:root {
  /* 主色：青绿，偏工具感、耐看 */
  --primary: #0d9488;
  --primary-dark: #0f766e;
  --primary-soft: rgba(13, 148, 136, 0.12);
  /* 顶栏：深 slate，比亮蓝更易读、更稳 */
  --header-bg: linear-gradient(165deg, #1e293b 0%, #0f172a 100%);
  --header-solid: #1e293b;
  /* 页面背景：极浅冷灰 */
  --bg-page: #eef2f6;
  /* 卡片与条目标签 */
  --surface: #ffffff;
  --surface-row: #f8fafc;
  --surface-row-hover: #f1f5f9;
  --border-subtle: rgba(148, 163, 184, 0.35);
  --text-dark: #0f172a;
  --text-muted: #64748b;
  /* 提醒数字：琥珀色，在深色顶栏上清晰且不刺眼 */
  --accent-alert: #fb923c;
  /* 未完成说明：偏琥珀/砖红，避免荧光红 */
  --accent-warn-text: #9a3412;
  --white: #fff;
  --radius-lg: 16px;
  --radius-bar: 12px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.06);
  --shadow-fab: 0 8px 28px rgba(13, 148, 136, 0.38);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* 访问密码全屏遮罩（未登录或会话 Cookie 无效时显示；密码仅服务端校验） */
body.auth-gate-active {
  overflow: hidden;
}

#auth-gate-root {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(165deg, #1e293b 0%, #0f172a 100%);
}

.auth-gate-panel {
  width: 100%;
  max-width: 340px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 28px 24px 24px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.35);
}

.auth-gate-title {
  margin: 0 0 8px;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-dark);
  text-align: center;
}

.auth-gate-hint {
  margin: 0 0 20px;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.45;
}

.auth-gate-input {
  width: 100%;
  padding: 14px 16px;
  font-size: 1.1rem;
  letter-spacing: 0.12em;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  margin-bottom: 8px;
}

.auth-gate-error {
  min-height: 1.25rem;
  margin: 0 0 14px;
  font-size: 0.85rem;
  color: #b91c1c;
  text-align: center;
}

.auth-gate-btn {
  width: 100%;
  padding: 14px;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--white);
  background: var(--primary);
  border: none;
  border-radius: 12px;
  cursor: pointer;
}

.auth-gate-btn:hover {
  background: var(--primary-dark);
}

html {
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg-page);
  color: var(--text-dark);
  padding-bottom: 100px;
}

a {
  color: inherit;
  text-decoration: none;
}

.page {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
}

/* Header */
.app-header {
  background: var(--header-bg);
  background-color: var(--header-solid);
  color: var(--white);
  padding: 14px 18px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.2);
}

.app-header h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.reminder-link {
  font-size: 0.9rem;
  color: rgba(248, 250, 252, 0.88);
  font-weight: 500;
}

.reminder-link .count {
  color: var(--accent-alert);
  font-weight: 700;
}

/* Main */
main {
  padding: 16px;
}

.section-title {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0 0 4px 4px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: none;
}

.section-subhint {
  font-size: 0.72rem;
  color: #94a3b8;
  margin: 0 0 8px 4px;
  line-height: 1.35;
}

.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-subtle);
}

.card-footer {
  text-align: right;
  margin-top: 12px;
  padding-top: 4px;
}

.card-footer a {
  font-size: 0.88rem;
  color: var(--primary);
  font-weight: 600;
}

/* Task rows */
.task-row {
  display: block;
  background: var(--surface-row);
  border-radius: var(--radius-bar);
  padding: 12px 14px;
  margin-bottom: 10px;
  border: 1px solid var(--border-subtle);
  box-shadow: none;
  transition: transform 0.15s ease, background 0.15s ease;
}

.task-row:last-child {
  margin-bottom: 0;
}

.task-row:hover {
  background: var(--surface-row-hover);
}

.task-row:active {
  transform: scale(0.99);
}

.task-row-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.task-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.task-progress {
  font-weight: 700;
  font-size: 0.95rem;
  white-space: nowrap;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}

.task-sub {
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--accent-warn-text);
  line-height: 1.45;
  opacity: 0.92;
}

.task-sub--alldone {
  color: #64748b;
  opacity: 1;
}

.btn-ongoing-more {
  display: block;
  width: 100%;
  margin: 14px 0 0;
  padding: 12px 16px;
  font-size: 0.88rem;
  font-weight: 600;
  font-family: inherit;
  text-align: center;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid rgba(13, 148, 136, 0.35);
  border-radius: 12px;
  cursor: pointer;
  box-sizing: border-box;
}

.btn-ongoing-more:hover {
  background: rgba(13, 148, 136, 0.2);
}

.btn-ongoing-more:active {
  transform: scale(0.99);
}

/* Completed row */
.done-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  background: var(--surface-row);
  border-radius: var(--radius-bar);
  padding: 12px 14px;
  margin-bottom: 10px;
  border: 1px solid var(--border-subtle);
}

.done-row:last-child {
  margin-bottom: 0;
}

.done-title {
  flex: 1 1 100%;
  font-weight: 600;
  font-size: 0.95rem;
}

.btn-pill {
  border: none;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.btn-pill.blue {
  background: var(--primary);
  color: var(--white);
}

.btn-pill.blue:hover {
  background: var(--primary-dark);
}

.btn-pill.blue-outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}

.btn-pill.blue-outline:hover {
  background: var(--primary-soft);
}

.date-text {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* 单店专属卡片：首页区块 + 单店列表页共用 */
#singleStoreCard .special-issue-title,
.special-single-list .special-issue-title {
  color: var(--text-dark);
  font-weight: 600;
}

#singleStoreCard .special-issue-title:hover,
.special-single-list .special-issue-title:hover {
  color: var(--primary-dark);
}

#singleStoreCard .date-text,
.special-single-list .date-text {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
}

#singleStoreCard .change-special-date-btn,
.special-single-list .change-special-date-btn {
  background: transparent;
  color: #64748b;
  border: 2px solid #cbd5e1;
}

#singleStoreCard .change-special-date-btn:hover,
.special-single-list .change-special-date-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #475569;
}

#singleStoreCard .status-pill,
.special-single-list .status-pill {
  flex-shrink: 0;
}

#singleStoreCard .status-pill.special-status-toggle,
.special-single-list .status-pill.special-status-toggle {
  cursor: pointer;
  font-family: inherit;
}

#singleStoreCard .status-pill.special-status-toggle:active,
.special-single-list .status-pill.special-status-toggle:active {
  transform: scale(0.97);
}

#singleStoreCard .status-pill.special-status-toggle:disabled,
.special-single-list .status-pill.special-status-toggle:disabled {
  opacity: 0.65;
  cursor: wait;
}

#singleStoreCard .status-pill--done,
.special-single-list .status-pill--done {
  background: #e2e8f0;
  color: #64748b;
}

#singleStoreCard .status-pill--pending,
.special-single-list .status-pill--pending {
  background: #fff7ed;
  color: #9a3412;
  border: 2px solid #fed7aa;
}

/* 已完成记录页：名称、日期、状态标签同灰 */
.page-done-muted .done-title {
  color: #64748b;
  font-weight: 600;
}

.page-done-muted .date-text {
  color: #94a3b8;
  font-weight: 500;
}

.page-done-muted .status.done {
  background: #e2e8f0;
  color: #64748b;
}

/* FAB */
.fab-wrap {
  position: fixed;
  right: 18px;
  bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 50;
}

.fab {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--white);
  border: none;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-fab);
  font-family: inherit;
  line-height: 1.15;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4px;
}

.fab:hover {
  background: var(--primary-dark);
  filter: none;
}


/* Sub pages: back bar */
.sub-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--white);
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 40;
}

.sub-nav a.back {
  color: var(--primary);
  font-size: 0.95rem;
  font-weight: 600;
}

.sub-nav h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* List pages */
.list-page main {
  padding-top: 8px;
}

.store-list-item {
  background: var(--white);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.store-list-item .status {
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 600;
}

/* 门店列表：添加、序号、拖拽排序 */
.stores-toolbar {
  margin-bottom: 4px;
}

.btn-add-store {
  padding: 10px 18px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--white);
  background: var(--primary);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(13, 148, 136, 0.25);
}

.btn-add-store:hover {
  background: var(--primary-dark);
}

.btn-add-store:active {
  transform: scale(0.98);
}

.store-sort-hint {
  font-size: 0.78rem;
  color: #64748b;
  margin: 0 0 12px;
  line-height: 1.45;
}

.store-sort-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--white);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 8px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-subtle);
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.store-sort-row.is-dragging {
  opacity: 0.55;
  border-color: var(--primary);
}

.store-sort-row.is-drag-over {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.store-sort-index {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  background: #f1f5f9;
  border-radius: 8px;
}

.store-sort-handle {
  flex-shrink: 0;
  width: 34px;
  text-align: center;
  cursor: grab;
  color: #94a3b8;
  font-size: 0.95rem;
  line-height: 1;
  letter-spacing: -3px;
  user-select: none;
  touch-action: none;
}

.store-sort-handle:active {
  cursor: grabbing;
}

.store-sort-row--nosort .store-sort-handle {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.store-sort-name {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  font-size: 0.92rem;
}

.store-sort-btns {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.btn-icon-sort {
  width: 34px;
  height: 34px;
  padding: 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #475569;
  cursor: pointer;
  font-family: inherit;
}

.btn-icon-sort:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
}

.btn-icon-sort:active {
  transform: scale(0.96);
}

.btn-store-delete {
  background: transparent;
  color: #b91c1c;
  border: 2px solid #fecaca;
}

.btn-store-delete:hover {
  background: #fef2f2;
  border-color: #fca5a5;
}

.btn-store-delete:active {
  transform: scale(0.97);
}

.status.done {
  background: rgba(13, 148, 136, 0.14);
  color: var(--primary-dark);
}

.status.pending {
  background: rgba(251, 146, 60, 0.15);
  color: #9a3412;
}

/* Forms */
.form-page main {
  padding: 16px;
}

.form-page-hint {
  margin: 0 0 14px;
  padding: 12px 14px;
  font-size: 0.88rem;
  line-height: 1.5;
  color: #475569;
  background: #f8fafc;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
}

.form-page-hint strong {
  color: var(--text-dark);
  font-weight: 600;
}

.form-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
}

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: #475569;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
}

.form-group textarea {
  min-height: 100px;
  resize: vertical;
}

/* 表单内只读说明（如：问题+ 默认全部门店） */
.form-static {
  margin: 0;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  font-size: 0.95rem;
  color: #64748b;
  line-height: 1.45;
}

.form-hint {
  font-size: 0.75rem;
  color: #94a3b8;
  margin: 6px 0 0;
  line-height: 1.45;
}

.form-group input[type="file"] {
  width: 100%;
  padding: 8px 0;
  border: none;
  font-size: 0.9rem;
}

.issue-photo-preview-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.issue-photo-preview-item {
  width: 76px;
  height: 76px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
}

.issue-photo-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}


.issue-detail-desc {
  margin-bottom: 14px;
  font-size: 0.9rem;
  color: #334155;
}

.issue-detail-desc strong {
  display: block;
  margin-bottom: 4px;
  color: #475569;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
}

.issue-detail-desc p {
  margin: 6px 0 0;
  white-space: pre-wrap;
  line-height: 1.5;
}

.issue-detail-photos {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.issue-detail-photo-link {
  display: block;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  max-width: 100%;
}

.issue-detail-photo {
  display: block;
  max-width: 100%;
  max-height: 240px;
  width: auto;
  height: auto;
  object-fit: contain;
  vertical-align: middle;
  background: #f1f5f9;
}

.task-has-photo {
  margin-left: 6px;
  opacity: 0.88;
  font-size: 0.92em;
  vertical-align: middle;
}

.btn-submit {
  width: 100%;
  padding: 14px;
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  margin-top: 8px;
}

.btn-submit:hover {
  background: var(--primary-dark);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.modal-overlay.open {
  display: flex;
}

/* 删除确认：盖住悬浮按钮，避免误点挡在删除键上 */
#deleteConfirmModal.modal-overlay {
  z-index: 10000;
}

#deleteConfirmModal .modal-sheet {
  position: relative;
  z-index: 1;
  pointer-events: auto;
  touch-action: manipulation;
}

.modal-sheet {
  background: var(--white);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-width: 480px;
  padding: 20px;
  animation: slideUp 0.25s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-sheet h3 {
  margin: 0 0 16px;
  font-size: 1.1rem;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.modal-actions button {
  flex: 1;
  padding: 12px;
  border-radius: 10px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
}

.modal-actions .cancel {
  background: #f1f5f9;
  color: #475569;
  position: relative;
  z-index: 2;
  pointer-events: auto;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.modal-actions .save {
  background: var(--primary);
  color: var(--white);
}

.modal-actions .save:hover {
  background: var(--primary-dark);
}

.modal-actions .danger {
  background: #b91c1c;
  color: var(--white);
  position: relative;
  z-index: 2;
  pointer-events: auto;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.modal-actions .danger:hover {
  background: #991b1b;
}

.modal-sheet .modal-body {
  margin: 0 0 8px;
  font-size: 0.95rem;
  color: #475569;
  line-height: 1.5;
}

/* 任务详情：门店色块网格（顺序与 data.js 一致） */
.task-store-legend {
  margin: 0 0 12px;
  font-size: 0.78rem;
  color: #94a3b8;
}

.store-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

@media (max-width: 360px) {
  .store-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.store-tile {
  border-radius: 10px;
  padding: 10px 6px;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  border: 1px solid transparent;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  box-sizing: border-box;
}

.store-tile-name {
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.3;
  word-break: break-all;
}

.store-tile--pending {
  background: #fee2e2;
  border-color: #fecaca;
}

.store-tile--pending .store-tile-name {
  color: #7f1d1d;
}

.store-tile--done {
  background: #bbf7d0;
  border-color: #86efac;
}

.store-tile--done .store-tile-name {
  color: #14532d;
}

.store-tile--clickable {
  cursor: pointer;
}

.store-tile--clickable:active {
  transform: scale(0.98);
}

/* 问题详情：删除入口（页面最下） */
.issue-detail-actions {
  margin-top: 20px;
  padding-top: 4px;
}

.btn-delete-issue {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid #fecaca;
  background: #fff;
  color: #b91c1c;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.btn-delete-issue:hover {
  background: #fef2f2;
}

/* Empty hint */
.empty-hint {
  text-align: center;
  color: #94a3b8;
  padding: 32px 16px;
  font-size: 0.9rem;
}
