/* Layout, navigation and record pages (2026-09-30, the founder: "you need to scroll all the way down to the
   notes"). Loaded after app.css and uses its tokens, so the dark theme follows; no colour of its own. */

/* ── the side navigation, in groups ─────────────────────────────────────────────────────────────────── */
.nav { gap: 10px; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-head {
  padding: 0 10px 2px; color: var(--muted); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase;
}
details.nav-more > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 6px; }
details.nav-more > summary::-webkit-details-marker { display: none; }
details.nav-more > summary::after { content: "▸"; font-size: 0.7rem; }
details.nav-more[open] > summary::after { content: "▾"; }
details.nav-more > summary:hover { color: var(--ink); }
details.nav-more[open] > summary { margin-bottom: 2px; }

@media (max-width: 980px) {
  /* one row that wraps (a laptop's half screen) or scrolls (a phone): the groups' items in it, no headings */
  .nav { flex-direction: row; gap: 2px; }
  .nav-group:not(details) { display: contents; }
  .nav-group:not(details) > .nav-head { display: none; }
  details.nav-more { display: flex; flex-direction: row; flex-wrap: wrap; gap: 2px; align-items: center; }
  details.nav-more > summary { padding: 8px 10px; font-size: 0.85rem; letter-spacing: normal; text-transform: none; }
}
@media (max-width: 560px) {
  details.nav-more { flex-wrap: nowrap; flex: none; }
  details.nav-more > summary { padding: 6px 9px; white-space: nowrap; }
}

/* ── the record's name and key actions in the sticky top bar ─────────────────────────────────────────── */
.top { flex-wrap: wrap; }
.entity-bar { order: 2; margin-left: auto; display: flex; align-items: center; gap: 6px; min-width: 0; }
.entity-bar-name {
  display: inline-flex; align-items: center; gap: 6px; min-width: 0; max-width: 260px; color: var(--ink);
  font-weight: 600;
}
.entity-bar-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entity-bar-name:hover { text-decoration: none; color: var(--accent-ink); }
/* with layout.js: only once the record's own header has scrolled away (no jump: it keeps its room) */
.layout-js .entity-bar:not(.shown) { visibility: hidden; }
@media (max-width: 980px) {
  .entity-bar-name { display: none; }
  .entity-bar .bar-label { display: none; }
}

/* ── folds: the log form, the call prep, a map ───────────────────────────────────────────────────────── */
details.log-fold > summary { list-style: none; width: fit-content; }
details.log-fold > summary::-webkit-details-marker { display: none; }
details.log-fold[open] > summary { margin-bottom: 10px; }
details.log-fold { scroll-margin-top: 80px; }

details.prep-fold > summary { cursor: pointer; list-style: none; flex-wrap: wrap; gap: 4px 12px; }
details.prep-fold > summary::-webkit-details-marker { display: none; }
details.prep-fold > summary h2::before { content: "▸ "; color: var(--muted); }
details.prep-fold[open] > summary h2::before { content: "▾ "; }
details.prep-fold:not([open]) > summary { margin-bottom: 0; }
.prep-last { font-size: 0.88rem; }

details.map-fold > summary { cursor: pointer; color: var(--ink-2); font-size: 0.88rem; margin: 2px 0 6px; }
details.map-fold > summary:hover { color: var(--ink); }

/* ── the "…" menu of a record's header ───────────────────────────────────────────────────────────────── */
.more-menu > summary { min-width: 2.4em; justify-content: center; font-weight: 700; letter-spacing: 0.08em; }
.menu-body { width: min(340px, calc(100vw - 32px)); max-height: 70vh; overflow: auto; }
.menu-body .action-link, .menu-body details.action > summary { display: flex; align-items: center; gap: 8px; }
/* the actions wrap in a row beside the name; the name keeps room enough not to break word by word */
.entity-title { flex: 1 1 260px; }
.entity-actions { flex: 0 1 600px; min-width: 0; flex-direction: row; flex-wrap: wrap; justify-content: flex-end; }
.entity-actions .scope { flex-basis: 100%; display: flex; justify-content: flex-end; }
@media (max-width: 560px) {
  .entity-actions { flex: 1 1 100%; max-width: none; justify-content: flex-start; }
  .entity-actions .scope { justify-content: flex-start; }
  .menu-body { right: auto; left: 0; }
}
