/*
 * Desktop recipe workspace restored from the approved Cooksy reference.
 * The existing application stays mounted underneath so its import, account,
 * and editor workflows can continue to be reused.
 */

:root {
  --reference-red: #ea4335;
  --reference-red-deep: #cf362c;
  --reference-ink: #1f2024;
  --reference-muted: #78797e;
  --reference-line: #ecebed;
  --reference-soft: #fbfbfc;
  --reference-active: #fff3f1;
  --reference-green: #2d8a2f;
  --reference-blue: #2877d7;
}

body.reference-shell-active {
  min-width: 320px;
  margin: 0;
  overflow: hidden;
  background: #fff;
  color: var(--reference-ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

body.reference-shell-active .app > .topbar,
body.reference-shell-active .app > #mainGrid {
  display: none !important;
}

body.reference-shell-active.cooksy-legacy-flow {
  overflow: hidden;
  background: #fff;
}

body.reference-shell-active.cooksy-legacy-flow .reference-shell {
  display: grid;
}

body.reference-shell-active.cooksy-legacy-flow .app > .topbar {
  display: none !important;
}

body.reference-shell-active.cooksy-legacy-flow .app > #mainGrid {
  display: block !important;
}

.reference-shell,
.reference-shell *,
.reference-shell *::before,
.reference-shell *::after {
  box-sizing: border-box;
}

.reference-shell {
  position: relative;
  display: grid;
  grid-template-columns: 160px minmax(640px, 1fr) minmax(320px, 380px);
  grid-template-rows: 48px minmax(0, 1fr);
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  min-height: 560px;
  margin: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: #fff;
  box-shadow: none;
  color: var(--reference-ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  isolation: isolate;
}

.reference-shell button,
.reference-shell input,
.reference-shell select {
  font: inherit;
}

.reference-shell button {
  cursor: pointer;
}

.reference-sidebar {
  grid-row: 1 / span 2;
  display: flex;
  min-width: 0;
  flex-direction: column;
  border-right: 1px solid var(--reference-line);
  background: #fff;
}

.reference-brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
  height: 48px;
  padding: 0 14px;
  border: 0;
  border-bottom: 1px solid var(--reference-line);
  background: #fff;
  color: var(--reference-red);
  text-align: left;
}

.reference-brand-mark {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  overflow: hidden;
  border: 1px solid #f0e8e3;
  border-radius: 7px;
  background: #fffaf6;
}

.reference-brand-mark img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.reference-brand-word {
  overflow: hidden;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reference-nav {
  display: grid;
  gap: 3px;
  padding: 13px 8px;
}

.reference-nav-item,
.reference-sidebar-footer button {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 11px;
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #56575d;
  font-size: 12px;
  font-weight: 600;
  text-align: left;
}

.reference-nav-item:hover,
.reference-sidebar-footer button:hover {
  background: #fafafa;
  color: #242529;
}

@media (min-width: 861px) {
  .reference-shell.is-compact {
    grid-template-columns: 56px minmax(520px, 1fr) minmax(305px, 360px);
  }

  .reference-shell.is-compact .reference-brand {
    justify-content: center;
    padding: 0;
  }

  .reference-shell.is-compact .reference-brand-word,
  .reference-shell.is-compact .reference-nav-item > span,
  .reference-shell.is-compact .reference-sidebar-footer button > span {
    display: none;
  }

  .reference-shell.is-compact .reference-nav-item,
  .reference-shell.is-compact .reference-sidebar-footer button {
    justify-content: center;
    padding: 0;
  }

  .reference-shell.is-compact .reference-nav-item.is-active::before {
    left: 0;
  }
}

.reference-nav-item.is-active {
  position: relative;
  background: var(--reference-active);
  color: var(--reference-red);
  font-weight: 750;
}

.reference-nav-item.is-active::before {
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: -8px;
  width: 2px;
  border-radius: 0 2px 2px 0;
  background: var(--reference-red);
  content: "";
}

.reference-nav-icon,
.reference-action-icon,
.reference-button-icon,
.reference-tab-icon,
.reference-check-icon {
  display: block;
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  opacity: 0.78;
}

.reference-nav-item.is-active .reference-nav-icon {
  opacity: 1;
  filter: invert(38%) sepia(74%) saturate(2061%) hue-rotate(338deg) brightness(102%) contrast(84%);
}

.reference-sidebar-footer {
  display: grid;
  gap: 3px;
  margin-top: auto;
  padding: 12px 8px 14px;
}

.reference-sidebar-footer button {
  color: #73747a;
  font-weight: 500;
}

.reference-topbar {
  grid-column: 2 / span 2;
  display: grid;
  grid-template-columns: minmax(112px, 1fr) minmax(260px, 350px) auto auto auto;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 0 15px;
  border-bottom: 1px solid var(--reference-line);
  background: #fff;
}

.reference-page-title {
  min-width: 0;
  color: #1f2024;
  font-size: 14px;
  font-weight: 800;
}

.reference-search {
  position: relative;
  min-width: 0;
}

.reference-search img {
  position: absolute;
  top: 50%;
  left: 11px;
  width: 15px;
  height: 15px;
  transform: translateY(-50%);
  opacity: 0.52;
}

.reference-search input {
  width: 100%;
  height: 34px;
  padding: 0 41px 0 32px;
  border: 1px solid #e7e6e7;
  border-radius: 6px;
  outline: none;
  background: #fcfcfc;
  color: #313237;
  font-size: 11px;
}

.reference-search input::placeholder {
  color: #999aa0;
}

.reference-search input:focus {
  border-color: #e8b2ac;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(234, 67, 53, 0.09);
}

.reference-search-shortcut {
  position: absolute;
  top: 50%;
  right: 7px;
  display: inline-flex;
  align-items: center;
  height: 19px;
  padding: 0 5px;
  transform: translateY(-50%);
  border-radius: 4px;
  background: #f1f1f2;
  color: #a1a2a6;
  font-size: 9px;
  line-height: 1;
}

.reference-primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--reference-red);
  border-radius: 6px;
  background: linear-gradient(135deg, #ed5142, #d83a30);
  box-shadow: 0 5px 10px rgba(212, 55, 46, 0.17);
  color: #fff;
  font-size: 10px;
  font-weight: 750;
  white-space: nowrap;
}

.reference-primary-action:hover {
  background: linear-gradient(135deg, #f25b4b, #d4382e);
}

.reference-primary-action .reference-button-icon {
  width: 14px;
  height: 14px;
  filter: brightness(0) invert(1);
}

.reference-icon-button {
  position: relative;
  display: inline-grid;
  width: 30px;
  height: 30px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
}

.reference-icon-button:hover {
  background: #f7f7f7;
}

.reference-icon-button img {
  width: 17px;
  height: 17px;
  opacity: 0.76;
}

.reference-notification-dot {
  position: absolute;
  top: 5px;
  right: 4px;
  width: 5px;
  height: 5px;
  border: 1px solid #fff;
  border-radius: 50%;
  background: var(--reference-red);
}

.reference-avatar {
  display: inline-grid;
  width: 30px;
  height: 30px;
  place-items: center;
  overflow: hidden;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #f1f1f1;
  color: #53545a;
  font-size: 9px;
  font-weight: 800;
}

.reference-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.reference-avatar-chevron {
  width: 13px;
  height: 13px;
  opacity: 0.65;
}

.reference-recipes {
  grid-column: 2;
  min-width: 0;
  overflow: auto;
  background: #fff;
}

.reference-recipes-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 54px;
  gap: 12px;
  padding: 10px 15px;
  border-bottom: 1px solid var(--reference-line);
}

.reference-filter-wrap {
  position: relative;
}

.reference-filter-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid #ecebed;
  border-radius: 5px;
  background: #fff;
  color: #54555a;
  font-size: 11px;
  font-weight: 650;
}

.reference-filter-button:hover,
.reference-filter-button[aria-expanded="true"] {
  border-color: #e1d6d4;
  background: #fffafa;
}

.reference-filter-button img {
  width: 14px;
  height: 14px;
  opacity: 0.7;
}

.reference-filter-menu {
  position: absolute;
  z-index: 5;
  top: 36px;
  left: 0;
  display: grid;
  width: 188px;
  gap: 6px;
  padding: 11px;
  border: 1px solid #e9e7e7;
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 14px 26px rgba(30, 30, 32, 0.12);
}

.reference-filter-menu[hidden] {
  display: none;
}

.reference-filter-menu label {
  color: #707177;
  font-size: 10px;
  font-weight: 700;
}

.reference-filter-menu select {
  width: 100%;
  height: 31px;
  padding: 0 8px;
  border: 1px solid #e5e3e4;
  border-radius: 5px;
  background: #fff;
  color: #3d3e43;
  font-size: 11px;
}

.reference-count {
  color: #797a80;
  font-size: 10px;
  white-space: nowrap;
}

.reference-table-head,
.reference-row {
  display: grid;
  grid-template-columns: minmax(340px, 2.4fr) minmax(110px, 0.8fr) 86px minmax(140px, 1fr) 96px 30px;
  align-items: center;
  min-width: 860px;
  width: 100%;
}

.reference-table-head {
  min-height: 31px;
  padding: 0 13px 0 26px;
  border-bottom: 1px solid #f1f0f1;
  color: #8b8c91;
  font-size: 8px;
  font-weight: 800;
  text-transform: uppercase;
}

.reference-table-head > span {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 3px;
}

.reference-sort {
  width: 10px;
  height: 10px;
  opacity: 0.45;
}

.reference-table {
  min-width: 860px;
  width: 100%;
}

.reference-row {
  position: relative;
  min-height: 64px;
  padding: 0 13px 0 26px;
  border: 0;
  border-bottom: 1px solid #f0eff0;
  background: #fff;
  color: inherit;
  text-align: left;
}

.reference-row::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 2px;
  background: transparent;
  content: "";
}

.reference-row:hover {
  background: #fffafa;
}

.reference-row.is-selected {
  background: linear-gradient(90deg, #fff5f3, #fffdfd);
}

.reference-row.is-selected::before {
  background: var(--reference-red);
}

.reference-row-cell {
  min-width: 0;
  padding: 7px 4px;
}

.reference-recipe-main {
  display: grid;
  grid-template-columns: 47px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.reference-recipe-main.has-no-photo {
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
}

.reference-recipe-thumb {
  width: 47px;
  height: 47px;
  overflow: hidden;
  border-radius: 6px;
  background: #f2efec;
}

.reference-recipe-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.reference-recipe-title {
  display: -webkit-box;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  color: #28292d;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.32;
  overflow-wrap: normal;
  word-break: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.reference-cell-text {
  overflow: hidden;
  color: #68696e;
  font-size: 10px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reference-cell-date {
  display: grid;
  gap: 2px;
}

.reference-cell-date strong,
.reference-cell-date span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reference-cell-date strong {
  color: #65666b;
  font-size: 10px;
  font-weight: 600;
}

.reference-cell-date span {
  color: #919297;
  font-size: 9px;
}

.reference-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  height: 21px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 750;
  white-space: nowrap;
}

.reference-status.is-ready {
  background: #e4f6df;
  color: #3b9b42;
}

.reference-status.is-review {
  background: #e7f0ff;
  color: #3578ce;
}

.reference-status.is-draft {
  background: #f2f2f3;
  color: #7a7b80;
}

.reference-row-menu {
  display: inline-grid;
  width: 27px;
  height: 27px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
}

.reference-row-menu:hover {
  background: #f3f2f2;
}

.reference-row-menu img {
  width: 16px;
  height: 16px;
  opacity: 0.63;
}

.reference-pagination {
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 47px;
  padding: 0 18px;
  border-top: 1px solid #f0eff0;
  color: #7c7d82;
  font-size: 9px;
}

.reference-page-numbers {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-left: auto;
}

.reference-page-numbers button {
  width: 18px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #797a7f;
  font-size: 9px;
}

.reference-page-numbers button.is-current {
  background: #fff0ee;
  color: var(--reference-red);
  font-weight: 800;
}

.reference-inspector {
  grid-column: 3;
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  border-left: 1px solid var(--reference-line);
  background: #fff;
}

.reference-inspector-head {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 47px;
  padding: 0 14px;
}

.reference-inspector-close,
.reference-inspector-more {
  display: inline-grid;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
}

.reference-inspector-close:hover,
.reference-inspector-more:hover {
  background: #f4f4f4;
}

.reference-inspector-close img,
.reference-inspector-more img {
  width: 16px;
  height: 16px;
  opacity: 0.67;
}

.reference-inspector-title {
  flex: 1;
  overflow: hidden;
  color: #242529;
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reference-inspector-hero {
  position: relative;
  flex: 0 0 auto;
  height: 228px;
  margin: 2px 14px 11px;
  overflow: hidden;
  border-radius: 7px;
  background: #efefef;
}

.reference-inspector-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.reference-detail-tabs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  min-height: 29px;
  padding: 0 14px;
  border-bottom: 1px solid var(--reference-line);
}

.reference-detail-tabs button {
  position: relative;
  overflow: hidden;
  padding: 0;
  border: 0;
  background: transparent;
  color: #85868b;
  font-size: 9px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reference-detail-tabs button.is-active {
  color: var(--reference-red);
  font-weight: 800;
}

.reference-detail-tabs button.is-active::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  background: var(--reference-red);
  content: "";
}

.reference-inspector-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 12px 17px 0;
}

.reference-detail-list {
  display: grid;
  gap: 7px;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--reference-line);
}

.reference-detail-pair {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) minmax(94px, 1.1fr);
  gap: 12px;
  color: #6e6f74;
  font-size: 9px;
}

.reference-detail-pair strong {
  overflow: hidden;
  color: #5e5f64;
  font-weight: 600;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reference-detail-status {
  display: inline-flex;
  width: fit-content;
  margin-left: auto;
}

.reference-ingredients {
  padding: 13px 0 0;
}

.reference-ingredients-head {
  display: grid;
  grid-template-columns: 1fr auto 89px;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.reference-ingredients-head h3 {
  margin: 0;
  color: #343539;
  font-size: 11px;
  font-weight: 800;
}

.reference-ingredients-count {
  color: var(--reference-green);
  font-size: 9px;
  font-weight: 800;
}

.reference-progress {
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: #eeeeef;
}

.reference-progress span {
  display: block;
  width: var(--reference-progress, 0%);
  height: 100%;
  border-radius: inherit;
  background: #2a8e2d;
}

.reference-ingredient-row {
  display: grid;
  grid-template-columns: 15px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 24px;
  color: #5e5f64;
  font-size: 9px;
}

.reference-ingredient-row img {
  width: 14px;
  height: 14px;
}

.reference-ingredient-row.is-done img {
  filter: invert(47%) sepia(82%) saturate(576%) hue-rotate(72deg) brightness(81%) contrast(91%);
}

.reference-ingredient-name,
.reference-ingredient-amount {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reference-ingredient-amount {
  color: #6d6e73;
}

.reference-tab-panel {
  color: #66676d;
  font-size: 10px;
  line-height: 1.55;
}

.reference-tab-panel h3 {
  margin: 0 0 9px;
  color: #343539;
  font-size: 11px;
}

.reference-tab-panel p {
  margin: 0;
}

.reference-cost-panel {
  display: grid;
  gap: 10px;
  color: #66676d;
  font-size: 10px;
}

.reference-cost-panel > h3 {
  margin: 0;
  color: #343539;
  font-size: 12px;
}

.reference-cost-summary,
.reference-cost-line-values {
  display: grid;
  gap: 5px;
}

.reference-cost-summary {
  padding: 9px;
  border: 1px solid #f0d8d4;
  border-radius: 7px;
  background: #fff7f5;
}

.reference-cost-line {
  padding: 9px;
  border: 1px solid var(--reference-line);
  border-radius: 7px;
  background: #fff;
}

.reference-cost-line h4 {
  margin: 0 0 7px;
  color: #343539;
  font-size: 11px;
}

.reference-cost-line .reference-detail-pair,
.reference-cost-summary .reference-detail-pair {
  min-height: 20px;
  padding: 0;
  border: 0;
}

.reference-cost-empty {
  margin: 0;
  padding: 12px;
  border-radius: 7px;
  background: #f6f6f6;
  text-align: center;
}

.reference-inspector-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  border-top: 1px solid var(--reference-line);
}

.reference-open-complete {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--reference-red);
  font-size: 9px;
  font-weight: 750;
}

.reference-open-complete img {
  width: 13px;
  height: 13px;
  filter: invert(38%) sepia(74%) saturate(2061%) hue-rotate(338deg) brightness(102%) contrast(84%);
}

.reference-empty {
  display: grid;
  min-height: 310px;
  place-items: center;
  padding: 30px;
  color: #797a7f;
  font-size: 12px;
  text-align: center;
}

.reference-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 1080px) {
  .reference-shell {
    grid-template-columns: 136px minmax(470px, 1fr) minmax(290px, 322px);
  }

  .reference-topbar {
    grid-template-columns: minmax(92px, 1fr) minmax(210px, 300px) auto auto auto;
    gap: 8px;
    padding-inline: 11px;
  }

  .reference-table-head,
  .reference-row,
  .reference-table {
    min-width: 630px;
  }

  .reference-table-head,
  .reference-row {
    grid-template-columns: minmax(205px, 1.8fr) 72px 65px minmax(100px, 0.92fr) 82px 25px;
    padding-left: 18px;
  }

  .reference-inspector-hero {
    height: 205px;
  }
}

@media (max-width: 860px) {
  body.reference-shell-active {
    overflow: auto;
    background: #fff;
  }

  .reference-shell {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    height: auto;
    min-height: 100vh;
    margin: 0;
    overflow: visible;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .reference-sidebar {
    position: fixed;
    z-index: 8;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    height: 60px;
    border-top: 1px solid var(--reference-line);
    border-right: 0;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(14px);
  }

  .reference-brand,
  .reference-sidebar-footer {
    display: none;
  }

  .reference-nav {
    display: contents;
    padding: 0;
  }

  .reference-nav-item {
    display: grid;
    min-height: 60px;
    place-content: center;
    gap: 3px;
    padding: 5px 3px;
    border-radius: 0;
    font-size: 9px;
    text-align: center;
  }

  .reference-nav-item:nth-child(n + 6) {
    display: none;
  }

  .reference-nav-item.is-active::before {
    top: 0;
    right: 12px;
    bottom: auto;
    left: 12px;
    width: auto;
    height: 2px;
    border-radius: 0 0 2px 2px;
  }

  .reference-nav-icon {
    width: 17px;
    height: 17px;
    margin: 0 auto;
  }

  .reference-topbar {
    position: sticky;
    z-index: 4;
    top: 0;
    display: grid;
    grid-column: auto;
    width: 100%;
    flex: 0 0 auto;
    grid-template-columns: 1fr auto auto;
    gap: 9px;
    min-height: 56px;
    padding: 0 14px;
  }

  .reference-page-title {
    font-size: 15px;
  }

  .reference-search {
    grid-column: 1 / span 3;
    grid-row: 2;
    margin-bottom: 11px;
  }

  .reference-search-shortcut,
  .reference-avatar-chevron,
  .reference-avatar {
    display: none;
  }

  .reference-primary-action {
    height: 31px;
    padding: 0 10px;
    font-size: 10px;
  }

  .reference-recipes {
    grid-column: auto;
    width: 100%;
    flex: 1 1 auto;
    overflow: visible;
    padding-bottom: 60px;
  }

  .reference-recipes-toolbar {
    position: sticky;
    z-index: 3;
    top: 102px;
    background: #fff;
  }

  .reference-table-head {
    display: none;
  }

  .reference-table,
  .reference-row {
    min-width: 0;
  }

  .reference-row {
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 73px;
    padding: 0 12px 0 16px;
  }

  .reference-row > :nth-child(2),
  .reference-row > :nth-child(3),
  .reference-row > :nth-child(4) {
    display: none;
  }

  .reference-recipe-main {
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 11px;
  }

  .reference-recipe-thumb {
    width: 52px;
    height: 52px;
  }

  .reference-recipe-title {
    font-size: 12px;
  }

  .reference-row-cell.reference-status-cell {
    display: none;
  }

  .reference-row-menu {
    display: none;
  }

  .reference-inspector {
    display: none;
  }
}

@media (max-width: 500px) {
  .reference-topbar {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .reference-topbar > .reference-icon-button {
    display: none;
  }

  .reference-search {
    grid-column: 1 / span 2;
  }

  .reference-primary-action span {
    display: none;
  }

  .reference-primary-action {
    width: 34px;
    padding: 0;
  }

  .reference-primary-action .reference-button-icon {
    width: 16px;
    height: 16px;
  }
}

/* Unified Cooksy workspaces: the existing import, editor and account flows
   keep their behavior, but now live inside the same application frame. */
body.reference-shell-active.cooksy-legacy-flow .reference-recipes,
body.reference-shell-active.cooksy-legacy-flow .reference-inspector {
  display: none !important;
}

body.reference-shell-active.cooksy-legacy-flow .reference-shell {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  margin: 0;
  z-index: 20;
}

body.reference-shell-active.cooksy-legacy-flow .app {
  position: fixed;
  z-index: 21;
  top: 58px;
  right: 10px;
  bottom: 10px;
  left: 160px;
  width: auto;
  max-width: none;
  margin: 0;
  padding: 0;
  overflow: auto;
  background: #f8f8f8;
  color: #242529;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

body.reference-shell-active.cooksy-legacy-flow .app > #mainGrid {
  min-height: 100%;
  padding: 28px clamp(20px, 3vw, 46px) 40px;
  background: #f8f8f8;
}

body.reference-shell-active.cooksy-legacy-flow .app .desktopStartPanel,
body.reference-shell-active.cooksy-legacy-flow .app .appLegalFooter {
  display: none !important;
}

body.reference-shell-active.cooksy-new-recipe-flow .app .inputWorkspace {
  display: none !important;
}

/* La modifica di una ricetta e' un editor dedicato, separato da Importa. */
body.reference-shell-active.cooksy-edit-recipe-flow .app .inputWorkspace,
body.reference-shell-active.cooksy-edit-recipe-flow .app .desktopStartPanel {
  display: none !important;
}

body.reference-shell-active.cooksy-edit-recipe-flow .app .previewWorkspace {
  width: min(1180px, 100%);
}

body.reference-shell-active.cooksy-new-recipe-flow .app .previewHeaderActions {
  display: none !important;
}

body.reference-shell-active.cooksy-new-recipe-flow .app .previewTitle {
  min-height: 52px;
  font-size: 26px;
  font-weight: 750;
}

body.reference-shell-active.cooksy-legacy-flow .app .card,
body.reference-shell-active.cooksy-legacy-flow .app .inputWorkspace,
body.reference-shell-active.cooksy-legacy-flow .app .previewWorkspace {
  width: min(1080px, 100%);
  margin: 0 auto;
  padding: 22px;
  border: 1px solid #e8e5e3;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(25, 25, 25, 0.05);
}

body.reference-shell-active.cooksy-legacy-flow .app .cardHeader {
  align-items: flex-start;
  gap: 16px;
  min-height: 54px;
  margin: 0 0 20px;
  padding: 0 0 16px;
  border-color: #ebe9e7;
}

body.reference-shell-active.cooksy-legacy-flow .app .cardTitle,
body.reference-shell-active.cooksy-legacy-flow .app .previewTitle {
  color: #202124;
  font-size: 24px;
  font-weight: 760;
  letter-spacing: -0.02em;
}

body.reference-shell-active.cooksy-legacy-flow .app .cardHint,
body.reference-shell-active.cooksy-legacy-flow .app .previewMeta,
body.reference-shell-active.cooksy-legacy-flow .app .fieldHint,
body.reference-shell-active.cooksy-legacy-flow .app .missingHint {
  color: #77716e;
  font-size: 13px;
  line-height: 1.45;
}

body.reference-shell-active.cooksy-legacy-flow .app .btn {
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid #e1ddda;
  border-radius: 6px;
  background: #fff;
  color: #292a2d;
  box-shadow: 0 4px 12px rgba(25, 25, 25, 0.05);
  font-size: 13px;
  font-weight: 700;
}

body.reference-shell-active.cooksy-legacy-flow .app .btn:hover:not(:disabled) {
  border-color: #cfc9c5;
  background: #fafafa;
  box-shadow: 0 7px 18px rgba(25, 25, 25, 0.08);
  transform: translateY(-1px);
}

body.reference-shell-active.cooksy-legacy-flow .app .btn.primary {
  border-color: #df4135;
  background: #e84739;
  color: #fff;
  box-shadow: 0 8px 18px rgba(225, 63, 52, 0.19);
}

body.reference-shell-active.cooksy-legacy-flow .app .btn.primary:hover:not(:disabled) {
  border-color: #ce352a;
  background: #d93d30;
}

body.reference-shell-active.cooksy-legacy-flow .app .btn.subtle,
body.reference-shell-active.cooksy-legacy-flow .app .btn.secondary {
  background: #fff;
  color: #4f4b49;
}

body.reference-shell-active.cooksy-legacy-flow .app .btn.danger {
  border-color: #f0c9c4;
  color: #bf372d;
  background: #fffafa;
}

body.reference-shell-active.cooksy-legacy-flow .app .importMethodPicker {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

body.reference-shell-active.cooksy-legacy-flow .app .importMethod {
  min-height: 86px;
  padding: 14px;
  border-color: #e7e2df;
  border-radius: 8px;
  background: #fff;
  box-shadow: none;
}

body.reference-shell-active.cooksy-legacy-flow .app .importMethod:hover {
  border-color: #d5cfcb;
  background: #fdfcfb;
}

body.reference-shell-active.cooksy-legacy-flow .app .importMethodInput:checked + .importMethod {
  border-color: #ec766c;
  background: #fff5f3;
  box-shadow: inset 3px 0 0 #e84739;
}

body.reference-shell-active.cooksy-legacy-flow .app .importMethodInput:checked + .importMethod strong {
  color: #c93b31;
}

body.reference-shell-active.cooksy-legacy-flow .app .importRoute {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid #ece8e5;
  border-radius: 8px;
  background: #fcfcfc;
}

body.reference-shell-active.cooksy-legacy-flow .app .importRouteCopy strong {
  color: #252629;
  font-size: 18px;
}

body.reference-shell-active.cooksy-legacy-flow .app .importRouteCopy span {
  color: #77716e;
}

body.reference-shell-active.cooksy-legacy-flow .app .importPrimaryButton {
  min-height: 40px;
  margin-top: 14px;
}

body.reference-shell-active.cooksy-legacy-flow .app .importSelectionPanel,
body.reference-shell-active.cooksy-legacy-flow .app .importFolderWork,
body.reference-shell-active.cooksy-legacy-flow .app .importProgressPanel,
body.reference-shell-active.cooksy-legacy-flow .app .importDetails,
body.reference-shell-active.cooksy-legacy-flow .app .missingPanel,
body.reference-shell-active.cooksy-legacy-flow .app .previewBox {
  border-color: #e8e5e3;
  border-radius: 7px;
  background: #fff;
  box-shadow: none;
}

body.reference-shell-active.cooksy-legacy-flow .app .fileList,
body.reference-shell-active.cooksy-legacy-flow .app .log,
body.reference-shell-active.cooksy-legacy-flow .app .logList {
  border-color: #e9e5e2;
  border-radius: 7px;
  background: #fafafa;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

body.reference-shell-active.cooksy-legacy-flow .app input,
body.reference-shell-active.cooksy-legacy-flow .app textarea,
body.reference-shell-active.cooksy-legacy-flow .app select,
body.reference-shell-active.cooksy-legacy-flow .app .metaInput,
body.reference-shell-active.cooksy-legacy-flow .app .dtInput {
  border: 1px solid #dfdbd8;
  border-radius: 6px;
  background: #fff;
  color: #292a2d;
  box-shadow: none;
}

body.reference-shell-active.cooksy-legacy-flow .app input:focus,
body.reference-shell-active.cooksy-legacy-flow .app textarea:focus,
body.reference-shell-active.cooksy-legacy-flow .app select:focus,
body.reference-shell-active.cooksy-legacy-flow .app .metaInput:focus,
body.reference-shell-active.cooksy-legacy-flow .app .dtInput:focus {
  outline: 3px solid rgba(232, 71, 57, 0.13);
  border-color: #e56b61;
}

body.reference-shell-active.cooksy-legacy-flow .app .previewCols,
body.reference-shell-active.cooksy-legacy-flow .app .accountGrid {
  gap: 14px;
}

body.reference-shell-active.cooksy-legacy-flow .app .previewBox {
  padding: 16px;
}

body.reference-shell-active.cooksy-legacy-flow .app .previewBoxTitle,
body.reference-shell-active.cooksy-legacy-flow .app .accountSectionTitle {
  color: #252629;
  font-size: 15px;
  font-weight: 760;
}

body.reference-shell-active.cooksy-legacy-flow .app .metaRow {
  gap: 9px;
}

body.reference-shell-active.cooksy-legacy-flow .app .metaField {
  padding: 9px 10px;
  border-color: #e7e3e0;
  border-radius: 7px;
  background: #fafafa;
}

body.reference-shell-active.cooksy-legacy-flow .app .metaLabel,
body.reference-shell-active.cooksy-legacy-flow .app .label {
  color: #736d69;
  font-size: 11px;
  font-weight: 720;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

body.reference-shell-active .modalBackdrop {
  background: rgba(10, 10, 12, 0.48);
  backdrop-filter: blur(3px);
}

body.reference-shell-active .modalPanel,
body.reference-shell-active .accountPanel {
  border: 1px solid #e6e2df;
  border-radius: 9px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.24);
}

body.reference-shell-active .modalHeader {
  min-height: 58px;
  padding: 12px 18px;
  border-color: #ebe8e5;
  background: #fff;
}

body.reference-shell-active .modalTitle {
  color: #222326;
  font-size: 18px;
  font-weight: 760;
}

body.reference-shell-active .modalBody {
  padding: 18px;
  background: #fafafa;
}

body.reference-shell-active .accountPanel .modalBody,
body.reference-shell-active .accountBody {
  background: #fafafa;
}

body.reference-shell-active .accountSection {
  padding: 16px;
  border-color: #e6e1de;
  border-radius: 8px;
  background: #fff;
  box-shadow: none;
}

body.reference-shell-active .accountHero,
body.reference-shell-active .accountPasskeyBox {
  border-color: #e6e1de;
  border-radius: 8px;
  background: #fff;
}

/* L'account vive nello stesso spazio di lavoro: non e' una finestra separata. */
body.reference-shell-active.cooksy-legacy-flow .accountModal:not(.hidden) {
  position: fixed;
  z-index: 30;
  inset: 58px 10px 10px 160px;
  display: block;
  background: #fafafa;
}

body.reference-shell-active.cooksy-legacy-flow .accountModal .modalBackdrop {
  display: none;
}

body.reference-shell-active.cooksy-legacy-flow .accountModal .accountPanel {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  border: 0;
  border-radius: 0;
  background: #fafafa;
  box-shadow: none;
}

body.reference-shell-active.cooksy-legacy-flow .accountModal .modalHeader {
  min-height: 74px;
  padding: 16px max(28px, 4vw);
  border-bottom-color: #e8e5e3;
  background: #fff;
}

body.reference-shell-active.cooksy-legacy-flow .accountModal .modalTitle {
  font-size: 24px;
  font-weight: 760;
}

body.reference-shell-active.cooksy-legacy-flow .accountModal .modalBody {
  width: min(1080px, 100%);
  margin: 0 auto;
  padding: 30px clamp(24px, 4vw, 48px) 48px;
  background: #fafafa;
}

body.reference-shell-active.cooksy-legacy-flow .accountModal .accountSection {
  padding: 20px;
}

body.reference-shell-active.cooksy-legacy-flow .accountModal input[type="file"].metaInput {
  min-height: 42px;
  padding: 5px 8px;
}

body.reference-shell-active.cooksy-legacy-flow .accountModal input[type="file"].metaInput::file-selector-button {
  height: 30px;
  margin-right: 10px;
  padding: 0 11px;
  border: 0;
  border-radius: 5px;
  background: #f2efed;
  color: #252629;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

body.reference-shell-active .accountAvatar {
  border-radius: 8px;
  background: #fff5f3;
}

body.reference-shell-active .accountBadge {
  border-radius: 999px;
}

/* L'archivio e' una pagina integrata nel telaio Cooksy, non una sovrappagina. */
body.reference-shell-active.cooksy-legacy-flow #archiveModal:not(.hidden) {
  position: fixed;
  z-index: 30;
  inset: 58px 10px 10px 160px;
  display: block;
  background: #fafafa;
}

body.reference-shell-active.cooksy-legacy-flow #archiveModal .modalBackdrop {
  display: none;
}

body.reference-shell-active.cooksy-legacy-flow #archiveModal .modalPanel {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  border: 0;
  border-radius: 0;
  background: #fafafa;
  box-shadow: none;
}

body.reference-shell-active.cooksy-legacy-flow #archiveModal .modalHeader {
  min-height: 74px;
  padding: 16px max(28px, 4vw);
}

body.reference-shell-active.cooksy-legacy-flow #archiveModal .archiveBody {
  padding: 24px clamp(20px, 3vw, 44px) 40px;
}

@media (max-width: 860px) {
  body.reference-shell-active.cooksy-legacy-flow {
    overflow: auto;
    background: #fff;
  }

  body.reference-shell-active.cooksy-legacy-flow .reference-shell {
    position: relative;
    inset: auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    height: auto;
    min-height: 102px;
    overflow: visible;
  }

  body.reference-shell-active.cooksy-legacy-flow .reference-topbar {
    grid-column: auto;
    width: 100%;
    flex: 0 0 auto;
  }

  body.reference-shell-active.cooksy-legacy-flow .reference-sidebar {
    display: grid;
  }

  body.reference-shell-active.cooksy-legacy-flow .app {
    position: relative;
    z-index: 1;
    top: auto;
    right: auto;
    bottom: auto;
    left: auto;
    min-height: calc(100vh - 162px);
    overflow: visible;
  }

  body.reference-shell-active.cooksy-legacy-flow .app > #mainGrid {
    padding: 18px 12px 82px;
  }

  body.reference-shell-active.cooksy-legacy-flow .app .card,
  body.reference-shell-active.cooksy-legacy-flow .app .inputWorkspace,
  body.reference-shell-active.cooksy-legacy-flow .app .previewWorkspace {
    padding: 16px;
  }

  body.reference-shell-active.cooksy-legacy-flow .app .importMethodPicker {
    grid-template-columns: 1fr;
  }

  body.reference-shell-active.cooksy-legacy-flow .accountModal:not(.hidden) {
    inset: 0 0 60px;
  }

  body.reference-shell-active.cooksy-legacy-flow #archiveModal:not(.hidden) {
    inset: 0 0 60px;
  }

  body.reference-shell-active.cooksy-legacy-flow .accountModal .modalHeader {
    min-height: 58px;
    padding: 11px 16px;
  }

  body.reference-shell-active.cooksy-legacy-flow .accountModal .modalBody {
    padding: 18px 14px 28px;
  }
}

/*
 * Integrated page architecture.
 *
 * Import, editing, archive and account are mounted inside this grid cell.
 * The old modal elements retain their controls and API wiring, but no longer
 * behave as overlays or cover the recipe list.
 */
.reference-page-host {
  grid-column: 2 / span 2;
  grid-row: 2;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  background: #f8f8f8;
}

.reference-page-host[hidden] {
  display: none !important;
}

.reference-shell[data-view]:not([data-view="recipes"]) .reference-recipes,
.reference-shell[data-view]:not([data-view="recipes"]) .reference-inspector {
  display: none !important;
}

.reference-shell[data-view]:not([data-view="recipes"]) .reference-topbar {
  grid-template-columns: minmax(0, 1fr) auto auto auto;
}

.reference-shell[data-view]:not([data-view="recipes"]) .reference-page-title {
  font-size: 16px;
}

.reference-page-host > .reference-legacy-page {
  position: static !important;
  inset: auto !important;
  z-index: auto !important;
  width: 100% !important;
  max-width: none !important;
  min-height: 100%;
  margin: 0 !important;
  padding: 0 !important;
  overflow: visible !important;
  background: #f8f8f8;
}

.reference-page-host > .reference-legacy-page[hidden] {
  display: none !important;
}

body.reference-shell-active.cooksy-page-active .reference-page-host > .reference-legacy-page:not([hidden]) {
  display: block !important;
}

body.reference-shell-active.cooksy-page-active .reference-page-host > .reference-legacy-page > .topbar {
  display: none !important;
}

body.reference-shell-active.cooksy-page-active .reference-page-host > .reference-legacy-page > #mainGrid {
  display: block !important;
  min-height: 100%;
  padding: 28px clamp(20px, 3vw, 46px) 48px;
  background: #f8f8f8;
}

body.reference-shell-active.cooksy-import-page .reference-page-host .desktopStartPanel,
body.reference-shell-active.cooksy-import-page .reference-page-host .appLegalFooter,
body.reference-shell-active.cooksy-edit-recipe-flow .reference-page-host .desktopStartPanel,
body.reference-shell-active.cooksy-edit-recipe-flow .reference-page-host .inputWorkspace,
body.reference-shell-active.cooksy-new-recipe-flow .reference-page-host .desktopStartPanel,
body.reference-shell-active.cooksy-new-recipe-flow .reference-page-host .inputWorkspace {
  display: none !important;
}

body.reference-shell-active.cooksy-import-page .reference-page-host .inputWorkspace {
  display: block !important;
}

body.reference-shell-active.cooksy-edit-recipe-flow .reference-page-host .previewWorkspace,
body.reference-shell-active.cooksy-new-recipe-flow .reference-page-host .previewWorkspace {
  display: block !important;
  width: 100% !important;
  max-width: none !important;
}

body.reference-shell-active.cooksy-edit-recipe-flow .reference-page-host .previewWorkspace::before {
  display: block;
  margin: -2px 0 18px;
  padding: 10px 12px;
  border: 1px solid #f0d7d3;
  border-radius: 7px;
  background: #fff7f5;
  color: #8a352e;
  content: "Stai modificando una ricetta salvata. Controlla tutti i dati e usa Aggiorna archivio per salvare le modifiche.";
  font-size: 12px;
  font-weight: 650;
  line-height: 1.45;
}

.reference-page-host > .reference-inline-page {
  position: static !important;
  inset: auto !important;
  z-index: auto !important;
  width: 100% !important;
  min-height: 100%;
  overflow: visible !important;
  background: #f8f8f8;
}

.reference-page-host > .reference-inline-page[hidden],
.reference-page-host > .reference-inline-page.hidden {
  display: none !important;
}

.reference-page-host > .reference-inline-page:not(.hidden):not([hidden]) {
  display: block !important;
}

.reference-page-host > .reference-inline-page .modalBackdrop {
  display: none !important;
}

.reference-page-host > .reference-inline-page .modalPanel {
  position: static !important;
  inset: auto !important;
  display: flex;
  width: 100% !important;
  height: auto !important;
  max-width: none !important;
  min-height: 100%;
  max-height: none !important;
  margin: 0 !important;
  transform: none !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: #f8f8f8;
  box-shadow: none !important;
  overflow: visible !important;
}

.reference-page-host > .reference-inline-page .modalHeader {
  position: sticky;
  z-index: 2;
  top: 0;
  min-height: 70px;
  padding: 15px clamp(20px, 3vw, 44px);
  border-bottom: 1px solid #e8e5e3;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(12px);
}

.reference-page-host > .reference-inline-page .modalTitle {
  font-size: 24px;
}

.reference-page-host > #archiveModal .archiveBody,
.reference-page-host > #accountModal .modalBody {
  width: 100%;
  max-width: none;
  margin: 0 auto;
  padding: 28px clamp(20px, 3vw, 44px) 52px;
  overflow: visible !important;
  background: #f8f8f8;
}

.reference-page-host > #archiveModal .archiveTableWrap {
  max-height: none !important;
  overflow: auto;
}

.reference-page-host > #accountModal .accountPanel {
  width: 100% !important;
  height: auto !important;
  max-width: none !important;
  max-height: none !important;
}

@media (max-width: 860px) {
  .reference-page-host {
    grid-column: auto;
    grid-row: auto;
    width: 100%;
    min-height: calc(100vh - 56px);
    padding-bottom: 60px;
    overflow: visible;
  }

  .reference-shell[data-view]:not([data-view="recipes"]) .reference-topbar {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  body.reference-shell-active.cooksy-page-active .reference-page-host > .reference-legacy-page > #mainGrid {
    padding: 16px 12px 28px;
  }

  .reference-page-host > .reference-inline-page .modalHeader {
    position: static;
    align-items: flex-start;
    min-height: 58px;
    padding: 12px 14px;
  }

  .reference-page-host > .reference-inline-page .modalActions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .reference-page-host > #archiveModal .archiveBody,
  .reference-page-host > #accountModal .modalBody {
    padding: 18px 12px 30px;
  }
}
