:root {
  color-scheme: light dark;
  --line: light-dark(#ddd, #3a3a3a);
  --muted: light-dark(#666, #a5a5a5);
  --panel: light-dark(#fff, #1e1e1e);
  --page: light-dark(#f6f5f2, #141414);
  --accent: light-dark(#23613f, #7cc79b);
  --note: light-dark(#f3f1e7, #2a2922);
}

* {
  box-sizing: border-box;
}

/* Keep the page the same width on tabs too short to scroll. */
html {
  scrollbar-gutter: stable;
}

body {
  background: var(--page);
  font: 16px/1.4 system-ui, sans-serif;
  margin: 0 auto;
  max-width: 1100px;
  padding: 0 1rem 4rem;
}

h2 {
  font-size: 1.15rem;
  margin: 1.5rem 0 0.5rem;
}

h3 {
  font-size: 1rem;
  margin: 0;
}

p {
  margin: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
select {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 2.25rem;
  padding: 0.25rem 0.6rem;
}

button:not(:disabled) {
  cursor: pointer;
}

button[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--panel);
}

button.link {
  background: none;
  border: 0;
  color: var(--accent);
  padding: 0;
  text-decoration: underline;
}

textarea,
input[type="search"],
input[type="password"] {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.5rem;
  width: 100%;
}

#tabs {
  background: var(--page);
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 0;
  position: sticky;
  top: 0;
  z-index: 1;
}

#tabs button {
  flex: 1;
  padding-inline: 0.25rem;
  white-space: nowrap;
}

#error {
  background: light-dark(#fbe3e0, #4a211c);
  border-radius: 6px;
  margin-bottom: 0.75rem;
  padding: 0.5rem 0.75rem;
}

#login {
  display: grid;
  gap: 0.75rem;
  margin: 20vh auto 0;
  max-width: 300px;
}

.muted {
  color: var(--muted);
  font-size: 0.875rem;
}

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

.chips,
.filters,
.badges,
.steppers,
.actions,
.search {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.actions {
  align-items: center;
  gap: 1rem;
}

.search input {
  flex: 1;
}

.filters {
  justify-content: space-between;
}

.toggle {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  gap: 0.4rem;
  min-height: 2.25rem;
  padding: 0.25rem 0.6rem;
}

.grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  margin: 0.75rem 0;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.card > img,
.card > .no-photo {
  aspect-ratio: 2;
  flex: none;
  object-fit: cover;
  width: 100%;
}

.card > .no-photo {
  background: var(--note);
}

.card.planned {
  outline: 2px solid var(--accent);
}

.card.passed > img {
  filter: grayscale(0.8);
  opacity: 0.5;
}

.card.excluded > img,
.card.excluded > .card-body {
  opacity: 0.5;
}

.exclude {
  position: absolute;
  right: 0.5rem;
  top: 0.5rem;
}

.card-body,
.editor {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.5rem;
}

.card-body {
  padding: 0.75rem;
}

.card-controls {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: auto;
}

.badge {
  border-radius: 99px;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.1rem 0.6rem;
  white-space: nowrap;
}

.badge.great {
  background: #1d7a46;
  color: #fff;
}

.badge.good {
  background: #cfe9d8;
  color: #124a2a;
}

.badge.fence {
  background: #f4e3ae;
  color: #5a4300;
}

.badge.pass {
  background: #f2cbc5;
  color: #6f1a10;
}

.badge.unrated {
  border: 1px solid var(--line);
  color: var(--muted);
}

.badge.new {
  background: #d5e3f8;
  color: #163d73;
}

.note {
  background: var(--note);
  border-radius: 6px;
  font-size: 0.9rem;
  padding: 0.5rem;
  white-space: pre-line;
}

.suggestion {
  align-items: center;
  border: 1px dashed var(--line);
  border-radius: 6px;
  display: flex;
  font-size: 0.9rem;
  gap: 0.4rem;
  padding: 0.5rem;
}

.suggestion > span:first-child {
  flex: 1;
}

.stepper {
  align-items: center;
  display: flex;
  gap: 0.4rem;
}

.stepper button {
  min-width: 2.25rem;
}

.stepper .count {
  min-width: 1ch;
  text-align: center;
}

.steppers {
  gap: 1rem;
}

.rows,
.changes {
  list-style: none;
  margin: 0;
  padding: 0;
}

.row {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.5rem 0;
}

.row img,
.row .no-photo {
  border-radius: 6px;
  height: 48px;
  object-fit: cover;
  width: 72px;
}

.row-name {
  flex: 1;
  min-width: 10rem;
}

.changes li {
  padding: 0.3rem 0;
}

textarea.note {
  /* Grow to fit the note, where the browser supports it, and to fill the card. */
  field-sizing: content;
  flex: 1 0 auto;
  min-height: 6rem;
  resize: none;
  white-space: pre-wrap;
}

.field {
  display: grid;
  font-size: 0.875rem;
  gap: 0.25rem;
}

details {
  margin: 0.75rem 0;
}

summary {
  cursor: pointer;
  margin-bottom: 0.5rem;
}
