      /* 统计页高度随内容自适应：窗口过矮时整页滚动，避免趋势图被 flex 压缩裁切 */
      #statsScreen {
        height: auto;
        min-height: calc(100vh - 64px);
        flex-shrink: 0;
      }

      .stats-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 24px;
        margin-bottom: 24px;
      }

      .stats-card {
        background: var(--panel);
        border: 1px solid var(--line);
        box-shadow: var(--shadow);
        border-radius: 22px;
        padding: 24px;
        position: relative;
        overflow: hidden;
        transition: transform 200ms ease, box-shadow 200ms ease;
      }

      .stats-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 28px 70px rgba(0, 100, 150, 0.2);
      }

      .stats-card::after {
        content: "";
        position: absolute;
        top: 0;
        right: 0;
        width: 60%;
        height: 60%;
        background: radial-gradient(ellipse at top right, rgba(124, 77, 255, 0.06) 0%, transparent 60%);
        pointer-events: none;
        border-radius: 0 28px 0 0;
      }

      .stats-card.daily::after {
        background: radial-gradient(ellipse at top right, rgba(0, 188, 212, 0.08) 0%, transparent 60%);
      }

      .stats-card.monthly::after {
        background: radial-gradient(ellipse at top right, rgba(124, 77, 255, 0.08) 0%, transparent 60%);
      }

      .stats-card.chart-card {
        grid-column: 1 / -1;
        padding: 12px;
      }

      .chart-card .stats-card-header {
        margin-bottom: 8px;
      }

      .chart-card .stats-card-header h3 {
        font-size: 15px;
      }

      .stats-card-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 20px;
      }

      .stats-card-header h3 {
        margin: 0;
        font-size: 18px;
        color: var(--text);
      }

      .stats-date {
        font-size: 14px;
        color: var(--muted);
      }

      .stats-period {
        font-size: 13px;
        color: var(--muted);
        margin-left: 12px;
        padding: 4px 10px;
        background: rgba(0, 188, 212, 0.1);
        border-radius: 8px;
        display: inline-block;
      }

      .stats-period-remain {
        font-size: 11px;
        color: rgba(255, 152, 0, 0.55);
        margin-left: 8px;
        letter-spacing: 0.5px;
        vertical-align: middle;
      }

      .stats-numbers {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 20px;
      }

      .stat-box {
        text-align: center;
        padding: 20px;
        border-radius: 20px;
        background: rgba(255, 255, 255, 0.6);
      }

      .stat-box.new {
        background: linear-gradient(135deg, rgba(255, 107, 107, 0.15) 0%, rgba(255, 107, 107, 0.05) 100%);
        border: 1px solid rgba(255, 107, 107, 0.3);
        box-shadow: 0 4px 15px rgba(255, 107, 107, 0.1);
      }

      .stat-box.closed {
        background: linear-gradient(135deg, rgba(0, 191, 165, 0.15) 0%, rgba(0, 191, 165, 0.05) 100%);
        border: 1px solid rgba(0, 191, 165, 0.3);
        box-shadow: 0 4px 15px rgba(0, 191, 165, 0.1);
      }

      .stat-number {
        display: block;
        font-size: 42px;
        font-weight: 700;
        line-height: 1;
        margin-bottom: 8px;
      }

      .stat-box.new .stat-number {
        background: linear-gradient(135deg, #ff6b6b, #ff5252);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
      }

      .stat-box.closed .stat-number {
        background: linear-gradient(135deg, #26d9b8, #00bfa5);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
      }

      .stat-label {
        font-size: 14px;
        color: var(--muted);
      }

      .stats-header-side {
        display: flex;
        align-items: center;
        gap: 10px;
      }

      .stats-mini-btn {
        font-size: 12px;
        line-height: 1;
        padding: 5px 12px;
        border-radius: 999px;
        border: 1px solid rgba(0, 150, 200, 0.35);
        background: transparent;
        color: #0a7ea4;
        cursor: pointer;
        transition: background 120ms ease, border-color 120ms ease;
      }

      .stats-mini-btn:hover {
        background: rgba(0, 150, 200, 0.1);
        border-color: rgba(0, 150, 200, 0.6);
      }

      .stat-delta {
        display: block;
        margin-top: 7px;
        font-size: 12px;
        line-height: 1.2;
        color: var(--muted);
        min-height: 14px;
      }

      .stat-delta.up { color: #00947f; }

      .stat-delta.down { color: #e05a5a; }

      .stats-caption {
        grid-column: 1 / -1;
        text-align: center;
        font-size: 12px;
        color: var(--muted);
        margin-top: -6px;
      }

      .favorite-loading {
        padding: 48px 0;
        text-align: center;
        font-size: 13px;
        color: var(--muted);
        animation: favoritePulse 1.2s ease-in-out infinite;
      }

      @keyframes favoritePulse {
        0%, 100% { opacity: 0.4; }
        50% { opacity: 1; }
      }

      .chart-container {
        padding: 16px 14px 10px;
        position: relative;
        border-radius: 16px;
        border: 1px solid var(--line);
      }

      .chart-main {
        display: flex;
        align-items: stretch;
        position: relative;
      }

      .chart-y-axis {
        width: 36px;
        flex-shrink: 0;
        position: relative;
        font-size: 12px;
        font-weight: 500;
        color: var(--muted);
        line-height: 1;
        pointer-events: none;
        user-select: none;
      }

      .chart-y-label {
        position: absolute;
        right: 8px;
        transform: translateY(-50%);
        font-variant-numeric: tabular-nums;
      }

      .chart-svg-wrap {
        flex: 1;
        min-width: 0;
        position: relative;
      }

      .chart-svg {
        width: 100%;
        height: auto;
        display: block;
        overflow: visible;
      }

      .chart-line {
        fill: none;
        stroke-width: 2.5;
        stroke-linecap: round;
        stroke-linejoin: round;
      }

      .chart-line.new {
        stroke: url(#lineGradientNew);
      }

      .chart-line.closed {
        stroke: url(#lineGradientClosed);
      }

      .chart-area {
        opacity: 1;
      }

      .chart-area.new {
        fill: url(#areaGradientNew);
      }

      .chart-area.closed {
        fill: url(#areaGradientClosed);
      }

      .chart-dot {
        r: 3;
        stroke-width: 2;
        stroke: var(--panel);
        cursor: pointer;
        opacity: 0;
        transition: opacity 150ms ease, r 150ms cubic-bezier(0.4, 0, 0.2, 1);
      }

      .chart-dot.active,
      .chart-dot.today {
        opacity: 1;
      }

      .chart-dot.active {
        r: 4.5;
        stroke-width: 2.5;
      }

      .chart-dot.new {
        fill: #ff6b6b;
      }

      .chart-dot.closed {
        fill: #26d9b8;
      }

      .chart-grid-line.baseline {
        stroke: rgba(148, 163, 184, 0.3);
        stroke-dasharray: none;
      }

      .chart-dot-halo {
        fill: none;
        stroke-width: 1.5;
        opacity: 0;
        pointer-events: none;
      }

      .chart-dot-halo.new { stroke: #ff6b6b; }

      .chart-dot-halo.closed { stroke: #00bfa5; }

      @media (prefers-reduced-motion: no-preference) {
        .chart-dot-halo.on {
          animation: chartHalo 2.4s ease-out infinite;
        }
      }

      @keyframes chartHalo {
        0% { r: 4; opacity: 0.55; }
        75% { r: 12; opacity: 0; }
        100% { r: 12; opacity: 0; }
      }

      .chart-grid-line {
        stroke: rgba(148, 163, 184, 0.12);
        stroke-width: 1;
        stroke-dasharray: 3 3;
      }

      .chart-guide {
        stroke: rgba(148, 163, 184, 0.25);
        stroke-width: 1;
        stroke-dasharray: 3 3;
        opacity: 0;
        transition: opacity 200ms ease;
        pointer-events: none;
      }

      .chart-guide.visible {
        opacity: 1;
      }

      .chart-labels {
        position: relative;
        height: 18px;
        margin-top: 6px;
      }

      .chart-label {
        position: absolute;
        top: 0;
        transform: translateX(-50%);
        font-size: 12px;
        color: var(--muted);
        text-align: center;
        font-weight: 500;
        line-height: 1;
        transition: color 200ms ease;
        white-space: nowrap;
      }

      .chart-label:hover {
        color: #78909c;
      }

      .chart-label:first-child {
        transform: translateX(0);
      }

      .chart-label:last-child {
        transform: translateX(-100%);
      }

      .chart-label.today {
        color: #0a7ea4;
        font-weight: 600;
      }

      .chart-tooltip {
        position: absolute;
        background: rgba(255, 255, 255, 0.96);
        color: var(--text);
        border: 1px solid var(--line);
        padding: 10px 14px;
        border-radius: 12px;
        font-size: 12px;
        pointer-events: none;
        opacity: 0;
        transform: translateY(6px) scale(0.95);
        transition: opacity 180ms ease, transform 180ms cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 100;
        box-shadow: 0 12px 32px rgba(15, 40, 60, 0.14);
        min-width: 130px;
        backdrop-filter: blur(8px);
      }

      .chart-tooltip.visible {
        opacity: 1;
        transform: translateY(0) scale(1);
      }

      .chart-tooltip-date {
        font-weight: 600;
        margin-bottom: 6px;
        padding-bottom: 6px;
        border-bottom: 1px solid var(--line);
        font-size: 11px;
        color: var(--muted);
      }

      .chart-tooltip-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 16px;
        margin: 4px 0;
      }

      .chart-tooltip-label {
        display: flex;
        align-items: center;
        gap: 6px;
        color: var(--text);
      }

      .chart-tooltip-dot {
        width: 8px;
        height: 8px;
        border-radius: 50%;
      }

      .chart-tooltip-dot.new { background: #ff6b6b; }

      .chart-tooltip-dot.closed { background: #00bfa5; }

      .chart-tooltip-value {
        font-weight: 700;
        font-size: 13px;
        color: var(--text);
        font-variant-numeric: tabular-nums;
      }

      .chart-hover-area {
        fill: transparent;
        cursor: pointer;
      }

      .chart-hover-area:hover {
        fill: rgba(0, 188, 212, 0.05);
      }

      .chart-legend {
        display: flex;
        justify-content: flex-end;
        gap: 16px;
      }

      .legend-item {
        display: flex;
        align-items: center;
        gap: 6px;
        font-size: 12px;
        color: var(--muted);
        font-weight: 500;
        transition: color 200ms ease;
      }

      .legend-item:hover {
        color: var(--text);
      }

      .legend-dot {
        width: 8px;
        height: 8px;
        border-radius: 50%;
      }

      .legend-item.new .legend-dot {
        background: #ff6b6b;
      }

      .legend-item.closed .legend-dot {
        background: #00bfa5;
      }

      .stats-date-picker {
        display: flex;
        align-items: center;
        gap: 12px;
        margin-top: 24px;
        padding: 20px 24px;
        background: linear-gradient(135deg, rgba(255, 255, 255, 0.85) 0%, rgba(255, 255, 255, 0.65) 100%);
        border: 1px solid var(--line);
        box-shadow: var(--shadow);
        border-radius: 22px;
        position: relative;
        overflow: hidden;
      }

      .stats-date-picker::before {
        content: "";
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        height: 3px;
        background: linear-gradient(90deg, var(--green), var(--accent), var(--purple));
        opacity: 0.5;
      }

      .stats-date-picker label {
        margin: 0;
        font-size: 15px;
      }

      .stats-date-picker input {
        width: auto;
        min-width: 150px;
      }

