/* 
 * 体重打卡 - 网页版高级样式
 * Material Design 3 + 现代化美学设计
 */

:root {
  /* Material Design 3 Color Tokens */
  --md-sys-color-primary: #6366f1;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-primary-container: #e0e7ff;
  --md-sys-color-on-primary-container: #1e1b16;
  --md-sys-color-secondary: #10b981;
  --md-sys-color-on-secondary: #ffffff;
  --md-sys-color-secondary-container: #ecfdf5;
  --md-sys-color-on-secondary-container: #064e3b;
  --md-sys-color-tertiary: #f59e0b;
  --md-sys-color-on-tertiary: #ffffff;
  --md-sys-color-tertiary-container: #fef3c7;
  --md-sys-color-on-tertiary-container: #92400e;
  --md-sys-color-error: #ef4444;
  --md-sys-color-on-error: #ffffff;
  --md-sys-color-error-container: #fee2e2;
  --md-sys-color-on-error-container: #991b1b;
  --md-sys-color-surface: #ffffff;
  --md-sys-color-on-surface: #1f2937;
  --md-sys-color-surface-variant: #f8fafc;
  --md-sys-color-on-surface-variant: #6b7280;
  --md-sys-color-outline: #d1d5db;
  --md-sys-color-outline-variant: #e5e7eb;
  --md-sys-color-shadow: rgba(0, 0, 0, 0.1);
  --md-sys-color-surface-tint: var(--md-sys-color-primary);

  /* Typography Scale */
  --md-sys-typescale-display-large: 57px;
  --md-sys-typescale-display-medium: 45px;
  --md-sys-typescale-display-small: 36px;
  --md-sys-typescale-headline-large: 32px;
  --md-sys-typescale-headline-medium: 28px;
  --md-sys-typescale-headline-small: 24px;
  --md-sys-typescale-title-large: 22px;
  --md-sys-typescale-title-medium: 16px;
  --md-sys-typescale-title-small: 14px;
  --md-sys-typescale-body-large: 16px;
  --md-sys-typescale-body-medium: 14px;
  --md-sys-typescale-body-small: 12px;
  --md-sys-typescale-label-large: 14px;
  --md-sys-typescale-label-medium: 12px;
  --md-sys-typescale-label-small: 11px;

  /* Elevation Shadows */
  --md-sys-elevation-level0: none;
  --md-sys-elevation-level1: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
  --md-sys-elevation-level2: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23);
  --md-sys-elevation-level3: 0 10px 20px rgba(0, 0, 0, 0.19), 0 6px 6px rgba(0, 0, 0, 0.23);
  --md-sys-elevation-level4: 0 14px 28px rgba(0, 0, 0, 0.25), 0 10px 10px rgba(0, 0, 0, 0.22);
  --md-sys-elevation-level5: 0 19px 38px rgba(0, 0, 0, 0.30), 0 15px 12px rgba(0, 0, 0, 0.22);

  /* Shape Tokens */
  --md-sys-shape-corner-none: 0px;
  --md-sys-shape-corner-extra-small: 4px;
  --md-sys-shape-corner-small: 8px;
  --md-sys-shape-corner-medium: 12px;
  --md-sys-shape-corner-large: 16px;
  --md-sys-shape-corner-extra-large: 28px;
  --md-sys-shape-corner-full: 9999px;

  /* Motion Tokens */
  --md-sys-motion-duration-short1: 50ms;
  --md-sys-motion-duration-short2: 100ms;
  --md-sys-motion-duration-short3: 150ms;
  --md-sys-motion-duration-short4: 200ms;
  --md-sys-motion-duration-medium1: 250ms;
  --md-sys-motion-duration-medium2: 300ms;
  --md-sys-motion-duration-medium3: 350ms;
  --md-sys-motion-duration-medium4: 400ms;
  --md-sys-motion-duration-long1: 450ms;
  --md-sys-motion-duration-long2: 500ms;
  --md-sys-motion-duration-long3: 550ms;
  --md-sys-motion-duration-long4: 600ms;
  --md-sys-motion-easing-standard: cubic-bezier(0.2, 0.0, 0, 1.0);
  --md-sys-motion-easing-standard-decelerate: cubic-bezier(0.0, 0.0, 0, 1.0);
  --md-sys-motion-easing-standard-accelerate: cubic-bezier(0.3, 0.0, 1.0, 1.0);
  --md-sys-motion-easing-emphasized: cubic-bezier(0.2, 0.0, 0, 1.0);

  /* Custom Layout Tokens */
  --app-sidebar-width: 280px;
  --app-header-height: 64px;
  --app-bottom-nav-height: 56px;
  --app-max-content-width: 1200px;
  --app-spacing-xs: 4px;
  --app-spacing-sm: 8px;
  --app-spacing-md: 16px;
  --app-spacing-lg: 24px;
  --app-spacing-xl: 32px;
  --app-spacing-2xl: 48px;
}

/* Dark Theme Colors */
[data-theme="dark"] {
  --md-sys-color-primary: #a5b4fc;
  --md-sys-color-on-primary: #1e1b16;
  --md-sys-color-primary-container: #3730a3;
  --md-sys-color-on-primary-container: #e0e7ff;
  --md-sys-color-secondary: #6ee7b7;
  --md-sys-color-on-secondary: #064e3b;
  --md-sys-color-secondary-container: #047857;
  --md-sys-color-on-secondary-container: #ecfdf5;
  --md-sys-color-tertiary: #fbbf24;
  --md-sys-color-on-tertiary: #92400e;
  --md-sys-color-tertiary-container: #d97706;
  --md-sys-color-on-tertiary-container: #fef3c7;
  --md-sys-color-error: #f87171;
  --md-sys-color-on-error: #991b1b;
  --md-sys-color-error-container: #dc2626;
  --md-sys-color-on-error-container: #fee2e2;
  --md-sys-color-surface: #111827;
  --md-sys-color-on-surface: #f9fafb;
  --md-sys-color-surface-variant: #1f2937;
  --md-sys-color-on-surface-variant: #9ca3af;
  --md-sys-color-outline: #4b5563;
  --md-sys-color-outline-variant: #374151;
  --md-sys-color-shadow: rgba(0, 0, 0, 0.3);
}

/* Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  line-height: 1.6;
  color: var(--md-sys-color-on-surface);
  background-color: var(--md-sys-color-surface-variant);
  font-size: var(--md-sys-typescale-body-medium);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Typography */
h1 {
  font-size: var(--md-sys-typescale-headline-large);
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: var(--app-spacing-md);
}

h2 {
  font-size: var(--md-sys-typescale-headline-medium);
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: var(--app-spacing-md);
}

h3 {
  font-size: var(--md-sys-typescale-headline-small);
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: var(--app-spacing-sm);
}

h4 {
  font-size: var(--md-sys-typescale-title-large);
  font-weight: 500;
  line-height: 1.4;
  margin-bottom: var(--app-spacing-sm);
}

h5 {
  font-size: var(--md-sys-typescale-title-medium);
  font-weight: 500;
  line-height: 1.4;
  margin-bottom: var(--app-spacing-xs);
}

h6 {
  font-size: var(--md-sys-typescale-title-small);
  font-weight: 500;
  line-height: 1.4;
  margin-bottom: var(--app-spacing-xs);
}

p {
  margin-bottom: var(--app-spacing-md);
  line-height: 1.6;
}

/* Splash Screen */
.splash-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--md-sys-color-primary) 0%, var(--md-sys-color-secondary) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity var(--md-sys-motion-duration-long2) var(--md-sys-motion-easing-standard);
}

.splash-screen.fade-out {
  opacity: 0;
  pointer-events: none;
}

.splash-content {
  text-align: center;
  color: white;
}

.app-logo {
  margin-bottom: var(--app-spacing-2xl);
}

.logo-icon {
  font-size: 64px;
  margin-bottom: var(--app-spacing-md);
  display: block;
}

.splash-content h1 {
  font-size: var(--md-sys-typescale-display-small);
  font-weight: 700;
  margin-bottom: var(--app-spacing-sm);
  color: white;
}

.splash-content p {
  font-size: var(--md-sys-typescale-body-large);
  opacity: 0.9;
  margin-bottom: 0;
}

.loading-indicator {
  margin-top: var(--app-spacing-2xl);
}

.loading-dots {
  display: flex;
  gap: var(--app-spacing-xs);
  justify-content: center;
}

.loading-dots span {
  width: 8px;
  height: 8px;
  border-radius: var(--md-sys-shape-corner-full);
  background-color: white;
  animation: loading-bounce 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }
.loading-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes loading-bounce {
  0%, 80%, 100% {
    transform: scale(0);
  }
  40% {
    transform: scale(1);
  }
}

/* Main App Layout */
.main-app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: opacity var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-standard);
}

.main-app.hidden {
  opacity: 0;
  pointer-events: none;
}

/* Header */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--app-header-height);
  background-color: var(--md-sys-color-surface);
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  z-index: 1000;
  box-shadow: var(--md-sys-elevation-level1);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 var(--app-spacing-md);
  max-width: var(--app-max-content-width);
  margin: 0 auto;
}

.header-left {
  display: flex;
  align-items: center;
}

.app-title {
  display: flex;
  align-items: center;
  gap: var(--app-spacing-sm);
}

.app-icon {
  font-size: 24px;
}

.app-title h1 {
  font-size: var(--md-sys-typescale-title-large);
  font-weight: 600;
  margin-bottom: 0;
  color: var(--md-sys-color-primary);
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--app-spacing-xs);
}

.header-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: var(--md-sys-shape-corner-full);
  background-color: transparent;
  color: var(--md-sys-color-on-surface);
  cursor: pointer;
  transition: all var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
}

.header-btn:hover {
  background-color: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}

.header-btn:active {
  background-color: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
}

.header-btn i {
  font-size: 20px;
}

/* Sidebar Navigation */
.sidebar {
  position: fixed;
  top: var(--app-header-height);
  left: 0;
  width: var(--app-sidebar-width);
  height: calc(100vh - var(--app-header-height));
  background-color: var(--md-sys-color-surface-variant);
  border-right: 1px solid var(--md-sys-color-outline-variant);
  z-index: 900;
  transform: translateX(-100%);
  transition: transform var(--md-sys-motion-duration-medium3) var(--md-sys-motion-easing-emphasized);
}

.sidebar.open {
  transform: translateX(0);
}

.sidebar-content {
  padding: var(--app-spacing-md);
  height: 100%;
  overflow-y: auto;
}

.nav-items {
  display: flex;
  flex-direction: column;
  gap: var(--app-spacing-xs);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--app-spacing-md);
  padding: var(--app-spacing-md);
  border-radius: var(--md-sys-shape-corner-medium);
  text-decoration: none;
  color: var(--md-sys-color-on-surface-variant);
  font-weight: 500;
  transition: all var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
}

.nav-item:hover {
  background-color: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}

.nav-item.active {
  background-color: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
}

.nav-item i {
  font-size: 24px;
}

/* Main Content Area */
.main-content {
  margin-top: var(--app-header-height);
  padding: var(--app-spacing-lg);
  max-width: var(--app-max-content-width);
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

.content-section,
.tab-content {
  display: none;
  animation: fadeInUp var(--md-sys-motion-duration-medium3) var(--md-sys-motion-easing-standard);
}

.content-section.active,
.tab-content.active {
  display: block;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Cards */
.card {
  background-color: var(--md-sys-color-surface);
  border-radius: var(--md-sys-shape-corner-large);
  padding: var(--app-spacing-lg);
  box-shadow: var(--md-sys-elevation-level1);
  border: 1px solid var(--md-sys-color-outline-variant);
  transition: all var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
  margin-bottom: var(--app-spacing-lg);
}

.card:hover {
  box-shadow: var(--md-sys-elevation-level2);
}

.card-header {
  display: flex;
  align-items: center;
  gap: var(--app-spacing-md);
  margin-bottom: var(--app-spacing-lg);
  padding-bottom: var(--app-spacing-md);
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.card-header i {
  font-size: 24px;
  color: var(--md-sys-color-primary);
}

.card-header h3 {
  margin-bottom: 0;
  color: var(--md-sys-color-on-surface);
}

.card-content {
  color: var(--md-sys-color-on-surface-variant);
}

/* Metrics Cards */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--app-spacing-md);
  margin-bottom: var(--app-spacing-2xl);
}

@media (max-width: 1024px) {
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .metrics-grid {
    grid-template-columns: 1fr;
  }
}

.metric-card {
  background: linear-gradient(135deg, var(--md-sys-color-primary-container) 0%, var(--md-sys-color-secondary-container) 100%);
  border-radius: var(--md-sys-shape-corner-large);
  padding: var(--app-spacing-md);
  position: relative;
  overflow: hidden;
  min-height: 120px;
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 100px;
  height: 100px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--md-sys-shape-corner-full);
  transform: translate(30px, -30px);
}

.metric-header {
  display: flex;
  align-items: center;
  gap: var(--app-spacing-sm);
  margin-bottom: var(--app-spacing-md);
}

.metric-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--md-sys-shape-corner-medium);
  background-color: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.metric-icon i {
  font-size: 20px;
  color: white;
}

.metric-title {
  font-size: var(--md-sys-typescale-body-large);
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
}

.metric-value {
  font-size: var(--md-sys-typescale-display-small);
  font-weight: 700;
  color: white;
  margin-bottom: var(--app-spacing-xs);
}

.metric-change {
  display: flex;
  align-items: center;
  gap: var(--app-spacing-xs);
  font-size: var(--md-sys-typescale-body-small);
  color: rgba(255, 255, 255, 0.8);
}

.metric-change i {
  font-size: 16px;
}

.metric-change.positive {
  color: var(--md-sys-color-secondary);
}

.metric-change.negative {
  color: var(--md-sys-color-error);
}

/* Form Styles */
.form-card {
  background-color: var(--md-sys-color-surface);
  border-radius: var(--md-sys-shape-corner-large);
  border: 1px solid var(--md-sys-color-outline-variant);
  margin-bottom: var(--app-spacing-lg);
  overflow: hidden;
  transition: all var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
}

.form-card:hover {
  box-shadow: var(--md-sys-elevation-level2);
}

.form-card-header {
  display: flex;
  align-items: center;
  gap: var(--app-spacing-md);
  padding: var(--app-spacing-lg);
  background-color: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.form-card-header i {
  font-size: 24px;
}

.form-card-header h3 {
  margin-bottom: 0;
  font-weight: 600;
}

.form-card-content {
  padding: var(--app-spacing-lg);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--app-spacing-lg);
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: var(--app-spacing-xs);
}

.form-field label {
  font-size: var(--md-sys-typescale-body-medium);
  font-weight: 500;
  color: var(--md-sys-color-on-surface);
}

.form-field.required label::after {
  content: ' *';
  color: var(--md-sys-color-error);
}

.form-field input,
.form-field select,
.form-field textarea {
  padding: var(--app-spacing-md);
  border: 1px solid var(--md-sys-color-outline);
  border-radius: var(--md-sys-shape-corner-medium);
  font-size: var(--md-sys-typescale-body-medium);
  font-family: inherit;
  background-color: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  transition: all var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--md-sys-color-primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.form-field input:invalid,
.form-field select:invalid,
.form-field textarea:invalid {
  border-color: var(--md-sys-color-error);
}

.field-hint {
  font-size: var(--md-sys-typescale-body-small);
  color: var(--md-sys-color-on-surface-variant);
}

.field-error {
  font-size: var(--md-sys-typescale-body-small);
  color: var(--md-sys-color-error);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--app-spacing-sm);
  padding: var(--app-spacing-md) var(--app-spacing-lg);
  border: none;
  border-radius: var(--md-sys-shape-corner-full);
  font-size: var(--md-sys-typescale-label-large);
  font-weight: 500;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
  min-height: 40px;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background-color: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
}

.btn-primary:hover:not(:disabled) {
  background-color: color-mix(in srgb, var(--md-sys-color-primary) 90%, white);
  box-shadow: var(--md-sys-elevation-level2);
}

.btn-primary:active:not(:disabled) {
  background-color: color-mix(in srgb, var(--md-sys-color-primary) 80%, black);
}

.btn-secondary {
  background-color: var(--md-sys-color-secondary);
  color: var(--md-sys-color-on-secondary);
}

.btn-secondary:hover:not(:disabled) {
  background-color: color-mix(in srgb, var(--md-sys-color-secondary) 90%, white);
  box-shadow: var(--md-sys-elevation-level2);
}

.btn-outline {
  background-color: transparent;
  color: var(--md-sys-color-primary);
  border: 1px solid var(--md-sys-color-outline);
}

.btn-outline:hover:not(:disabled) {
  background-color: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}

.btn-text {
  background-color: transparent;
  color: var(--md-sys-color-primary);
  padding: var(--app-spacing-sm) var(--app-spacing-md);
}

.btn-text:hover:not(:disabled) {
  background-color: var(--md-sys-color-primary-container);
}

.btn-fab {
  position: fixed;
  bottom: var(--app-spacing-lg);
  right: var(--app-spacing-lg);
  width: 56px;
  height: 56px;
  border-radius: var(--md-sys-shape-corner-large);
  background-color: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  box-shadow: var(--md-sys-elevation-level3);
  z-index: 1000;
}

.btn-fab:hover:not(:disabled) {
  box-shadow: var(--md-sys-elevation-level4);
}

.btn-fab i {
  font-size: 24px;
}

/* Charts Container */
.chart-container {
  background-color: var(--md-sys-color-surface);
  border-radius: var(--md-sys-shape-corner-large);
  padding: var(--app-spacing-lg);
  margin-bottom: var(--app-spacing-lg);
  box-shadow: var(--md-sys-elevation-level1);
  border: 1px solid var(--md-sys-color-outline-variant);
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--app-spacing-lg);
  flex-wrap: wrap;
  gap: var(--app-spacing-md);
}

.chart-title {
  font-size: var(--md-sys-typescale-title-large);
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
  margin-bottom: 0;
}

.chart-controls {
  display: flex;
  gap: var(--app-spacing-sm);
  flex-wrap: wrap;
}

.chart-canvas {
  width: 100%;
  height: 400px;
  border-radius: var(--md-sys-shape-corner-medium);
}

/* Bottom Navigation (Mobile) */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--app-bottom-nav-height);
  background-color: var(--md-sys-color-surface);
  border-top: 1px solid var(--md-sys-color-outline-variant);
  display: none;
  z-index: 1000;
}

.bottom-nav-content {
  display: flex;
  height: 100%;
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--md-sys-color-on-surface-variant);
  font-size: var(--md-sys-typescale-label-small);
  font-weight: 500;
  transition: all var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
}

.bottom-nav-item.active {
  color: var(--md-sys-color-primary);
}

.bottom-nav-item i {
  font-size: 20px;
  margin-bottom: 2px;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: all var(--md-sys-motion-duration-medium3) var(--md-sys-motion-easing-standard);
}

.modal.show {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background-color: var(--md-sys-color-surface);
  border-radius: var(--md-sys-shape-corner-extra-large);
  padding: var(--app-spacing-2xl);
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--md-sys-elevation-level5);
  transform: scale(0.9);
  transition: transform var(--md-sys-motion-duration-medium3) var(--md-sys-motion-easing-emphasized);
}

.modal.show .modal-content {
  transform: scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--app-spacing-lg);
  padding-bottom: var(--app-spacing-md);
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.modal-title {
  font-size: var(--md-sys-typescale-headline-small);
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
  margin-bottom: 0;
}

.modal-close {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: var(--md-sys-shape-corner-full);
  background-color: transparent;
  color: var(--md-sys-color-on-surface-variant);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
}

.modal-close:hover {
  background-color: var(--md-sys-color-error-container);
  color: var(--md-sys-color-on-error-container);
}

/* Responsive Design */
@media (max-width: 768px) {
  :root {
    --app-spacing-md: 12px;
    --app-spacing-lg: 16px;
    --app-spacing-xl: 24px;
    --app-spacing-2xl: 32px;
  }

  .main-content {
    padding: var(--app-spacing-md);
    margin-bottom: var(--app-bottom-nav-height);
  }

  .sidebar {
    display: none;
  }

  .bottom-nav {
    display: block;
  }

  .header-content {
    padding: 0 var(--app-spacing-md);
  }

  .app-title h1 {
    font-size: var(--md-sys-typescale-title-medium);
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .modal-content {
    margin: var(--app-spacing-md);
    padding: var(--app-spacing-lg);
    max-width: none;
    width: calc(100% - 2 * var(--app-spacing-md));
  }

  .btn-fab {
    bottom: calc(var(--app-bottom-nav-height) + var(--app-spacing-md));
  }
}

@media (min-width: 769px) {
  .sidebar {
    transform: translateX(0);
  }

  .main-content {
    margin-left: var(--app-sidebar-width);
    width: calc(100% - var(--app-sidebar-width));
  }
}

/* Utility Classes */
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.flex { display: flex; }
.flex-column { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--app-spacing-sm); }
.gap-md { gap: var(--app-spacing-md); }
.gap-lg { gap: var(--app-spacing-lg); }
.mb-0 { margin-bottom: 0 !important; }
.mb-sm { margin-bottom: var(--app-spacing-sm); }
.mb-md { margin-bottom: var(--app-spacing-md); }
.mb-lg { margin-bottom: var(--app-spacing-lg); }
.mt-sm { margin-top: var(--app-spacing-sm); }
.mt-md { margin-top: var(--app-spacing-md); }
.mt-lg { margin-top: var(--app-spacing-lg); }
.p-sm { padding: var(--app-spacing-sm); }
.p-md { padding: var(--app-spacing-md); }
.p-lg { padding: var(--app-spacing-lg); }
.w-full { width: 100%; }
.h-full { height: 100%; }

/* Modal/Dialog Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  animation: fadeIn var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-standard);
}

.modal.active {
  display: flex;
}

.modal-dialog {
  background: var(--md-sys-color-surface);
  border-radius: var(--md-sys-shape-corner-large);
  box-shadow: var(--md-sys-elevation-level5);
  max-width: 600px;
  width: 90%;
  max-height: 90%;
  overflow-y: auto;
  position: relative;
  animation: slideIn var(--md-sys-motion-duration-medium3) var(--md-sys-motion-easing-standard);
}

.modal-header {
  padding: var(--app-spacing-lg);
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: var(--md-sys-typescale-headline-small);
  font-weight: 500;
  color: var(--md-sys-color-on-surface);
  margin: 0;
}

.modal-close {
  width: 40px;
  height: 40px;
  border-radius: var(--md-sys-shape-corner-full);
  border: none;
  background: transparent;
  color: var(--md-sys-color-on-surface-variant);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
}

.modal-close:hover {
  background-color: var(--md-sys-color-error-container);
  color: var(--md-sys-color-on-error-container);
}

.modal-body {
  padding: var(--app-spacing-lg);
}

.modal-footer {
  padding: var(--app-spacing-lg);
  border-top: 1px solid var(--md-sys-color-outline-variant);
  display: flex;
  gap: var(--app-spacing-md);
  justify-content: flex-end;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-50px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Empty State Styles */
.empty-state {
  text-align: center;
  padding: var(--app-spacing-2xl);
  color: var(--md-sys-color-on-surface-variant);
}

.empty-state .empty-icon {
  font-size: 64px;
  margin-bottom: var(--app-spacing-lg);
  opacity: 0.5;
}

.empty-state h3 {
  margin: var(--app-spacing-md) 0;
  color: var(--md-sys-color-on-surface);
}

.empty-state p {
  margin-bottom: var(--app-spacing-lg);
}

/* History List Styles */
.history-list {
  display: flex;
  flex-direction: column;
  gap: var(--app-spacing-md);
}

.history-item {
  display: flex;
  align-items: center;
  gap: var(--app-spacing-md);
  padding: var(--app-spacing-md);
  background: var(--md-sys-color-surface-variant);
  border-radius: var(--md-sys-shape-corner-medium);
  border: 1px solid var(--md-sys-color-outline-variant);
  transition: all var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
}

.history-item:hover {
  background: var(--md-sys-color-primary-container);
  border-color: var(--md-sys-color-primary);
}

.history-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  border-radius: var(--md-sys-shape-corner-medium);
  flex-shrink: 0;
}

.date-day {
  font-size: 20px;
  font-weight: 600;
  line-height: 1;
}

.date-month {
  font-size: 12px;
  opacity: 0.8;
}

.history-content {
  flex: 1;
}

.history-main {
  display: flex;
  align-items: baseline;
  gap: var(--app-spacing-sm);
  margin-bottom: var(--app-spacing-xs);
}

.weight-value {
  font-size: var(--md-sys-typescale-title-large);
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
}

.record-time {
  font-size: var(--md-sys-typescale-body-small);
  color: var(--md-sys-color-on-surface-variant);
}

.history-details {
  display: flex;
  gap: var(--app-spacing-md);
  margin-bottom: var(--app-spacing-xs);
}

.detail-item {
  font-size: var(--md-sys-typescale-body-small);
  color: var(--md-sys-color-on-surface-variant);
  background: var(--md-sys-color-surface);
  padding: 2px 8px;
  border-radius: var(--md-sys-shape-corner-extra-small);
}

.record-notes {
  font-size: var(--md-sys-typescale-body-small);
  color: var(--md-sys-color-on-surface-variant);
  font-style: italic;
}

.history-actions {
  display: flex;
  gap: var(--app-spacing-xs);
}

.btn-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--md-sys-shape-corner-full);
  border: none;
  background: transparent;
  color: var(--md-sys-color-on-surface-variant);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
}

.btn-icon:hover {
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}

.btn-icon.btn-danger:hover {
  background: var(--md-sys-color-error-container);
  color: var(--md-sys-color-on-error-container);
}

/* History Stats Grid */
.history-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--app-spacing-md);
  margin-bottom: var(--app-spacing-lg);
}

.stat-card {
  background: var(--md-sys-color-surface-variant);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-medium);
  padding: var(--app-spacing-md);
  text-align: center;
}

.stat-content {
  display: flex;
  flex-direction: column;
  gap: var(--app-spacing-xs);
}

.stat-value {
  font-size: var(--md-sys-typescale-headline-small);
  font-weight: 600;
  color: var(--md-sys-color-primary);
}

.stat-label {
  font-size: var(--md-sys-typescale-body-small);
  color: var(--md-sys-color-on-surface-variant);
}

/* Chart Styles */
.empty-chart-state {
  text-align: center;
  padding: var(--app-spacing-2xl);
  color: var(--md-sys-color-on-surface-variant);
}

.empty-chart-state i {
  font-size: 64px;
  margin-bottom: var(--app-spacing-md);
  opacity: 0.5;
}

.chart-stats {
  display: flex;
  gap: var(--app-spacing-lg);
  margin-bottom: var(--app-spacing-md);
  flex-wrap: wrap;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: var(--app-spacing-xs);
}

.stat-label {
  color: var(--md-sys-color-on-surface-variant);
  font-size: var(--md-sys-typescale-body-small);
}

.stat-value {
  font-weight: 500;
  color: var(--md-sys-color-on-surface);
}

.stat-value.positive {
  color: var(--md-sys-color-secondary);
}

.stat-value.negative {
  color: var(--md-sys-color-error);
}

/* Goals Styles */
.goal-item {
  background: var(--md-sys-color-surface-variant);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-medium);
  padding: var(--app-spacing-lg);
  margin-bottom: var(--app-spacing-md);
  transition: all var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
}

.goal-item:hover {
  background: var(--md-sys-color-primary-container);
  border-color: var(--md-sys-color-primary);
}

.goal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--app-spacing-md);
}

.goal-title {
  font-size: var(--md-sys-typescale-title-medium);
  margin: 0 0 var(--app-spacing-xs) 0;
  color: var(--md-sys-color-on-surface);
}

.goal-meta {
  display: flex;
  gap: var(--app-spacing-sm);
}

.goal-type,
.goal-status {
  font-size: var(--md-sys-typescale-label-medium);
  padding: 2px 8px;
  border-radius: var(--md-sys-shape-corner-extra-small);
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}

.goal-progress {
  margin-bottom: var(--app-spacing-md);
}

.progress-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--app-spacing-xs);
  font-size: var(--md-sys-typescale-body-small);
  color: var(--md-sys-color-on-surface-variant);
}

.progress-bar {
  height: 8px;
  background: var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-full);
  overflow: hidden;
  margin-bottom: var(--app-spacing-xs);
}

.progress-fill {
  height: 100%;
  background: var(--md-sys-color-primary);
  transition: width var(--md-sys-motion-duration-medium3) var(--md-sys-motion-easing-standard);
}

.progress-text {
  font-size: var(--md-sys-typescale-body-small);
  color: var(--md-sys-color-primary);
  font-weight: 500;
}

.goal-deadline {
  display: flex;
  align-items: center;
  gap: var(--app-spacing-xs);
  font-size: var(--md-sys-typescale-body-small);
  color: var(--md-sys-color-on-surface-variant);
  margin-bottom: var(--app-spacing-sm);
}

.goal-description {
  font-size: var(--md-sys-typescale-body-small);
  color: var(--md-sys-color-on-surface-variant);
  line-height: 1.4;
}

/* Goal Progress Styles for Dashboard */
.goal-progress-item {
  background: var(--md-sys-color-surface-variant);
  border-radius: var(--md-sys-shape-corner-medium);
  padding: var(--app-spacing-md);
  margin-bottom: var(--app-spacing-sm);
}

.goal-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--app-spacing-xs);
}

.goal-progress-title {
  font-weight: 500;
  color: var(--md-sys-color-on-surface);
}

.goal-progress-percent {
  font-weight: 600;
  color: var(--md-sys-color-primary);
}

.goal-progress-bar {
  height: 6px;
  background: var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-full);
  overflow: hidden;
  margin-bottom: var(--app-spacing-xs);
}

.goal-progress-fill {
  height: 100%;
  background: var(--md-sys-color-primary);
  transition: width var(--md-sys-motion-duration-medium3) var(--md-sys-motion-easing-standard);
}

.goal-progress-details {
  display: flex;
  justify-content: space-between;
  font-size: var(--md-sys-typescale-body-small);
  color: var(--md-sys-color-on-surface-variant);
}

.no-goals-message {
  text-align: center;
  padding: var(--app-spacing-lg);
  color: var(--md-sys-color-on-surface-variant);
}

/* Body Analysis Styles */
.analysis-card {
  background: var(--md-sys-color-surface-variant);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-medium);
  padding: var(--app-spacing-lg);
  margin-bottom: var(--app-spacing-md);
}

.analysis-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--app-spacing-md);
}

.bmi-value,
.bodyfat-value,
.health-score {
  font-size: var(--md-sys-typescale-headline-medium);
  font-weight: 600;
}

.bmi-scale,
.bodyfat-chart {
  margin: var(--app-spacing-md) 0;
}

.bmi-bar,
.bodyfat-gauge {
  height: 8px;
  background: var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-full);
  position: relative;
  margin-bottom: var(--app-spacing-xs);
}

.bmi-indicator {
  position: absolute;
  top: -2px;
  width: 12px;
  height: 12px;
  background: var(--md-sys-color-primary);
  border-radius: var(--md-sys-shape-corner-full);
  transform: translateX(-50%);
}

.gauge-fill {
  height: 100%;
  border-radius: var(--md-sys-shape-corner-full);
  transition: width var(--md-sys-motion-duration-medium3) var(--md-sys-motion-easing-standard);
}

.bmi-labels,
.gauge-labels {
  display: flex;
  justify-content: space-between;
  font-size: var(--md-sys-typescale-body-small);
  color: var(--md-sys-color-on-surface-variant);
}

.measurements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--app-spacing-md);
  margin-bottom: var(--app-spacing-md);
}

.measurement-item {
  display: flex;
  align-items: center;
  gap: var(--app-spacing-sm);
}

.measurement-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--md-sys-shape-corner-full);
  background: var(--md-sys-color-primary-container);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--md-sys-color-on-primary-container);
}

.measurement-content {
  flex: 1;
}

.measurement-label {
  font-size: var(--md-sys-typescale-body-small);
  color: var(--md-sys-color-on-surface-variant);
}

.measurement-value {
  font-size: var(--md-sys-typescale-title-medium);
  font-weight: 500;
  color: var(--md-sys-color-on-surface);
}

.ratio-analysis {
  text-align: center;
  padding: var(--app-spacing-md);
  background: var(--md-sys-color-surface);
  border-radius: var(--md-sys-shape-corner-medium);
}

.ratio-value {
  font-size: var(--md-sys-typescale-headline-small);
  font-weight: 600;
  color: var(--md-sys-color-primary);
}

.health-level {
  font-size: var(--md-sys-typescale-title-large);
  font-weight: 600;
  text-align: center;
  margin-bottom: var(--app-spacing-md);
}

.score-breakdown {
  margin: var(--app-spacing-md) 0;
}

.score-item {
  display: flex;
  align-items: center;
  gap: var(--app-spacing-md);
  margin-bottom: var(--app-spacing-sm);
}

.score-label {
  min-width: 80px;
  font-size: var(--md-sys-typescale-body-small);
  color: var(--md-sys-color-on-surface-variant);
}

.score-bar {
  flex: 1;
  height: 6px;
  background: var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-full);
  overflow: hidden;
}

.score-fill {
  height: 100%;
  border-radius: var(--md-sys-shape-corner-full);
  transition: width var(--md-sys-motion-duration-medium3) var(--md-sys-motion-easing-standard);
}

.score-value {
  min-width: 40px;
  text-align: right;
  font-weight: 500;
}

/* Statistics Styles */
.statistics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--app-spacing-md);
  margin-bottom: var(--app-spacing-lg);
}

.stat-header {
  display: flex;
  align-items: center;
  gap: var(--app-spacing-sm);
  margin-bottom: var(--app-spacing-md);
}

.stat-header h4 {
  margin: 0;
  color: var(--md-sys-color-on-surface);
}

.stat-detail {
  font-size: var(--md-sys-typescale-body-small);
  color: var(--md-sys-color-on-surface-variant);
  margin-top: var(--app-spacing-xs);
}

.trend-analysis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--app-spacing-md);
}

.trend-card {
  background: var(--md-sys-color-surface-variant);
  border-radius: var(--md-sys-shape-corner-medium);
  padding: var(--app-spacing-md);
}

.trend-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--app-spacing-sm);
}

.trend-icon.up { color: var(--md-sys-color-secondary); }
.trend-icon.down { color: var(--md-sys-color-error); }
.trend-icon.stable { color: var(--md-sys-color-on-surface-variant); }

.trend-change.up { color: var(--md-sys-color-secondary); }
.trend-change.down { color: var(--md-sys-color-error); }
.trend-change.stable { color: var(--md-sys-color-on-surface-variant); }

.goal-statistics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--app-spacing-md);
}

.goal-stat-card {
  display: flex;
  align-items: center;
  gap: var(--app-spacing-sm);
  background: var(--md-sys-color-surface-variant);
  border-radius: var(--md-sys-shape-corner-medium);
  padding: var(--app-spacing-md);
}

.goal-stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--md-sys-shape-corner-full);
  background: var(--md-sys-color-outline-variant);
  display: flex;
  align-items: center;
  justify-content: center;
}

.goal-stat-icon.active { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
.goal-stat-icon.completed { background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); }

.goal-stat-value {
  font-size: var(--md-sys-typescale-title-large);
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
}

.goal-stat-label {
  font-size: var(--md-sys-typescale-body-small);
  color: var(--md-sys-color-on-surface-variant);
}

.monthly-report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--app-spacing-md);
}

.monthly-card {
  background: var(--md-sys-color-surface-variant);
  border-radius: var(--md-sys-shape-corner-medium);
  padding: var(--app-spacing-md);
  border: 2px solid transparent;
}

.monthly-card.current {
  border-color: var(--md-sys-color-primary);
}

.monthly-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--app-spacing-sm);
}

.current-badge {
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  padding: 2px 8px;
  border-radius: var(--md-sys-shape-corner-extra-small);
  font-size: var(--md-sys-typescale-label-small);
}

.monthly-stats {
  display: flex;
  flex-direction: column;
  gap: var(--app-spacing-xs);
}

.monthly-stat {
  display: flex;
  justify-content: space-between;
}

/* Enhanced Reference Tables */
.reference-card.enhanced {
  background: linear-gradient(135deg, var(--md-sys-color-primary-container) 0%, var(--md-sys-color-secondary-container) 100%);
  border: 2px solid var(--md-sys-color-outline-variant);
  position: relative;
  overflow: hidden;
}

.reference-card.enhanced::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 100px;
  height: 100px;
  background: linear-gradient(45deg, transparent 50%, rgba(255,255,255,0.1) 50%);
  border-radius: 0 0 0 100px;
}

.reference-card .card-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-bottom: var(--app-spacing-lg);
  border-bottom: 2px solid var(--md-sys-color-outline-variant);
  padding-bottom: var(--app-spacing-md);
}

.reference-card .card-subtitle {
  font-size: var(--md-sys-typescale-body-small);
  color: var(--md-sys-color-on-surface-variant);
  font-weight: 500;
  margin-top: var(--app-spacing-xs);
}

.reference-tables-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--app-spacing-lg);
  margin-bottom: var(--app-spacing-lg);
}

@media (max-width: 768px) {
  .reference-tables-grid {
    grid-template-columns: 1fr;
    gap: var(--app-spacing-md);
  }
}

.reference-table-container {
  background: var(--md-sys-color-surface);
  border-radius: var(--md-sys-shape-corner-medium);
  padding: var(--app-spacing-md);
  border: 1px solid var(--md-sys-color-outline-variant);
  box-shadow: var(--md-sys-elevation-level1);
}

.table-title {
  font-size: var(--md-sys-typescale-title-medium);
  font-weight: 600;
  margin-bottom: var(--app-spacing-md);
  display: flex;
  align-items: center;
  gap: var(--app-spacing-sm);
}

.table-title.male {
  color: var(--md-sys-color-primary);
}

.table-title.female {
  color: #e91e63;
}

/* 标准表格样式 */
.standard-table {
  width: 100%;
  border-collapse: collapse;
  font-family: inherit;
}

.standard-table thead {
  background: var(--md-sys-color-primary-container);
}

.standard-table th {
  padding: var(--app-spacing-md);
  text-align: left;
  font-weight: 600;
  font-size: var(--md-sys-typescale-body-medium);
  color: var(--md-sys-color-on-primary-container);
  border-bottom: 2px solid var(--md-sys-color-primary);
}

.standard-table td {
  padding: var(--app-spacing-md);
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  vertical-align: middle;
}

.standard-table tbody tr:hover {
  background: var(--md-sys-color-surface-variant);
  transition: background-color var(--md-sys-motion-duration-short2) var(--md-sys-motion-easing-standard);
}

.standard-table tbody tr.excellent {
  border-left: 4px solid #4caf50;
}

.standard-table tbody tr.good {
  border-left: 4px solid #2196f3;
}

.standard-table tbody tr.normal {
  border-left: 4px solid #ff9800;
}

.standard-table tbody tr.warning {
  border-left: 4px solid #f44336;
}

.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: var(--md-sys-shape-corner-full);
  font-size: var(--md-sys-typescale-body-small);
  font-weight: 600;
  text-align: center;
  min-width: 60px;
}

.status-badge.excellent {
  background: #e8f5e8;
  color: #2e7d32;
  border: 1px solid #4caf50;
}

.status-badge.good {
  background: #e3f2fd;
  color: #1565c0;
  border: 1px solid #2196f3;
}

.status-badge.normal {
  background: #fff3e0;
  color: #ef6c00;
  border: 1px solid #ff9800;
}

.status-badge.warning {
  background: #ffebee;
  color: #c62828;
  border: 1px solid #f44336;
}

.reference-note {
  display: flex;
  align-items: center;
  gap: var(--app-spacing-sm);
  background: var(--md-sys-color-surface);
  padding: var(--app-spacing-md);
  border-radius: var(--md-sys-shape-corner-medium);
  border-left: 4px solid var(--md-sys-color-primary);
  font-size: var(--md-sys-typescale-body-small);
  color: var(--md-sys-color-on-surface-variant);
}

.reference-note .material-icons {
  color: var(--md-sys-color-primary);
  font-size: 18px;
}

/* Single table layout */
.reference-tables-grid.single-table {
  grid-template-columns: 1fr;
}

.table-title.bmi {
  color: #6366f1;
}

/* BMI specific row styles */
.standard-table tbody tr.underweight {
  border-left: 4px solid #9c27b0;
}

.standard-table tbody tr.overweight {
  border-left: 4px solid #ff9800;
}

.standard-table tbody tr.obese-1 {
  border-left: 4px solid #ff5722;
}

.standard-table tbody tr.obese-2 {
  border-left: 4px solid #f44336;
}

.standard-table tbody tr.obese-3 {
  border-left: 4px solid #d32f2f;
}

/* BMI specific badge styles */
.status-badge.underweight {
  background: #f3e5f5;
  color: #7b1fa2;
  border: 1px solid #9c27b0;
}

.status-badge.overweight {
  background: #fff3e0;
  color: #ef6c00;
  border: 1px solid #ff9800;
}

.status-badge.obese-1 {
  background: #fbe9e7;
  color: #d84315;
  border: 1px solid #ff5722;
}

.status-badge.obese-2 {
  background: #ffebee;
  color: #c62828;
  border: 1px solid #f44336;
}

.status-badge.obese-3 {
  background: #ffcdd2;
  color: #b71c1c;
  border: 1px solid #d32f2f;
}/* Statistics Charts - 恢复原始大小 */
.stats-chart {
  margin-top: var(--app-spacing-md);
  height: 80px;
  padding-left: 0; /* 移除左侧内边距 */
  position: relative;
  overflow: visible; /* 确保标签不被裁切 */
}

.stats-chart canvas {
  width: 100% !important;
  height: 80px !important; /* 恢复原始大小 */
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

.statistics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr); /* 固定4列布局 */
  gap: var(--app-spacing-md);
  margin-bottom: var(--app-spacing-2xl);
  overflow-x: auto; /* 允许在小屏幕上水平滚动 */
}

@media (max-width: 1024px) {
  .statistics-grid {
    grid-template-columns: repeat(4, minmax(240px, 1fr)); /* 保持4列但设置最小宽度 */
    min-width: 960px; /* 确保至少有足够宽度容纳4个卡片 */
  }
}

.stats-card {
  background: var(--md-sys-color-surface);
  border-radius: var(--md-sys-shape-corner-large);
  padding: var(--app-spacing-md); /* 减小内边距 */
  box-shadow: var(--md-sys-elevation-level1);
  min-height: 180px; /* 减小高度 */
  overflow: visible;
}

.stats-card .stats-content {
  display: flex;
  flex-direction: column;
  gap: var(--app-spacing-xs); /* 减小内部元素间距 */
}

.stats-card .stats-chart {
  margin-left: 10px; /* 为Y轴标签预留空间 */
}

#weight-trend-mini,
#bodyfat-trend-mini,
#frequency-chart,
#goals-progress-chart {
  width: 100% !important;
  height: 80px !important; /* 恢复原始大小 */
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

/* 当前BMI和体脂率高亮显示 */
.standard-table tbody tr.current-level {
  background: linear-gradient(135deg, var(--md-sys-color-primary-container) 20%, transparent 100%);
  border: 2px solid var(--md-sys-color-primary);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.2);
  position: relative;
}


/* 仪表盘页面头部样式 */
.page-header .header-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: var(--app-spacing-md);
}

.page-header .header-text {
  flex: 1;
  min-width: 200px;
}

.page-header .header-controls {
  display: flex;
  align-items: center;
  gap: var(--app-spacing-md);
}

.gender-selector {
  display: flex;
  align-items: center;
  gap: var(--app-spacing-sm);
  background: var(--md-sys-color-surface-variant);
  padding: var(--app-spacing-sm) var(--app-spacing-md);
  border-radius: var(--md-sys-shape-corner-medium);
  border: 1px solid var(--md-sys-color-outline-variant);
}

.gender-selector label {
  font-size: var(--md-sys-typescale-body-medium);
  font-weight: 500;
  color: var(--md-sys-color-on-surface-variant);
  white-space: nowrap;
}

.gender-select {
  background: var(--md-sys-color-surface);
  border: 1px solid var(--md-sys-color-outline);
  border-radius: var(--md-sys-shape-corner-small);
  padding: 6px 12px;
  font-size: var(--md-sys-typescale-body-medium);
  color: var(--md-sys-color-on-surface);
  cursor: pointer;
  transition: all var(--md-sys-motion-duration-short2) var(--md-sys-motion-easing-standard);
  min-width: 100px;
}

.gender-select:hover {
  border-color: var(--md-sys-color-primary);
}

.gender-select:focus {
  outline: none;
  border-color: var(--md-sys-color-primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

@media (max-width: 768px) {
  .page-header .header-content {
    flex-direction: column;
    align-items: stretch;
  }
  
  .gender-selector {
    justify-content: space-between;
  }
}

