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

:root {
  --bg: #faf8f5;
  --text: #2c2c2c;
  --text-muted: #888;
  --border: #e8e4df;
  --card-bg: #fff;
  --radius: 12px;
  --tier-weekly: #90caf9;
  --tier-weekly-light: #e3f2fd;
  --tier-monthly: #b39ddb;
  --tier-monthly-light: #ede7f6;
  --tier-yearly: #ffb74d;
  --tier-yearly-light: #fff3e0;
  --completed: #c8e6c9;
  --completed-text: #2e7d32;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: 40px;
}

/* Login */
.login-card {
  text-align: center;
  padding: 60px 24px;
}

.login-card h1 {
  font-size: 28px;
  margin-bottom: 4px;
}

.login-card .subtitle {
  color: var(--text-muted);
  margin-bottom: 32px;
  font-size: 15px;
}

#login-form {
  display: flex;
  gap: 8px;
}

#login-form input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 16px;
  background: var(--card-bg);
}

#login-form button {
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius);
  background: var(--text);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

.error {
  color: #d44;
  font-size: 14px;
  margin-top: 12px;
}

/* Header */
header {
  text-align: center;
  padding: 8px 0 12px;
}

header h1 {
  font-size: 22px;
  margin-bottom: 8px;
}

.year-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.year-nav span {
  font-size: 17px;
  font-weight: 600;
  min-width: 60px;
  text-align: center;
}

.nav-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card-bg);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
}

/* Today action */
.today-action {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.today-action .today-label {
  font-size: 14px;
  font-weight: 600;
}

.today-action .today-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.today-action .complete-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  color: #fff;
}

.today-action .complete-btn.weekly { background: var(--tier-weekly); }
.today-action .complete-btn.monthly { background: var(--tier-monthly); }
.today-action .complete-btn.yearly { background: var(--tier-yearly); }

.today-action .complete-btn.done {
  background: var(--completed);
  color: var(--completed-text);
  cursor: default;
}

/* Stats */
.stats {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.stat-card {
  flex: 1;
  background: var(--card-bg);
  border-radius: 10px;
  padding: 10px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.stat-card .stat-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-card .stat-value {
  font-size: 18px;
  font-weight: 700;
  margin-top: 2px;
}

.stat-card.weekly { border-top: 3px solid var(--tier-weekly); }
.stat-card.monthly { border-top: 3px solid var(--tier-monthly); }
.stat-card.yearly { border-top: 3px solid var(--tier-yearly); }

/* Tab nav */
.tab-nav {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  background: var(--card-bg);
  border-radius: 10px;
  padding: 4px;
}

.tab-btn {
  flex: 1;
  padding: 8px;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
}

.tab-btn.active {
  background: var(--text);
  color: #fff;
}

/* Calendar months */
.month-block {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.month-block h3 {
  font-size: 15px;
  margin-bottom: 8px;
}

.cal-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 12px;
  position: relative;
}

.cal-day.empty {
  visibility: hidden;
}

.cal-day.today {
  font-weight: 800;
  box-shadow: inset 0 0 0 2px var(--text);
}

.cal-day.fast-weekly { background: var(--tier-weekly-light); color: var(--tier-weekly); font-weight: 700; }
.cal-day.fast-monthly { background: var(--tier-monthly-light); color: var(--tier-monthly); font-weight: 700; }
.cal-day.fast-yearly { background: var(--tier-yearly-light); color: var(--tier-yearly); font-weight: 700; }

.cal-day.fast-completed {
  background: var(--completed) !important;
  color: var(--completed-text) !important;
}

.cal-day.fast-skipped {
  background: var(--tier-weekly-light);
  opacity: 0.4;
}

.cal-day.clickable {
  cursor: pointer;
}

/* Legend */
.legend {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
  font-size: 12px;
  color: var(--text-muted);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

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

/* Schedule tab */
.schedule-section {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.schedule-section h3 {
  font-size: 16px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.schedule-section h3 .tier-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
}

.schedule-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.schedule-row:last-child {
  border-bottom: none;
}

.schedule-row .date-range {
  font-weight: 500;
}

.schedule-row .status {
  font-size: 12px;
  color: var(--text-muted);
}

.schedule-row .status.done {
  color: var(--completed-text);
  font-weight: 600;
}

.move-btn {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  font-size: 12px;
  cursor: pointer;
  color: var(--text-muted);
}

.move-btn:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

.weekly-day-selector {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.day-option {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card-bg);
  font-size: 13px;
  cursor: pointer;
  font-weight: 500;
}

.day-option.active {
  background: var(--tier-weekly);
  color: #fff;
  border-color: var(--tier-weekly);
}

.generate-section {
  text-align: center;
  padding: 20px;
}

.generate-btn {
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius);
  background: var(--text);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.generate-btn.secondary {
  background: var(--card-bg);
  color: var(--text);
  border: 1px solid var(--border);
  font-size: 13px;
  padding: 8px 16px;
  margin-top: 12px;
}

/* Date input for moving */
.date-input-inline {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
}
