/*
 * TAG Legal Desk v2.1, J130: "{ai} can handle these from now on", the second opinion and {ai}'s rules
 * (js\v21_teachfred.js).
 * Desk tokens only, so Light, Dark, Eucalypt, Harbour, High contrast and the Canteen themes all hold. Nothing animates.
 * 44 px targets where a person presses, the desk's own focus ring, no page scroll sideways at phone width. The job's
 * button, the board head notice and the list all leave the screen at once while a welfare message is open, the quiet
 * period runs or the "While nobody was here" band shows (data-quiet), and none of it is ever printed. No inline styles.
 */

/* ---------- on the job, under Tell the AI what to change ---------- */
.v21tf-job { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 12px; min-width: 0; }
.v21tf-job[hidden] { display: none; }
.v21tf-btn { min-height: 44px; white-space: normal; text-align: left; }
.v21tf-btn .ico, .v21tf-head .ico { color: var(--brand-text); }
.v21tf-line { margin: 0; flex: 1 1 260px; min-width: 0; font-size: .875rem; line-height: 1.35rem; color: var(--ink-2); overflow-wrap: anywhere; }
.v21tf-see { min-height: 44px; }

/* ---------- the board head notice ---------- */
.v21tf-head { min-height: 44px; white-space: normal; text-align: left; font-weight: 700; }

/* ---------- the ask sheet ---------- */
.sheet.v21tf-sheet { width: min(560px, 100%); }
.v21tf-form { display: grid; gap: 18px; min-width: 0; }
.v21tf-field { display: grid; gap: 6px; min-width: 0; }
.v21tf-field > label, .v21tf-label, .v21tf-choice > legend { margin: 0; font-weight: 700; font-size: .9375rem; color: var(--ink); }
.v21tf-field .meta { margin: 0; font-size: .8125rem; line-height: 1.25rem; color: var(--ink-2); }
.v21tf-kind {
  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;
}
.v21tf-kind:focus-visible { outline-offset: 0; border-color: var(--focus); }
.v21tf-kind[aria-invalid="true"] { border-color: var(--danger); }
/* J229: the leader's "Why this is justified" box */
.v21tf-why-in {
  width: 100%; min-height: 88px; box-sizing: border-box; padding: 10px 12px; border-radius: 12px; resize: vertical;
  border: 1px solid var(--edge-strong); background: var(--solid); color: var(--ink); font: inherit; font-size: .9375rem; line-height: 1.4rem;
}
.v21tf-why-in:focus-visible { outline-offset: 0; border-color: var(--focus); }
.v21tf-why-in[aria-invalid="true"] { border-color: var(--danger); }
@media (forced-colors: active) { .v21tf-why-in, .v21tf-kind { border-color: CanvasText; } }
.v21tf-err { margin: 0; font-size: .8125rem; font-weight: 700; color: var(--danger); overflow-wrap: anywhere; }
.v21tf-err:empty { display: none; }
.v21tf-choice { display: grid; gap: 8px; margin: 0; padding: 0; border: 0; min-width: 0; }
.v21tf-choice > legend { padding: 0; margin-bottom: 6px; }
.v21tf-opt { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; padding: 10px 14px; border-radius: 14px; border: 1px solid var(--glass-edge); cursor: pointer; min-width: 0; }
.v21tf-opt input { flex: none; width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--brand); }
.v21tf-opt:has(input:checked) { border-color: var(--brand-text); background: var(--brand-soft); }
.v21tf-opt:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.v21tf-opt-t { display: grid; gap: 2px; min-width: 0; font-size: .875rem; line-height: 1.35rem; color: var(--ink-2); overflow-wrap: anywhere; }
.v21tf-opt-t b { color: var(--ink); font-size: .9375rem; }
.v21tf-act { margin: 0; font-size: .875rem; line-height: 1.35rem; color: var(--ink-2); overflow-wrap: anywhere; }
.v21tf-act b { color: var(--ink); }
.v21tf-row { justify-content: flex-end; }
.v21tf-row .btn { white-space: normal; }

/* ---------- the list ---------- */
.v21tf-list { display: grid; gap: 18px; min-width: 0; }
.v21tf-intro { margin: 0; font-size: .875rem; line-height: 1.35rem; }
.v21tf-sec { display: grid; gap: 10px; min-width: 0; }
.v21tf-sec > h3 { margin: 0; font-size: 1rem; }
.v21tf-old > summary { list-style: none; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px 0 10px; border-radius: 10px; font-weight: 700; font-size: .9375rem; color: var(--brand-text); cursor: pointer; background: var(--brand-soft); }
.v21tf-old > summary::-webkit-details-marker { display: none; }
.v21tf-old[open] > summary .ico { transform: rotate(180deg); }
.v21tf-old > .v21tf-rules { margin-top: 10px; }
.v21tf-rules { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; min-width: 0; }
.v21tf-rule { display: grid; gap: 6px; padding: 12px 14px; border-radius: 16px; min-width: 0; }
.v21tf-rule[data-state="pending"] { box-shadow: inset 4px 0 0 var(--brand-text); }
.v21tf-rule[data-state="undone"] .v21tf-rule-kind { color: var(--ink-2); }
.v21tf-rule-kind { margin: 0; font-weight: 700; font-size: .9375rem; line-height: 1.4rem; color: var(--ink); overflow-wrap: anywhere; }
.v21tf-rule-act { margin: 0; font-size: .875rem; line-height: 1.35rem; color: var(--ink-2); overflow-wrap: anywhere; }
.v21tf-rule-meta { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; font-size: .8125rem; line-height: 1.25rem; color: var(--ink-3); overflow-wrap: anywhere; }
.v21tf-wait { font-weight: 600; }
.v21tf-undo-q { margin: 0; font-size: .875rem; line-height: 1.35rem; font-weight: 600; color: var(--ink); }
.v21tf-rule .btn { min-height: 44px; }

:root[data-theme="high_contrast"] .v21tf-opt, :root[data-theme="high_contrast"] .v21tf-rule { border: 2px solid #000; box-shadow: none; }
:root[data-theme="high_contrast"] .v21tf-opt:has(input:checked) { outline: 3px solid #000; outline-offset: 1px; }
:root[data-theme="high_contrast"] .v21tf-rule-meta { color: var(--ink-2); }

/* ---------- phone width ---------- */
@media (max-width: 599px) {
  .v21tf-job { align-items: stretch; }
  .v21tf-btn { width: 100%; justify-content: flex-start; }
  .v21tf-row { justify-content: stretch; }
  .v21tf-row .btn { flex: 1 1 auto; }
}

/* ---------- the quiet states: gone at once (the core closes the sheets itself) ---------- */
:root[data-quiet="on"] .v21tf-job,
:root[data-quiet="on"] .v21tf-head,
:root[data-v21-welfare="on"] .v21tf-job,
:root[data-v21-welfare="on"] .v21tf-head { display: none !important; }

/* ---------- never printed ---------- */
@media print {
  .v21tf-job, .v21tf-head, .v21tf-sheet { display: none !important; }
}
