:root {
  color-scheme: light;
  font-family: Arial, sans-serif;
  background: #f7f7f4;
  color: #1f2933;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 104px minmax(280px, 380px) 1fr;
  min-height: 100vh;
}

.sidebar {
  background: #24312f;
  color: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 18px 10px;
}

.brand {
  font-weight: 700;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  margin-bottom: 22px;
}

.icon-button {
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 8px;
  background: #f4c95d;
  color: #111827;
  font-size: 34px;
  font-weight: 700;
  line-height: 1;
}

.nav-button {
  width: 84px;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 8px;
  background: transparent;
  color: white;
  padding: 9px 7px;
  font-size: 13px;
}

.nav-button.active {
  background: rgba(255, 255, 255, .12);
}

.recipe-list-panel {
  border-right: 1px solid #d8d6ce;
  background: #ffffff;
  min-width: 0;
}

.toolbar {
  padding: 18px;
  border-bottom: 1px solid #e5e1d7;
}

.filter-panel {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.filter-group {
  display: grid;
  gap: 6px;
}

.filter-heading {
  color: #69756f;
  font-size: 12px;
  font-weight: 700;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-chip {
  border: 1px solid #d5ccba;
  border-radius: 8px;
  background: #fffdfa;
  color: #334155;
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 700;
}

.filter-chip.active {
  border-color: #24312f;
  background: #24312f;
  color: #fff;
}

.toolbar input,
.dialog-form input,
.detail-form input,
.detail-form textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #c9c4b8;
  border-radius: 8px;
  background: #fffdfa;
  color: #1f2933;
}

.recipe-list {
  display: grid;
}

.recipe-row {
  text-align: left;
  border: 0;
  border-bottom: 1px solid #ebe7dd;
  background: white;
  padding: 12px 18px;
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 12px;
  align-items: center;
}

.recipe-row:not(:has(.recipe-row-image)) {
  grid-template-columns: 1fr;
}

.recipe-row:hover,
.recipe-row.selected {
  background: #f7f3e8;
}

.recipe-row-image {
  width: 58px;
  height: 58px;
  border-radius: 8px;
  object-fit: cover;
  background: #efe9dc;
}

.recipe-row-text {
  min-width: 0;
}

.recipe-row strong {
  display: block;
  margin-bottom: 5px;
  overflow-wrap: anywhere;
}

.recipe-row span {
  color: #69756f;
  font-size: 14px;
}

.recipe-row-rating {
  display: block;
  margin-top: 4px;
  color: #d6a319;
  font-size: 15px;
  letter-spacing: 0;
}

.empty-list {
  color: #69756f;
  padding: 18px;
}

.recipe-detail {
  padding: 26px;
  max-width: 920px;
  min-width: 0;
}

.recipe-detail.empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
}

.detail-form {
  display: grid;
  gap: 14px;
}

.detail-form h1 {
  margin: 0 0 4px;
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1.08;
  overflow-wrap: anywhere;
}

.recipe-image-button {
  justify-self: start;
  max-width: min(360px, 100%);
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: transparent;
}

.recipe-image {
  display: block;
  width: 100%;
  max-height: 260px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid #d8d6ce;
}

.detail-form label,
.dialog-form label,
.rating-field {
  display: grid;
  gap: 7px;
  color: #334155;
  font-weight: 700;
}

.star-rating {
  display: flex;
  gap: 3px;
  align-items: center;
}

.star-button {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #c7bca2;
  font-size: 28px;
  line-height: 1;
  padding: 0;
}

.star-button.active,
.star-button:hover,
.star-button:focus-visible {
  color: #f4c95d;
}

.detail-form textarea {
  min-height: 110px;
  resize: vertical;
}

.detail-form textarea.tall-textarea {
  min-height: 170px;
  line-height: 1.45;
}

.source-link {
  color: #1f5d56;
  font-weight: 700;
}

.primary {
  justify-self: start;
  border: 0;
  border-radius: 8px;
  background: #24312f;
  color: white;
  padding: 11px 16px;
  font-weight: 700;
}

.dialog-form {
  min-width: min(520px, 90vw);
  display: grid;
  gap: 14px;
}

.dialog-form h2 {
  margin: 0;
}

.dialog-form menu {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 0;
  margin: 0;
}

.dialog-form menu button {
  border: 1px solid #c9c4b8;
  border-radius: 8px;
  background: white;
  padding: 10px 14px;
}

.dialog-form menu .primary {
  border: 0;
  background: #24312f;
}

.image-dialog {
  width: min(940px, 92vw);
  max-height: 90vh;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: #111827;
}

.image-dialog::backdrop {
  background: rgba(17, 24, 39, .72);
}

.image-dialog img {
  display: block;
  width: 100%;
  max-height: 90vh;
  object-fit: contain;
}

.image-dialog-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, .9);
  color: #111827;
  font-size: 28px;
  line-height: 1;
}

@media (max-width: 760px) {
  .app-shell {
    grid-template-columns: 76px 1fr;
  }

  .sidebar {
    padding-inline: 8px;
  }

  .icon-button {
    width: 52px;
    height: 52px;
  }

  .nav-button {
    width: 60px;
    font-size: 12px;
  }

  .recipe-detail {
    grid-column: 1 / -1;
    border-top: 1px solid #d8d6ce;
    padding: 20px;
  }
}
