/* ============================================================
   Management System (feature 024) — Register + Record.
   Ported verbatim from the genesis prototype CSS
   (ms-explore/ms-shared.css + ms-explore/direction-b.html),
   renamed to the production `msb-*` namespace the ms-v18.js
   render structure uses, and scoped under `.msb-root` so the
   bare prototype selectors (.dt/.badge/.pill/.btn/...) never
   collide with the app's existing global classes.

   The genesis design tokens (--navy/--ink/--muted/...) are
   redeclared here, mapped to the app's --color-* / --rp-* system,
   scoped to .msb-root. Register area re-matched to the v37
   prototype (feature 045): its visual roles now resolve through the
   corrected semantic tokens while decorative data fills stay unchanged
   (specs/045-v37-ui-parity/reference + scratchpad v37.css).
   ============================================================ */

.msb-root {
  /* genesis tokens mapped onto the app palette (layout.css owns --color-*) */
  --navy: var(--color-navy);
  --blue: var(--color-blue);
  --teal: var(--color-teal);
  --teal-soft: var(--color-ice-blue);
  --surface: var(--color-surface);
  --white: var(--color-white);
  --border: var(--color-border);
  --border-light: var(--color-border-light);
  --ink: var(--rp-ink);
  --ink-soft: var(--rp-ink-soft);
  --muted: var(--rp-muted);
  --muted-2: var(--color-text-secondary);
  --ok: var(--color-success);
  --ok-bg: var(--color-success-tint);
  --warn: var(--color-warning);
  --warn-bg: var(--color-warning-tint);
  --info: var(--color-info);
  --info-bg: var(--color-info-tint);
  --err: var(--color-error);
  --err-bg: var(--color-error-tint);
  --mono: var(--font-mono);

  display: block;
  color: var(--ink);
}

/* The Register / Explorer flow sits inside the standard page padding (.main-content),
   so it reads as a flat surface page — no white head bar, no left rail (v28). */
.msb-page { display: block; }

/* ---- page head: plain v37 title; the Register|Explorer toggle (kept per D8) sits on the right ---- */
.msb-pagehead { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: var(--space-6); }
.msb-pagehead .msb-view-seg { margin-top: 4px; }

/* ---- top filter toolbar: prominent search + dropdown facet buttons (v37 reference values) ---- */
.msb-tb { margin-bottom: var(--space-4); }
.msb-tb-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.msb-tb-search { position: relative; display: flex; align-items: center; flex: 1; min-width: 300px; }
.msb-tb-search > svg { position: absolute; left: 14px; width: 18px; height: 18px; color: var(--color-text-secondary); pointer-events: none; }
.msb-tb-search input { width: 100%; padding: 13px 40px 13px 42px; border: 1px solid var(--color-control-border); border-radius: var(--radius-md); font-size: 14.5px; color: var(--navy); background: var(--color-white); font-family: var(--font-primary); }
.msb-tb-search input::placeholder { color: var(--color-text-secondary); }
.msb-tb-search input:focus { outline: none; border-color: var(--color-control-border); box-shadow: var(--shadow-focus); }
.msb-tb-clear { position: absolute; right: 10px; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; border: none; background: none; color: var(--color-text-secondary); cursor: pointer; border-radius: var(--radius-sm); }
.msb-tb-clear:hover { background: var(--surface); color: var(--color-text-secondary); }
.msb-tb-clear svg { width: 14px; height: 14px; }

.msb-tb-controls { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-top: var(--space-4); }

/* dropdown facet buttons + popovers */
.msb-dd-wrap { position: relative; }
.msb-dd { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 500; color: var(--color-text-secondary); background: var(--color-white); border: 1px solid var(--color-control-border); border-radius: var(--radius-md); padding: 9px 12px; cursor: pointer; font-family: var(--font-primary); white-space: nowrap; }
.msb-dd:hover { border-color: var(--color-control-border); color: var(--navy); }
.msb-dd.on { background: #D8EAE9; border-color: var(--color-control-border); color: var(--navy); }
.msb-dd.open { border-color: var(--color-control-border); box-shadow: var(--shadow-focus); }
.msb-dd .caret { width: 14px; height: 14px; opacity: .6; }
.msb-dd-badge { font-family: var(--mono); font-size: 11px; background: var(--navy); color: var(--color-white); border-radius: var(--radius-full); min-width: 17px; height: 17px; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px; }
.msb-dd-menu { position: absolute; top: calc(100% + 6px); left: 0; background: var(--color-white); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-md); padding: 5px; min-width: 236px; z-index: 40; max-height: 340px; overflow-y: auto; }
.msb-dd-menu[hidden] { display: none; }
.msb-dd-menu.wide { min-width: 264px; }
.msb-dd-opt { display: flex; align-items: center; gap: 9px; width: 100%; text-align: left; padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer; font-size: 12.5px; color: var(--color-text-secondary); border: none; background: none; font-family: var(--font-primary); }
.msb-dd-opt:hover { background: var(--surface); }
.msb-dd-opt.on { background: #D8EAE9; color: var(--navy); font-weight: 500; }
.msb-dd-opt .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.msb-dd-opt .lbl { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msb-dd-opt .cnt { font-family: var(--mono); font-size: 11px; color: var(--color-text-secondary); flex-shrink: 0; }
.msb-dd-opt .tick { width: 15px; height: 15px; color: var(--navy); flex-shrink: 0; }
.msb-dd-foot { border-top: 1px solid var(--border-light); margin-top: 4px; padding-top: 4px; }
.msb-dd-clear { width: 100%; text-align: left; padding: 8px 10px; border-radius: var(--radius-sm); border: none; background: none; cursor: pointer; font-size: 12.5px; color: var(--color-teal-text); font-weight: 500; font-family: var(--font-primary); }
.msb-dd-clear:hover { background: var(--surface); }

/* foot row: "N documents" count + active filter chips */
.msb-tb-foot { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: var(--space-4); }
.msb-tb-foot .msb-reg-count { margin: 0; }
.msb-tb-foot .msb-active { margin: 0; }
.msb-clearall { border: none; background: none; cursor: pointer; font-size: 12px; color: var(--color-teal-text); font-weight: 500; font-family: var(--font-primary); padding: 9px 4px; }
.msb-clearall:hover { text-decoration: underline; }

/* Record drill-in keeps its original full-bleed framing (crumb/hero/body carry their own padding),
   so break out of the surrounding page padding. */
.msb-main { display: block; min-width: 0; margin: calc(-1 * var(--space-10)); background: var(--color-surface); min-height: calc(100vh - var(--topbar-height)); }

/* ---- status breakdown bar (register uses approved-vs-rest; the Record keeps all four segments) ---- */
.msb-statbar { display: flex; height: 8px; border-radius: var(--radius-full); overflow: hidden; background: var(--border-light); gap: 1.5px; }
.msb-statbar .seg { height: 100%; }
.msb-statbar .seg-approved { background: #3C9A6B; }
.msb-statbar .seg-flagged  { background: var(--color-warning); }
.msb-statbar .seg-pending  { background: var(--color-blue); }
.msb-statbar .seg-rejected { background: var(--color-error); }

/* ---- pills / chips ---- */
.msb-pill { display: inline-flex; align-items: center; font-family: var(--font-primary); font-size: 10.5px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; padding: 2px 8px; border-radius: var(--radius-full); white-space: nowrap; }
.msb-pill-approved { background: var(--ok-bg); color: var(--ok); }
.msb-pill-flagged  { background: var(--warn-bg); color: var(--warn); }
.msb-pill-pending  { background: var(--info-bg); color: var(--info); }
.msb-pill-rejected { background: var(--err-bg); color: var(--err); }
.msb-pill-queued   { background: var(--surface); color: var(--color-text-secondary); }
.msb-pill-sc { background: var(--color-deep-navy); color: var(--color-white); }
.msb-type-chip { display: inline-block; font-family: var(--font-heading); font-size: 10px; font-weight: 600; letter-spacing: .03em; padding: 2px 7px; border-radius: var(--radius-full); background: var(--surface); color: var(--color-text-secondary); }
.msb-doc-ref { font-family: var(--mono); font-size: 12px; color: var(--color-text-secondary); font-weight: 500; }
.msb-root .mono { font-family: var(--mono); font-size: 12px; color: var(--color-text-secondary); }

/* ---- lifecycle badge (hero meta strip) ---- */
.msb-life { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-primary); font-size: 11px; font-weight: 600; letter-spacing: .02em; padding: 3px 10px; border-radius: var(--radius-full); white-space: nowrap; }
.msb-life::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.msb-life-approved { background: var(--ok-bg); color: var(--ok); }
.msb-life-review   { background: var(--info-bg); color: var(--info); }
.msb-life-queued   { background: var(--surface); color: var(--color-text-secondary); }

/* ---- data table (scoped; v37 refined header + even-row striping) ---- */
.msb-root .data-table { width: 100%; border-collapse: collapse; }
.msb-root .data-table thead th { text-align: left; font-family: var(--font-heading); font-size: 11.5px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: #3A5868; background: #F6F9F9; padding: 14px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.msb-root .data-table tbody td { padding: 14px 16px; border-bottom: 1px solid var(--border-light); font-size: 13.5px; color: #1F3E52; vertical-align: middle; }
.msb-root .data-table tbody tr { transition: background var(--duration-fast); }
.msb-root .data-table tbody tr:nth-child(even) { background: #FAFCFC; }
.msb-root .data-table tbody tr:hover { background: rgba(216, 234, 233, .35); }
/* Read-only tables (record responsibilities): keep striping, drop the hover tint so static rows
   don't advertise a click they can't honour. */
.msb-root .data-table.msb-static tbody tr:hover { background: transparent; }
.msb-root .data-table.msb-static tbody tr:nth-child(even):hover { background: #FAFCFC; }
.msb-reg-table tbody tr { cursor: pointer; }
.msb-reg-table tbody tr:last-child td { border-bottom: none; }
.msb-root .data-table th.srt { cursor: pointer; }
.msb-root .data-table th.srt:hover { color: var(--navy); }

/* ---- register ---- */
.msb-reg { display: block; }
.msb-reg-count { font-size: 13px; color: var(--color-text-secondary); }
.msb-reg-count b { color: var(--navy); font-weight: 600; }
.msb-active { display: flex; gap: 7px; flex-wrap: wrap; }
.msb-tag { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--navy); background: #D8EAE9; border-radius: var(--radius-full); padding: 4px 10px; }
.msb-tag .x { cursor: pointer; opacity: .6; font-weight: 700; border: none; background: none; color: inherit; font-size: inherit; padding: 0; }
.msb-tag .x:hover { opacity: 1; }
.msb-panel { background: var(--color-white); border: 1px solid var(--color-border); border-radius: var(--radius-lg); overflow: hidden; }
.msb-resp { min-width: 188px; }
.msb-resp .msb-statbar { margin-bottom: 5px; }
.msb-resp .line { font-size: 11.5px; color: var(--color-text-secondary); }
.msb-resp .line b { color: #1F3E52; font-weight: 600; }
.msb-empty { padding: 48px 20px; text-align: center; color: var(--color-text-secondary); font-size: 13.5px; }

/* ---- record page ---- */
.msb-rec-crumb { padding: 16px 30px; border-bottom: 1px solid var(--border-light); background: var(--color-white); display: flex; align-items: center; gap: 7px; flex-wrap: wrap; font-size: 13px; }
.msb-rec-crumb a { color: var(--color-text-link); cursor: pointer; font-weight: 500; }
.msb-rec-crumb a:hover { color: var(--color-text-link-hover); text-decoration: underline; }
.msb-rec-crumb .sep { color: var(--color-text-secondary); }
.msb-rec-crumb .cur { color: var(--navy); font-weight: 600; }

.msb-rec-hero { background: var(--color-white); border-bottom: 1px solid var(--border); padding: 22px 30px 24px; }
.msb-rec-hero-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.msb-rec-num { font-family: var(--mono); font-size: 13px; color: var(--color-text-secondary); }
.msb-rec-title { font-size: 26px; font-weight: 600; color: var(--navy); margin-top: 4px; letter-spacing: -0.01em; line-height: 1.2; font-family: var(--font-heading); }
.msb-rec-strip { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; font-size: 12.5px; color: var(--color-text-secondary); }
.msb-rec-strip .msb-pages { white-space: nowrap; }
.msb-rec-strip .mono { font-size: 12px; }
.msb-rec-actions { display: flex; gap: 8px; flex-shrink: 0; }

.msb-rec-body { display: grid; grid-template-columns: 1fr 312px; gap: 26px; padding: 26px 30px; align-items: start; }
.msb-card { background: var(--color-white); border: 1px solid var(--color-border-light); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: 22px; margin-bottom: 22px; }
.msb-card-h { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.msb-card-h h3 { font-size: 15px; font-weight: 600; color: var(--navy); font-family: var(--font-heading); }
.msb-go { font-size: 12.5px; font-weight: 600; color: var(--color-text-link); cursor: pointer; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; border: none; background: none; font-family: var(--font-primary); }
.msb-go:hover { color: var(--navy); gap: 8px; }
.msb-go svg { width: 14px; height: 14px; }

.msb-asg-count { margin-top: 10px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.msb-asgfilters { display: flex; gap: 7px; flex-wrap: wrap; margin: 8px 0 14px; }
.msb-fchip { font-size: 12px; font-weight: 500; padding: 5px 12px; border-radius: var(--radius-full); border: 1px solid var(--color-control-border); color: var(--color-text-secondary); background: var(--color-white); cursor: pointer; font-family: var(--font-primary); }
.msb-fchip.on { background: var(--navy); color: var(--color-white); border-color: var(--navy); }
.msb-asg-resp { color: var(--ink); font-weight: 500; max-width: 420px; }
.msb-asg-resp .s { font-size: 11.5px; color: var(--muted); margin-top: 3px; font-family: var(--mono); }

.msb-ver { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border-light); }
.msb-ver:last-child { border-bottom: none; }
.msb-ver-badge { font-family: var(--mono); font-size: 11px; font-weight: 500; background: var(--color-white); border: 1px solid var(--color-border); color: var(--color-info); border-radius: 6px; padding: 3px 8px; flex-shrink: 0; }
.msb-ver.current .msb-ver-badge { background: var(--navy); border-color: var(--navy); color: var(--color-white); }
.msb-ver-main { flex: 1; min-width: 0; }
.msb-ver-line { font-size: 13px; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.msb-ver-meta { font-size: 11px; color: var(--muted); margin-top: 2px; font-family: var(--mono); }
.msb-ver-state { font-size: 9.5px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; padding: 1px 7px; border-radius: var(--radius-full); }
.msb-st-cur { background: var(--ok-bg); color: var(--ok); }
.msb-st-sup { background: color-mix(in srgb, var(--color-warning) 14%, var(--color-white)); color: color-mix(in srgb, var(--color-warning) 88%, var(--color-navy)); }

/* aside */
.msb-aside-card { background: var(--color-white); border: 1px solid var(--color-border-light); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: 18px; margin-bottom: 18px; }
.msb-aside-card .h { font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-bottom: 14px; }
.msb-akv { display: flex; flex-direction: column; gap: 13px; }
.msb-akv .row { display: flex; flex-direction: column; gap: 2px; }
.msb-akv .k { font-size: 11px; color: var(--muted); }
.msb-akv .v { font-size: 13px; color: var(--ink); }
.msb-role-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border-light); cursor: pointer; }
.msb-role-row:last-child { border-bottom: none; }
.msb-role-row:hover .rn { color: var(--navy); }
.msb-role-row .rn { font-size: 12.5px; color: var(--ink-soft); }
.msb-role-row .rc { font-family: var(--mono); font-size: 11.5px; color: var(--color-text-secondary); background: var(--surface); border-radius: var(--radius-full); padding: 1px 9px; flex-shrink: 0; }

/* ---- buttons (scoped to the record hero / asides) ---- */
.msb-root .btn { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 500; padding: 9px 15px; border-radius: var(--radius-md); cursor: pointer; border: 1px solid var(--border); background: var(--color-white); color: var(--navy); transition: background 120ms, border-color 120ms; white-space: nowrap; font-family: var(--font-primary); }
.msb-root .btn:hover { background: var(--surface); border-color: var(--color-blue); }
.msb-root .btn svg { width: 15px; height: 15px; }
.msb-root .btn-primary { background: var(--navy); color: var(--color-white); border-color: var(--navy); }
.msb-root .btn-primary:hover { background: var(--color-blue); border-color: var(--color-blue); }
.msb-root .btn-secondary { background: var(--color-white); color: var(--navy); }
.msb-root .btn-sm { padding: 6px 11px; font-size: 12px; }

/* ---- source-PDF actions ---- */
/* Inline notice when a document has no retrievable source PDF (local sets without uploads). */
.msb-pdf-note { font-size: 12px; color: var(--ink-soft); align-self: center; }
/* Click-away layer under the facet menus (z 40): a click anywhere else closes the open menu. */
.msb-click-away { position: fixed; inset: 0; z-index: 10; background: transparent; }

/* processing placeholder (queued / extracting record card) */
.msb-proc { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-soft); padding: 18px 0; }
.msb-proc .spin { width: 16px; height: 16px; border: 2px solid var(--border); border-top-color: var(--blue); border-radius: 50%; animation: msb-spin 0.8s linear infinite; flex-shrink: 0; }
@keyframes msb-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .msb-proc .spin { animation: none; } }

@media (max-width: 1024px) {
  .msb-rec-body { grid-template-columns: 1fr; }
}

/* The app shell reduces content padding from 40px to 24px at its laptop breakpoint.
   Match the active inset so the record view is full-bleed without horizontal overflow. */
@media (max-width: 1512px) {
  .msb-main { margin: calc(-1 * var(--space-6)); }
}

/* ============================================================
   Management System Explorer (feature 024, US3).
   Ported verbatim from the genesis prototype CSS
   (ms-explore/ms-shared.css + ms-explore/direction-a.html),
   renamed to the production prefixes the ms-explorer-v12.js
   render structure uses: the facet segmented control (.seg /
   .seg-btn), folder tree (.ms-tree / .ms-tnode* / .ms-tchild*),
   folder grid (.ms-folder*) and breadcrumb (.ms-crumb).
   All scoped under .msb-root so the bare prototype selectors
   never collide with the app's existing global classes.
   ============================================================ */

/* ---- view toggle (Register | Explorer) ---- */
.msb-view-seg { display: inline-flex; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 3px; gap: 2px; }
.msb-view-seg .seg-btn { font-size: 12.5px; font-weight: 500; color: var(--color-text-secondary); padding: 6px 16px; border-radius: 6px; white-space: nowrap; border: none; background: none; cursor: pointer; font-family: var(--font-primary); transition: background 120ms, color 120ms; }
.msb-view-seg .seg-btn:hover { color: var(--navy); }
.msb-view-seg .seg-btn.active { background: var(--navy); color: var(--color-white); }
/* small "Beta" pill on the Explorer toggle — amber tokens so it reads on both button states */
.msb-view-seg .msb-beta { font-size: 9px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; background: var(--color-warning-tint); color: var(--color-warning); border-radius: var(--radius-full); padding: 1px 6px; margin-left: 4px; vertical-align: middle; }
.msb-view-seg .seg-btn.active .msb-beta { background: color-mix(in srgb, var(--color-warning) 10%, var(--color-white)); }

/* ---- explorer toolbar (facet segmented control + search) ----
   Sits in the page flow under the shared page-header now, so it reads as an inline control
   row rather than the old full-bleed white bar. */
.msb-exp-toolbar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: var(--space-4); }
.msb-exp-browseby { display: flex; align-items: center; gap: 10px; }
.msb-exp-browseby .lbl { font-size: 10px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.msb-exp-search { position: relative; display: flex; align-items: center; flex: 1; min-width: 240px; }
.msb-exp-search svg { position: absolute; left: 12px; width: 16px; height: 16px; color: var(--muted-2); pointer-events: none; }
.msb-exp-search input { width: 100%; padding: 10px 14px 10px 36px; border: 1px solid var(--color-control-border); border-radius: var(--radius-md); font-size: 13px; color: var(--ink); background: var(--color-white); font-family: var(--font-primary); }
.msb-exp-search input:focus { outline: none; border-color: var(--color-blue); box-shadow: var(--shadow-focus); }
.msb-exp-search .clr { position: absolute; right: 10px; width: 20px; height: 20px; border: none; background: none; color: var(--muted-2); cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 15px; }
.msb-exp-search .clr:hover { color: var(--navy); }

/* facet segmented control (.seg / .seg-btn) — verbatim from ms-shared.css, renamed .on -> .active */
.msb-root .seg { display: inline-flex; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 3px; gap: 2px; }
.msb-root .seg-btn { font-size: 12.5px; font-weight: 500; color: var(--color-text-secondary); padding: 6px 13px; border-radius: 6px; white-space: nowrap; border: none; background: none; cursor: pointer; font-family: var(--font-primary); transition: background 120ms, color 120ms; }
.msb-root .seg-btn:hover { color: var(--navy); }
.msb-root .seg-btn.active { background: var(--navy); color: var(--color-white); }

/* ---- explorer body (tree rail + content) ----
   In the new flat-page flow the body is a card with a bounded height so the tree and content scroll
   independently, matching the old full-bleed feel without a hard-coded viewport container. */
.msb-exp-body { display: flex; min-height: 0; height: calc(100vh - 260px); min-height: 420px; background: var(--color-white); border: 1px solid var(--color-border-light); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden; }

/* folder tree (.ms-tree / .ms-tnode* / .ms-tchild*) — verbatim from direction-a.html, prefixed */
.ms-tree { width: 262px; flex-shrink: 0; background: var(--color-white); border-right: 1px solid var(--border); overflow-y: auto; padding: 14px 12px; }
.ms-tree-root { display: flex; align-items: center; gap: 8px; padding: 8px 9px; font-size: 12.5px; color: var(--ink); cursor: pointer; font-weight: 600; border-bottom: 1px solid var(--border-light); margin-bottom: 4px; padding-bottom: 10px; }
.ms-tree-root:hover { color: var(--navy); }
.ms-tree-root.active { color: var(--navy); }
.ms-tree-root svg { width: 15px; height: 15px; color: var(--color-teal); }
.ms-tnode-row, .ms-tchild { display: flex; align-items: center; gap: 6px; padding: 7px 8px; border-radius: var(--radius-sm); cursor: pointer; font-size: 12.5px; color: var(--ink-soft); }
.ms-tnode-row:hover, .ms-tchild:hover { background: var(--surface); }
.ms-tnode-row.active, .ms-tchild.active { background: var(--teal-soft); color: var(--navy); font-weight: 600; }
.ms-tnode-caret { width: 14px; height: 14px; flex-shrink: 0; color: var(--muted-2); transition: transform .15s; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.ms-tnode-caret svg { width: 12px; height: 12px; }
.ms-tnode.open > .ms-tnode-row .ms-tnode-caret { transform: rotate(90deg); }
.ms-tnode-icon { width: 15px; height: 15px; flex-shrink: 0; color: var(--color-teal); display: flex; }
.ms-tnode-icon svg { width: 15px; height: 15px; }
.ms-tnode-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ms-tnode-count { font-size: 11px; color: var(--muted-2); font-family: var(--mono); flex-shrink: 0; }
.ms-tnode-children { margin-left: 13px; border-left: 1px solid var(--border-light); padding-left: 4px; display: none; }
.ms-tnode.open > .ms-tnode-children { display: block; }
.ms-tchild { padding-left: 8px; font-size: 12px; color: var(--color-text-link); }
.ms-tree-hint { margin-top: 12px; padding: 10px 9px 0; border-top: 1px solid var(--border-light); font-size: 11px; color: var(--muted); line-height: 1.5; }

/* content pane */
.msb-exp-content { flex: 1; overflow-y: auto; padding: 20px 26px 60px; min-width: 0; }
.ms-crumb { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; font-size: 13px; margin-bottom: 18px; }
.ms-crumb a { color: var(--color-text-link); cursor: pointer; font-weight: 500; }
.ms-crumb a:hover { color: var(--color-text-link-hover); text-decoration: underline; }
.ms-crumb .sep { color: var(--color-text-secondary); }
.ms-crumb .current { color: var(--navy); font-weight: 600; }
.ms-pane-head { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.ms-pane-count { font-size: 12.5px; color: var(--muted); }

/* folder grid (.ms-folder*) — verbatim from ms-shared.css, prefixed */
.ms-folder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); gap: 14px; }
.ms-folder { display: flex; align-items: flex-start; gap: 13px; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px; cursor: pointer; text-align: left; transition: border-color 120ms, box-shadow 120ms; width: 100%; font-family: var(--font-primary); }
.ms-folder:hover { border-color: var(--color-blue); box-shadow: var(--shadow-sm); }
.ms-folder-ic { width: 38px; height: 38px; border-radius: var(--radius-md); background: color-mix(in srgb, var(--color-teal) 28%, var(--color-white)); color: var(--color-navy); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ms-folder-ic svg { width: 20px; height: 20px; }
.ms-folder-main { flex: 1; min-width: 0; }
.ms-folder-name { font-size: 14px; font-weight: 600; color: var(--ink); line-height: 1.3; }
.ms-folder-meta { font-size: 12px; color: var(--muted); margin-top: 4px; }
.ms-folder-meta .attn { color: var(--warn); font-weight: 600; }
.ms-folder-arrow { color: var(--border); flex-shrink: 0; align-self: center; }
.ms-folder-arrow svg { width: 16px; height: 16px; }

/* leaf-table extras (reuse .data-table; hover comes from the shared .msb-root .data-table rule) */
.ms-result-path { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.msb-exp-leaf tbody tr { cursor: pointer; }

@media (max-width: 1024px) {
  .ms-tree { width: 218px; }
}
