@font-face {
  font-family: "DejaVu Sans";
  src: url("/static/fonts/DejaVuSans-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #f5f4f0;
  --ink: #1a1917;
  --muted: #7a776f;
  --faint: #c5c1b8;
  --line: #ddd9d0;
  --closed: #3d7a52;
  --partial: #c49a3c;
  --missed: #c45c4c;
  --fill-closed: #b9d4c0;
  --fill-partial: #ead7a0;
  --fill-missed: #e8c4bd;
  --frozen: #4d7a8c;
  --fill-frozen: #c4dce6;
  --empty: #eceae4;
  --focus: #1a1917;
  --theme-meta: #f5f4f0;
  --habit-train-ink: #5d7466;
  --habit-train-wash: #e3ebe6;
  --habit-sleep-ink: #6a7380;
  --habit-sleep-wash: #e5e8ec;
  --habit-alcohol-ink: #7a6562;
  --habit-alcohol-wash: #ece6e4;
  --habit-read-ink: #74685c;
  --habit-read-wash: #ebe6df;
  --habit-food-ink: #6e735e;
  --habit-food-wash: #e7eadf;
  --habit-generic-ink: #7a776f;
  --habit-generic-wash: #eceae4;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "DejaVu Sans", sans-serif;
  font-weight: 700;
  font-size: 14px;
  line-height: 1.3;
  background: var(--bg);
  color: var(--ink);
}
h1, h2, h3, small { font-size: inherit; font-weight: 700; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; font-weight: 700; }

.shell {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding: 28px 0 80px;
}
.topbar, .topbar-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.topbar { margin-bottom: 36px; }
.brand {
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.who { color: var(--muted); }
.who:hover { color: var(--ink); }
.text-link, .topbar button {
  background: none;
  border: 0;
  color: var(--muted);
  padding: 8px 0;
  cursor: pointer;
}
.text-link:hover, .topbar button:hover { color: var(--ink); }
.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
}
.hero h1, .auth h1 {
  margin: 0;
  line-height: 1.15;
}
.hero { margin-bottom: 24px; }
.hero-meta, .group-meta {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: baseline;
  margin-top: 10px;
}
.chip { color: var(--muted); }
.chip.status-closed { color: var(--closed); }
.chip.status-partial { color: var(--partial); }
.chip.status-missed { color: var(--missed); }
.chip.status-frozen { color: var(--frozen); }

.group-strip { margin-bottom: 40px; }
.group-score { margin: 0; }
.pills {
  display: flex;
  gap: 24px;
  overflow-x: auto;
  padding: 14px 0 0;
  scrollbar-width: none;
}
.pill {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  padding-bottom: 4px;
  border-bottom: 2px solid transparent;
}
.pill.current {
  color: var(--ink);
  border-bottom-color: var(--ink);
}
.pill small { color: var(--muted); }
.avatar {
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: 4px;
  flex: 0 0 32px;
  background: var(--empty);
}
.pill-body { display: flex; flex-direction: column; gap: 2px; }
.habit-copy small, .muted, .hint { color: var(--muted); }

.banner, .flash { margin: 0 0 24px; color: var(--muted); }
.flash.bad { color: var(--ink); }

.workspace {
  display: grid;
  gap: 48px;
  grid-template-areas:
    "day"
    "cal";
}
.calendar-wrap { grid-area: cal; }
.day-pane { grid-area: day; }
.checklist { display: grid; gap: 0; margin: 0; }
.habit {
  --habit-ink: var(--habit-generic-ink);
  --habit-wash: var(--habit-generic-wash);
  --habit-mask: url("/static/icons/habits/generic.svg");
  width: 100%;
  display: flex;
  gap: 12px;
  align-items: center;
  text-align: left;
  min-height: 56px;
  padding: 10px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  color: var(--ink);
  cursor: pointer;
}
.habit:first-child { border-top: 1px solid var(--line); }
.habit.readonly { cursor: default; }
.habit.on { color: var(--muted); }
.habit.quota { color: var(--muted); }
.habit.icon-train { --habit-ink: var(--habit-train-ink); --habit-wash: var(--habit-train-wash); --habit-mask: url("/static/icons/habits/train.svg"); }
.habit.icon-sleep { --habit-ink: var(--habit-sleep-ink); --habit-wash: var(--habit-sleep-wash); --habit-mask: url("/static/icons/habits/sleep.svg"); }
.habit.icon-alcohol { --habit-ink: var(--habit-alcohol-ink); --habit-wash: var(--habit-alcohol-wash); --habit-mask: url("/static/icons/habits/alcohol.svg"); }
.habit.icon-read { --habit-ink: var(--habit-read-ink); --habit-wash: var(--habit-read-wash); --habit-mask: url("/static/icons/habits/read.svg"); }
.habit.icon-food { --habit-ink: var(--habit-food-ink); --habit-wash: var(--habit-food-wash); --habit-mask: url("/static/icons/habits/food.svg"); }
.habit-icon {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  background: var(--habit-wash);
  color: var(--habit-ink);
  flex: 0 0 32px;
  position: relative;
}
.habit-icon::before {
  content: "";
  position: absolute;
  inset: 7px;
  background: currentColor;
  mask: var(--habit-mask) center / contain no-repeat;
  -webkit-mask: var(--habit-mask) center / contain no-repeat;
}
.habit.on .habit-icon {
  box-shadow: inset 0 0 0 1.5px var(--habit-ink);
}
.mark {
  width: 14px;
  height: 14px;
  margin-left: auto;
  border-radius: 2px;
  border: 1px solid var(--faint);
  flex: 0 0 14px;
}
.habit.on .mark {
  background: var(--habit-ink);
  border-color: var(--habit-ink);
}
.habit.quota .mark {
  border-color: var(--habit-ink);
}
.habit-copy { display: flex; flex-direction: column; gap: 2px; flex: 1; }

.calendar-head {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.calendar-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.calendar-head h2 {
  margin: 0;
  text-align: center;
  text-transform: capitalize;
}
.jump-today {
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.jump-today:hover,
.jump-today.is-now { color: var(--ink); }
.dow, .calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}
.icon-btn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  color: var(--ink);
  font-size: 22px;
  border: 1px solid var(--line);
  background: none;
}
.icon-btn:hover { border-color: var(--ink); }
.dow {
  margin-bottom: 0;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  text-align: center;
  padding-bottom: 8px;
}
.calendar {
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}
.cell {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  color: var(--ink);
  text-decoration: none;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  position: relative;
}
.cell .num {
  position: relative;
  line-height: 1;
}
.cell.status-empty { background: var(--empty); }
.cell.status-closed { background: var(--fill-closed); }
.cell.status-partial { background: var(--fill-partial); }
.cell.status-missed { background: var(--fill-missed); }
.cell.status-frozen { background: var(--fill-frozen); }
.cell.status-future,
.cell.status-outside { color: var(--muted); }
.cell.today .num::after {
  content: "";
  position: absolute;
  left: 50%;
  top: calc(100% + 4px);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ink);
  transform: translateX(-50%);
}
.cell.selected {
  z-index: 1;
  outline: 2px solid var(--ink);
  outline-offset: -2px;
}
.cell.placeholder {
  background: transparent;
  pointer-events: none;
}
.legend {
  display: flex;
  gap: 16px;
  padding: 0;
  margin: 12px 0 0;
  list-style: none;
  color: var(--muted);
  flex-wrap: wrap;
}
.legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  vertical-align: middle;
  background: var(--empty);
  border: 1px solid var(--line);
}
.legend .status-closed { background: var(--fill-closed); }
.legend .status-partial { background: var(--fill-partial); }
.legend .status-missed { background: var(--fill-missed); }
.legend .status-frozen { background: var(--fill-frozen); }
.freeze-form {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  max-width: 420px;
}
.freeze-label {
  margin: 0;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.freeze-note {
  margin: 0;
  padding-top: 4px;
}
.freeze-comment {
  margin: 0 0 12px;
  max-width: 420px;
}
.icon-btn.disabled {
  opacity: 0.28;
  pointer-events: none;
}

.auth {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-card, .panel { padding: 0; margin-bottom: 40px; max-width: 480px; }
.invite-box { max-width: none; }
.invite-row {
  display: grid;
  gap: 4px;
  margin: 12px 0 8px;
  justify-items: start;
}
.invite-url {
  margin: 0;
  word-break: break-all;
}
.panel h2 { margin: 0 0 16px; }
.lead { color: var(--muted); }
.stack { display: grid; gap: 18px; }
.inline-form { grid-template-columns: 1fr 1fr auto; align-items: end; }
label {
  display: grid;
  gap: 8px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
input {
  width: 100%;
  background: transparent;
  color: var(--ink);
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 10px 0;
  min-height: 44px;
}
input:focus {
  outline: none;
  border-bottom-color: var(--ink);
}
.btn {
  border: 0;
  background: none;
  color: var(--ink);
  padding: 12px 0;
  min-height: 44px;
  cursor: pointer;
  text-align: left;
}
.btn.primary { text-decoration: underline; text-underline-offset: 4px; }
.table { list-style: none; padding: 0; margin: 0; }
.table li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.table small { display: block; color: var(--muted); }
.row-actions {
  display: flex;
  gap: 16px;
  flex-shrink: 0;
}

.profile-identity {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 8px 32px;
  align-items: center;
  max-width: 520px;
}
.profile-photo {
  width: 120px;
  height: 120px;
  margin: 0;
  border-radius: 4px;
  background: var(--empty);
  color: var(--muted);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.profile-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.profile-name { margin: 0; }
.profile-photo-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
  max-width: 520px;
  margin: 16px 0 0;
}
.file-pick {
  position: relative;
  display: inline-flex;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}
.file-pick input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  border: 0;
}
.profile-secret {
  max-width: 520px;
  margin-top: 40px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
}
.profile-secret h2 { margin: 0 0 16px; }
input[type="file"] {
  padding: 12px 0;
  color: var(--muted);
}
input[type="file"]::file-selector-button {
  border: 0;
  background: none;
  color: var(--ink);
  padding: 0;
  margin: 0 12px 0 0;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 4px;
}

@media (min-width: 900px) {
  .workspace {
    grid-template-areas: "cal day";
    grid-template-columns: minmax(500px, 1.15fr) minmax(320px, 0.85fr);
    gap: 64px;
    align-items: start;
  }
  .day-pane { position: sticky; top: 28px; }
}

@media (max-width: 640px) {
  .inline-form { grid-template-columns: 1fr; }
  .shell { width: calc(100% - 32px); padding-top: 20px; }
  .profile-identity { grid-template-columns: 96px minmax(0, 1fr); gap: 8px 20px; }
  .profile-photo { width: 96px; height: 96px; }
}
