#dlg:has(.work-create) {
  width: min(750px, calc(100% - 24px));
  max-width: none;
  max-height: min(880px, calc(100dvh - 24px));
  padding: 0;
  overflow: hidden;
  border-radius: 16px;
}
#frm:has(.work-create) { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; max-height: min(880px, calc(100dvh - 26px)); }
#frm:has(.work-create) > h3 {
  margin: 0;
  padding: 17px 22px;
  background: var(--brand-heading);
  color: var(--brand-white);
  font-size: clamp(21px, 4vw, 26px);
  line-height: 1.2;
}
.work-create { display: grid; align-content: start; gap: 12px; overflow-y: auto; padding: 14px 20px; background: var(--bg); overscroll-behavior: contain; }
.wc-section { min-width: 0; display: grid; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 11px; padding: 12px; }
.wc-section h4 { margin: 0; font-size: 15px; }
.wc-section h4 small { margin-left: 4px; font-size: 11px; color: var(--mut); }
.wc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; }
.work-create label { margin: 0; min-width: 0; color: var(--ink); font-weight: 600; }
.work-create :is(input:not([type="checkbox"]), select, textarea) {
  display: block; width: 100%; min-width: 0; max-width: 100%; min-height: 44px;
  margin-top: 4px; padding: 8px; background: var(--card); color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: 16px; font-weight: 400;
}
.work-create summary { cursor: pointer; font-size: 14px; font-weight: 650; }
.wc-members { max-height: 150px; overflow-y: auto; margin-top: 6px; }
.wc-members label { display: flex; align-items: center; gap: 8px; min-height: 44px; border-bottom: 1px solid var(--line); }
.wc-members input { width: auto; }
.wc-members small { color: var(--mut); font-weight: 400; }
.wc-extra[open] > label { margin-block: 8px; }
.work-create .wc-color input { width: 70px; }
.work-create textarea { resize: vertical; }
#frm:has(.work-create) > .row:last-child {
  margin: 0 !important;
  padding: 10px 20px;
  border-top: 1px solid var(--line);
  background: var(--card);
}
#frm:has(.work-create) > .row:last-child button { min-height: 44px; }
#frm:has(.work-create) :focus-visible { outline: 2px solid var(--pri); outline-offset: 2px; }
@media (max-width: 420px) {
  .work-create { padding-inline: 10px; }
  .wc-grid { grid-template-columns: minmax(0, 1fr); }
  #frm:has(.work-create) > .row:last-child { padding-inline: 10px; }
}

#dlg:has(.task-create) {
  width: min(540px, calc(100% - 24px));
  max-width: none;
  max-height: calc(100dvh - 24px);
  padding: 0;
  overflow: auto;
}

#frm:has(.task-create) > h3 {
  margin: 0;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  font-size: 19px;
}

.task-create {
  display: grid;
  gap: 12px;
  padding: 16px 20px;
}

.task-create-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.task-create label {
  display: grid;
  min-width: 0;
  gap: 5px;
  margin: 0;
  font-weight: 600;
}

#dlg .task-create :is(input:not([type="checkbox"]), select, textarea) {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--ink);
  font: inherit;
  font-weight: 400;
}

.task-create textarea { resize: vertical; }

.task-create-flags { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.task-create-flags label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  color: var(--ink);
}
#dlg .task-create-flags input { width: 16px; height: 16px; margin: 0; }

#frm:has(.task-create) > .row:last-child {
  position: sticky;
  bottom: 0;
  margin: 0 !important;
  padding: 10px 20px;
  border-top: 1px solid var(--line);
  background: var(--card);
}
#frm:has(.task-create) > .row:last-child button { min-height: 44px; }

@media (max-width: 380px) {
  .task-create-grid { grid-template-columns: minmax(0, 1fr); }
}

#big:has(.task-detail) {
  padding: 0;
  max-height: calc(100dvh - 24px) !important;
}

.task-detail-header {
  position: sticky;
  top: 0;
  display: flex;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 12px;
  padding: 8px clamp(12px, 3vw, 24px);
  z-index: 2;
}
.task-detail-header .hint { overflow-wrap: anywhere; }
.task-detail-header button { flex: none; min-height: 44px; }

.tk {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(215px, 27%);
  align-items: start;
  gap: clamp(12px, 2vw, 24px);
  padding: clamp(12px, 3vw, 24px);
}
.task-detail-main, .task-detail-meta { min-width: 0; overflow-wrap: anywhere; }
.task-detail-meta {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}
.task-detail-meta h3 { margin: 0; font-size: 16px; }
.tk h4, .task-field-label {
  display: block;
  margin: 18px 0 6px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 650;
}
.tk :is(input:not([type="checkbox"]), select, textarea) {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  font: inherit;
}
.tk textarea {
  min-height: 92px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
  resize: vertical;
}
.tk .ttl { font-size: clamp(20px, 3vw, 26px); font-weight: 750; }
.tk button { min-height: 40px; }
.tk .ci { display: flex; align-items: center; gap: 8px; padding: 5px 0; }
.tk .ci.dn .task-check-title span { text-decoration: line-through; color: var(--mut); }
.tk .task-check-title { display: flex; align-items: center; gap: 8px; margin: 0; min-width: 0; min-height: 42px; color: var(--ink); }
.tk input[type="checkbox"] { width: 16px; height: 16px; flex: none; }
.tk .task-check-item, .tk .task-check-add {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
  gap: 8px;
  padding: 10px;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.tk .task-check-item { background: var(--surface-soft); }
.task-check-title, #ciNew { grid-column: 1 / -1; }
.tk .task-date-overdue { border-color: var(--bad); }

@media (max-width: 760px) {
  .tk { grid-template-columns: minmax(0, 1fr); }
}

.task-detail-main { container-type: inline-size; }
.tk .task-check-date, .tk .task-check-time {
  display: grid;
  gap: 4px;
  min-width: 0;
  margin: 0;
}
.tk .task-check-date input, .tk .task-check-time input {
  padding-inline: 7px;
  font-size: 14px;
}
.tk .task-check-item { position: relative; }
.tk .task-check-item:has([data-cd]) .task-check-title { padding-inline-end: 44px; }
.tk .task-check-item [data-cd] { position: absolute; inset: 8px 8px auto auto; min-width: 40px; }
.tk #ciAdd { grid-column: 1 / -1; justify-self: end; min-width: 60px; }

@container (min-width: 570px) {
  .tk .task-check-item, .tk .task-check-add {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(142px, .9fr) minmax(110px, .7fr);
  }
}
@container (max-width: 310px) {
  .tk .task-check-date { grid-column: 1 / -1; }
  .tk .task-check-time { grid-column: 1 / -1; }
}

#dlg:has(.stf-create) { width: min(660px, calc(100% - 24px)); }
.stf-create { gap: 6px; }
.stf-core { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 12px; }
.stf-password { display: grid; gap: 6px; }
.stf-password #pwGen { min-height: 44px; }
@media (max-width: 500px) {
  .stf-core { grid-template-columns: minmax(0, 1fr); }
}
.stf-create details.wc-section { padding-block: 0; }
.stf-create details.wc-section[open] { padding-bottom: 12px; }
.stf-create details.wc-section > summary { min-height: 44px; align-content: center; }
.stf-create #stfDrop { width: 92px; height: 92px; }
.stf-create .stf-avbar { justify-content: start; }
.stf-create .stf-avbar button { min-height: 44px; }

.stf-avatar-hint { margin: 4px 0 0; }
.stf-create .stf-avatar-box { max-width: 124px; }
@media (max-width: 500px) {
  .stf-create .stf-avatar-box {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    max-width: none;
    gap: 4px 10px;
  }
  .stf-create #stfDrop { grid-row: span 2; }
  .stf-create .stf-avatar-hint { align-self: start; }
  .stf-create .stf-avbar { align-self: end; }
}
