/* Habits list: one row per routine with its time, streak and today's tick. */

.habits-summary {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
  color: var(--body);
  font-size: 0.88rem;
  white-space: nowrap;
}

.habits-summary strong {
  color: var(--ink);
}

.habits-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.habit-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 12px 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, background-color 0.15s;
}

.habit-row:hover {
  border-color: var(--line-strong);
}

.habit-row.completed {
  background: var(--surface-soft);
}

.habit-row.completed .habit-title {
  color: var(--faint);
  text-decoration: line-through;
}

.habit-row.paused {
  background: var(--surface-soft);
  box-shadow: none;
}

.habit-row.paused .habit-title,
.habit-row.paused .habit-time {
  color: var(--faint);
}

.habit-toggle {
  display: inline-flex;
  flex: none;
  margin: 0;
}

.habit-toggle .task-checkbox {
  width: 20px;
  height: 20px;
}

.habit-time {
  flex: none;
  min-width: 46px;
  padding: 3px 8px;
  border-radius: 8px;
  background: var(--teal-wash);
  color: var(--teal-ink);
  font-size: 0.8rem;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.habit-info {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.habit-title {
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.habit-title:hover {
  color: var(--teal-ink);
}

.habit-meta {
  color: var(--muted);
  font-size: 0.8rem;
}

.habit-badge {
  flex: none;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-sunken);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
}

.habit-actions {
  display: flex;
  flex: none;
  align-items: center;
  gap: 2px;
}

@media (max-width: 640px) {
  .habit-row {
    flex-wrap: wrap;
  }

  .habit-info {
    flex: 1 1 140px;
  }

  .habit-actions {
    flex: 1 1 100%;
    justify-content: flex-end;
  }
}

.habit-days {
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
}

.habit-days legend {
  padding: 0;
}

.habit-days-options {
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-auto-flow: row;
}

/* A note on the day's check-in, such as a score or how it went. */

.habit-note {
  margin-top: 4px;
  font-size: 0.8rem;
}

.habit-note summary {
  color: var(--teal-ink);
  font-weight: 600;
  cursor: pointer;
}

.habit-note-text {
  color: var(--body);
  font-weight: 400;
  overflow-wrap: anywhere;
}

.habit-note-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  margin-top: 4px;
}

.habit-note-form input[type="text"] {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* Check-in history on a habit's page. */

.habit-history-title {
  margin: 0 0 10px;
  font-size: 1rem;
}

.habit-history {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.habit-history-row {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.habit-history-date {
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 600;
}
