/* Chef DS Family Tools unified navigation and ingredient-search styling — v20 */
:root {
  --family-nav-height: 80px;
  --family-gold: #d4af37;
  --family-charcoal: #1e232a;
  --family-paper: #fdfbf7;
  --family-stone: #f5f5f4;
  --family-border: #e7e5e4;
  --family-muted: #6b7280;
}

.family-tools-subnav {
  position: sticky;
  top: var(--family-nav-height);
  z-index: 880;
  width: 100%;
  margin-top: var(--family-nav-height);
  border-bottom: 1px solid rgba(30, 35, 42, .12);
  background: rgba(253, 251, 247, .97);
  box-shadow: 0 4px 14px rgba(30, 35, 42, .05);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color-scheme: light;
}
.family-tools-subnav__scroller {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  width: min(1280px, 100%);
  min-height: 56px;
  margin: 0 auto;
  padding: .45rem 1rem;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
.family-tools-subnav__link,
.family-tools-subnav__logout {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: .68rem .9rem;
  border: 1px solid transparent;
  border-radius: 2px;
  background: transparent;
  color: var(--family-charcoal);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: .72rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: .12em;
  text-decoration: none;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .18s ease, border-color .18s ease, color .18s ease;
}
.family-tools-subnav__link:hover,
.family-tools-subnav__link:focus-visible {
  border-color: rgba(212, 175, 55, .55);
  background: rgba(212, 175, 55, .10);
  color: #876b12;
}
.family-tools-subnav__link.is-active,
.family-tools-subnav__link[aria-current="page"] {
  border-color: var(--family-charcoal);
  background: var(--family-charcoal);
  color: #fff;
}
.family-tools-subnav__logout {
  margin-left: .35rem;
  border-color: rgba(153, 27, 27, .32);
  color: #991b1b;
}
.family-tools-subnav__logout:hover,
.family-tools-subnav__logout:focus-visible {
  border-color: #991b1b;
  background: #991b1b;
  color: #fff;
}

/* The primary site header already owns the first 80 px. The subnav owns the next row. */
body[data-family-tool-page="portal"] .family-tools-subnav + section {
  padding-top: 3rem !important;
}
body[data-family-tool-page="builder"] .family-tools-subnav + .public-page-banner {
  padding-top: 3.5rem !important;
  padding-bottom: 3.5rem !important;
}

/* Restyle the legacy ingredient-search utility to the Family Portal visual system. */
body[data-family-tool-page="ingredient-search"] {
  --bg: var(--family-paper) !important;
  --panel: #fff !important;
  --panel-soft: var(--family-stone) !important;
  --text: var(--family-charcoal) !important;
  --muted: var(--family-muted) !important;
  --border: var(--family-border) !important;
  --accent: var(--family-gold) !important;
  --accent-strong: #876b12 !important;
  --accent-soft: #fff9e6 !important;
  --warning: #92400e !important;
  --warning-bg: #fffbeb !important;
  --danger: #991b1b !important;
  --danger-bg: #fef2f2 !important;
  --shadow: 0 1px 3px rgba(30, 35, 42, .08) !important;
  --radius: 2px !important;
  max-width: 100%;
  overflow-x: hidden;
  background: var(--family-paper) !important;
  color: var(--family-charcoal) !important;
  color-scheme: light !important;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif !important;
}
body[data-family-tool-page="ingredient-search"] .family-search-banner {
  position: relative;
  padding: 3.75rem 1rem 3.5rem;
  overflow: hidden;
  border-bottom: 1px solid rgba(212, 175, 55, .45);
  background: var(--family-charcoal);
  color: #fff;
  text-align: center;
}
body[data-family-tool-page="ingredient-search"] .family-search-banner::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 0%, rgba(212, 175, 55, .12), transparent 55%);
  pointer-events: none;
}
body[data-family-tool-page="ingredient-search"] .family-search-banner__inner {
  position: relative;
  z-index: 1;
  width: min(820px, 100%);
  margin: 0 auto;
}
body[data-family-tool-page="ingredient-search"] .family-search-banner__eyebrow {
  display: block;
  margin-bottom: .8rem;
  color: var(--family-gold);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .22em;
  text-transform: uppercase;
}
body[data-family-tool-page="ingredient-search"] .family-search-banner h1 {
  margin: 0;
  color: #fff;
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(2.15rem, 6vw, 4rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -.025em;
}
body[data-family-tool-page="ingredient-search"] .family-search-banner__rule {
  width: 6rem;
  height: 3px;
  margin: 1.25rem auto;
  background: var(--family-gold);
}
body[data-family-tool-page="ingredient-search"] .family-search-banner p {
  max-width: 700px;
  margin: 0 auto;
  color: #d1d5db;
  font-size: 1rem;
  line-height: 1.65;
}
body[data-family-tool-page="ingredient-search"] .family-search-banner .source-chip {
  display: inline-flex;
  margin-top: 1.25rem;
  border-color: rgba(255,255,255,.18) !important;
  border-radius: 999px !important;
  background: rgba(255,255,255,.08) !important;
  color: #e5e7eb !important;
  box-shadow: none !important;
}
body[data-family-tool-page="ingredient-search"] .family-search-banner .source-dot {
  background: var(--family-gold) !important;
  box-shadow: 0 0 0 4px rgba(212,175,55,.16) !important;
}
body[data-family-tool-page="ingredient-search"] main.shell {
  width: min(1280px, calc(100% - 32px)) !important;
  margin: 0 auto 4rem !important;
  padding-top: 2rem !important;
}
body[data-family-tool-page="ingredient-search"] .grid {
  grid-template-columns: minmax(0, 1fr) 340px !important;
  gap: 1.5rem !important;
}
body[data-family-tool-page="ingredient-search"] .panel {
  border: 1px solid var(--family-border) !important;
  border-radius: 2px !important;
  background: #fff !important;
  box-shadow: 0 1px 3px rgba(30,35,42,.07) !important;
}
body[data-family-tool-page="ingredient-search"] .search-panel {
  padding: 1.5rem !important;
}
body[data-family-tool-page="ingredient-search"] label,
body[data-family-tool-page="ingredient-search"] .selected-filter-head strong {
  color: var(--family-charcoal) !important;
  font-size: .72rem !important;
  font-weight: 700 !important;
  letter-spacing: .1em !important;
  text-transform: uppercase !important;
}
body[data-family-tool-page="ingredient-search"] input,
body[data-family-tool-page="ingredient-search"] select {
  min-height: 46px !important;
  border: 1px solid #d6d3d1 !important;
  border-radius: 2px !important;
  background: #fff !important;
  color: var(--family-charcoal) !important;
  font-size: 16px !important;
  box-shadow: none !important;
}
body[data-family-tool-page="ingredient-search"] input:focus,
body[data-family-tool-page="ingredient-search"] select:focus {
  border-color: var(--family-gold) !important;
  outline: 2px solid rgba(212,175,55,.22) !important;
  outline-offset: 1px !important;
}
body[data-family-tool-page="ingredient-search"] .helper,
body[data-family-tool-page="ingredient-search"] .privacy,
body[data-family-tool-page="ingredient-search"] .side-panel p,
body[data-family-tool-page="ingredient-search"] .secondary {
  color: var(--family-muted) !important;
}
body[data-family-tool-page="ingredient-search"] .selected-filter-area {
  border-radius: 2px !important;
  background: var(--family-stone) !important;
}
body[data-family-tool-page="ingredient-search"] .ingredient-chip {
  border-color: rgba(212,175,55,.55) !important;
  border-radius: 999px !important;
  background: #fff9e6 !important;
  color: #755c0c !important;
}
body[data-family-tool-page="ingredient-search"] .ingredient-chip button {
  color: #755c0c !important;
}
body[data-family-tool-page="ingredient-search"] .metrics {
  gap: .75rem !important;
}
body[data-family-tool-page="ingredient-search"] .metric {
  border-radius: 2px !important;
  background: var(--family-stone) !important;
}
body[data-family-tool-page="ingredient-search"] .metric strong {
  color: var(--family-charcoal) !important;
  font-family: "Playfair Display", Georgia, serif !important;
  font-size: 1.65rem !important;
}
body[data-family-tool-page="ingredient-search"] .metric span {
  color: var(--family-muted) !important;
  font-weight: 600 !important;
  letter-spacing: .04em !important;
  text-transform: uppercase !important;
}
body[data-family-tool-page="ingredient-search"] .results-panel {
  border-radius: 2px !important;
}
body[data-family-tool-page="ingredient-search"] .results-toolbar {
  padding: 1rem 1.25rem !important;
  background: var(--family-stone) !important;
}
body[data-family-tool-page="ingredient-search"] .results-title,
body[data-family-tool-page="ingredient-search"] .side-panel h2 {
  color: var(--family-charcoal) !important;
  font-family: "Playfair Display", Georgia, serif !important;
  font-weight: 700 !important;
}
body[data-family-tool-page="ingredient-search"] .results-title {
  font-size: 1.25rem !important;
}
body[data-family-tool-page="ingredient-search"] .side-panel {
  padding: 1.25rem !important;
}
body[data-family-tool-page="ingredient-search"] .side-panel h2 {
  font-size: 1.35rem !important;
}
body[data-family-tool-page="ingredient-search"] .btn {
  min-height: 42px !important;
  border: 1px solid #d6d3d1 !important;
  border-radius: 2px !important;
  background: #fff !important;
  color: var(--family-charcoal) !important;
  font-size: .72rem !important;
  font-weight: 700 !important;
  letter-spacing: .08em !important;
  text-transform: uppercase !important;
  box-shadow: none !important;
}
body[data-family-tool-page="ingredient-search"] .btn:hover,
body[data-family-tool-page="ingredient-search"] .btn:focus-visible {
  border-color: var(--family-gold) !important;
  color: #876b12 !important;
}
body[data-family-tool-page="ingredient-search"] .btn.primary {
  border-color: var(--family-charcoal) !important;
  background: var(--family-charcoal) !important;
  color: #fff !important;
}
body[data-family-tool-page="ingredient-search"] .btn.primary:hover,
body[data-family-tool-page="ingredient-search"] .btn.primary:focus-visible {
  border-color: var(--family-gold) !important;
  background: var(--family-gold) !important;
  color: var(--family-charcoal) !important;
}
body[data-family-tool-page="ingredient-search"] .btn.danger {
  border-color: #fecaca !important;
  background: #fef2f2 !important;
  color: #991b1b !important;
}
body[data-family-tool-page="ingredient-search"] .table-wrap {
  background: #fff !important;
  -webkit-overflow-scrolling: touch;
}
body[data-family-tool-page="ingredient-search"] th {
  top: 0 !important;
  border-color: #343a42 !important;
  background: var(--family-charcoal) !important;
  color: #fff !important;
  font-size: .7rem !important;
  letter-spacing: .09em !important;
}
body[data-family-tool-page="ingredient-search"] td {
  color: var(--family-charcoal) !important;
}
body[data-family-tool-page="ingredient-search"] tbody tr:hover {
  background: #fff9e6 !important;
}
body[data-family-tool-page="ingredient-search"] .file-label {
  border-color: rgba(212,175,55,.65) !important;
  border-radius: 2px !important;
  background: #fffdf6 !important;
  color: #755c0c !important;
}
body[data-family-tool-page="ingredient-search"] .status {
  border-radius: 2px !important;
  background: var(--family-stone) !important;
}
body[data-family-tool-page="ingredient-search"] .status.good {
  border-color: #bbf7d0 !important;
  background: #f0fdf4 !important;
  color: #166534 !important;
}
body[data-family-tool-page="ingredient-search"] .status.bad {
  border-color: #fecaca !important;
  background: #fef2f2 !important;
  color: #991b1b !important;
}
body[data-family-tool-page="ingredient-search"] .status.warn {
  border-color: #fde68a !important;
  background: #fffbeb !important;
  color: #92400e !important;
}
body[data-family-tool-page="ingredient-search"] .pager {
  border-top: 1px solid var(--family-border) !important;
  background: #fff !important;
}

@media (max-width: 900px) {
  .family-tools-subnav__scroller {
    justify-content: flex-start;
  }
  body[data-family-tool-page="ingredient-search"] .grid {
    grid-template-columns: 1fr !important;
  }
}
@media (max-width: 760px) {
  .family-tools-subnav__scroller {
    min-height: 54px;
    padding: .38rem .65rem;
  }
  .family-tools-subnav__link,
  .family-tools-subnav__logout {
    min-height: 44px;
    padding-inline: .78rem;
    font-size: .68rem;
  }
  .family-tools-subnav__logout { margin-left: 0; }
  body[data-family-tool-page="portal"] .family-tools-subnav + section {
    padding-top: 2.25rem !important;
  }
  body[data-family-tool-page="builder"] .family-tools-subnav + .public-page-banner {
    padding-top: 2.75rem !important;
    padding-bottom: 2.75rem !important;
  }
  body[data-family-tool-page="ingredient-search"] .family-search-banner {
    padding: 2.75rem 1rem 2.5rem;
  }
  body[data-family-tool-page="ingredient-search"] .family-search-banner h1 {
    font-size: clamp(2rem, 11vw, 3rem);
  }
  body[data-family-tool-page="ingredient-search"] .family-search-banner p {
    font-size: .94rem;
  }
  body[data-family-tool-page="ingredient-search"] main.shell {
    width: min(100% - 20px, 1280px) !important;
    padding-top: 1rem !important;
  }
  body[data-family-tool-page="ingredient-search"] .search-panel,
  body[data-family-tool-page="ingredient-search"] .side-panel {
    padding: 1rem !important;
  }
  body[data-family-tool-page="ingredient-search"] .search-row,
  body[data-family-tool-page="ingredient-search"] .ingredient-add-row {
    grid-template-columns: 1fr !important;
  }
  body[data-family-tool-page="ingredient-search"] .ingredient-add-row .btn,
  body[data-family-tool-page="ingredient-search"] .button-row,
  body[data-family-tool-page="ingredient-search"] .button-row .btn,
  body[data-family-tool-page="ingredient-search"] .small-actions,
  body[data-family-tool-page="ingredient-search"] .small-actions .btn {
    width: 100% !important;
  }
  body[data-family-tool-page="ingredient-search"] .button-row,
  body[data-family-tool-page="ingredient-search"] .small-actions {
    display: grid !important;
    grid-template-columns: 1fr !important;
  }
  body[data-family-tool-page="ingredient-search"] .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  body[data-family-tool-page="ingredient-search"] table {
    min-width: 700px !important;
  }
  body[data-family-tool-page="ingredient-search"] .pager {
    flex-wrap: wrap !important;
  }
}
@media (max-width: 430px) {
  body[data-family-tool-page="ingredient-search"] .metrics {
    grid-template-columns: 1fr 1fr !important;
  }
  body[data-family-tool-page="ingredient-search"] .selected-filter-head {
    align-items: stretch !important;
    flex-direction: column !important;
  }
  body[data-family-tool-page="ingredient-search"] .selected-filter-head .btn {
    width: 100% !important;
  }
}
@media print {
  .family-tools-subnav { display: none !important; }
  body[data-family-tool-page="ingredient-search"] .family-search-banner { display: none !important; }
}
