:root {
  --bg-start: #fff6ef;
  --bg-mid: #eef8f4;
  --bg-end: #f5f0ff;
  --card: rgba(255, 255, 255, 0.92);
  --text: #24312f;
  --muted: #6c7a76;
  --primary: #47a889;
  --primary-dark: #2f8268;
  --accent: #f3a65c;
  --line: #e4ece8;
  --danger: #d86c63;
  --shadow: 0 16px 40px rgba(67, 102, 91, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at 15% 8%, rgba(255, 208, 173, 0.58), transparent 30%),
    radial-gradient(circle at 90% 12%, rgba(195, 235, 221, 0.72), transparent 32%),
    linear-gradient(145deg, var(--bg-start), var(--bg-mid) 48%, var(--bg-end));
}

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

button {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  width: min(100%, 720px);
  margin: 0 auto;
  padding: 22px 16px 34px;
}

.hero {
  padding: 12px 2px 18px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 700;
}

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

h1 {
  font-size: 30px;
  line-height: 1.18;
  letter-spacing: 0;
}

.hero-copy {
  margin-top: 10px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.tab-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 8px;
  margin: 2px 0 16px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 18px;
  box-shadow: 0 10px 26px rgba(77, 111, 100, 0.12);
  backdrop-filter: blur(12px);
}

.tab-btn {
  min-height: 42px;
  border: 0;
  border-radius: 14px;
  color: var(--muted);
  background: transparent;
  font-size: 14px;
  font-weight: 700;
}

.tab-btn.active {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  box-shadow: 0 8px 18px rgba(71, 168, 137, 0.26);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.card {
  margin-bottom: 16px;
  padding: 18px;
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.88);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.section-title {
  margin-bottom: 16px;
}

.section-title h2 {
  font-size: 20px;
  line-height: 1.3;
}

.section-title p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.with-action {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.field-grid {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 13px;
}

.field span {
  color: #4c5b57;
  font-size: 14px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 13px;
  color: var(--text);
  background: #fbfffd;
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.6;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(71, 168, 137, 0.8);
  box-shadow: 0 0 0 4px rgba(71, 168, 137, 0.12);
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.danger-btn {
  min-height: 48px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  font-weight: 800;
}

.primary-btn {
  width: 100%;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  box-shadow: 0 12px 24px rgba(71, 168, 137, 0.26);
}

.secondary-btn {
  color: var(--primary-dark);
  background: #e8f7f1;
}

.ghost-btn {
  color: var(--muted);
  background: #f4f7f6;
}

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

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

.hidden {
  display: none !important;
}

.metric-grid,
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.metric,
.stat-item {
  min-height: 84px;
  padding: 12px;
  background: #f7fbf9;
  border: 1px solid var(--line);
  border-radius: 16px;
}

.metric span,
.stat-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.metric strong,
.stat-item strong {
  display: block;
  margin-top: 6px;
  font-size: 21px;
  line-height: 1.2;
}

.metric small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
}

.stat-item.wide {
  grid-column: span 3;
}

.advice-box {
  padding: 14px;
  color: #40514d;
  background: linear-gradient(135deg, #f7fbf9, #fff8ef);
  border: 1px solid var(--line);
  border-radius: 16px;
  line-height: 1.7;
  font-size: 14px;
}

.subheading {
  margin: 18px 0 12px;
  font-size: 17px;
}

.plan-list {
  display: grid;
  gap: 10px;
}

.plan-day,
.record-item {
  padding: 13px;
  background: #fbfffd;
  border: 1px solid var(--line);
  border-radius: 16px;
}

.plan-day strong,
.record-top strong {
  font-size: 15px;
}

.plan-day p,
.record-item p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.record-list {
  display: grid;
  gap: 10px;
}

.record-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.record-weight {
  color: var(--primary-dark);
  font-weight: 800;
}

.change {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 9px;
  color: #5f6f6a;
  background: #f1f5f3;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.change.down {
  color: #2f8268;
  background: #e8f7f1;
}

.change.up {
  color: #b95f35;
  background: #fff1e8;
}

.delete-btn {
  min-width: 54px;
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  color: #c4544b;
  background: #fff0ef;
  font-size: 13px;
  font-weight: 800;
}

.empty-state {
  padding: 18px;
  color: var(--muted);
  text-align: center;
  background: #f7fbf9;
  border: 1px dashed #cedbd6;
  border-radius: 16px;
  line-height: 1.6;
}

.monthly-card {
  background: linear-gradient(155deg, rgba(255,255,255,0.95), rgba(239, 250, 246, 0.95));
}

.chart-wrap {
  position: relative;
  width: 100%;
  min-height: 220px;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  background: #fbfffd;
  border: 1px solid var(--line);
  border-radius: 16px;
}

.chart-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  color: var(--muted);
  background: rgba(251, 255, 253, 0.86);
  border-radius: 16px;
  font-weight: 700;
}

.disclaimer {
  padding: 16px 4px 0;
  color: #788782;
  font-size: 12px;
  line-height: 1.7;
  text-align: center;
}

@media (min-width: 620px) {
  .field-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .primary-btn {
    width: auto;
    min-width: 180px;
  }
}

@media (max-width: 380px) {
  .app-shell {
    padding-inline: 12px;
  }

  h1 {
    font-size: 26px;
  }

  .card {
    padding: 15px;
    border-radius: 18px;
  }

  .tab-btn {
    font-size: 13px;
  }

  .metric-grid,
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .stat-item.wide {
    grid-column: span 2;
  }

  .button-row {
    grid-template-columns: 1fr;
  }
}
