.app {
  max-width: 960px;
  margin: 0 auto;
  min-height: 100vh;
}

.app-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.brand {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
}

.page {
  padding: 1.5rem;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.actions {
  display: flex;
  gap: 0.5rem;
}

.button {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}

.button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}

.button.danger {
  color: var(--danger);
  border-color: var(--danger);
}

.button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.error {
  color: var(--danger);
  background: #fdecea;
  border: 1px solid var(--danger);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
}

.search {
  width: 100%;
  margin-bottom: 1rem;
}

.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.recipe-card {
  display: block;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
  text-decoration: none;
  color: var(--text);
}

.recipe-card img,
.recipe-card-placeholder {
  width: 100%;
  height: 120px;
  object-fit: cover;
  background: var(--border);
}

.recipe-card-body {
  padding: 0.6rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.tag {
  display: inline-block;
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--border);
  border-radius: 4px;
  padding: 0.1rem 0.5rem;
  width: fit-content;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
}

.field-grid label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.row-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem;
  background: var(--surface);
}

.ingredient-row .qty {
  width: 5rem;
}

.ingredient-row .unit {
  width: 5rem;
}

.ingredient-row .text {
  flex: 1;
}

.checkbox-inline {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.step-row textarea {
  flex: 1;
}

.row-controls {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.row-controls button {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 4px;
  line-height: 1;
  padding: 0.1rem 0.3rem;
}

.step-number {
  text-align: center;
  font-weight: 600;
  color: var(--accent);
}

.remove {
  border: none;
  background: transparent;
  color: var(--danger);
  font-size: 1.1rem;
}

.image-preview {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.image-preview img {
  max-height: 120px;
  border-radius: 6px;
}

.detail-image {
  max-width: 100%;
  max-height: 300px;
  border-radius: 8px;
  margin-bottom: 1rem;
}

.timing-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  margin: 0.75rem 0;
  color: var(--text-muted);
}

.detail-columns {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 2rem;
  margin-top: 1rem;
}

.ingredient-list,
.step-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.ingredient-list li {
  display: flex;
  gap: 0.75rem;
}

.ingredient-list .qty {
  min-width: 4.5rem;
  color: var(--text-muted);
}

.ingredient-list .section-header {
  font-weight: 700;
  margin-top: 0.5rem;
}

.step-list {
  list-style: decimal;
  padding-left: 1.25rem;
}

.step-list li {
  white-space: pre-line;
}

.notes {
  white-space: pre-line;
  color: var(--text-muted);
}

.nutrition-summary {
  display: flex;
  gap: 1.5rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
}

@media (max-width: 640px) {
  .detail-columns {
    grid-template-columns: 1fr;
  }
}
