* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  min-height: 100vh;
  padding: 20px;
}

.page-wrapper {
  max-width: 520px;
  margin: 0 auto;
}

/* Today Card */
.card {
  background: white;
  border-radius: 24px;
  padding: 2.5rem 3rem;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15);
  width: 100%;
}

.card.phase-1 {
  --accent-color: #8B92A0;
  --accent-light: #E8EAF0;
}

.card.phase-2 {
  --accent-color: #4A90E2;
  --accent-light: #E3F0FF;
}

.card.phase-3 {
  --accent-color: #A574D7;
  --accent-light: #F3ECFF;
}

h1 {
  font-size: 1.8rem;
  font-weight: 700;
  color: #2C3E50;
  margin-bottom: 1.5rem;
  letter-spacing: -0.5px;
}

.info-section {
  margin-bottom: 2.2rem;
}

.info-row {
  margin: 1.4rem 0;
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
}

.info-label {
  font-size: 1rem;
  color: #7F8C99;
  flex-shrink: 0;
}

.info-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent-color, #333);
  flex: 1;
}

.treatment-box {
  background: var(--accent-light, #f0f0f0);
  border-left: 4px solid var(--accent-color, #999);
  padding: 1rem 1.2rem;
  border-radius: 8px;
  margin-top: 1.5rem;
  text-align: center;
}

.treatment-label {
  font-size: 0.85rem;
  color: #7F8C99;
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.treatment-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent-color, #333);
}

.progress-container {
  margin: 2rem 0 1.5rem 0;
}

.progress-label {
  font-size: 0.75rem;
  color: #A0AAB5;
  margin-bottom: 0.6rem;
  display: flex;
  justify-content: space-between;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-weight: 600;
}

.progress-bar-bg {
  background: #E8EAF0;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--accent-color, #999);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.footer {
  font-size: 0.8rem;
  color: #A0AAB5;
  margin-top: 2rem;
  text-align: center;
  line-height: 1.6;
}

.emoji {
  margin-right: 0.4rem;
  font-size: 1.2em;
}

.quote-box {
  border-top: 1px solid #E8EAF0;
  margin-top: 1.5rem;
  padding-top: 1rem;
  text-align: center;
  line-height: 1.6;
}

#daily-quote {
  font-size: 0.95rem;
  color: #555;
  font-style: italic;
  margin: 0;
}

#quote-author {
  font-size: 0.8rem;
  color: #A0AAB5;
  margin: 0.3rem 0 0 0;
}

/* Calendar Card */
.calendar-card {
  background: white;
  border-radius: 24px;
  padding: 2rem 2.5rem;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15);
  width: 100%;
  margin-top: 1.5rem;
}

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

.cal-nav-btn {
  background: none;
  border: none;
  font-size: 1.3rem;
  color: #4A90E2;
  cursor: pointer;
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  transition: background 0.2s;
}

.cal-nav-btn:hover {
  background: #E3F0FF;
}

.cal-month-year {
  font-size: 1.1rem;
  font-weight: 600;
  color: #2C3E50;
  text-align: center;
  flex: 1;
}

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 0.8rem;
  text-align: center;
}

.cal-weekday {
  font-size: 0.75rem;
  font-weight: 700;
  color: #7F8C99;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.4rem 0;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 1.5rem;
}

.cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: default;
  transition: all 0.2s;
}

.cal-day.other-month {
  opacity: 0.15;
  color: #A0AAB5;
}

.cal-day.phase-1 { background: #E8EAF0; color: #8B92A0; }
.cal-day.phase-2 { background: #E3F0FF; color: #4A90E2; }
.cal-day.phase-3 { background: #F3ECFF; color: #A574D7; }

.cal-day.today {
  outline: 3px solid #2C3E50;
  outline-offset: 2px;
  font-weight: 700;
}

.cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem;
  padding-top: 1rem;
  border-top: 1px solid #E8EAF0;
  font-size: 0.85rem;
  color: #7F8C99;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.legend-dot.phase-1 { background: #8B92A0; }
.legend-dot.phase-2 { background: #4A90E2; }
.legend-dot.phase-3 { background: #A574D7; }

/* Table Card */
.table-card {
  background: white;
  border-radius: 24px;
  padding: 2rem 2.5rem;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15);
  width: 100%;
  margin-top: 1.5rem;
  overflow: hidden;
}

.table-card h2 {
  font-size: 1.3rem;
  font-weight: 700;
  color: #2C3E50;
  margin-bottom: 1.5rem;
}

.table-scroll {
  overflow-x: auto;
  margin: 0 -2.5rem;
  padding: 0 2.5rem;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th, td {
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid #E8EAF0;
}

th {
  background: #F8F9FA;
  color: #7F8C99;
  text-transform: uppercase;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.3px;
}

th:first-child, td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
}

th:first-child { background: #F8F9FA; }
td:first-child { background: white; }
tr.current td:first-child { background: #FFFBEA; }

tr.divider-row td {
  background: #F8F9FA;
  font-size: 0.75rem;
  color: #A0AAB5;
  text-align: center;
  font-style: italic;
  padding: 0.5rem 1rem;
  border-bottom: 2px solid #E8EAF0;
  font-weight: 500;
}

td {
  color: #2C3E50;
  white-space: nowrap;
}

tr.current {
  background: #FFFBEA;
  font-weight: 600;
}

.col-cycle { color: #2C3E50; font-weight: 600; }
.col-phase-1 { color: #8B92A0; }
.col-phase-2 { color: #4A90E2; }
.col-phase-3 { color: #A574D7; }

@media (max-width: 480px) {
  .card, .calendar-card {
    padding: 1.8rem 1.5rem;
    border-radius: 20px;
  }

  h1 {
    font-size: 1.5rem;
    margin-bottom: 1.2rem;
  }

  .calendar-card {
    padding: 1.5rem 1.2rem;
  }

  .cal-grid { gap: 4px; }
  .cal-day { font-size: 0.75rem; }
  .cal-legend { font-size: 0.75rem; gap: 0.8rem; }
  .info-value { font-size: 1.4rem; }
  .treatment-value { font-size: 1.2rem; }

  th, td {
    padding: 0.6rem 0.8rem;
    font-size: 0.8rem;
  }

  .table-card {
    padding: 1.5rem 1.2rem;
  }

  .table-card h2 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
  }

  .table-scroll {
    margin: 0 -1.2rem;
    padding: 0 1.2rem;
  }
}
