/* Shared shift sheets. Desktop actions sit next to the calendar in a side panel. */
#dialog {
  --field-height: 52px;
  --group-radius: 20px;
  --group-edge: #4c365112;
  --group-shadow: inset 0 0 0 1px var(--group-edge), 0 1px 3px #33223b06;
  inset: 0 0 0 auto;
  margin: 0;
  width: min(464px, 100vw);
  max-width: 100%;
  height: 100%;
  height: 100dvh;
  max-height: none;
  border-radius: 28px 0 0 28px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #f7f5fa;
  color: var(--ink);
  box-shadow: inset 1px 1px 0 #ffffffb8, -14px 0 54px #27153324;
}
#dialog[open] {
  animation: panel-arrive 250ms cubic-bezier(.19,1,.22,1);
}
#dialog[open]::backdrop {
  background: rgb(42 32 55 / 13%);
  animation: veil-arrive 160ms ease-out;
}
/* Blur the page itself so WebKit also softens content through a top-layer dialog.
   The header stays unfiltered to preserve positioning of the fixed mobile tab bar. */
body:has(#dialog[open]) .workspace,
body:has(#dialog[open]) .top-inner > * {
  filter: blur(5px);
}
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  #dialog {
    background: rgb(250 248 255 / 67%);
    -webkit-backdrop-filter: blur(19px) saturate(145%);
    backdrop-filter: blur(19px) saturate(145%);
  }
}
@keyframes panel-arrive { from { transform: translateX(100%); } }
@keyframes sheet-arrive { from { transform: translateY(100%); } }
@keyframes veil-arrive { from { opacity: 0; } }
.sheet-grip { display: none; }
#dialog .dialog-inner {
  padding: max(28px, env(safe-area-inset-top)) max(28px, env(safe-area-inset-right)) 32px max(28px, env(safe-area-inset-left));
}
#dialog .dialog-head {
  align-items: center;
  margin-bottom: 20px;
}
#dialog .dialog-head h2 {
  margin: 0;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -.039em;
}
#dialog-title:focus { outline: none; }
#dialog .dialog-head .iconbtn {
  width: 44px;
  height: 44px;
  color: var(--quiet);
  border: 0;
  border-radius: 50%;
  flex: none;
  background: #fff;
  box-shadow: var(--group-shadow);
}
#dialog .dialog-head .iconbtn:hover { background: #eae5ee; }
.sheet-subtitle { margin-bottom: 6px; font-size: 14px; color: var(--quiet); }
#dialog .fields { gap: 16px; }
.sheet-date {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 9px;
  padding: 0;
  color: var(--accent-dark);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: #8056b55c;
  text-underline-offset: 4px;
}
.sheet-date:hover { text-decoration-color: currentColor; }
.sheet-date .icon { width: 18px; height: 18px; }
.sheet-subtitle .sheet-date { margin-top: -9px; margin-bottom: -3px; }
.move-date-field input { height: var(--field-height); }
#dialog .visually-hidden, .kind-choice input {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.shift-kinds {
  --thumb-radius: 14px;
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  min-width: 0;
  margin: 0;
  height: var(--field-height);
  padding: 2px;
  gap: 4px;
  border: 0;
  border-radius: calc(var(--thumb-radius) + 2px);
  background: #eae5ef;
  box-shadow: inset 0 1px 3px #3720420d;
}
.kind-choice { position: relative; cursor: pointer; }
.kind-face {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  height: 100%;
  min-height: 0;
  padding: 0 5px;
  border: 1px solid transparent;
  border-radius: var(--thumb-radius);
  color: var(--quiet);
}
.kind-face .icon { width: 21px; height: 21px; }
.kind-face strong, .kind-face small { display: block; }
.kind-face strong { font-size: 16px; font-weight: 650; line-height: 1.15; }
.kind-face small { margin-top: 2px; color: var(--quiet); font-size: 12px; font-variant-numeric: tabular-nums; }
.kind-choice input[value="day"]:checked + .kind-face .icon { color: #946007; }
.kind-choice input:checked + .kind-face {
  background: var(--paper);
  border-color: #d9c4ed;
  color: var(--accent-dark);
  box-shadow: 0 1px 3px #301b4512;
}
/* The selected surface travels behind the native radio labels. The focus ring stays on the label. */
@supports selector(:has(*)) {
  .shift-kinds::before {
    content: "";
    position: absolute;
    inset-block: 2px;
    inset-inline-start: 2px;
    width: calc((100% - 8px) / 2);
    border-radius: var(--thumb-fallback-radius, var(--thumb-radius));
    background: var(--paper);
    box-shadow: 0 2px 5px #33194c23, inset 0 1px 0 #fff;
    transition: transform 240ms cubic-bezier(.22,1,.36,1);
    pointer-events: none;
  }
  .shift-kinds:has(input[value="night"]:checked)::before {
    transform: translateX(calc(100% + 4px));
  }
  .kind-choice input:checked + .kind-face {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
  }
}
.kind-choice input:focus-visible + .kind-face {
  outline: 3px solid #a370dd;
  outline-offset: 1px;
}
.kind-choice input:disabled + .kind-face { opacity: .54; cursor: default; }
.station-choice { position: relative; }
.station-choice .icon {
  position: absolute;
  top: 50%;
  left: 13px;
  z-index: 1;
  color: var(--quiet);
  transform: translateY(-50%);
  pointer-events: none;
}
.station-choice .icon:last-child {
  left: auto;
  right: 13px;
  width: 16px;
  height: 16px;
}
.station-choice .icon:first-child {
  left: 12px;
  width: 34px;
  height: 34px;
  padding: 8px;
  color: var(--accent-dark);
  border-radius: 12px;
  background: var(--tint);
}
.station-choice select {
  -webkit-appearance: none;
  appearance: none;
  height: var(--field-height);
  padding: 8px 38px 8px 57px;
}
.participant-field { display: grid; gap: 8px; min-width: 0; }
.assignment-fields, #dialog .fact-list, .outcome-group, #volunteer-form .person-trigger {
  border-radius: var(--group-radius);
  background: var(--paper);
  box-shadow: var(--group-shadow);
}
.assignment-fields .station-choice::after {
  position: absolute;
  content: "";
  right: 14px;
  bottom: 0;
  left: 57px;
  height: 1px;
  background: var(--group-edge);
  pointer-events: none;
}
.assignment-fields .station-choice select, .assignment-fields .person-trigger {
  border: 0;
  background: transparent;
  box-shadow: none;
}
.assignment-fields .station-choice select { border-radius: var(--group-radius) var(--group-radius) 0 0; }
.assignment-fields .person-trigger { border-radius: 0 0 var(--group-radius) var(--group-radius); }
.assignment-fields select:focus-visible, .assignment-fields .person-trigger:focus-visible { outline-offset: -3px; }
.assignment-fields .person-trigger[aria-expanded="true"] { background: #7c28e309; }
.person-choice { position: relative; min-width: 0; }
.person-trigger, .person-options li {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 7px 12px;
  text-align: left;
}
.person-trigger {
  height: var(--field-height);
  border: 1px solid var(--field-edge);
  border-radius: var(--control-radius);
  background: var(--paper);
  font-size: 16px;
  font-weight: 600;
}
.person-trigger[aria-expanded="true"] { border-color: #9662c2; }
.person-trigger > .icon, .person-options .icon { margin-left: auto; color: var(--accent-dark); width: 16px; height: 16px; }
.person-trigger > .icon { color: var(--quiet); }
.person-trigger .avatar, .person-options .avatar { width: 34px; height: 34px; }
.person-options {
  position: absolute;
  z-index: 3;
  inset-inline: 0;
  top: calc(100% + 6px);
  background: var(--paper);
  box-shadow: 0 2px 6px #27153312, 0 12px 32px #27153329;
  list-style: none;
  max-height: min(240px, 35dvh);
  margin: 0;
  padding: 5px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid #e5dfeb;
  border-radius: var(--group-radius);
}
.person-options[data-side="above"] { top: auto; bottom: calc(100% + 6px); }
.shift-feedback {
  display: grid;
  font-size: 14px;
  min-block-size: 2lh;
}
/* Both variants size the same row, including when an occupied slot has a longer message. */
.shift-feedback > * { grid-area: 1 / 1; align-self: center; }
.shift-feedback > [aria-hidden="true"] { visibility: hidden; }
.shift-feedback > .error { margin: 0; }
.person-options li {
  min-height: 46px;
  padding: 6px 8px;
  cursor: pointer;
  border-radius: 13px;
}
.person-options li:hover, .person-options li[data-active="true"] { background: var(--soft); }
.person-options li[aria-selected="true"] { background: var(--tint); color: var(--accent-dark); font-weight: 600; }
.shift-feedback .checkline { padding-inline: 4px; }
#dialog .form-actions, .sheet-actions {
  display: grid;
  grid-template-columns: minmax(0,1fr);
  gap: 4px;
  margin-top: 22px;
}
#shift-form .form-actions { margin-top: 8px; }
#dialog .btn { min-height: 44px; white-space: normal; }
#dialog .btn.primary, #dialog .btn.solid-danger { min-height: var(--field-height); font-size: 16px; }
#dialog .sheet-actions .text-danger {
  justify-self: center;
  color: var(--error);
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  font-weight: 500;
}
.sheet-actions .text-danger:hover { text-decoration: underline; text-underline-offset: 3px; }
#dialog .solid-danger {
  color: white;
  background: var(--error);
  border-color: transparent;
  box-shadow: inset 0 1px 0 #ffffff24, 0 2px 5px #69233418;
}
#dialog .solid-danger:hover { background: #86243a; }
#dialog .person-banner {
  width: 100%;
  min-height: 82px;
  padding: 14px 16px;
  gap: 14px;
  background: #f2ecf8;
  box-shadow: inset 0 0 0 1px #71499915, inset 0 1px 0 #fff;
  border-radius: var(--group-radius);
  text-align: left;
}
#dialog .person-banner.editable:hover { background: #eee5f9; }
#dialog .person-banner > .avatar { box-shadow: 0 0 0 2px white; }
.person-description { min-width: 0; }
.person-description small { display: block; margin-bottom: 3px; color: var(--quiet); font-size: 13px; }
.person-description strong { display: block; font-size: 19px; letter-spacing: -.014em; line-height: 1.15; }
.person-banner > .icon {
  margin-left: auto;
  width: 32px;
  height: 32px;
  padding: 8px;
  border-radius: 50%;
  color: var(--accent-dark);
  background: var(--paper);
}
#dialog .fact-list { margin: 14px 0; padding-inline: 16px; }
#dialog .fact-list div {
  align-items: center;
  min-height: 44px;
  padding: 11px 0;
  border-color: var(--group-edge);
}
#dialog .fact-list div:first-child { border-top: 0; }
#dialog .fact-list dt { font-size: 14px; }
#dialog .fact-list dd { font-size: 15px; }
#dialog [data-action="download"] {
  min-height: 46px;
  color: var(--accent-dark);
  background: var(--paper);
  border-color: transparent;
  box-shadow: var(--group-shadow);
}
.auto-result, .end-date { display: block; margin-top: 3px; font-size: 12px; color: var(--quiet); font-weight: 400; }
.outcome-person { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 17px; }
.outcome-group { padding: 16px; }
.outcome-description { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--group-edge); line-height: 1.5; }
.outcome-description p + p { margin-top: 8px; }
#volunteer-form .rule-note { font-size: 15px; }
#volunteer-form .person-trigger { border: 0; }
@media (max-width: 760px) {
  #dialog {
    inset: auto 0 0;
    width: 100%;
    max-width: none;
    height: auto;
    max-height: calc(100% - env(safe-area-inset-top) - 8px);
    max-height: calc(100dvh - env(safe-area-inset-top) - 8px);
    border-radius: 30px 30px 0 0;
    box-shadow: inset 0 1px 0 #ffffffdb, 0 -10px 38px #27153321;
  }
  #dialog[open] { animation-name: sheet-arrive; }
  .sheet-grip {
    display: grid;
    place-items: center;
    height: 23px;
    touch-action: none;
  }
  .sheet-grip::before {
    content: "";
    width: 36px;
    height: 4px;
    border-radius: 4px;
    background: #d4cdd9;
  }
  #dialog .dialog-inner {
    padding: 0 max(19px, env(safe-area-inset-right)) calc(16px + env(safe-area-inset-bottom)) max(19px, env(safe-area-inset-left));
  }
  #dialog .dialog-head { margin-bottom: 16px; }
  #dialog .dialog-head h2 { font-size: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  #dialog[open], #dialog[open]::backdrop { animation: none; }
  .shift-kinds::before { transition: none; }
}
@supports (corner-shape: squircle) {
  .assignment-fields, #dialog .fact-list, .outcome-group, .station-choice .icon:first-child {
    corner-shape: squircle;
  }
  #dialog { --group-radius: 26px; }
  .shift-kinds { --thumb-radius: 20px; }
  @media (max-width: 760px) {
    #dialog { border-top-left-radius: 42px; border-top-right-radius: 42px; }
  }
}
@supports not (corner-shape: squircle) {
  @supports (-webkit-mask-box-image: linear-gradient(white, white)) or (mask-border-source: linear-gradient(white, white)) {
    .shift-kinds { background: transparent; }
    .shift-kinds::after {
      content: "";
      position: absolute;
      inset: 0;
      z-index: -1;
      background: #eae5ef;
      -webkit-mask-box-image: var(--smooth-corners) 30 fill / calc(var(--thumb-radius) + 2px) / 0 stretch;
      mask-border: var(--smooth-corners) 30 fill / calc(var(--thumb-radius) + 2px) / 0 stretch;
      pointer-events: none;
    }
  }
}
@media (prefers-reduced-transparency: reduce), (prefers-contrast: more), (forced-colors: active) {
  body:has(#dialog[open]) .workspace, body:has(#dialog[open]) .top-inner > * { filter: none; }
  #dialog {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: var(--paper);
  }
  #dialog[open]::backdrop {
    background: #24182f66;
  }
}
@media (forced-colors: active) {
  .kind-choice input:checked + .kind-face { outline: 2px solid Highlight; outline-offset: -2px; }
}
