/* SelfLaw components. Requires tokens.css (which declares the layer order).
   Class prefix: ps-. Every measurement here is taken from the design canvas.
   Not run through `npm run deslop:strict` or axe yet. */

@layer base {
  *, *::before, *::after { box-sizing: border-box; }
  [hidden] { display: none !important; }
  body {
    margin: 0;
    background: var(--bg-canvas);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: 1.5;
    font-variant-numeric: tabular-nums lining-nums;
  }
  button, input, select, textarea { font: inherit; color: inherit; }
  button { cursor: pointer; }
  a { color: inherit; text-underline-offset: 4px; }
  :focus-visible { outline: 2px solid var(--focus-ring-color); outline-offset: 2px; }
  @media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
}

@layer components {
  /* ---- Type ---- */
  .ps-wordmark { font-family: var(--font-display); font-size: 1.5rem; font-weight: 900; letter-spacing: -0.04em; text-decoration: none; }
  .ps-wordmark__light { font-weight: 500; }
  .ps-hero { margin: 0; font-family: var(--font-display); font-size: var(--text-hero); line-height: 0.86; font-weight: var(--weight-hero); letter-spacing: var(--tracking-hero); }
  .ps-hero-mark { display: inline-block; padding: 6px 14px 8px; background: var(--accent-primary); color: var(--text-on-accent); font-family: var(--font-display); font-size: clamp(1.625rem, 3.4vw, 2.875rem); line-height: 1.1; font-weight: 800; letter-spacing: -0.03em; }
  .ps-section-title { margin: 0; font-family: var(--font-display); font-size: var(--text-section); line-height: 0.98; font-weight: 900; letter-spacing: -0.04em; }
  .ps-title { margin: 0; font-family: var(--font-display); font-size: var(--text-xl); line-height: 1.05; font-weight: var(--weight-display); letter-spacing: -0.025em; }
  .ps-numeral { font-family: var(--font-display); font-size: var(--text-numeral); line-height: 1; font-weight: 900; letter-spacing: -0.05em; }
  .ps-numeral--lg { font-size: var(--text-numeral-lg); line-height: 0.9; }
  .ps-caption { font-family: var(--font-mono); font-size: var(--text-xs); font-weight: 600; letter-spacing: var(--tracking-mono-caps); text-transform: uppercase; }
  .ps-help { margin: 0; font-size: var(--text-sm); color: var(--text-secondary); }
  .ps-term { color: var(--accent-ink-navy); font-weight: 600; text-decoration: underline dotted; text-underline-offset: 3px; background: none; border: 0; padding: 0; }

  /* ---- Buttons ---- */
  .ps-btn { display: inline-flex; align-items: center; justify-content: space-between; gap: var(--space-4); min-height: var(--tap-comfortable); padding: 0 var(--space-4); border: 0; border-radius: var(--radius-md); background: var(--accent-primary); color: var(--text-on-accent); font-family: var(--font-display); font-size: 1.125rem; font-weight: 800; letter-spacing: -0.01em; text-decoration: none; }
  .ps-btn:hover { background: var(--accent-primary-hover); }
  .ps-btn--ink { background: var(--border-ink); color: var(--bg-canvas); }
  .ps-btn--outline { background: transparent; color: var(--text-primary); border: var(--rule-ink); font-family: var(--font-sans); font-size: var(--text-sm); font-weight: 700; min-height: var(--tap-min); }
  .ps-btn--outline:hover { background: var(--bg-subtle); }
  .ps-btn--icon { width: var(--tap-comfortable); padding: 0; justify-content: center; }
  .ps-btn--block { display: flex; width: 100%; }
  .ps-link-btn { min-height: var(--tap-min); padding: 0; border: 0; background: none; font-size: 0.875rem; font-weight: 600; text-decoration: underline; text-underline-offset: 4px; }
  /* Quick hide: always present, always top right, never moves. */
  .ps-hide { display: inline-flex; align-items: center; gap: 6px; height: var(--tap-min); padding: 0 10px; border: var(--rule-ink); border-radius: var(--radius-sm); background: transparent; font-family: var(--font-mono); font-size: var(--text-xs); font-weight: 600; }

  /* ---- Tags, stamps, doors ---- */
  .ps-tag { display: inline-block; padding: 3px 7px; border-radius: var(--radius-sm); background: var(--case-spine, var(--spine-teal)); color: #FFFFFF; font-size: var(--text-xs); font-weight: 700; }
  .ps-stamp { display: inline-block; transform: rotate(-6deg); padding: 3px; border: 2px solid var(--accent-ink-navy); color: var(--accent-ink-navy); font-family: var(--font-mono); text-align: center; line-height: 1.25; }
  .ps-stamp > span { display: block; padding: 5px 10px 4px; border: 1px solid currentColor; letter-spacing: 0.08em; font-weight: 600; }
  /* Door: the two entry points. The cut corner is a triangle in the page color. */
  .ps-door { position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: var(--space-4); min-height: 148px; padding: 14px 16px 16px; border: 0; border-radius: var(--radius-md); background: var(--accent-primary); color: var(--text-on-accent); text-align: left; text-decoration: none; }
  .ps-door--ink { background: #181715; color: #FFFFFF; }
  .ps-door::after { content: ""; position: absolute; top: 0; right: 0; border-top: 28px solid var(--bg-canvas); border-left: 28px solid transparent; }
  .ps-door__title { font-family: var(--font-display); font-size: 2rem; line-height: 1; font-weight: 800; letter-spacing: -0.03em; }
  .ps-door__sub { font-size: var(--text-sm); opacity: 0.86; }

  /* ---- Case chrome ---- */
  .ps-casebar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: 52px; padding: 0 10px 0 var(--space-4); border-top: 4px solid var(--case-spine, var(--spine-teal)); border-bottom: var(--rule-ink); }
  .ps-casebar__caption { font-family: var(--font-mono); font-size: 0.875rem; font-weight: 600; letter-spacing: 0.02em; }
  .ps-steps { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 3px; }
  .ps-steps > * { height: 6px; background: var(--meter-track); }
  .ps-steps > [data-done] { background: var(--case-spine, var(--accent-primary)); }
  .ps-clock { display: inline-flex; align-items: center; gap: var(--space-2); min-height: var(--tap-min); padding: 0; border: 0; background: none; text-align: left; }
  .ps-clock__label { font-size: var(--text-xs); line-height: 1.2; color: var(--text-secondary); }
  .ps-clock__label strong { color: var(--status-verified-fg); }
  .ps-tabs { display: flex; flex-wrap: wrap; gap: 0 var(--space-5); padding: 0 var(--space-4); border-bottom: var(--rule-hairline); }
  .ps-tabs button { height: 46px; padding: 0; border: 0; border-bottom: 3px solid transparent; background: none; color: var(--text-secondary); font-weight: 500; }
  .ps-tabs button[aria-pressed="true"] { border-bottom-color: var(--border-ink); color: var(--text-primary); font-weight: 700; }
  .ps-alert { display: flex; align-items: center; gap: var(--space-3); padding: 10px var(--space-4); background: var(--status-attention-bg); color: var(--status-attention-fg); font-size: 0.875rem; line-height: 1.35; }
  .ps-alert--urgent { background: var(--status-urgent-bg); color: var(--status-urgent-fg); }
  .ps-note-verified { display: flex; gap: var(--space-2); margin: 0; font-size: var(--text-xs); line-height: 1.4; color: var(--status-verified-fg); }

  /* ---- Pleading paper: their words and your filing, always white ---- */
  .ps-pleading { display: flex; background: var(--bg-court-paper); color: var(--ink-court-paper); border: 1px solid var(--border-strong); font-family: var(--font-court-doc); font-size: 0.9375rem; line-height: 23px; }
  .ps-pleading__lines { flex: none; width: 40px; padding: 14px 7px 14px 0; border-right: 3px double var(--ink-court-paper); text-align: right; font-size: var(--text-xs); }
  .ps-pleading__body { flex: 1; min-width: 0; position: relative; padding: 14px 18px 14px 14px; }
  .ps-pleading__stamp-box { position: absolute; top: 10px; right: 12px; width: 132px; height: 118px; display: grid; place-items: center; border: 1.5px dashed #1B4332; background: #ECF5F0; color: #164A33; font-family: var(--font-mono); font-size: 0.75rem; line-height: 1.35; text-align: center; }
  .ps-pleading mark { background: #DCE6F3; color: inherit; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
  .ps-pleading--sheet { box-shadow: var(--shadow-sheet); }

  /* ---- Guided step ---- */
  .ps-verdict { display: flex; flex-direction: column; gap: 6px; }
  .ps-verdict button { display: flex; align-items: stretch; gap: var(--space-3); min-height: var(--tap-comfortable); padding: 0 var(--space-3) 0 0; border: var(--rule-ink); border-radius: var(--radius-md); background: var(--bg-surface); color: var(--text-primary); text-align: left; }
  .ps-verdict__glyph { flex: none; width: 50px; display: grid; place-items: center; border-right: var(--rule-ink); font-family: var(--font-display); font-size: 1.5rem; font-weight: 900; }
  .ps-verdict__text { display: flex; flex-direction: column; justify-content: center; gap: 1px; }
  .ps-verdict__text strong { font-size: var(--text-base); font-weight: 700; line-height: 1.2; }
  .ps-verdict__text span { font-size: var(--text-xs); line-height: 1.3; color: var(--text-secondary); }
  .ps-verdict button[aria-pressed="true"] { background: var(--accent-primary); border-color: var(--accent-primary); color: var(--text-on-accent); }
  .ps-verdict button[aria-pressed="true"] .ps-verdict__glyph { border-right-color: currentColor; }
  .ps-verdict button[aria-pressed="true"] .ps-verdict__text span { color: var(--text-on-accent-soft); }
  .ps-outcome { margin: 0; font-family: var(--font-mono); font-size: var(--text-xs); line-height: 1.4; }
  .ps-dock { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-2) var(--space-4) 14px; border-top: var(--rule-ink); position: sticky; bottom: 0; background: var(--bg-canvas); padding-bottom: max(14px, env(safe-area-inset-bottom)); }
  .ps-dock__row { display: flex; gap: 6px; }
  .ps-dock__row .ps-btn:last-child { flex: 1; }

  /* ---- Chat ---- */
  .ps-msg { display: flex; flex-direction: column; gap: var(--space-2); }
  .ps-msg p { margin: 0; text-wrap: pretty; }
  .ps-msg__from { display: flex; align-items: center; gap: var(--space-2); font-family: var(--font-mono); font-size: var(--text-xs); font-weight: 600; }
  .ps-msg__from::before { content: "S"; width: 22px; height: 22px; display: grid; place-items: center; background: var(--accent-primary); color: var(--text-on-accent); font-family: var(--font-display); font-size: 0.875rem; font-weight: 900; }
  .ps-msg--me { align-self: flex-end; max-width: 292px; padding: 10px 14px; border-radius: var(--radius-md); background: #181715; color: #FFFFFF; }
  .ps-fact { background: var(--bg-surface); border: var(--rule-ink); border-radius: var(--radius-md); }
  .ps-fact__row { display: flex; align-items: center; justify-content: space-between; min-height: 42px; padding: 0 var(--space-3); border-bottom: 1px dashed var(--border-strong); }
  .ps-fact__row:last-of-type { border-bottom: var(--rule-ink); }
  .ps-fact__actions { display: grid; grid-template-columns: 2fr 1fr; }
  .ps-fact__actions button { height: 50px; border: 0; background: none; font-weight: 600; }
  .ps-fact__actions button + button { border-left: var(--rule-ink); }
  .ps-fact__actions button[aria-pressed="true"] { background: var(--accent-primary); color: var(--text-on-accent); font-weight: 700; }
  .ps-composer { display: flex; align-items: center; gap: 6px; padding: 10px var(--space-3) 14px; border-top: var(--rule-ink); }
  .ps-composer__field { flex: 1; min-width: 0; display: flex; align-items: center; height: 50px; padding: 0 2px 0 var(--space-3); border: var(--rule-ink); border-radius: var(--radius-md); background: var(--bg-surface); }
  .ps-composer__field input { flex: 1; min-width: 0; height: 40px; border: 0; background: none; }

  /* ---- Cards, lists, receipts ---- */
  .ps-case-card { display: flex; flex-direction: column; background: var(--bg-surface); border: var(--rule-ink); border-top: 5px solid var(--case-spine, var(--spine-teal)); border-radius: var(--radius-md); }
  .ps-case-card__body { display: flex; justify-content: space-between; gap: var(--space-3); padding: 10px var(--space-3) var(--space-3); }
  .ps-case-card__action { display: flex; align-items: center; justify-content: space-between; height: 50px; padding: 0 var(--space-3); border: 0; border-top: var(--rule-ink); background: none; font-weight: 700; }
  .ps-case-card__action--primary { background: var(--accent-primary); color: var(--text-on-accent); }
  .ps-docket { margin: 0; padding: 0; list-style: none; border-top: var(--rule-ink); }
  .ps-docket > li { display: flex; align-items: baseline; gap: var(--space-3); min-height: var(--tap-min); padding: 11px 0; border-bottom: var(--rule-hairline); }
  .ps-docket > li:last-child { border-bottom: var(--rule-ink); }
  .ps-docket__no { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-muted); }
  .ps-receipt { font-family: var(--font-mono); font-size: var(--text-xs); line-height: 1.9; }
  .ps-receipt > div { display: flex; justify-content: space-between; gap: var(--space-4); border-top: 1px dashed var(--border-strong); }
  .ps-receipt > div:last-child { border-top: var(--rule-ink); font-weight: 600; }

  /* ---- Forms (guide capture) ---- */
  .ps-field { display: flex; flex-direction: column; gap: 6px; }
  .ps-field label { font-size: var(--text-sm); font-weight: 700; }
  .ps-field input, .ps-field select { width: 100%; height: 52px; padding: 0 14px; border: var(--rule-ink); border-radius: var(--radius-md); background: var(--bg-surface); }
  .ps-capture { display: flex; flex-direction: column; gap: 14px; padding: 22px; background: var(--bg-surface); border: var(--rule-ink); }
  .ps-guide-cover { position: relative; display: flex; height: 250px; background: var(--accent-primary); color: #FFFFFF; overflow: hidden; }
  .ps-guide-cover--ink { background: #181715; }
  .ps-guide-cover::after { content: ""; position: absolute; top: 0; right: 0; border-top: 34px solid var(--bg-canvas); border-left: 34px solid transparent; }

  /* ---- Court day (use inside [data-theme="night"]) ---- */
  .ps-cue { display: flex; flex-direction: column; gap: 14px; }
  .ps-cue__when { margin: 0; font-size: 1.1875rem; line-height: 1.35; color: var(--text-secondary); }
  .ps-cue__label { font-size: var(--text-sm); font-weight: 700; color: var(--accent-primary); }
  .ps-cue__say { margin: 0; font-family: var(--font-display); font-size: var(--text-podium-lead); line-height: 1.1; font-weight: 900; letter-spacing: -0.03em; text-wrap: balance; }
  .ps-cue__then { margin: 0; font-family: var(--font-display); font-size: var(--text-podium); line-height: 1.25; font-weight: 500; letter-spacing: -0.015em; }
  .ps-cue__show { display: flex; align-items: center; gap: var(--space-3); font-size: 1.1875rem; font-weight: 700; }
  .ps-cue__show::before { content: ""; flex: none; width: 12px; height: 12px; background: var(--accent-primary); }

  /* ---- Page shells ---- */
  .ps-page { max-width: var(--page-max); margin-inline: auto; padding-inline: var(--page-gutter); }
  .ps-phone { min-height: 100svh; display: flex; flex-direction: column; }
  .ps-workbench { display: flex; flex-wrap: wrap; align-items: stretch; }
  .ps-workbench > :nth-child(1) { flex: 1 1 340px; min-width: 0; }
  .ps-workbench > :nth-child(2) { flex: 999 1 520px; min-width: 0; background: var(--bg-subtle); border-inline: var(--rule-hairline); }
  .ps-workbench > :nth-child(3) { flex: 1 1 290px; min-width: 0; }
  .ps-grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(var(--col-min, 240px), 100%), 1fr)); gap: var(--space-3); }

  /* Responsive screen shell: phone column, 680px tablet column, optional wide desktop. */
  .ps-screen { min-height: 100svh; display: flex; flex-direction: column; }
  .ps-screen__main { flex: 1; width: 100%; max-width: 680px; margin-inline: auto; padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-4); }
  .ps-screen__main--wide { max-width: var(--page-max); }
  .ps-screen > .ps-dock > * { width: 100%; max-width: 648px; margin-inline: auto; }
  .ps-split { display: grid; gap: var(--space-5); align-items: start; }
  .ps-band { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); padding: 10px var(--space-4); border-bottom: var(--rule-hairline); }
  @media (min-width: 1280px) {
    .ps-screen__main--focus { max-width: 640px; }
    .ps-split { grid-template-columns: minmax(0, 1fr) 360px; }
    .ps-split--even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  }

  /* ---- Card and small parts shared by the kits below ---- */
  .ps-card { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4); background: var(--bg-surface); border: var(--rule-ink); border-radius: var(--radius-md); }
  .ps-card--flush { padding: 0; gap: 0; }
  .ps-well { margin: 0; padding: 10px var(--space-3); background: var(--bg-subtle); font-size: 0.875rem; line-height: 1.45; color: var(--text-secondary); }
  .ps-well strong { color: var(--text-primary); }
  .ps-seg { display: inline-flex; border: var(--rule-ink); border-radius: var(--radius-sm); }
  .ps-seg button { min-height: var(--tap-min); padding: 0 var(--space-3); border: 0; background: none; color: var(--text-secondary); font-size: 0.875rem; font-weight: 600; }
  .ps-seg button[aria-pressed="true"] { background: var(--border-ink); color: var(--bg-canvas); font-weight: 700; }
  .ps-toast { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); min-height: var(--tap-comfortable); padding: 0 var(--space-2) 0 var(--space-4); background: #181715; color: #FFFFFF; border-radius: var(--radius-md); font-size: var(--text-sm); }
  .ps-toast button { min-height: var(--tap-min); padding: 0 var(--space-3); border: 0; background: none; color: #FFFFFF; font-weight: 700; text-decoration: underline; text-underline-offset: 4px; }
  .ps-bar { height: 6px; background: var(--meter-track); }
  .ps-bar > i { display: block; height: 100%; background: var(--accent-primary); }

  /* ---- Kit A: scanner, truth receipt, term popover, date math ---- */
  .ps-scanner { position: relative; height: 220px; background: #161514; color: #F3EFE8; overflow: hidden; }
  .ps-scanner__paper { position: absolute; left: 50%; top: 26px; width: 170px; height: 240px; margin-left: -85px; padding: 14px; background: #FFFFFF; color: #111111; transform: rotate(-3deg); font-family: var(--font-court-doc); font-size: var(--text-xs); font-weight: 700; text-align: center; letter-spacing: 0.04em; }
  .ps-scanner__paper::after { content: ""; display: block; height: 120px; margin-top: 12px; background: repeating-linear-gradient(#C5BEB3 0 3px, transparent 3px 12px); }
  .ps-scanner__guide { position: absolute; left: 50%; top: 12px; width: 230px; height: 22px; margin-left: -115px; border: 2px solid #52B788; border-bottom: 0; }
  .ps-scanner__hint, .ps-scanner__count { position: absolute; z-index: 1; bottom: 10px; padding: 2px 6px; background: #161514; font-size: var(--text-xs); }
  .ps-scanner__hint { left: var(--space-3); }
  .ps-scanner__count { right: var(--space-3); font-family: var(--font-mono); }
  .ps-popover { width: min(340px, calc(100vw - 32px)); margin: auto; padding: var(--space-4); border: var(--rule-ink); border-radius: var(--radius-md); background: var(--bg-surface); color: var(--text-primary); }
  .ps-popover::backdrop { background: rgba(24, 23, 21, 0.4); }
  .ps-popover dl { margin: 0; display: flex; flex-direction: column; }
  .ps-popover dt { font-size: var(--text-xs); font-weight: 700; color: var(--text-secondary); padding-top: 10px; border-top: var(--rule-hairline); margin-top: 10px; }
  .ps-popover dt:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
  .ps-popover dd { margin: 2px 0 0; }
  details.ps-math > summary { list-style: none; cursor: pointer; }
  details.ps-math > summary::-webkit-details-marker { display: none; }
  details.ps-math[open] > summary { padding-bottom: var(--space-2); }

  /* ---- Kit B: where on my paper, off duty, family summary, matrix ---- */
  .ps-whereon { display: flex; align-items: center; gap: var(--space-4); }
  .ps-whereon__paper { flex: none; position: relative; width: 120px; height: 150px; background: #FFFFFF; border: 1px solid var(--border-strong); }
  .ps-whereon__paper::before { content: ""; position: absolute; inset: 14px 12px; background: repeating-linear-gradient(#E4DFD7 0 3px, transparent 3px 11px); }
  .ps-whereon__mark { position: absolute; right: 8px; top: 34px; width: 58px; height: 22px; border: 2px solid var(--accent-ink-navy); background: var(--highlight-navy-bg); }
  .ps-offduty { background: var(--status-verified-bg); color: var(--status-verified-fg); border: 0; }
  .ps-offduty .ps-numeral { color: inherit; }
  .ps-offduty .ps-receipt > div { border-color: currentColor; }
  .ps-summary { font-size: var(--text-lg); line-height: 1.4; }
  .ps-summary li + li { margin-top: var(--space-2); }
  .ps-matrix { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
  .ps-matrix th, .ps-matrix td { padding: 10px 8px; border-bottom: var(--rule-hairline); text-align: left; vertical-align: top; }
  .ps-matrix th { font-size: var(--text-xs); border-bottom: var(--rule-ink); }

  /* ---- Kit C: binder slots filling in ---- */
  .ps-slots { margin: 0; padding: 0; list-style: none; font-size: var(--text-sm); }
  .ps-slots li { display: flex; gap: var(--space-3); padding: 9px 0; border-bottom: var(--rule-hairline); color: var(--text-muted); }
  .ps-slots li::before { content: ""; flex: none; width: 12px; height: 12px; margin-top: 5px; border: 1.5px solid var(--border-strong); }
  .ps-slots li[data-filled] { color: var(--text-primary); }
  .ps-slots li[data-filled]::before { background: var(--accent-primary); border-color: var(--accent-primary); }
  .ps-sign { display: grid; place-items: center; min-height: 96px; border: 1.5px dashed var(--border-strong); color: var(--text-secondary); font-size: var(--text-sm); }

  /* ---- Kit D: bumper, mailroom, firm, timeline, exhibit, transcript, recorder ---- */
  .ps-bumper { display: flex; flex-direction: column; justify-content: flex-end; gap: var(--space-2); min-height: 320px; padding: var(--space-5); background: var(--case-spine, var(--spine-teal)); color: #FFFFFF; }
  .ps-bumper__name { font-family: var(--font-display); font-size: 2.75rem; line-height: 0.95; font-weight: 900; letter-spacing: -0.04em; }
  .ps-mailroom__choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); }
  .ps-mailroom__choices button { display: flex; flex-direction: column; gap: 2px; min-height: 76px; padding: 10px var(--space-3); border: var(--rule-ink); border-top: 5px solid var(--case-spine, var(--spine-teal)); border-radius: var(--radius-md); background: var(--bg-surface); text-align: left; }
  .ps-timeline { margin: 0; padding: 0; list-style: none; }
  .ps-timeline li { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: var(--space-3); padding: 11px 0; border-bottom: var(--rule-hairline); }
  .ps-timeline time { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-muted); padding-top: 3px; }
  .ps-timeline [data-overdue] { color: var(--status-attention-fg); font-weight: 700; }
  .ps-sms { display: flex; flex-direction: column; gap: 6px; padding: var(--space-3); background: #FFFFFF; color: #111111; border: 1px solid var(--border-strong); font-size: var(--text-sm); }
  .ps-sms p { margin: 0; max-width: 80%; padding: 7px 10px; border: 1px solid #C5BEB3; }
  .ps-sms p[data-me] { align-self: flex-end; background: #F2EFE9; }
  .ps-sms time { font-family: var(--font-mono); font-size: var(--text-xs); color: #6B665F; align-self: center; }
  .ps-transcript { margin: 0; padding: 0; list-style: none; font-family: var(--font-court-doc); background: #FFFFFF; color: #111111; border: 1px solid var(--border-strong); }
  .ps-transcript li { display: grid; grid-template-columns: 62px minmax(0, 1fr); gap: var(--space-3); padding: 6px var(--space-3); }
  .ps-transcript li > span:first-child { font-family: var(--font-mono); font-size: var(--text-xs); color: #6B665F; padding-top: 3px; }
  .ps-transcript li[data-hit] { background: #FDF4E3; box-shadow: inset 0 0 0 1px #7C4D06; }
  .ps-wave { display: flex; align-items: center; gap: 3px; height: 56px; }
  .ps-wave i { flex: 1; background: var(--text-primary); }
  .ps-wave i[data-pin] { background: var(--accent-primary); }
  .ps-stages { margin: 0; padding: 0; list-style: none; counter-reset: stage; }
  .ps-stages li { counter-increment: stage; display: flex; gap: var(--space-3); padding: 11px 0; border-bottom: var(--rule-hairline); }
  .ps-stages li::before { content: counter(stage); font-family: var(--font-display); font-size: 1.5rem; line-height: 1; font-weight: 900; color: var(--accent-primary); width: 20px; }

  /* ---- Kit E: law ladder, dollar shield, brief x-ray, sync, portal, page 0 ---- */
  .ps-ladder { margin: 0; padding: 0; list-style: none; border-top: var(--rule-ink); }
  .ps-ladder li { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-4); padding: 11px 0; border-bottom: var(--rule-hairline); }
  .ps-ladder li span { font-size: var(--text-xs); color: var(--text-secondary); text-align: right; }
  .ps-ladder li[data-off] b { color: var(--text-muted); font-weight: 400; text-decoration: line-through; }
  .ps-shield { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); gap: var(--space-2); }
  .ps-shield > div { display: flex; flex-direction: column; gap: 2px; padding: var(--space-3); border: var(--rule-ink); }
  .ps-shield > div[data-safe] { background: var(--status-verified-bg); color: var(--status-verified-fg); border-color: currentColor; }
  .ps-shield > div[data-check] { background: var(--status-attention-bg); color: var(--status-attention-fg); border-color: currentColor; }
  .ps-brief { display: grid; grid-template-columns: minmax(0, 1fr) 150px; gap: 0 var(--space-4); background: #FFFFFF; color: #111111; border: 1px solid var(--border-strong); padding: var(--space-4); font-family: var(--font-court-doc); }
  .ps-brief p { margin: 0 0 var(--space-3); }
  .ps-brief mark { background: #FDF4E3; color: inherit; }
  .ps-brief aside { margin-bottom: var(--space-3); font-family: var(--font-sans); font-size: var(--text-xs); font-weight: 700; color: #7C4D06; }
  .ps-diff del { color: var(--status-urgent-fg); }
  .ps-diff ins { color: var(--status-verified-fg); text-decoration: underline; font-weight: 600; }
  .ps-recipe { margin: 0; padding: 0; list-style: none; }
  .ps-recipe li { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: var(--tap-comfortable); border-bottom: var(--rule-hairline); }
  .ps-recipe code { font-family: var(--font-mono); font-size: var(--text-xs); }
  .ps-page0 { background: #FFFFFF; color: #111111; border: 1px solid var(--border-strong); padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-3); font-size: var(--text-lg); font-weight: 700; }
  .ps-page0 > div { display: flex; align-items: center; gap: var(--space-3); }
  .ps-page0 i { flex: none; width: 34px; height: 34px; }
  .ps-page0 [data-sign] i { background: #1B4332; }
  .ps-page0 [data-blank] i { background: #8E1B1B; clip-path: polygon(30% 0, 70% 0, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0 70%, 0 30%); }
  .ps-page0 [data-server] i { background: #7C4D06; border-radius: 50%; }

  /* ---- Kit F: stipulation trap x-ray ---- */
  .ps-trap { display: flex; flex-direction: column; }
  .ps-trap > section { padding: var(--space-3) var(--space-4); }
  .ps-trap h4 { margin: 0 0 4px; font-family: var(--font-display); font-size: var(--text-lg); font-weight: 800; }
  .ps-trap ul { margin: 0; padding-left: 1.1em; }
  .ps-trap [data-ok] { background: var(--status-verified-bg); color: var(--status-verified-fg); }
  .ps-trap [data-trap] { background: var(--status-urgent-bg); color: var(--status-urgent-fg); }
  .ps-trap [data-missing] { background: var(--status-attention-bg); color: var(--status-attention-fg); }
  .ps-strike { font-family: var(--font-court-doc); background: #FFFFFF; color: #111111; padding: var(--space-3); border: 1px solid var(--border-strong); }
  .ps-strike del { text-decoration-color: #1D3557; text-decoration-thickness: 2px; }
  .ps-strike ins { color: #1D3557; text-decoration: none; font-style: italic; }
}

@layer utilities {
  .ps-stack { display: flex; flex-direction: column; gap: var(--gap, var(--space-3)); }
  .ps-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gap, var(--space-2)); }
  .ps-between { justify-content: space-between; }
  .ps-grow { flex: 1; min-width: 0; }
  .ps-mono { font-family: var(--font-mono); font-size: var(--text-xs); }
  .ps-muted { color: var(--text-secondary); }
  .ps-small { font-size: var(--text-xs); }
  .ps-strong { font-weight: 700; }
  .ps-m0 { margin: 0; }
  .ps-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
