/* Assets and Parts as pages of the Today day book (DESIGN.md). Loaded after room-layout.css, whose room grammar
   (heading, panels, grouped rows, pager, dialogs) both rooms use; only what is their own is here, scoped to the room
   (.rv-assets, .rv-parts) or its dialogs (.rv-asset-card, .rv-part-card). Tokens only, from theme.css. */

/* shared by both rooms: a group's count beside its name, a count inside a view switch */
:is(.rv-assets,.rv-parts) .rv-grp > h2 i,:is(.rv-assets,.rv-parts) .rv-seg i{margin-left:8px;font-style:normal;color:var(--muted)}
:is(.rv-assets,.rv-parts) .rv-seg button[aria-pressed=true] i{color:var(--ink)}
:is(.rv-assets,.rv-parts) .rv-head .rv-link{margin-right:8px}
:is(.rv-asset-card,.rv-part-card) h3{margin:0;font:var(--w-strong) var(--t-section)/24px var(--display);color:var(--ink)}
:is(.rv-asset-card,.rv-part-card) .rv-note{color:var(--muted);text-wrap:pretty}

/* A quiet empty state shared by Assets, Factory and Products. */
:is(.rv-assets,.rv-factory,.pr-page) .rv-none{display:flex;align-items:center;min-height:44px;margin:0;color:var(--muted)}

/* ASSETS: the list foot's notice, which may carry the save barrier's own buttons */
.rv-assets .rv-foot [role=status]:empty{display:none}
.rv-assets .rv-foot [role=status]{display:flex;flex-wrap:wrap;align-items:center;gap:0 16px}

/* an asset's record: the facts ruled, links and evidence stacked at the right */
.rv-asset-card .rv-dialog-body{display:flex;flex-direction:column;gap:20px}
.rv-asset-card .pr{margin:0;color:var(--muted);text-wrap:pretty}
/* a fact's label and value both from the top: a value of several lines never pulls its label down */
.rv-asset-card .card .f{align-items:start}
.rv-asset-card .card .f .v,.rv-asset-card .card .f .v:has(.lk){display:flex;flex-direction:column;align-items:flex-end;gap:4px}
.rv-asset-card .card .f .v i{display:block}
/* a link's own 44px tap area, its words centred in it level with the label: 12px above and below them reach into the
   row's padding (negative margins), so the row is no taller; a link after another starts below that one's area, so two
   areas never overlap (24px between their words) */
.rv-asset-card .card .f .v .lk{display:flex;align-items:center;min-height:44px;margin:-12px 0}
.rv-asset-card .card .f .v .lk + .lk{margin-top:8px}
/* what follows a link (the dated index note) starts where its 44px area ends, never over it */
.rv-asset-card .card .f .v .lk + :not(.lk){margin-top:8px}
.rv-asset-card .card .f .v > :not(.lk) + .lk{margin-top:0}
.rv-asset-card .ref{overflow-wrap:anywhere}
.rv-asset-card .rv-copy{min-height:44px;padding:0 14px;border:0;background:none;color:var(--ink);font:var(--w-mid) var(--t-row)/1.2 var(--body)}
.rv-asset-card .go .btn.ghost{min-height:48px}
.rv-asset-card .go .lk{min-height:48px}
.rv-asset-card .rv-said{color:var(--ink)}
.rv-asset-card .rv-said:empty{display:none}
/* its history: one entry a rule, when and who in grey */
.rv-asset-card .rv-hist{display:grid;gap:12px}
.rv-asset-card .rv-hist li{display:grid;gap:4px;padding:12px 0;border-top:1px solid var(--line)}
.rv-asset-card .rv-hist .when,.rv-asset-card .rv-hist .chg{color:var(--muted);overflow-wrap:anywhere}
/* the sources: each a ruled card under its name */
.rv-asset-card .rv-srcs{display:grid;gap:20px}
.rv-asset-card .rv-srcs > li{display:grid;gap:12px}
.rv-asset-card .rv-srcs h3 .lk{font:inherit}
/* the forms: two columns of fields where there is room, the long ones across */
.rv-asset-card .form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}
.rv-asset-card .span-two{grid-column:1 / -1}
.rv-asset-card select[multiple]{min-height:160px;padding:8px}
.rv-asset-card .error{color:var(--ink);padding:12px 0;border-top:1px solid var(--line)}
.rv-asset-card .rv-filt .go [role=status]{flex:none;width:100%;color:var(--muted)}
@media (max-width:699px){.rv-asset-card .form-grid{grid-template-columns:minmax(0,1fr)}}

/* the view switch keeps its own line whole rather than wrapping a view under the others */
:is(.rv-assets,.rv-parts) .rv-tools .rv-seg{flex:0 0 auto;flex-wrap:nowrap}

/* PARTS: the what-if line under the panel, Clear beside it */
.rv-parts-say{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.rv-parts .rv-wiw,.rv-part-card .rv-wiw{display:flex;flex-wrap:wrap;align-items:center;gap:4px 20px}
.rv-parts .rv-wi,.rv-part-card .rv-wi{padding:10px 0;color:var(--muted);text-wrap:pretty}
.rv-parts .rv-wi b,.rv-part-card .rv-wi b{font-weight:var(--w-mid);color:var(--ink)}
.rv-part-card .rv-wiw .rv-link{display:inline-flex;align-items:center;min-height:44px;padding:0;border:0;background:none;color:var(--accent);font:var(--w-mid) var(--t-row)/1.2 var(--body)}
/* a product's strip of parts: filled built, outlined missing, blue ticked */
.rv-strip{display:flex;flex-wrap:wrap;gap:4px;justify-content:flex-end}
.rv-strip i{display:block;width:12px;height:12px;border:1px solid var(--line2);border-radius:3px}
.rv-strip i.on{background:var(--muted);border-color:var(--muted)}
.rv-strip i.tx{background:var(--accent);border-color:var(--accent)}
.rv-part-card .rv-strip{justify-content:flex-start}
/* a part not built yet: the whole row is its tick, the box at the right edge where a row's arrow sits */
:is(.rv-parts,.rv-part-card) .rv-tk{position:relative}
:is(.rv-parts,.rv-part-card) .rv-tk input{position:absolute;inset:0;width:100%;height:100%;margin:0;opacity:0;cursor:pointer;min-height:0}
:is(.rv-parts,.rv-part-card) .rv-box{grid-area:chev;width:20px;height:20px;border:1px solid var(--line2);border-radius:6px}
:is(.rv-parts,.rv-part-card) .rv-tk:has(:checked) .rv-box{background:var(--accent);border-color:var(--accent);box-shadow:inset 0 0 0 3px var(--bg2)}
:is(.rv-parts,.rv-part-card) .rv-tk .rv-n{color:var(--muted)}
:is(.rv-parts,.rv-part-card) .rv-tk:has(:checked) .rv-n{color:var(--ink)}
:is(.rv-parts,.rv-part-card) .rv-tk:has(input:focus-visible){outline:2px solid var(--accent);outline-offset:2px;border-radius:8px}
/* an opened part or product: its sections stacked, the import line in mono and wrapped whole */
.rv-part-card .rv-dialog-body{display:flex;flex-direction:column;gap:20px}
.rv-part-card .pr{margin:0;color:var(--muted)}
.rv-part-card .rv-back{align-self:flex-start}
.rv-part-card .rv-sec{display:flex;flex-direction:column;gap:4px}
.rv-part-card .rv-sec p{color:var(--ink);text-wrap:pretty}
.rv-part-card .rv-where li{display:flex;flex-wrap:wrap;justify-content:space-between;gap:4px 16px;padding:12px 0;border-top:1px solid var(--line)}
.rv-part-card .rv-site{color:var(--muted);overflow-wrap:anywhere}
.rv-part-card .rv-code{display:block;padding:12px 0;border-block:1px solid var(--line);color:var(--ink);font:var(--w-row) var(--t-row)/1.5 var(--mono);white-space:pre-wrap;overflow-wrap:anywhere}
.rv-part-card p.rv-row{cursor:default}
/* the narrowest phones keep the whole switch on one line */
@media (max-width:420px){:is(.rv-assets,.rv-parts) .rv-tools .rv-seg button{padding:0 10px}}

/* WIDE: the rows of a group in two columns, every row ruled above, so a page holds twice as many */
@media (min-width:1024px){
  :is(.rv-assets,.rv-parts) .rv-grp > ol{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));column-gap:32px}
  :is(.rv-assets,.rv-parts) .rv-grp > h2{padding-bottom:8px}
  .rv-room:is(.rv-assets,.rv-parts) .rv-grp > h2 + ol > li:not([hidden]) > .rv-row{border-top:1px solid var(--line)}
}

/* ASSETS at one glance: the register in its dialog, its view switch and Filter on one line over the records by kind */
/* the register is as tall as what it holds, up to the window; past that only the list scrolls (an empty Review is a
   short dialog, never a tall blank one) */
.rv-asset-register{height:fit-content;max-height:min(760px,calc(100% - 32px))}
.rv-asset-register[open]{display:flex;flex-direction:column}
.rv-asset-register .rv-dialog-body{display:flex;flex-direction:column;flex:0 1 auto;min-height:0;max-height:none;overflow:hidden}
.rv-asset-register .rv-assets-list{flex:0 1 auto;min-height:0;overflow:auto;overscroll-behavior:contain}
/* a row's secondary line (what Chris decides in Review, else its product; what tells look-alike names apart): the
   console's secondary metadata, 12px in the secondary colour, under the name */
.rv-asset-register .rv-sub{font:var(--w-row) var(--t-meta)/16px var(--body);color:var(--muted)}
/* what Chris decides about a Review record, first in its dialog */
.rv-asset-card .rv-ask{margin:0 0 8px;font:var(--w-strong) var(--t-row)/1.4 var(--body);color:var(--ink)}
/* the gap scale: 12px inside a group (the views; Filter and Add asset), 20px between the two groups */
.rv-asset-register .rv-reg-tools{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:16px}
/* while a save waits for confirmation: why saving is paused and until when, beside each paused button (the register, a
   record's dialog, the page), then its check, the same accent control everywhere; afterwards, the check's answer */
.rv-paused{display:flex;flex-wrap:wrap;align-items:center;column-gap:12px;margin:12px 0 0;color:var(--muted)}
.rv-paused[hidden]{display:none}
.rv-paused .rv-link{display:inline-flex;align-items:center;min-height:44px;padding:0;border:0;background:none;color:var(--accent);font:var(--w-mid) var(--t-row)/1.2 var(--body);text-decoration:underline;text-underline-offset:3px;cursor:pointer}
.rv-paused .rv-link:hover{text-decoration-thickness:2px}
.rv-asset-register .rv-reg-acts{display:flex;align-items:center;gap:12px}
.rv-asset-register .rv-seg{display:flex;flex-wrap:nowrap;gap:8px;min-width:0}
.rv-asset-register .rv-seg button{display:inline-flex;align-items:center;min-height:44px;padding:0 12px;border:0;border-radius:10px;background:none;color:var(--muted);font:var(--w-mid) var(--t-row)/1 var(--body);white-space:nowrap;cursor:pointer}
/* The selected register view is underlined. */
.rv-asset-register .rv-seg button[aria-pressed=true]{color:var(--accent);text-decoration:underline;text-underline-offset:4px}
/* a group whose rows share one source says it once, after its count */
.rv-asset-register .rv-grp > h2 .rv-gsrc{margin-left:8px;color:var(--muted)}
.rv-asset-register .rv-grp > h2 .rv-gsrc::before{content:"· ";}
.rv-asset-register .rv-seg i{margin-left:8px;font-style:normal;color:var(--muted)}
.rv-asset-register .rv-seg button[aria-pressed=true] i{color:var(--accent)}
.rv-asset-register .ftog{display:inline-flex;align-items:center;gap:8px;min-height:44px;padding:0 14px;border:0;background:none;color:var(--ink);font:var(--w-mid) var(--t-row)/1 var(--body);cursor:pointer}
.rv-asset-register .ftog b{min-width:20px;height:20px;padding:0 6px;border-radius:10px;background:var(--accent);color:var(--accent-ink);font:var(--w-strong) var(--t-meta)/20px var(--body);text-align:center}
.rv-asset-register .rv-grp > h2{display:block;margin:0;padding:20px 0 12px;font:var(--w-strong) var(--t-section)/24px var(--display);color:var(--ink)}
.rv-asset-register .rv-grp > h2 i{margin-left:8px;font-style:normal}
.rv-asset-register .rv-grp ol{list-style:none;margin:0;padding:0}
.rv-asset-register .rv-empty{color:var(--muted)}
/* the register keeps one size across its views: the list takes what the views and Filter leave, an empty one centres its
   line in it, and the last row always clears what sits under the list */
.rv-asset-register .rv-assets-list{flex:1 1 auto;padding-bottom:12px}
.rv-asset-register .rv-assets-list:has(> .rv-empty){display:flex;align-items:center;justify-content:center;text-align:center}
/* a phone: the four views in one row (each name over its count), Filter and Add asset at the dialog's foot, so the first
   record sits high on the screen; a record is its name across the row (14px, the console's pinned body, wrapping rather
   than clipped), then one line: what it is, and where it stands (a renewal, a status) at its right. Where it was read from
   stays in the record's own dialog. Nothing is cut */
@media (max-width:699px){
  .rv-asset-register{max-height:calc(100% - 24px)}
  .rv-asset-register .rv-reg-tools{display:contents}
  /* each view's name on one line over its count, the views sharing the row by what they hold, 8px apart */
  .rv-asset-register .rv-seg{display:grid;grid-template-columns:repeat(4,auto);gap:8px;width:100%}
  .rv-asset-register .rv-seg button{flex-direction:column;justify-content:center;gap:4px;min-height:52px;padding:6px 8px;white-space:nowrap;text-align:center;line-height:1.15}
  .rv-asset-register .rv-seg i{margin-left:0;font-size:var(--t-meta)}
  .rv-asset-register [data-paused]{order:1}
  .rv-asset-register .rv-assets-list{order:2}
  .rv-asset-register .rv-reg-acts{order:3;justify-content:flex-end;margin-top:12px;padding-top:12px;border-top:1px solid var(--line)}
  .rv-asset-register .rv-row{grid-template-columns:minmax(0,1fr) auto;grid-template-areas:"n chev" "sub chev";column-gap:12px}
  /* where it stands takes only its own width (two words, at most just over half the row), so what it is keeps one line */
  .rv-asset-register .rv-row:not(:has(.rv-rm .src)){grid-template-columns:minmax(0,1fr) fit-content(55%) auto;grid-template-areas:"n n chev" "sub rm chev"}
  /* a product has no line under its name: its count stays beside the name */
  .rv-asset-register .rv-row:not(:has(.rv-sub,.rv-rm .src)){grid-template-columns:minmax(0,1fr) auto auto;grid-template-areas:"n rm chev"}
  .rv-asset-register .rv-rt{display:contents}
  .rv-asset-register .rv-rt .rv-n{grid-area:n}
  .rv-asset-register .rv-rt .rv-sub{grid-area:sub;text-wrap:balance}
  .rv-asset-register .rv-rm{grid-area:rm;text-align:right;text-wrap:balance;overflow-wrap:normal}
  .rv-asset-register .rv-rm:has(.src){display:none}
  /* Names use row type and their details use muted metadata. */
  .rv-asset-register .rv-rt .rv-n{font:var(--w-mid) var(--t-row)/22px var(--body);color:var(--ink)}
  .rv-asset-register .rv-rt .rv-sub{font:var(--w-row) var(--t-meta)/18px var(--body);color:var(--muted)}
  .rv-asset-register .rv-rm{font-size:var(--t-row);line-height:22px}
}

/* the narrowest phones (320px): the four views still fit the dialog, each name whole on one line, 4px apart (the gap
   scale's smallest), a point smaller */
@media (max-width:359px){
  .rv-asset-register .rv-seg{gap:4px}
  .rv-asset-register .rv-seg button{padding:6px 4px;font-size:var(--t-meta)}
}

/* a source's or an account's own page: Back stays inside the page and wraps where any name does, never cut short; a
   long record name breaks only where the room put a break (after _ . / or a hyphen not inside a date, or at a space);
   using the shared row and detail tokens. */
/* a source's or account's head holds by construction at any width: Back sits beside the heading only while it fits there
   on one line, else it drops below it; the heading and Back may each shrink to nothing (the shared tools column never
   does by itself, room-layout.css .rv-g-tools) and, as a last resort, break anywhere, so neither ever widens the page */
.rv-assets .rv-g-head{flex-wrap:wrap}
.rv-assets .rv-g-head > div:first-child{flex:0 1 auto;min-width:0}
.rv-assets .rv-g-head .rv-g-fig{overflow-wrap:anywhere}
.rv-assets .rv-g-head .rv-g-tools{flex:0 1 auto;min-width:0;max-width:100%}
.rv-assets .rv-g-tools .rv-back{display:inline-block;max-width:100%;overflow-wrap:anywhere;vertical-align:bottom}
/* a date in a name is never split, wherever the name is shown; it reads as the name's own text (a row title's spans are
   otherwise small grey blocks, room-layout.css .rv-g-rt span) */
:is(.rv-assets,.rv-asset-card) .rv-nb{display:inline;margin:0;font:inherit;color:inherit;white-space:nowrap}
.rv-assets .asset-rows .rv-g-rt b{overflow-wrap:break-word;word-break:normal}
/* the pager spans the list's whole grid, so its Next ends where the rows' Open buttons do */
.rv-assets .asset-rows > .rv-pager{grid-column:1 / -1}


@media (max-width:559px){
  .rv-dialog.rv-asset-register{height:100%;max-height:none}
  .rv-asset-register .rv-dialog-body{flex:1}
}

.rv-part-card .rv-sec > .label {
  font:var(--w-strong) var(--t-section)/24px var(--display);
  color:var(--ink);
}
.rv-asset-card .btn.ghost {background:none;border:1px solid var(--line2);}
