/* ═════════════════════════════════════════════════════════
   统一对话框与 Toast、催催提醒与家长待办、日记防丢稿、骨架屏与错误卡片、日期快捷导航、抽屉过渡、全局无障碍
   由原 style.css 按顺序拆出（P4.2），规则逐行原样搬移。层叠顺序靠 templates/layout/head.html
   中 01→10 的引用顺序保证，之后才加载 fonts.css 与 css/ui.css；新样式优先写进 css/ui.css。
   ═════════════════════════════════════════════════════════ */
/* ══════════ 统一对话框组件 (uiAlert / uiConfirm) 与 Toast 升级样式 ══════════ */
.modal-overlay.ui-dialog-overlay {
  z-index: 2000000;
  padding: 16px;
}

.modal-content.ui-dialog-box {
  max-width: 380px;
  width: 100%;
  padding: 24px 20px 20px;
  border-radius: 22px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.28);
  border: 1.5px solid var(--c-slate-200);
  background: var(--c-white);
}

.ui-dialog-icon {
  font-size: 2.4rem;
  line-height: 1.1;
  margin-bottom: 10px;
  user-select: none;
}

.ui-dialog-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--c-slate-900);
  margin: 0 0 8px 0;
  line-height: 1.35;
}

.ui-dialog-message {
  font-size: 0.94rem;
  color: var(--c-slate-600);
  margin: 0 0 20px 0;
  line-height: 1.55;
  white-space: pre-line;
  word-break: break-word;
}

.ui-dialog-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: stretch;
}

.ui-dialog-btn {
  flex: 1 1 0;
  min-height: 44px;
  min-width: 44px;
  padding: 10px 16px;
  border-radius: 14px;
  font-size: 0.96rem;
  font-weight: 800;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: transform 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  -webkit-tap-highlight-color: transparent;
}

.ui-dialog-btn:active {
  transform: scale(0.97);
}

.ui-dialog-btn:focus-visible {
  outline: 3px solid var(--primary, var(--c-indigo-600));
  outline-offset: 2px;
}

.ui-dialog-btn-cancel {
  background: var(--c-slate-100);
  color: var(--c-slate-700);
  border-color: var(--c-slate-300);
}

.ui-dialog-btn-cancel:hover {
  background: var(--c-slate-200);
  color: var(--c-slate-900);
}

.ui-dialog-btn-confirm {
  background: var(--primary, var(--c-indigo-600));
  color: var(--c-white);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.ui-dialog-btn-confirm:hover {
  opacity: 0.94;
}

.ui-dialog-btn-danger {
  background: var(--c-red-500);
  color: var(--c-white);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

.ui-dialog-btn-danger:hover {
  background: var(--c-red-600);
}

/* 升级版全局 Toast 容器与条目 */
.hw-toast-container {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2100000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  width: calc(100vw - 24px);
  max-width: 420px;
}

.hw-toast-container.hw-toast-top {
  top: calc(12px + env(safe-area-inset-top, 0px));
}

.hw-toast-container.hw-toast-bottom {
  bottom: calc(76px + env(safe-area-inset-bottom, 0px));
}

.hw-toast-item {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 16px;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--c-white);
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.22);
  cursor: pointer;
  max-width: 100%;
  word-break: break-word;
  transition: opacity 0.22s ease, transform 0.22s ease;
  -webkit-tap-highlight-color: transparent;
}

.hw-toast-msg {
  flex: 1 1 auto;
  line-height: 1.4;
  text-align: left;
}

.hw-toast-action-btn {
  flex-shrink: 0;
  min-height: 36px;
  min-width: 44px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.2);
  color: var(--c-white);
  font-size: 0.84rem;
  font-weight: 800;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s ease;
}

.hw-toast-action-btn:hover {
  background: rgba(255, 255, 255, 0.32);
}

.hw-toast-action-btn:active {
  transform: scale(0.95);
}

@media (prefers-reduced-motion: reduce) {
  .modal-overlay.ui-dialog-overlay,
  .modal-content.ui-dialog-box,
  .ui-dialog-btn,
  .hw-toast-item,
  .hw-toast-action-btn {
    transition: none !important;
    animation: none !important;
  }
}


/* ══════════ 第 1B 批 · 催催提醒状态、家长徽标与「家长待办」卡片 ══════════ */
#parentModeBtn {
  position: relative;
}

.parent-pending-badge {
  position: absolute;
  top: -5px;
  right: -6px;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--c-red-500);
  color: var(--c-white);
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--c-white);
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.35);
  pointer-events: none;
  z-index: 2;
}

.badge-remind-count {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--c-amber-100);
  color: var(--c-amber-700);
  border: 1px solid var(--c-amber-200);
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

.quick-remind-bell-btn.is-cooldown,
.quick-remind-bell-btn:disabled,
.btn-remind-parent.is-cooldown,
.btn-remind-parent:disabled {
  background: var(--c-slate-100) !important;
  color: var(--c-slate-500) !important;
  border-color: var(--c-slate-300) !important;
  box-shadow: none !important;
  cursor: not-allowed !important;
  opacity: 0.85;
  transform: none !important;
}

.parent-pending-card {
  background: linear-gradient(135deg, var(--c-amber-50) 0%, var(--c-white) 100%);
  border: 1.5px solid var(--c-amber-300);
  border-radius: var(--radius-lg, 18px);
  padding: 14px 16px;
  margin-bottom: 14px;
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.1);
}

.parent-pending-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.parent-pending-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  font-weight: 800;
  color: var(--c-amber-800);
}

.parent-pending-total-pill {
  background: var(--c-amber-500);
  color: var(--c-white);
  font-size: 0.75rem;
  font-weight: 800;
  padding: 2px 9px;
  border-radius: 999px;
}

.parent-pending-sub {
  font-size: 0.76rem;
  color: var(--c-amber-700);
  font-weight: 600;
}

.parent-pending-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.parent-pending-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  min-height: 48px;
  border-radius: 14px;
  background: var(--c-white);
  border: 1px solid var(--c-amber-200);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  flex-wrap: wrap;
}

.parent-pending-row:hover {
  border-color: var(--c-amber-500);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.12);
}

.parent-pending-row-main {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 0;
}

.parent-pending-avatar {
  font-size: 1.45rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--c-amber-100);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.parent-pending-info {
  flex: 1 1 auto;
  min-width: 0;
}

.parent-pending-line1 {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.parent-pending-name {
  font-size: 0.94rem;
  font-weight: 800;
  color: var(--c-slate-800);
}

.parent-pending-count-tag {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--c-amber-700);
  background: var(--c-amber-100);
  padding: 2px 8px;
  border-radius: 999px;
}

.parent-pending-nudge-pill {
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--c-red-600);
  background: var(--c-red-50);
  border: 1px solid var(--c-red-200);
  padding: 2px 8px;
  border-radius: 999px;
}

.btn-parent-pending-confirm-all {
  min-height: 44px;
  min-width: 44px;
  padding: 8px 14px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, var(--c-amber-500) 0%, var(--c-amber-600) 100%);
  color: var(--c-white);
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 3px 10px rgba(217, 119, 6, 0.25);
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.btn-parent-pending-confirm-all:hover {
  opacity: 0.94;
}

.btn-parent-pending-confirm-all:active {
  transform: scale(0.97);
}

@media (max-width: 767px) {
  #dashParentPendingCard {
    order: 0;
  }
  .parent-pending-row {
    padding: 10px;
  }
  .btn-parent-pending-confirm-all {
    width: 100%;
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .parent-pending-row,
  .btn-parent-pending-confirm-all,
  .quick-remind-bell-btn {
    transition: none !important;
    animation: none !important;
  }
}


/* ══════════ 日记防丢稿与提交体验 (P0) 增强样式 ══════════ */
.diary-autosave-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--c-green-50);
  color: var(--c-green-700);
  border: 1px solid var(--c-green-200);
  white-space: nowrap;
}

.diary-autosave-indicator.saving {
  background: var(--c-blue-50);
  color: var(--c-blue-700);
  border-color: var(--c-blue-200);
}

.diary-autosave-indicator.saved {
  background: var(--c-green-50);
  color: var(--c-green-700);
  border-color: var(--c-green-200);
}

.diary-autosave-indicator.error {
  background: var(--c-red-50);
  color: var(--c-red-600);
  border-color: var(--c-red-200);
}

/* 多端冲突只读对照折叠框 */
.diary-conflict-compare-box {
  background: var(--c-amber-50);
  border: 1.5px solid var(--c-amber-300);
  border-radius: var(--radius-md, 14px);
  padding: 10px 14px;
  margin-bottom: 14px;
}

.diary-conflict-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.86rem;
  font-weight: 800;
  color: var(--c-amber-800);
  cursor: pointer;
  min-height: 44px;
  list-style: none;
}

.diary-conflict-summary::-webkit-details-marker {
  display: none;
}

.diary-conflict-copy-btn {
  min-height: 36px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--c-amber-500);
  background: var(--c-white);
  color: var(--c-amber-700);
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
  flex-shrink: 0;
}

.diary-conflict-server-body {
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--c-white);
  border: 1px dashed var(--c-amber-300);
  border-radius: 10px;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--c-slate-700);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 180px;
  overflow-y: auto;
  user-select: text;
}

/* 未达字数门槛时的可点击按钮样式與轻晃动画 */
.diary-action-btn.unreached {
  background: var(--c-slate-200);
  color: var(--c-slate-600);
  border: 1.5px dashed var(--c-slate-400);
}

@keyframes diaryCapsuleShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.diary-capsule-shake {
  animation: diaryCapsuleShake 0.45s ease;
  color: var(--rose, var(--c-rose-500)) !important;
}

/* 图片上传占位进度与重试/删除覆盖层 */
.diary-thumb-preview-blur {
  filter: blur(2px) brightness(0.75);
}

.diary-thumb-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  color: var(--c-white);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px;
  text-align: center;
}

.diary-thumb-overlay-error {
  background: rgba(127, 29, 29, 0.78);
}

.diary-thumb-status-text {
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 1.2;
}

.diary-thumb-progress-track {
  width: 82%;
  height: 6px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 999px;
  overflow: hidden;
}

.diary-thumb-progress-fill {
  height: 100%;
  background: var(--c-sky-400);
  border-radius: 999px;
  transition: width 0.2s ease;
}

.diary-thumb-retry-actions {
  display: flex;
  gap: 4px;
  width: 100%;
  justify-content: center;
}

.diary-thumb-mini-btn {
  min-height: 32px;
  min-width: 38px;
  padding: 3px 8px;
  border-radius: 8px;
  border: none;
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
}

.diary-thumb-mini-btn.retry {
  background: var(--c-white);
  color: var(--c-slate-900);
}

.diary-thumb-mini-btn.delete {
  background: var(--c-red-500);
  color: var(--c-white);
}

@media (prefers-reduced-motion: reduce) {
  .diary-capsule-shake {
    animation: none !important;
  }
  .diary-thumb-progress-fill,
  .diary-mood-btn {
    transition: none !important;
  }
  .diary-topic-dice.is-rolling,
  .diary-reply-banner-sticker,
  .diary-reply-bubble.is-new .diary-reply-sticker {
    animation: none !important;
  }
  .diary-reply-sticker-btn {
    transition: none !important;
  }
}

/* ─── P1: 纯 CSS 骨架屏占位、统一错误卡片、日期快捷导航与抽屉平滑过渡 ─── */
@keyframes hwSkeletonShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.hw-skeleton-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.hw-skeleton {
  background: linear-gradient(90deg, var(--c-slate-100) 25%, var(--c-slate-200) 50%, var(--c-slate-100) 75%);
  background-size: 200% 100%;
  animation: hwSkeletonShimmer 1.4s ease-in-out infinite;
  border-radius: 8px;
}

.hw-skeleton-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--c-white);
  border: 1px solid var(--c-slate-200);
  border-radius: 14px;
}

.hw-skeleton-grid-item {
  flex-direction: column;
  justify-content: center;
  padding: 18px 12px;
}

.hw-skeleton-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  flex-shrink: 0;
}

.hw-skeleton-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
}

.hw-skeleton-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hw-skeleton-line {
  height: 13px;
  border-radius: 6px;
}

.hw-skeleton-line-sm {
  height: 10px;
}

.hw-skeleton-pill {
  width: 56px;
  height: 26px;
  border-radius: 999px;
  flex-shrink: 0;
}

.hw-skeleton-cal-cell {
  height: 44px;
  border-radius: 10px;
}

/* 统一错误态卡片 */
.hw-error-state-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 28px 16px;
  background: var(--c-rose-50);
  border: 1.5px dashed var(--c-rose-300);
  border-radius: 16px;
  gap: 8px;
  grid-column: 1 / -1;
}

.hw-error-state-icon {
  font-size: 2.2rem;
  line-height: 1;
}

.hw-error-state-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--c-rose-800);
}

.hw-error-state-msg {
  font-size: 0.85rem;
  color: var(--c-rose-700);
  max-width: 340px;
  line-height: 1.45;
}

.hw-error-retry-btn {
  margin-top: 6px;
  min-height: 44px;
  min-width: 120px;
  padding: 8px 20px;
  border-radius: 999px;
  border: none;
  background: var(--c-rose-600);
  color: var(--c-white);
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(225, 29, 72, 0.22);
  transition: transform 0.15s ease, background 0.15s ease;
}

.hw-error-retry-btn:hover {
  background: var(--c-rose-700);
}

/* 任务中心日期快捷导航与非今日提醒横幅 */
.hw-date-nav-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.hw-date-nav-btn {
  min-height: 44px;
  min-width: 44px;
  padding: 6px 12px;
  border-radius: 10px;
  border: 1.5px solid var(--c-slate-300);
  background: var(--c-slate-50);
  color: var(--c-slate-700);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.hw-date-nav-btn:hover {
  background: var(--c-slate-100);
  border-color: var(--c-slate-400);
}

.hw-date-nav-btn.is-today-active {
  background: var(--primary-light, var(--c-indigo-100));
  color: var(--primary, var(--c-indigo-700));
  border-color: var(--primary, var(--c-indigo-700));
}

.hw-non-today-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 14px;
  margin-bottom: 12px;
  background: var(--c-amber-50);
  border: 1.5px solid var(--c-amber-300);
  border-radius: 12px;
  color: var(--c-amber-800);
  font-size: 0.85rem;
}

.hw-viewing-date-badge {
  font-weight: 800;
  background: var(--c-amber-100);
  color: var(--c-amber-700);
  padding: 4px 10px;
  border-radius: 999px;
}

.hw-cross-day-rule-hint {
  font-weight: 600;
  color: var(--c-amber-800);
}

.hw-back-today-inline-btn {
  min-height: 44px;
  min-width: 44px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--c-amber-500);
  background: var(--c-white);
  color: var(--c-amber-700);
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
}

/* 任务卡片抽屉 max-height / opacity 动画过渡 */
.task-drawer-content {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.22s ease, opacity 0.2s ease;
}

.task-drawer-content.drawer-open {
  max-height: 420px;
  opacity: 1;
}

.task-drawer-content.drawer-closed {
  max-height: 0;
  opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
  .hw-skeleton {
    animation: none !important;
  }
  .task-drawer-content,
  .hw-error-retry-btn,
  .hw-date-nav-btn {
    transition: none !important;
  }
}

/* ══════════════════════════════════════════════════════════
   ♿ 第 4 批：全局无障碍焦点、iOS 防自动缩放与语义化按钮重置
   ══════════════════════════════════════════════════════════ */
:focus-visible {
  outline: 3px solid var(--primary, var(--c-indigo-600));
  outline-offset: 2px;
}

input:not([type="checkbox"]):not([type="radio"]),
textarea,
select,
.form-input {
  font-size: max(16px, 1rem);
}

button.date-badge,
button.filter-chip {
  font-family: inherit;
  text-align: inherit;
  appearance: none;
  -webkit-appearance: none;
}

[role="button"][tabindex="0"] {
  cursor: pointer;
}
