.shell {
  width: min(100% - 28px, var(--hrum-content-max));
  margin: 0 auto;
  padding: 16px 0 54px;
  min-width: 0;
}

:root {
  --hrum-topbar-offset: 72px;
}

body.app-chrome {
  padding-top: var(--hrum-topbar-offset, 72px);
}

.topbar-slot {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  min-height: calc(56px + env(safe-area-inset-top, 0px));
  padding: max(8px, env(safe-area-inset-top, 0px)) 0 0;
  background: var(--hrum-color-surface);
  border-bottom: 1px solid var(--hrum-border-subtle);
}

.topbar {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(160px, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  width: min(100% - 28px, var(--hrum-content-max));
  margin: 0 auto;
  padding: 8px 0 10px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 42px;
  padding: 0 8px 0 2px;
  font-weight: 700;
}

.brand__mark {
  display: block;
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: var(--hrum-radius-lg);
  box-shadow: var(--hrum-elevation-1);
}

.brand__text {
  font-family: var(--hrum-font-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.header-search {
  display: flex;
  align-items: center;
  min-width: 0;
  height: 44px;
  padding: 4px;
  overflow: hidden;
  border: 1px solid var(--hrum-border-subtle);
  border-radius: var(--hrum-radius-pill);
  background: var(--hrum-color-background);
  box-shadow: none;
}

.header-search input {
  flex: 1;
  width: auto;
  min-width: 0;
  height: 100%;
  border: 0;
  background: transparent;
  color: var(--hrum-color-on-surface);
  padding: 0 12px 0 14px;
  outline: 0;
}

.header-search:focus-within {
  border-color: var(--hrum-color-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--hrum-color-primary) 30%, transparent);
}

.header-search button {
  display: grid;
  flex: none;
  width: 36px;
  min-width: 36px;
  max-width: 36px;
  height: 36px;
  margin: 0;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: var(--hrum-radius-pill);
  background: var(--hrum-color-primary);
  color: var(--hrum-color-on-primary);
  font-size: 1rem;
  line-height: 1;
  opacity: 1;
  transition: background var(--hrum-motion-fast);
}

.header-search button:hover {
  filter: brightness(1.12);
  opacity: 1;
}

.topbar__actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-self: end;
}

.topbar__login {
  display: inline-flex;
}

.topnav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  min-width: 0;
  overflow: visible;
  flex-wrap: wrap;
}
.topnav > a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 11px;
  border-radius: var(--hrum-radius-pill);
  color: color-mix(in srgb, var(--hrum-color-on-background) 74%, transparent);
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}
.topnav > a.is-active {
  color: var(--hrum-color-primary);
  background: color-mix(in srgb, var(--hrum-color-primary-container) 55%, transparent);
}
.topnav > a.button {
  color: var(--hrum-color-on-primary);
}
.topnav > a.button:hover {
  background: var(--hrum-color-primary);
  color: var(--hrum-color-on-primary);
}
.topnav > a:hover {
  background: rgba(47, 107, 79, 0.08);
  color: var(--hrum-color-primary);
  text-decoration: none;
}

.topnav .icon-button {
  flex: 0 0 auto;
  align-self: center;
}

.inline-form { display: inline; }

.recipe-grid {
  display: grid;
  grid-template-columns: 1fr;
  align-items: stretch;
  gap: 14px;
}

.recipe-grid.is-list { grid-template-columns: 1fr; }
.recipe-grid.is-list .recipe-card {
  grid-template-columns: 1fr;
  grid-template-rows: auto auto 1fr auto;
}
.recipe-grid.is-list .recipe-card__media {
  height: 180px;
  max-height: 180px;
  aspect-ratio: auto;
}

.auth-body { display: grid; min-height: 100vh; place-items: center; padding: 20px; }
.auth-shell { width: min(100%, 440px); }
.admin-shell { display: grid; gap: 18px; }

.mobile-dock {
  display: none;
}

/* M3 extended FAB — desktop only (mobile uses bottom dock). */
.hrum-fab {
  position: fixed;
  right: max(24px, env(safe-area-inset-right, 0px));
  bottom: max(24px, env(safe-area-inset-bottom, 0px));
  z-index: 120;
  display: none;
  align-items: center;
  gap: 8px;
  min-height: 56px;
  padding: 0 20px 0 16px;
  border-radius: 16px;
  background: var(--hrum-color-primary-container);
  color: var(--hrum-color-on-primary-container);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.92rem;
  line-height: 1;
  box-shadow:
    0 4px 12px color-mix(in srgb, var(--hrum-color-primary) 28%, transparent),
    0 10px 28px color-mix(in srgb, #000 18%, transparent);
  transition: transform .15s ease, background .15s ease, box-shadow .15s ease;
}

.hrum-fab .material-symbols-outlined {
  font-size: 24px;
  width: 24px;
  height: 24px;
  line-height: 1;
}

.hrum-fab__label {
  white-space: nowrap;
}

.hrum-fab:hover,
.hrum-fab:focus-visible {
  color: var(--hrum-color-on-primary-container);
  background: color-mix(in srgb, var(--hrum-color-primary-container) 88%, var(--hrum-color-primary));
  transform: translateY(-1px);
  outline: none;
}

.hrum-fab.is-active {
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--hrum-color-primary) 28%, transparent),
    0 10px 28px color-mix(in srgb, #000 18%, transparent);
}

@media (min-width: 721px) {
  :root {
    --hrum-topbar-offset: 72px;
  }

  body.app-chrome {
    padding-top: var(--hrum-topbar-offset, 84px);
  }

  .topbar-slot {
    min-height: calc(68px + env(safe-area-inset-top, 0px));
  }

  body.has-mobile-dock .hrum-fab {
    display: inline-flex;
  }
}

@media (max-width: 720px) {
  :root {
    /* Two-row mobile header: prevents content from flashing underneath it
       before header-offset.js measures the exact rendered height. */
    --hrum-topbar-offset: 125px;
  }

  body.app-chrome.has-mobile-dock {
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }

  .topnav--desktop {
    display: none;
  }

  .topbar .topbar__login {
    display: none;
  }

  .hrum-fab {
    display: none !important;
  }

  body.has-mobile-dock .mobile-dock {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: max(8px, env(safe-area-inset-bottom, 0px));
    z-index: 110;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 2px;
    padding: 6px 6px;
    overflow: visible;
    border: 1px solid var(--hrum-border-subtle);
    border-radius: var(--hrum-radius-expressive);
    background: var(--hrum-color-surface);
    box-shadow: var(--hrum-elevation-2);
  }

  .mobile-dock__item {
    display: grid;
    justify-items: center;
    gap: 2px;
    padding: 6px 4px;
    border-radius: var(--hrum-radius-xl);
    color: color-mix(in srgb, var(--hrum-color-on-surface) 58%, transparent);
    font-size: 0.62rem;
    font-weight: 780;
    text-decoration: none;
    line-height: 1.1;
  }

  .mobile-dock__item--add .mobile-dock__add {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    margin-top: -2px;
    border-radius: 12px;
    background: var(--hrum-color-primary-container);
    color: var(--hrum-color-on-primary-container);
  }

  .mobile-dock__item--add .mobile-dock__add .material-symbols-outlined {
    font-size: 22px;
  }

  .mobile-dock__item .material-symbols-outlined {
    font-size: 22px;
    width: 22px;
    height: 22px;
  }

  .mobile-dock__icon-wrap {
    position: relative;
    display: grid;
    place-items: center;
  }

  .mobile-dock__badge {
    position: absolute;
    top: -4px;
    right: -8px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--hrum-color-error, #9B3C4D);
    color: #fff;
    font-size: 0.58rem;
    font-weight: 800;
    line-height: 16px;
    text-align: center;
  }

  .mobile-dock__item.is-active {
    color: var(--hrum-color-primary);
    background: color-mix(in srgb, var(--hrum-color-primary-container) 55%, transparent);
  }

  .topbar {
    grid-template-columns: 1fr auto;
    width: min(100% - 28px, var(--hrum-content-max));
    gap: 8px;
  }

  .brand {
    grid-column: 1;
  }

  .topbar__actions {
    grid-column: 2;
    grid-row: 1;
  }

  .header-search {
    grid-column: 1 / -1;
    height: 50px;
    padding: 3px;
  }

  .header-search button {
    width: 44px;
    min-width: 44px;
    max-width: 44px;
    height: 44px;
  }

  body.app-chrome {
    padding-top: var(--hrum-topbar-offset, 72px);
  }
}

@media (min-width: 720px) {
  .shell { padding-top: 28px; }
  .recipe-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
}

@media (min-width: 1080px) {
  .recipe-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 520px) {
  .shell {
    width: min(100% - 22px, var(--hrum-content-max));
    margin-top: 0;
    padding-top: 10px;
  }
  .topbar-slot {
    padding: max(6px, env(safe-area-inset-top, 0px)) 0 0;
  }

  .topbar {
    width: min(100% - 22px, var(--hrum-content-max));
  }

  .brand {
    padding-left: 0;
  }

  .brand__text {
    font-size: 0.96rem;
  }

  body.has-mobile-dock .mobile-dock {
    left: 6px;
    right: 6px;
    bottom: max(6px, env(safe-area-inset-bottom, 0px));
    border-radius: 24px;
  }

  .mobile-dock__item {
    min-width: 0;
    min-height: 52px;
    padding-inline: 2px;
    font-size: clamp(0.52rem, 2.6vw, 0.62rem);
  }
}
