/* ==================================================================
   Threshold - file responsibility (th-resp-*)
   ------------------------------------------------------------------
   The Applicant File's owning block as a button and its non-modal
   Responsibility drawer, lifted from the approved Teams, routing,
   ownership and My Work canon (File Responsibility.dc.html; the
   handoff's drawer, radio-list and "What changes" primitives in
   handoff/threshold-ops.css). Values are the prototype's, on
   production tokens:

     --sunk -> --th-paper-sunk     --paper -> --th-paper
     --mono / --serif / --sans -> --th-font-mono / serif / sans

   No token is declared here and every colour tracks a theme token, so
   dark mode needs no override. Buttons, pills, banners, radio lists,
   fields, the textarea and the feedback notice are the shared atoms
   (cc-btn, cc-pill, th-banner, th-radiolist, th-radio, th-textarea,
   th-fb) and are not redefined. The owning block keeps All Files'
   lifted placement (.af-file-owning in all-files.css) and turns the
   static stack into the canon's button.
   ================================================================== */

/* ---------- owning block (summary card) ---------- */
.af-file-owning.th-resp-owning {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 4px 10px;
  border-radius: var(--th-radius-3);
  border: 1px solid transparent;
  background: transparent;
  font: inherit;
  cursor: pointer;
  text-align: right;
  color: inherit;
}
/* The summary card's children are flex: none; the owning block alone may shrink, so a long team or owner name wraps.
   Only the shrink changes: All Files' narrow rule still gives the block its own line (flex-basis: 100%). */
.af-file-summary > .af-file-owning.th-resp-owning { flex-shrink: 1; min-width: 0; max-width: 100%; }
/* Narrow: All Files canon (F03, F11) sets the owning block on its own line, flush left. The button's
   right-aligned stack is a wide-layout arrangement, so its lines align left here too. */
@media (max-width: 952px) {
  .af-file-summary > .af-file-owning.th-resp-owning { align-items: flex-start; text-align: left; }
  .af-file-summary > .af-file-owning .th-resp-owning__stack { align-items: flex-start; }
}
.th-resp-owning:hover { border-color: var(--th-line-2); background: var(--th-paper); }
.th-resp-owning:focus-visible { outline: 2px solid var(--th-advant); outline-offset: 2px; }
.th-resp-owning__stack { display: flex; flex-direction: column; gap: 1px; align-items: flex-end; min-width: 0; }
.th-resp-owning .af-file-team-owner { font-size: 12px; color: var(--th-ink-2); white-space: normal; overflow-wrap: anywhere; }
.th-resp-owning .af-file-owning-label { font-size: 11px; color: var(--th-ink-2); }
.th-resp-owning > svg { color: var(--th-ink-2); flex: none; }

/* ---------- drawer (ADR-0063 family, non-modal) ---------- */
.th-resp-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 460px;
  max-width: 100vw;
  background: var(--th-paper-sunk);
  border-left: 1px solid var(--th-line-2);
  box-shadow: -12px 0 36px oklch(20% 0.01 255 / 0.14);
  z-index: 55;
  display: flex;
  flex-direction: column;
  font-family: var(--th-font-sans);
  color: var(--th-ink);
  font-size: 13px;
}
.th-resp-head {
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--th-line);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex: none;
}
.th-resp-head__text { flex: 1; min-width: 0; }
.th-resp-title { margin: 0; font: 600 17px var(--th-font-serif); color: var(--th-ink); }
.th-resp-title:focus { outline: none; }
.th-resp-meta {
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--th-ink-2);
  font-family: var(--th-font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.th-resp-close {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: var(--th-radius-3);
  color: var(--th-ink-2);
  background: transparent;
  border: 0;
  cursor: pointer;
  flex: none;
}
.th-resp-close:hover { background: var(--th-paper-2); color: var(--th-ink); }
.th-resp-close:focus-visible { outline: 2px solid var(--th-advant); outline-offset: 2px; }
.th-resp-close[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.th-resp-scroll { flex: 1; overflow-y: auto; min-height: 0; }

/* ---------- banners at the top of the drawer ---------- */
.th-resp-banner { margin: 14px 18px 0; font-size: 12.5px; }
.th-resp-banner-btn {
  font: inherit;
  font-size: 12px;
  padding: 1px 8px;
  border: 1px solid currentcolor;
  border-radius: var(--th-radius-3);
  background: transparent;
  color: inherit;
  cursor: pointer;
}
.th-resp-banner-btn:focus-visible { outline: 2px solid var(--th-advant); outline-offset: 2px; }
.th-resp-offline {
  margin: 14px 18px 0;
  border: 1px solid var(--th-warn);
  border-radius: var(--th-radius-5);
  background: var(--th-warn-soft);
  padding: 10px 12px;
  font-size: 12.5px;
  color: var(--th-warn-ink);
  line-height: 1.5;
}

/* ---------- overview ---------- */
.th-resp-body { padding: 14px 18px 0; display: flex; flex-direction: column; gap: 14px; }
.th-resp-card { border: 1px solid var(--th-line); border-radius: var(--th-radius-5); background: var(--th-paper); }
.th-resp-card.is-last { margin-bottom: 18px; }
.th-resp-card__head {
  padding: 9px 12px;
  border-bottom: 1px solid var(--th-line);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.th-resp-kicker { font-size: 10.5px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--th-ink-2); }
.th-resp-card__mono { font-family: var(--th-font-mono); font-size: 10.5px; color: var(--th-ink-2); }
.th-resp-card__pill { margin-left: auto; }
.th-resp-facts {
  padding: 10px 12px;
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 8px 12px;
  font-size: 12.5px;
  align-items: center;
}
.th-resp-facts.is-loose { gap: 6px 12px; align-items: start; }
.th-resp-facts__label { color: var(--th-ink-2); }
/* anywhere (not break-word) shrinks min-content, so an unbroken team or person name wraps inside its column. */
.th-resp-facts__value { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; color: var(--th-ink); overflow-wrap: anywhere; }
.th-resp-facts__team { font-weight: 600; }
.th-resp-facts__owner { font-weight: 500; }
.th-resp-facts__quiet { color: var(--th-ink-2); }
.th-resp-facts__mono { font-family: var(--th-font-mono); font-size: 11.5px; color: var(--th-ink-2); overflow-wrap: anywhere; }
.th-resp-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: oklch(50% 0.08 220);
  color: var(--th-paper);
  display: grid;
  place-items: center;
  font-size: 9.5px;
  font-weight: 600;
  flex: none;
}
[data-theme="dark"] .th-resp-avatar { background: oklch(70% 0.08 220); }
.th-resp-gone { padding: 0 12px 10px; font-size: 11.5px; color: var(--th-risk-ink); line-height: 1.5; }
.th-resp-gone__link { white-space: nowrap; color: var(--th-advant); }
.th-resp-gone__link:hover { color: var(--th-advant-deep); }
.th-resp-card__foot {
  padding: 8px 12px 10px;
  border-top: 1px solid var(--th-line-soft);
  font-size: 11.5px;
  color: var(--th-ink-2);
  line-height: 1.5;
}

/* routing attention: status is a word and a dot, never colour alone */
.th-resp-attn { border: 1px solid var(--th-warn); border-radius: var(--th-radius-5); background: var(--th-warn-soft); }
.th-resp-attn:focus { outline: none; }
.th-resp-attn:focus-visible { outline: 2px solid var(--th-advant); outline-offset: 2px; }
.th-resp-attn__head { padding: 9px 12px; display: flex; align-items: center; gap: 8px; }
.th-resp-attn__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--th-warn-ink);
  box-shadow: 0 0 0 2px color-mix(in oklab, var(--th-warn-ink) 18%, transparent);
  flex: none;
}
.th-resp-attn__title { font-weight: 600; font-size: 12.5px; color: var(--th-warn-ink); }
.th-resp-attn__gen { margin-left: auto; font-family: var(--th-font-mono); font-size: 10.5px; color: var(--th-warn-ink); }
.th-resp-attn__line { padding: 0 12px 10px; font-size: 12.5px; color: var(--th-ink-2); line-height: 1.5; overflow-wrap: anywhere; }
.th-resp-attn__actions { padding: 0 12px 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.th-resp-attn__foot {
  padding: 8px 12px 10px;
  border-top: 1px solid color-mix(in oklab, var(--th-warn) 40%, transparent);
  font-size: 11.5px;
  color: var(--th-ink-2);
  line-height: 1.5;
}
.cc-btn.th-resp-btn-sm { font-size: 12px; padding: 4px 10px; }
.th-resp-attn__actions .cc-btn:not(.is-primary) { background: var(--th-paper); }

/* change responsibility */
.th-resp-actions { display: flex; flex-direction: column; gap: 8px; }
.th-resp-actions__row { display: flex; gap: 8px; flex-wrap: wrap; }
.th-resp-actions__row .cc-btn { font-size: 12.5px; white-space: nowrap; }
.th-resp-hint { font-size: 11.5px; color: var(--th-ink-2); line-height: 1.5; display: flex; gap: 6px; }
.th-resp-hint > svg { flex: none; margin-top: 2px; }
.th-resp-hint.is-warn { color: var(--th-warn-ink); }
.th-resp-note {
  font-size: 12px;
  color: var(--th-ink-2);
  line-height: 1.5;
  display: flex;
  gap: 6px;
  border: 1px solid var(--th-line);
  border-radius: var(--th-radius-5);
  padding: 10px 12px;
  background: var(--th-paper);
}
.th-resp-note > svg { flex: none; margin-top: 2px; }

/* separate assignments */
.th-resp-assign { padding: 9px 12px; border-bottom: 1px solid var(--th-line-soft); display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; }
.th-resp-assign__line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.th-resp-assign__title { color: var(--th-ink); font-weight: 500; overflow-wrap: anywhere; }
.th-resp-assign__meta { font-size: 11.5px; color: var(--th-ink-2); }
.th-resp-assign-empty { padding: 10px 12px; font-size: 12px; color: var(--th-ink-2); }
.th-resp-assign-foot { padding: 8px 12px; border-top: 1px solid var(--th-line-soft); font-size: 11px; color: var(--th-ink-2); line-height: 1.5; }

/* responsibility history */
.th-resp-hist {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--th-line-soft);
  font-size: 12px;
  align-items: baseline;
}
.th-resp-hist__when { font-family: var(--th-font-mono); font-size: 11px; color: var(--th-ink-2); white-space: nowrap; }
.th-resp-hist__body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.th-resp-hist__what { color: var(--th-ink); overflow-wrap: anywhere; }
.th-resp-hist__meta { font-size: 11px; color: var(--th-ink-2); overflow-wrap: anywhere; }

/* ---------- action sheets (replace the drawer body) ---------- */
.th-resp-sheet { padding: 14px 18px 18px; display: flex; flex-direction: column; gap: 14px; }
.th-resp-back {
  align-self: flex-start;
  font: inherit;
  font-size: 12px;
  color: var(--th-ink-2);
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.th-resp-back:hover { color: var(--th-ink); }
.th-resp-back:focus-visible { outline: 2px solid var(--th-advant); outline-offset: 2px; }
.th-resp-back[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.th-resp-sheet__title { margin: 0; font: 600 15px var(--th-font-serif); color: var(--th-ink); }
.th-resp-sheet__title:focus { outline: none; }
.th-resp-sheet__desc { margin-top: 3px; font-size: 12.5px; color: var(--th-ink-2); line-height: 1.5; }
.th-resp-pick { border: 1px solid var(--th-line); border-radius: var(--th-radius-5); background: var(--th-paper); overflow: hidden; }
.th-resp-pick .th-radio { padding: 8px 12px; }
.th-resp-pick .th-radio:last-child { border-bottom: 0; }
/* A disposition's note runs to two or three lines: its dot sits beside the label, not mid-row (canon). */
.th-resp-pick .th-radio.th-resp-disposition { align-items: flex-start; }
.th-resp-disposition .th-radio__dot { margin-top: 2px; }
.th-resp-pick__head {
  padding: 8px 12px;
  border-bottom: 1px solid var(--th-line);
  display: flex;
  align-items: center;
  gap: 8px;
}
.th-resp-choice { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.th-resp-choice__name { font-weight: 500; overflow-wrap: anywhere; }
.th-resp-choice__note { font-size: 11px; color: var(--th-ink-2); line-height: 1.45; overflow-wrap: anywhere; }
.th-resp-choice__note.is-risk { color: var(--th-risk-ink); }
.th-resp-choice__side { font-size: 11px; color: var(--th-ink-2); text-align: right; max-width: 120px; line-height: 1.3; }
.th-resp-pick__alert { padding: 14px 12px; font-size: 12.5px; color: var(--th-ink-2); line-height: 1.5; }
.th-resp-pick__alert b { color: var(--th-ink); font-weight: 600; }
.th-resp-pick__foot { padding: 8px 12px; font-size: 11px; color: var(--th-ink-2); line-height: 1.5; }
.th-resp-pick__loading { padding: 10px 12px; font-size: 12px; color: var(--th-ink-2); }
.th-resp-reason { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--th-ink-2); }
.th-resp-reason__required { color: var(--th-risk); }
.th-resp-reason__help { font-size: 11px; color: var(--th-ink-2); }
.th-resp-what__row {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 9px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--th-line-soft);
  font-size: 12.5px;
  align-items: start;
}
.th-resp-what__row:last-child { border-bottom: 0; }
.th-resp-what__icon { display: inline-flex; margin-top: 1px; color: var(--th-ink-2); }
.th-resp-what__icon.is-change { color: var(--th-advant-deep); }
.th-resp-what__icon.is-keep { color: var(--th-ok-ink); }
.th-resp-what__text { color: var(--th-ink-2); line-height: 1.45; }
.th-resp-foot { display: flex; gap: 8px; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.th-resp-foot__expects { font-family: var(--th-font-mono); font-size: 10.5px; color: var(--th-ink-2); margin-right: auto; }

/* ---------- busy ---------- */
.th-resp-busy {
  padding: 40px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--th-ink-2);
  text-align: center;
}
.th-resp-spin {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--th-line-2);
  border-top-color: var(--th-advant);
  animation: th-resp-spin 0.9s linear infinite;
}
@keyframes th-resp-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .th-resp-spin { animation: none; } }

@media (max-width: 952px) {
  .th-resp-drawer { width: 100vw; }
}
