/* ═══════════════════════════════════════════════════════════════════════
   astrasera — Top navigation (top-nav.js)
   The sidebar's groups as a bar in the header, each opening a panel of its
   sections. Editorial grammar of the page: letterspaced caps like the
   sidebar's group labels, the current group underlined in ink, panels on
   a hairline with no radius.
   ═══════════════════════════════════════════════════════════════════════ */

/* The sidebar's room goes back to the page. (The selectors match the
   weight of the shell rules they replace; this sheet loads after them.) */
body.tn-on aside.hub-sidebar.tn-moved { display: none !important; }
body.tn-on:has(.hub-shell) .hub-shell .hub-main { margin-left: 0 !important; }
body.tn-on:has(.hub-shell) .hub-shell { grid-template-columns: 1fr !important; }
/* The brand is pinned at the left of the header (position: fixed, 44px
   in), out of the row: the bar starts after it. */
body.tn-on:has(.hub-shell) header.topbar.topbar { padding-left: 270px !important; position: relative; z-index: 300; }
/* Narrower: the enso alone carries the brand, as on the phone. */
@media (max-width: 1180px) {
  body.tn-on:has(.hub-shell) header.topbar.topbar { padding-left: 100px !important; }
  body.tn-on:has(.hub-shell) header.topbar .brand-name { display: none !important; }
  header.topbar .tn { gap: 0; }
  header.topbar .tn-btn { padding-left: 10px; padding-right: 10px; }
}
/* Narrower still: the bar takes a row of its own under the brand and the
   actions. */
@media (max-width: 1100px) {
  body.tn-on:has(.hub-shell) header.topbar.topbar { flex-wrap: wrap; row-gap: 14px; }
  header.topbar .tn { order: 3; flex: 1 0 100%; }
  header.topbar .nav-actions { margin-left: auto; }
}

/* Open Journal goes while the Journal is open (top-nav.js). */
body.tn-on header.topbar .tn-gone { display: none !important; }

/* the sidebar's buttons under the person's name, dressed as the dropdown's own rows */
.user-dropdown .dropdown-item.sidebar-item, .user-dropdown .dropdown-item.sidebar-item.active { display: flex; align-items: center; gap: 12px; width: 100%; margin: 0; padding: 10px 12px; border: 0; border-radius: 0; background: transparent; color: var(--ink); font-family: var(--sans); font-size: 13.5px; font-weight: 400; text-align: left; box-shadow: none; }
.user-dropdown .dropdown-item.sidebar-item:hover { background: var(--surface); }
.user-dropdown .dropdown-item.sidebar-item .si-icon { width: 20px; font-size: 15px; text-align: center; color: inherit; opacity: 1; }
.user-dropdown .dropdown-item.sidebar-item .si-label { flex: 1; }
.user-dropdown .dropdown-item.sidebar-item .sidebar-badge { margin-left: auto; }

/* ── The bar ──────────────────────────────────────────────── */

.tn {
  flex: 1;
  display: flex;
  justify-content: center;
  gap: var(--as-space-2, 8px);
  min-width: 0;
}

.tn-cell { position: relative; }

.tn-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px 9px;
  background: none;
  border: 0;
  border-bottom: 1.5px solid transparent;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  transition: color var(--as-transition, 220ms ease), border-color var(--as-transition, 220ms ease);
}
.tn-btn i { font-size: 10px; transition: transform var(--as-transition, 220ms ease); }
.tn-btn:hover,
.tn-cell.is-open .tn-btn { color: var(--ink); }
.tn-cell.is-open .tn-btn i { transform: rotate(180deg); }
.tn-cell.is-current .tn-btn { color: var(--ink); border-bottom-color: var(--ink); }
.tn-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── A group's panel ──────────────────────────────────────── */

.tn-panel {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  z-index: 400;
  min-width: 250px;
  padding: 6px;
  background: var(--card, var(--bg));
  border: 1px solid var(--border);
  box-shadow: 0 8px 28px rgba(27, 27, 27, 0.12);
}
.tn-panel[hidden] { display: none; }
/* The last group (Account) opens towards the page, not off its edge. */
.tn-cell:last-child .tn-panel { left: auto; right: 0; }

.tn-rule { height: 1px; margin: 6px 8px; background: var(--border); }

/* The sidebar's buttons, in the panel's light. */
body.tn-on .tn-panel .sidebar-item {
  display: flex !important;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px !important;
  margin: 0 !important;
  background: none !important;
  border: 0 !important;
  border-radius: 0 !important;
  color: var(--ink-soft, var(--ink)) !important;
  font-family: var(--sans);
  font-size: 14px !important;
  font-weight: 400 !important;
  letter-spacing: 0 !important;
  text-align: left;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--as-transition, 220ms ease), color var(--as-transition, 220ms ease);
}
/* The buttons the dashboard keeps hidden (by plan) stay hidden. */
body.tn-on .tn-panel .sidebar-item[style*="display:none"],
body.tn-on .tn-panel .sidebar-item[style*="display: none"] { display: none !important; }
body.tn-on .tn-panel .sidebar-item::before,
body.tn-on .tn-panel .sidebar-item::after { display: none !important; }
body.tn-on .tn-panel .sidebar-item:hover { background: var(--surface) !important; color: var(--ink) !important; }
body.tn-on .tn-panel .sidebar-item.active { background: var(--surface) !important; color: var(--ink) !important; font-weight: 500 !important; }
body.tn-on .tn-panel .sidebar-item .si-icon { display: flex; width: 18px; justify-content: center; color: var(--muted); font-size: 15px; }
body.tn-on .tn-panel .sidebar-item.active .si-icon { color: var(--ink); }
body.tn-on .tn-panel .sidebar-item .si-label { display: inline !important; opacity: 1 !important; width: auto !important; color: inherit !important; }
body.tn-on .tn-panel .sidebar-item .sidebar-badge {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--as-radius-round, 999px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 500;
  color: #fff;
  background: var(--muted);
}
body.tn-on .tn-panel .sidebar-item .sidebar-badge[style*="display:none"],
body.tn-on .tn-panel .sidebar-item .sidebar-badge[style*="display: none"] { display: none !important; }
body.tn-on .tn-panel .sidebar-item .sidebar-badge.amber { background: var(--amber, #b98a3e); }
