:root {
  --bg: #f7f4ef;
  --card: #ffffff;
  --text: #2c2c2c;
  --text-muted: #6b6b6b;
  --border: #e8e2d9;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  --radius: 14px;
  --transition: 0.4s ease;
}

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

body {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

.app {
  max-width: 640px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

.header {
  text-align: center;
  margin-bottom: 2rem;
}

.header h1 {
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.subtitle {
  margin-top: 0.5rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.sync-status {
  display: inline-block;
  margin-top: 0.75rem;
  font-size: 0.8rem;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  background: #e8e2d9;
  color: var(--text-muted);
}

.sync-status--synced { background: #d4edda; color: #2c5a3c; }
.sync-status--syncing { background: #fff3cd; color: #856404; }
.sync-status--error { background: #f8d7da; color: #721c24; }
.sync-status--local { background: #e8e2d9; color: var(--text-muted); }

.auth-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}

.auth-details {
  cursor: default;
}

.auth-summary {
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  margin-bottom: 0.75rem;
  list-style: none;
}

.auth-summary::-webkit-details-marker {
  display: none;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.auth-input {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  width: 100%;
}

.auth-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.auth-logged-in {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.auth-email {
  font-size: 0.9rem;
  color: var(--text);
}

.auth-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

.auth-hint code {
  font-size: 0.78rem;
  background: #f3efe8;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

.auth-message {
  font-size: 0.85rem;
}

.auth-message--error { color: #c45c5c; }
.auth-message--ok { color: #2c5a3c; }

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.82rem;
}

.dimensions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.dimension-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.dimension-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.dimension-label {
  font-weight: 600;
  font-size: 1rem;
  min-width: 3rem;
}

.dimension-value {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.progress-track {
  height: 12px;
  background: #ece8e1;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  width: 0%;
  transition: width var(--transition), background-color var(--transition);
}

.progress-fill--low {
  background-color: #c45c5c;
}

.progress-fill--mid {
  background-color: #d4a03c;
}

.progress-fill--high {
  background-color: #5a9e6f;
}

.dimension-message {
  font-size: 0.88rem;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 0.75rem;
  min-height: 1.4em;
}

.dimension-actions {
  display: flex;
  justify-content: flex-end;
}

.btn {
  border: none;
  border-radius: 8px;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-increment {
  background: #4a7c9e;
  color: #fff;
}

.btn-increment:hover:not(:disabled) {
  background: #3d6a87;
}

.btn-decrement {
  background: #e8e2d9;
  color: var(--text-muted);
}

.btn-decrement:hover:not(:disabled) {
  background: #ddd6cb;
}

.dimension-actions {
  gap: 0.5rem;
}

.calendar {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  margin-top: 2rem;
}

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

.calendar-title {
  font-size: 1.1rem;
  font-weight: 600;
}

.cal-nav {
  padding: 0.25rem 0.75rem;
  font-size: 1.1rem;
  line-height: 1;
}

.calendar-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  justify-content: center;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.calendar-stats .stat b {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

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

.calendar-weekday {
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  padding-bottom: 0.25rem;
}

.calendar-cell {
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f3efe8;
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.2s;
}

.calendar-cell:hover:not(:disabled) {
  transform: translateY(-1px);
}

.calendar-cell--blank {
  border: none;
  background: transparent;
  cursor: default;
}

.calendar-cell--future {
  background: #f7f4ef;
  color: #c4bdb1;
  cursor: not-allowed;
}

.calendar-cell--none {
  background: #e6b8b8;
  color: #6b2c2c;
}

.calendar-cell--partial {
  background: #eccf8e;
  color: #6b5320;
}

.calendar-cell--full {
  background: #a9d6b8;
  color: #2c5a3c;
}

.calendar-cell--today {
  font-weight: 700;
  box-shadow: inset 0 0 0 2px #4a7c9e;
}

.calendar-cell--selected {
  outline: 2px solid #2c2c2c;
  outline-offset: 1px;
}

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  margin-top: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

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

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

.legend-dot--full { background: #a9d6b8; }
.legend-dot--partial { background: #eccf8e; }
.legend-dot--none { background: #e6b8b8; }

.calendar-detail {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
  min-height: 2.5rem;
}

.detail-hint,
.detail-none {
  color: var(--text-muted);
}

.detail-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.detail-done { color: #2c5a3c; }
.detail-missing { color: #8a6a1f; margin-top: 0.2rem; }
.detail-full { color: #2c5a3c; margin-top: 0.2rem; }

.day-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.day-chip {
  border: 1px solid var(--border);
  background: #f3efe8;
  color: var(--text-muted);
  border-radius: 999px;
  padding: 0.3rem 0.85rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.day-chip:hover:not(:disabled) {
  border-color: #5a9e6f;
}

.day-chip--on {
  background: #a9d6b8;
  color: #2c5a3c;
  border-color: #8cc6a0;
  font-weight: 600;
}

.day-chip:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.detail-tip {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 0.3rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.btn-secondary {
  background: #e8e2d9;
  color: var(--text);
}

.btn-secondary:hover:not(:disabled) {
  background: #ddd6cb;
}

.btn-danger {
  background: #c45c5c;
  color: #fff;
}

.btn-danger:hover:not(:disabled) {
  background: #a84d4d;
}

@media (max-width: 480px) {
  .app {
    padding: 1.5rem 1rem 2.5rem;
  }

  .header h1 {
    font-size: 1.35rem;
  }

  .actions {
    flex-direction: column;
  }

  .actions .btn {
    width: 100%;
  }
}
