/* ============================================================
   设计变量
============================================================ */
:root {
  --bg: #f3f2ee;
  --panel: #fffefa;
  --panel-muted: #f7f6f1;
  --border: #e6e3da;
  --border-strong: #d5d1c6;
  --ink: #1c1c18;
  --ink-2: #5b5952;
  --ink-3: #8d8a80;
  --accent: #136b5b;
  --accent-hover: #0e5649;
  --accent-soft: #e3f0ec;
  --accent-ink: #0b4a3f;
  --on-accent: #ffffff;
  --danger: #b23a2e;
  --danger-soft: #fbe9e6;
  --warn: #a35c11;
  --warn-soft: #fcf0dd;
  --blue: #2d5bd1;
  --blue-soft: #e9eefb;
  --shadow-sm: 0 1px 2px rgba(28, 28, 24, 0.05);
  --shadow-md: 0 10px 30px rgba(28, 28, 24, 0.08);
  --shadow-lg: 0 28px 70px rgba(28, 28, 24, 0.2);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101210;
    --panel: #191b18;
    --panel-muted: #20231f;
    --border: #2c302a;
    --border-strong: #3d423a;
    --ink: #eceae3;
    --ink-2: #a9a79e;
    --ink-3: #7d7b72;
    --accent: #45b8a4;
    --accent-hover: #63cbb8;
    --accent-soft: #16332d;
    --accent-ink: #b8ebdf;
    --on-accent: #06231d;
    --danger: #e37d72;
    --danger-soft: #371e1b;
    --warn: #e0a35e;
    --warn-soft: #362716;
    --blue: #82a4fa;
    --blue-soft: #1b2540;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.45);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 28px 70px rgba(0, 0, 0, 0.65);
    color-scheme: dark;
  }
}

/* ============================================================
   基础
============================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
p,
ul {
  margin: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

::selection {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

[hidden] {
  display: none !important;
}

/* 滚动条 */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 99px;
}
::-webkit-scrollbar-track {
  background: transparent;
}

/* ============================================================
   通用按钮 / 表单
============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 40px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--ink);
  font-size: 14px;
  font-weight: 550;
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.btn:hover {
  background: var(--panel-muted);
  border-color: var(--border-strong);
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.55;
  pointer-events: none;
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--ink-2);
}

.btn-ghost:hover {
  background: var(--panel-muted);
  border-color: var(--border);
  color: var(--ink);
}

.btn-danger {
  color: var(--danger);
  border-color: transparent;
  background: transparent;
}

.btn-danger:hover {
  background: var(--danger-soft);
  border-color: transparent;
}

.btn-block {
  width: 100%;
  height: 44px;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-2);
  transition: background 0.15s ease, color 0.15s ease;
}

.icon-btn:hover {
  background: var(--panel-muted);
  color: var(--ink);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.field > span {
  font-size: 13px;
  font-weight: 550;
  color: var(--ink-2);
}

.field > span em {
  color: var(--danger);
  font-style: normal;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--panel);
  color: var(--ink);
  font-size: 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field textarea {
  resize: vertical;
  min-height: 76px;
  line-height: 1.55;
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--ink-3);
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.field-row-3 {
  grid-template-columns: repeat(3, 1fr);
}

.form-error {
  min-height: 20px;
  margin-top: 2px;
  color: var(--danger);
  font-size: 13px;
}

/* ============================================================
   登录
============================================================ */
.login-screen {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(900px 480px at 50% -12%, var(--accent-soft), transparent 65%),
    radial-gradient(700px 400px at 100% 110%, var(--blue-soft), transparent 65%),
    var(--bg);
}

.login-card {
  width: min(400px, 100%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 38px 34px 30px;
  box-shadow: var(--shadow-md);
  text-align: center;
}

.login-title {
  margin-top: 18px;
  font-size: 24px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.login-sub {
  margin-top: 4px;
  color: var(--ink-3);
  font-size: 14px;
}

.login-field {
  margin-top: 26px;
  text-align: left;
}

.login-card .btn-block {
  margin-top: 6px;
}

.login-foot {
  margin-top: 22px;
  color: var(--ink-3);
  font-size: 12px;
  letter-spacing: 0.02em;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(150deg, #17876f, #0b463c);
  color: #fff;
  box-shadow: 0 4px 12px rgba(19, 107, 91, 0.3);
}

.brand-mark svg {
  width: 22px;
  height: 22px;
  stroke-width: 1.7;
}

.brand-mark-lg {
  width: 56px;
  height: 56px;
  border-radius: 17px;
  margin: 0 auto;
}

.brand-mark-lg svg {
  width: 32px;
  height: 32px;
}

/* ============================================================
   应用骨架
============================================================ */
.app {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  height: 100dvh;
  overflow: hidden;
}

/* ---------- 侧栏 ---------- */
.sidebar {
  position: relative;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 20px 14px 16px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 2px 8px 6px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-text strong {
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.brand-text span {
  margin-top: 3px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--ink-3);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 9px 11px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 550;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-item svg {
  width: 17px;
  height: 17px;
  color: var(--ink-3);
}

.nav-item:hover {
  background: var(--panel-muted);
  color: var(--ink);
}

.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.nav-item.active svg {
  color: var(--accent);
}

.nav-count {
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.nav-item.active .nav-count {
  color: var(--accent);
}

.side-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
}

.side-title {
  padding: 0 11px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.08em;
  color: var(--ink-3);
}

.side-links {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.side-link {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 11px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-2);
  font-size: 13.5px;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
}

.side-link svg {
  width: 15px;
  height: 15px;
  color: var(--ink-3);
}

.side-link:hover {
  background: var(--panel-muted);
  color: var(--ink);
}

.side-link.active {
  background: var(--panel-muted);
  color: var(--accent);
  font-weight: 550;
}

.side-link .side-count {
  margin-left: auto;
  font-size: 12px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.side-link .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--border-strong);
  flex: none;
}

.side-link.active .dot {
  background: var(--accent);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.sidebar-backdrop {
  display: none;
}

/* ---------- 主区域 ---------- */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100dvh;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 72px;
  padding: 12px clamp(18px, 2.6vw, 34px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
}

.menu-btn {
  display: none;
}

.topbar-title {
  min-width: 0;
}

.topbar-title h1 {
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-title p {
  margin-top: 1px;
  font-size: 12.5px;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  width: 220px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--ink-3);
  transition: border-color 0.15s ease, width 0.2s ease;
}

.search:focus-within {
  border-color: var(--accent);
}

.search svg {
  width: 15px;
  height: 15px;
}

.search input {
  width: 100%;
  border: none;
  background: transparent;
  outline: none;
  font-size: 13.5px;
}

.search input::-webkit-search-cancel-button {
  display: none;
}

/* ---------- 视图 ---------- */
.view {
  flex: 1;
  overflow-y: auto;
  padding: 24px clamp(18px, 2.6vw, 34px) 60px;
  scroll-behavior: smooth;
}

/* ============================================================
   任务视图
============================================================ */
.stat-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 15px 17px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
}

.stat-label {
  font-size: 12.5px;
  font-weight: 550;
  color: var(--ink-3);
}

.stat-value {
  font-size: 27px;
  font-weight: 650;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.stat-hint {
  font-size: 11.5px;
  color: var(--ink-3);
}

.stat-icon {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--panel-muted);
  color: var(--ink-3);
}

.stat-icon svg {
  width: 15px;
  height: 15px;
}

.stat-card.accent .stat-icon {
  background: var(--accent-soft);
  color: var(--accent);
}

.stat-card.danger .stat-icon {
  background: var(--danger-soft);
  color: var(--danger);
}

.stat-card.danger .stat-value {
  color: var(--danger);
}

.stat-card.blue .stat-icon {
  background: var(--blue-soft);
  color: var(--blue);
}

/* ---------- 筛选 ---------- */
.filters-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.chips {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  scrollbar-width: none;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 550;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}

.chip:hover {
  background: var(--panel-muted);
  color: var(--ink);
}

.chip.active {
  background: var(--accent);
  color: var(--on-accent);
}

.chip .chip-count {
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  opacity: 0.62;
}

.chip.overdue-chip .chip-count {
  color: var(--danger);
  opacity: 1;
}

.chip.active.overdue-chip {
  background: var(--danger);
  color: #fff;
}

.chip.active.overdue-chip .chip-count {
  color: #fff;
}

.filters-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.month-input {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--ink-3);
  box-shadow: var(--shadow-sm);
}

.month-input:focus-within {
  border-color: var(--accent);
}

.month-input svg {
  width: 15px;
  height: 15px;
}

.month-input select {
  width: 128px;
  padding: 0 18px 0 0;
  border: none;
  background: transparent;
  outline: none;
  font-size: 13px;
  color: var(--ink-2);
  appearance: none;
  cursor: pointer;
}

/* ---------- 任务列表 ---------- */
.task-list {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px 9px;
  background: var(--panel-muted);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: var(--ink-2);
}

.group-header:not(:first-child) {
  border-top: 1px solid var(--border);
}

.group-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink-3);
}

.group-dot.doing {
  background: var(--blue);
}
.group-dot.done {
  background: var(--accent);
}
.group-dot.blocked {
  background: var(--danger);
}

.group-count {
  margin-left: auto;
  font-weight: 550;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.task-row {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.13s ease;
}

.task-row:last-child {
  border-bottom: none;
}

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

.task-check {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 1.5px solid var(--border-strong);
  border-radius: 6px;
  background: transparent;
  color: transparent;
  flex: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.task-check svg {
  width: 12px;
  height: 12px;
  stroke-width: 2.6;
}

.task-check:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.task-check.checked {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.task-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.task-title {
  font-size: 14.5px;
  font-weight: 550;
  letter-spacing: -0.005em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-row.is-done .task-title {
  color: var(--ink-3);
  text-decoration: line-through;
  text-decoration-color: var(--border-strong);
}

.task-meta {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--ink-3);
}

.task-meta .pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-meta .pill svg {
  width: 12px;
  height: 12px;
}

.task-meta .tag {
  color: var(--ink-3);
}

.task-side {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: none;
}

.priority-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--panel-muted);
  color: var(--ink-3);
}

.priority-badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.priority-badge.high {
  background: var(--danger-soft);
  color: var(--danger);
}

.priority-badge.medium {
  background: var(--warn-soft);
  color: var(--warn);
}

.due-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  min-width: 70px;
  justify-content: flex-end;
}

.due-pill.overdue {
  color: var(--danger);
  font-weight: 600;
}

.due-pill.today {
  color: var(--warn);
  font-weight: 600;
}

.hours {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  min-width: 44px;
  justify-content: flex-end;
}

.hours svg {
  width: 12px;
  height: 12px;
}

.row-edit {
  opacity: 0;
  transition: opacity 0.15s ease;
}

.task-row:hover .row-edit,
.task-row:focus-within .row-edit {
  opacity: 1;
}

/* 空状态 */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 70px 24px;
  text-align: center;
  color: var(--ink-3);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
}

.empty-state svg {
  width: 34px;
  height: 34px;
  color: var(--border-strong);
}

.empty-state strong {
  color: var(--ink-2);
  font-size: 15px;
  font-weight: 600;
}

.empty-state p {
  font-size: 13px;
  max-width: 320px;
}

.more-row {
  display: flex;
  justify-content: center;
  padding: 12px;
  border-bottom: 1px solid var(--border);
}

.more-row button {
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: 13px;
  font-weight: 550;
  padding: 6px 14px;
  border-radius: 8px;
}

.more-row button:hover {
  background: var(--accent-soft);
}

/* ============================================================
   月报
============================================================ */
.report-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.month-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.month-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 148px;
  line-height: 1.3;
}

.month-display strong {
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.month-display span {
  font-size: 11.5px;
  color: var(--ink-3);
}

.report-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.kpi-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}

.kpi {
  flex: 1 1 158px;
  min-width: 0;
  padding: 15px 17px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
}

.kpi-label {
  font-size: 12.5px;
  font-weight: 550;
  color: var(--ink-3);
}

.kpi-value {
  margin-top: 4px;
  font-size: 26px;
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.kpi-value small {
  margin-left: 3px;
  font-size: 13px;
  font-weight: 550;
  color: var(--ink-3);
  letter-spacing: 0;
}

.kpi.accent-kpi {
  background: linear-gradient(165deg, var(--accent-soft), var(--panel) 75%);
  border-color: color-mix(in srgb, var(--accent) 22%, var(--border));
}

.kpi.accent-kpi .kpi-value {
  color: var(--accent-ink);
}

.kpi-sub {
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--ink-3);
}

.card {
  padding: 18px 20px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.card-head h2 {
  font-size: 14.5px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.card-sub {
  font-size: 12px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.summary-card {
  position: relative;
  margin-bottom: 14px;
  padding-left: 22px;
  overflow: hidden;
}

.summary-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--accent);
}

.summary-text {
  font-size: 14.5px;
  line-height: 1.7;
  color: var(--ink-2);
}

.summary-meta {
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--ink-3);
}

.report-columns {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

.report-columns.even {
  grid-template-columns: 1fr 1fr;
}

/* 每日完成图 */
.daily-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 158px;
  padding-top: 8px;
  border-bottom: 1px solid var(--border);
}

.bar-col {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.bar-col .bar {
  width: 100%;
  max-width: 18px;
  min-height: 2px;
  border-radius: 4px 4px 2px 2px;
  background: var(--accent);
  opacity: 0.82;
  transition: opacity 0.15s ease;
}

.bar-col .bar.zero {
  background: var(--border);
  opacity: 1;
}

.bar-col:hover .bar:not(.zero) {
  opacity: 1;
}

.daily-labels {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}

.daily-labels span {
  flex: 1;
  text-align: center;
  font-size: 10px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}

.chart-empty,
.list-empty {
  display: grid;
  place-items: center;
  min-height: 120px;
  color: var(--ink-3);
  font-size: 13px;
  text-align: center;
}

/* 横向条形图 */
.bar-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bar-item {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

.bar-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-2);
}

.bar-track {
  height: 8px;
  border-radius: 99px;
  background: var(--panel-muted);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--accent);
  opacity: 0.85;
  min-width: 3px;
}

.bar-fill.alt {
  background: var(--blue);
}

.bar-value {
  font-size: 12px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.bar-value b {
  color: var(--ink-2);
  font-weight: 600;
}

/* 优先级 */
.priority-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.priority-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

.priority-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 550;
  color: var(--ink-2);
}

.priority-tag::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink-3);
}

.priority-tag.high::before {
  background: var(--danger);
}
.priority-tag.medium::before {
  background: var(--warn);
}
.priority-tag.low::before {
  background: var(--blue);
}

/* 完成清单 */
.done-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  max-height: 420px;
  overflow-y: auto;
  margin: 0 -6px;
}

.done-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 6px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}

.done-item:last-child {
  border-bottom: none;
}

.done-date {
  flex: none;
  width: 58px;
  font-size: 11.5px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.done-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.done-title {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.done-meta {
  font-size: 11.5px;
  color: var(--ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.done-hours {
  flex: none;
  font-size: 12px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

/* 逾期 */
.overdue-card {
  border-color: color-mix(in srgb, var(--danger) 26%, var(--border));
}

.overdue-card .card-head h2 {
  color: var(--danger);
}

.overdue-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}

.overdue-item:last-child {
  border-bottom: none;
}

.overdue-item .overdue-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.overdue-item .overdue-days {
  flex: none;
  font-size: 11.5px;
  color: var(--danger);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.report-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 64px 24px;
  text-align: center;
  color: var(--ink-3);
  background: var(--panel);
  border: 1px dashed var(--border-strong);
  border-radius: 16px;
}

.report-empty strong {
  color: var(--ink-2);
  font-size: 16px;
}

.report-empty p {
  font-size: 13px;
}

.report-loading {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.skeleton {
  border-radius: 14px;
  background: linear-gradient(100deg, var(--panel-muted) 30%, var(--panel) 50%, var(--panel-muted) 70%);
  background-size: 300% 100%;
  animation: shimmer 1.3s infinite linear;
}

@keyframes shimmer {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: -100% 0;
  }
}

/* ============================================================
   对话框
============================================================ */
dialog {
  width: min(640px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

dialog::backdrop {
  background: rgba(18, 20, 17, 0.48);
  backdrop-filter: blur(3px);
}

dialog[open] {
  animation: dialog-in 0.18s ease;
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

#task-form {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 48px);
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border);
}

.dialog-head h2 {
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.dialog-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px 22px;
  overflow-y: auto;
}

.dialog-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  background: var(--panel-muted);
}

.dialog-foot-right {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

/* 分段控件 */
.segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 3px;
  padding: 3px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--panel-muted);
}

.seg {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 550;
  color: var(--ink-2);
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.seg input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.seg:hover {
  color: var(--ink);
}

.seg:has(input:checked) {
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.seg-high:has(input:checked) {
  color: var(--danger);
}
.seg-medium:has(input:checked) {
  color: var(--warn);
}
.seg-low:has(input:checked) {
  color: var(--blue);
}

/* ============================================================
   Toast
============================================================ */
.toast-wrap {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 18px;
  border-radius: 99px;
  background: var(--ink);
  color: var(--bg);
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: toast-in 0.2s ease;
}

.toast.error {
  background: var(--danger);
  color: #fff;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ============================================================
   响应式
============================================================ */
@media (max-width: 1080px) {
  .kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .report-columns {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 960px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 278px;
    transform: translateX(-103%);
    transition: transform 0.22s cubic-bezier(0.2, 0.9, 0.3, 1);
    box-shadow: var(--shadow-lg);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 15;
    background: rgba(16, 18, 15, 0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
  }

  .sidebar-backdrop.show {
    opacity: 1;
    pointer-events: auto;
  }

  .menu-btn {
    display: grid;
  }

  .topbar {
    min-height: 64px;
  }
}

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

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .search {
    width: 40px;
    padding: 0;
    justify-content: center;
    cursor: text;
  }

  .search input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
  }

  .search:focus-within {
    width: min(220px, 52vw);
    padding: 0 12px;
    justify-content: flex-start;
  }

  .search:focus-within input {
    position: static;
    width: 100%;
    height: auto;
    opacity: 1;
  }

  .btn-label {
    display: none;
  }

  .btn-primary .btn-label {
    display: inline;
  }

  .report-actions .btn {
    padding: 0 10px;
  }

  .field-row,
  .field-row-3 {
    grid-template-columns: 1fr;
  }

  .task-side .hours {
    display: none;
  }

  .due-pill {
    min-width: 0;
  }

  .chips {
    flex-wrap: wrap;
  }

  .filters-right {
    width: auto;
    margin-left: 0;
  }

  .month-input {
    flex: none;
  }

  .view {
    padding-bottom: 40px;
  }

  .report-toolbar {
    gap: 10px;
  }

  .report-actions {
    margin-left: 0;
    width: 100%;
    justify-content: flex-end;
  }
}

@media (max-width: 520px) {
  .topbar-actions {
    gap: 6px;
  }

  .topbar {
    padding: 10px 14px;
  }

  .view {
    padding: 16px 14px 40px;
  }

  .task-row {
    padding: 12px 14px;
    gap: 10px;
  }

  .task-side {
    gap: 8px;
  }

  .priority-badge {
    display: none;
  }

  .row-edit {
    display: none;
  }

  .done-date {
    width: 50px;
  }

  .stat-value {
    font-size: 23px;
  }

  .dialog-body {
    padding: 16px;
  }

  .dialog-head,
  .dialog-foot {
    padding-inline: 16px;
  }

  .month-display {
    min-width: 120px;
  }
}

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

/* ============================================================
   补充细节
============================================================ */
.side-empty {
  padding: 6px 11px;
  font-size: 12.5px;
  color: var(--ink-3);
}

.side-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-meta .desc-pill {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@keyframes shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}

.login-card.shake {
  animation: shake 0.4s ease;
}

@media (max-width: 720px) {
  .task-meta .desc-pill {
    display: none;
  }
}
