/* Mobile-first Action Items workspace. Every dialog owns one foreground scroller. */

#actionItemsPanel.home-operational-card {
  margin-block: 0;
  padding: 18px;
}

#actionItemsPanel .action-items-panel-head {
  margin: 0;
}

#actionItemsPanel.has-overdue {
  border-color: rgba(180, 92, 0, .22);
  background: #fffaf1;
}

#actionItemsPanel .action-items-panel-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

#actionItemsPanel .action-items-manage,
#actionItemsPanel .action-items-add {
  width: auto;
  min-height: 44px;
  border-radius: 999px;
  padding: 9px 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: inherit;
  font-size: .88rem;
  font-weight: 760;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}

#actionItemsPanel .action-items-manage {
  border: 1px solid rgba(0, 0, 0, .08);
  background: #fff;
  color: #3f3f44;
}

#actionItemsPanel .action-items-add {
  border: 1px solid rgba(0, 113, 227, .16);
  background: #eaf4ff;
  color: #1469aa;
}

#actionItemsPanel .action-items-add::before {
  content: "+";
  font-size: 1.15rem;
  font-weight: 500;
  line-height: .8;
}

#actionItemsPanel .action-items-manage:active,
#actionItemsPanel .action-items-add:active {
  transform: scale(.98);
}

.action-items-dialog {
  width: min(720px, calc(100vw - 28px));
  height: min(88vh, 760px);
  max-width: 720px;
  max-height: 88vh;
  margin: auto;
  padding: 0;
  overflow: hidden;
  overscroll-behavior: contain;
  border: 0;
  border-radius: 24px;
  background: #fff;
  color: #1d1d1f;
  box-shadow: 0 26px 72px rgba(0, 0, 0, .28);
}

@supports (height: 1dvh) {
  .action-items-dialog {
    height: min(88dvh, 760px);
    max-height: 88dvh;
  }
}

.action-items-dialog[open] {
  display: flex;
  flex-direction: column;
}

.action-items-dialog::backdrop {
  background: rgba(19, 19, 22, .66);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.action-items-dialog-shell {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  overflow: hidden;
  overscroll-behavior: contain;
  padding: 0;
  gap: 0;
  background: #fff;
}

.action-items-dialog .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.action-items-dialog-head {
  flex: 0 0 auto;
  margin: 0;
  padding: 22px 22px 16px;
  border-bottom: 1px solid #e8e8ec;
  background: #fff;
}

.action-items-dialog-head > div {
  min-width: 0;
}

.action-items-dialog-head h3 {
  margin: 2px 0 0;
  font-size: 1.55rem;
  line-height: 1.08;
}

.action-items-dialog-head .section-note {
  margin-top: 5px;
  line-height: 1.35;
}

.action-items-dialog-head .close {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f1f2f4;
  color: #62676d;
  font: inherit;
  font-size: 1.55rem;
  line-height: 1;
  cursor: pointer;
}

.action-items-scroll {
  min-height: 0;
  flex: 1 1 auto;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
}

.action-items-manager-toolbar {
  min-height: 58px;
  flex: 0 0 auto;
  padding: 9px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #ededf0;
  background: #fafafd;
  color: #6e6e73;
  font-size: .82rem;
  font-weight: 720;
}

.action-items-manager-toolbar button,
.action-items-empty button {
  min-height: 44px;
  border: 1px solid rgba(0, 113, 227, .18);
  border-radius: 999px;
  padding: 9px 14px;
  background: #eaf4ff;
  color: #1469aa;
  font: inherit;
  font-weight: 760;
  cursor: pointer;
}

.action-items-message {
  min-height: 0;
  margin: 0;
  color: #3d6f4d;
  font-size: .82rem;
  line-height: 1.35;
}

.action-items-message:empty {
  display: none;
}

#actionItemsManagerStatus:not(:empty) {
  flex: 0 0 auto;
  padding: 10px 22px;
  border-bottom: 1px solid #e5efe8;
  background: #f2faf4;
}

.action-items-message.is-error,
.action-items-empty.is-error {
  color: #a8322d;
}

#actionItemsManagerStatus.is-error:not(:empty) {
  border-color: #f3d7d5;
  background: #fff4f3;
}

.action-items-manager-scroll {
  padding: 6px 22px calc(24px + env(safe-area-inset-bottom));
}

.action-items-group {
  padding-top: 16px;
}

.action-items-group + .action-items-group {
  margin-top: 6px;
  border-top: 1px solid #ececef;
}

.action-items-group-head {
  min-height: 30px;
  padding: 0 3px 7px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.action-items-group-head h4 {
  margin: 0;
  color: #65656c;
  font-size: .74rem;
  font-weight: 820;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.action-items-group-head span {
  min-width: 26px;
  border-radius: 999px;
  padding: 3px 8px;
  background: #f0f1f3;
  color: #68686e;
  font-size: .72rem;
  font-weight: 780;
  text-align: center;
}

.action-items-group-list {
  display: grid;
  gap: 8px;
}

.action-items-history {
  margin-top: 22px;
  border-top: 1px solid #ececef;
  padding-top: 12px;
}

.action-items-history > summary {
  min-height: 44px;
  border-radius: 13px;
  padding: 9px 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #f7f7f9;
  color: #626268;
  font-size: .82rem;
  font-weight: 760;
  cursor: pointer;
  list-style: none;
}

.action-items-history > summary::-webkit-details-marker {
  display: none;
}

.action-items-history > summary::before {
  content: "›";
  color: #85858b;
  font-size: 1rem;
}

.action-items-history[open] > summary::before {
  transform: rotate(90deg);
}

.action-items-history > summary > span {
  flex: 1;
}

.action-items-history > summary > strong {
  min-width: 26px;
  border-radius: 999px;
  padding: 3px 8px;
  background: #ececef;
  color: #68686e;
  font-size: .72rem;
  text-align: center;
}

.action-items-history-list {
  padding-top: 2px;
}

.action-item-row {
  min-width: 0;
  min-height: 68px;
  border: 1px solid #e4e5e8;
  border-radius: 17px;
  padding: 9px 10px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  background: #fff;
}

.action-item-row.status-completed {
  border-color: #d5eadc;
  background: #f5fbf7;
}

.action-item-row.status-cancelled {
  border-style: dashed;
  background: #f7f7f8;
  color: #6e6e73;
}

.action-item-complete,
.action-item-state-mark {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  font-size: 1rem;
  font-weight: 900;
}

.action-item-complete {
  border: 2px solid #b8bbc1;
  background: #fff;
  color: transparent;
  cursor: pointer;
}

.action-item-complete:hover,
.action-item-complete:focus-visible {
  border-color: #238442;
  color: #238442;
}

.action-item-state-mark {
  border: 0;
  background: #dff3e5;
  color: #238442;
}

.status-cancelled .action-item-state-mark {
  background: #ececee;
  color: #929297;
}

.action-item-body {
  min-width: 0;
  min-height: 48px;
  border: 0;
  padding: 3px 1px;
  display: grid;
  align-content: center;
  gap: 4px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.action-item-title {
  overflow: hidden;
  color: #202024;
  font-size: .96rem;
  font-weight: 780;
  line-height: 1.2;
  text-overflow: ellipsis;
}

.status-cancelled .action-item-title {
  color: #6e6e73;
}

.action-item-meta,
.action-item-context {
  color: #6e6e73;
  font-size: .76rem;
  line-height: 1.25;
}

.action-item-context {
  width: max-content;
  max-width: 100%;
  border-radius: 999px;
  padding: 3px 7px;
  overflow: hidden;
  background: #edf4fb;
  color: #366a96;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.action-item-reopen {
  min-width: 58px;
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  padding: 8px 10px;
  background: #edf3f8;
  color: #286aa6;
  font: inherit;
  font-size: .78rem;
  font-weight: 780;
  cursor: pointer;
}

.action-items-empty {
  margin: 18px 0;
  border: 1px dashed #d7d8dc;
  border-radius: 18px;
  padding: 24px 18px;
  display: grid;
  justify-items: center;
  gap: 8px;
  color: #6e6e73;
  text-align: center;
}

.action-items-empty strong {
  color: #2c2c30;
}

.action-items-empty p {
  margin: 0;
  line-height: 1.4;
}

.action-item-editor-scroll {
  padding: 18px 22px 24px;
  display: grid;
  align-content: start;
  gap: 16px;
}

.action-item-field {
  min-width: 0;
  display: grid;
  gap: 7px;
  color: #343438;
  font-size: .84rem;
  font-weight: 760;
}

.action-item-field > span small {
  color: #8a8a91;
  font-size: .75rem;
  font-weight: 600;
}

.action-item-field input,
.action-item-field textarea,
.action-item-field select,
.action-assignee-search input {
  width: 100%;
  min-height: 48px;
  box-sizing: border-box;
  border: 1px solid #d7d8dd;
  border-radius: 14px;
  padding: 11px 13px;
  background: #fff;
  color: #1d1d1f;
  font: inherit;
  font-size: 16px;
  font-weight: 500;
  outline: none;
}

.action-item-field textarea {
  min-height: 92px;
  resize: vertical;
}

.action-item-field input:focus,
.action-item-field textarea:focus,
.action-item-field select:focus,
.action-assignee-search input:focus {
  border-color: #2283c6;
  box-shadow: 0 0 0 3px rgba(34, 131, 198, .15);
}

.action-item-assignee-trigger {
  width: 100%;
  min-height: 58px;
  border: 1px solid #d7d8dd;
  border-radius: 15px;
  padding: 10px 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #fff;
  color: #1769aa;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.action-item-assignee-trigger > span:first-child {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.action-item-assignee-trigger strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.action-item-assignee-trigger small {
  color: #77777d;
  font-size: .74rem;
}

.action-item-due-presets {
  margin-top: -8px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.action-item-due-presets button {
  min-height: 44px;
  border: 1px solid #d9dadd;
  border-radius: 999px;
  padding: 8px 9px;
  background: #f7f7f9;
  color: #4e4e54;
  font: inherit;
  font-size: .76rem;
  font-weight: 750;
  cursor: pointer;
}

.action-item-due-presets button.selected {
  border-color: #a9d1ee;
  background: #eaf4ff;
  color: #1469aa;
}

.action-item-editor-actions {
  position: sticky;
  z-index: 2;
  bottom: 0;
  flex: 0 0 auto;
  margin: 0;
  padding: 12px 22px calc(12px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 9px;
  border-top: 1px solid #e7e7eb;
  background: rgba(255, 255, 255, .98);
}

.action-item-editor-actions button {
  min-height: 46px;
  border-radius: 13px;
  padding: 10px 15px;
  font: inherit;
  font-weight: 760;
  cursor: pointer;
}

.action-item-editor-actions .action-item-actions-spacer {
  flex: 1 1 auto;
}

.action-item-cancel-work {
  border: 1px solid rgba(174, 49, 42, .18);
  background: #fff7f6;
  color: #a8322d;
}

.action-item-editor-actions button:disabled,
.action-item-complete:disabled,
.action-item-reopen:disabled {
  cursor: wait;
  opacity: .58;
}

.action-assignee-scroll {
  padding: 14px 22px calc(24px + env(safe-area-inset-bottom));
}

.action-assignee-search {
  position: sticky;
  z-index: 2;
  top: -14px;
  display: block;
  padding: 14px 0 10px;
  background: rgba(255, 255, 255, .97);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.action-assignee-list {
  display: grid;
}

.action-assignee-choice {
  width: 100%;
  min-height: 62px;
  border: 0;
  border-bottom: 1px solid #e8e8ec;
  padding: 9px 4px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 11px;
  background: #fff;
  color: #1d1d1f;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.action-assignee-choice.selected {
  background: #f2f8fd;
}

.action-assignee-group {
  margin-bottom: 10px;
  border-bottom: 1px solid rgba(0, 0, 0, .08);
  background: #f4f8fc;
}

.action-assignee-group small {
  white-space: normal;
  line-height: 1.3;
}

#actionItemEditorDialog[aria-busy="true"] #saveActionItem {
  cursor: wait;
  opacity: .72;
}

.action-assignee-choice > span:nth-child(2) {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.action-assignee-choice strong {
  overflow: hidden;
  color: #0878d1;
  font-size: .98rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.action-assignee-choice small {
  color: #3d7b51;
  font-size: .72rem;
  font-weight: 740;
}

.action-assignee-initials {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #edf2f8;
  color: #2d4053;
  font-size: .88rem;
  font-weight: 800;
}

@media (max-width: 700px) {
  #actionItemsPanel.home-operational-card {
    padding: 16px;
  }

  .action-items-dialog {
    width: calc(100vw - 24px);
    border-radius: 22px;
  }

  .action-items-dialog-head {
    padding: 18px 18px 14px;
  }

  .action-items-dialog-head h3 {
    font-size: 1.42rem;
  }

  .action-items-manager-toolbar {
    padding-inline: 18px;
  }

  #actionItemsManagerStatus:not(:empty) {
    padding-inline: 18px;
  }

  .action-items-manager-scroll,
  .action-assignee-scroll {
    padding-inline: 18px;
  }

  .action-item-editor-scroll {
    padding: 16px 18px 22px;
  }

  .action-item-editor-actions {
    padding: 11px 18px calc(11px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 390px) {
  #actionItemsPanel .action-items-panel-actions {
    gap: 6px;
  }

  #actionItemsPanel .action-items-manage,
  #actionItemsPanel .action-items-add {
    padding-inline: 10px;
    font-size: .84rem;
  }

  .action-item-row {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .action-item-reopen {
    grid-column: 2;
    justify-self: start;
    min-width: 76px;
  }

  .action-item-due-presets {
    gap: 5px;
  }

  .action-item-due-presets button {
    padding-inline: 6px;
    font-size: .72rem;
  }

  .action-item-editor-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .action-item-editor-actions .action-item-actions-spacer {
    display: none;
  }

  .action-item-cancel-work:not([hidden]) {
    grid-column: 1 / -1;
  }
}

@media (max-height: 700px) {
  .action-items-dialog {
    height: 88vh;
    max-height: 88vh;
  }

  @supports (height: 1dvh) {
    .action-items-dialog {
      height: 88dvh;
      max-height: 88dvh;
    }
  }

  .action-items-dialog-head {
    padding-block: 14px 11px;
  }

  .action-items-dialog-head .section-note {
    display: none;
  }

  .action-items-manager-toolbar {
    min-height: 52px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #actionItemsPanel .action-items-manage,
  #actionItemsPanel .action-items-add,
  .action-item-complete,
  .action-item-reopen,
  .action-assignee-choice {
    transition: none;
  }
}
