/* v2.0 Mobile Dialog & Detail Card System (药房工作台高级二级页面风格) */
#modal.task-detail-dialog {
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 24px 24px 0 0;
  background: #f4f6f4;
  box-shadow: 0 -10px 40px rgba(23, 56, 46, 0.14);
}
.task-detail-dialog #modal-content {
  display: flex;
  flex-direction: column;
  max-height: calc(88dvh - 2px);
}
.task-detail-dialog .dialog-head {
  position: static;
  padding: 8px 18px 14px;
  margin: 0;
  flex-shrink: 0;
  background: #fff;
  border-bottom: 1px solid #edf2ee;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.task-sheet-pill {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: #d8e0da;
  margin: 0 auto 2px;
}
.task-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}
.task-heading {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.task-heading h2 {
  font-size: 18px;
  font-weight: 700;
  color: #17382e;
  margin: 0;
  line-height: 1.35;
  letter-spacing: -0.2px;
}
.task-status {
  border-radius: 999px;
  padding: 3px 10px;
  color: #285d45;
  background: #e8f2ec;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.task-status.forced_ended { background: #f9ebe8; color: #a4423d; }
.task-status.done { background: #e6f4ec; color: #285d45; }
.task-status.pending { background: #edf3ef; color: #53755e; }

.task-head-actions {
  display: flex;
  flex-shrink: 0;
  gap: 6px;
}
.task-head-actions button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  background: #f1f5f2;
  border: 0;
  border-radius: 50%;
  color: #2b4237;
  cursor: pointer;
}
.task-head-actions button .ui-icon {
  width: 18px;
  height: 18px;
}

.task-detail-dialog .task-detail {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: #f4f6f4;
  position: relative;
}
.task-detail-body {
  padding: 14px 16px 20px;
  overflow-y: auto;
  min-height: 0;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* 时间与人员聚焦卡片 */
.task-time-focus {
  padding: 16px 18px;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 1px 4px rgba(15, 56, 46, 0.04);
  display: flex;
  flex-direction: column;
  gap: 10px;
  border: 1px solid #edf2ee;
}
.task-time-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.task-time-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #5c6f65;
  font-size: 13px;
  font-weight: 500;
}
.task-time-icon {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  color: #285d45;
}
.task-time-icon .ui-icon {
  width: 16px;
  height: 16px;
}
.task-time-date {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.task-recur-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  background: #f0f4f1;
  color: #3f6050;
  font-size: 11px;
  font-weight: 500;
}
.task-recur-badge .ui-icon {
  width: 12px;
  height: 12px;
}
.task-time-range-display {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 30px;
  line-height: 1.15;
  font-weight: 800;
  color: #17382e;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.6px;
}
.task-time-range-display .time-sep {
  color: #9aaa9b;
  font-size: 20px;
  font-weight: 400;
  margin: 0 2px;
}

/* 人员胶囊标签组 */
.task-people-tags {
  display: flex;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px dashed #e3ede6;
  margin-top: 2px;
}
.task-person-pill {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: #f6f9f7;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid #e7efe9;
}
.task-person-pill .person-role {
  font-size: 11px;
  color: #718477;
  font-weight: 500;
}
.task-person-pill .person-name {
  font-size: 14px;
  color: #1a3328;
  font-weight: 600;
}

/* 任务说明卡片 */
.task-overview .task-work-notes {
  padding: 14px 16px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 1px 4px rgba(15, 56, 46, 0.04);
  border: 1px solid #edf2ee;
}
.task-notes-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}
.task-notes-icon {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  color: #285d45;
}
.task-notes-icon .ui-icon {
  width: 16px;
  height: 16px;
}
.task-notes-header h3 {
  font-size: 13px;
  font-weight: 600;
  color: #5c6f65;
  margin: 0;
}
.task-overview .task-work-notes .notes {
  font-size: 14px;
  line-height: 1.65;
  color: #17382e;
  margin: 0;
  white-space: pre-wrap;
}

/* 工作流程步骤列表卡片 */
.task-flow-summary {
  padding: 16px 18px;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 1px 4px rgba(15, 56, 46, 0.04);
  display: flex;
  flex-direction: column;
  gap: 10px;
  border: 1px solid #edf2ee;
  margin: 0;
}
.task-flow-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}
.task-flow-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.task-flow-icon {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  min-width: 18px;
  color: #285d45;
}
.task-flow-icon .ui-icon {
  width: 18px;
  height: 18px;
}
.task-flow-label {
  font-size: 14px;
  font-weight: 700;
  color: #17382e;
  letter-spacing: 0.2px;
}
.task-flow-count {
  font-size: 13px;
  font-weight: 600;
  color: #285d45;
}
.task-flow-count small {
  font-weight: 400;
  color: #718477;
}
.task-flow-summary progress {
  width: 100%;
  height: 6px;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  background: #e8ede9;
}
.task-flow-summary progress::-webkit-progress-bar { background: #e8ede9; }
.task-flow-summary progress::-webkit-progress-value { background: #285d45; border-radius: 999px; }

.task-step-overview {
  flex-basis: 100%;
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.task-step-overview li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #f8faf8;
  border: 1px solid #edf2ec;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.task-step-overview li:active {
  background: #edf3ee;
}
.task-step-overview li.done {
  background: #eef6f1;
  border-color: #d4e6db;
}
.task-overview-number {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  border-radius: 8px;
  background: #e4ebe5;
  color: #4b6354;
  font-size: 12px;
  font-weight: 700;
}
.task-overview-number .ui-icon {
  width: 14px;
  height: 14px;
}
.task-step-overview li.done .task-overview-number {
  background: #285d45;
  color: #fff;
}
.task-overview-step-title {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  color: #17382e;
  overflow-wrap: anywhere;
}
.task-overview-step-status {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  color: #85968b;
  background: #fff;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid #e7eee9;
}
.task-step-overview li.done .task-overview-step-status {
  color: #285d45;
  background: #fff;
  border-color: #cbe0d3;
}

.task-confirmed {
  font-size: 12px;
  color: #718477;
  text-align: center;
  margin: 4px 0 0;
}

/* 底部全宽吸底操作栏 */
.task-detail-footer {
  padding: 12px 16px max(16px, env(safe-area-inset-bottom));
  background: #fff;
  border-top: 1px solid #edf2ee;
  flex-shrink: 0;
  box-shadow: 0 -4px 16px rgba(15, 56, 46, 0.05);
}
.task-detail-footer .error {
  margin: 0 0 8px;
  font-size: 12px;
  color: #a4423d;
}
.task-actions {
  display: flex;
  width: 100%;
}
.task-actions .primary,
.task-overview .task-detail-footer button {
  width: 100%;
  min-height: 48px;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 600;
  background: #285d45;
  color: #fff;
  border: 0;
  box-shadow: 0 3px 12px rgba(40, 93, 69, 0.28);
  cursor: pointer;
  letter-spacing: 0.3px;
  transition: transform 0.1s ease, background 0.15s ease;
}
.task-actions .primary:active {
  transform: scale(0.99);
  background: #214e3a;
}

.task-menu {
  position: absolute;
  z-index: 10;
  top: 4px;
  right: 16px;
  width: min(220px, calc(100% - 32px));
  border-radius: 14px;
  background: #fff;
  padding: 4px;
  box-shadow: 0 8px 28px rgba(15, 56, 46, 0.16);
  border: 1px solid #edf2ee;
}
.task-menu button {
  display: flex;
  gap: 8px;
  align-items: center;
  width: 100%;
  border: 0;
  border-radius: 8px;
  background: transparent;
  padding: 10px 12px;
  text-align: left;
  font-size: 13px;
  font-weight: 500;
  color: #17382e;
}
.task-menu button:hover,
.task-menu button:active { background: #f2f6f3; }
.task-menu .danger { color: #c24136; }
.task-menu .danger:hover { background: #fdf2f0; }

@media (max-width: 600px) {
  html[data-surface="staff"] #modal.task-detail-dialog {
    inset: auto 0 0;
    width: 100%;
    max-width: 100%;
    border-radius: 24px 24px 0 0;
    max-height: 88dvh;
    margin: 0;
  }
}
