/* topbar.css — the app header.
   r1 (2026-09-18): one account control (the avatar) opens the account menu; the
   hamburger is gone; Dashboard is an icon.
   r2 (2026-09-18, owner's UX feedback): the header is a bar, not a row of boxed
   buttons. Glyph icons with a circular press state, unread badges on the glyphs,
   a circular avatar, a 64px bar with one hairline, the current screen marked by
   a red glyph and a short bar. The account menu opens with the agent's name and
   plan and closes with Sign out.

   A layer linked after layout.css and auth.css, so it wins the cascade over
   styles.css -> premium-product.css -> mobile-fixes.css -> legibility.css.
   Selectors carry at least the weight of mobile-fixes' body:not(.auth-active) rules.
   To revert: restore the previous index.html/app.js and drop this <link>. */

:root {
  /* The bar's own height plus the device's top inset (0 where the shell insets). */
  --rcr-header-h: calc(64px + env(safe-area-inset-top, 0px));
  --rcr-header-glyph: 22px;
}

/* ----------------------------------------------------------- the bar */

.topbar,
body:not(.auth-active) .topbar {
  box-sizing: border-box;
  height: var(--rcr-header-h);
  padding: env(safe-area-inset-top, 0px) 6px 0 16px;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

body:not(.auth-active) {
  padding-top: var(--rcr-header-h);
}

.topbar .brand,
body:not(.auth-active) .topbar .brand {
  width: auto;
  height: 40px;
  display: grid;
  place-items: center start;
}

.topbar .brand img,
body:not(.auth-active) .topbar .brand img {
  max-height: 34px;
  width: auto;
}

.topbar .top-actions,
body:not(.auth-active) .topbar .top-actions {
  gap: 0;
  align-items: center;
}

/* ----------------------------------------------------------- icons */

/* 44px hit area, glyph only; a circular tint on hover/press. */
.topbar .top-actions .header-icon,
body:not(.auth-active) .topbar .top-actions .header-icon {
  position: relative;
  width: var(--rcr-tap, 44px);
  min-width: var(--rcr-tap, 44px);
  height: var(--rcr-tap, 44px);
  flex: 0 0 var(--rcr-tap, 44px);
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  color: var(--ink);
  font-size: 0;
  letter-spacing: 0;
  cursor: pointer;
}

.topbar .top-actions .header-icon svg {
  width: var(--rcr-header-glyph);
  height: var(--rcr-header-glyph);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Press tint everywhere; hover tint only where a pointer can hover, so a tap on
   a phone never leaves a tint behind. Both carry the base rule's weight. */
.topbar .top-actions .header-icon:active,
body:not(.auth-active) .topbar .top-actions .header-icon:active {
  background: var(--stone);
  box-shadow: none;
}

@media (hover: hover) {
  .topbar .top-actions .header-icon:hover,
  body:not(.auth-active) .topbar .top-actions .header-icon:hover {
    background: var(--stone);
    box-shadow: none;
  }
}

/* Unread counts sit on the glyph's shoulder. */
#messageCenter[data-unread]:not([data-unread=""])::after,
#notificationCenter[data-unread]:not([data-unread=""])::after {
  top: 5px;
  right: 4px;
}

/* Current screen: red glyph, short bar beneath. Nothing filled, nothing boxed. */
.topbar .top-actions .dashboard-button.active,
body:not(.auth-active) .topbar .top-actions .dashboard-button.active {
  background: transparent;
  border: 0;
  color: var(--red);
}

.topbar .top-actions .dashboard-button.active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 4px;
  width: 18px;
  height: 3px;
  margin-left: -9px;
  border-radius: 2px;
  background: var(--red);
}

/* ----------------------------------------------------------- avatar */

.topbar .header-menu-wrap {
  margin-left: 6px;
}

.topbar .header-menu-wrap .avatar,
body:not(.auth-active) .topbar .header-menu-wrap .avatar {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  padding: 0;
  border: 0;
  border-radius: 50% !important;
  background: var(--ink);
  color: #fff;
  font: 700 13px/1 "Manrope", sans-serif;
  letter-spacing: .04em;
  box-shadow: 0 0 0 1px rgba(20, 30, 36, .08), 0 1px 2px rgba(20, 30, 36, .12);
  cursor: pointer;
  justify-self: auto;
  overflow: hidden;
}

.topbar .header-menu-wrap .avatar[aria-expanded="true"],
body:not(.auth-active) .topbar .header-menu-wrap .avatar[aria-expanded="true"] {
  box-shadow: 0 0 0 2px var(--card, #fff), 0 0 0 4px var(--red);
}

/* ----------------------------------------------------------- the account menu */

.header-menu {
  top: calc(100% + 8px);
  width: 264px;
  padding: 6px;
  border-radius: 16px;
}

.header-menu-identity {
  padding: 10px 12px 8px;
}

.header-menu-identity strong {
  display: block;
  font: 700 14px/1.25 "Manrope", sans-serif;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.header-menu-identity span {
  display: block;
  margin-top: 3px;
  font: 700 11px/1.3 "Manrope", sans-serif;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--red);
}

.header-menu-identity[hidden] {
  display: none;
}

.header-menu-separator {
  height: 1px;
  margin: 4px 6px;
  background: var(--line);
}

.header-menu button {
  font: 600 13px/1.2 "Manrope", sans-serif;
  letter-spacing: 0;
  text-transform: none;
}

.header-menu .header-menu-signout {
  color: var(--muted);
}

html[data-theme="dark"] .topbar .header-menu-wrap .avatar {
  background: #f5f6f7;
  color: #14171a;
}

/* ------------------------------------------- Android shell (r3, 2026-09-24)
   The Android shell reserves the status bar and cutout itself (root padding in
   MainActivity) and, from build 27, consumes those insets so the WebView reports
   env(safe-area-inset-top) as 0. Build 26 and earlier let the insets through, so
   the header carried a second status-bar height of padding above the logo (owner's
   screenshot, My listings). Pin the header to 64px on Android whatever the WebView
   reports; iOS keeps the additive form because there the web layer owns the inset. */
html.rcr-native-android {
  --rcr-header-h: 64px;
}

html.rcr-native-android .topbar,
html.rcr-native-android body:not(.auth-active) .topbar {
  padding-top: 0;
}

