:root {
  color-scheme: dark;
  --bg: #121212;
  --surface: #1a1a1a;
  --surface-raised: #222222;
  --surface-strong: #282828;
  --line: #363636;
  --line-soft: #292929;
  --text: #f8f8f8;
  --text-muted: #b2b2b2;
  --text-soft: #777777;
  --blue: #36a9f6;
  --green: #59b87a;
  --amber: #d89a39;
  --red: #cf5e5e;
  /* Keep screen typography on these six roles; print typography lives in TeX. */
  --type-caption: 12px;
  --type-small: 14px;
  --type-body: 16px;
  --type-heading: 20px;
  --type-title: 34px;
  --type-display: clamp(44px, 6vw, 72px);
  --header-height: 72px;
  --collection-pane-width: clamp(288px, 22vw, 340px);
  --collection-row-height: 44px;
  --reading-column-width: 904px;
  --reading-column-padding: 42px;
  --radius: 10px;
  --shadow: 0 18px 60px rgb(0 0 0 / 24%);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  font-synthesis: none;
  line-height: 1.45;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-size: var(--type-body);
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

::selection {
  background: rgb(54 169 246 / 34%);
}

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

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 100;
  padding: 10px 14px;
  color: #111;
  background: #fff;
  border-radius: 5px;
  transform: translateY(-140%);
}

.skip-link:focus {
  transform: translateY(0);
}

.app-frame {
  min-height: 100vh;
}

.app-header {
  position: relative;
  z-index: 20;
  height: var(--header-height);
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: 0;
  padding: 0 24px;
  background: rgb(15 15 15 / 97%);
  border-bottom: 1px solid var(--line-soft);
  box-shadow: 0 7px 24px rgb(0 0 0 / 18%);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.03em;
}

.primary-nav {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 18px;
  margin-left: 32px;
}

.nav-link {
  padding: 9px 5px 7px;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  font-size: var(--type-small);
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  transition: color 120ms ease, border-color 120ms ease;
}

.nav-link:hover {
  color: var(--text);
}

.nav-link.is-active {
  color: var(--text);
  border-bottom-color: var(--blue);
}

.account-cluster {
  min-width: 270px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  color: var(--text-soft);
  font-size: var(--type-caption);
  justify-self: end;
}

.account-email {
  max-width: 150px;
  overflow: hidden;
  color: var(--text-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logout-form {
  margin: 0;
}

.icon-text-button {
  padding: 6px 0;
  color: var(--text-soft);
  background: transparent;
  border: 0;
  cursor: pointer;
}

.icon-text-button:hover {
  color: var(--text);
}

.global-progress {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  overflow: hidden;
  opacity: 0;
}

.global-progress::after {
  content: "";
  width: 34%;
  height: 100%;
  display: block;
  background: var(--blue);
  animation: progress-slide 1s ease-in-out infinite;
}

.global-progress.htmx-request,
.htmx-request .global-progress {
  opacity: 1;
}

@keyframes progress-slide {
  from { transform: translateX(-110%); }
  to { transform: translateX(400%); }
}

.workspace {
  height: calc(100vh - var(--header-height));
  display: grid;
  grid-template-columns:
    var(--collection-pane-width)
    minmax(0, 1fr);
  overflow: hidden;
}

.collection-pane,
.detail-pane {
  min-width: 0;
  min-height: 0;
}

.collection-pane {
  display: flex;
  flex-direction: column;
  background: #151515;
  border-right: 1px solid var(--line-soft);
}

.pane-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 28px 24px 18px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--text-soft);
  font-size: var(--type-caption);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.pane-heading h1,
.pane-heading h2 {
  margin: 0;
  font-size: var(--type-heading);
  font-weight: 620;
  letter-spacing: -0.035em;
}

.count-badge {
  min-width: 30px;
  height: 26px;
  display: inline-grid;
  place-items: center;
  color: var(--text-muted);
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: var(--type-caption);
}

.search-form {
  position: relative;
  margin: 0 18px 17px;
}

.search-form input {
  width: 100%;
  height: 38px;
  padding: 0 36px 0 38px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: 0;
}

.search-form input::placeholder {
  color: var(--text-soft);
}

.search-form input:focus {
  border-color: #626262;
  box-shadow: 0 0 0 3px rgb(255 255 255 / 5%);
}

.search-glyph {
  position: absolute;
  top: 12px;
  left: 15px;
  width: 12px;
  height: 12px;
  z-index: 1;
  border: 1.5px solid var(--text-soft);
  border-radius: 50%;
}

.search-glyph::after {
  content: "";
  position: absolute;
  right: -5px;
  bottom: -3px;
  width: 6px;
  height: 1.5px;
  background: var(--text-soft);
  transform: rotate(45deg);
  transform-origin: left center;
}

.collection-list {
  min-height: 0;
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0;
  padding: 0 18px 20px;
  overflow-y: auto;
  scrollbar-color: #444 transparent;
  scrollbar-width: thin;
}

.collection-item {
  position: relative;
  flex: 0 0 auto;
  min-height: var(--collection-row-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 8px 10px 12px;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 120ms ease;
}

.collection-item::before {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 0;
  width: 2px;
  background: transparent;
  border-radius: 99px;
}

.collection-item:hover {
  color: var(--text);
}

.collection-item.is-selected {
  color: var(--text);
}

.collection-item.is-selected::before {
  background: var(--blue);
}

.collection-item-title {
  min-width: 0;
  flex: 1 1 auto;
  font-size: var(--type-body);
  font-weight: 650;
  line-height: 1.3;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.collection-item-meta {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  color: #8d8d8d;
  font-size: var(--type-caption);
  font-weight: 650;
  letter-spacing: 0.08em;
  white-space: nowrap;
  text-transform: uppercase;
}

.collection-item.collection-item-with-meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: center;
  align-items: start;
  justify-content: stretch;
  gap: 2px;
}

.collection-item-with-meta .collection-item-meta {
  justify-self: start;
}

.empty-list {
  display: grid;
  gap: 4px;
  margin: 18px 8px;
  padding: 24px 18px;
  color: var(--text-soft);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  font-size: var(--type-small);
  text-align: center;
}

.empty-list strong {
  color: var(--text-muted);
}

.detail-pane {
  overflow-y: auto;
  background: var(--bg);
  scrollbar-color: #484848 transparent;
  scrollbar-width: thin;
}

.detail-hero {
  text-align: center;
}

.inventory-dot {
  width: 8px;
  height: 8px;
  display: inline-block;
  background: #575757;
  border: 1px solid #777;
  border-radius: 50%;
}

.empty-section {
  padding: 28px;
  color: var(--text-soft);
  font-size: var(--type-small);
  text-align: center;
}

.support-section {
  margin-top: 34px;
}

.support-section > h3 {
  margin: 0 0 17px;
  font-size: var(--type-heading);
  font-weight: 590;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 15px;
}

.photo-card {
  min-width: 0;
  display: grid;
  gap: 5px;
  color: var(--text-muted);
  text-decoration: none;
}

.photo-card-image {
  color: inherit;
  text-decoration: none;
}

.photo-frame {
  position: relative;
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    linear-gradient(135deg, transparent 45%, #2e2e2e 45%, #2e2e2e 55%, transparent 55%),
    #202020;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.photo-frame img {
  width: 100%;
  height: 100%;
  position: relative;
  z-index: 1;
  display: block;
  object-fit: cover;
  transition: transform 180ms ease, opacity 120ms ease;
}

.photo-card:hover img {
  transform: scale(1.025);
}

.photo-fallback {
  position: absolute;
  color: var(--text-soft);
  font-size: var(--type-caption);
}

.photo-card.is-missing img {
  display: none;
}

.photo-preview-frame.is-missing img {
  display: none;
}

.photo-card strong {
  margin-top: 4px;
  overflow: hidden;
  color: #d5d5d5;
  font-size: var(--type-caption);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photo-card-caption {
  display: -webkit-box;
  overflow: hidden;
  color: var(--text-soft);
  font-size: var(--type-caption);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.photo-card-manage {
  width: fit-content;
  color: var(--blue);
  font-size: var(--type-caption);
  text-decoration: none;
}

.photo-card-manage:hover {
  text-decoration: underline;
}

.reference-list {
  display: grid;
  gap: 0;
}

.reference-item {
  min-width: 0;
  padding: 10px 0 5px 0;
}

.reference-citation {
  margin: 0;
  padding-left: 24px;
  color: var(--text-muted);
  font-size: var(--type-body);
  line-height: 1.65;
  text-indent: -24px;
}

.reference-citation cite {
  color: var(--text);
  font-style: italic;
  font-weight: 600;
}

.reference-citation > span {
  color: var(--text-muted);
}

.reference-citation .reference-source-type {
  color: var(--text-soft);
  text-transform: capitalize;
}

.reference-notes {
  margin: 7px 0 0 24px;
  color: var(--text-soft);
  font-size: var(--type-small);
  line-height: 1.55;
}

.reference-url {
  display: block;
  margin: 8px 0 0 24px;
  color: var(--blue);
  font-size: var(--type-small);
  line-height: 1.5;
  overflow-wrap: anywhere;
  text-decoration: none;
  word-break: break-word;
}

a.reference-url:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.reference-url-invalid {
  color: var(--text-muted);
}

.upload-details {
  position: relative;
}

.upload-details summary {
  list-style: none;
  user-select: none;
}

.upload-details summary::-webkit-details-marker {
  display: none;
}

.upload-details[open] summary {
  color: #fff;
  background: #242424;
  border-color: #696969;
}

.upload-details .upload-form {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 20;
  width: min(360px, calc(100vw - 36px));
  margin-top: 0;
  padding: 18px;
  background: #171717;
  border: 1px solid #4a4a4a;
  border-radius: 9px;
  box-shadow: 0 20px 55px rgb(0 0 0 / 55%);
}

.secondary-button,
.primary-button {
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease, transform 120ms ease;
}

.secondary-button {
  min-height: 39px;
  padding: 8px 13px;
  color: #c7c7c7;
  background: #1b1b1b;
  border: 1px solid #484848;
  font-size: var(--type-caption);
  font-weight: 650;
}

.secondary-button:hover {
  color: #fff;
  background: #242424;
  border-color: #696969;
}

.upload-form {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.manage-workspace {
  height: calc(100vh - var(--header-height));
  display: grid;
  grid-template-columns: 220px var(--collection-pane-width) minmax(0, 1fr);
  overflow: hidden;
}

.manage-categories {
  min-width: 0;
  padding: 30px 16px;
  overflow-x: hidden;
  overflow-y: auto;
  background: #111;
  border-right: 1px solid var(--line-soft);
}

.manage-title {
  padding: 0 12px 28px;
}

.manage-title h1 {
  margin: 0;
  font-size: var(--type-heading);
  font-weight: 620;
  letter-spacing: -0.04em;
}

.manage-categories nav {
  display: grid;
  gap: 0;
}

.manage-category {
  position: relative;
  min-height: var(--collection-row-height);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 8px 10px 8px 13px;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 120ms ease;
}

.manage-category::before {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 0;
  width: 2px;
  background: transparent;
  border-radius: 99px;
}

.manage-category:hover {
  color: var(--text);
}

.manage-category span {
  font-size: var(--type-small);
  font-weight: 650;
}

.manage-category.is-active {
  color: var(--text);
}

.manage-category.is-active::before {
  background: var(--blue);
}

.manage-collection {
  min-width: 0;
}

.manage-pane-heading {
  padding-bottom: 14px;
}

.manage-list-copy {
  min-width: 0;
  width: 100%;
  display: grid;
  gap: 3px;
}

.manage-list-subtitle {
  color: var(--text-soft);
  font-size: var(--type-caption);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.manage-collection .collection-item {
  align-items: flex-start;
}

.manage-directory-status {
  margin: 0 24px 17px;
  color: var(--text-soft);
  font-size: var(--type-caption);
  line-height: 1.45;
}

.new-record-button {
  width: fit-content;
  margin: -3px 10px 12px;
}

.manage-detail {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  background:
    radial-gradient(circle at 50% 30%, rgb(255 255 255 / 2.5%), transparent 36%),
    var(--bg);
}

.managed-record {
  width: min(820px, calc(100% - 72px));
  min-height: calc(100% - 120px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 60px auto;
  text-align: center;
}

.managed-record h2 {
  max-width: 620px;
  margin: 0;
  font-size: var(--type-title);
  font-weight: 650;
  letter-spacing: -0.035em;
  line-height: 1.12;
}

.managed-record > p:not(.eyebrow) {
  max-width: 600px;
  margin: 20px 0 0;
  color: var(--text-muted);
  font-size: var(--type-body);
  line-height: 1.6;
}

.managed-editor {
  align-items: stretch;
  text-align: left;
}

.managed-editor .eyebrow,
.managed-editor h2,
.managed-editor > p {
  align-self: center;
  text-align: center;
}

.managed-form {
  width: min(560px, 100%);
  display: grid;
  gap: 10px;
  align-self: center;
  margin-top: 38px;
  padding: 26px;
  background: #181818;
  border: 1px solid var(--line);
  border-radius: 11px;
  box-shadow: var(--shadow);
}

.managed-form label {
  color: var(--text-soft);
  font-size: var(--type-caption);
  font-weight: 750;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.managed-form input[type="text"],
.managed-form input[type="email"],
.managed-form input[type="password"],
.managed-form input[type="url"],
.managed-form input[type="number"],
.managed-form select,
.managed-form textarea {
  width: 100%;
  min-height: 49px;
  padding: 12px 14px;
  color: var(--text);
  background: #101010;
  border: 1px solid #444;
  border-radius: 8px;
  font-size: var(--type-body);
  outline: 0;
  resize: vertical;
}

.managed-form input[type="text"]:focus,
.managed-form input[type="email"]:focus,
.managed-form input[type="password"]:focus,
.managed-form input[type="url"]:focus,
.managed-form input[type="number"]:focus,
.managed-form select:focus,
.managed-form textarea:focus {
  border-color: #767676;
  box-shadow: 0 0 0 3px rgb(255 255 255 / 5%);
}

.managed-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 18px;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.managed-alert {
  width: min(560px, 100%);
  align-self: center;
  margin: 24px 0 -16px;
  text-align: left;
}

.catalog-managed-form {
  gap: 12px;
}

.manage-record-detail .detail-action-bar form {
  margin: 0;
}

.manage-definition-list {
  width: 100%;
  display: grid;
  margin: 0;
  border-top: 1px solid var(--line-soft);
}

.manage-definition-list > div {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(110px, 0.28fr) minmax(0, 1fr);
  gap: 20px;
  align-items: baseline;
  padding: 14px 0;
  border-bottom: 1px solid var(--line-soft);
}

.manage-definition-list dt {
  color: var(--text-soft);
  font-size: var(--type-caption);
  font-weight: 750;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.manage-definition-list dd {
  min-width: 0;
  margin: 0;
  color: var(--text-muted);
  font-size: var(--type-body);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.manage-definition-list a {
  color: var(--blue);
}

.managed-reference-tags {
  justify-content: flex-start;
}

.managed-reference-tags span {
  color: var(--text-muted);
  font-size: var(--type-small);
}

.manage-editor-column {
  padding-bottom: 64px;
}

.manage-editor-document .manage-editor-form {
  width: min(680px, 100%);
  align-self: center;
  margin: 0 auto;
  padding: 24px 0 0;
  background: transparent;
  border: 0;
  border-top: 1px solid var(--line-soft);
  border-radius: 0;
  box-shadow: none;
}

.manage-editor-document .managed-alert {
  width: min(680px, 100%);
  margin: 0 auto 20px;
}

.manage-stub-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  color: var(--text-muted);
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: var(--type-caption);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.manage-user-copy {
  max-width: 680px;
  margin: 0 auto;
  color: var(--text-muted);
  font-size: var(--type-body);
  line-height: 1.6;
  text-align: left;
}

.manage-stub-notice {
  width: min(680px, 100%);
  display: grid;
  gap: 3px;
  margin: 0 auto 24px;
  padding: 3px 0 3px 14px;
  color: var(--text-muted);
  border-left: 2px solid var(--blue);
  font-size: var(--type-small);
}

.manage-stub-notice strong {
  color: var(--text);
  font-weight: 650;
}

.stub-submit-button:disabled {
  color: var(--text-soft);
  background: var(--surface-raised);
  cursor: not-allowed;
  opacity: 1;
}

.ingredient-profile-section {
  width: 100%;
  margin-top: 34px;
  padding-top: 30px;
  border-top: 1px solid var(--line-soft);
}

.ingredient-profile-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}

.ingredient-profile-heading .eyebrow {
  margin-bottom: 7px;
}

.ingredient-profile-heading h3 {
  margin: 0;
  color: var(--text);
  font-size: var(--type-heading);
  font-weight: 650;
}

.ingredient-profile-section > p {
  max-width: 650px;
  margin: 10px 0 0;
  color: var(--text-muted);
  font-size: var(--type-body);
  line-height: 1.55;
}

.ingredient-subsection {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.ingredient-subsection h4 {
  margin: 0 0 0.75rem;
}

.knowledge-list {
  display: grid;
  gap: 0.5rem;
  margin: 0.8rem 0;
}

.knowledge-row,
.knowledge-editor > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--line);
}

.knowledge-row span,
.knowledge-editor > summary span:first-child {
  display: grid;
  gap: 0.12rem;
}

.knowledge-row small,
.knowledge-editor small {
  color: var(--text-muted);
}

.knowledge-editor > summary {
  cursor: pointer;
  list-style: none;
}

.knowledge-editor > summary::-webkit-details-marker {
  display: none;
}

.knowledge-editor[open] > summary {
  color: var(--blue);
}

.knowledge-add {
  margin-top: 0.8rem;
}

.knowledge-add > summary {
  justify-content: flex-start;
  color: var(--blue);
  font-weight: 700;
}

.compact-knowledge-form {
  margin: 0.5rem 0 0.65rem;
  padding: 0.85rem;
  background: var(--surface-raised);
  border-radius: var(--radius);
}

.knowledge-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.ingredient-danger-zone {
  border-color: color-mix(in srgb, var(--red) 30%, var(--line));
}

.preserve-lines {
  white-space: pre-wrap;
}

@media (max-width: 760px) {
  .knowledge-form-grid { grid-template-columns: 1fr; }
  .knowledge-row, .knowledge-editor > summary { align-items: flex-start; }
}

.ingredient-form-list {
  display: grid;
  margin-top: 20px;
  border-top: 1px solid var(--line-soft);
}

.ingredient-form-row {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: var(--type-body);
}

.ingredient-form-row form,
.nutrition-delete-form {
  margin: 0;
}

.text-action-danger {
  color: var(--red);
}

@media (max-width: 780px) {
  .nutrition-field-grid,
  .nutrition-profile-values {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ingredient-form-attach > div {
    align-items: stretch;
    flex-direction: column;
  }

  .ingredient-form-attach select {
    min-width: 0;
    width: 100%;
  }
}

.ingredient-form-attach {
  display: grid;
  gap: 8px;
  margin-top: 22px;
}

.ingredient-form-attach > label,
.ingredient-nutrition-form label > span {
  color: var(--text-soft);
  font-size: var(--type-caption);
  font-weight: 750;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.ingredient-form-attach > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ingredient-form-attach select {
  min-width: min(360px, 70%);
  min-height: 42px;
  padding: 8px 34px 8px 11px;
  color: var(--text);
  background: #101010;
  border: 1px solid #444;
  border-radius: 7px;
  font-size: var(--type-body);
}

.estimate-badge {
  padding: 4px 8px;
  color: var(--text-muted);
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: var(--type-caption);
  font-weight: 750;
  text-transform: uppercase;
}

.ingredient-nutrition-form {
  width: 100%;
  margin-top: 22px;
}

.nutrition-field-grid,
.nutrition-profile-values {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.nutrition-field-grid label {
  min-width: 0;
  display: grid;
  gap: 7px;
}

.nutrition-profile-values {
  margin: 22px 0 0;
}

.nutrition-profile-values > div {
  min-width: 0;
  padding: 14px;
  background: #171717;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
}

.nutrition-profile-values dt {
  color: var(--text-soft);
  font-size: var(--type-caption);
  font-weight: 750;
  text-transform: uppercase;
}

.nutrition-profile-values dd {
  margin: 7px 0 0;
  color: var(--text);
  font-size: var(--type-body);
}

.nutrition-delete-form {
  margin-top: 14px;
  text-align: right;
}

.manage-notice {
  margin-bottom: -10px;
}

.upload-form label {
  display: grid;
  gap: 5px;
  color: var(--text-soft);
  font-size: var(--type-caption);
  font-weight: 650;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.upload-form input,
.upload-form textarea {
  width: 100%;
  min-width: 0;
  padding: 8px 9px;
  color: var(--text);
  background: #111;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: var(--type-caption);
  letter-spacing: normal;
  text-transform: none;
}

.upload-form input[type="file"] {
  padding: 7px;
  color: #929292;
}

.primary-button {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 14px;
  color: #121212;
  background: #f1f1f1;
  border: 1px solid #fff;
  font-size: var(--type-caption);
  font-weight: 750;
  text-decoration: none;
}

.primary-button:hover {
  background: #fff;
  transform: translateY(-1px);
}

.compact-button {
  min-height: 37px;
  justify-content: center;
}

.empty-detail {
  min-height: 100%;
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 40px;
  color: var(--text-soft);
  text-align: center;
}

.empty-detail h2 {
  margin: 16px 0 6px;
  color: #c7c7c7;
  font-size: var(--type-heading);
  font-weight: 560;
}

.empty-detail p {
  max-width: 420px;
  margin: 0;
  font-size: var(--type-small);
}

.empty-mark {
  width: 42px;
  height: 42px;
  display: block;
  border: 1px solid #454545;
  border-radius: 50%;
  box-shadow: inset 0 0 0 8px #1c1c1c;
}

.state-page {
  height: calc(100vh - var(--header-height));
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 40px;
  overflow: auto;
  text-align: center;
}

.state-page h1 {
  max-width: 700px;
  margin: 0;
  font-size: var(--type-display);
  font-weight: 520;
  letter-spacing: -0.055em;
  line-height: 1;
}

.state-page > p:not(.eyebrow) {
  max-width: 600px;
  margin: 22px 0;
  color: var(--text-muted);
}

.inline-button {
  min-width: 150px;
  display: inline-flex;
  justify-content: center;
  margin-top: 8px;
}

.login-body {
  overflow: auto;
  background: var(--bg);
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(420px, 0.75fr);
  background: var(--bg);
}

.login-panel {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(45px, 7vw, 110px);
  background: var(--bg);
}

.login-form {
  display: grid;
  gap: 10px;
}

.login-form label {
  margin-top: 8px;
  color: var(--text-soft);
  font-size: var(--type-caption);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.login-form input {
  height: 48px;
  padding: 0 14px;
  color: var(--text);
  background: #111;
  border: 1px solid #3b3b3b;
  border-radius: 8px;
}

.login-form input:focus {
  border-color: #737373;
  outline: 0;
  box-shadow: 0 0 0 3px rgb(255 255 255 / 5%);
}

.login-form .primary-button {
  margin-top: 24px;
}

.alert {
  margin: 0 0 22px;
  padding: 12px 14px;
  color: #f2b8b8;
  background: rgb(207 94 94 / 10%);
  border: 1px solid rgb(207 94 94 / 35%);
  border-radius: 7px;
  font-size: var(--type-caption);
}

@media (max-width: 1280px) {
  :root {
    --collection-pane-width: 280px;
  }

  .app-header {
    grid-template-columns: auto auto minmax(0, 1fr);
    padding-inline: 18px;
  }

  .primary-nav {
    margin-left: 24px;
  }

  .nav-link {
    padding-inline: 4px;
  }

  .account-cluster {
    min-width: 180px;
  }

  .manage-workspace {
    grid-template-columns: 190px var(--collection-pane-width) minmax(0, 1fr);
  }
}

@media (max-width: 1100px) {
  :root {
    --header-height: 68px;
    --collection-pane-width: 278px;
  }

  .app-header {
    grid-template-columns: auto auto minmax(0, 1fr);
  }

  .primary-nav {
    margin-left: 18px;
  }

  .account-email {
    display: none;
  }

  .account-cluster {
    min-width: auto;
  }

  .nav-link {
    padding: 8px 3px 6px;
    font-size: var(--type-caption);
  }

  .workspace {
    grid-template-rows: minmax(0, 1fr);
  }

  .manage-workspace {
    grid-template-columns: 170px var(--collection-pane-width) minmax(0, 1fr);
  }

  .manage-category {
    padding-inline: 9px;
  }

  .managed-record {
    width: calc(100% - 42px);
  }

  .photo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 780px) {
  body {
    overflow: auto;
  }

  .app-header {
    position: sticky;
    top: 0;
    height: auto;
    min-height: var(--header-height);
    grid-template-columns: auto 1fr auto;
    gap: 10px;
    padding: 10px 12px;
  }

  .primary-nav {
    justify-content: flex-start;
    gap: 12px;
    margin-left: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .nav-link {
    min-width: auto;
    padding: 9px 4px 7px;
    white-space: nowrap;
  }

  .search-form input {
    height: 42px;
  }

  .search-glyph {
    top: 14px;
  }

  .workspace {
    height: auto;
    min-height: calc(100vh - var(--header-height));
    display: block;
    overflow: visible;
  }

  .upload-details .upload-form {
    right: auto;
    left: 0;
  }

  .manage-workspace {
    height: auto;
    min-height: calc(100vh - var(--header-height));
    display: block;
    overflow: visible;
  }

  .manage-categories {
    padding: 18px 12px 12px;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
  }

  .manage-title {
    padding: 0 8px 14px;
  }

  .manage-categories nav {
    display: flex;
    gap: 6px;
    overflow-x: auto;
  }

  .manage-category {
    min-width: max-content;
    min-height: 38px;
    padding: 8px 12px;
  }

  .manage-category::before {
    top: auto;
    right: 10px;
    bottom: 0;
    left: 10px;
    width: auto;
    height: 2px;
  }

  .manage-category small {
    display: none;
  }

  .manage-collection {
    max-height: 390px;
  }

  .manage-detail {
    min-height: 540px;
    display: flow-root;
    overflow: visible;
  }

  .managed-record {
    width: calc(100% - 32px);
    min-height: 470px;
    margin: 36px auto;
  }

  .managed-record h2 {
    font-size: var(--type-title);
  }

  .managed-form {
    padding: 20px;
  }

  .collection-pane {
    max-height: 340px;
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
  }

  .collection-list {
    max-height: 220px;
  }

  .detail-pane {
    overflow: visible;
  }

  .reference-list,
  .photo-grid {
    grid-template-columns: 1fr;
  }

  .login-shell {
    grid-template-columns: 1fr;
  }

  .login-panel {
    min-height: 100vh;
    grid-column: 1;
    padding: 46px 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.detail-document.ipad-detail {
  width: 100%;
  margin: 0;
  padding: 0 0 44px;
}

.detail-action-bar {
  min-height: 54px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  padding: 18px 34px 0;
}

.detail-action {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 8px;
  color: var(--blue);
  background: transparent;
  border: 0;
  border-radius: 6px;
  font-size: var(--type-small);
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}

.detail-action:hover {
  background: rgb(54 169 246 / 10%);
}

.detail-action-danger {
  color: #e28585;
}

.detail-action-danger:hover {
  background: rgb(207 94 94 / 12%);
}

.ipad-detail .detail-hero {
  width: min(var(--reading-column-width), 100%);
  max-width: none;
  margin: 0 auto;
  padding: 34px var(--reading-column-padding) 30px;
}

.ipad-detail .detail-hero h2 {
  margin: 0;
  color: var(--text);
  font-size: var(--type-title);
  font-weight: 650;
  letter-spacing: -0.035em;
  line-height: 1.12;
}

.ipad-detail .detail-hero > p {
  max-width: 720px;
  margin: 14px auto 0;
  color: var(--text-muted);
  font-size: var(--type-body);
  line-height: 1.55;
  text-align: left;
}

.ipad-reading-column {
  width: min(var(--reading-column-width), 100%);
  margin: 0 auto;
  padding: 0 var(--reading-column-padding);
}

.detail-section-stack,
.version-history {
  display: grid;
  gap: 38px;
}

.ipad-detail-section {
  width: 100%;
  margin-top: 34px;
}

.ipad-detail-section > h3,
.support-title > h3 {
  margin: 0 0 18px;
  color: var(--text);
  font-size: var(--type-heading);
  font-weight: 650;
  letter-spacing: -0.015em;
  text-align: center;
}

.ipad-formula {
  min-width: 0;
  color: var(--text);
}

.dish-formula-header {
  margin-bottom: 12px;
  text-align: center;
}

.dish-formula-header h3 {
  margin: 0;
  color: var(--text);
  font-size: var(--type-heading);
  font-weight: 650;
  letter-spacing: -0.025em;
}

.dish-formula-header p {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: var(--type-body);
}

.dish-formula-header .formula-usage {
  font-size: var(--type-small);
}

.recipe-version-block {
  padding: 16px;
  background: var(--bg);
  border: 1px solid transparent;
  border-radius: 8px;
}

.recipe-version-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
}

.recipe-version-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.recipe-version-title h4 {
  margin: 0;
  color: var(--text);
  font-size: var(--type-heading);
  font-weight: 650;
}

.recipe-version-header p {
  margin: 7px 0 0;
  color: var(--text-muted);
  font-size: var(--type-body);
}

.current-badge {
  padding: 4px 8px;
  color: var(--text-muted);
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: var(--type-caption);
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

.nutrition-estimate {
  margin: 20px 0 0;
  padding: 18px 0 0;
  border-top: 1px solid var(--line-soft);
}

.ipad-detail-section > .nutrition-estimate {
  margin: 0;
  padding: 16px;
  background: var(--bg);
  border: 1px solid transparent;
  border-radius: 8px;
}

.nutrition-estimate-heading {
  margin-bottom: 0;
}

.nutrition-estimate-heading .recipe-version-title {
  flex-wrap: wrap;
}

.nutrition-estimate-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 28px;
  margin-top: 16px;
}

.nutrition-estimate-group {
  min-width: 0;
  padding-top: 12px;
}

.nutrition-estimate-group h5 {
  margin: 0;
  color: var(--text);
  font-size: var(--type-body);
  font-weight: 650;
}

.nutrition-estimate-values {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px 14px;
  margin: 12px 0 0;
}

.nutrition-estimate-values div {
  min-width: 0;
}

.nutrition-estimate-values dt {
  color: var(--text-soft);
  font-size: var(--type-caption);
}

.nutrition-estimate-values dd {
  margin: 2px 0 0;
  color: var(--text);
  font-size: var(--type-small);
  font-weight: 650;
}

.nutrition-estimate-note {
  margin: 16px 0 0;
  padding-top: 12px;
  color: var(--text-muted);
  font-size: var(--type-small);
  line-height: 1.5;
}

@media (max-width: 720px) {
  .nutrition-estimate-groups {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .nutrition-estimate-values {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.version-action {
  padding: 5px 7px;
  color: var(--green);
  background: transparent;
  border: 0;
  border-radius: 5px;
  font-size: var(--type-small);
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}

.version-action:hover {
  background: rgb(89 184 122 / 10%);
}

.recipe-version-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 3px;
}

.recipe-version-actions form {
  margin: 0;
}

.ingredient-table {
  min-width: 0;
}

.ingredient-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 86px 36px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  padding: 8px 0;
  color: var(--text);
  font-size: var(--type-body);
  line-height: 1.45;
}

.ingredient-header {
  padding: 0 0 7px;
  color: var(--text-muted);
  border-bottom: 1px solid rgb(178 178 178 / 35%);
  font-size: var(--type-caption);
  font-weight: 650;
}

.ingredient-header > span:nth-child(2) {
  text-align: right;
}

.ingredient-header > span:nth-child(3) {
  text-align: center;
}

.ingredient-description {
  color: var(--text);
  overflow-wrap: anywhere;
}

.ingredient-quantity {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.ingredient-inventory {
  padding-top: 3px;
  text-align: center;
}

.ingredient-steps {
  display: grid;
  gap: 5px;
  color: var(--text);
  font-size: var(--type-body);
  overflow-wrap: anywhere;
}

.version-notes {
  margin-top: 8px;
  color: var(--text-muted);
}

.version-notes strong {
  font-size: var(--type-caption);
  font-weight: 650;
}

.version-notes p {
  margin: 4px 0 0;
  font-size: var(--type-body);
}

.support-title {
  position: relative;
}

.support-title .upload-details {
  position: absolute;
  top: -8px;
  right: 0;
}

.add-photo-button {
  list-style: none;
  cursor: pointer;
}

.add-photo-button::-webkit-details-marker {
  display: none;
}

.support-empty {
  margin: 0;
  padding: 18px 0;
  color: var(--text-muted);
  font-size: var(--type-body);
  text-align: center;
}

.ipad-detail .photo-grid {
  gap: 22px;
}

.ipad-detail .photo-frame {
  border-radius: 4px;
}

.support-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.support-tags .support-tag {
  color: var(--blue);
  font-size: var(--type-small);
  font-weight: 650;
  text-decoration: none;
  border-radius: 6px;
  padding: 2px 4px;
  margin: -2px -4px;
}

.support-tags .support-tag:hover,
.support-tags .support-tag:focus-visible {
  text-decoration: underline;
  outline: none;
}

.plan-active-badge {
  display: inline-block;
  margin-left: 0;
  padding: 1px 6px;
  color: var(--text-muted);
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: var(--type-caption);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  vertical-align: middle;
}

.plan-status-action {
  display: inline-flex;
}

.plan-detail .detail-hero {
  text-align: left;
}

.plan-detail .detail-hero > p {
  margin-right: 0;
  margin-left: 0;
  text-align: left;
}

.detail-hero-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.plan-section-heading {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 18px;
}

.plan-section-heading h3 {
  flex: 1;
  margin: 0;
  color: var(--blue);
  font-size: var(--type-heading);
  font-weight: 650;
  letter-spacing: -0.015em;
  text-align: left;
}

.plan-section-action {
  position: absolute;
  right: 0;
}

.plan-detail .plan-section-heading {
  position: static;
  display: grid;
  align-items: initial;
  justify-content: stretch;
  gap: 5px;
}

.plan-detail .plan-section-heading h3 {
  color: var(--text);
}

.plan-section-helper {
  margin: 0;
  color: var(--text-soft);
  font-size: var(--type-small);
  line-height: 1.45;
}

.plan-section-count {
  margin-left: 8px;
  color: var(--text-muted);
  font-size: var(--type-small);
  font-weight: 550;
}

.plan-item-list,
.plan-grocery-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0;
}

.plan-item-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 110px minmax(134px, auto) auto;
  gap: 12px;
  align-items: center;
  padding: 8px 0;
  background: transparent;
  border: 0;
  color: var(--text);
  font-size: var(--type-body);
}

.plan-item-kind {
  color: var(--text-muted);
  font-size: var(--type-caption);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.plan-item-name {
  color: var(--text);
  font-weight: 400;
  text-decoration: none;
}

.plan-item-name:hover {
  color: var(--blue);
}

.plan-item-scale {
  color: var(--text-muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.plan-item-yield {
  color: var(--text-soft);
  font-size: var(--type-small);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.plan-add-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 76px auto auto;
  gap: 10px;
  align-items: center;
  margin: 0 0 12px;
  padding: 10px 0;
  border-block: 1px solid rgb(178 178 178 / 28%);
}

.plan-add-item-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.plan-add-item-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plan-add-item > label {
  color: var(--text-muted);
  font-size: var(--type-small);
}

.plan-scale-input {
  width: 76px;
  min-height: 32px;
  padding: 4px 7px;
  border: 1px solid rgb(178 178 178 / 50%);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-variant-numeric: tabular-nums;
}

.plan-scale-input:focus {
  border-color: var(--blue);
  outline: 2px solid rgb(54 169 246 / 18%);
  outline-offset: 1px;
}

.plan-item-scale-form {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  justify-self: end;
}

.plan-row-action {
  padding: 4px 5px;
  border: 0;
  background: transparent;
  color: var(--blue);
  font: inherit;
  font-size: var(--type-small);
  font-weight: 650;
  cursor: pointer;
}

.plan-row-action:hover {
  text-decoration: underline;
}

.plan-row-action-danger {
  color: #d46f6f;
}

.plan-cancel-action {
  color: var(--text-muted);
}

.plan-formula-list {
  display: grid;
  gap: 12px;
}

.plan-formula-item {
  border-bottom: 1px solid var(--line-soft);
}

.plan-formula-item:first-child {
  border-top: 1px solid var(--line-soft);
}

.plan-formula-item:not(:last-child) {
  border-bottom: 0;
}

.plan-formula-item + .plan-formula-item {
  border-top: 1px solid var(--blue);
}

.plan-formula-item > summary {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 110px 56px;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  color: var(--text);
  cursor: pointer;
  list-style: none;
}

.plan-formula-item > summary::-webkit-details-marker {
  display: none;
}

.plan-formula-item > summary::after {
  content: "＋";
  grid-column: 4;
  grid-row: 1;
  justify-self: end;
  color: var(--text-soft);
  font-size: var(--type-body);
}

.plan-formula-item[open] > summary::after {
  content: "−";
}

.plan-formula-item > summary .plan-item-scale {
  grid-column: 4;
  grid-row: 1;
  padding-right: 22px;
}

.plan-formula-stack {
  padding: 8px 0 24px;
}

.formula-role {
  display: block;
  margin-bottom: 5px;
  color: var(--text-soft);
  font-size: var(--type-caption);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.plan-requirements-table {
  display: grid;
  gap: 0;
}

.plan-requirements-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 140px;
  gap: 12px;
  padding: 8px 0;
  background: transparent;
  color: var(--text);
  font-size: var(--type-body);
}

.plan-requirements-row.plan-requirements-header {
  padding: 0 0 7px;
  background: transparent;
  color: var(--text-muted);
  border-bottom: 1px solid rgb(178 178 178 / 35%);
  font-size: var(--type-caption);
  font-weight: 650;
}

.plan-requirements-row span:last-child {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.plan-grocery-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  background: transparent;
  border: 0;
  color: var(--text);
  font-size: var(--type-body);
}

.plan-grocery-row.is-checked {
  color: var(--text-soft);
  text-decoration: line-through;
}

.plan-grocery-mark {
  color: var(--text-muted);
  font-weight: 700;
  text-align: center;
}

.plan-grocery-row.is-checked .plan-grocery-mark {
  color: var(--blue);
}

@media (max-width: 780px) {
  .plan-section-heading {
    justify-content: space-between;
  }

  .plan-section-heading h3 {
    text-align: left;
  }

  .plan-section-action {
    position: static;
  }

  .plan-item-row {
    grid-template-columns: 64px minmax(0, 1fr) auto;
  }

  .plan-item-yield {
    grid-column: 2 / -1;
  }

  .plan-item-scale-form {
    grid-column: 2;
    justify-self: start;
  }

  .plan-formula-item > summary {
    grid-template-columns: 64px minmax(0, 1fr) auto;
  }

  .plan-formula-item > summary .plan-item-yield {
    grid-column: 2 / -1;
    justify-self: start;
  }

  .plan-formula-item > summary .plan-item-scale {
    grid-column: 3;
    grid-row: 1;
    padding-right: 22px;
  }

  .plan-formula-item > summary::after {
    grid-column: 3;
  }

  .plan-add-item {
    grid-template-columns: minmax(0, 1fr) auto 76px;
  }

  .plan-add-item-copy {
    grid-column: 1 / -1;
  }

  .plan-add-item .plan-cancel-action {
    grid-column: 1;
    grid-row: 3;
    justify-self: start;
  }
}

.manual-print-note {
  display: none;
}

.recipe-editor-document {
  width: min(100%, 980px);
  margin: 0 auto;
  padding: 34px 42px 72px;
}

.recipe-editor-form {
  display: grid;
  gap: 22px;
}

.recipe-editor-header,
.recipe-editor-section-title,
.recipe-editor-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}

.recipe-editor-header {
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.recipe-editor-header h2 {
  margin: 3px 0 0;
  font-size: var(--type-title);
  font-weight: 570;
  letter-spacing: -0.045em;
}

.recipe-editor-header p:last-child,
.recipe-editor-section-title p {
  margin: 7px 0 0;
  color: var(--text-muted);
  font-size: var(--type-small);
}

.recipe-editor-actions,
.recipe-editor-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.recipe-editor-actions > *,
.recipe-editor-footer > * {
  flex: 0 0 auto;
  white-space: nowrap;
}

.recipe-editor-section {
  padding: 23px 25px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.recipe-editor-section > h3,
.recipe-editor-section-title h3 {
  margin: 0 0 18px;
  font-size: var(--type-heading);
  font-weight: 620;
  letter-spacing: -0.02em;
}

.recipe-editor-section-title h3 {
  margin-bottom: 0;
}

.recipe-field-grid,
.recipe-line-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.formula-field-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.recipe-editor-form label,
.recipe-line-editor label,
.recipe-step-row label {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 7px;
  color: var(--text-muted);
  font-size: var(--type-caption);
  font-weight: 680;
  letter-spacing: 0.025em;
}

.recipe-editor-form input,
.recipe-editor-form textarea,
.recipe-editor-form select {
  width: 100%;
  min-width: 0;
  padding: 10px 11px;
  color: var(--text);
  background: #141414;
  border: 1px solid #414141;
  border-radius: 8px;
}

.recipe-editor-form textarea {
  resize: vertical;
}

.recipe-editor-form input:focus,
.recipe-editor-form textarea:focus,
.recipe-editor-form select:focus {
  border-color: var(--blue);
  outline: 0;
  box-shadow: 0 0 0 3px rgb(54 169 246 / 13%);
}

.recipe-editor-form input:disabled {
  color: var(--text-muted);
  background: #1d1d1d;
}

.field-span-2 {
  grid-column: span 2;
}

.recipe-editor-alert {
  margin: 0;
}

.recipe-editor-alert strong {
  display: block;
  margin-bottom: 6px;
}

.recipe-editor-alert ul {
  margin: 0;
  padding-left: 20px;
}

.recipe-line-list {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

.inline-ingredient-creator {
  margin-top: 1rem;
  color: var(--text-muted);
}

.inline-ingredient-creator > summary {
  width: fit-content;
  cursor: pointer;
  color: var(--blue);
  font-size: var(--type-small);
  font-weight: 700;
}

.inline-ingredient-creator > div {
  display: flex;
  align-items: end;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.inline-ingredient-creator label {
  display: grid;
  gap: 0.35rem;
  flex: 1;
  max-width: 420px;
  font-size: var(--type-small);
  font-weight: 650;
}

.inline-ingredient-creator input,
[data-ingredient-filter] {
  width: 100%;
  min-width: 0;
  padding: 0.58rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
}

[data-ingredient-filter] {
  margin-bottom: 0.45rem;
  font-size: var(--type-small);
}

[data-inline-ingredient-status] {
  align-self: center;
  font-size: var(--type-small);
}

.recipe-line-editor {
  padding: 18px;
  background: #151515;
  border: 1px solid #333;
  border-radius: 10px;
}

.recipe-line-editor > header,
.recipe-step-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.recipe-line-editor > header {
  margin-bottom: 16px;
}

.recipe-line-editor h4 {
  margin: 2px 0 0;
  font-size: var(--type-body);
}

.recipe-line-field-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.line-type-toggle {
  display: flex;
  gap: 16px;
  padding: 8px 4px 14px;
  color: var(--text-muted);
  font-size: var(--type-small);
}

.line-type-toggle label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  cursor: pointer;
}

.line-type-toggle input {
  width: auto;
  margin: 0;
  accent-color: var(--blue);
}

[data-recipe-line][data-line-type="ingredient"] .line-fields-component,
[data-recipe-line][data-line-type="component"] .line-fields-ingredient {
  display: none;
}

.anchor-choice {
  display: flex !important;
  grid-template-columns: auto 1fr;
  align-items: center !important;
  align-self: end;
  min-height: 41px;
  padding: 9px 11px;
  color: var(--text) !important;
  background: #1c1c1c;
  border: 1px solid #3a3a3a;
  border-radius: 8px;
}

.anchor-choice input {
  width: auto;
  margin: 0;
  accent-color: var(--blue);
}

.editor-row-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

.editor-row-actions button,
.text-action {
  padding: 6px 8px;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid #3d3d3d;
  border-radius: 6px;
  cursor: pointer;
}

.editor-row-actions button:hover,
.text-action:hover {
  color: var(--text);
  border-color: #656565;
}

.editor-row-actions .danger-quiet {
  color: #e08a8a;
}

.recipe-step-editor {
  margin-top: 18px;
  padding-top: 15px;
  border-top: 1px solid #303030;
}

.recipe-step-heading strong {
  font-size: var(--type-small);
}

.recipe-step-list {
  display: grid;
  gap: 9px;
  margin-top: 10px;
}

.recipe-step-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.5fr) 90px 120px minmax(150px, 1fr) auto;
  gap: 9px;
  align-items: end;
  padding: 11px;
  background: #1b1b1b;
  border-radius: 8px;
}

.step-actions {
  padding-bottom: 4px;
}

.tag-picker-fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.tag-picker-fieldset legend {
  margin: 0;
  padding: 0;
  color: var(--text);
  font-size: var(--type-heading);
  font-weight: 620;
  letter-spacing: -0.02em;
  text-transform: none;
}

.tag-picker-help {
  margin: 5px 0 12px;
  color: var(--text-muted);
  font-size: var(--type-small);
  font-weight: 400;
  letter-spacing: 0;
}

.tag-picker-summary-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.tag-picker-selection {
  display: flex;
  flex: 1 1 280px;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  min-width: 0;
}

.tag-picker-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  color: var(--text-muted);
  background: #151515;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: var(--type-small);
  font-weight: 650;
  line-height: 1.25;
}

.tag-picker-chip.is-unavailable {
  color: var(--text-soft);
  border-style: dashed;
}

.tag-picker-none {
  color: var(--text-soft);
  font-size: var(--type-small);
}

.tag-picker-trigger {
  appearance: none;
  min-height: 30px;
  margin: 0;
  padding: 4px 2px;
  color: var(--blue);
  background: transparent;
  border: 0;
  border-radius: 0;
  font: inherit;
  font-size: var(--type-small);
  font-weight: 650;
  line-height: 1.25;
  cursor: pointer;
}

.tag-picker-trigger:hover {
  color: #83ceff;
}

.tag-picker-trigger:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 4px;
}

.tag-picker-values:empty {
  display: none;
}

.tag-picker-dialog {
  width: min(580px, calc(100vw - 40px));
  max-width: none;
  max-height: min(720px, calc(100dvh - 48px));
  margin: auto;
  padding: 0;
  color: var(--text);
  background: #151515;
  border: 1px solid #3b3b3b;
  border-radius: 12px;
  box-shadow: 0 24px 80px rgb(0 0 0 / 65%);
  overflow: hidden;
}

.tag-picker-dialog::backdrop {
  background: rgb(0 0 0 / 74%);
}

.tag-picker-dialog-shell {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  max-height: min(720px, calc(100dvh - 48px));
}

.tag-picker-dialog-header {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--line);
}

.tag-picker-dialog-header .eyebrow {
  margin-bottom: 4px;
}

.tag-picker-dialog-header h2 {
  margin: 0;
  color: var(--text);
  font-size: var(--type-title);
  letter-spacing: -0.03em;
}

.tag-picker-dialog-close {
  display: inline-grid;
  width: 32px;
  height: 32px;
  min-height: 0;
  flex: 0 0 32px;
  place-items: center;
  margin: 0;
  padding: 0;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: var(--type-heading);
  line-height: 1;
  cursor: pointer;
}

.tag-picker-dialog-close:hover {
  color: var(--text);
  border-color: #5a5a5a;
}

.tag-picker-search {
  display: grid;
  gap: 6px;
  padding: 16px 22px 10px;
  color: var(--text-muted);
  font-size: var(--type-small);
  font-weight: 650;
  letter-spacing: 0;
  text-transform: none;
}

.tag-picker-search input {
  width: 100%;
  min-height: 40px;
  margin: 0;
  padding: 8px 11px;
  color: var(--text);
  background: #101010;
  border: 1px solid #454545;
  border-radius: 7px;
  font: inherit;
  font-size: var(--type-body);
  font-weight: 500;
}

.tag-picker-search input:focus {
  border-color: var(--blue);
  outline: 2px solid rgb(54 169 246 / 18%);
}

.tag-picker-dialog-meta {
  display: flex;
  justify-content: space-between;
  padding: 0 22px 10px;
  color: var(--text-soft);
  font-size: var(--type-small);
}

.tag-picker-option-list {
  display: grid;
  align-content: start;
  gap: 5px;
  min-height: 160px;
  max-height: 420px;
  padding: 2px 14px 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.tag-picker-dialog .tag-picker-option {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 40px;
  margin: 0;
  padding: 8px 10px;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  font-size: var(--type-body);
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.25;
  text-transform: none;
  cursor: pointer;
}

.tag-picker-dialog .tag-picker-option[hidden] {
  display: none;
}

.tag-picker-dialog .tag-picker-option:hover {
  color: var(--text);
  background: #1c1c1c;
}

.tag-picker-dialog .tag-picker-option input {
  width: 17px;
  height: 17px;
  min-height: 0;
  flex: 0 0 17px;
  margin: 0;
  padding: 0;
  accent-color: var(--blue);
}

.tag-picker-dialog .tag-picker-option:has(input:checked) {
  color: #ccecff;
  background: rgb(54 169 246 / 10%);
  border-color: rgb(54 169 246 / 45%);
}

.tag-picker-no-results,
.tag-picker-empty,
.tag-picker-dialog-problem {
  margin: 0;
  padding: 22px;
  color: var(--text-soft);
  font-size: var(--type-small);
}

.tag-picker-no-results {
  padding: 28px 8px;
  text-align: center;
}

.tag-picker-dialog-problem {
  color: #ffd3d3;
}

.tag-picker-dialog-footer {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  background: #121212;
  border-top: 1px solid var(--line);
}

.tag-picker-dialog-footer .primary-button {
  margin-left: auto;
}

.idea-reference-editor .tag-picker-fieldset {
  margin-top: 16px;
}

.notice-banner {
  width: min(820px, calc(100% - 56px));
  margin: 20px auto 0;
  padding: 10px 14px;
  color: #c8ecd4;
  background: rgb(89 184 122 / 10%);
  border: 1px solid rgb(89 184 122 / 30%);
  border-radius: 8px;
  font-size: var(--type-small);
}

.action-problem-banner {
  width: min(820px, calc(100% - 56px));
  margin: 20px auto 0;
}

@media (max-width: 1050px) {
  .recipe-editor-document {
    padding-inline: 26px;
  }

  .formula-field-grid,
  .recipe-line-field-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .recipe-step-row {
    grid-template-columns: minmax(180px, 1fr) 90px 120px;
  }

  .step-notes {
    grid-column: 1 / 3;
  }
}

@media (max-width: 720px) {
  .recipe-editor-document {
    padding: 24px 16px 56px;
  }

  .recipe-editor-header,
  .recipe-editor-section-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .recipe-editor-actions {
    width: 100%;
  }

  .recipe-field-grid,
  .formula-field-grid,
  .recipe-line-field-grid,
  .recipe-step-row {
    grid-template-columns: 1fr;
  }

  .field-span-2,
  .step-notes {
    grid-column: auto;
  }
}

@media (max-width: 1100px) {
  .ipad-reading-column {
    padding-inline: 28px;
  }

  .ipad-detail .detail-hero {
    padding-inline: 28px;
  }

  .ingredient-row {
    gap: 12px;
    font-size: var(--type-small);
  }
}

@media (max-width: 780px) {
  .detail-action-bar {
    padding-inline: 16px;
  }

  .ipad-detail .detail-hero {
    padding: 25px 18px 26px;
  }

  .ipad-detail .detail-hero h2 {
    font-size: var(--type-title);
  }

  .ipad-reading-column {
    padding-inline: 16px;
  }

  .recipe-version-block {
    padding-inline: 0;
  }

  .ingredient-row {
    grid-template-columns: minmax(0, 1fr) 62px 28px;
    gap: 9px;
  }

  .ingredient-header > span:last-child {
    display: none;
  }

  .ingredient-steps {
    grid-column: 1 / -1;
    padding-left: 18px;
  }

  .recipe-version-header {
    align-items: flex-start;
  }

  .ipad-detail .photo-grid {
    grid-template-columns: 1fr;
  }

  .tag-picker-summary-row {
    align-items: flex-start;
  }

  .tag-picker-dialog {
    width: calc(100vw - 20px);
    max-height: calc(100dvh - 20px);
    border-radius: 10px;
  }

  .tag-picker-dialog-shell {
    max-height: calc(100dvh - 20px);
  }

  .tag-picker-dialog-header,
  .tag-picker-dialog-footer {
    padding-inline: 16px;
  }

  .tag-picker-search {
    padding-inline: 16px;
  }

  .tag-picker-dialog-meta {
    padding-inline: 16px;
  }

  .tag-picker-option-list {
    max-height: none;
    padding-inline: 10px;
  }
}

/* Supplied W6 Lab wordmark. */
.brand-logo {
  width: 116px;
  height: auto;
  display: block;
}

.idea-detail .detail-hero {
  text-align: left;
}

.idea-notes-section > h3 {
  text-align: left;
}

.idea-detail .support-title > h3,
.idea-detail .support-section > h3 {
  text-align: left;
}

.idea-notes {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--type-body);
  line-height: 1.7;
  white-space: pre-line;
}

.idea-detail .support-empty {
  padding: 0;
  text-align: left;
  line-height: 1.55;
}

.add-support-button {
  position: absolute;
  top: -8px;
  right: 0;
  text-decoration: none;
}

.add-photo-button:hover,
.add-support-button:hover {
  background: rgb(54 169 246 / 10%);
}

.add-photo-button,
.add-support-button {
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--blue);
  background: transparent;
  border: 1px solid rgb(54 169 246 / 68%);
  border-radius: 50%;
  line-height: 0;
}

.add-photo-button .plus-icon,
.add-support-button .plus-icon {
  width: 16px;
  height: 16px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.75;
  vector-effect: non-scaling-stroke;
}

.api-pending-note {
  margin: -4px 0 0;
  padding: 10px 13px;
  color: #d7c292;
  background: rgb(216 154 57 / 9%);
  border: 1px solid rgb(216 154 57 / 24%);
  border-radius: 8px;
  font-size: var(--type-small);
}

.api-pending-note code {
  color: inherit;
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: var(--type-caption);
}

.recipe-editor-form button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.idea-reference-editor-list {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.idea-reference-editor {
  padding: 18px;
  background: #151515;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
}

.idea-reference-editor.is-new {
  background: rgb(54 169 246 / 3%);
  border-color: rgb(54 169 246 / 26%);
}

.idea-reference-editor > .eyebrow {
  margin-bottom: 13px;
}

.idea-reference-remove {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text-muted);
  font-size: var(--type-small);
}

.idea-reference-remove input {
  width: auto;
}

.support-editor-workspace {
  min-height: calc(100vh - var(--header-height));
  padding: 28px clamp(20px, 4vw, 56px) 64px;
}

.support-editor-document {
  max-width: 1040px;
  margin: 0 auto;
}

.support-editor-help {
  margin: 7px 0 16px;
  color: var(--text-muted);
  font-size: var(--type-small);
}

.support-photo-editor {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(0, 1.2fr);
  gap: 28px;
  align-items: start;
}

.support-photo-preview {
  display: grid;
  gap: 10px;
}

.support-photo-preview .photo-frame {
  width: 100%;
}

.support-photo-preview a {
  width: fit-content;
  color: var(--blue);
  font-size: var(--type-small);
}

@media (max-width: 720px) {
  .support-editor-workspace {
    padding: 0 0 48px;
  }

  .support-photo-editor {
    grid-template-columns: 1fr;
  }
}

.recipe-idea-source {
  padding: 20px 24px;
  background: rgb(54 169 246 / 5%);
  border: 1px solid rgb(54 169 246 / 25%);
  border-radius: 12px;
}

.recipe-idea-source-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}

.recipe-idea-source h3 {
  margin: 2px 0 0;
  font-size: var(--type-heading);
}

.recipe-idea-source > p {
  margin: 10px 0 0;
  color: var(--text-muted);
  font-size: var(--type-small);
  line-height: 1.55;
}

.recipe-idea-source .support-section {
  margin-top: 22px;
}

.recipe-idea-source .support-title > h3 {
  color: var(--text-muted);
  font-size: var(--type-body);
  text-align: left;
}

.recipe-idea-references {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgb(54 169 246 / 18%);
}

.recipe-idea-references > summary {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  color: var(--text);
  font-size: var(--type-small);
  font-weight: 650;
  list-style: none;
  cursor: pointer;
}

.recipe-idea-references > summary::-webkit-details-marker {
  display: none;
}

.recipe-idea-references > summary span:last-child {
  color: var(--blue);
  font-weight: 600;
}

.recipe-idea-references[open] > summary {
  padding-bottom: 4px;
}

@media (max-width: 1100px) {
  .brand-logo {
    width: 96px;
  }
}

@media (max-width: 780px) {
  .brand-logo {
    width: 82px;
  }

  .idea-reference-editor {
    padding: 14px;
  }

  .recipe-idea-source-heading {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* Stock and the shared Grocery list use the same collection/detail language
   as Dishes, Recipes, Ideas, and Plans. */
.stock-grocery-shortcut {
  margin: 0 18px 14px;
}

.stock-collection-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 0 24px 10px;
  color: var(--text-soft);
  font-size: var(--type-caption);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stock-collection-heading span:last-child {
  letter-spacing: 0;
  text-transform: none;
}

.collection-filter-form {
  display: grid;
  gap: 9px;
  padding: 0 18px 15px;
}

.collection-filter-search {
  margin: 0;
}

.collection-filter-form select {
  width: 100%;
  height: 38px;
  padding: 0 34px 0 12px;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.collection-filter-form select:focus {
  border-color: #626262;
  outline: 0;
  box-shadow: 0 0 0 3px rgb(255 255 255 / 5%);
}

.stock-collection-list {
  padding-top: 0;
}

.stock-collection-item {
  gap: 10px;
}

.stock-collection-meta {
  min-width: 0;
  max-width: 58%;
  display: flex;
  flex: 0 1 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
}

.stock-note-preview {
  min-width: 0;
  overflow: hidden;
  color: var(--text-soft);
  font-size: var(--type-caption);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stock-signal {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  color: var(--text-muted);
  font-size: var(--type-caption);
  font-weight: 650;
}

.stock-dot {
  width: 8px;
  height: 8px;
  display: inline-block;
  flex: 0 0 auto;
  background: #575757;
  border: 1px solid #777;
  border-radius: 50%;
}

.stock-signal-out .stock-dot {
  background: var(--red);
  border-color: #e38b8b;
  box-shadow: 0 0 0 3px rgb(207 94 94 / 10%);
}

.stock-signal-low .stock-dot {
  background: var(--amber);
  border-color: #e7b361;
  box-shadow: 0 0 0 3px rgb(216 154 57 / 10%);
}

.stock-signal-enough .stock-dot {
  background: var(--green);
  border-color: #82c999;
  box-shadow: 0 0 0 3px rgb(89 184 122 / 10%);
}

.stock-signal-unknown .stock-dot {
  background: var(--blue);
  border-color: #83caf8;
  box-shadow: 0 0 0 3px rgb(54 169 246 / 10%);
}

.stock-detail .detail-hero {
  text-align: left;
}

.stock-detail .detail-hero > p {
  margin-right: 0;
  margin-left: 0;
}

.detail-action.is-disabled,
.detail-action:disabled {
  color: var(--text-soft);
  cursor: not-allowed;
  opacity: 0.62;
}

.detail-action.is-disabled:hover,
.detail-action:disabled:hover {
  background: transparent;
}

.stock-section-caption {
  color: var(--text-soft);
  font-size: var(--type-small);
}

.grocery-list {
  border-top: 1px solid rgb(178 178 178 / 35%);
}

.grocery-row {
  grid-template-columns: 24px minmax(0, 1fr) auto auto;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line-soft);
}

.grocery-check {
  align-self: start;
  padding-top: 2px;
}

.grocery-check-form {
  align-self: start;
}

.grocery-check-button {
  width: 24px;
  min-height: 24px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 4px;
  font: inherit;
  cursor: pointer;
}

.grocery-check-button:hover,
.grocery-check-button:focus-visible {
  color: var(--blue);
  background: rgb(54 169 246 / 9%);
  outline: 0;
}

.grocery-item-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.grocery-item-name {
  width: fit-content;
  color: var(--text);
  font-size: var(--type-body);
  font-weight: 600;
  text-decoration: none;
}

a.grocery-item-name:hover {
  color: var(--blue);
}

.grocery-buy-note {
  color: var(--text-muted);
  font-size: var(--type-small);
}

.grocery-row > .stock-signal {
  align-self: center;
  grid-column: 3;
}

.grocery-row-actions {
  display: inline-flex;
  grid-column: 4;
  align-items: center;
  gap: 10px;
}

.grocery-row-actions form {
  margin: 0;
}

.grocery-row-actions .plan-row-action {
  display: inline;
  padding: 0;
  background: transparent;
  border: 0;
  font: inherit;
  font-size: var(--type-small);
  text-decoration: none;
  cursor: pointer;
}

.stock-detail-copy {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--type-body);
  line-height: 1.55;
}

.api-boundary-note {
  display: block;
  margin-top: 13px;
  color: var(--text-soft);
  font-size: var(--type-small);
}

.api-boundary-note code {
  color: var(--text-muted);
}

.stock-status-panel {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 18px 0;
  border-top: 1px solid rgb(178 178 178 / 35%);
  border-bottom: 1px solid var(--line-soft);
}

.stock-status-panel > .stock-signal {
  min-width: 96px;
  color: var(--text);
  font-size: var(--type-body);
}

.stock-status-panel > p {
  margin: 0;
  padding: 0;
  color: var(--text-muted);
  font-size: var(--type-body);
  text-align: left;
}

.stock-editor-document {
  width: min(100%, 820px);
}

.stock-field-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 780px) {
  .stock-grocery-shortcut {
    margin-bottom: 14px;
  }

  .collection-filter-form {
    grid-template-columns: minmax(0, 1fr) 150px;
  }

  .stock-collection-list {
    max-height: 260px;
  }

  .grocery-row {
    grid-template-columns: 24px minmax(0, 1fr);
  }

  .grocery-row > .stock-signal {
    grid-column: 2;
  }

  .stock-status-panel {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .stock-field-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .collection-filter-form {
    grid-template-columns: 1fr;
  }
}

/* Fine-pointer editors trade touch-sized targets for denser desktop entry. */
@media (hover: hover) and (pointer: fine) and (min-width: 781px) {
  .recipe-editor-document {
    width: min(100%, 1080px);
    padding: 26px 28px 52px;
  }

  .recipe-editor-form {
    gap: 16px;
  }

  .recipe-editor-header {
    padding-bottom: 18px;
  }

  .recipe-editor-header,
  .recipe-editor-section-title,
  .recipe-editor-footer {
    gap: 18px;
  }

  .recipe-editor-actions,
  .recipe-editor-footer {
    gap: 8px;
  }

  .recipe-editor-section {
    padding: 18px 20px;
    border-radius: 9px;
  }

  .recipe-editor-section > h3,
  .recipe-editor-section-title h3 {
    margin-bottom: 14px;
  }

  .recipe-editor-section-title h3 {
    margin-bottom: 0;
  }

  .recipe-field-grid,
  .recipe-line-field-grid {
    gap: 12px;
  }

  .recipe-editor-form label,
  .recipe-line-editor label,
  .recipe-step-row label {
    gap: 5px;
  }

  .recipe-editor-form input,
  .recipe-editor-form textarea,
  .recipe-editor-form select {
    min-height: 36px;
    padding: 7px 9px;
    border-radius: 6px;
  }

  .recipe-editor-form .line-type-toggle input,
  .recipe-editor-form .anchor-choice input,
  .recipe-editor-form .tag-picker-dialog .tag-picker-option input,
  .recipe-editor-form .idea-reference-remove input {
    min-height: 0;
    padding: 0;
  }

  .recipe-line-list {
    gap: 10px;
    margin-top: 14px;
  }

  .recipe-line-editor {
    padding: 14px;
    border-radius: 8px;
  }

  .recipe-line-editor > header {
    margin-bottom: 12px;
  }

  .line-type-toggle {
    padding: 5px 2px 10px;
  }

  .anchor-choice {
    min-height: 36px;
    padding: 6px 8px;
    border-radius: 6px;
  }

  .editor-row-actions button,
  .text-action {
    min-height: 30px;
    padding: 4px 6px;
    font-size: var(--type-small);
  }

  .recipe-step-editor {
    margin-top: 14px;
    padding-top: 12px;
  }

  .recipe-step-row {
    gap: 7px;
    padding: 8px;
    border-radius: 6px;
  }

  .tag-picker-option-list {
    gap: 3px;
  }

  .tag-picker-dialog .tag-picker-option {
    min-height: 34px;
    padding: 6px 9px;
    border-radius: 6px;
  }

  .secondary-button,
  .primary-button {
    min-height: 34px;
    padding: 6px 10px;
    border-radius: 6px;
  }

  .managed-editor {
    width: min(760px, calc(100% - 56px));
    min-height: 0;
    align-items: stretch;
    justify-content: flex-start;
    margin: 38px auto;
  }

  .managed-editor .eyebrow,
  .managed-editor h2,
  .managed-editor > p {
    align-self: flex-start;
    text-align: left;
  }

  .managed-form {
    width: 100%;
    align-self: flex-start;
    gap: 8px;
    margin-top: 24px;
    padding: 20px;
    border-radius: 8px;
  }

  .managed-form input[type="text"],
  .managed-form input[type="email"],
  .managed-form input[type="password"],
  .managed-form input[type="url"],
  .managed-form textarea {
    min-height: 38px;
    padding: 8px 10px;
    border-radius: 6px;
  }

  .managed-form input[type="text"],
  .managed-form input[type="email"],
  .managed-form input[type="password"],
  .managed-form input[type="url"] {
    line-height: 1.25;
  }

  .managed-form-actions {
    margin-top: 12px;
  }

  .idea-editor-form .recipe-editor-footer,
  .plan-editor-form .recipe-editor-footer,
  .stock-editor-form .recipe-editor-footer {
    display: none;
  }
}
