/*
 * TAG Legal Desk v2.1: Needs you (J234; js/v21_needsyou.js), for the Director and the GM only. The bell and its red
 * number on your chip and in your chip's menu, and the wide panel: the sections with their red dots, one card per item
 * (the proof, the confidence bar, the examples that open, the two answer rows), {ai} deciding, and the Resolved list.
 * Desk tokens only, so Light, Dark, Eucalypt, Harbour, High contrast and the Canteen themes all hold. Red means open and
 * nothing else; words always say it too. Only transform and opacity move (the live dot, the bar filling, {ai} thinking),
 * and nothing moves with reduced motion or Calm. 44 px targets, the desk's own focus ring, no sideways scroll at phone
 * width. No inline styles: the bar's fill is the custom property --v21ny-c, set through style.setProperty.
 */

/* ---------- the red number: one look everywhere ---------- */
.v21ny-mn, .v21ny-cn, .v21ny-sn, .v21ny-n.is-open { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; box-sizing: border-box; border-radius: 999px; background: var(--danger); color: var(--solid); font-size: .75rem; line-height: 1; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- your chip: the bell ---------- */
.v21ny-chipbell { position: relative; display: inline-grid; place-items: center; flex: none; width: 26px; height: 26px; margin-left: 2px; border-radius: 50%; color: var(--ink-2); }
.v21ny-chipbell.has-open { color: var(--ink); }
.v21ny-chipbell .ico { display: block; }
.v21ny-chipbell .v21ny-cn { position: absolute; top: -6px; right: -8px; min-width: 18px; height: 18px; padding: 0 5px; font-size: .6875rem; box-shadow: 0 0 0 2px var(--solid); }

/* ---------- your chip's menu: the mark and its count ---------- */
.v21ny-mi { display: inline-grid; place-items: center; flex: none; width: 18px; height: 18px; color: var(--ink-3); }
.v21ny-mi .ico { display: block; }
.menu button:has(> .v21ny-mi) { position: relative; padding-right: 48px; }
.v21ny-mi .v21ny-mn { position: absolute; top: 50%; right: 12px; margin-top: -10px; }

/* ---------- the panel: the desk's sheet, expanded wide ---------- */
.sheet.v21ny-sheet { width: 100%; border-radius: 0; }
.v21ny-sheet .sheet-h { width: 100%; max-width: 1184px; margin: 0 auto; }
.v21ny-sheet .sheet-b { scrollbar-gutter: stable; }
.v21ny { display: grid; gap: 16px; width: 100%; max-width: 1040px; margin: 0 auto; min-width: 0; align-content: start; }

.v21ny-live { display: inline-flex; align-items: center; gap: 8px; flex: none; min-height: 30px; padding: 3px 12px 3px 11px; border-radius: 999px; font-size: .8125rem; font-weight: 600; color: var(--ink-2); background: color-mix(in srgb, var(--ok) var(--tint-alpha), transparent); white-space: nowrap; font-variant-numeric: tabular-nums; }
.v21ny-live.is-off { background: var(--solid-2); }
.v21ny-pulse { position: relative; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.v21ny-pulse::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--ok); opacity: 0; animation: v21ny-ping 2.6s var(--ease-out) infinite; }
.v21ny-live.is-off .v21ny-pulse { background: var(--edge-strong); }
.v21ny-live.is-off .v21ny-pulse::after { display: none; }
@keyframes v21ny-ping { 0% { transform: scale(.4); opacity: .7; } 70%, 100% { transform: scale(1.5); opacity: 0; } }

.v21ny-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; min-width: 0; }
.v21ny-head[hidden] { display: none; }
.v21ny-tabs { display: inline-flex; gap: 2px; max-width: 100%; padding: 3px; border-radius: 14px; background: var(--brand-soft); }
.v21ny-tab { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border: 0; border-radius: 11px; background: transparent; color: var(--ink-2); font-size: .875rem; font-weight: 700; line-height: 1.15; transition: background-color var(--t-small) var(--ease-out), color var(--t-small) var(--ease-out); }
.v21ny-tab:hover { color: var(--ink); background: var(--glass-hover); }
.v21ny-tab[aria-selected="true"] { background: var(--solid); color: var(--ink); box-shadow: var(--shadow-1); }
.v21ny-tab:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.v21ny-n { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--solid); color: var(--ink-2); font-size: .75rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.v21ny-n[hidden] { display: none; }
.v21ny-intro { margin: 0; flex: 1 1 320px; min-width: 0; font-size: .875rem; line-height: 1.35rem; }

.v21ny-err { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin: 0; padding: 10px 12px 10px 16px; border-radius: 14px; background: var(--solid); border: 1px solid var(--glass-rim); box-shadow: inset 4px 0 0 var(--warn), var(--shadow-1); color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.v21ny-err > span { flex: 1 1 200px; min-width: 0; }
.v21ny-err .ico { flex: none; color: var(--warn); }
.v21ny-err[hidden] { display: none; }
.v21ny-panel { display: grid; gap: 20px; min-width: 0; border-radius: 12px; }
.v21ny-panel[hidden] { display: none; }
.v21ny-empty { margin: 0; padding: 18px 20px; border-radius: var(--r-card); color: var(--ink-2); font-weight: 600; }

/* ---------- the sections, each with its red dot while it has open items ---------- */
.v21ny-secs { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
.v21ny-sec { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--glass-rim); background: var(--solid); color: var(--ink-2); font-size: .875rem; font-weight: 700; line-height: 1.15; transition: background-color var(--t-small) var(--ease-out), color var(--t-small) var(--ease-out); }
.v21ny-sec:hover { color: var(--ink); background: var(--glass-hover); }
.v21ny-sec.has-open { color: var(--ink); }
.v21ny-sec[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand-text); border-color: transparent; box-shadow: inset 0 0 0 2px var(--brand-text); }
.v21ny-sec:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.v21ny-dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 2px color-mix(in srgb, var(--danger) 22%, transparent); }

.v21ny-group { display: grid; gap: 12px; min-width: 0; }
.v21ny-gh { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0; font-size: 1rem; line-height: 1.4rem; font-weight: 700; color: var(--ink); }
.v21ny-gn { margin: 0; font-size: .8125rem; font-weight: 600; }

/* ---------- one card per item ---------- */
.v21ny-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; min-width: 0; }
.v21ny-list > li { display: grid; min-width: 0; }
.v21ny-list[hidden] { display: none; }
.v21ny-card { --v21ny-k: var(--danger); display: grid; gap: 14px; min-width: 0; padding: 20px 22px 20px 24px; border-radius: var(--r-card); }
.v21ny-card.g1 { box-shadow: inset 5px 0 0 var(--v21ny-k), inset 0 1px 0 var(--glass-hi), 0 0 0 1px var(--glass-rim), var(--shadow-1); }
.v21ny-card.is-answered_one { --v21ny-k: var(--info); }
.v21ny-card.is-deciding { --v21ny-k: var(--ember); }
.v21ny-card.is-resolved { --v21ny-k: var(--ok); }

.v21ny-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; min-width: 0; }
.v21ny-tag, .v21ny-state { display: inline-flex; align-items: center; gap: 7px; padding: 3px 11px; border-radius: 999px; font-size: .75rem; line-height: 1.2rem; font-weight: 700; }
.v21ny-tag { color: var(--ink-2); background: var(--solid-2); border: 1px solid var(--glass-rim); }
.v21ny-state { --v21ny-s: var(--danger); color: color-mix(in srgb, var(--v21ny-s) 78%, var(--ink)); background: color-mix(in srgb, var(--v21ny-s) var(--tint-alpha), transparent); }
.v21ny-state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--v21ny-s); }
.v21ny-state.is-wait { --v21ny-s: var(--info); }
.v21ny-state.is-deciding { --v21ny-s: var(--ember); }
.v21ny-state.is-done { --v21ny-s: var(--ok); }

.v21ny-title { margin: 0; font-size: 1.3125rem; line-height: 1.8rem; font-weight: 700; letter-spacing: -.005em; color: var(--ink); overflow-wrap: anywhere; }
.v21ny-title:focus { outline: none; }
.v21ny-title:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; border-radius: 6px; }
.v21ny-title.is-done { font-size: 1.125rem; line-height: 1.6rem; }
.v21ny-title.is-none { font-style: italic; color: var(--ink-2); }
.v21ny-sum { margin: 0; font-size: 1rem; line-height: 1.55rem; color: var(--ink-2); overflow-wrap: anywhere; max-width: 72ch; }
.v21ny-where { margin: 0; }

/* the proof */
.v21ny-proof, .v21ny-decision { display: grid; gap: 10px; min-width: 0; padding: 14px 16px 16px; border-radius: 16px; background: var(--solid); border: 1px solid var(--glass-rim); }
.v21ny-ph { margin: 0; font-size: .75rem; line-height: 1rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
.v21ny-reasons { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.v21ny-reasons li { font-size: .9375rem; line-height: 1.45rem; color: var(--ink); overflow-wrap: anywhere; }
.v21ny-none { margin: 0; font-style: italic; color: var(--ink-2); }

/* the confidence bar */
.v21ny-conf { --v21ny-f: var(--ok); display: grid; gap: 6px; min-width: 0; }
.v21ny-conf.is-fair { --v21ny-f: var(--info); }
.v21ny-conf.is-low { --v21ny-f: var(--warn); }
.v21ny-confh { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 0; font-size: .9375rem; font-weight: 600; color: var(--ink-2); }
.v21ny-pc { color: var(--ink); font-size: 1.0625rem; font-variant-numeric: tabular-nums; }
.v21ny-lvl { padding: 1px 9px; border-radius: 999px; font-size: .75rem; font-weight: 700; color: color-mix(in srgb, var(--v21ny-f) 78%, var(--ink)); background: color-mix(in srgb, var(--v21ny-f) var(--tint-alpha), transparent); }
.v21ny-bar { position: relative; height: 12px; border-radius: 999px; background: var(--solid-2); box-shadow: inset 0 0 0 1px var(--glass-rim); overflow: hidden; max-width: 520px; }
.v21ny-fill { position: absolute; inset: 0; border-radius: inherit; background: var(--v21ny-f); transform-origin: left center; transform: scaleX(var(--v21ny-c, 0)); animation: v21ny-grow .7s var(--ease-out) both; }
@keyframes v21ny-grow { from { transform: scaleX(0); } }
.v21ny-fill.is-still { animation: none; }
.v21ny-confwhy { margin: 0; font-size: .875rem; line-height: 1.35rem; color: var(--ink-2); overflow-wrap: anywhere; }

/* the examples that open */
.v21ny-exs { display: grid; gap: 6px; min-width: 0; }
.v21ny-exh { margin: 4px 0 0; font-size: .875rem; font-weight: 700; color: var(--ink-2); }
.v21ny-ex, .v21ny-more { border-radius: 12px; background: var(--solid-2); border: 1px solid var(--glass-rim); min-width: 0; }
.v21ny-ex > summary, .v21ny-more > summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; padding: 0 12px 0 14px; border-radius: 12px; cursor: pointer; list-style: none; font-size: .9375rem; font-weight: 700; color: var(--ink); }
.v21ny-ex > summary::-webkit-details-marker, .v21ny-more > summary::-webkit-details-marker { display: none; }
.v21ny-ex > summary > span, .v21ny-more > summary > span { min-width: 0; overflow-wrap: anywhere; }
.v21ny-ex > summary .ico, .v21ny-more > summary .ico { flex: none; color: var(--ink-2); transition: transform var(--t-small) var(--ease-out); }
.v21ny-ex[open] > summary .ico, .v21ny-more[open] > summary .ico { transform: rotate(180deg); }
.v21ny-ex > summary:focus-visible, .v21ny-more > summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.v21ny-exb { padding: 0 14px 12px; }
.v21ny-exb p { margin: 0; font-size: .9375rem; line-height: 1.5rem; color: var(--ink-2); overflow-wrap: anywhere; }
.v21ny-moreb { display: grid; gap: 12px; padding: 0 12px 12px; }

/* ---------- the two answer rows ---------- */
.v21ny-rows { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; min-width: 0; }
.v21ny-row { display: grid; align-content: start; gap: 10px; min-width: 0; padding: 14px 16px; border-radius: 16px; background: var(--solid-2); border: 1px solid var(--glass-rim); }
.v21ny-row.is-mine { background: var(--solid); box-shadow: inset 0 3px 0 var(--brand-text); }
.v21ny-rh { display: flex; align-items: center; gap: 8px; margin: 0; font-size: .9375rem; font-weight: 700; color: var(--ink); }
.v21ny-you { padding: 1px 8px; border-radius: 999px; font-size: .6875rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--brand-text); background: var(--brand-soft); }
.v21ny-said, .v21ny-other { display: flex; align-items: flex-start; gap: 8px; margin: 0; font-size: .9375rem; line-height: 1.45rem; color: var(--ink); overflow-wrap: anywhere; }
.v21ny-said .ico, .v21ny-other .ico { flex: none; margin-top: 3px; }
.v21ny-row.is-agree .v21ny-said .ico { color: var(--ok); }
.v21ny-row.is-disagree .v21ny-said .ico { color: var(--danger); }
.v21ny-row.is-not_sure .v21ny-said .ico { color: var(--warn); }
.v21ny-other { color: var(--ink-2); }
.v21ny-other .ico { color: var(--info); }
.v21ny-at { margin: 0; }
.v21ny-ask { margin: 0; font-size: .875rem; font-weight: 700; color: var(--ink-2); }
.v21ny-choices { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
.v21ny-choice { min-height: 44px; }
.v21ny-choice[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand-text); box-shadow: inset 0 0 0 2px var(--brand-text); }
.v21ny-choice.is-agree .ico { color: var(--ok); }
.v21ny-choice.is-disagree .ico { color: var(--danger); }
.v21ny-choice.is-not_sure .ico { color: var(--warn); }
.v21ny-choice[aria-disabled="true"], .v21ny-send[aria-disabled="true"] { opacity: .55; cursor: progress; }
.v21ny-cf { display: grid; gap: 6px; min-width: 0; }
.v21ny-cf label { font-size: .875rem; font-weight: 600; color: var(--ink-2); }
.v21ny-comment { width: 100%; min-height: 76px; box-sizing: border-box; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--edge-strong); background: var(--solid); color: var(--ink); font: inherit; font-size: .9375rem; line-height: 1.4rem; resize: vertical; }
.v21ny-comment::placeholder { color: var(--ink-3); opacity: 1; }
.v21ny-comment:focus-visible { outline: 3px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
.v21ny-comment[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); }
.v21ny-hint { margin: 0; }
.v21ny-sendrow { display: flex; flex-wrap: wrap; gap: 10px; }
.v21ny-rerr { margin: 0; font-size: .875rem; font-weight: 700; color: var(--danger); overflow-wrap: anywhere; }
.v21ny-rerr:empty { display: none; }

/* ---------- {ai} is deciding: a gentle working state ---------- */
.v21ny-deciding { display: flex; align-items: center; gap: 16px; padding: 14px 18px; border-radius: 16px; background: color-mix(in srgb, var(--ember) var(--tint-alpha), transparent); box-shadow: inset 3px 0 0 var(--ember); min-width: 0; }
.v21ny-dpic { display: inline-grid; place-items: center; flex: none; color: var(--ember); }
.v21ny-dt { display: grid; gap: 4px; min-width: 0; }
.v21ny-dh { margin: 0; font-size: 1.0625rem; line-height: 1.5rem; font-weight: 700; color: var(--ink); }
.v21ny-dt .meta { margin: 0; }
.v21ny-deciding .v21ny-dh::after { content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 8px; vertical-align: middle; border-radius: 50%; background: var(--ember); animation: v21ny-breathe 1.8s ease-in-out infinite; }
@keyframes v21ny-breathe { 0%, 100% { opacity: .25; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.1); } }

/* ---------- the decision ---------- */
.v21ny-decision { box-shadow: inset 0 3px 0 var(--ok); }
.v21ny-dtext { margin: 0; font-size: 1.0625rem; line-height: 1.55rem; font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.v21ny-dwhy { margin: 0; font-size: .9375rem; line-height: 1.5rem; color: var(--ink-2); overflow-wrap: anywhere; }
.v21ny-decision .meta { margin: 0; }
.v21ny-both { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.v21ny-both li { padding: 8px 12px; border-radius: 12px; background: var(--solid-2); font-size: .9375rem; line-height: 1.4rem; color: var(--ink-2); overflow-wrap: anywhere; }
.v21ny-both b { color: var(--ink); }

/* ---------- Resolved: the search ---------- */
.v21ny-find { display: grid; gap: 6px; max-width: 640px; min-width: 0; }
.v21ny-find label { font-size: .875rem; font-weight: 700; color: var(--ink-2); }
.v21ny-search { width: 100%; min-height: 44px; box-sizing: border-box; padding: 0 12px; border-radius: 12px; border: 1px solid var(--edge-strong); background: var(--solid); color: var(--ink); font: inherit; font-size: .9375rem; }
.v21ny-search::placeholder { color: var(--ink-3); opacity: 1; }
.v21ny-search:focus-visible { outline: 3px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
.v21ny-count { margin: 0; }

/* ---------- narrower screens ---------- */
@media (max-width: 799px) {
  .v21ny-rows { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 599px) {
  .v21ny-sheet .sheet-h { flex-wrap: wrap; row-gap: 6px; }
  .v21ny-sheet .sheet-h h2 { flex: 1 1 60%; min-width: 0; }
  .v21ny-sheet .v21ny-live { order: 3; }
  .v21ny-sheet .sheet-b { padding-left: 16px; padding-right: 16px; }
  .v21ny-tabs { display: flex; width: 100%; }
  .v21ny-tab { flex: 1 1 0; min-width: 0; padding: 0 8px; }
  .v21ny-card { padding: 16px 16px 16px 18px; gap: 12px; }
  .v21ny-title { font-size: 1.1875rem; line-height: 1.65rem; }
  .v21ny-choice { flex: 1 1 30%; justify-content: center; }
  .v21ny-send, .v21ny-go { flex: 1 1 100%; justify-content: center; }
  .v21ny-deciding { flex-direction: column; align-items: flex-start; }
}

/* ---------- High contrast and forced colours ---------- */
:root[data-theme="high_contrast"] .v21ny-card, :root[data-theme="high_contrast"] .v21ny-empty, :root[data-theme="high_contrast"] .v21ny-err, :root[data-theme="high_contrast"] .v21ny-proof, :root[data-theme="high_contrast"] .v21ny-decision, :root[data-theme="high_contrast"] .v21ny-row, :root[data-theme="high_contrast"] .v21ny-bar { border: 2px solid var(--ink); }
:root[data-theme="high_contrast"] .v21ny-state, :root[data-theme="high_contrast"] .v21ny-tag, :root[data-theme="high_contrast"] .v21ny-sec, :root[data-theme="high_contrast"] .v21ny-live, :root[data-theme="high_contrast"] .v21ny-lvl { border: 1.5px solid currentColor; }
:root[data-theme="high_contrast"] .v21ny-mn, :root[data-theme="high_contrast"] .v21ny-cn, :root[data-theme="high_contrast"] .v21ny-sn, :root[data-theme="high_contrast"] .v21ny-dot { box-shadow: 0 0 0 2px var(--ink); }
:root[data-theme="high_contrast"] .v21ny-comment, :root[data-theme="high_contrast"] .v21ny-search { border: 2px solid var(--ink); }
@media (forced-colors: active) {
  .v21ny-card, .v21ny-empty, .v21ny-err, .v21ny-proof, .v21ny-decision, .v21ny-row, .v21ny-ex, .v21ny-more, .v21ny-bar { border: 1px solid CanvasText; }
  .v21ny-state, .v21ny-tag, .v21ny-sec, .v21ny-live, .v21ny-lvl, .v21ny-mn, .v21ny-cn, .v21ny-sn, .v21ny-n { border: 1px solid CanvasText; }
  .v21ny-sec[aria-pressed="true"], .v21ny-choice[aria-pressed="true"], .v21ny-tab[aria-selected="true"] { outline: 2px solid Highlight; }
  .v21ny-dot, .v21ny-pulse, .v21ny-state::before, .v21ny-fill, .v21ny-mn, .v21ny-cn, .v21ny-sn { forced-color-adjust: none; background: Highlight; color: HighlightText; }
}

/* ---------- reduced motion and Calm: nothing moves ---------- */
@media (prefers-reduced-motion: reduce) {
  :root:not([data-motion="full"]) .v21ny-pulse::after { animation: none; display: none; }
  :root:not([data-motion="full"]) .v21ny-fill, :root:not([data-motion="full"]) .v21ny-deciding .v21ny-dh::after { animation: none; }
  :root:not([data-motion="full"]) .v21ny-tab, :root:not([data-motion="full"]) .v21ny-sec, :root:not([data-motion="full"]) .v21ny-ex > summary .ico, :root:not([data-motion="full"]) .v21ny-more > summary .ico { transition: none; }
}
:root[data-motion="reduced"] .v21ny-pulse::after, :root[data-calm="on"] .v21ny-pulse::after { animation: none; display: none; }
:root[data-motion="reduced"] .v21ny-fill, :root[data-calm="on"] .v21ny-fill,
:root[data-motion="reduced"] .v21ny-deciding .v21ny-dh::after, :root[data-calm="on"] .v21ny-deciding .v21ny-dh::after { animation: none; }
:root[data-motion="reduced"] .v21ny-tab, :root[data-calm="on"] .v21ny-tab, :root[data-motion="reduced"] .v21ny-sec, :root[data-calm="on"] .v21ny-sec { transition: none; }

/* ---------- print: the items and decisions, never the controls ---------- */
@media print {
  .v21ny-secs, .v21ny-choices, .v21ny-cf, .v21ny-sendrow, .v21ny-live, .v21ny-find { display: none !important; }
}
