/* Policies — page layout only: the rule list's drag handle and drop marks, the sticky preview
   column and the tower readout lines. Every block look comes from the kit. */
@layer page {
  .pol-session { max-width: 1040px; }

  /* A policy value's preset comparison: built-in, Strict, Relaxed; the one in force reads strong */
  .pol-presets { font-size: var(--t-small); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s1) var(--s4); margin: 0; }
  .pol-presets dt { color: var(--text-3); font-size: var(--t-small); }
  .pol-presets dd { margin: 0; color: var(--text-2); }
  .pol-presets dd[data-on] { color: var(--text); font-weight: 600; }
  @media (max-width: 700px) { .pol-presets { grid-template-columns: minmax(0, 1fr); } }

  /* Tower rules: the drag handle and where a dragged rule will land */
  .pol-grip { display: grid; place-items: center; width: 20px; height: 40px; color: var(--text-3); cursor: grab; touch-action: none; user-select: none; border-radius: var(--r1); }
  .pol-grip:empty { cursor: default; }
  .pol-grip:not(:empty):hover { color: var(--text); background: var(--hover); }
  [data-drag] { z-index: 5; box-shadow: var(--shadow-3); cursor: grabbing; }
  :is([data-drop="before"], [data-drop="after"])::after { content: ''; position: absolute; left: var(--s2); right: var(--s2); height: 2px; background: var(--accent); border-radius: 2px; }
  [data-drop="before"]::after { top: -1px; }
  [data-drop="after"]::after { bottom: -1px; }

  /* What the operator sees: sticky beside the rules, first above them once the columns stack */
  .pol-pv { position: sticky; top: calc(var(--top-h) + var(--s4)); max-height: calc(100vh - var(--top-h) - var(--s8)); overflow-y: auto; overscroll-behavior: contain; padding: 2px; margin: -2px; }
  .pol-tw { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; font-size: var(--t-small); }
  .pol-tw > li { display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: var(--s2); align-items: start; }
  .pol-tw > li > :first-child { margin-top: 4px; }
  .pol-why { display: block; color: var(--text-2); }
  @media (max-width: 1180px) {
    .pol-pv { position: static; max-height: none; overflow: visible; padding: 0; margin: 0; }
    .pol-tower > :last-child { order: -1; }
  }
  /* A row's source, and its preset comparison folded beside it (open on an edited row). */
  .pol-hint { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s3); }
  .pol-compare:not([data-open]) { display: none; }
  #pol:has(#pol-cmp:checked) .pol-compare { display: block; }
  .pol-rules { display: grid; gap: var(--s1); margin: var(--s1) 0 0; padding: 0; list-style: none; }
  /* The area tabs, with the area's explanation at the end of the row. */
  .pol-tabs { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2) var(--s4); margin-bottom: var(--s4); }
}
