/* ====== CSS 变量与设计系统 ====== */
:root {
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-round: 50%;

  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);

  --font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ====== 暗色主题（晚7点 ~ 早7点） ====== */
[data-theme="dark"] {
  --bg-primary: #0f0f1a;
  --bg-secondary: #1a1a2e;
  --bg-card: #16213e;
  --bg-card-hover: #1a2744;
  --bg-modal: #1a1a2e;
  --bg-input: #0f0f1a;
  --bg-body-outer: #080810;

  --text-primary: #e8e8f0;
  --text-secondary: #a0a0b8;
  --text-muted: #6b6b80;

  --accent-milk: #4fc3f7;
  --accent-milk-light: rgba(79, 195, 247, 0.15);
  --accent-milk-glow: rgba(79, 195, 247, 0.3);
  --accent-poop: #ffb74d;
  --accent-poop-light: rgba(255, 183, 77, 0.15);
  --accent-poop-glow: rgba(255, 183, 77, 0.3);
  --accent-pee: #81c784;
  --accent-pee-light: rgba(129, 199, 132, 0.15);
  --accent-danger: #ef5350;
  --accent-danger-light: rgba(239, 83, 80, 0.15);

  --gradient-header: linear-gradient(135deg, #1a1a3e 0%, #2d1b69 50%, #1a1a3e 100%);
  --gradient-milk: linear-gradient(135deg, #1565c0, #42a5f5);
  --gradient-poop: linear-gradient(135deg, #e65100, #ffb74d);
  --gradient-milk-btn: linear-gradient(135deg, #0d47a1, #1e88e5);
  --gradient-diaper-btn: linear-gradient(135deg, #e65100, #fb8c00);

  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.3);
  --shadow-btn: 0 4px 15px rgba(0, 0, 0, 0.3);
  --shadow-modal: 0 20px 60px rgba(0, 0, 0, 0.5);
  --shadow-app-glow: 0 0 80px rgba(79, 195, 247, 0.05);

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-milk: rgba(79, 195, 247, 0.15);
  --border-poop: rgba(255, 183, 77, 0.15);

  --overlay-bg: rgba(0, 0, 0, 0.6);
  --toast-bg: rgba(40, 40, 60, 0.95);
  --btn-hover-bg: rgba(255, 255, 255, 0.06);
  --btn-active-bg: rgba(255, 255, 255, 0.12);
  --scrollbar-thumb: rgba(255, 255, 255, 0.1);

  --header-title-from: #e8e8f0;
  --header-title-to: #a0a0b8;
  --header-glow1: rgba(79, 195, 247, 0.12);
  --header-glow2: rgba(255, 183, 77, 0.1);
}

/* ====== 亮色主题（早7点 ~ 晚7点） ====== */
[data-theme="light"] {
  --bg-primary: #f7f8fc;
  --bg-secondary: #eef0f7;
  --bg-card: #ffffff;
  --bg-card-hover: #f9fafd;
  --bg-modal: #ffffff;
  --bg-input: #f1f3f9;
  --bg-body-outer: #e9ecf2;

  --text-primary: #1e2a3a;
  --text-secondary: #5a6a7e;
  --text-muted: #94a3b8;

  --accent-milk: #2196f3;
  --accent-milk-light: rgba(33, 150, 243, 0.1);
  --accent-milk-glow: rgba(33, 150, 243, 0.2);
  --accent-poop: #f57c00;
  --accent-poop-light: rgba(245, 124, 0, 0.08);
  --accent-poop-glow: rgba(245, 124, 0, 0.15);
  --accent-pee: #43a047;
  --accent-pee-light: rgba(67, 160, 71, 0.08);
  --accent-danger: #e53935;
  --accent-danger-light: rgba(229, 57, 53, 0.08);

  --gradient-header: linear-gradient(135deg, #e3ecf7 0%, #dce4f0 50%, #e8eff8 100%);
  --gradient-milk: linear-gradient(135deg, #1e88e5, #64b5f6);
  --gradient-poop: linear-gradient(135deg, #ef6c00, #ffa726);
  --gradient-milk-btn: linear-gradient(135deg, #1976d2, #42a5f5);
  --gradient-diaper-btn: linear-gradient(135deg, #ef6c00, #ffa726);

  --shadow-card: 0 1px 8px rgba(30, 42, 58, 0.06), 0 2px 4px rgba(30, 42, 58, 0.04);
  --shadow-btn: 0 3px 10px rgba(30, 42, 58, 0.1);
  --shadow-modal: 0 16px 48px rgba(30, 42, 58, 0.12);
  --shadow-app-glow: 0 0 30px rgba(30, 42, 58, 0.05);

  --border-subtle: rgba(30, 42, 58, 0.08);
  --border-milk: rgba(33, 150, 243, 0.25);
  --border-poop: rgba(245, 124, 0, 0.25);

  --overlay-bg: rgba(30, 42, 58, 0.25);
  --toast-bg: rgba(255, 255, 255, 0.96);
  --btn-hover-bg: rgba(30, 42, 58, 0.04);
  --btn-active-bg: rgba(30, 42, 58, 0.08);
  --scrollbar-thumb: rgba(30, 42, 58, 0.12);

  --header-title-from: #1e2a3a;
  --header-title-to: #5a6a7e;
  --header-glow1: rgba(33, 150, 243, 0.06);
  --header-glow2: rgba(245, 124, 0, 0.04);
}

/* ====== 全局样式 ====== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-family);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.6s ease, color 0.6s ease;
}

/* ====== 应用容器 ====== */
.app {
  max-width: 480px;
  margin: 0 auto;
  padding-bottom: 40px;
  position: relative;
}

/* ====== 头部 ====== */
.header {
  position: relative;
  padding: 48px 24px 32px;
  overflow: hidden;
}

.header-bg {
  position: absolute;
  inset: 0;
  background: var(--gradient-header);
  z-index: 0;
}

.header-bg::before {
  content: '';
  position: absolute;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, var(--header-glow1) 0%, transparent 70%);
  top: -60px;
  right: -40px;
  border-radius: 50%;
  animation: float 6s ease-in-out infinite;
}

.header-bg::after {
  content: '';
  position: absolute;
  width: 150px;
  height: 150px;
  background: radial-gradient(circle, var(--header-glow2) 0%, transparent 70%);
  bottom: -30px;
  left: -20px;
  border-radius: 50%;
  animation: float 8s ease-in-out infinite reverse;
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-20px); }
}

.header-content {
  position: relative;
  z-index: 1;
}

.header-title {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: linear-gradient(135deg, var(--header-title-from) 0%, var(--header-title-to) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-date {
  margin-top: 6px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 300;
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.theme-toggle {
  background: var(--btn-hover-bg);
  border: 1px solid var(--border-subtle);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-round);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-normal);
  flex-shrink: 0;
}

.theme-toggle:active {
  transform: scale(0.9);
  background: var(--btn-active-bg);
}

.theme-toggle-icon {
  font-size: 1.2rem;
  line-height: 1;
  transition: transform 0.4s ease;
}

.theme-toggle:active .theme-toggle-icon {
  transform: rotate(30deg);
}

/* ====== 今日摘要卡片 ====== */
.summary-section {
  padding: 0 16px;
  margin-top: -8px;
}

.summary-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.summary-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px 16px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: transform var(--transition-normal);
}

.summary-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.milk-card::before {
  background: var(--gradient-milk);
}

.poop-card::before {
  background: var(--gradient-poop);
}

.summary-card:active {
  transform: scale(0.97);
}

.card-icon {
  font-size: 1.5rem;
  margin-bottom: 8px;
}

.card-info {
  display: flex;
  align-items: baseline;
  gap: 2px;
}

.card-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
}

.milk-card .card-value { color: var(--accent-milk); }
.poop-card .card-value { color: var(--accent-poop); }

.card-unit {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 400;
}

.card-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.card-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* 上次时间提示条 */
.last-time-bar {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-top: 12px;
  box-shadow: var(--shadow-card);
}

.last-time-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.last-label {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.last-value {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.last-time-divider {
  width: 1px;
  height: 28px;
  background: var(--border-subtle);
  margin: 0 12px;
}

/* ====== 快速操作按钮 ====== */
.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 20px 16px;
}

.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 16px;
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  font-family: var(--font-family);
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
  box-shadow: var(--shadow-btn);
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.action-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(255,255,255,0.1), transparent);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.action-btn:active {
  transform: scale(0.95);
}

.action-btn:active::after {
  opacity: 1;
}

.milk-btn {
  background: var(--gradient-milk-btn);
}

.diaper-btn {
  background: var(--gradient-diaper-btn);
}

.btn-emoji {
  font-size: 2rem;
  line-height: 1;
}

.btn-text {
  font-size: 0.85rem;
}

/* ====== 记录列表 ====== */
.records-section {
  padding: 0 16px;
}

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

.section-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
}

.history-btn {
  background: var(--btn-hover-bg);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font-family);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.history-btn:active {
  background: var(--btn-active-bg);
}

.records-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.record-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: all var(--transition-fast);
  animation: slideIn 0.3s ease;
  position: relative;
  overflow: hidden;
}

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

.record-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
}

.record-item.feeding-record::before {
  background: var(--accent-milk);
}

.record-item.diaper-record::before {
  background: var(--accent-poop);
}

.record-item.diaper-record.pee-record::before {
  background: var(--accent-pee);
}

.record-emoji {
  font-size: 1.4rem;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}

.feeding-record .record-emoji {
  background: var(--accent-milk-light);
}

.diaper-record .record-emoji {
  background: var(--accent-poop-light);
}

.diaper-record.pee-record .record-emoji {
  background: var(--accent-pee-light);
}

.record-info {
  flex: 1;
  min-width: 0;
}

.record-main {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
}

.record-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.record-note {
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.record-edit,
.record-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  flex-shrink: 0;
  opacity: 0.5;
}

.record-edit {
  margin-right: 4px;
}

.record-edit:active {
  color: var(--accent-milk);
  background: var(--accent-milk-light);
  opacity: 1;
}

.record-delete:active {
  color: var(--accent-danger);
  background: var(--accent-danger-light);
  opacity: 1;
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-state p {
  font-size: 0.85rem;
  line-height: 1.5;
}

/* ====== 弹窗 ====== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--bg-modal);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform var(--transition-slow);
  box-shadow: var(--shadow-modal);
}

.modal-overlay.active .modal {
  transform: translateY(0);
}

.modal-large {
  max-height: 85vh;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 12px;
  position: sticky;
  top: 0;
  z-index: 1;
}

.milk-modal-header {
  background: var(--bg-modal);
  border-bottom: 1px solid var(--border-milk);
}

.diaper-modal-header {
  background: var(--bg-modal);
  border-bottom: 1px solid var(--border-poop);
}

.history-modal-header {
  background: var(--bg-modal);
  border-bottom: 1px solid var(--border-subtle);
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
}

.modal-close {
  background: var(--btn-hover-bg);
  border: none;
  color: var(--text-secondary);
  font-size: 1.1rem;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-round);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.modal-close:active {
  background: var(--btn-active-bg);
}

.modal-body {
  padding: 16px 20px;
}

.modal-footer {
  padding: 12px 20px 28px;
  padding-bottom: max(28px, env(safe-area-inset-bottom));
}

/* ====== 表单 ====== */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.form-input {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: var(--font-family);
  transition: border-color var(--transition-fast);
  outline: none;
}

.form-input:focus {
  border-color: var(--accent-milk);
  box-shadow: 0 0 0 3px var(--accent-milk-light);
}

/* 奶量快捷按钮 */
.quick-amount-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.quick-amount-btn {
  padding: 10px 4px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  font-family: var(--font-family);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.quick-amount-btn:active,
.quick-amount-btn.active {
  background: var(--accent-milk-light);
  border-color: var(--accent-milk);
  color: var(--accent-milk);
}

/* 奶量调整行 */
.amount-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.amount-adjust-btn {
  width: 48px;
  height: 44px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font-family);
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.amount-adjust-btn:active {
  background: var(--accent-milk-light);
  border-color: var(--accent-milk);
  color: var(--accent-milk);
}

.amount-input {
  flex: 1;
  text-align: center;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--accent-milk);
  font-size: 1.5rem;
  font-weight: 700;
  font-family: var(--font-family);
  outline: none;
  transition: border-color var(--transition-fast);
  -moz-appearance: textfield;
}

.amount-input::-webkit-inner-spin-button,
.amount-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
}

.amount-input:focus {
  border-color: var(--accent-milk);
}

/* 尿布类型选择 */
.type-select {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.type-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 8px;
  background: var(--bg-input);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-family: var(--font-family);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.type-btn.active {
  background: var(--accent-poop-light);
  border-color: var(--accent-poop);
  color: var(--accent-poop);
}

/* 喂奶类型选择 - 三列蓝色 */
.milk-type-select {
  grid-template-columns: repeat(3, 1fr);
}

.milk-type-btn.active {
  background: var(--accent-milk-light);
  border-color: var(--accent-milk);
  color: var(--accent-milk);
}

.type-emoji {
  font-size: 1.5rem;
}

/* 提交按钮 */
.submit-btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font-family);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.milk-submit {
  background: var(--gradient-milk-btn);
  box-shadow: 0 4px 15px rgba(21, 101, 192, 0.3);
}

.diaper-submit {
  background: var(--gradient-diaper-btn);
  box-shadow: 0 4px 15px rgba(230, 81, 0, 0.3);
}

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

.submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ====== 历史记录 ====== */
.history-date-picker {
  margin-bottom: 16px;
}

.history-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.history-stat {
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 10px 8px;
  text-align: center;
}

.history-stat-value {
  font-size: 1.2rem;
  font-weight: 700;
  display: block;
}

.history-stat-value.milk-color { color: var(--accent-milk); }
.history-stat-value.poop-color { color: var(--accent-poop); }
.history-stat-value.pee-color { color: var(--accent-pee); }

.history-stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
  display: block;
}

/* ====== Toast ====== */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--toast-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--text-primary);
  padding: 12px 24px;
  border-radius: var(--radius-lg);
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-subtle);
  opacity: 0;
  pointer-events: none;
  transition: all var(--transition-normal);
  z-index: 2000;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ====== 响应式 ====== */
@media (min-width: 481px) {
  body {
    background: var(--bg-body-outer);
  }
  .app {
    margin-top: 20px;
    border-radius: var(--radius-xl);
    overflow: hidden;
    background: var(--bg-primary);
    box-shadow: var(--shadow-app-glow);
    padding-bottom: 20px;
  }
  .modal {
    border-radius: var(--radius-xl);
    max-height: 80vh;
  }
  .modal-overlay {
    align-items: center;
    padding: 20px;
  }
}

/* ====== 安全区域 ====== */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .app {
    padding-bottom: calc(40px + env(safe-area-inset-bottom));
  }
}

/* ====== 滚动条 ====== */
::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 4px;
}

/* ====== 主题切换过渡 ====== */
.summary-card,
.last-time-bar,
.record-item,
.modal,
.form-input,
.quick-amount-btn,
.amount-adjust-btn,
.amount-input,
.type-btn,
.history-btn,
.history-stat,
.toast {
  transition: background 0.4s ease, border-color 0.4s ease, color 0.4s ease, box-shadow 0.4s ease;
}

/* ====== 主题指示器 ====== */
.theme-indicator {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 100;
  font-size: 1.3rem;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-round);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-card);
  cursor: default;
  transition: all 0.4s ease;
  animation: themeFadeIn 0.6s ease;
}

@keyframes themeFadeIn {
  from { opacity: 0; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1); }
}

/* 加载动画 */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.loading {
  animation: pulse 1.5s ease-in-out infinite;
}

/* ====== 数据分析样式 ====== */
.header-buttons {
  display: flex;
  gap: 8px;
}

.analytics-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 0.8rem;
  color: var(--accent-milk);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.analytics-btn:active {
  transform: scale(0.95);
}

.analytics-range-selector {
  display: flex;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 20px;
}

.range-tab {
  flex: 1;
  border: none;
  background: transparent;
  padding: 8px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  font-family: var(--font-family);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.range-tab.active {
  background: var(--bg-card);
  color: var(--accent-milk);
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  font-weight: 600;
}

.analytics-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.analytics-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 8px;
  text-align: center;
  box-shadow: var(--shadow-card);
}

.stat-num {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  display: inline-block;
}

.stat-unit {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-left: 2px;
  display: inline-block;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.analytics-section {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-card);
}

.analytics-sub-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
  margin-top: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.chart-container {
  height: 180px;
  display: flex;
  align-items: flex-end;
  padding-top: 20px;
  overflow-x: auto;
}

.chart-bars {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  width: 100%;
  min-width: 280px;
  height: 100%;
  gap: 8px;
}

.chart-bar-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
}

.chart-bar-value {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.chart-bar-outer {
  width: 16px;
  background: var(--bg-secondary);
  border-radius: 8px 8px 0 0;
  height: calc(100% - 35px);
  display: flex;
  align-items: flex-end;
}

.chart-bar {
  width: 100%;
  background: var(--accent-milk);
  border-radius: 8px 8px 0 0;
  transition: height 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  height: 0%;
}

.chart-bar-label {
  font-size: 0.65rem;
  color: var(--text-secondary);
  margin-top: 6px;
  white-space: nowrap;
}

.analytics-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ratio-progress-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ratio-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
}

.ratio-label-breast {
  color: var(--accent-milk);
  font-weight: 500;
}

.ratio-label-formula {
  color: #2e7d32;
  font-weight: 500;
}

.ratio-bar {
  height: 12px;
  border-radius: 6px;
  background: var(--bg-secondary);
  display: flex;
  overflow: hidden;
}

.ratio-bar-breast {
  background: var(--accent-milk);
  transition: width 0.6s ease;
}

.ratio-bar-formula {
  background: #4caf50;
  transition: width 0.6s ease;
}

.time-slots-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.time-slot-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
}

.time-slot-info {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
}

.time-slot-label {
  font-weight: 500;
  color: var(--text-primary);
  min-width: 32px;
}

.time-slot-bar-container {
  flex: 1;
  margin: 0 12px;
  height: 8px;
  background: var(--bg-secondary);
  border-radius: 4px;
  overflow: hidden;
}

.time-slot-bar {
  height: 100%;
  background: var(--accent-milk);
  border-radius: 4px;
  transition: width 0.6s ease;
  width: 0%;
}

.time-slot-count {
  color: var(--text-muted);
  font-size: 0.75rem;
  min-width: 30px;
  text-align: right;
}

/* 主题适配 */
[data-theme="dark"] .analytics-btn {
  color: var(--accent-milk);
}

[data-theme="dark"] .ratio-label-formula {
  color: #81c784;
}

[data-theme="dark"] .ratio-bar-formula {
  background: #81c784;
}

/* ====== 页面视图与导航样式 ====== */
.view {
  display: none;
  animation: viewFadeIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.view.active {
  display: block;
}

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

.view-body {
  padding: 16px 20px;
}

/* 返回按钮 */
.back-btn {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  outline: none;
  font-family: var(--font-family);
}

.back-btn:active {
  transform: scale(0.95);
  background: rgba(255, 255, 255, 0.25);
}

[data-theme="light"] .back-btn {
  background: rgba(30, 42, 58, 0.06);
  border-color: rgba(30, 42, 58, 0.12);
  color: var(--text-primary);
}

[data-theme="light"] .back-btn:active {
  background: rgba(30, 42, 58, 0.12);
}

/* 时间日期组合选择器 */
.datetime-picker-row {
  display: flex;
  gap: 12px;
}

.datetime-picker-row .form-input {
  flex: 1;
}
