
/* ==========================================================================
   V6.3 界面状态 + 极端窄屏
   ========================================================================== */

/* ---------- 骨架屏 ---------- */
.skeleton-wrap { display: flex; flex-direction: column; gap: 2px; }
.skeleton {
  background: linear-gradient(90deg, var(--paper-2) 25%, #F3EDE3 37%, var(--paper-2) 63%);
  background-size: 400% 100%;
  animation: sk 1.4s ease infinite;
  border-radius: 2px;
}
.sk-line { height: 34px; margin: 6px 0; }
.sk-chart { height: 160px; margin: 8px 0 14px; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

/* ---------- 统一空状态 ---------- */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; padding: 44px 20px; text-align: center;
}
.es-mark {
  width: 40px; height: 40px; margin-bottom: 6px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--gold-line); border-radius: 50%;
  color: var(--gold-text); font-size: 17px;
}
.es-title { font-family: var(--serif-cn); font-size: 15px; color: var(--ink); letter-spacing: .04em; }
.es-hint { font-size: 12.5px; color: var(--text-2); line-height: 1.8; max-width: 26em; }
.es-action { margin-top: 12px; }

/* ---------- 错误态 ---------- */
.error-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; padding: 36px 20px; text-align: center;
  border: 1px dashed var(--line-strong); border-radius: 3px;
  background: rgba(180, 154, 112, .05);
}
.error-state .es-mark { border-color: var(--accent); color: var(--accent-deep); }

/* ---------- 表单内联错误 ---------- */
.field-error {
  margin-top: 6px; font-size: 12px; color: var(--accent-deep);
  display: flex; align-items: center; gap: 5px;
}
.field-error::before { content: "!"; display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 10px; }
[aria-invalid="true"] { border-color: var(--accent) !important; }

/* ==========================================================================
   窄屏弹窗：头部固定 + 主体内部滚动 + 底部操作条吸附
   （此前靠遮罩层滚动，标题与关闭按钮会滚出视野，表单底部够不到）
   ========================================================================== */
@media (max-width: 767px) {
  .modal-mask { padding: 0; align-items: stretch; }
  .modal {
    max-width: none; width: 100%; margin: 0;
    height: 100vh; height: 100dvh;      /* dvh：避开移动端浏览器地址栏 */
    max-height: 100dvh;
    border-radius: 0; border-left: none; border-right: none;
    display: flex; flex-direction: column;
  }
  .modal-head {
    flex: 0 0 auto; position: sticky; top: 0; z-index: 3;
    background: var(--card);
    padding-top: calc(16px + env(safe-area-inset-top, 0px));
  }
  .modal-body {
    flex: 1 1 auto; overflow-y: auto; -webkit-overflow-scrolling: touch;
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    overscroll-behavior: contain;
  }
  /* 底部操作条吸附：保存/收款按钮始终可点，不必滚到表单末尾 */
  .modal-actions {
    position: sticky; bottom: 0; z-index: 2;
    background: var(--card);
    padding: 12px 0 calc(12px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--line);
  }
  .modal-actions .btn { flex: 1 1 auto; min-height: 46px; }
}

/* ---------- 320px：排期页工具条换行，消除横向溢出 ---------- */
@media (max-width: 400px) {
  .cal-bar { flex-wrap: wrap; row-gap: 10px; }
  .cal-label { order: -1; width: 100%; min-width: 0; }
  .cal-bar .btn { width: 100%; order: 3; }
  .swipe-hint { width: 100%; justify-content: center; order: 2; }
}

/* ---------- 空状态在窄屏的呼吸感 ---------- */
@media (max-width: 767px) {
  .empty-state { padding: 32px 16px; }
  .es-title { font-size: 14.5px; }
  .es-hint { font-size: 12px; }
}

/* ---------- 危险操作区（清空演示数据） ---------- */
.danger-zone { border-color: var(--line-strong); background: rgba(140, 98, 83, .03); }
.dz-text { font-size: 12.5px; line-height: 1.9; color: var(--text-2); margin-bottom: 14px; }
.btn-danger {
  background: transparent; color: var(--accent-deep);
  border: 1px solid var(--accent); border-radius: 2px;
  min-height: 44px; padding: 0 20px; letter-spacing: .1em;
  font-family: var(--font); font-size: 13px; cursor: pointer;
  transition: background .18s ease, color .18s ease;
}
.btn-danger:hover { background: var(--accent); color: #fff; }
.btn-danger:disabled { opacity: .5; cursor: not-allowed; }
.dz-warn {
  padding: 14px 16px; border-left: 2px solid var(--accent);
  background: var(--accent-soft); border-radius: 2px;
  font-size: 13px; line-height: 1.9; color: var(--text);
}
.dz-warn b { color: var(--accent-deep); }

/* ---------- 列表分批渲染的底部状态条 ---------- */
.list-bar {
  display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap;
  margin-top: 10px; padding: 16px 12px;
  font-size: 12px; letter-spacing: .06em; color: var(--text-3);
  border-top: 1px solid var(--gold-line);
}
.list-bar .btn { min-height: 40px; }
