
/* Budget Page */
/* Budget Overview Card */
    .overview-card {
      border-radius: 0 var(--radius-xl) var(--radius-xl) var(--radius-xl);
      border: 1px solid var(--color-border);
      padding: 1.25rem;
      color: var(--color-text);
      margin-bottom: 1.5rem;
    }

    .overview-header {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      margin-bottom: 1rem;
    }

    .overview-header svg {
      width: 24px;
      height: 24px;
    }

    .overview-header h2 {
      font-size: 1.125rem;
      font-weight: 600;
    }

    .overview-amounts {
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
      margin-bottom: 1rem;
      gap: 1rem;
    }

    .overview-amount {
      flex: 1;
      text-align: center;
    }

    .overview-amount-label {
      font-size: 0.875rem;
      opacity: 0.9;
      margin-bottom: 0.25rem;
    }

    .overview-amount-value {
      font-size: 1.875rem;
      font-weight: 700;
    }

    .overview-amount-value.over-budget {
      color: var(--color-danger);
    }

    .overview-grid {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 1rem;
    }

    .overview-item {
      border-radius:0 var(--radius-lg) var(--radius-lg) var(--radius-lg);
      border: 1px solid var(--color-border);
      padding: 0.75rem;
    }

    .overview-item-label {
      display: flex;
      align-items: center;
      gap: 0.375rem;
      color: var(--color-tex);
      font-size: 0.875rem;
      margin-bottom: 0.25rem;
    }

    .overview-item-label svg,
    .overview-item-label img {
      width: 16px;
      height: 16px;
    }

    .overview-item-label img {
      filter: brightness(0) invert(1);
      opacity: 0.8;
    }

    .overview-item-value {
      font-size: 1.25rem;
      font-weight: 600;
    }

    .overview-item-value.over-budget {
      color: var(--color-danger);
    }

    .overview-warning {
      margin-top: 1rem;
      background: rgba(239, 68, 68, 0.3);
      border: 1px solid rgba(248, 113, 113, 0.5);
      border-radius: var(--radius-lg);
      padding: 0.75rem;
      display: flex;
      align-items: center;
      gap: 0.5rem;
      font-size: 0.875rem;
    }

    .overview-warning svg {
      width: 18px;
      height: 18px;
      flex-shrink: 0;
    }

    /* Section Header */
    .section {
      margin-bottom: 1.5rem;
    }

    .section-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 0.75rem;
    }

    .section-title {
      font-size: 1.125rem;
      font-weight: 600;
      display: flex;
      align-items: center;
      gap: 0.5rem;
    }

    .section-title svg {
      width: 20px;
      height: 20px;
    }

    .section-title .icon-monthly {
      color: var(--color-primary);
    }

    .section-title .icon-yearly {
      color: #8b5cf6;
    }

    .section-count {
      font-size: 0.875rem;
      color: var(--color-text-secondary);
    }

    /* Budget List */
    .budget-list {
      display: flex;
      flex-direction: column;
      gap: 0.75rem;
    }

    .budget-card-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 0.75rem;
    }

    .budget-card-title {
      display: flex;
      align-items: center;
      gap: 0.5rem;
    }

    .budget-card-name {
      font-size: 1.125rem;
      font-weight: 500;
    }

    .budget-card-badge {
      font-size: 0.75rem;
      padding: 0.125rem 0.5rem;
      border-radius: 9999px;
    }

    .budget-card-badge.monthly {
      background-color: #dbeafe;
      color: #1d4ed8;
    }

    .budget-card-badge.yearly {
      background-color: #ede9fe;
      color: #6d28d9;
    }

    [data-theme="dark"] .budget-card-badge.monthly {
      background-color: rgba(59, 130, 246, 0.2);
      color: #93c5fd;
    }

    [data-theme="dark"] .budget-card-badge.yearly {
      background-color: rgba(139, 92, 246, 0.2);
      color: #c4b5fd;
    }

    .budget-card-actions {
      display: flex;
      gap: 0.25rem;
    }

    .budget-card-actions button {
      padding: 0.375rem;
      border: none;
      background: none;
      cursor: pointer;
      border-radius: var(--radius-md);
      color: var(--color-text-tertiary);
      transition: all 0.2s;
    }

    @media (hover: hover) and (pointer: fine) {
      .budget-card-actions button:hover {
        background-color: var(--color-bg-tertiary);
      }

      .budget-card-actions .btn-edit:hover {
        color: var(--color-primary);
      }

      .budget-card-actions .btn-delete:hover {
        color: var(--color-danger);
      }
    }

    .budget-card-actions svg {
      width: 16px;
      height: 16px;
    }

    .budget-card-stats {
      display: flex;
      justify-content: space-between;
      font-size: 0.875rem;
      margin-bottom: 0.5rem;
    }

    .budget-card-spent {
      color: var(--color-text-secondary);
    }

    .budget-card-percent {
      font-weight: 500;
      color: var(--color-text);
    }

    .budget-card-percent.over-budget {
      color: var(--color-danger);
    }

    /* Progress Bar */
    .budget-progress-bar {
      width: 100%;
      height: 0.5rem;
      background-color: var(--color-bg-tertiary);
      border-radius: 9999px;
      overflow: visible; /* 改为 visible，让分隔线可以超出显示 */
      margin-bottom: 0.5rem;
      display: flex; /* 支持多段进度条并排显示 */
    }

    .budget-card-footer {
      display: flex;
      justify-content: space-between;
      font-size: 0.875rem;
      padding-top: 0.25rem;
    }

    .budget-card-budget {
      color: var(--color-text-secondary);
    }

    .budget-card-remaining {
      font-weight: 500;
    }

    .budget-card-remaining.positive {
      color: var(--color-success);
    }

    .budget-card-remaining.negative {
      color: var(--color-danger);
    }

    /* Unbudgeted Categories */
    .unbudgeted-item {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0.75rem;
      background-color: var(--color-bg-secondary);
      border: 1px dashed var(--color-border);
      border-radius: var(--radius-lg);
      margin-bottom: 0.5rem;
    }

    .unbudgeted-item-left {
      display: flex;
      align-items: center;
      gap: var(--spacing-sm);
    }

    .unbudgeted-item-name {
      color: var(--color-text-secondary);
    }

    .unbudgeted-item-btn {
      display: flex;
      align-items: center;
      gap: 0.25rem;
      font-size: 0.875rem;
      color: var(--color-primary);
      background: none;
      border: none;
      cursor: pointer;
      padding: 0.25rem 0.5rem;
      border-radius: var(--radius-md);
      transition: background-color 0.2s;
      flex-shrink: 0;
    }

    @media (hover: hover) and (pointer: fine) {
      .unbudgeted-item-btn:hover {
        background-color: rgba(59, 130, 246, 0.1);
      }
    }

    .unbudgeted-item-btn svg {
      width: 16px;
      height: 16px;
    }

    /* Modal Budget Form Styles */
    .form-static {
      padding: var(--spacing-sm) var(--spacing-md);
      background-color: var(--color-bg-tertiary);
      border-radius: var(--radius-lg);
      color: var(--color-text);
    }

    .mode-selector {
      display: flex;
      gap: 0.5rem;
    }


    #voice-record-btn {
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    }

    #voice-record-btn * {
    pointer-events: none; /* 关键：让子元素不接收指针事件 */
    }

    .mode-btn {
      flex: 1;
      padding: 0.5rem 1rem;
      border: 2px solid var(--color-border);
      border-radius: var(--radius-lg);
      background: none;
      cursor: pointer;
      font-size: 1rem;
      color: var(--color-text-secondary);
      transition: all 0.2s;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 0.25rem;
    }

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

    .mode-btn.active.monthly {
      border-color: var(--color-primary);
      background-color: rgba(99, 102, 241, 0.1);
      color: var(--color-primary);
    }

    .mode-btn.active.yearly {
      border-color: #8b5cf6;
      background-color: rgba(139, 92, 246, 0.1);
      color: #8b5cf6;
    }

    .form-input-with-prefix {
      position: relative;
    }

    .form-input-prefix {
      position: absolute;
      left: 0.75rem;
      top: 50%;
      transform: translateY(-50%);
      color: var(--color-text-tertiary);
    }

    .form-input-with-prefix .form-input {
      padding-left: 1.75rem;
    }

    .form-error {
      margin-top: 0.25rem;
      font-size: 0.875rem;
      color: var(--color-danger);
      display: flex;
      align-items: center;
      gap: 0.25rem;
    }

    .form-error svg {
      width: 14px;
      height: 14px;
    }

    .delete-modal-content {
      text-align: center;
      padding: 1.5rem;
    }

    .delete-modal-icon {
      width: 3rem;
      height: 3rem;
      background-color: rgba(239, 68, 68, 0.1);
      border-radius: 9999px;
      display: flex;
      align-items: center;
      justify-content: center;
      margin: 0 auto 1rem;
    }

    [data-theme="dark"] .delete-modal-icon {
      background-color: rgba(239, 68, 68, 0.2);
    }

    .delete-modal-icon svg {
      width: 24px;
      height: 24px;
      color: var(--color-danger);
    }

    .delete-modal-title {
      font-size: 1.125rem;
      font-weight: 600;
      margin-bottom: 0.5rem;
    }

    .delete-modal-message {
      color: var(--color-text-secondary);
      margin-bottom: 1.5rem;
    }

    .delete-modal-actions {
      display: flex;
      gap: 0.75rem;
    }

    /* Loading and Error States */
    .loading-container {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      min-height: 60vh;
    }

    .loading-spinner {
      width: 40px;
      height: 40px;
      border: 3px solid var(--color-border);
      border-top-color: var(--color-primary);
      border-radius: 50%;
      animation: spin 1s linear infinite;
      margin-bottom: 1rem;
    }

    @keyframes spin {
      to { transform: rotate(360deg); }
    }

    .loading-text {
      color: var(--color-text-secondary);
    }

    .error-container {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      min-height: 60vh;
      text-align: center;
      padding: 1rem;
    }

    .error-icon {
      width: 48px;
      height: 48px;
      color: var(--color-danger);
      margin-bottom: 1rem;
    }

    .error-message {
      color: var(--color-text);
      margin-bottom: 1rem;
    }

    .empty-state {
      text-align: center;
      padding: 2rem 1rem;
      color: var(--color-text-secondary);
    }


/* Reimbursement Page */
.reimbursement-summary {
      border: 1px solid var(--color-warning-light);
      border-radius: 0  var(--radius-lg) var(--radius-lg) var(--radius-lg);
      padding: var(--spacing-md);
      margin-bottom: var(--spacing-lg);
      display: flex;
      justify-content: space-between;
      align-items: center;
    }
    
    .reimbursement-summary-label {
      color: var(--color-text-secondary);
    }
    
    .reimbursement-summary-amount {
      font-size: var(--font-size-xl);
      font-weight: var(--font-weight-bold);
      color: var(--color-warning);
    }


/* Yearly Budgets Collapsible */
.yearly-budgets-section {
      margin-top: var(--spacing-md);
    }

    .yearly-budgets-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: var(--spacing-sm) var(--spacing-md);
      background-color: var(--color-bg-secondary);
      border-radius: var(--radius-md);
      cursor: pointer;
      transition: all var(--transition-fast);
      margin-bottom: 1px;
    }

    @media (hover: hover) and (pointer: fine) {
      .yearly-budgets-header:hover {
        background-color: var(--color-bg-tertiary);
      }
    }

    .yearly-budgets-title {
      font-size: var(--font-size-sm);
      font-weight: var(--font-weight-medium);
      color: var(--color-text-secondary);
    }

    .yearly-budgets-toggle-icon {
      width: 16px;
      height: 16px;
      transition: transform var(--transition-fast);
      color: var(--color-text-tertiary);
    }

    .yearly-budgets-section.expanded .yearly-budgets-toggle-icon {
      transform: rotate(180deg);
    }

    .yearly-budgets-content {
      overflow: hidden;
      transition: max-height var(--transition-base), opacity var(--transition-base);
      max-height: 0;
      opacity: 0;
    }

    .yearly-budgets-content.collapsed {
      max-height: 0;
      opacity: 0;
      overflow: hidden;
    }

    .yearly-budgets-content.expanded {
      /* max-height will be set dynamically by JavaScript */
      opacity: 1;
    }

/* Simple Budget Card */
.simple-budget-card {
  border: 1px solid var(--color-overview-card);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  color: var(--color-text);
  margin-bottom: 1.5rem;
}

.simple-budget-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.simple-budget-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
}

.simple-budget-amount {
  text-align: center;
  margin-bottom: 1.5rem;
}

.simple-budget-value {
  display: block;
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.2;
}

.simple-budget-label {
  display: block;
  font-size: 0.875rem;
  opacity: 0.8;
  margin-top: 0.25rem;
}

.simple-budget-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.simple-budget-stat {
  background: rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-lg);
  padding: 0.75rem;
  text-align: center;
}

.simple-budget-stat .stat-label {
  display: block;
  font-size: 0.75rem;
  opacity: 0.8;
  margin-bottom: 0.25rem;
}

.simple-budget-stat .stat-value {
  display: block;
  font-size: 1.125rem;
  font-weight: 600;
}

.simple-budget-remaining {
  text-align: center;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-lg);
  font-size: 1.125rem;
  font-weight: 600;
}

.simple-budget-remaining.positive {
  color: var(--color-success);
}

.simple-budget-remaining.negative {
  color: var(--color-danger);
}

/* Simple Budget Progress */
.simple-budget-progress {
  margin-bottom: 1.5rem;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  color: var(--color-text-secondary);
}

.simple-budget-progress .progress-bar {
  width: 100%;
  height: 0.75rem;
  background-color: var(--color-bg-tertiary);
  border-radius: 9999px;
  overflow: visible; /* 改为 visible，让分隔线可以超出显示 */
  display: flex; /* 支持多段进度条并排显示 */
}

.simple-budget-progress .progress-fill {
  height: 100%;
  border: 2px solid var(--color-primary);
  background-color: var(--color-bg-secondary);
  transition: width 0.5s ease-out;
  flex-shrink: 0; /* 防止压缩 */
}

.simple-budget-progress .progress-fill.over-budget {
  border-color: var(--color-danger);
}

/* 简易预算进度条分隔线 */
.simple-budget-progress .progress-fill.with-divider {
  position: relative;
  border-right-color: transparent;
}

.simple-budget-progress .progress-fill.with-divider::after {
  content: '';
  position: absolute;
  right: -2px;
  top: -6px;
  height: calc(100% + 12px);
  width: 2px;
  background-color: var(--color-primary);
}

/* Settings: Budget Mode Section */
#budget-mode-settings {
  margin-bottom: 2rem;
}

.settings-item-description-full p {
  line-height: 1.6;
}
