/* primitives.css — the P3 design-system primitives, one canonical definition each.
   Values are ported verbatim from docs/design/gallery.html (the LAW) and the
   eski-style skill (§2/§4). Tokens only — no hex. These are GLOBAL utilities
   (defined once, unscoped, reused by every screen); a screen that reinvents one
   is a rejected screen. Round is avatars + presence dots + the toggle knob only;
   all other chrome is --r (3px). */

/* ── P3.1 Button ─────────────────────────────────────────────────────────── */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:5px;
  border:1px solid transparent;border-radius:var(--r);
  padding:3px 10px;font:inherit;font-size:var(--fs-xs);font-weight:500;line-height:1.3;
  color:var(--ink);cursor:pointer;white-space:nowrap;
  transition:background var(--t),color var(--t),border-color var(--t)}
.btn.sm{padding:2px 8px;font-size:11px}
.btn .ic{width:13px;height:13px}
.btn[disabled],.btn[aria-disabled="true"]{opacity:.5;pointer-events:none}

/* (1) colour-change — the default; hover shifts fill, click INVERTS */
.btn{background:var(--surface);color:var(--ink)}
.btn:hover{background:var(--plate)}
.btn:active{background:var(--ink);color:var(--on-ink)}
/* primary = pre-inverted ink anchor */
.btn.primary{background:var(--ink);color:var(--on-ink);border-color:var(--ink)}
.btn.primary:hover{background:var(--soft);border-color:var(--soft)}
.btn.primary:active{background:var(--paper);color:var(--ink)}
/* danger = colour-change in member-red */
.btn.danger{background:var(--danger);color:#fff;border-color:var(--danger)}
.btn.danger:hover{background:color-mix(in srgb,var(--danger),#000 12%)}
:root[data-theme="dark"] .btn.danger:hover,
:root:not([data-theme="light"]) .btn.danger:hover{background:color-mix(in srgb,var(--danger),#fff 14%)}
.btn.danger:active{background:var(--paper);color:var(--danger)}
/* (2) text-highlight — no box ever; grey label → full ink on hover */
.btn.ghost{background:none;color:var(--muted);padding-left:6px;padding-right:6px}
.btn.ghost:hover{background:none;color:var(--ink)}
/* (3) border-on-hover — faint resting border steps up */
.btn.outline{background:none;color:var(--soft);border-color:var(--line2)}
.btn.outline:hover{border-color:var(--soft);color:var(--ink)}
.btn.outline:active{border-color:var(--ink);color:var(--ink)}
/* loading: a spinner replaces the label, control inert */
.btn.loading{pointer-events:none;color:transparent;position:relative}
.btn.loading::after{content:"";position:absolute;width:13px;height:13px;border-radius:50%;
  border:2px solid currentColor;border-top-color:transparent;
  color:var(--ink);animation:spin .6s linear infinite}
.btn.primary.loading::after{color:var(--on-ink)}

/* P3 — shared async-busy overlay (ui.js busyOverlay): a light scrim + spinner over a host box
   while an async action runs. Same spinner geometry as .btn.loading, sized up for a surface.
   Inherits the host's radius so it doesn't square off a rounded well. */
.busyov{position:absolute;inset:0;z-index:5;display:grid;place-items:center;border-radius:inherit;
  background:color-mix(in srgb,var(--paper) 62%,transparent)}
.busyov-sp{width:20px;height:20px;border-radius:50%;border:2px solid var(--line2);
  border-top-color:var(--ink);animation:spin .6s linear infinite}

/* P35 — shared loading affordances (ui.js loadingLabel / indetBar). One motion vocabulary for
   every async wait so nothing shows dead static text; the indeterminate bar replaces the
   spinning search icon. Dots are TEXT glyphs (not circles) so the no-new-round-elements rule holds. */
.loadlbl .dots{display:inline-flex;gap:1px;margin-left:1px;line-height:1}
.loadlbl .dots i{font-style:normal;opacity:.25;animation:dotpulse 1.25s ease-in-out infinite}
.loadlbl .dots i:nth-child(2){animation-delay:.18s}
.loadlbl .dots i:nth-child(3){animation-delay:.36s}
@keyframes dotpulse{0%,72%,100%{opacity:.25;transform:translateY(0)}36%{opacity:1;transform:translateY(-2px)}}
.indetbar{height:3px;border-radius:var(--r);background:var(--plate);overflow:hidden;position:relative}
.indetfill{position:absolute;top:0;left:0;height:100%;width:34%;background:var(--ink);
  border-radius:inherit;animation:uplslide 1.05s ease-in-out infinite}

/* P36 — crop/zoom modal (ui.js cropImage). A fixed-aspect crop frame the picked image pans/zooms
   inside, above a zoom slider. The frame is the ratio; a round variant masks a circle for avatars
   (the one place round is allowed). Chrome radius --r on square frames; media itself stays square. */
.cropwrap{display:flex;flex-direction:column;gap:var(--s3);align-items:center}
.cropstage{position:relative;overflow:hidden;border-radius:var(--r);background:var(--paper1);
  cursor:grab;touch-action:none;user-select:none}
.cropstage:active{cursor:grabbing}
.cropstage.round{border-radius:50%}
.cropimg{position:absolute;top:0;left:0;max-width:none;pointer-events:none;transform-origin:0 0}
.croprow{display:flex;align-items:center;gap:var(--s2);width:100%;color:var(--muted)}
.cropzoom{flex:1;accent-color:var(--ink)}

/* P16 — upload progress (ui.js uploadProgress): an animated determinate bar + %, inline in the
   modal; minimize floats a compact chip bottom-right that keeps tracking while you work. */
.uplwidget{display:flex;flex-direction:column;gap:8px;margin-top:var(--s3);padding:var(--s3);
  background:var(--surface);border-radius:var(--r)}
.uplhd{display:flex;align-items:center;gap:8px;font-size:var(--fs-sm)}
.uplhd b{font-weight:600}
.uplpct{margin-left:auto;color:var(--muted);font-size:var(--fs-xs);font-variant-numeric:tabular-nums}
.uplhd .iconbtn{width:22px;height:22px}
.uplbar{height:5px;border-radius:var(--r);background:var(--plate);overflow:hidden;position:relative}
.uplfill{height:100%;width:0;background:var(--ink);border-radius:inherit;transition:width .28s ease}
.uplwidget.done .uplfill,.uplchip.done .uplfill{background:var(--ink)}
.uplwidget.fail .uplfill,.uplchip.fail .uplfill{background:var(--danger);width:100%}
.upllabel{font-size:var(--fs-xs);color:var(--muted)}
/* indeterminate phase (hashing/signing) — a sliding sliver instead of a fixed width */
.uplwidget.indet .uplfill,.uplchip.indet .uplfill{width:34%;animation:uplslide 1.05s ease-in-out infinite}
@keyframes uplslide{0%{transform:translateX(-110%)}100%{transform:translateX(320%)}}
/* the floating Drive-style chip (B20): INVERSE colour (ink ground / paper text) so it reads as a
   distinct system element; right-edge aligned with the explorer's New-folder/Upload cluster
   (.exfab is inset --s5 from the pane's right, which ≈ the viewport right here) and lifted ABOVE
   it (bottom clears the ~44px button row) so it never covers those buttons. */
.uplchip{position:fixed;right:var(--s5);bottom:56px;z-index:60;width:288px;max-width:calc(100vw - 2*var(--s5));
  padding:var(--s3);background:var(--ink);color:var(--on-ink);border-radius:var(--r);
  box-shadow:0 6px 24px rgba(0,0,0,.28);display:flex;flex-direction:column;gap:8px;animation:uplchipin .2s ease}
@keyframes uplchipin{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}
.uplchip .uplbar{background:color-mix(in srgb,var(--on-ink) 24%,transparent)}
.uplchip .uplfill{background:var(--on-ink)}
.uplchip.done .uplfill{background:var(--on-ink)}
.uplchip-top{display:flex;align-items:center;gap:8px;font-size:var(--fs-sm)}
.uplchip-lbl{font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.uplchip-pct{margin-left:auto;color:color-mix(in srgb,var(--on-ink) 70%,transparent);font-size:var(--fs-xs);font-variant-numeric:tabular-nums;flex:none}
.uplchip .iconbtn{width:20px;height:20px;flex:none;color:var(--on-ink)}
.uplchip .iconbtn:hover{background:color-mix(in srgb,var(--on-ink) 16%,transparent);color:var(--on-ink)}

/* B14: off-screen keep-alive host — a backgrounded player parks here so it stays in the document
   and keeps playing (a removed media element is force-paused by the browser). Never visible. */
.playerkeep{position:fixed;left:-99999px;top:0;width:1px;height:1px;overflow:hidden;pointer-events:none}

/* Parked (DOCK_ENABLED=false): the opt-in mini media dock — a persistent player that survives
   navigation (bottom-left so it never collides with the bottom-right upload chip / explorer exfab).
   Floating chrome, so it carries the same soft shadow as .uplchip (the no-shadow rule is for modals
   on a scrim, not floating chips). Kept for a future opt-in; nothing renders it today. */
.pdock{position:fixed;left:var(--s5);bottom:var(--s5);z-index:60;width:320px;max-width:calc(100vw - 2*var(--s5));
  padding:var(--s3);background:var(--surface);border-radius:var(--r);
  box-shadow:0 6px 24px rgba(0,0,0,.28);display:flex;flex-direction:column;gap:8px;animation:uplchipin .2s ease}
.pdock-hd{display:flex;align-items:center;gap:8px}
.pdock-play{flex:none}
.pdock-title{flex:1;min-width:0;text-align:left;background:none;border:0;padding:0;color:var(--ink);
  font-size:var(--fs-sm);font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;cursor:pointer}
.pdock-title:disabled{cursor:default}
.pdock-title:hover:not(:disabled){color:var(--soft)}
/* the docked wrap sheds its big media area (audio) / caps the video; only the seek transport flows */
.pdock .dmplayer.docked{background:none;border-radius:0;overflow:visible}
.pdock .dmplayer.docked[data-kind="audio"] .dmmedia{display:none}
.pdock .dmplayer.docked[data-kind="video"] .dmmedia{min-height:0}
.pdock .dmplayer.docked[data-kind="video"] video{max-height:120px;border-radius:var(--r)}
.pdock .dmplayer.docked .dmtransport{position:static;background:none;padding:0;gap:8px}

/* ── P3.2 IconButton + CloseButton ───────────────────────────────────────── */
.iconbtn{display:grid;place-items:center;width:26px;height:26px;border-radius:var(--r);
  background:none;color:var(--soft);cursor:pointer;
  transition:background var(--t),color var(--t)}
.iconbtn:hover{background:var(--surface);color:var(--ink)}
.iconbtn:active{background:var(--ink);color:var(--on-ink)}
.iconbtn[disabled],.iconbtn[aria-disabled="true"]{opacity:.5;pointer-events:none}

/* ── P3.3 Field ──────────────────────────────────────────────────────────── */
.field{display:flex;align-items:center;gap:var(--s2);background:var(--paper);
  border:1px solid var(--line2);border-radius:var(--r);padding:8px 11px;
  transition:border-color var(--t)}
.field:focus-within{border-color:var(--ink)}
.field input{flex:1;border:0;background:none;outline:none;font:inherit;
  font-size:var(--fs-sm);color:var(--ink);min-width:0}
.field input::placeholder{color:var(--muted)}
.field .ic{color:var(--muted)}
.field .at{color:var(--muted);font-size:var(--fs-sm);font-weight:600;flex:none}  /* @-prefix */
.field.req{border-color:var(--soft)}
.field.err{border-color:var(--danger)}
.field[aria-disabled="true"]{opacity:.5;pointer-events:none}
/* searchbar — the one dense height for every search field app-wide (owner call 2026-08-30:
   match the compact density of the typed-tags prototype input). Applied to the explorer, feed,
   search screen and quick-switcher search fields; overrides any larger per-screen font. */
.field.searchbar{padding:6px 9px}
/* owner 2026-09-01: "make the search bars thinner, same height as the buttons" — the field's OWN
   padding was never actually the whole story: <input> carries a UA-default padding (Chrome: 1px 2px)
   this rule never zeroed, AND with no line-height of its own it inherited body's global 1.5 (base.css)
   — 13px * 1.5 = 19.5px, nearly 1.5x the ~13px a button's own line-height (1.3) produces at the same
   font-size. That's what was actually inflating every search field well past its sibling buttons,
   not the field's padding (which the explorer toolbar had already thinned once, .toolbar rule below
   — and it still read tall, because this was the real cause). line-height:1.3 matches .btn's own
   value exactly; padding:0 hands the input's whole box back to .field's padding. */
.field.searchbar input{font-size:var(--fs-sm);line-height:1.3;padding:0}

/* P11 — typed-tag soft chip (tags.js tagChip). Owner-picked V2: a compact --r box washed with
   the type hue for a typed tag; neutral --tagbg for an untyped one. The value carries; the type
   is a small dimmed affix. This is the ONE place a tag renders as a box (the plain-text .tag rule
   still holds elsewhere) — a deliberate owner call so a bpm/key reads at a glance. */
.tchip{position:relative;display:inline-flex;align-items:center;gap:5px;border-radius:var(--r);padding:2px 7px;
  font-weight:600;font-size:var(--fs-xs);line-height:1.4;background:var(--tagbg);color:var(--soft)}
.tchip.clickable{cursor:pointer}
.tchip.clickable:hover{filter:brightness(1.06)}
/* P38: a typed chip has TWO independent click surfaces (the type affix -> hastag:<type>, the value
   -> the exact type:value) — each its own keyboard target (role=button tabindex=0, tags.js
   clickableSpan). The whole-chip brightness above still cues "this is interactive"; the underline +
   focus ring on hover/focus pinpoint WHICH half is about to fire. */
.tchip.clickable [role="button"]{cursor:pointer}
.tchip.clickable [role="button"]:hover{text-decoration:underline}
.tchip.clickable [role="button"]:focus-visible{outline:1.5px solid currentColor;outline-offset:1px;border-radius:2px}
.tchip .ty{font-size:var(--fs-mi);opacity:.72;font-weight:600}
/* P26: the ✕ is a HOVER OVERLAY on the right edge — absolute so it adds no chip width; it partly
   occludes the tag's right side (background:inherit = the chip's own fill) so the ✕ reads clearly,
   with a soft left fade. The rest of the chip stays clickable (→ search by this tag). */
.tchip .x{position:absolute;top:0;right:0;bottom:0;width:19px;display:none;align-items:center;justify-content:center;
  border-radius:0 var(--r) var(--r) 0;background:inherit;color:inherit;cursor:pointer;font-size:10px;font-weight:600;
  box-shadow:-5px 0 5px -3px var(--tagbg)}
.tchip:hover .x{display:flex}
.tchip .x:hover{filter:brightness(1.15)}
/* the typed-tag editor (tags.js tagEditor) — chips row + a colon-aware input */
.tageditor{display:flex;flex-direction:column;gap:8px}
.tchips{display:flex;flex-wrap:wrap;gap:6px;align-items:center}
.tchips:empty{display:none}
.tchip.chipslot input{background:none;border:0;font:inherit;font-weight:600;font-size:var(--fs-xs);
  color:inherit;width:4.5ch;padding:0;min-width:2ch}
.tchip.chipslot input:focus{outline:none}
.tchip.chipslot input::placeholder{color:currentColor;opacity:.62;font-weight:500}
.taghint{font-size:var(--fs-mi);color:var(--muted);min-height:14px}
.tagin input{font-size:var(--fs-sm)}

/* ── P3.4 Modal + scrim ──────────────────────────────────────────────────── */
/* scrim = fixed backdrop that DARKENS the page and centres the modal. No drop
   shadow on the card.
   IT MUST BE DARK IN BOTH THEMES. The old `background:var(--ink)` + a black overlay
   was wrong: --ink is near-WHITE in dark mode, so ink + 55% black computed to GREY —
   every modal sat on a grey slab in dark mode (owner bug 2026-08-28). A scrim is a
   translucent BLACK over the page in both themes, so the page dims through it and the
   modal always reads as lifted above a darkened backdrop — never a grey fill. */
/* z-index 82 sits ABOVE the details .sheet (81): a modal is always spawned from
   within a surface (a Rename prompt opened from the details-pane ⋯ menu), so it is
   the newer, active interaction and must layer on top of the viewer that opened it —
   never behind it. Menus (90) and toasts (95) still float above modals. */
.scrim{position:fixed;inset:0;z-index:82;display:grid;place-items:center;
  padding:var(--s4);background:rgba(0,0,0,.55)}
:root[data-theme="dark"] .scrim,
:root:not([data-theme="light"]) .scrim{background:rgba(0,0,0,.66)}
.scrim>*{position:relative;z-index:1}
/* Column layout + a viewport cap so a content-tall modal (Upload, Roles, Move-to-folder)
   never overflows off-screen: the header (with ✕) and footer stay pinned and reachable,
   the body scrolls, and the scrim's backdrop is always on-screen to click. The cap is the
   scrim's inset (2×--s4) so the card sits inside the padded gutter. */
.modal{width:340px;max-width:100%;max-height:calc(100vh - var(--s4)*2);display:flex;flex-direction:column;
  background:var(--paper);border-radius:var(--r);overflow:hidden}
.modal.wide{width:440px}
/* P12 density: header/footer carry the minimum vertical inset (--s2); the body keeps the --s4
   horizontal inset but a tighter --s3 vertical, so a small dialog stays small instead of reading
   tablet-sized. */
.modal .uhd{flex:none;display:flex;align-items:center;justify-content:space-between;padding:var(--s2) var(--s4)}
.modal .uhd b{font-size:var(--fs-sm);font-weight:600}
/* P12 (owner: V1 Tight): denser dialog body — scoped to .modal so app-wide fields/pane bodies
   are untouched. Body padding 10/14, fields 6/10, and the per-row vertical rhythm dropped to --s2
   (8px, from the old inline 12px) via .modal .mbody's labels/rows. */
.modal .mbody{flex:1 1 auto;min-height:0;overflow-y:auto;padding:10px 14px}
.modal .mbody>p{font-size:var(--fs-sm);color:var(--soft);line-height:1.5}
.modal .field{width:100%;padding:6px 10px}
.modal .mfoot{flex:none;position:relative;display:flex;justify-content:flex-end;gap:var(--s2);padding:var(--s2) var(--s4)}
.modal .mfoot::after{content:"";position:absolute;left:var(--hair-inset);right:var(--hair-inset);top:0;height:1px;background:var(--line)}

/* ── P3.5 Menu + MenuItem ────────────────────────────────────────────────── */
.menu{position:fixed;z-index:90;background:var(--paper);border-radius:var(--r);
  box-shadow:0 12px 40px rgba(0,0,0,.28);padding:5px;min-width:200px;display:none}
.menu.open{display:block}
.menu .mlabel{font-size:10px;color:var(--muted);padding:6px 10px 3px}
.menu button{display:flex;align-items:center;gap:9px;width:100%;text-align:left;
  padding:6px 10px;border-radius:var(--r);font-size:var(--fs-sm);color:var(--ink)}
.menu button .ic{color:var(--muted)}
.menu button .mgrow{flex:1}   /* pushes a trailing submenu chevron to the right edge */
.menu button:hover,.menu button:focus-visible{background:var(--surface);outline:none}
.menu button:active{background:var(--ink);color:var(--on-ink)}
.menu button:active .ic{color:var(--on-ink)}
/* selected row: shown by a filled highlight + weight (the selected-nav convention),
   NOT a ✓ tick — a dropdown/multi-select marks its choice the way hover fills a row.
   A step above the --surface hover so a selected row you're also hovering still reads. */
.menu button.sel{background:var(--plate);color:var(--ink);font-weight:600}
.menu button.sel .ic{color:var(--ink)}
.menu button.sel:active{background:var(--ink);color:var(--on-ink)}
.menu button.sel:active .ic{color:var(--on-ink)}
.menu button.danger{color:var(--danger)}          /* --danger, not --m1 (skill §1) */
.menu button.danger .ic{color:var(--danger)}
.menu .sep{height:1px;background:var(--line);margin:5px var(--hair-inset)}  /* inset, never full-bleed */

/* ── P3.6 Avatar + PresenceDot ───────────────────────────────────────────── */
.av{flex:none;border-radius:50%;background:var(--paper1);color:var(--soft);overflow:hidden;
  display:grid;place-items:center;font-weight:700;width:28px;height:28px;font-size:var(--fs-xs)}
.av.md{width:28px;height:28px;font-size:var(--fs-xs)}   /* = default */
.av.sm{width:20px;height:20px;font-size:10px}
.av.lg{width:76px;height:76px;font-size:26px}
.av img{width:100%;height:100%;border-radius:inherit;object-fit:cover}
/* presence dot — round is allowed here. online=ink, idle=muted, dnd=danger, offline=line2.
   The 2px ring matches whatever surface it sits on; pass it via --ring. */
.pres{width:9px;height:9px;border-radius:50%;flex:none;background:var(--ink);
  box-shadow:0 0 0 2px var(--ring,var(--paper))}
.pres.idle{background:var(--muted)}
.pres.dnd{background:var(--danger)}
.pres.off{background:var(--line2)}

/* ── P3.7 Tag + Chip ─────────────────────────────────────────────────────── */
/* tag = coloured bold TEXT, not a pill (the word carries it — skill §4) */
.tag{display:inline-flex;align-items:center;color:var(--soft);font-size:var(--fs-xs);font-weight:600}
.tag.auto{background:var(--ink);color:var(--on-ink);border-radius:var(--r);padding:1px 6px}
.tag.rm{gap:4px;cursor:default}
.tag .x{display:none}
.tag.rm:hover .x{display:inline-grid}
/* uchip = member chip: coloured bold text (the killed round .dot stays hidden).
   The member hue arrives via inline style (server surfaces only). */
.uchip{display:inline-flex;align-items:center;font-size:var(--fs-xs);font-weight:600}
.uchip .dot{display:none}
/* the one exception (skill): a removable recipient token inside an input keeps a chip */
.field.collabs{flex-wrap:wrap;gap:5px}
.field.collabs input{width:70px;flex:1 0 70px}
.collabs .uchip{gap:5px;background:var(--surface);border-radius:var(--r);padding:3px 8px}

/* ── P3.8 Toggle ─────────────────────────────────────────────────────────── */
/* the switch — the round knob is a control affordance (allowed, skill §4) */
.tgl{position:relative;width:38px;height:22px;border-radius:999px;flex:none;
  background:var(--line2);cursor:pointer;transition:background var(--t)}
.tgl::after{content:"";position:absolute;top:2px;left:2px;width:18px;height:18px;
  border-radius:50%;background:var(--paper);transition:transform var(--t)}
.tgl.on{background:var(--ink)}
.tgl.on::after{transform:translateX(16px)}
.tgl[aria-disabled="true"]{opacity:.5;pointer-events:none}

/* ── P3.9 Checkbox ───────────────────────────────────────────────────────── */
.cbx{width:18px;height:18px;flex:none;border-radius:3px;background:var(--paper);
  box-shadow:inset 0 0 0 1.5px var(--line2);display:grid;place-items:center;color:transparent}
.cbx svg{width:12px;height:12px}
.cbx.on{background:var(--ink);box-shadow:none;color:var(--on-ink)}
.cbx[aria-disabled="true"]{opacity:.5;pointer-events:none}

/* ── P3.10 UsageBar ──────────────────────────────────────────────────────── */
.bar{height:9px;background:var(--plate);border-radius:999px;overflow:hidden;max-width:560px;margin:6px 0}
.bar i{display:block;height:100%;background:var(--ink);transition:width .2s linear}
.bar.warn i{background:var(--danger)}   /* over-cap tone */

/* ── P3.11 Toast ─────────────────────────────────────────────────────────── */
.toast{display:flex;align-items:flex-start;gap:var(--s2);background:var(--ink);color:var(--on-ink);
  border-radius:var(--r);padding:var(--s2) var(--s3);font-size:var(--fs-sm);animation:toastin .18s ease}
.toast .ic{flex:none;margin-top:1px;color:var(--on-ink)}
.toast .tact{margin-left:8px;color:var(--on-ink);font-weight:600;text-decoration:underline;text-underline-offset:2px}
.toast .tclose{margin-left:auto;color:var(--on-ink);opacity:.7}
.toast .tclose:hover{opacity:1}
/* a stack container so multiple toasts don't overlap */
.toaststack{position:fixed;z-index:95;right:var(--s4);bottom:var(--s4);
  display:flex;flex-direction:column;gap:var(--s2);align-items:flex-end}

/* ── P3.12 Tabs ──────────────────────────────────────────────────────────── */
/* underline-active tab row; active = ink + 2px inset underline, separated by
   background step (not a baseline hairline). Keyboard focus shows the SAME
   underline, never a bounding box. */
.nav{display:inline-flex;align-items:center;gap:6px;color:var(--soft);
  padding:9px 10px;font-size:var(--fs-sm);position:relative;cursor:pointer;background:none}
.nav .n{color:var(--muted);font-size:var(--fs-xs)}         /* inline count */
.nav:hover{color:var(--ink)}
.nav.on{color:var(--ink);font-weight:600}
.nav.on::after{content:"";position:absolute;left:0;right:0;bottom:0;height:2px;background:var(--ink)}
.nav.on .n{color:var(--ink)}
.nav:focus-visible{outline:none;box-shadow:inset 0 -2px 0 var(--ink)}

/* ── P3.13 SegmentedControl ──────────────────────────────────────────────── */
.seg{display:flex;gap:6px}
.seg .o{flex:1;min-width:0;display:flex;align-items:center;justify-content:center;gap:7px;
  padding:6px 10px;background:var(--surface);border-radius:var(--r);white-space:nowrap;
  font-size:var(--fs-xs);color:var(--soft);cursor:pointer;
  transition:background var(--t),color var(--t)}
.seg .o .ic{width:15px;height:15px;color:var(--muted)}
.seg .o:hover{background:var(--plate)}
.seg .o.on{background:var(--ink);color:var(--on-ink)}
.seg .o.on .ic{color:var(--on-ink)}
.seg .o.disabled{opacity:.4;cursor:not-allowed}
.seg .o.disabled:hover{background:none}

/* ── P3.14 SelectPill / Dropdown ─────────────────────────────────────────── */
/* a colour-change button with a trailing chevron that rotates 180° while open.
   Denser than a .field so it never reads as a text input. Not round — --r. */
.selbtn{display:inline-flex;align-items:center;gap:7px;background:var(--surface);
  border:1px solid transparent;border-radius:var(--r);padding:6px 10px;
  font-size:var(--fs-sm);color:var(--ink);cursor:pointer;
  transition:background var(--t),color var(--t)}
.selbtn.sm{padding:5px 9px;font-size:var(--fs-xs)}
.selbtn:hover{background:var(--plate)}
.selbtn:active{background:var(--ink);color:var(--on-ink)}
.selbtn:active .ic{color:var(--on-ink)}
.selbtn .ic{color:var(--muted)}
.selbtn .chev{transition:transform var(--t)}
.selbtn[aria-expanded="true"] .chev{transform:rotate(180deg)}
.selbtn.danger{color:var(--danger)}
.selbtn.danger .ic{color:var(--danger)}
.selbtn.danger:hover{background:var(--plate);color:var(--danger)}
/* selpill = a lighter display variant on --plate */
.selpill{display:inline-flex;align-items:center;gap:6px;background:var(--plate);
  border-radius:var(--r);padding:6px 10px;font-size:var(--fs-xs);color:var(--soft);cursor:pointer}

/* ── P3.15 MediaPlayer ───────────────────────────────────────────────────── */
.dmplayer{position:relative;background:var(--paper1);border-radius:var(--r);overflow:hidden}
.dmplayer .dmmedia{position:relative;display:grid;place-items:center;min-height:120px}
.dmplayer audio{display:none}
.dmplayer video{width:100%;display:block;background:#000}
.dmplayer[data-kind="audio"] .dmmedia{min-height:180px}
/* big centred play/pause toggle */
.dmbigplay{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);z-index:2;
  width:64px;height:64px;border-radius:50%;background:var(--paper);color:var(--ink);
  display:grid;place-items:center;cursor:pointer}
.dmbigplay:hover{background:var(--surface)}
.dmbigplay .ic{width:26px;height:26px}
/* transport pinned to the media foot */
.dmtransport{position:absolute;left:0;right:0;bottom:0;display:flex;align-items:center;gap:12px;
  padding:14px 20px;font-size:12px;color:var(--soft);font-variant-numeric:tabular-nums;
  background:linear-gradient(to top,rgba(0,0,0,.35),transparent)}
.dmplayer[data-kind="audio"] .dmtransport{background:none}
.dmtransport .t{flex:none;min-width:38px}
.dmtransport .dmskips{display:flex;align-items:center;gap:4px;flex:none}   /* B18: skip pair, grouped right */
.dmtransport .track{flex:1;height:7px;background:var(--line);border-radius:var(--r);position:relative;cursor:pointer}
.dmtransport .track i{position:absolute;left:0;top:0;bottom:0;width:0;background:var(--ink);border-radius:var(--r)}
.dmtransport .track .knob{position:absolute;top:50%;left:0;width:3px;height:15px;border-radius:1px;
  background:var(--ink);transform:translate(-50%,-50%)}
.tbtn{width:26px;height:26px;border-radius:var(--r);display:grid;place-items:center;
  color:var(--soft);cursor:pointer;transition:background var(--t),color var(--t)}
.tbtn:hover{background:var(--surface);color:var(--ink)}
.tbtn:active{background:var(--ink);color:var(--on-ink)}
.tbtn .ic{width:15px;height:15px}
/* nav arrows (folder prev/next over media) — colour-change, invert on click, ring to read over media */
.navarrow{position:absolute;top:50%;transform:translateY(-50%);z-index:3;width:32px;height:32px;
  border-radius:var(--r);background:var(--paper);color:var(--soft);box-shadow:0 0 0 1px var(--line);
  display:grid;place-items:center;cursor:pointer;transition:background var(--t),color var(--t)}
.navarrow:hover{background:var(--surface);color:var(--ink)}
.navarrow:active{background:var(--ink);color:var(--on-ink);box-shadow:0 0 0 1px var(--ink)}
.navarrow.prev{left:14px}.navarrow.next{right:14px}
.navarrow .ic{width:18px;height:18px}
.navarrow.prev .ic{transform:rotate(90deg)}.navarrow.next .ic{transform:rotate(-90deg)}

/* ── keyframes ───────────────────────────────────────────────────────────── */
@keyframes toastin{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
@keyframes spin{to{transform:rotate(360deg)}}
