/* v2.19.0-staging (Issue Form, Phase 1): the Issue form page and the A4 Asset Issue Form, which reuses the Return Form's look (.arf classes in
   asset_returns.css) with its own named page. No horizontal page scroll: wide tables scroll in their panel. */
/* v2.19.6-staging (Stage 5, laptop / desktop only): the Issue form fills the window below the header with NO outer page scroll; only the asset list
   and the 'To issue' list scroll, each inside its own bordered panel with a sticky header. The height comes from fit_height() (--ai-h); every rule
   here is screen-only, so the A4 print below is untouched. Colours only from tokens.css. */
@media screen{
.nr.ai .ai-grid{display:grid;grid-template-columns:minmax(0,1fr) clamp(16rem,34%,30rem);gap:0.75rem;align-items:stretch}
.nr.ai.ai-fit .ai-grid{height:var(--ai-h,auto);min-height:0}
.nr.ai .ai-side{display:flex;flex-direction:column;gap:0.5rem;min-width:0;min-height:0}
.nr.ai .ai-side .nr-card,.nr.ai .ai-grid>.nr-card{margin:0}
.nr.ai.ai-fit .ai-assets{display:flex;flex-direction:column;min-height:0;min-width:0;padding:0.625rem 0.75rem}
.nr.ai.ai-fit .ai-side .nr-card{padding:0.5rem 0.75rem}
.nr.ai .ai-head{display:flex;align-items:flex-start;justify-content:space-between;gap:0.75rem;margin:0 0 0.375rem}
.nr.ai .ai-title{min-width:0;flex:1 1 auto}
.nr.ai .ai-title .nr-h2,.nr.ai .ai-carthead .nr-h2,.nr.ai .ai-who .nr-h2,.nr.ai .ai-recent .nr-h2{margin:0 0 0.125rem}
.nr.ai .ai-help{font-size:0.8125rem;line-height:1.35;color:var(--nr-muted,var(--c-muted));margin:0}
.nr.ai .ai-refreshbox{display:flex;flex-direction:column;align-items:flex-end;gap:0.25rem;flex:0 0 auto;text-align:right}
.nr.ai .ai-stamp{display:flex;flex-direction:column;align-items:flex-end;font-size:0.75rem;line-height:1.3;color:var(--nr-muted,var(--c-muted))}
.nr.ai .ai-stamp.ai-st-stale .ai-stampline:last-child,.nr.ai .ai-stamp.ai-st-none{color:var(--c-warn)}
.nr.ai .ai-stamp.ai-st-loading{opacity:0.6}
.nr.ai #ai-refreshout{margin:0 0 0.375rem}
.nr.ai .ai-filters{display:flex;flex-wrap:wrap;gap:0.375rem 0.625rem;align-items:flex-end;margin:0 0 0.25rem}
.nr.ai .ai-filters .nr-field{display:flex;flex-direction:column;gap:0.125rem;font-size:0.8125rem;min-width:9rem;flex:1 1 9rem}
.nr.ai .ai-filters .ai-q{flex:2 1 16rem;min-width:min(16rem,100%)}
.nr.ai .ai-filters select{max-width:100%}
.nr.ai .ai-filters input,.nr.ai .ai-filters select{font:inherit;font-size:0.875rem;padding:0.3125rem 0.5rem}
.nr.ai .ai-found{margin:0.125rem 0 0.25rem;font-size:0.8125rem}
.nr.ai .ai-panel{border:1px solid var(--nr-line,var(--c-line));border-radius:var(--nr-r,0.375rem);overflow:auto;min-height:0;background:var(--nr-card)}
.nr.ai.ai-fit .ai-listpanel{flex:1 1 0;min-height:6rem}
.nr.ai .ai-panel thead th{position:sticky;top:0;z-index:1;background:var(--nr-card);box-shadow:inset 0 -1px 0 var(--nr-line,var(--c-line))}
.nr.ai .ai-panel:focus-visible{outline:2px solid var(--c-brand);outline-offset:1px}
.nr.ai .ai-table,.nr.ai .ai-carttable{width:100%;margin:0}
.nr.ai .ai-table th,.nr.ai .ai-table td{padding:0.3125rem 0.5rem}
.nr.ai .ai-table td{overflow-wrap:anywhere}
.nr.ai .ai-table tr.ai-on td{background:var(--acc2,var(--c-brand-tint))}
.nr.ai .ai-table tr.ai-isheld td{color:var(--nr-muted,var(--c-muted))}
.nr.ai .ai-held{display:inline-block;white-space:nowrap;font-size:0.75rem;font-weight:600;color:var(--amber,var(--c-warn))}
/* v2.19.7 (item 5): a search hit that cannot be issued - red warning, no tick box (colours from tokens.css only) */
.nr.ai .ai-table tr.ai-blocked td{background:var(--c-overdue-bg);color:var(--c-overdue)}
.nr.ai .ai-table tr.ai-blocked:not(.ai-warnrow) td:first-child{box-shadow:inset 3px 0 0 var(--c-overdue)}
.nr.ai .ai-table tr.ai-warnrow td{padding-top:0;border-top:0}
.nr.ai .ai-warn{color:var(--c-overdue);font-weight:600}
.nr.ai .ai-warnrow .ai-warn{display:inline-block;position:sticky;left:0.5rem;max-width:min(48vw,60rem);white-space:normal}   /* wraps and stays in view when the table scrolls sideways */
.nr.ai .ai-held.ai-warn{color:var(--c-overdue)} .nr.ai .ai-heldto{display:block;white-space:normal;max-width:7rem;font-weight:400}
.nr.ai .ai-table .ar-chk{width:4.5rem;text-align:left}
.nr.ai .ai-pager{justify-content:flex-end;align-items:center;gap:0.5rem;margin:0.375rem 0 0;flex:0 0 auto}
.nr.ai .ai-pager:empty{display:none}
.nr.ai .ai-n{display:inline-block;min-width:1.75rem;text-align:center;border-radius:999px;background:var(--acc,var(--c-brand));color:var(--c-white);font-size:0.875rem;padding:0 0.5rem}
.nr.ai .ai-carthead{display:flex;align-items:center;justify-content:space-between;gap:0.5rem;flex-wrap:wrap}
.nr.ai.ai-fit .ai-cart{display:flex;flex-direction:column;flex:1 1 0;min-height:9rem;gap:0.25rem}
.nr.ai.ai-fit .ai-cartpanel{flex:1 1 0;min-height:3.5rem}
.nr.ai .ai-carttable th,.nr.ai .ai-carttable td{padding:0.25rem 0.5rem;vertical-align:middle;overflow-wrap:anywhere}
.nr.ai .ai-carttable .ai-rmcell{text-align:right;width:1%}
.nr.ai .ai-err{margin:0}
.nr.ai.ai-fit .ai-who{flex:0 0 auto}
.nr.ai .ai-people{grid-template-columns:1fr;max-height:min(16rem,30vh);overflow:auto}
.nr.ai .ai-det{grid-template-columns:repeat(auto-fill,minmax(13rem,1fr));gap:0.125rem 0.75rem;margin:0 0 0.375rem}
.nr.ai .ai-det dt{min-width:5.75rem}
.nr.ai .ai-det dd{overflow-wrap:anywhere}
.nr.ai .ai-recent{flex:0 0 auto}
.nr.ai .ai-recent summary{cursor:pointer;list-style-position:inside}
.nr.ai .ai-recent summary h2{display:inline;font-size:1rem}
.nr.ai .ai-recentbox{max-height:min(14rem,25vh);overflow:auto;margin-top:0.25rem}
.nr.ai .ai-recentul{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:0.375rem}
.nr.ai .ai-recentul li{overflow-wrap:anywhere}
.nr.ai .ai-back{margin:0 0 0.5rem}
.nr.ai .ai-grid.ai-tight{height:auto}
/* too short to fit (below a laptop's height): the page scrolls and each panel keeps a usable height of its own */
.nr.ai .ai-grid.ai-tight .ai-listpanel{flex:none;height:60vh} .nr.ai .ai-grid.ai-tight .ai-cartpanel{flex:none;height:40vh}
}
/* a short window (a laptop at 150 % zoom: about 850 x 530 CSS pixels): tighter spacing, the refresh details on two lines, smaller (still readable) help */
@media screen and (max-height:640px){
.nr.ai .ai-grid{gap:0.5rem}
.nr.ai.ai-fit .ai-assets,.nr.ai.ai-fit .ai-side .nr-card{padding:0.375rem 0.5rem}
.nr.ai .ai-side{gap:0.375rem}
.nr.ai .nr-h2{font-size:1rem}
.nr.ai .ai-help{font-size:0.75rem;line-height:1.25}
.nr.ai .ai-stamp{flex-direction:row;flex-wrap:wrap;justify-content:flex-end;gap:0 0.375rem;max-width:20rem;font-size:0.6875rem}
.nr.ai .ai-filters{gap:0.25rem 0.5rem}
.nr.ai .ai-filters .nr-field{font-size:0.75rem;min-width:7.5rem;flex-basis:7.5rem}
.nr.ai .ai-filters .ai-q{flex-basis:12rem;min-width:min(12rem,100%)}
.nr.ai .ai-filters input,.nr.ai .ai-filters select,.nr.ai .ai-filters .nr-btn{font-size:0.8125rem;padding:0.1875rem 0.375rem}
.nr.ai .ai-found{margin:0 0 0.125rem;font-size:0.75rem}
.nr.ai .ai-pager{margin-top:0.25rem} .nr.ai .ai-pager .nr-btn{padding:0.125rem 0.5rem}
.nr.ai .ai-table th,.nr.ai .ai-table td,.nr.ai .ai-carttable th,.nr.ai .ai-carttable td{padding:0.1875rem 0.375rem;font-size:0.8125rem}
.nr.ai .ai-det{font-size:0.8125rem;margin-bottom:0.25rem}
.nr.ai.ai-fit .ai-listpanel{min-height:4.5rem} .nr.ai.ai-fit .ai-cart{min-height:6rem} .nr.ai.ai-fit .ai-cartpanel{min-height:2.75rem}
.nr.ai .ai-recent summary h2{font-size:0.875rem}
.nr.ai .ai-grid{grid-template-columns:minmax(0,1fr) clamp(18rem,38%,30rem)}
.nr.ai .ai-det{grid-template-columns:1fr;gap:0}
.nr.ai .ai-det div{display:flex;gap:0.375rem;min-width:0} .nr.ai .ai-det dt{flex:0 0 auto;min-width:5.25rem} .nr.ai .ai-det dd{margin:0;min-width:0;overflow-wrap:break-word}
.nr.ai .ai-who .nr-h2{display:inline-block;margin-right:0.5rem} .nr.ai #ai-change{padding:0.0625rem 0.5rem;font-size:0.75rem}
.nr.ai .ai-carthead .nr-btn{padding:0.1875rem 0.5rem;font-size:0.8125rem}
.nr.ai .ai-cart .ai-help{font-size:0.6875rem}
/* the head: the help text runs the full width under the title and the refresh button / details */
.nr.ai .ai-head{display:grid;grid-template-columns:minmax(0,1fr) auto;column-gap:0.75rem;margin-bottom:0.25rem}
.nr.ai .ai-title{display:contents} .nr.ai .ai-title .nr-h2{grid-column:1;grid-row:1;align-self:start;white-space:nowrap}
.nr.ai .ai-head .ai-help{grid-column:1 / -1;grid-row:2;margin-top:0.125rem}
.nr.ai .ai-refreshbox{grid-column:2;grid-row:1;flex-direction:row;align-items:flex-start;gap:0.5rem}
.nr.ai .ai-refreshbox .nr-btn{padding:0.1875rem 0.5rem;font-size:0.8125rem;order:2}
.nr.ai .ai-stamp{max-width:17rem;order:1}
/* the page's own title bar and version line keep their place, with less space around them */
main:has(> .nr.ai.ai-fit){padding-top:0.375rem;padding-bottom:0.25rem}
main:has(> .nr.ai.ai-fit) > .titlebar h1{font-size:1.0625rem;margin:0 0 0.25rem}
main:has(> .nr.ai.ai-fit) > .dbpath{margin:0.25rem 0 0}
}
@media screen and (min-width:3000px){.nr.ai .ai-grid{grid-template-columns:minmax(0,1fr) 36rem}}
/* below a laptop's width (phones / tablets: out of scope, a separate app comes later) the columns stack and the page scrolls as before */
@media screen and (max-width:799px){.nr.ai .ai-grid{grid-template-columns:minmax(0,1fr)} .nr.ai.ai-fit .ai-grid{height:auto} .nr.ai .ai-side{position:static}
  .nr.ai.ai-fit .ai-listpanel{flex:none;height:60vh} .nr.ai.ai-fit .ai-cartpanel{flex:none;height:40vh}}
/* the A4 Issue Form: the Return Form's rules, its own page (v2.20.2: the footer carries the signed-forms address returns@..., as the Return Form) */
.arf.aif .aif-assets td{height:12mm}
.arf.aif .arf-reason{gap:2mm 5mm;flex-wrap:nowrap} .arf.aif .arf-other{width:38mm}
@media print{
  body.aiprint header,body.aiprint #alerts,body.aiprint .syncbar,body.aiprint main>*:not(.arf){display:none!important}
  /* v2.20.6: nothing but the form prints - the Chat launcher and panel, the feedback button, toasts, pop-ups and every other element appended to <body>
     (position:fixed ones repeat on every page), and no height or margin of the shell may add a blank sheet */
  body.aiprint>*:not(#app){display:none!important}
  /* v2.20.7: Chrome breaks the page at every change of page name. The form is on the named page, so the document itself (html and body) is put on it
     too and everything else under <html> is hidden: an element a browser extension appends after <body> (even an empty one) printed a blank sheet 2 */
  html:has(body.aiprint),body.aiprint{page:aiform}
  html:has(body.aiprint)>*:not(body){display:none!important}
  body.aiprint #app>*:not(main){display:none!important}
  html:has(body.aiprint),body.aiprint,body.aiprint #app,body.aiprint main{height:auto!important;min-height:0!important;max-height:none!important;overflow:visible!important;margin:0!important;padding:0!important;border:0!important}
  body.aiprint,body.aiprint main{background:var(--c-white);margin:0;padding:0}
  body.aiprint .arf.aif{page:aiform;width:180mm;max-width:none;margin:0;padding:0;box-shadow:none;overflow:visible}
  body.aiprint .arf-screenfoot{display:none}
}
