/* library area styles, app 10x pass, 20 Nov 2026. Owned by the library agent.
   Notes, Sources, Repos and Graph polish. Uses the shared tokens in app.css only. */

/* ---------- shared bits ---------- */
.seg button[aria-pressed="true"], .seg a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line), var(--shadow-1); }
.seg a { display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-3); font-weight: 500; padding: 5px 14px; border-radius: var(--r-sm); color: var(--muted); text-decoration: none; }
.seg a:hover { color: var(--ink); }
.seg a .ico { width: 14px; height: 14px; }
.lib-banner { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-4); margin: 0 0 var(--s-4); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); box-shadow: var(--shadow-1); font-size: var(--t-3); color: var(--muted); }
.lib-banner > .ico { color: var(--blue-text); flex: none; }
.lib-banner p { flex: 1; min-width: 0; text-wrap: pretty; }
.lib-banner b { color: var(--ink); font-weight: 600; }
.lib-banner .btn { flex: none; }
mark { background: var(--blue-soft); color: var(--blue-ink); border-radius: 3px; padding: 0 1px; }

/* ---------- notes ---------- */
.lib-notes { max-width: var(--page-wide); }
.lib-toolbar { gap: var(--s-2) 10px; margin-bottom: var(--s-1); }
.lib-toolbar .tb-sort, .lib-toolbar .tb-repo { flex: none; }
.lib-view { margin-left: auto; }
.lib-split { display: block; }
.lib-panel[hidden] { display: none; }

/* The hover band sits flush with the list edges. Content pads inside it. */
.lib-notes .nrow { margin: 0; padding: var(--s-4) var(--s-3); border-radius: 0; }
.lib-notes .ng-h { padding-inline: var(--s-3); }
.lib-notes .nrow.is-open { background: var(--blue-soft); box-shadow: inset 0 0 0 1px var(--blue-line); border-bottom-color: transparent; border-radius: var(--r-sm); }
.lib-notes .nrow.is-open .nr-title { color: var(--blue-ink); }
/* The copy button stays visible for touch and keyboard users, quieter at rest. */
.lib-notes .nr-side .btn-icon.lib-copy { opacity: .6; }
.lib-notes .nrow:hover .lib-copy, .lib-notes .nrow:focus-within .lib-copy, .lib-notes .lib-copy:focus-visible { opacity: 1; }
.lib-more { padding: var(--s-4) var(--s-3); }

@media (min-width: 1100px) {
  .lib-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 400px); gap: var(--s-6); align-items: start; }
  .lib-panel { position: sticky; top: var(--s-5); margin-top: var(--s-5); max-height: calc(100vh - 48px); overflow: auto; overscroll-behavior: contain; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-2); padding: var(--s-5); }
  .lib-notes .nr-idea { -webkit-line-clamp: 2; }
  .lib-notes .nrow.is-open .nr-idea { display: -webkit-box; -webkit-line-clamp: 2; color: var(--muted); }
}
.lib-pick { color: var(--muted); font-size: var(--t-3); }

/* the reader: a note as formatted text */
.lib-reader { display: grid; gap: var(--s-3); min-width: 0; }
.lib-from { display: flex; align-items: flex-start; gap: var(--s-2); font-size: var(--t-3); color: var(--muted); }
.lib-from .fav, .lib-from .fav-fb { margin-top: 1px; }
.lib-from b { color: var(--ink); font-weight: 600; }
.lib-from a { color: var(--blue-deep); text-underline-offset: 3px; }
.lib-rtitle { font-size: var(--t-6); line-height: 1.2; letter-spacing: -0.02em; font-weight: 650; text-wrap: balance; }
.lib-rel { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); font-size: var(--t-3); color: var(--muted); }
.lib-rel .rel { font-size: var(--t-1); padding: 2px 8px 2px 6px; }
.lib-rel a { color: var(--blue-deep); font-weight: 500; text-underline-offset: 3px; }
.lib-rel b { color: var(--ink); font-weight: 600; }
.lib-idea { font-size: var(--t-4); line-height: 1.6; color: var(--ink); max-width: 65ch; text-wrap: pretty; }
.lib-why { border-top: 1px solid var(--line); padding-top: var(--s-3); }
.lib-why h3 { font-size: var(--t-2); font-weight: 600; color: var(--muted); margin-bottom: 2px; }
.lib-why p { font-size: var(--t-3); line-height: 1.6; max-width: 65ch; text-wrap: pretty; }
.lib-fm { margin: 0; display: grid; gap: 6px; padding: var(--s-3); background: var(--sunk); border-radius: var(--r-md); font-size: var(--t-2); }
.lib-fm div { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: var(--s-3); }
.lib-fm dt { color: var(--muted); }
.lib-fm dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }
.lib-fm dd a { color: var(--blue-deep); text-underline-offset: 3px; }
.lib-ractions { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.lib-raw summary { font-size: var(--t-2); color: var(--muted); cursor: pointer; width: fit-content; padding: 4px 0; }
.lib-raw summary:hover { color: var(--ink); }
.lib-raw .md { max-height: 320px; overflow: auto; font-size: var(--t-1); margin-top: var(--s-2); }
.lib-inline { margin-top: var(--s-4); padding-top: var(--s-4); border-top: 1px solid var(--blue-line); }

/* empty state with an example row */
.lib-empty { display: grid; gap: var(--s-3); justify-items: start; max-width: 560px; padding-top: var(--s-5); }
.lib-empty-cap { display: flex; align-items: center; gap: var(--s-2); font-size: var(--t-2); color: var(--muted); }
.lib-example { width: 100%; border: 1px dashed var(--line-strong); border-radius: var(--r-md); margin: 0 0 var(--s-4); padding: var(--s-4) !important; background: var(--surface); opacity: .8; pointer-events: none; }
.lib-example .nr-title { font-size: var(--t-4); font-weight: 600; }
.lib-date { font-family: var(--mono); font-size: var(--t-1); color: var(--faint); }
.lib-empty h2 { font-size: var(--t-7); letter-spacing: -0.03em; }
.lib-empty > p { color: var(--muted); font-size: var(--t-4); text-wrap: pretty; }

@media (max-width: 760px) {
  .lib-view { margin-left: 0; }
  .lib-toolbar .tb-sort, .lib-toolbar .tb-repo { flex: 1 1 140px; min-width: 0; }
  .lib-banner { flex-wrap: wrap; }
  .lib-notes .nrow { padding-inline: var(--s-2); }
  .lib-notes .nr-side .btn-icon.lib-copy { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .lib-notes .nrow { transition: none; }
}

/* ---------- sources ---------- */
/* Rows cap at 720px, so the switch sits near the name it controls. */
.lib-sources .src-list, .lib-sources .lib-add, .lib-sources .lib-chips, .lib-sources .lib-cap, .lib-sources .lib-fwd-line { max-width: 720px; }
.lib-sources .sec-row { max-width: 720px; }
.lib-add { margin-bottom: var(--s-6); }
.lib-hint { font-size: var(--t-2); color: var(--muted); margin-top: 6px; }
.lib-hint[data-kind="feed"], .lib-hint[data-kind="page"] { color: var(--blue-ink); }
.lib-hint[data-kind="bad"] { color: var(--amber-ink); }
.lib-add .form-msg:empty { display: none; }
.lib-add .form-msg { font-size: var(--t-3); margin-top: var(--s-2); }
.lib-add .form-msg.is-busy { color: var(--muted); font-variant-numeric: tabular-nums; }
.lib-add .form-msg.is-ok { color: var(--green); }
.lib-add .form-msg.is-bad { color: var(--red); }
.lib-add .form-msg a { color: var(--blue-deep); font-weight: 500; }
.lib-row { gap: 2px var(--s-4); }
.lib-row .s-name { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px var(--s-2); font-size: var(--t-4); }
.lib-row .s-name .lib-by { margin: 0; font-weight: 400; color: var(--muted); font-size: var(--t-3); }
.lib-row .s-name .lib-own { margin: 0; align-self: center; color: var(--blue-ink); background: var(--blue-soft); }
.lib-latest { display: flex; align-items: baseline; gap: var(--s-2); font-size: var(--t-3); color: var(--ink); margin-top: 2px; min-width: 0; }
.lib-latest a { color: inherit; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.lib-latest a:hover { text-decoration: underline; text-underline-offset: 3px; }
.lib-latest .lib-ldate { font-size: var(--t-2); color: var(--muted); flex: none; }
.lib-latest.lib-url { font-size: var(--t-2); color: var(--muted); overflow-wrap: anywhere; }
.lib-gave { color: var(--ink); font-variant-numeric: tabular-nums; }
.lib-fix { font-size: var(--t-2); color: var(--red); margin-top: var(--s-1); }
.lib-fix .link-btn { color: var(--blue-deep); font-weight: 500; }
.lib-cap { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; padding: 10px var(--s-3); margin: var(--s-2) 0; border-radius: var(--r-md); background: var(--amber-soft); color: var(--amber-ink); font-size: var(--t-3); font-weight: 500; }
.lib-cap .link-btn { color: var(--blue-deep); margin-left: auto; }
.lib-topics { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.lib-tchip { display: inline-flex; align-items: center; gap: 4px; font-size: var(--t-1); color: var(--muted); background: var(--sunk); border-radius: var(--r-xs); padding: 1px 7px; }
.lib-tchip.is-hit { color: var(--blue-ink); background: var(--blue-soft); }
.lib-tchip .ico { width: 11px; height: 11px; }
.lib-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: var(--s-2) 0 var(--s-3); }
.lib-chip { font: inherit; font-size: var(--t-2); font-weight: 500; padding: 4px 12px; min-height: 30px; border-radius: var(--r-pill); border: 1px solid var(--line-strong); background: var(--surface); color: var(--muted); cursor: pointer; transition: border-color var(--dur-1), color var(--dur-1), background var(--dur-1); }
.lib-chip:hover { color: var(--ink); border-color: var(--ink); }
.lib-chip[aria-pressed="true"] { background: var(--inverse); border-color: var(--inverse); color: var(--on-inverse); }
.lib-why-list { font-size: var(--t-2); color: var(--muted); margin-bottom: var(--s-1); }
.lib-nomatch { display: grid; gap: 6px; padding: var(--s-5) 0; color: var(--muted); font-size: var(--t-3); }
.lib-nomatch b { color: var(--ink); }
.lib-nomatch-a { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-1); }
.lib-sources .lib-more { padding-inline: 0; }
.lib-fwd-off { margin-top: var(--s-6); }
.lib-fwd-line { display: flex; align-items: baseline; gap: var(--s-3); font-size: var(--t-3); color: var(--muted); padding-top: var(--s-4); border-top: 1px solid var(--line); text-wrap: pretty; }
.lib-fwd-line b { color: var(--ink); font-weight: 600; }
.lib-fwd-line .tag { flex: none; }
.lib-inbox { margin: 10px 0 14px; }
.lib-toast { display: flex; align-items: center; gap: var(--s-4); }
.lib-undo { font: inherit; font-size: var(--t-3); font-weight: 600; color: var(--on-inverse); background: none; border: 0; padding: 4px 6px; margin: -4px -6px -4px auto; border-radius: var(--r-xs); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.lib-undo:focus-visible { outline: 2px solid var(--on-inverse); outline-offset: 2px; }
@media (max-width: 600px) {
  .lib-row .s-name { flex-direction: column; gap: 0; }
  .lib-row .s-name .lib-own { align-self: flex-start; margin-top: 2px; }
  .lib-chip { flex: none; min-height: 36px; }
  .lib-cap .link-btn { margin-left: 0; }
}
.lib-sources .head { max-width: 720px; }


/* ---------- notes and sources: phone and edge rules, unchanged ---------- */
@media (max-width: 600px) {
  .lib-row.is-broken { grid-template-columns: 28px minmax(0, 1fr); }
  .lib-row.is-broken .s-end { grid-column: 2; }
}
@media (max-width: 760px) {
  .lib-toolbar .tb-repo .input, .lib-toolbar .tb-sort .input { width: 100%; }
  .lib-toolbar .tb-repo { max-width: calc(50% - 5px); }
}
@media (max-width: 600px) { .lib-sources .sec-row .search { flex: 1 1 100%; } }
.lib-sources #h-fol + .count-pill { margin-left: auto; }
a.goes.none { text-decoration: underline; text-underline-offset: 3px; }
.lib-row.is-broken .s-end { flex-wrap: wrap; justify-content: flex-end; }
select.input { text-overflow: ellipsis; }
@media (max-width: 600px) {
  .lib-add .row { flex-wrap: nowrap; }
  .lib-add .row .input { flex: 1 1 auto; min-width: 0; }
  .lib-add .row .btn { width: auto; flex: none; }
  .lib-row .s-name { flex-direction: row; flex-wrap: wrap; column-gap: var(--s-2); }
  .lib-row .s-name .lib-by { flex-basis: 100%; }
}
@media (max-width: 600px) {
  .lib-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
}

/* ---------- repos, distilled 20 Nov 2026 ---------- */
/* One repo reads top to bottom: name, what it reads, where it writes, the last pull request. One column, hairlines between. */
.lib-repos .repos { margin-bottom: var(--s-7); }
.lib-repos .repo { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-3); padding: var(--s-5) 0; }
.lib-repos .repos > .repo:last-child { border-bottom: 0; }
.lib-repos .repo.is-missing { padding-inline: var(--s-4); }
.r-head { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s-2) var(--s-3); min-height: 36px; }
.lib-repos .r-title { flex: 1 1 auto; min-width: 0; margin: 0; display: flex; align-items: center; gap: 10px; font-size: var(--t-4); font-weight: 600; letter-spacing: 0; }
.lib-repos .r-title > .ico { color: var(--muted); }
.r-name { color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
a.r-name:hover { text-decoration: underline; text-underline-offset: 3px; }
.lib-repos .r-side { display: flex; align-items: center; gap: var(--s-2); margin-left: auto; }
.rp-path { margin: 0; display: grid; gap: var(--s-2); }
.rp-row { display: grid; grid-template-columns: 148px minmax(0, 1fr); gap: var(--s-1) var(--s-4); align-items: baseline; font-size: var(--t-3); }
.rp-row dt { color: var(--muted); font-size: var(--t-2); font-weight: 500; }
.rp-row dd { margin: 0; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); line-height: 1.5; }
.rp-txt { color: var(--muted); }
.rp-txt .mono { font-size: var(--t-2); color: var(--ink); }
.rp-chips { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.rp-chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: var(--r-sm); background: var(--sunk); color: var(--ink); font-size: var(--t-2); line-height: 20px; }
.rp-chip .ico { width: 13px; height: 13px; color: var(--muted); }
.rp-chip .mono { font-size: var(--t-2); }
.rp-chip.is-out { color: var(--muted); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.rp-skip { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px; color: var(--muted); font-size: var(--t-2); }
.rp-connect { flex: none; }
.repo .fp-host:not(:empty) { margin-top: var(--s-1); }
/* one link style on the page: the shared .link, blue and underlined */
.lib-repos .link { font-size: inherit; font-weight: 500; }
.lib-auth { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; font-size: var(--t-2); color: var(--muted); }
.lib-auth li { display: grid; grid-template-columns: 16px auto minmax(0, 1fr); gap: var(--s-2); align-items: baseline; }
.lib-auth li b { font-weight: 500; color: var(--muted); }
.lib-auth li.is-on b { color: var(--ink); font-weight: 600; }
.lib-auth li.is-on .ico { color: var(--green); width: 14px; height: 14px; align-self: center; }
.lib-auth-dot { width: 6px; height: 6px; border-radius: 50%; border: 1px solid var(--line-strong); justify-self: center; align-self: center; }
.lib-confirm { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); padding: 10px var(--s-3); border-radius: var(--r-md); background: var(--red-soft); color: var(--ink); font-size: var(--t-3); }
.lib-confirm > span { flex: 1 1 240px; }
.lib-danger { background: var(--red-fill); color: var(--on-accent); }
.lib-danger:hover:not(:disabled) { background: var(--red-fill); filter: brightness(.92); }

/* pull requests: plain rows, the same link style as the repo rows */
.lib-repos .pr-list { gap: 0; border-top: 1px solid var(--line); }
.lib-repos .pr-list li { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: var(--s-3) 0; }
.lib-repos .pr-list li .pr-top { gap: var(--s-2) var(--s-3); font-size: var(--t-3); }
.lib-repos .pr-list li .pr-top > .ico { color: var(--muted); }
.lib-repos .pr-list li.failed { border: 0; border-radius: var(--r-md); background: var(--red-soft); padding: var(--s-3) var(--s-4); margin-block: var(--s-1); }
.pr-meta { color: var(--muted); font-size: var(--t-2); }
.pr-meta time { margin: 0 !important; font-size: inherit !important; }
.pr-top .mono { font-family: var(--font); font-weight: 500; color: var(--muted); letter-spacing: 0; }
.lib-expr { margin-top: var(--s-3); padding: var(--s-4); border: 1px dashed var(--line-strong); border-radius: var(--r-md); background: var(--surface); color: var(--muted); display: grid; gap: var(--s-2); max-width: 560px; }
.lib-expr-top { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s-2); font-size: var(--t-3); }
.lib-expr-top b { color: var(--ink); font-weight: 600; }
.lib-merged { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; font-size: var(--t-1); font-weight: 600; padding: 2px 8px; border-radius: var(--r-pill); background: var(--sunk); color: var(--muted); }
.lib-merged .ico { width: 12px; height: 12px; }
.lib-expr-branch { font-size: var(--t-1); }
.lib-expr-files { list-style: none; margin: 0; padding: var(--s-2) var(--s-3); background: var(--sunk); border-radius: var(--r-sm); font-size: var(--t-1); display: grid; gap: 4px; overflow-wrap: anywhere; }
.lib-expr-files .ico { width: 12px; height: 12px; color: var(--faint); }
.lib-expr-foot { font-size: var(--t-2); }

/* the map: newsletter and repo cards capped at a readable width, lines across the middle, no grid texture */
.lib-map-hint { margin: -6px 0 var(--s-3); font-size: var(--t-2); }
.lib-repos .graph { grid-template-columns: minmax(0, 300px) minmax(0, 300px); justify-content: space-between; background-image: none; padding: var(--s-5); }
.lib-repos .g-right { display: flex; flex-direction: column; gap: var(--s-3); }
.lib-repos .g-right > .g-cap { margin-bottom: 0; }
.lib-repos .g-right > .g-cap + .grepo { margin-top: auto; }
.lib-repos .g-right > .grepo:last-child { margin-bottom: auto; }
.g-right .grepo { min-height: 56px; }
.gn-name.mono, .grid thead th .mono, .g-detail .mono { font-family: var(--font); font-weight: 600; letter-spacing: 0; }
.gn-flag:not(.bad), .g-none:not(.g-bad) { color: var(--muted); background: var(--sunk); }
.gn-flag.bad .ico { width: 12px; height: 12px; vertical-align: -2px; }
.g-none.g-bad { color: var(--red); background: var(--red-soft); display: inline-flex; align-items: center; gap: 4px; }
.g-none.g-bad .ico { width: 11px; height: 11px; }
.gsrc.is-loose .port-r { border-style: solid; border-color: var(--line-strong); background: var(--sunk); }
.g-hint:empty { display: none; }
.edge.feed-bad { stroke: var(--red); stroke-dasharray: 5 4; }
.gnode:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { .edge, .end, .gnode { transition: none !important; } }
@media (max-width: 760px) { .lib-repos .graph { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }

@media (max-width: 600px) {
  .r-head { flex-wrap: wrap; }
  .lib-repos .r-side { width: 100%; justify-content: space-between; margin-left: 0; }
  .lib-repos .r-side:not(:has(.mini-switch)) { justify-content: flex-end; }
  /* A repo with only the More menu keeps it on the title row. The tag wraps under the name instead. */
  .r-head:has(.r-side > details.menu:only-child) { flex-wrap: nowrap; align-items: flex-start; }
  .lib-repos .r-head:has(.r-side > details.menu:only-child) .r-title { flex-wrap: wrap; row-gap: var(--s-1); }
  .lib-repos .r-side:has(> details.menu:only-child) { width: auto; flex: none; }
  .rp-row { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .rp-connect { width: 100%; }
  .lib-repos .pr-list li .pr-top { display: grid; grid-template-columns: 20px minmax(0, 1fr); row-gap: 2px; }
  .lib-repos .pr-list li .pr-top > .pr-meta { grid-column: 2; }
  /* phone table: headers on one line with no hyphen break, the full name in the title */
  .grid thead th { white-space: normal; }
  .grid thead th:not(:first-child) { width: 92px; max-width: 92px; padding-inline: 6px; white-space: nowrap; }
  .grid thead th .mono { display: block; max-width: 86px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; overflow-wrap: normal; word-break: keep-all; hyphens: none; margin-inline: auto; font-size: var(--t-1); line-height: 1.25; }
  .g-src { display: grid; grid-template-columns: 20px minmax(0, 1fr); column-gap: 10px; row-gap: 4px; align-items: center; }
  .g-src .g-none { grid-column: 2; justify-self: start; }
}

/* ---------- graph, distilled 20 Nov 2026 ---------- */
/* Three controls in the bar: the mode switch, search, and one View menu. Folder colors and their filter live in the key under the map. */
.gv-bar { gap: var(--s-2); }
/* One control height across the bar: the mode switch, the search field and More all sit at 36px, 44px on touch. */
.gv-bar .seg, .gv-bar .gv-search .input { height: var(--h-md); box-sizing: border-box; }
.gv-bar .gv-search .input { padding-top: 0; padding-bottom: 0; }
.gv-bar .seg button { padding-top: 0; padding-bottom: 0; }
@media (max-width: 820px), (pointer: coarse) { .gv-bar .seg, .gv-bar .gv-search .input { height: var(--h-lg); } }
.gv-mode { flex: none; }
.gv-mode button { white-space: nowrap; }
.gv-open-map { display: none; }
.gv-filters { margin-left: auto; }
.gv-filters .gv-pop { left: auto; right: 0; }
.gv-full-only[hidden] { display: none !important; }
.gv-pop-act { font: inherit; font-size: var(--t-3); display: flex; align-items: center; gap: 9px; width: 100%; min-height: 36px; padding: 0 6px; border: 0; border-radius: var(--r-sm); background: none; color: var(--ink); cursor: pointer; text-align: left; }
.gv-pop-act:hover { background: var(--hover); }
.gv-pop-act:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.gv-pop-act > .ico { width: 15px; height: 15px; color: var(--muted); }
.gv-pop-act .num { margin-left: auto; color: var(--faint); font-size: var(--t-1); }
.gv-pop-act[aria-pressed="true"] { color: var(--blue-ink); background: var(--blue-soft); }
.gv-pop .gv-switch-row { border-bottom: 0; }

.gv-page .gv-frame { box-shadow: none; overflow: hidden; margin-bottom: 0; }
.gv-page .gv-frame canvas { border-radius: inherit; }
.gv-ov-bar { display: none; }
.gv-tap[hidden] { display: none; }

/* the key: one quiet row under the canvas. A folder you hid stays in the row, faded and struck through. */
.gv-page .gv-legend { position: static; margin-top: var(--s-3); pointer-events: auto; }
.gv-page .gv-legend ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-2); background: none; border: 0; }
.gv-key { font: inherit; font-size: var(--t-2); display: inline-flex; align-items: center; gap: 7px; min-height: 30px; padding: 0 10px; border: 1px solid transparent; border-radius: var(--r-pill); background: none; color: var(--muted); }
button.gv-key { cursor: pointer; border-color: var(--line); color: var(--ink); }
button.gv-key:hover { background: var(--hover); }
button.gv-key:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
button.gv-key[aria-pressed="false"] { color: var(--faint); border-style: dashed; }
button.gv-key[aria-pressed="false"] > span:not(.num) { text-decoration: line-through; }
button.gv-key[aria-pressed="false"] .gv-sw, button.gv-key[aria-pressed="false"] .gv-dot { opacity: .35; }
.gv-key .num { color: var(--faint); font-size: var(--t-1); }
.gv-sw { width: 9px; height: 9px; border-radius: 50%; }
.gv-page .gv-dot.gv-new { border-radius: 2px; padding: 0; }
.gv-dot.gv-topic { box-shadow: inset 0 0 0 2px var(--g-topic); }

/* side panel */
.gv-p-head { justify-content: space-between; align-items: center; gap: var(--s-2); padding: var(--s-2) var(--s-2) 0 var(--s-4); }
.gv-p-head .btn:only-child { margin-left: auto; }
.gv-p-head .btn .ico { width: 14px; height: 14px; }
.gv-p-head + .gv-p-body { padding-top: var(--s-3); }
.gv-panel::after { content: ""; position: sticky; bottom: 0; display: block; height: 36px; margin-top: -36px; background: linear-gradient(to bottom, transparent, var(--surface)); pointer-events: none; }
.gv-nb { min-height: 34px; }
.gv-nb .gv-nb-t { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gv-nb .gv-nb-f { flex: none; margin-left: auto; font-size: var(--t-1); color: var(--faint); }
.gv-nb > .ico { flex: none; width: 14px; height: 14px; color: var(--faint); opacity: 0; transition: opacity var(--dur-1) var(--ease); }
.gv-nb .gv-nb-t + .ico { margin-left: auto; }
.gv-nb:hover > .ico, .gv-nb:focus-visible > .ico { opacity: 1; }
.gv-nb:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.gv-p-sec h3 .gv-all { margin-left: auto; font-weight: 500; font-size: var(--t-2); margin-top: 0; }
.gv-all { font-size: var(--t-2); justify-self: start; color: var(--blue-deep); }
.gv-more { font: inherit; font-size: var(--t-2); font-weight: 500; color: var(--blue-deep); background: none; border: 0; padding: 6px 0; cursor: pointer; justify-self: start; text-align: left; }
.gv-more:hover { text-decoration: underline; text-underline-offset: 3px; }
.gv-more:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-xs); }
a.gv-p-path { display: inline; color: var(--muted); text-decoration: none; word-break: normal; overflow-wrap: anywhere; }
a.gv-p-path:hover { color: var(--blue-deep); text-decoration: underline; text-underline-offset: 3px; }
a.gv-p-path .ico { display: inline-block; width: 12px; height: 12px; vertical-align: -1px; margin-left: 2px; }
.gv-chip { color: var(--blue-ink); background: var(--blue-soft); }
.gv-chip:hover { background: var(--blue-soft); box-shadow: inset 0 0 0 1px var(--blue); }

/* phone one-note view: the note, then every link as a 44px row */
.gv-local[hidden] { display: none; }
.gv-local { margin-top: var(--s-4); }
.gv-l-body { padding: 0; gap: var(--s-3); }
.gv-l-body h2 { font-size: var(--t-6); line-height: 1.2; }
.gv-l-body .gv-p-sec { padding-top: var(--s-3); }
.gv-l-body .gv-p-sec h3 { font-size: var(--t-2); }
.gv-l-body .gv-nbs { position: relative; padding-left: 14px; gap: 0; }
.gv-l-body .gv-nbs::before { content: ""; position: absolute; left: 4px; top: 0; bottom: 22px; width: 1px; background: var(--line-strong); }
.gv-l-body .gv-nbs > li { position: relative; }
.gv-l-body .gv-nbs > li::before { content: ""; position: absolute; left: -10px; top: 50%; width: 9px; border-top: 1px solid var(--line-strong); }
.gv-l-body .gv-nb { min-height: 44px; margin: 0; padding: 0 var(--s-2); }
.gv-l-body .gv-nb > .ico { opacity: 1; }
.gv-l-body .gv-ideas { gap: var(--s-2); }
.gv-l-body .btn { width: auto; }
.gv-page .gv-local .gv-l-body > a.btn { width: auto; justify-self: start; align-self: flex-start; }

@media (max-width: 820px) {
  .gv-page .gv-panel { max-height: 44%; }
  .gv-page .gv-p-body { display: flex; flex-direction: column; }
  .gv-page .gv-p-body > * { order: 3; }
  .gv-page .gv-p-body > .gv-p-kind, .gv-page .gv-p-body > h2 { order: 0; }
  .gv-page .gv-p-body > .gv-p-sec:has(.gv-ideas) { order: 1; }
  .gv-page .gv-l-body > .gv-p-path, .gv-page .gv-l-body > a.btn { order: 0; }
}

/* phones: one note first. The bar holds search and Whole map. The key, View menu and mode switch stay on wide screens. */
@media (max-width: 600px) {
  .gv-page .head-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s-2); width: 100%; }
  .gv-page .head-actions .tb-repo { min-width: 0; }
  .gv-page .head-actions .tb-repo .input { width: 100%; }
  .gv-page .head-actions .lib-view { justify-self: end; }
  .gv-page .gv-bar { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
  .gv-page .gv-bar .gv-mode-bar, .gv-page .gv-bar .gv-filters { display: none; }
  .gv-page .gv-bar .gv-search { max-width: none; }
  .gv-page .gv-open-map { display: inline-flex; min-height: 44px; }
  .gv-page .gv-legend { display: none; }
  .gv-page .gv-frame { border-radius: var(--r-md); }
  .gv-page .gv-frame.is-local { height: 232px; margin-bottom: var(--s-2); }
  .gv-page .gv-frame.is-local .gv-zoom { display: none; }
  .gv-page .gv-frame.is-local canvas { touch-action: pan-y; }
  .gv-page .gv-panel::before { content: ""; display: block; width: 36px; height: 4px; border-radius: var(--r-pill); background: var(--line-strong); margin: 8px auto 0; }
  .gv-all { min-height: 40px; }
}

/* the phone's whole map: full screen over the page, a title bar with a close button, pinch to zoom */
body.gv-lock { overflow: hidden; }
.gv-page .gv-frame.is-overlay { position: fixed; inset: 0; z-index: 48; height: 100dvh !important; margin: 0; border: 0; border-radius: 0; }
.gv-frame.is-overlay canvas { border-radius: 0; touch-action: none; }
.gv-frame.is-overlay .gv-ov-bar { display: flex; position: absolute; z-index: 2; top: 0; left: 0; right: 0; align-items: center; gap: var(--s-2); padding: calc(env(safe-area-inset-top) + 6px) 6px 6px var(--s-4); background: var(--surface); border-bottom: 1px solid var(--line); }
.gv-ov-bar b { font-size: var(--t-4); font-weight: 600; }
.gv-ov-bar span { color: var(--muted); font-size: var(--t-2); }
.gv-ov-bar .btn { margin-left: auto; width: 44px; height: 44px; }
.gv-frame.is-overlay .gv-zoom { top: 68px; right: 8px; bottom: auto; flex-direction: column; }
.gv-frame.is-overlay .gv-zoom .btn { width: 44px; min-height: 44px; }
.gv-tap { position: absolute; z-index: 2; left: 8px; right: 8px; bottom: calc(env(safe-area-inset-bottom) + 8px); display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-3) var(--s-3) var(--s-4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-2); }
.gv-tap-t { flex: 1; min-width: 0; display: grid; gap: 2px; }
.gv-tap-t b { font-size: var(--t-4); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gv-tap-t span { color: var(--muted); font-size: var(--t-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gv-tap .btn { flex: none; min-height: 44px; }
.gv-frame.is-overlay .gv-zoom .btn-icon { display: none; }

/* ---------- round 2 ---------- */
.gv-frame.is-overlay .gv-zoom .btn-icon { display: inline-flex; }
.gv-ov-key { display: none; }
.gv-frame.is-overlay .gv-ov-key { display: flex; flex-wrap: wrap; gap: 4px 12px; position: absolute; z-index: 1; left: var(--s-4); right: 64px; bottom: calc(env(safe-area-inset-bottom) + 14px); list-style: none; margin: 0; padding: 0; font-size: var(--t-1); color: var(--muted); }
.gv-ov-key li { display: inline-flex; align-items: center; gap: 6px; }
.gv-frame.is-overlay .gv-tap:not([hidden]) ~ .gv-ov-key { display: none; }
.gv-nw { white-space: nowrap; }
.gv-p-sec h3 { align-items: center; }
.gv-pop-acts { display: grid; gap: 2px; padding-top: var(--s-2); border-top: 1px solid var(--line); }
.gv-page .head-actions > .lib-view:only-child { justify-self: start; }
/* repos: the folder count and its link sit on their own line under the chips; a skipped folder reads as skipped */
.rp-row dd:has(.rp-chips) { display: grid; justify-items: start; gap: 6px; }
.rp-chip.is-out .mono { text-decoration: line-through; text-decoration-color: var(--faint); }
.lib-repos .repos { margin-bottom: var(--s-5); }
.lib-repos .map { margin-top: var(--s-6); }
/* the map: repo cards start at the top of their column, beside the first newsletters */
.lib-repos .g-right > .g-cap + .grepo { margin-top: 0; }
.lib-repos .g-right > .grepo:last-child { margin-bottom: 0; }
.lib-repos .pr-list li .pr-top .tag { flex: none; }
@media (max-width: 600px) {
  .lib-repos .r-side:not(:has(.mini-switch)) { width: auto; margin-left: auto; }
  .lib-repos .pr-list li { padding: var(--s-2) 0; min-height: 44px; }
  .lib-repos .pr-list li .pr-top { grid-template-columns: 20px auto minmax(0, 1fr); align-items: center; }
  .lib-repos .pr-list li .pr-top > .pr-meta { grid-column: 2 / -1; }
}
/* repo cards spread evenly down their column, so neither the top nor the bottom holds an empty block */
.lib-repos .g-right > .grepo { margin-block: auto !important; }

/* ---------- round 3 ---------- */
.rp-chip.is-out .mono { text-decoration: none; }
.rp-skip { flex-wrap: wrap; }
/* "skips" never wraps alone: it stays on one line with the first skipped folder. */
.rp-skip-lead { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
/* Each map checkbox is a 44px target, and the box itself grows on phones. */
.lib-repos .g-cell { min-width: var(--h-lg); min-height: var(--h-lg); }
@media (max-width: 600px) { .lib-repos .g-box { width: 26px; height: 26px; } }
.lib-repos .pr-list li .pr-top .tag { justify-self: start; }
.lib-repos .graph { grid-template-columns: minmax(0, 340px) minmax(0, 340px); }
.lib-repos .g-right .grepo { min-height: 64px; }
.lib-repos .map-foot { margin-top: var(--s-3); font-size: var(--t-3); }
@media (max-width: 600px) { .lib-repos .map-foot .link { display: inline-flex; align-items: center; min-height: 44px; } }
/* graph: the key keeps its pill shape in both modes; the panel action sits under the title */
span.gv-key { border-color: var(--line); }
.gv-p-focus { justify-self: start; align-self: flex-start; }
.gv-frame.is-overlay .gv-ov-key { font-size: var(--t-2); }
.gv-pop .gv-switch-row { border-top: 0; }
