/* Recipe grid/cards, document tables and status pills. */
.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  align-items: start;
}

.recipe-grid > * {
  min-width: 0;
}

.document-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 900px));
  justify-content: start;
  align-items: start;
  gap: 16px;
}

.recipes-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 18px;
  align-items: start;
}

.recipes-main {
  display: grid;
  gap: 14px;
}

.recipes-sidebar {
  --recipes-sidebar-offset: 12px;
  position: sticky;
  top: var(--recipes-sidebar-offset);
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: calc(100dvh - (var(--recipes-sidebar-offset) * 2));
  overflow: hidden;
}

.tag-filter-list {
  display: grid;
  gap: 8px;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
  scrollbar-gutter: stable;
}

.tag-filter-link {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 14px;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(24, 48, 45, 0.08);
  font-size: 0.92rem;
}

.tag-filter-link-active {
  background: rgba(220, 107, 66, 0.12);
  border-color: rgba(220, 107, 66, 0.22);
}

.recipe-card,
.document-card,
.admin-table-card,
.empty-state,
.detail-card {
  padding: 16px;
}

.recipe-card,
.chat-result-card {
  display: grid;
  gap: 10px;
  align-content: start;
  min-width: 0;
  overflow: hidden;
}

.recipe-card-top h3,
.document-card h3 {
  margin: 4px 0 6px;
  font-size: 1rem;
  line-height: 1.22;
  min-width: 0;
}

.recipe-card-top h3 a,
.chat-result-card h3 a {
  display: -webkit-box;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.recipe-card-topbar,
.chat-result-topbar {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 10px;
  min-width: 0;
}

.recipe-category,
.document-status {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.68rem;
  color: var(--accent);
  font-weight: 700;
}

.recipe-snippet,
.document-error {
  color: var(--muted);
}

.recipe-card-media {
  position: relative;
  height: 104px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(24, 48, 45, 0.08);
  background:
    linear-gradient(135deg, rgba(220, 107, 66, 0.16), rgba(142, 164, 79, 0.18)),
    rgba(255, 255, 255, 0.72);
}

.recipe-card-media-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  color: var(--muted);
  text-align: center;
  font-size: 0.84rem;
  font-weight: 600;
}

.recipe-card-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.recipe-meta,
.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.84rem;
  min-width: 0;
}

.recipe-card .recipe-meta,
.chat-result-card .recipe-meta {
  display: grid;
  gap: 4px;
}

.recipe-meta-primary,
.recipe-meta-secondary {
  min-width: 0;
}

.recipe-meta-primary {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.favorite-toggle-form,
.favorite-detail-form {
  margin: 0;
}

.favorite-toggle-button,
.favorite-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 14px;
  border: 1px solid rgba(24, 48, 45, 0.14);
  background: rgba(255, 255, 255, 0.88);
  color: var(--muted);
  box-shadow: none;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.favorite-toggle-button {
  width: 36px;
  height: 36px;
  padding: 0;
}

.favorite-pill {
  padding: 9px 13px;
}

.favorite-toggle-button:hover,
.favorite-pill:hover {
  transform: translateY(-1px);
  background: white;
  border-color: rgba(220, 107, 66, 0.28);
  color: var(--accent);
}

.favorite-toggle-button:disabled,
.favorite-pill:disabled {
  cursor: wait;
  opacity: 0.72;
  transform: none;
}

.favorite-toggle-button-active,
.favorite-pill-active {
  background: rgba(220, 107, 66, 0.14);
  border-color: rgba(220, 107, 66, 0.28);
  color: var(--accent);
}

.favorite-toggle-button span,
.favorite-pill span {
  font-size: 1rem;
  line-height: 1;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.document-card dl,
.nutrition-grid {
  display: grid;
  gap: 8px;
  margin: 10px 0 0;
}

.document-card dt,
.nutrition-grid dt {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.document-card dd,
.nutrition-grid dd {
  margin: 4px 0 0;
  font-weight: 700;
}

.admin-table-card {
  padding: 0;
  overflow: hidden;
}

.document-table-wrap {
  overflow-x: auto;
}

.document-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 880px;
}

.document-table th,
.document-table td {
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid rgba(24, 48, 45, 0.08);
}

.document-table th {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
}

.document-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.55);
}

.document-table tbody tr:last-child td {
  border-bottom: 0;
}

.document-primary-cell {
  display: grid;
  gap: 4px;
}

.document-primary-cell strong {
  font-size: 0.95rem;
}

.document-status-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid currentColor;
  background: rgba(255, 255, 255, 0.72);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.document-actions-heading {
  text-align: right;
  width: 190px;
  min-width: 190px;
}

.document-actions-cell {
  width: 190px;
  min-width: 190px;
  white-space: nowrap;
}

.document-icon-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
  min-width: 168px;
}

.document-icon-actions form {
  margin: 0;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid rgba(24, 48, 45, 0.14);
  background: rgba(255, 255, 255, 0.84);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

.icon-button:hover {
  transform: translateY(-1px);
  background: white;
  border-color: rgba(24, 48, 45, 0.22);
}

.icon-button-with-label {
  width: auto;
  height: auto;
  gap: 8px;
  padding: 10px 14px;
  font-weight: 700;
}

.icon-button svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.icon-button-danger {
  color: var(--danger);
  border-color: rgba(178, 76, 64, 0.24);
}

.icon-button-accent {
  color: var(--accent-2);
  border-color: rgba(92, 112, 92, 0.24);
}

.icon-button-accent:hover {
  background: rgba(92, 112, 92, 0.08);
  border-color: rgba(92, 112, 92, 0.4);
}

.icon-button-danger:hover {
  background: rgba(178, 76, 64, 0.08);
  border-color: rgba(178, 76, 64, 0.4);
}

.status-processed {
  color: var(--accent-2);
}

.status-failed {
  color: var(--danger);
}

.status-needs_ocr {
  color: #a36d17;
}

.status-no_recipes {
  color: #7f6f2f;
}
