/* The AI policy builder (tools.zaiphr.ai/ai-policy), after css/tools.css. Direction A,
   "Interview" (Matt, 2026-10-20; second pass 2026-10-23): a guided panel asks one question
   at a time, and a formal policy writes itself on a true-size US Letter page (816 px:
   0.75 in margins). The section being answered is lit with the flame rail; in the panel,
   flame is the one action that moves you on. Phones: Questions and Policy views. The document
   is always a light page in the dark app (Matt, 2026-10-23: corporate documents are light), and
   print is black on white (Matt, 2026-10-20): a policy is printed, signed and filed. Every value is a token or a mix of tokens; motion is transform
   and opacity. */

@layer components {
  /* a wider panel than the other tools: it holds questions, not a list (in components, so it
     beats tools.css's narrower responsive columns) */
  .desk.policy-desk { grid-template-columns: minmax(0, 1fr) 420px; }
  @media (max-width: 1180px) { .desk.policy-desk { grid-template-columns: minmax(0, 1fr) 380px; } }

  /* ---- the work bar: status, and the document's own actions */
  .policy-desk .work-bar { width: min(100%, 816px); gap: 12px; }
  .p-status { display: flex; align-items: center; gap: 14px; min-width: 0; margin: 0; flex: 1; font-size: 12.5px; color: var(--z-fg-subtle); }
  .p-saved { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
  .p-saved .icon { transition: color var(--z-dur-std) ease; }
  .p-saved.is-fresh .icon { color: var(--z-success-text); animation: saved 1.6s var(--z-ease); }
  @keyframes saved { 0% { opacity: 0; transform: scale(0.6); } 20% { opacity: 1; transform: scale(1); } }
  .p-saved.is-warn { color: var(--z-warning-text); white-space: normal; }
  .policy-desk .work-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
  .p-more { position: relative; }
  .p-more-btn, .p-icon { width: 34px; padding: 0; }
  .p-menu {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; display: grid; min-width: 250px; padding: 6px;
    border-radius: 12px; background: var(--z-surface-1); border: 1px solid var(--z-border-control);
    box-shadow: 0 18px 40px -14px color-mix(in oklab, var(--z-void) 75%, transparent);
    transform-origin: top right; animation: pop-in var(--z-dur-std) var(--z-spring);
  }
  .p-menu button, .p-menu label {
    display: block; width: 100%; padding: 9px 12px; border: 0; border-radius: 8px; background: none; color: var(--z-fg);
    font: 500 13.5px/1.3 var(--z-font-display); text-align: left; cursor: pointer;
  }
  @media (hover: hover) { .p-menu button:hover, .p-menu label:hover { background: var(--z-surface-2); } }
  .p-menu button:focus-visible, .p-menu label:focus-visible { outline-offset: -2px; }
  .p-menu hr { margin: 6px 4px; border: 0; border-top: 1px solid var(--z-border); }

  /* ---- the document */
  .policy-desk .sheet-wrap { scroll-behavior: auto; }
  .sheet.policy { width: min(100%, 816px); min-height: 0; padding: 64px 72px 72px; display: block; font: 400 15px/1.65 var(--z-font-editorial); }
  .ps-go { display: inline; padding: 0; margin: 0; border: 0; background: none; color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit; text-align: left; cursor: pointer; border-radius: 3px; }

  .phead { border-radius: 3px; cursor: pointer; }
  .psample { margin: 0 0 14px; font: 500 12px/1.3 var(--z-font-display); color: var(--z-fg-muted); }
  .porg { margin: 0; font: 600 12px/1.3 var(--z-font-display); letter-spacing: var(--z-track-label); text-transform: uppercase; color: var(--z-fg-muted); }
  .ptitle { margin: 10px 0 0; font: 600 30px/1.14 var(--z-font-display); letter-spacing: -0.014em; color: var(--z-tools-sheet-ink); }
  .pcontrol {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 24px 0 0;
    border-top: 1px solid color-mix(in oklab, var(--z-tools-sheet-ink) 22%, transparent);
    border-bottom: 1px solid color-mix(in oklab, var(--z-tools-sheet-ink) 22%, transparent);
  }
  .pcontrol div { display: grid; gap: 3px; align-content: start; padding: 11px 14px 12px 0; }
  .pcontrol div:nth-child(n + 4) { border-top: 1px solid color-mix(in oklab, var(--z-tools-sheet-ink) 10%, transparent); }
  .pcontrol .is-wide { grid-column: span 2; }
  .pcontrol dt { font: 600 10.5px/1.4 var(--z-font-display); letter-spacing: var(--z-track-label); text-transform: uppercase; color: var(--z-fg-subtle); }
  .pcontrol dd { margin: 0; font: 500 13.5px/1.4 var(--z-font-display); }

  /* at a glance: a card you could pin up in the staff room (paper on the black card) */
  .psum { margin: 28px 0 10px; padding: 22px 26px 24px; border-radius: 6px; background: var(--z-tools-sheet-card); color: var(--z-tools-sheet-card-ink); box-shadow: var(--z-tools-shadow-card); }
  .psum-k { margin: 0; font: 600 11px/1 var(--z-font-display); letter-spacing: var(--z-track-label); text-transform: uppercase; color: color-mix(in oklab, var(--z-tools-sheet-card-ink) 72%, var(--z-tools-sheet-card)); }
  .psum ol { margin: 14px 0 0; padding: 0; list-style: none; counter-reset: rule; display: grid; gap: 9px; }
  .psum li { counter-increment: rule; display: grid; grid-template-columns: 30px 1fr; font: 500 14.5px/1.45 var(--z-font-display); }
  .psum li::before { content: counter(rule); font: 600 19px/1.1 var(--z-font-display); font-variant-numeric: tabular-nums; }
  .sheet[data-theme='light'] .psum { box-shadow: 0 0 0 1px color-mix(in oklab, var(--z-tools-sheet-ink) 12%, transparent), var(--z-tools-shadow-card); }

  /* the sections: numbered clauses; choosing a section answers it */
  .ps { position: relative; padding: 22px 0 6px; border-radius: 3px; cursor: pointer; transition: background-color var(--z-dur-micro) ease; }
  .ps.is-static { cursor: auto; }
  .ps h3 { display: flex; align-items: baseline; gap: 10px; margin: 0 0 10px; font: 600 16.5px/1.3 var(--z-font-display); color: var(--z-tools-sheet-ink); }
  .pn { min-width: 30px; font-variant-numeric: tabular-nums; }
  .popen { margin-left: auto; padding: 3px 8px; border: 1px dashed var(--z-border-control); border-radius: var(--z-radius-pill); font: 600 10px/1 var(--z-font-display); letter-spacing: var(--z-track-label); text-transform: uppercase; color: var(--z-fg-muted); white-space: nowrap; }
  .pclauses { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
  .pclauses > li { display: grid; grid-template-columns: 40px minmax(0, 1fr); }
  .pcn { padding-top: 0.2em; font: 500 12.5px/1.4 var(--z-font-display); font-variant-numeric: tabular-nums; color: var(--z-fg-muted); }
  .pcl p { margin: 0; }
  .pcl b { font-weight: 600; }
  .pitems { margin: 6px 0 2px; padding: 0; list-style: none; display: grid; gap: 4px; counter-reset: item; }
  .pitems li { counter-increment: item; display: grid; grid-template-columns: 28px minmax(0, 1fr); }
  .pitems li::before { content: '(' counter(item, lower-alpha) ')'; color: var(--z-fg-muted); font-variant-numeric: tabular-nums; }
  @media (hover: hover) { .ps:not(.is-lit):not(.is-static):hover, .phead:not(.is-lit):hover { background: color-mix(in oklab, var(--z-tools-sheet-ink) 3%, transparent); } }
  .ps.is-lit, .phead.is-lit { margin: 8px -30px 4px; padding: 20px 30px 16px; background: color-mix(in oklab, var(--z-tools-sheet-ink) 5%, var(--z-tools-sheet)); box-shadow: inset 3px 0 0 var(--z-accent); cursor: default; }
  .phead.is-lit { margin: -20px -30px 0; padding-bottom: 20px; }
  .ps.is-changed .pcl { animation: settle 520ms var(--z-ease) both; }
  @keyframes settle { from { opacity: 0.35; transform: translateY(2px); } }

  /* information in AI tools: a real table, the rule always in words */
  .ptable { width: 100%; margin: 10px 0 4px; border-collapse: collapse; font: 400 14px/1.4 var(--z-font-editorial); }
  .ptable th { padding: 0 0 7px; text-align: left; font: 600 10.5px/1.3 var(--z-font-display); letter-spacing: var(--z-track-label); text-transform: uppercase; color: var(--z-fg-subtle); border-bottom: 1px solid color-mix(in oklab, var(--z-tools-sheet-ink) 22%, transparent); }
  .ptable th:last-child { text-align: right; }
  .ptable td { padding: 8px 0; vertical-align: middle; border-bottom: 1px solid color-mix(in oklab, var(--z-tools-sheet-ink) 10%, transparent); }
  .ptable td:first-child { padding-right: 16px; }
  .ptd { display: grid; gap: 1px; }
  .ptd b { font-weight: 500; }
  .ptd span { font-size: 12.5px; color: var(--z-fg-muted); }
  .pstate { white-space: nowrap; text-align: right; font: 600 13px/1 var(--z-font-display); }
  .pstate .pm { display: inline-block; width: 15px; height: 15px; margin-right: 6px; vertical-align: -3px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  .pstate .pm .fill { fill: currentColor; stroke: none; }
  .pstate.is-permitted { color: var(--z-fg-muted); font-weight: 500; }

  /* something not decided yet: a visible marker on screen, never filler */
  .blank { padding: 1px 7px 2px; border: 1px dashed var(--z-border-control); border-radius: 5px; color: var(--z-fg-muted); font: 500 0.92em/1.4 var(--z-font-display); white-space: nowrap; }
  .pcl .blank.has-opts { display: inline-block; white-space: normal; }
  .popts { display: none; } /* an open choice's options: print only */

  /* approval and acknowledgement */
  .psign { display: grid; gap: 30px; margin-top: 34px; padding-top: 22px; border-top: 1px solid color-mix(in oklab, var(--z-tools-sheet-ink) 22%, transparent); font-size: 14px; }
  .psign-h { margin: 0 0 6px; font: 600 15px/1.3 var(--z-font-display); color: var(--z-tools-sheet-ink); }
  .psign-block p { margin: 0; color: var(--z-fg-muted); }
  .psign-lines { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 30px 22px; margin-top: 34px; }
  .psign-lines span { padding-top: 7px; border-top: 1px solid var(--z-border-control); font: 600 10.5px/1 var(--z-font-display); letter-spacing: var(--z-track-label); text-transform: uppercase; color: var(--z-fg-subtle); }

  /* ---- the panel */
  .p-panel { background: var(--z-ground); }
  .pp-head { position: relative; padding: 18px 24px 16px; border-bottom: 1px solid var(--z-border); }
  .pp-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  .pp-kicker { margin: 0; font: 600 11px/1.3 var(--z-font-display); letter-spacing: var(--z-track-label); text-transform: uppercase; color: var(--z-fg-muted); }
  .pp-all { display: inline-flex; align-items: center; gap: 4px; padding: 4px 6px; margin-right: -6px; border: 0; border-radius: 6px; background: none; color: var(--z-fg-muted); font: 500 12.5px/1 var(--z-font-display); cursor: pointer; }
  @media (hover: hover) { .pp-all:hover { color: var(--z-fg); background: var(--z-surface-1); } }
  .pp-all .icon { transition: transform var(--z-dur-std) var(--z-ease); }
  .pp-all[aria-expanded='true'] .icon { transform: rotate(180deg); }
  .pp-bar { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; margin-top: 12px; }
  .pp-bar span { height: 4px; border-radius: 2px; background: var(--z-surface-2); box-shadow: inset 0 0 0 1px var(--z-border-control); transition: background-color var(--z-dur-std) ease; }
  .pp-bar span.is-done { background: var(--z-fg); box-shadow: none; }
  .pp-bar span.is-open { background: transparent; box-shadow: inset 0 0 0 1px var(--z-fg-muted); }
  .pp-bar span.is-here { background: var(--z-accent); box-shadow: none; }
  .pp-steps {
    position: absolute; left: 12px; right: 12px; top: calc(100% - 4px); z-index: 40; display: grid; gap: 1px; max-height: min(70dvh, 560px); overflow: auto; padding: 6px;
    border-radius: 14px; background: var(--z-surface-1); border: 1px solid var(--z-border-control);
    box-shadow: 0 22px 48px -16px color-mix(in oklab, var(--z-void) 80%, transparent);
    transform-origin: top center; animation: pop-in var(--z-dur-std) var(--z-spring);
  }
  .pp-step { display: grid; grid-template-columns: 14px 22px minmax(0, 1fr) auto; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 9px; background: none; color: var(--z-fg); text-align: left; font: 500 13.5px/1.25 var(--z-font-display); cursor: pointer; }
  @media (hover: hover) { .pp-step:hover { background: var(--z-surface-2); } }
  .pp-step.is-here { background: var(--z-surface-2); }
  .pp-step-i { width: 10px; height: 10px; border-radius: 50%; justify-self: center; }
  .pp-step-i.is-reviewed { background: var(--z-fg); }
  .pp-step-i.is-unseen { border: 1.5px solid var(--z-border-control); }
  .pp-step-i.is-open { border: 1.5px dashed var(--z-fg-muted); }
  .pp-step.is-here .pp-step-i { background: var(--z-accent); border: 0; }
  .pp-step-n { font-variant-numeric: tabular-nums; color: var(--z-fg-muted); font-size: 12.5px; }
  .pp-step-s { font-size: 12px; color: var(--z-fg-muted); }

  .policy-desk .inspector-body { overflow-x: hidden; } /* the step slides in from 12 px aside */
  .pv-step { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; padding: 24px 24px 30px; }
  .pv-step.is-fwd { animation: step-fwd var(--z-dur-std) var(--z-ease); }
  .pv-step.is-back { animation: step-back var(--z-dur-std) var(--z-ease); }
  @keyframes step-fwd { from { opacity: 0; transform: translateX(12px); } }
  @keyframes step-back { from { opacity: 0; transform: translateX(-12px); } }
  .pq-head { display: grid; gap: 8px; }
  .pq-title { margin: 0; font: 600 23px/1.2 var(--z-font-display); letter-spacing: -0.012em; }
  .pq-title:focus { outline: none; }
  .pq-title:focus-visible { outline: 2px solid var(--z-accent-text); outline-offset: 4px; }
  .pq-sub { margin: 0; font-size: 14px; line-height: 1.55; color: var(--z-fg-muted); }
  .pq-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .pq-group { display: grid; gap: 10px; }
  .pq-legend { padding: 0; margin: 0 0 10px; font: 600 13px/1.3 var(--z-font-display); color: var(--z-fg); }
  .pq-input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; }

  /* choice cards: a real radio, drawn as a card that says what the option means */
  .pq-cards { display: grid; gap: 8px; }
  .pq-cards.is-row { grid-template-columns: 1fr 1fr; }
  .pq-card {
    display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 4px 12px; align-items: start; padding: 14px 16px; border-radius: 12px;
    border: 1px solid var(--z-border-strong); background: transparent; cursor: pointer;
    transition: border-color var(--z-dur-micro) ease, background-color var(--z-dur-micro) ease, box-shadow var(--z-dur-micro) ease, transform var(--z-dur-micro) ease;
  }
  @media (hover: hover) { .pq-card:hover { border-color: var(--z-border-control); background: color-mix(in oklab, var(--z-surface-1) 55%, transparent); } }
  .pq-card:active { transform: scale(0.985); }
  .pq-radio { width: 18px; height: 18px; margin-top: 1px; border-radius: 50%; border: 1.5px solid var(--z-border-control); transition: border-color var(--z-dur-micro) ease, box-shadow var(--z-dur-std) var(--z-spring), background-color var(--z-dur-micro) ease; }
  .pq-card-t { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font: 600 14.5px/1.3 var(--z-font-display); color: var(--z-fg); }
  .pq-rec { display: inline-flex; align-items: center; gap: 5px; font: 600 12px/1.2 var(--z-font-display); color: var(--z-accent-text); }
  .pq-rec::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
  .pq-card-d { grid-column: 2; font-size: 13px; line-height: 1.45; color: var(--z-fg-muted); }
  input:checked + .pq-card { border-color: var(--z-fg); background: var(--z-surface-1); box-shadow: inset 0 0 0 0.5px var(--z-fg); }
  input:checked + .pq-card .pq-radio { border-color: var(--z-fg); background: var(--z-fg); box-shadow: inset 0 0 0 4px var(--z-surface-1); }
  input:focus-visible + .pq-card, input:focus-visible + .pq-chip { outline: 2px solid var(--z-accent-text); outline-offset: 2px; }

  /* toggles that add wording only when they apply */
  .pq-toggle.switch { gap: 14px; align-items: flex-start; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--z-border-strong); transition: border-color var(--z-dur-micro) ease, background-color var(--z-dur-micro) ease; }
  .pq-toggle.switch + .pq-toggle.switch { border-top: 1px solid var(--z-border-strong); }
  .pq-toggle .switch-track { margin-top: 1px; }
  @media (hover: hover) { .pq-toggle:hover { border-color: var(--z-border-control); } }
  .pq-toggle:has(input:checked) { border-color: var(--z-fg-muted); background: var(--z-surface-1); }
  .pq-toggle-t { display: grid; gap: 4px; }
  .pq-toggle-t b { font: 600 14px/1.3 var(--z-font-display); }
  .pq-toggle-t small { font-size: 12.5px; line-height: 1.45; color: var(--z-fg-muted); }

  /* multiple choices: toggle chips */
  .pq-chips { display: flex; flex-wrap: wrap; gap: 8px; }
  .pq-chip {
    display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px 0 11px; border-radius: var(--z-radius-pill);
    border: 1px solid var(--z-border-strong); color: var(--z-fg-muted); font: 500 13.5px/1 var(--z-font-display); cursor: pointer; user-select: none;
    transition: background-color var(--z-dur-micro) ease, border-color var(--z-dur-micro) ease, color var(--z-dur-micro) ease, transform var(--z-dur-micro) ease;
  }
  @media (hover: hover) { .pq-chip:hover { border-color: var(--z-border-control); color: var(--z-fg); } }
  .pq-chip:active { transform: scale(0.96); }
  .pq-chip-i { width: 15px; height: 15px; padding: 2px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--z-border-control); fill: none; stroke: transparent; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: stroke var(--z-dur-micro) ease; }
  input:checked + .pq-chip { border-color: var(--z-fg); background: var(--z-fg); color: var(--z-night); }
  input:checked + .pq-chip .pq-chip-i { box-shadow: none; stroke: var(--z-night); }

  /* fields */
  .pq-field { display: grid; gap: 7px; }
  .pq-label { font: 600 13px/1.3 var(--z-font-display); color: var(--z-fg); }
  .pq-text { width: 100%; height: 42px; padding: 0 13px; border-radius: 10px; border: 1px solid var(--z-border-control); background: var(--z-night); color: var(--z-fg); font: 500 15px/1.2 var(--z-font-display); color-scheme: dark; transition: border-color var(--z-dur-micro) ease; }
  .pq-text::placeholder { color: var(--z-fg-subtle); }
  @media (hover: hover) { .pq-text:hover { border-color: var(--z-fg-muted); } }
  .pq-text:focus { outline: 2px solid var(--z-accent-text); outline-offset: 1px; border-color: var(--z-fg-muted); }
  .pq-hint { margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--z-fg-muted); }
  .pq-row2 { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 12px; }
  .pq-pills { display: flex; flex-wrap: wrap; gap: 6px; }
  .pq-pill { height: 28px; padding: 0 11px; border-radius: var(--z-radius-pill); border: 1px solid var(--z-border-strong); background: none; color: var(--z-fg-muted); font: 500 12.5px/1 var(--z-font-display); cursor: pointer; transition: border-color var(--z-dur-micro) ease, color var(--z-dur-micro) ease, transform var(--z-dur-micro) ease; }
  @media (hover: hover) { .pq-pill:hover { border-color: var(--z-border-control); color: var(--z-fg); } }
  .pq-pill:active { transform: scale(0.96); }

  /* information in AI tools: a permissions matrix */
  .pq-matrix { display: grid; }
  .pq-mrow { display: grid; grid-template-columns: minmax(0, 1fr) repeat(3, 62px); align-items: stretch; border-top: 1px solid var(--z-border); }
  .pq-mrow:last-child { border-bottom: 1px solid var(--z-border); }
  .pq-mhead { border-top: 0; padding-bottom: 8px; font: 600 11px/1.2 var(--z-font-display); color: var(--z-fg-muted); text-align: center; align-items: end; }
  .pq-mlabel { display: grid; gap: 2px; min-width: 0; padding: 9px 10px 9px 0; align-content: center; }
  .pq-mlabel b { font: 600 13.5px/1.3 var(--z-font-display); }
  .pq-mlabel span { font-size: 12px; line-height: 1.35; color: var(--z-fg-muted); }
  .pq-mcell { position: relative; display: grid; place-items: center; cursor: pointer; border-radius: 8px; transition: background-color var(--z-dur-micro) ease; }
  @media (hover: hover) { .pq-mcell:hover { background: var(--z-surface-1); } }
  .pq-mr { appearance: none; width: 22px; height: 22px; margin: 0; border-radius: 50%; border: 1.5px solid var(--z-border-control); background: transparent; cursor: pointer; transition: background-color var(--z-dur-micro) ease, border-color var(--z-dur-micro) ease, transform var(--z-dur-micro) var(--z-spring); }
  .pq-mr:checked { border-color: var(--z-fg); background: var(--z-fg); }
  .pq-mcell:active .pq-mr { transform: scale(0.9); }
  .pq-mr:focus-visible { outline: 2px solid var(--z-accent-text); outline-offset: 2px; }
  .pq-mi { position: absolute; width: 13px; height: 13px; pointer-events: none; fill: none; stroke: var(--z-night); stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; opacity: 0; transform: scale(0.6); transition: opacity var(--z-dur-micro) ease, transform var(--z-dur-std) var(--z-spring); }
  .pq-mi .fill { fill: var(--z-night); stroke: none; }
  .pq-mr:checked + .pq-mi { opacity: 1; transform: scale(1); }
  .pq-tip { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--z-fg-muted); }
  .pq-tip a, .pq-assess a { color: var(--z-accent-text); font-weight: 500; text-underline-offset: 3px; }

  /* approved tools */
  .pq-tools { display: grid; gap: 12px; }
  .pq-quick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
  .pq-quick-l { margin-right: 2px; font: 600 11px/1 var(--z-font-display); letter-spacing: var(--z-track-label); text-transform: uppercase; color: var(--z-fg-muted); }
  .pq-qa { display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 11px 0 8px; border-radius: var(--z-radius-pill); border: 1px solid var(--z-border-strong); background: none; color: var(--z-fg); font: 500 12.5px/1 var(--z-font-display); cursor: pointer; transition: border-color var(--z-dur-micro) ease, background-color var(--z-dur-micro) ease, transform var(--z-dur-micro) ease; }
  @media (hover: hover) { .pq-qa:hover { border-color: var(--z-border-control); background: var(--z-surface-1); } }
  .pq-qa:active { transform: scale(0.96); }
  .pq-toollist { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
  .pq-tool {
    display: grid; grid-template-columns: minmax(0, 1fr) 34px; align-items: center; gap: 2px 6px; padding: 8px 6px 10px 6px;
    border-radius: 12px; border: 1px solid var(--z-border-strong); background: color-mix(in oklab, var(--z-surface-1) 40%, transparent);
    transition: border-color var(--z-dur-micro) ease; animation: pop-in var(--z-dur-std) var(--z-spring);
  }
  .pq-tool:focus-within { border-color: var(--z-fg-muted); }
  @media (hover: hover) { .pq-tool:hover { border-color: var(--z-border-control); } }
  .pq-cell { width: 100%; min-width: 0; height: 32px; padding: 0 8px; border: 0; border-radius: 7px; background: transparent; color: var(--z-fg); font: 600 15px/1.2 var(--z-font-display); }
  .pq-cell.is-use { height: 28px; padding: 0 6px; font: 500 13.5px/1.2 var(--z-font-display); }
  .pq-cell::placeholder { color: var(--z-fg-subtle); font-weight: 500; }
  @media (hover: hover) { .pq-cell:hover { background: var(--z-surface-1); } }
  .pq-cell:focus { outline: 2px solid var(--z-accent-text); outline-offset: 0; background: var(--z-night); }
  .pq-tool-use { grid-column: 1 / -1; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 2px; padding-left: 8px; }
  .pq-cell-l { font: 500 12.5px/1 var(--z-font-display); color: var(--z-fg-muted); white-space: nowrap; }
  .pq-tool-x { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 8px; background: none; color: var(--z-fg-muted); cursor: pointer; transition: background-color var(--z-dur-micro) ease, color var(--z-dur-micro) ease; }
  @media (hover: hover) { .pq-tool-x:hover { background: var(--z-surface-1); color: var(--z-fg); } }
  .pq-empty { margin: 0; font-size: 13px; line-height: 1.5; color: var(--z-fg-subtle); }
  .pq-add { justify-self: start; }

  /* why it matters */
  .pq-why { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 12px; padding: 14px 16px; border-radius: 12px; background: color-mix(in oklab, var(--z-surface-1) 60%, transparent); border: 1px solid var(--z-border); }
  .pq-why-i { width: 18px; height: 18px; margin-top: 1px; fill: none; stroke: var(--z-fg-muted); stroke-width: 1.5; stroke-linecap: round; }
  .pq-why b { display: block; margin-bottom: 4px; font: 600 12.5px/1.3 var(--z-font-display); color: var(--z-fg); }
  .pq-why p { margin: 0; font-size: 13px; line-height: 1.55; color: var(--z-fg-muted); }
  /* inline, so a long source name wraps like the sentence around it */
  .pq-src { color: var(--z-accent-text); font-weight: 500; text-underline-offset: 3px; }
  .pq-src .icon { display: inline-block; margin-left: 3px; vertical-align: -2px; }

  /* review and export */
  .pq-open { display: grid; gap: 6px; }
  .pq-open-i { display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 2px 10px; width: 100%; padding: 11px 14px; border-radius: 10px; border: 1px dashed var(--z-border-control); background: transparent; color: var(--z-fg); text-align: left; cursor: pointer; transition: background-color var(--z-dur-micro) ease, transform var(--z-dur-micro) ease; }
  @media (hover: hover) { .pq-open-i:hover { background: var(--z-surface-1); } }
  .pq-open-i:active { transform: scale(0.985); }
  .pq-unseen { display: grid; gap: 2px; }
  .pq-unseen .pq-legend { margin-bottom: 8px; font-weight: 500; color: var(--z-fg-muted); }
  .pq-unseen .pq-pill { color: var(--z-fg); }
  .pq-open-icon { width: 16px; height: 16px; margin-top: 1px; grid-row: span 2; fill: none; stroke: var(--z-fg-muted); stroke-width: 1.6; stroke-linecap: round; }
  .pq-open-t { font: 600 13.5px/1.3 var(--z-font-display); }
  .pq-open-a { font-size: 12.5px; color: var(--z-fg-muted); }
  /* the files: two cards, Word to edit and PDF to sign, then the quieter ways out */
  .pq-export { display: grid; gap: 8px; }
  .pq-file {
    display: grid; grid-template-columns: 26px minmax(0, 1fr) 18px; gap: 2px 12px; align-items: center; width: 100%; padding: 14px 16px;
    border-radius: 12px; border: 1px solid var(--z-border-control); background: var(--z-surface-1); color: var(--z-fg); text-align: left; cursor: pointer;
    transition: border-color var(--z-dur-micro) ease, background-color var(--z-dur-micro) ease, transform var(--z-dur-micro) ease;
  }
  @media (hover: hover) { .pq-file:hover { border-color: var(--z-fg-muted); background: var(--z-surface-2); } .pq-file:hover .pq-file-dl { transform: translateY(2px); } }
  .pq-file:active { transform: scale(0.985); }
  .pq-file-i { grid-row: span 2; width: 26px; height: 26px; fill: none; stroke: var(--z-fg); stroke-width: 1.2; stroke-linecap: round; stroke-linejoin: round; }
  .pq-file-t { font: 600 14.5px/1.3 var(--z-font-display); }
  .pq-file-d { grid-column: 2; font-size: 12.5px; line-height: 1.4; color: var(--z-fg-muted); }
  .pq-file-dl { grid-column: 3; grid-row: 1 / span 2; width: 16px; height: 16px; fill: none; stroke: var(--z-fg-muted); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; transition: transform var(--z-dur-std) var(--z-spring); }
  .pq-export-more { display: flex; flex-wrap: wrap; gap: 6px; }
  .pq-checks { display: grid; gap: 8px; }
  .pq-checks .pq-legend { margin: 6px 0 2px; }
  .pq-check { display: grid; gap: 4px; padding: 12px 14px; border-radius: 10px; background: var(--z-surface-1); border: 1px solid var(--z-border); }
  .pq-check b { font: 600 13.5px/1.3 var(--z-font-display); }
  .pq-check p { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--z-fg-muted); }
  .pq-check .pq-src { justify-self: start; font-size: 12.5px; }
  .pq-dated { margin: 2px 0 0; font-size: 12px; color: var(--z-fg-subtle); }
  .pq-assess { margin: 0; font-size: 13px; line-height: 1.5; color: var(--z-fg-muted); }

  /* Back and Continue, always at the foot of the panel */
  .pp-foot { display: flex; gap: 10px; padding: 14px 24px 18px; border-top: 1px solid var(--z-border); background: var(--z-ground); }
  .pp-foot .btn { height: 44px; font-size: 14.5px; }
  .pp-back { flex: none; padding: 0 16px 0 12px; }
  .pp-next { flex: 0 1 auto; min-width: 0; margin-left: auto; padding: 0 16px 0 20px; }
  .pp-next span { overflow: hidden; text-overflow: ellipsis; }
  .pp-next.is-print { padding: 0 20px 0 16px; }

  .p-toast {
    position: fixed; left: 50%; bottom: 28px; z-index: 70; transform: translate(-50%, 8px); max-width: calc(100% - 32px);
    padding: 10px 16px; border-radius: 12px; background: var(--z-surface-2); color: var(--z-fg); border: 1px solid var(--z-border-strong);
    font: 500 13.5px/1.35 var(--z-font-display); box-shadow: 0 16px 36px -14px color-mix(in oklab, var(--z-void) 70%, transparent);
    opacity: 0; pointer-events: none; transition: opacity var(--z-dur-std) ease, transform var(--z-dur-std) var(--z-ease);
  }
  .p-toast.is-on { opacity: 1; transform: translate(-50%, 0); }
  .p-toast:empty { display: none; }
  .p-undo { position: fixed; left: 50%; bottom: 24px; z-index: 60; display: flex; align-items: center; gap: 14px; padding: 8px 8px 8px 16px; border-radius: 12px; background: var(--z-surface-2); border: 1px solid var(--z-border-strong); box-shadow: 0 16px 36px -14px color-mix(in oklab, var(--z-void) 70%, transparent); transform: translateX(-50%); font: 500 13.5px/1.3 var(--z-font-display); color: var(--z-fg); animation: undo-in var(--z-dur-std) var(--z-ease); }
  .p-undo[hidden] { display: none; }
  @keyframes undo-in { from { opacity: 0; transform: translate(-50%, 8px); } }

  .pv-tabs, .pv-foot { display: none; }

  /* a laptop 768 px tall: a tighter head and foot, so the question keeps its room */
  @media (min-width: 761px) and (max-height: 820px) {
    .pp-head { padding: 14px 24px 12px; }
    .pv-step { padding-top: 20px; gap: 18px; }
    .pq-title { font-size: 21px; }
    .pp-foot { padding: 10px 24px 12px; }
    .pp-foot .btn { height: 42px; }
  }
  @media (max-width: 1180px) { .policy-desk .p-wide { padding: 0 10px; } }

  /* ---- phones: two views; the panel in the page, its foot fixed */
  @media (max-width: 760px) {
    .desk.policy-desk { display: block; padding-bottom: 88px; }
    .policy-desk .work-bar { flex-wrap: wrap; }
    .policy-desk .pv-tabs { display: inline-flex; flex: 1 1 100%; order: 0; }
    .pv-tabs .step { flex: 1; justify-content: center; }
    .pv-tabs .step[aria-pressed='true'] { background: var(--z-surface-2); color: var(--z-fg); box-shadow: inset 0 1px 0 var(--z-border), 0 1px 2px color-mix(in oklab, var(--z-void) 30%, transparent); }
    .policy-desk .work-actions { order: 2; margin-left: auto; }
    .policy-desk .p-wide { display: none; }
    .p-status { order: 1; flex: 1 1 auto; }
    .policy-desk[data-view='questions'] .sheet-wrap { display: none; }
    .policy-desk[data-view='policy'] .inspector { display: none; }
    .policy-desk .inspector { position: static; max-height: none; border: 0; box-shadow: none; background: transparent; }
    .policy-desk .inspector-body { display: block; max-height: none; overflow: visible; }
    .pp-head { padding: 6px 16px 14px; }
    .pp-steps { left: 8px; right: 8px; }
    .pv-step { padding: 20px 16px 24px; }
    .pq-title { font-size: 21px; }
    .pp-foot { position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--z-border-strong); }
    .pp-next { flex: 1; justify-content: space-between; }
    .pv-foot { position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: var(--z-ground); border-top: 1px solid var(--z-border-strong); gap: 8px; }
    .policy-desk[data-view='policy'] .pv-foot { display: flex; }
    .pv-foot .btn { flex: 1; height: 46px; }
    .pv-foot .btn-quiet { flex: 0 0 auto; }
    .p-toast, .p-undo { bottom: 84px; }
    .sheet.policy { padding: 26px 20px 30px; font-size: 15px; }
    .ptitle { font-size: 23px; }
    .pcontrol { grid-template-columns: 1fr 1fr; }
    .pcontrol div:nth-child(n + 3) { border-top: 1px solid color-mix(in oklab, var(--z-tools-sheet-ink) 10%, transparent); }
    .pcontrol .is-wide { grid-column: auto; }
    .psum { margin-inline: -6px; padding: 18px; }
    .psum li { grid-template-columns: 24px 1fr; font-size: 14px; }
    .pclauses > li { grid-template-columns: 34px minmax(0, 1fr); }
    .pn { min-width: 24px; }
    .ps.is-lit, .phead.is-lit { margin-inline: -20px; padding-inline: 20px; }
    .pq-mrow { grid-template-columns: minmax(0, 1fr) repeat(3, 56px); }
    .pq-mhead { font-size: 10.5px; }
  }
  @media (max-width: 360px) {
    .pq-mrow { grid-template-columns: minmax(0, 1fr) repeat(3, 48px); }
    .pq-mhead { font-size: 9.5px; letter-spacing: -0.01em; }
    .pq-cards.is-row { grid-template-columns: 1fr; }
    .pq-row2 { grid-template-columns: 1fr; }
  }
  @media (prefers-reduced-motion: reduce) {
    .pv-step.is-fwd, .pv-step.is-back, .ps.is-changed .pcl, .pq-tool, .p-undo, .p-menu, .pp-steps, .p-saved.is-fresh .icon { animation: none; }
  }
}

/* ---- Print or save as PDF: US Letter, black on white, whatever the screen's theme.
   Outside the layers, after the sheet's island remap (tools.css), so it wins there too:
   unlayered rules beat every layered one, so none of these needs !important. */
@page {
  size: letter;
  margin: 0.75in;
  /* a policy is signed and filed: number its pages */
  @bottom-right { content: 'Page ' counter(page) ' of ' counter(pages); font: 500 8.5pt/1 var(--z-font-display); color: var(--z-ink); }
}
@media print {
  :root { color-scheme: light; }
  html, body { background: none; }
  .topbar, .skip-link, .work-bar, .inspector, .pv-foot, .p-undo, .p-toast, .site-foot, #announce { display: none; }
  .desk.policy-desk { display: block; height: auto; min-height: 0; padding: 0; background: none; }
  .policy-desk .work { padding: 0; }
  .policy-desk .sheet-wrap { display: block; overflow: visible; padding: 0; }
  .sheet.policy, .sheet.policy[data-theme] {
    --z-fg: var(--z-ink);
    --z-fg-muted: color-mix(in oklab, var(--z-ink) 80%, var(--z-paper));
    --z-fg-subtle: color-mix(in oklab, var(--z-ink) 72%, var(--z-paper));
    --z-border-control: color-mix(in oklab, var(--z-ink) 55%, var(--z-paper));
    --z-tools-sheet-ink: var(--z-ink);
    --z-tools-sheet: var(--z-paper);
    width: auto; margin: 0; padding: 0; color: var(--z-ink); background: none; box-shadow: none; border-radius: 0; animation: none; font-size: 10.5pt;
  }
  .sheet.policy .ps, .sheet.policy .phead { cursor: auto; }
  .sheet.policy .ps.is-lit, .sheet.policy .phead.is-lit { margin: 0; padding: 22px 0 6px; background: none; box-shadow: none; }
  .sheet.policy .phead.is-lit { padding: 0; }
  .sheet.policy .psum { background: none; color: var(--z-ink); box-shadow: none; border: 1.5px solid var(--z-ink); break-inside: avoid; }
  .sheet.policy .psum-k { color: var(--z-ink); }
  .sheet.policy .popen { display: none; }
  .sheet.policy .psign-block, .sheet.policy .pcl > p, .sheet.policy .pitems li, .sheet.policy .ptable tr, .sheet.policy .psum { break-inside: avoid; }
  /* a clause's lead-in stays with its list or table; a table may run on, a row at a time */
  .sheet.policy .pcl > p:has(+ .pitems), .sheet.policy .pcl > p:has(+ .ptable) { break-after: avoid; }
  .sheet.policy .ps h3 { break-after: avoid; }
  .sheet.policy .ps.is-changed .pcl { animation: none; }
  /* an open choice prints as tick boxes to decide on paper; any other blank as a line to write on */
  .sheet.policy .blank.has-opts { display: none; }
  .sheet.policy .popts { display: inline; }
  .sheet.policy .popts.is-block { display: block; }
  .sheet.policy .popt + .popt { margin-left: 1.1em; }
  .sheet.policy .popts.is-block .popt { display: grid; grid-template-columns: 1.3em minmax(0, 1fr); margin: 5px 0 0; }
  .sheet.policy .popts.is-block .popt::before { margin-top: 0.3em; }
  .sheet.policy .popts.is-block .popt + .popt { margin-left: 0; }
  .sheet.policy .popt::before { content: ''; display: inline-block; width: 0.8em; height: 0.8em; margin-right: 0.45em; border: 1px solid var(--z-ink); vertical-align: -0.08em; }
  .sheet.policy .blank:not(.has-opts) { display: inline-block; min-width: 1.6in; padding: 0; border: 0; border-bottom: 1px solid var(--z-ink); border-radius: 0; color: transparent; }
}
