:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --text: #1f2421;
  --muted: #6b7370;
  --border: #e3e1da;
  --accent: #2f7d5b;
  --accent-text: #ffffff;
  --accent-soft: #dcefe5;
  --danger: #b3402f;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161a18;
    --surface: #1f2522;
    --text: #e8ebe9;
    --muted: #98a19d;
    --border: #2e3632;
    --accent: #4fae84;
    --accent-text: #0f1512;
    --accent-soft: #24382f;
    --danger: #e0806f;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

[hidden] {
  display: none !important;
}

h1,
h2 {
  margin: 0;
  font-weight: 600;
}

h1 {
  font-size: 20px;
}

input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: inherit;
  font: inherit;
}

input:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button {
  font: inherit;
  cursor: pointer;
}

button.primary {
  padding: 10px 20px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
  white-space: nowrap;
}

button.primary:disabled {
  background: var(--accent-soft);
  color: var(--accent);
  cursor: default;
}

button.link {
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 14px;
}

button.link:hover {
  color: var(--text);
}

button.link.danger:hover {
  color: var(--danger);
}

.error {
  min-height: 1.5em;
  margin: 8px 0;
  color: var(--danger);
  font-size: 14px;
}

/* 登录 */

.login {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 16px;
}

.login-card {
  display: grid;
  gap: 16px;
  width: 100%;
  max-width: 340px;
  padding: 32px 28px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}

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

.login-card label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
}

.login-card .error {
  margin: 0;
}

/* 主界面 */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 640px;
  margin: 0 auto;
  padding: 20px 16px 0;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
}

.content {
  max-width: 640px;
  margin: 0 auto;
  padding: 20px 16px 48px;
}

.create {
  display: flex;
  gap: 8px;
}

.empty {
  margin: 40px 0;
  color: var(--muted);
  text-align: center;
}

.projects {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.project {
  padding: 18px 20px 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}

.project-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.project-info {
  min-width: 0;
}

.project-name {
  overflow-wrap: anywhere;
  font-size: 17px;
}

.stats {
  display: flex;
  gap: 24px;
  margin: 8px 0 0;
}

.stats dt {
  color: var(--muted);
  font-size: 12px;
}

.stats dd {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.stats b {
  color: var(--text);
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}

.project-foot {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

/* 打卡记录日历 */

.calendar {
  max-width: 340px;
  margin: 8px auto 8px;
}

.calendar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 600;
}

.calendar-nav button {
  width: 32px;
  font-size: 20px;
  line-height: 1;
}

.weekdays,
.days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  text-align: center;
}

.weekdays {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.day {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 50%;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.day.checked {
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
}

.day.today:not(.checked) {
  box-shadow: inset 0 0 0 1.5px var(--accent);
}

.day.future {
  color: var(--border);
}
