/* Bottom sheet on phone and small tablet; 480 side panel on computer.
   Head and footer are pinned, the body scrolls. */

.scrim {
  position: fixed; inset: 0; z-index: 40; background: var(--scrim); opacity: 0;
  transition: opacity var(--ms-base) var(--ease-out);
}
.scrim.is-open { opacity: 1; }
.sheet {
  position: fixed; z-index: 50; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column;
  max-height: 92dvh; background: var(--surface-sheet); color: var(--text-strong);
  border-radius: var(--radius-24) var(--radius-24) 0 0; box-shadow: var(--shadow-raised);
  transform: translateY(100%); transition: transform var(--ms-slow) var(--ease-out);
}
.sheet.is-open { transform: none; }
.sheet.is-leaving { transform: translateY(100%); transition-duration: var(--ms-base); }
.sheet__head {
  flex: none; display: flex; align-items: flex-start; justify-content: space-between; gap: var(--gap-items);
  padding: var(--space-16) max(var(--space-16), env(safe-area-inset-right, 0px)) var(--space-8) max(var(--space-16), env(safe-area-inset-left, 0px));
}
.sheet__title { flex: 1 1 auto; min-width: 0; font-size: var(--fs-20); font-weight: var(--weight-heavy); line-height: var(--lh-tight); overflow-wrap: anywhere; outline: none; padding-top: var(--space-8); }
.sheet__body {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: var(--gap-sections);
  padding: var(--space-8) max(var(--space-16), env(safe-area-inset-right, 0px)) var(--space-24) max(var(--space-16), env(safe-area-inset-left, 0px));
}
.sheet__foot {
  flex: none; display: flex; flex-direction: column; gap: var(--gap-items);
  padding: var(--space-12) max(var(--space-16), env(safe-area-inset-right, 0px)) calc(var(--space-12) + env(safe-area-inset-bottom, 0px)) max(var(--space-16), env(safe-area-inset-left, 0px));
  box-shadow: 0 calc(var(--hairline) * -1) 0 var(--line);
}
@media (min-width: 1024px) {
  .sheet {
    left: auto; top: 0; width: var(--panel-w); max-height: none;
    border-radius: var(--radius-24) 0 0 var(--radius-24); transform: translateX(100%);
  }
  .sheet.is-leaving { transform: translateX(100%); }
  .sheet__foot { padding-bottom: var(--space-12); }
}
@media (prefers-reduced-motion: reduce) {
  .scrim, .sheet { transition: none; }
}

/* ---- work detail ---- */
.progress { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--gap-group); }
.progress__seg { height: var(--bar-h); border-radius: var(--radius-full); background: var(--surface-sunken); }
.progress__seg.is-on { background: var(--key-ink); }
.progress.is-final .progress__seg.is-on { background: var(--done-fg); }
.head-block { display: flex; flex-direction: column; gap: var(--gap-items); }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap-fields); }
.facts__item { display: flex; flex-direction: column; gap: var(--gap-group); min-width: 0; }
.facts dt { font-size: var(--fs-12); color: var(--text-muted); }
.facts dd { font-size: var(--fs-16); overflow-wrap: anywhere; }
.facts dd.is-name { font-weight: var(--weight-heavy); }
.stuck-note {
  display: flex; flex-direction: column; align-items: flex-start; gap: var(--gap-items);
  padding: var(--space-12) var(--space-16); border-radius: var(--radius-12);
  background: var(--alert-bg); color: var(--alert-fg); box-shadow: inset var(--edge-w) 0 0 var(--alert-fg);
}
.stuck-note__title { font-size: var(--fs-14); font-weight: var(--weight-heavy); }
.stuck-note__text { font-size: var(--fs-16); overflow-wrap: anywhere; white-space: pre-wrap; }
.readonly-note { font-size: var(--fs-14); color: var(--text-muted); }

/* ---- timeline: dated, newest first ---- */
.timeline { display: flex; flex-direction: column; }
.timeline__item { position: relative; display: flex; flex-direction: column; gap: var(--gap-group); padding: 0 0 var(--space-16) var(--space-24); }
.timeline__item::before {
  content: ""; position: absolute; left: 0; top: var(--space-4); width: var(--dot-size); height: var(--dot-size);
  border-radius: var(--radius-full); background: var(--key-ink);
}
.timeline__item:not(:last-child)::after {
  content: ""; position: absolute; left: calc(var(--dot-size) / 2 - var(--hairline)); top: calc(var(--dot-size) + var(--space-8));
  bottom: var(--space-4); width: var(--connector-h); background: var(--line);
}
.timeline__item:last-child { padding-bottom: 0; }
.timeline__when { font-size: var(--fs-12); color: var(--text-muted); }
.timeline__text { font-size: var(--fs-16); overflow-wrap: anywhere; white-space: pre-wrap; }
.timeline__text.is-note { font-weight: var(--weight-regular); }

/* ---- forms ---- */
.form { display: flex; flex-direction: column; gap: var(--gap-fields); }
.form__legend { font-size: var(--fs-12); color: var(--text-muted); }
.field { display: flex; flex-direction: column; gap: var(--gap-group); }
.field__label { font-size: var(--fs-14); font-weight: var(--weight-medium); }
.field__req { margin-inline-start: var(--space-4); }
.field__hint { font-size: var(--fs-14); color: var(--text-muted); overflow-wrap: anywhere; }
.field__error { font-size: var(--fs-14); font-weight: var(--weight-medium); color: var(--alert-fg); overflow-wrap: anywhere; }
.field__two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap-fields); }

/* ---- footer panels (stuck / assign / due / delete) ---- */
.panel { display: flex; flex-direction: column; gap: var(--gap-fields); }
.panel__ask { font-size: var(--fs-16); font-weight: var(--weight-heavy); }

/* ---- picker options and link box ---- */
.options { display: flex; flex-direction: column; gap: var(--gap-items); }
.option {
  display: flex; align-items: center; justify-content: space-between; gap: var(--gap-items);
  min-height: var(--target-min); padding: var(--space-8) var(--space-16); border: 0; border-radius: var(--radius-8);
  background: var(--key-white); box-shadow: inset 0 0 0 var(--hairline) var(--line-strong);
  text-align: left; font-size: var(--fs-16); overflow-wrap: anywhere;
}
.option[aria-pressed="true"] { font-weight: var(--weight-heavy); box-shadow: inset 0 0 0 var(--focus-w) var(--key-ink); }
.linkbox {
  padding: var(--space-12) var(--space-16); border-radius: var(--radius-12); background: var(--surface-sunken);
  font-size: var(--fs-14); overflow-wrap: anywhere; user-select: all; -webkit-user-select: all;
}
.instruction { font-size: var(--fs-16); }
.sheet-content { display: flex; flex-direction: column; gap: var(--gap-sections); }
