/* TaskFlow 第4稿主题 · 2026-09-18
   仅覆盖视觉与响应式布局，保留现有数据、认证和飞书接口。 */

:root {
  --primary: #e8ad60;
  --primary-light: #f4c784;
  --primary-dark: #d48e32;
  --accent: #d8a054;
  --success: #2eaf75;
  --warning: #dd8b22;
  --danger: #dc4545;
  --purple: #8d6bc4;
  --text-primary: #302b25;
  --text-secondary: #71685d;
  --text-muted: #82786b;
  --glass-bg: rgba(255, 252, 247, 0.78);
  --glass-bg-strong: rgba(255, 252, 247, 0.9);
  --glass-border: rgba(255, 255, 255, 0.78);
  --glass-shadow: 0 8px 28px rgba(83, 65, 43, 0.08), inset 0 1px 0 rgba(255,255,255,0.88);
  --radius: 20px;
  --radius-sm: 12px;
  --tf-divider: rgba(111, 92, 68, 0.14);
  --tf-control: rgba(255, 252, 247, 0.92);
  --tf-amber-soft: #fff0d7;
  --tf-panel: rgba(255, 252, 247, 0.82);
}

[hidden] { display: none !important; }

html, body { background: #f5f1ea; }
body {
  background-image: url("assets/taskflow-warm-light-bg.png");
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  color: var(--text-primary);
}
body::before {
  background: rgba(245, 241, 234, 0.18) !important;
}
body::after { display: none !important; }

.app { padding: 22px; gap: 16px; }
.topbar,
.main,
.login-card,
.today-focus-section,
.stats-row,
.chart-card,
.tasks-section,
.projects-section,
.mobile-more-card {
  background: var(--tf-panel) !important;
  border: 1px solid var(--glass-border) !important;
  box-shadow: var(--glass-shadow) !important;
  -webkit-backdrop-filter: blur(20px) saturate(110%);
  backdrop-filter: blur(20px) saturate(110%);
}

.topbar {
  height: 72px;
  padding: 0 20px;
  flex: 0 0 72px;
  border-radius: 22px;
}
.main {
  min-height: 0;
  border-radius: 26px;
  overflow: hidden;
}
.logo-icon,
.login-logo {
  background: #f5f1ea !important;
  border: 1px solid rgba(255,255,255,.8);
  box-shadow: 0 8px 18px rgba(174, 105, 24, .2) !important;
  overflow: hidden;
}
.logo-icon img,
.login-logo img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.18); }
.logo-text { font-size: 20px; }
.logo-sub { color: var(--text-secondary); }

.search-box,
.icon-btn,
.filter-tabs,
.mobile-search-overlay input {
  background: var(--tf-control) !important;
  border-color: rgba(111,92,68,.14) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9), 0 4px 12px rgba(83,65,43,.04) !important;
}
.search-box:hover,
.icon-btn:hover { background: #fffaf3 !important; color: #a45b0d; }
.search-box kbd { background: #fff0d7; color: #8d5516; }
.search-clear-btn {
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: rgba(111,92,68,.12);
  color: var(--text-secondary);
  cursor: pointer;
  line-height: 1;
}

.sidebar {
  width: 224px;
  padding: 22px 14px 18px;
  background: rgba(255,252,247,.56) !important;
  border-right: 1px solid var(--tf-divider);
}
.sidebar-new-btn { display: none; }
.nav-section {
  color: #9b8f81;
  letter-spacing: .08em;
  padding-top: 18px;
}
.nav-item {
  min-height: 48px;
  margin: 2px 0;
  color: #4f473f;
  font-size: 14px;
  border: 1px solid transparent;
}
.nav-item:hover { background: rgba(255,248,237,.72); transform: none; }
.nav-item.active {
  background: #fff0d7 !important;
  color: #8b510f !important;
  border-color: rgba(232,173,96,.42) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8) !important;
}
.nav-badge { background: #fbeae5; color: #a63d2f; }

.content {
  padding: 28px 32px 44px;
  max-width: 1320px;
  margin: 0 auto;
}
.page-header {
  min-height: 74px;
  padding: 0 !important;
  margin-bottom: 22px;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
.page-title { font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.page-date { color: var(--text-secondary); font-size: 14px; }
.page-date .dot { display: none; }
.page-date-divider { color: #b3a99c; }

.btn {
  min-height: 44px;
  border-radius: 12px;
  padding: 10px 18px;
}
.btn-primary,
.login-btn,
.sidebar-new-btn,
#newTaskSubmitBtn,
#changePasswordBtn {
  background: #e8ad60 !important;
  border: 1px solid #d99338 !important;
  color: #352515 !important;
  box-shadow: 0 8px 18px rgba(186,111,25,.16), inset 0 1px 0 rgba(255,255,255,.52) !important;
}
.btn-primary:hover,
.login-btn:hover { background: #dda052 !important; }
.btn-ghost {
  background: rgba(255,252,247,.84) !important;
  border: 1px solid rgba(111,92,68,.18) !important;
  color: var(--text-primary) !important;
}

/* 首页：今日聚焦永远是第一个业务区块 */
.today-focus-section {
  display: block;
  padding: 18px 20px 8px;
  border-radius: 20px;
  margin-bottom: 18px;
}
.today-focus-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.today-focus-title { font-size: 18px; font-weight: 700; }
.today-focus-title .count,
.tasks-title .count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 24px;
  padding: 0 8px;
  margin-left: 4px;
  border-radius: 999px;
  background: #fff0d7 !important;
  color: #8b510f !important;
  font-size: 12px;
}
.today-focus-hint { color: var(--text-muted); font-size: 12px; }
.today-focus-cards,
.task-cards {
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: visible;
  padding: 0;
  cursor: default;
  scroll-snap-type: none;
}
.today-focus-cards .task-card,
.task-cards .task-card {
  flex: none;
  width: 100%;
  min-height: 96px;
  padding: 16px 18px;
  margin: 0;
  border: 0 !important;
  border-bottom: 1px solid var(--tf-divider) !important;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none !important;
  transform: none !important;
}
.today-focus-cards .task-card:last-child,
.task-cards .task-card:last-child { border-bottom: 0 !important; }
.today-focus-cards .task-card:hover,
.task-cards .task-card:hover { background: rgba(255,249,240,.72) !important; }
.task-card::after { display: none !important; }
.task-top { margin-bottom: 8px; padding-left: 0; }
.task-name { padding-left: 0; font-size: 15px; color: var(--text-primary); }
.task-desc { padding-left: 0; color: var(--text-secondary); margin-bottom: 10px; }
.task-desc,
.detail-description,
.editable-description { white-space: pre-wrap; overflow-wrap: anywhere; }
.task-progress { margin-left: 0; background: rgba(111,92,68,.09); }
.task-meta,
.task-source { padding-left: 0; }
.task-source { color: var(--text-muted); }
.task-priority { padding: 4px 10px; border-radius: 999px; }
.status-segment { background: rgba(255,252,247,.88); border-color: rgba(111,92,68,.12); }
.seg-btn.active.doing { color: #b9690d; background: #fff0d7; }
.seg-btn.active.done { color: #277b53; background: #e7f6ec; }

.stats-row {
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border-radius: 20px;
  overflow: hidden;
  margin-bottom: 18px;
}
.stats-row .stat-card {
  min-height: 122px;
  border: 0 !important;
  border-right: 1px solid var(--tf-divider) !important;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none !important;
}
.stats-row .stat-card:last-child { border-right: 0 !important; }
.stat-card::before,
.stat-card::after,
.stat-sparkline { display: none !important; }
.stat-label { color: var(--text-secondary); }
.stat-value { font-size: 32px; color: #29231e; }
.stat-trend { color: var(--text-muted) !important; }
.stat-icon { background: rgba(255,255,255,.48) !important; }

.charts-row {
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 16px;
  margin-top: 18px;
}
.chart-card {
  min-height: 250px;
  padding: 20px;
  border-radius: 20px;
}
.chart-card:nth-child(n) { background: var(--tf-panel) !important; border-color: var(--glass-border) !important; }
.chart-title .tag { background: #fff0d7; color: #8b510f; }

.tasks-section {
  padding: 18px 20px;
  border-radius: 20px;
  margin-bottom: 18px;
}
.tasks-header { margin-bottom: 4px; }
.tasks-title { font-size: 18px; }
.task-scroll-hint,
.task-carousel-controls { display: none !important; }
.task-filter-btn {
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid rgba(111,92,68,.16);
  border-radius: 12px;
  background: rgba(255,252,247,.9);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.task-filter-btn span {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  margin-left: 4px;
  border-radius: 999px;
  background: #fff0d7;
  color: #8b510f;
  font-size: 11px;
}
.filter-field { margin-bottom: 18px; }
.filter-field label { display: block; margin-bottom: 7px; font-size: 13px; font-weight: 700; }
.filter-field select { width: 100%; min-height: 46px; padding: 0 12px; border: 1px solid rgba(111,92,68,.18); border-radius: 12px; background: rgba(255,252,247,.92); }
.filter-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 24px; }
.filter-actions .btn { justify-content: center; }
.filter-tabs { padding: 4px; }
.filter-tab.active {
  background: #fff0d7 !important;
  color: #8b510f !important;
  box-shadow: inset 0 0 0 1px rgba(232,173,96,.26) !important;
}
.empty-state { padding: 64px 20px; }
.empty-icon { background: #edf5e9; }

/* 项目页 */
.projects-section {
  padding: 22px;
  border-radius: 20px;
}
.projects-section[hidden] { display: none !important; }
.projects-header { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; }
.projects-title { font-size: 22px; font-weight: 700; }
.projects-subtitle { margin-top: 4px; color: var(--text-muted); font-size: 13px; }
.project-list { display: flex; flex-direction: column; }
.project-card {
  display: grid;
  grid-template-columns: 48px minmax(0,1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 18px 12px;
  border-bottom: 1px solid var(--tf-divider);
}
.project-card:last-child { border-bottom: 0; }
.project-folder {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: #edf5ff;
  color: #478dd8;
  font-size: 22px;
  font-weight: 700;
}
.project-name { font-size: 17px; font-weight: 700; }
.project-meta { margin-top: 5px; color: var(--text-secondary); font-size: 13px; }
.project-action { color: #9b5f17; background: #fff0d7; border: 0; border-radius: 999px; padding: 9px 14px; cursor: pointer; }

/* 弹窗与表单 */
.modal-overlay { background: rgba(67,52,36,.24) !important; }
.modal {
  background: rgba(255,252,247,.94) !important;
  border-color: rgba(255,255,255,.82) !important;
  box-shadow: 0 24px 64px rgba(72,53,31,.2), inset 0 1px 0 rgba(255,255,255,.95) !important;
}
.modal-header { background: rgba(255,252,247,.84) !important; border-bottom-color: var(--tf-divider) !important; }
.modal-title svg { color: #b66a11; stroke: currentColor; }
.modal-close { background: rgba(255,255,255,.48); }
#detailModal .detail-swipe-hint {
  display: flex;
  margin-left: auto;
  margin-right: 10px;
  padding: 5px 9px;
  border: 1px solid rgba(182,106,17,.18);
  border-radius: 999px;
  background: rgba(255,240,215,.72);
  color: #9b5f17;
}
.detail-swipe-copy { display: none; }
#detailBody {
  scrollbar-gutter: stable;
  scrollbar-color: rgba(155,95,23,.42) transparent;
  scrollbar-width: thin;
}
#detailBody::-webkit-scrollbar { width: 9px; }
#detailBody::-webkit-scrollbar-track { background: transparent; }
#detailBody::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: rgba(155,95,23,.42);
  background-clip: padding-box;
}
#detailBody .editable-title,
#detailBody .editable-text {
  border: 1px dashed rgba(182,106,17,.28);
  background: rgba(255,250,241,.72);
}
#detailBody .editable-title { padding-right: 84px; }
#detailBody .detail-grid .editable-text { padding-right: 72px !important; }
#detailBody .detail-description-card .editable-text { padding-top: 34px !important; }
#detailBody .editable-title .edit-hint,
#detailBody .editable-text .edit-hint {
  opacity: 1;
  padding: 3px 7px;
  border: 1px solid rgba(182,106,17,.2);
  border-radius: 999px;
  background: #fff0d7;
  color: #9b5f17;
  pointer-events: none;
}
#detailBody .editable-title:hover,
#detailBody .editable-text:hover,
#detailBody .editable-title:focus-visible,
#detailBody .editable-text:focus-visible {
  border-color: rgba(182,106,17,.52);
  background: rgba(255,245,226,.92);
  box-shadow: 0 0 0 3px rgba(182,106,17,.1);
}
.detail-field,
#detailBody > .detail-title-card,
#detailBody > .detail-description-card,
#detailBody > .detail-progress-card,
.detail-grid .detail-field,
.form-tip {
  background: rgba(255,252,247,.78) !important;
  border-color: var(--tf-divider) !important;
}
.select-badge { border-color: rgba(111,92,68,.14) !important; }
.deadline-badge {
  appearance: none;
  -webkit-appearance: none;
  font-family: inherit;
}
.deadline-edit-input { min-height: 42px; background: rgba(255,252,247,.96) !important; }
.deadline-edit-actions { display: flex; gap: 7px; margin-top: 8px; }
.deadline-edit-actions .btn { flex: 1; justify-content: center; padding: 7px 10px; font-size: 12px; }
.field-edit-tip { color: #b66a11; font-weight: 600; }
.progress-drag-area { padding: 7px 0; }
.progress-drag-track { overflow: visible !important; }
.progress-range-overlay {
  position: absolute !important;
  inset: -10px 0 !important;
  z-index: 3;
  width: 100% !important;
  height: 30px !important;
  padding: 0 !important;
  border: 0 !important;
  opacity: 0 !important;
  cursor: ew-resize;
  touch-action: none;
}
.progress-drag-thumb {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 14px;
  height: 14px;
  border: 3px solid #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 2px 7px rgba(83,55,23,.28);
  pointer-events: none;
  transition: left .08s linear;
}
.progress-original-labels { display: flex; justify-content: space-between; align-items: center; margin-top: 2px; color: var(--text-muted); font-size: 11px; }
.progress-original-labels output { font-size: 14px; font-weight: 800; }
.form-input,
.login-input,
input,
select,
textarea {
  color: var(--text-primary);
  font-family: inherit;
}
#newTaskModal input,
#newTaskModal select,
#newTaskModal textarea,
#accountSettingsModal input {
  background: rgba(255,252,247,.9) !important;
  border-color: rgba(111,92,68,.18) !important;
}

/* 登录页 */
.login-overlay {
  background: rgba(245,241,234,.22) !important;
  background-image: url("assets/taskflow-warm-light-bg.png") !important;
  background-size: cover !important;
  background-position: center !important;
}
.login-card {
  width: min(92vw, 510px);
  max-width: 510px;
  padding: 38px 40px 32px;
  border-radius: 24px;
}
.login-logo { width: 58px; height: 58px; border-radius: 16px; }
.login-title { font-size: 28px; margin-top: 2px; }
.login-subtitle { color: var(--text-secondary); }
.login-input { min-height: 54px; background: rgba(255,252,247,.9); border-color: rgba(111,92,68,.18); }
.login-input:focus { border-color: #e1a24e; box-shadow: 0 0 0 4px rgba(232,173,96,.16); }
.login-btn { min-height: 54px; }
.login-error:not(:empty) {
  padding: 12px 14px;
  border: 1px solid rgba(220,69,69,.28);
  border-radius: 12px;
  background: #fbeae5;
  text-align: left;
}

.mobile-more-panel { display: none; }

button:focus-visible,
.nav-item:focus-visible,
.filter-tab:focus-visible,
.task-card:focus-visible,
.stat-card:focus-visible {
  outline: 3px solid rgba(232,173,96,.36) !important;
  outline-offset: 3px;
}

@media (max-width: 1199px) {
  .app { padding: 14px; }
  .content { padding: 24px; }
  .sidebar { width: 196px; }
  .charts-row { grid-template-columns: 1fr; }
}

@media (max-width: 767px) {
  :root { --radius: 16px; }
  html, body { height: auto; min-height: 100%; overflow: auto; }
  body { background-attachment: scroll; background-position: 42% center; }
  .app { min-height: 100dvh; height: auto; padding: 0; gap: 0; }
  .topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    height: 68px;
    flex-basis: 68px;
    border: 0 !important;
    border-bottom: 1px solid var(--tf-divider) !important;
    border-radius: 0;
    padding: 0 16px;
  }
  .logo-icon { display: none; }
  .logo-text { font-size: 20px; }
  .topbar-right { gap: 8px; }
  .topbar-right .sync-status,
  .topbar-right .logout-btn,
  .topbar-right .avatar,
  .topbar-right > .icon-btn:not(.mobile-search-btn),
  .search-box { display: none !important; }
  .mobile-search-btn { display: flex !important; }
  .main { display: block; border: 0 !important; border-radius: 0; box-shadow: none !important; background: transparent !important; overflow: visible; }
  .sidebar { display: none; }
  .content {
    width: 100%;
    max-width: none;
    padding: 18px 16px calc(100px + env(safe-area-inset-bottom));
    overflow: visible;
  }
  .page-header { min-height: 58px; margin-bottom: 14px; flex-direction: row; align-items: flex-start; }
  .page-title { font-size: 24px; }
  .page-date { font-size: 12px; gap: 4px; }
  .header-actions { width: auto; gap: 8px; }
  .header-actions .btn-ghost { display: none; }
  .header-actions .btn-primary { width: 44px; height: 44px; padding: 0; justify-content: center; border-radius: 13px; }
  .header-actions .btn-primary { font-size: 0; }
  .header-actions .btn-primary svg { width: 20px; height: 20px; }

  .today-focus-section,
  .stats-row,
  .tasks-section,
  .projects-section,
  .chart-card {
    -webkit-backdrop-filter: blur(12px) saturate(108%);
    backdrop-filter: blur(12px) saturate(108%);
  }
  .today-focus-section { padding: 14px 14px 2px; border-radius: 16px; }
  .today-focus-header { margin-bottom: 6px; }
  .today-focus-title { font-size: 17px; }
  .today-focus-hint { display: none; }
  .today-focus-cards .task-card,
  .task-cards .task-card {
    min-height: 0;
    padding: 14px 4px;
  }
  .task-top { align-items: center; }
  .task-desc,
  .task-progress,
  .task-source { display: none; }
  .task-name { font-size: 14px; margin-bottom: 8px; }
  .task-meta { font-size: 11px; }
  .task-tag { display: none; }
  .status-segment { padding: 2px; }
  .seg-btn { width: 30px; height: 30px; min-height: 30px; }

  .stats-row {
    grid-template-columns: repeat(4, minmax(0,1fr));
    gap: 0;
    border-radius: 16px;
    margin-bottom: 16px;
  }
  .stats-row .stat-card {
    min-height: 76px;
    padding: 12px 6px;
    display: block;
    text-align: center;
  }
  .stat-label { justify-content: center; font-size: 10px; margin-bottom: 4px; }
  .stat-label svg { display: none; }
  .stat-value { font-size: 20px; }
  .stat-trend,
  .stat-icon { display: none !important; }

  .tasks-section { padding: 14px; border-radius: 16px; }
  .tasks-header { flex-direction: column; align-items: stretch; gap: 10px; }
  .tasks-tools { width: 100%; }
  .task-filter-btn { flex: 0 0 auto; }
  .filter-tabs { width: 100%; display: grid; grid-template-columns: repeat(5, max-content); overflow-x: auto; }
  .filter-tab { padding: 8px 12px; }
  .charts-row { gap: 12px; }
  .chart-card { min-height: 230px; border-radius: 16px; }

  #detailModal .modal,
  #newTaskModal .modal,
  #accountSettingsModal .modal {
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border: 0 !important;
    border-radius: 0;
    margin: 0;
  }
  .modal-overlay.show { padding: 0 !important; }
  .modal-header { min-height: 64px; }
  .modal-body { padding: 18px 16px; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-actions { padding-bottom: env(safe-area-inset-bottom); }
  .detail-swipe-copy { display: inline; }
  #detailModal .detail-swipe-hint { padding: 5px 7px; font-size: 10px; }

  .login-card { width: calc(100% - 32px); padding: 32px 22px 28px; }
  .login-title { font-size: 24px; }
  .login-subtitle { margin-bottom: 24px; }

  .mobile-bottom-nav {
    display: flex !important;
    left: 16px;
    right: 16px;
    bottom: max(10px, env(safe-area-inset-bottom));
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    background: rgba(255,252,247,.9);
    box-shadow: 0 12px 30px rgba(83,65,43,.16), inset 0 1px 0 rgba(255,255,255,.9);
    padding: 7px 10px;
  }
  .mobile-nav-item { min-width: 78px; color: var(--text-secondary); }
  .mobile-nav-item.active { color: #a75f0e; background: #fff0d7; }

  .mobile-more-panel {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: none;
    align-items: flex-end;
    background: rgba(67,52,36,.22);
  }
  .mobile-more-panel.show { display: flex; }
  .mobile-more-card {
    width: 100%;
    padding: 18px 16px calc(22px + env(safe-area-inset-bottom));
    border-radius: 24px 24px 0 0;
    animation: tfSheetIn .2s ease-out both;
  }
  .mobile-more-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
  .mobile-more-head strong { display: block; font-size: 22px; }
  .mobile-more-head span { color: var(--text-muted); font-size: 12px; }
  .more-row {
    width: 100%;
    min-height: 54px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--tf-divider);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
  }
  .more-row.danger { color: var(--danger); }
}

@keyframes tfSheetIn {
  from { transform: translateY(24px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .topbar, .main, .today-focus-section, .stats-row, .chart-card, .tasks-section, .projects-section, .login-card, .mobile-more-card {
    background: #fffcf7 !important;
  }
}
