:root {
  --red: #e8645a;
  --teal: #2a9d8f;
  --yellow: #fde8a0;
  --text: #3a3a3a;
  --bg: #fffdf7;
  --card-bg: #ffffff;
  --border: #eadfc4;
}

* { box-sizing: border-box; }

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

.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 20px;
}

.site-header {
  background: var(--red);
  color: #fff;
  padding: 16px 0;
}
.site-header .wrap { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.brand { color: #fff; text-decoration: none; font-weight: 700; font-size: 1.2rem; }
.header-user { display: flex; align-items: center; gap: 12px; font-size: 0.9rem; }

main.wrap { padding: 28px 20px 60px; }

h1 { color: var(--red); margin-top: 0; }
h2 { color: var(--teal); font-size: 1.1rem; }

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-top: 16px;
}

label { display: block; margin: 12px 0 4px; font-weight: 600; }
input[type="text"], textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
}

.btn {
  display: inline-block;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s;
}
.btn:hover { opacity: 0.85; }
.btn-primary { background: var(--teal); color: #fff; }
.btn-ghost { background: var(--yellow); color: var(--text); }
.btn-danger { background: #fff; color: var(--red); border: 1px solid var(--red); }

.form-actions { margin-top: 18px; display: flex; gap: 10px; align-items: center; }

.page-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }

.user-grid { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }
.user-card {
  background: var(--teal);
  color: #fff;
  padding: 14px 20px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 600;
}

.habit-list { list-style: none; padding: 0; margin: 20px 0; }
.habit-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-left: 6px solid var(--teal);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 10px;
}
.habit-row.done { border-left-color: var(--red); background: #fff6f2; }

.toggle-form { margin: 0; }
.check-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--teal);
  background: #fff;
  color: var(--red);
  font-size: 1.1rem;
  cursor: pointer;
  flex-shrink: 0;
}
.habit-row.done .check-btn { background: var(--red); border-color: var(--red); color: #fff; }

.habit-info { flex: 1; min-width: 0; }
.habit-name { font-weight: 700; text-decoration: none; color: var(--text); }
.habit-desc { margin: 4px 0 0; font-size: 0.85rem; color: #777; }

.habit-streak { font-size: 0.9rem; white-space: nowrap; }
.habit-actions { display: flex; gap: 6px; }
.habit-actions form { margin: 0; }

.muted { color: #888; }
.small { font-size: 0.85rem; }

.flash-list { margin-bottom: 16px; }
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 8px; font-size: 0.9rem; }
.flash-success { background: #e3f3ef; color: var(--teal); }
.flash-error { background: #fdeceb; color: var(--red); }

.history-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 6px;
  margin: 12px 0;
}
.history-cell {
  aspect-ratio: 1;
  border: 1px solid var(--border);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  background: #f7f4ea;
}
.history-cell.done { background: var(--teal); color: #fff; border-color: var(--teal); }
.history-date { font-size: 0.65rem; opacity: 0.7; }
.history-mark { font-weight: 700; }

.site-footer {
  background: var(--yellow);
  color: var(--text);
  text-align: center;
  padding: 16px 0;
  font-size: 0.85rem;
}
