/* The SOPs page (static/js/pages/sops.js). The card, eyebrow, lede, prose, badge and buttons are
   the portal's own classes (static/portal/css/app.css), the same Docs shape as the search page's
   Docs tab (search_docs.css). This file lays out the side list, the one open SOP, the editor
   with its preview, and the history. Every rule under html.ui-new. */
html.ui-new .psop .wrap { max-width: 1200px; margin: 0 auto; padding: var(--space-5, 32px) var(--space-4, 24px) 64px; }
html.ui-new .psop .sop-head h1 { margin: 0; }
html.ui-new .psop .sop-sub { margin: 6px 0 var(--space-4, 24px); color: var(--ink-500); font-size: var(--text-sm); max-width: 70ch; }
html.ui-new .psop .sop-grid { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: var(--space-4, 24px); align-items: start; }
html.ui-new .psop .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* the side list */
html.ui-new .psop .sop-side { position: sticky; top: 84px; }
html.ui-new .psop .sop-search input { width: 100%; font: inherit; font-size: var(--text-sm); border: 1px solid var(--ink-200, #e4dde8);
  border-radius: 999px; padding: 8px 14px; background: var(--white); color: var(--ink-900); }
html.ui-new .psop .sop-list { list-style: none; margin: 12px 0 0; padding: 0; }
html.ui-new .psop .sop-nav { display: flex; gap: 10px; align-items: baseline; padding: 9px 12px; border-radius: 12px;
  color: var(--ink-700); text-decoration: none; font-size: var(--text-sm); line-height: 1.35; }
html.ui-new .psop .sop-nav:hover { background: var(--paper-100, #f6f3ef); color: var(--ink-900); }
html.ui-new .psop .sop-nav.is-on { background: var(--white); color: var(--ink-900); font-weight: var(--fw-semibold);
  box-shadow: inset 0 0 0 1.5px #9140B0; }
html.ui-new .psop .sop-num { flex: none; width: 20px; height: 20px; border-radius: 999px; display: inline-grid; place-items: center;
  font-size: 11px; font-weight: 700; background: var(--paper-200, #ece7e1); color: var(--ink-700); }
html.ui-new .psop .sop-nav.is-on .sop-num { background: #9140B0; color: var(--white); }
html.ui-new .psop .sop-empty { margin: 12px 4px; font-size: var(--text-sm); color: var(--ink-500); }
html.ui-new .psop .sop-new { margin-top: 12px; width: 100%; }

/* the open SOP */
html.ui-new .psop .sop-main { min-width: 0; }
html.ui-new .psop .sop-doc { padding: var(--space-5, 32px); }
html.ui-new .psop .sop-dochead { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between;
  padding-bottom: var(--space-3, 16px); margin-bottom: var(--space-4, 24px); border-bottom: 1px solid var(--paper-200); }
html.ui-new .psop .sop-dochead h2 { margin: 2px 0 6px; font-size: 26px; line-height: 1.2; }
html.ui-new .psop .set-lede { margin: 0 0 8px; color: var(--ink-600, #5c5c66); font-size: var(--text-md, 15px); max-width: 68ch; }
html.ui-new .psop .sop-stamp { margin: 0; font-size: 12px; color: var(--ink-500); }
html.ui-new .psop .sop-tools { display: flex; gap: 8px; align-items: center; flex: none; flex-wrap: wrap; justify-content: flex-end; }
html.ui-new .psop .sop-prose { max-width: 72ch; font-size: 15px; line-height: 1.65; }
html.ui-new .psop .sop-prose h2, html.ui-new .psop .sop-prose h3 { display: flex; align-items: center; gap: 10px;
  margin: var(--space-5, 32px) 0 var(--space-2, 8px); font-size: 18px; }
html.ui-new .psop .sop-prose > h3:first-child, html.ui-new .psop .sop-prose > h2:first-child { margin-top: 0; }
html.ui-new .psop .sop-prose h4 { margin: var(--space-3, 16px) 0 var(--space-1, 4px); font-size: 15px; }
html.ui-new .psop .sop-prose ul, html.ui-new .psop .sop-prose ol { margin: var(--space-1, 4px) 0 var(--space-3, 16px); padding-left: 1.4em; }
html.ui-new .psop .sop-prose li { margin-bottom: 8px; }
html.ui-new .psop .sop-prose li > ul, html.ui-new .psop .sop-prose li > ol { margin: 8px 0 0; }
html.ui-new .psop .sop-prose p { margin: 0 0 var(--space-2, 8px); }
html.ui-new .psop .sop-note { padding: 12px 16px; border-radius: 12px; background: #F1E6F6; color: var(--ink-900); }
html.ui-new .psop .sop-copy { margin-left: auto; font-size: 12px; font-weight: 500; }
html.ui-new .psop .sop-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: var(--space-5, 32px);
  padding-top: var(--space-4, 24px); border-top: 1px solid var(--paper-200); }
html.ui-new .psop .sop-pager a { display: block; padding: 12px 14px; border-radius: 12px; box-shadow: inset 0 0 0 1px var(--ink-200, #e4dde8);
  color: var(--ink-900); text-decoration: none; font-size: var(--text-sm); font-weight: var(--fw-semibold); }
html.ui-new .psop .sop-pager a:hover { box-shadow: inset 0 0 0 1.5px #9140B0; }
html.ui-new .psop .sop-pager a span { display: block; font-size: 12px; font-weight: 400; color: var(--ink-500); margin-bottom: 2px; }
html.ui-new .psop .sop-next { text-align: right; grid-column: 2; }
html.ui-new .psop .sop-admin { display: flex; flex-wrap: wrap; gap: 8px; margin-top: var(--space-4, 24px); }
html.ui-new .psop .sop-off { margin-left: auto; color: #a92e64; }

/* the editor */
html.ui-new .psop .sop-fields { display: grid; grid-template-columns: 1fr 2fr; gap: 12px; }
html.ui-new .psop .field { display: block; margin: 0 0 12px; }
html.ui-new .psop .lbl { display: block; font-size: var(--text-sm); font-weight: var(--fw-semibold); margin-bottom: 6px; }
html.ui-new .psop .sop-fields input, html.ui-new .psop .sop-write textarea { width: 100%; font: inherit; border: 1px solid var(--ink-200, #e4dde8);
  border-radius: 10px; padding: 9px 12px; background: var(--white); color: var(--ink-900); }
html.ui-new .psop .sop-fields input:focus, html.ui-new .psop .sop-write textarea:focus { outline: none; border-color: #9140B0;
  box-shadow: 0 0 0 3px #F1E6F6; }
html.ui-new .psop .sop-split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
html.ui-new .psop .sop-bar { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
html.ui-new .psop .sop-tb { font: inherit; font-size: 12px; padding: 5px 10px; border: 1px solid var(--ink-200, #e4dde8);
  border-radius: 8px; background: var(--white); color: var(--ink-900); cursor: pointer; }
html.ui-new .psop .sop-tb:hover { border-color: #9140B0; }
html.ui-new .psop .sop-write textarea { width: 100%; min-height: 520px; resize: vertical; font-family: "Source Code Pro", ui-monospace, monospace;
  font-size: 13px; line-height: 1.6; }
html.ui-new .psop .sop-preview { border-radius: 12px; background: var(--paper-100, #f6f3ef); padding: 14px 18px; max-height: 620px; overflow: auto; }
html.ui-new .psop .sop-plabel { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-500); margin-bottom: 8px; }
html.ui-new .psop .sop-dirty { font-size: 12px; color: #a46a10; }
html.ui-new .psop .sop-warn { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 14px; margin-bottom: 12px;
  border-radius: 12px; background: #FBEECB; font-size: var(--text-sm); }
html.ui-new .psop .sop-err { color: #B3261E; font-size: var(--text-sm); margin: 0 0 12px; }

/* history */
html.ui-new .psop .sop-hist { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 20px; align-items: start; }
html.ui-new .psop .sop-vlist { list-style: none; margin: 0; padding: 0; }
html.ui-new .psop .sop-v { display: block; width: 100%; text-align: left; font: inherit; background: none; border: 0; cursor: pointer;
  padding: 10px 12px; border-radius: 12px; margin-bottom: 4px; }
html.ui-new .psop .sop-v:hover { background: var(--paper-100, #f6f3ef); }
html.ui-new .psop .sop-v.is-on { background: var(--white); box-shadow: inset 0 0 0 1.5px #9140B0; }
html.ui-new .psop .sop-vn { display: block; font-size: var(--text-sm); font-weight: var(--fw-semibold); color: var(--ink-900); }
html.ui-new .psop .sop-vm { display: block; font-size: 12px; color: var(--ink-500); }
html.ui-new .psop .sop-vshow { min-width: 0; border-left: 1px solid var(--paper-200); padding-left: 20px; }
html.ui-new .psop .sop-vhead { display: flex; gap: 12px; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
html.ui-new .psop .sop-vhead h3 { margin: 2px 0 4px; }

@media (max-width: 900px) {
  html.ui-new .psop .sop-split, html.ui-new .psop .sop-hist, html.ui-new .psop .sop-fields { grid-template-columns: 1fr; }
  html.ui-new .psop .sop-vshow { border-left: 0; padding-left: 0; border-top: 1px solid var(--paper-200); padding-top: 16px; }
}
@media (max-width: 760px) {
  html.ui-new .psop .sop-grid { grid-template-columns: 1fr; }
  html.ui-new .psop .sop-side { position: static; }
  html.ui-new .psop .sop-doc { padding: var(--space-4, 20px); }
  html.ui-new .psop .sop-dochead { flex-direction: column; }
  html.ui-new .psop .sop-write textarea { min-height: 320px; }
}
