:root {
  --background: #f9f5f2;
  --surface: #fffdfa;
  --panel: #fffefb;
  --primary-ink: #2e2923;
  --muted-ink: #695550;
  --strong-action: #311a16;
  --accent: #806d68;
  --soft-accent: #d2c9c5;
  --line: #ece5e2;
  --strong-line: #422e29;
  --callout: #ecf4ea;
  --warning: #ffd3c5;
  --avatar-green: #5f7657;
  --ink: var(--primary-ink);
  --muted: var(--muted-ink);
  --paper: var(--background);
  --card: var(--surface);
  --cream-dark: var(--soft-accent);
  --cream-dark-hover: color-mix(in srgb, var(--soft-accent) 82%, var(--strong-line));
  --green: var(--strong-action);
  --green-dark: var(--strong-line);
  --sage: var(--soft-accent);
  --sage-light: var(--callout);
  --gold: var(--accent);
  --category-chip-bg: color-mix(in srgb, var(--panel) 86%, transparent);
  --category-chip-ink: var(--strong-line);
  --tag-chip-bg: color-mix(in srgb, var(--soft-accent) 52%, var(--panel));
  --tag-chip-ink: var(--muted-ink);
  --contributor-chip-bg: var(--callout);
  --contributor-chip-ink: var(--strong-action);
  --shadow: 0 18px 50px rgba(49, 26, 22, .12);
  --radius-small: 8px;
  --radius-control: 12px;
  --radius-card: 16px;
  --radius-large: 24px;
  --radius-pill: 999px;
  --radius-circle: 50%;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "DM Sans", sans-serif;
}

body.auth-loading .auth-gate,
body.is-authenticated .auth-gate { display: none; }
body.is-signed-out .app-shell { display: none; }
body.auth-loading .app-shell { pointer-events: none; }
body.auth-loading #openAddRecipe,
body.auth-loading .sign-out-button { visibility: hidden; }

.auth-gate {
  min-height: 100vh;
  padding: 28px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 85% 12%, rgba(128, 109, 104, .14), transparent 26rem),
    radial-gradient(circle at 8% 90%, rgba(236, 244, 234, .88), transparent 28rem),
    var(--paper);
}

.auth-card {
  width: min(470px, 100%);
  padding: clamp(28px, 5vw, 48px);
  border: 1px solid var(--line);
  border-radius: var(--radius-large);
  background: var(--card);
  box-shadow: var(--shadow);
  text-align: center;
}

.auth-card h1 { margin-bottom: 14px; font-size: clamp(34px, 7vw, 48px); line-height: 1.04; }
#authTitle span { display: block; }
.auth-logo { width: min(250px, 100%); height: auto; display: block; margin: 14px auto 0; }
.auth-copy { margin: 0 auto 28px; max-width: 350px; color: var(--muted); line-height: 1.55; }
.google-signin { width: 100%; min-height: 52px; padding: 0 14px; display: flex; align-items: center; justify-content: center; gap: 10px; border: 1px solid var(--line); border-radius: var(--radius-control); color: var(--ink); background: var(--panel); cursor: pointer; font-weight: 700; white-space: nowrap; transition: background-color .16s ease, border-color .16s ease, transform .12s ease; }
.google-signin:hover:not(:disabled) { background: var(--surface); border-color: var(--strong-line); }
.google-signin:focus-visible { outline: 3px solid color-mix(in srgb, var(--strong-action) 24%, transparent); outline-offset: 2px; }
.google-signin:active:not(:disabled) { background: var(--soft-accent); transform: translateY(1px); }
.google-signin:disabled { cursor: wait; opacity: .65; }
.google-mark { width: 18px; height: 18px; display: block; flex: 0 0 18px; }
.auth-error { margin: 16px 0 0; padding: 11px 12px; border-radius: var(--radius-small); color: var(--strong-line); background: var(--warning); font-size: 13px; }
.auth-privacy { max-width: 350px; margin: 18px auto 0; color: var(--muted); font-size: 12px; line-height: 1.45; }

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

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

.topbar {
  height: 60px;
  padding: 0 max(20px, calc((100vw - 1180px) / 2));
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 12px;
  background: color-mix(in srgb, var(--background) 86%, transparent);
  backdrop-filter: blur(12px);
}

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.topbar-logo { width: auto; height: 44px; display: block; flex: 0 0 auto; }
.review-banner { margin: 0; padding: 7px 11px; border: 1px solid var(--line); border-radius: var(--radius-pill); color: var(--muted-ink); background: var(--callout); font-size: 12px; font-weight: 700; letter-spacing: .02em; }
.notification-button { position: relative; width: 44px; height: 44px; display: grid; place-items: center; padding: 0; border: 0; border-radius: var(--radius-circle); color: var(--muted); background: color-mix(in srgb, var(--soft-accent) 20%, transparent); cursor: pointer; }
.notification-button:hover { color: var(--ink); background: color-mix(in srgb, var(--soft-accent) 38%, var(--surface)); }
.notification-button:focus-visible { outline: 3px solid color-mix(in srgb, var(--strong-action) 24%, transparent); outline-offset: 2px; }
.notification-button svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.notification-button.has-unread { color: var(--avatar-green); }
.notification-button.has-unread svg { fill: currentColor; }
.notification-badge { position: absolute; top: -4px; right: -5px; min-width: 19px; height: 19px; padding: 0 5px; display: grid; place-items: center; border: 2px solid var(--paper); border-radius: var(--radius-pill); color: var(--surface); background: var(--strong-action); font-size: 10px; font-weight: 700; line-height: 1; }

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-control);
  color: var(--surface);
  background: var(--green);
  font-family: "DM Sans", sans-serif;
  font-size: 21px;
}

.button.sign-out-button {
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  margin-left: 0;
  padding: 0;
  border: 0;
  border-radius: var(--radius-circle);
  color: var(--muted);
  background: color-mix(in srgb, var(--soft-accent) 20%, transparent);
}
.button.sign-out-button:hover { color: var(--ink); background: color-mix(in srgb, var(--soft-accent) 38%, var(--surface)); }
.button.sign-out-button:focus-visible { outline: 3px solid color-mix(in srgb, var(--strong-action) 24%, transparent); outline-offset: 2px; }
.sign-out-button svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.notification-dismiss-layer { position: fixed; inset: 0; z-index: 39; background: transparent; }
.notification-dismiss-layer[hidden] { display: none; }
.notification-dialog { position: fixed; inset: auto; z-index: 40; width: min(400px, calc(100vw - 20px)); max-height: calc(100dvh - 76px); margin: 0; overflow: hidden; border: 0; outline: none; border-radius: var(--radius-card); background: var(--surface); box-shadow: 0 18px 48px rgba(49,26,22,.22); transform-origin: right top; }
.notification-dialog[open] { animation: notification-pop .16s ease-out; }
.notification-dialog::before { display: none; }
.notification-dialog-header { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 18px 12px; border: 0; border-radius: var(--radius-card) var(--radius-card) 0 0; background: var(--surface); }
.notification-dialog-header h2 { font-size: 24px; line-height: 29px; }
.notification-clear-all { position: relative; height: 29px; min-height: 29px; padding: 0 12px; border: 0; border-radius: var(--radius-pill); color: var(--muted); background: color-mix(in srgb, var(--soft-accent) 30%, var(--panel)); cursor: pointer; font: inherit; font-size: 12px; font-weight: 650; line-height: 1; }
.notification-clear-all::before { content: ""; position: absolute; inset: -8px -4px; }
.notification-clear-all:hover:not(:disabled) { color: var(--ink); background: color-mix(in srgb, var(--soft-accent) 48%, var(--panel)); }
.notification-clear-all:focus-visible { outline: 3px solid color-mix(in srgb, var(--strong-action) 24%, transparent); outline-offset: 2px; }
.notification-clear-all:disabled { cursor: default; opacity: .42; }
.notification-list { position: relative; z-index: 2; max-height: min(520px, calc(100dvh - 154px)); padding: 0 10px 10px; display: grid; gap: 8px; overflow-y: auto; border-radius: 0 0 var(--radius-card) var(--radius-card); background: var(--surface); overscroll-behavior: contain; }
.notification-item { position: relative; width: 100%; overflow: hidden; border: 0; border-radius: var(--radius-control); background: color-mix(in srgb, var(--soft-accent) 18%, var(--panel)); }
.notification-item.is-unread { background: color-mix(in srgb, var(--soft-accent) 30%, var(--panel)); }
.notification-open { position: relative; width: 100%; min-height: 64px; padding: 12px 44px 12px 12px; display: grid; grid-template-columns: 32px minmax(0, 1fr); align-items: center; gap: 10px; border: 0; color: var(--ink); background: transparent; cursor: pointer; text-align: left; }
.notification-open:hover { background: color-mix(in srgb, var(--soft-accent) 20%, transparent); }
.notification-open:focus-visible { position: relative; z-index: 1; outline: none; background: color-mix(in srgb, var(--soft-accent) 46%, transparent); }
.notification-avatar-wrap { position: relative; width: 32px; height: 32px; }
.contributor-avatar.notification-avatar { width: 32px; height: 32px; font-size: 12px; }
.notification-dismiss { position: absolute; top: 10px; right: 10px; z-index: 2; width: 28px; height: 28px; display: grid; place-items: center; padding: 0; border: 0; border-radius: var(--radius-circle); color: var(--muted); background: transparent; cursor: pointer; opacity: .72; font-size: 17px; line-height: 1; }
.notification-dismiss:hover { color: var(--ink); background: color-mix(in srgb, var(--soft-accent) 30%, var(--surface)); opacity: 1; }
.notification-dismiss:focus-visible { outline: 3px solid color-mix(in srgb, var(--strong-action) 24%, transparent); outline-offset: 2px; }
.notification-copy { min-width: 0; flex: 1; display: grid; gap: 3px; }
.notification-copy strong { overflow: hidden; font-size: 13px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.notification-copy > span { overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.notification-unread-dot { position: absolute; right: -2px; bottom: -2px; width: 9px; height: 9px; border: 2px solid var(--panel); border-radius: var(--radius-circle); background: var(--avatar-green); }
.notification-state { min-height: 150px; padding: 28px 20px; display: grid; place-items: center; align-content: center; gap: 5px; border-radius: var(--radius-control); color: var(--muted); background: color-mix(in srgb, var(--soft-accent) 16%, var(--panel)); text-align: center; }
.notification-state strong { color: var(--ink); font-size: 14px; }
.notification-state > span:last-child:not(.notification-state-icon) { max-width: 250px; font-size: 12px; line-height: 1.45; }
.notification-state-icon { width: 28px; height: 28px; display: grid; place-items: center; margin-bottom: 3px; border-radius: var(--radius-circle); color: var(--surface); background: var(--avatar-green); font-size: 14px; font-weight: 700; }
.notification-state.is-loading .notification-state-icon { border: 3px solid color-mix(in srgb, var(--soft-accent) 70%, var(--panel)); border-top-color: var(--avatar-green); background: transparent; animation: spin .7s linear infinite; }
.notification-error { color: var(--strong-line); background: color-mix(in srgb, var(--warning) 48%, var(--panel)); }
.notification-error .notification-state-icon { background: var(--strong-line); }
@keyframes notification-pop { from { opacity: 0; transform: translateY(-5px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
.confirmation-dialog { width: min(410px, calc(100% - 28px)); padding: 26px; }
.confirmation-dialog h2 { font-size: 26px; }
.confirmation-dialog > p:not(.dialog-feedback) { margin: 10px 0 0; color: var(--muted); line-height: 1.5; }
.confirmation-dialog .dialog-feedback { margin: 18px 0 0; }
.confirmation-dialog .button:focus-visible { outline: 3px solid color-mix(in srgb, var(--strong-action) 24%, transparent); outline-offset: 2px; }

.add-recipe-fab {
  position: fixed;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 20;
  width: 56px;
  min-width: 56px;
  height: 56px;
  padding: 0;
  border-radius: var(--radius-circle);
  box-shadow: 0 10px 24px rgba(49, 26, 22, .24);
}

.fab-icon { font-size: 28px; font-weight: 400; line-height: 1; }
.fab-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

@media (min-width: 851px) {
  .add-recipe-fab { right: 24px; bottom: 24px; width: 64px; min-width: 64px; height: 64px; }
  .fab-icon { font-size: 30px; }
}

main { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }

.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

h1, h2, h3 { margin-top: 0; }
h1, h2 { font-family: "DM Sans", sans-serif; font-weight: 700; }
h1 { margin-bottom: 10px; font-size: clamp(42px, 5.3vw, 60px); line-height: .98; letter-spacing: -.025em; }
h2 { margin-bottom: 0; font-size: 34px; }
h3 { margin-bottom: 8px; }

.surprise-button {
  border: 0;
  color: var(--surface);
  background: var(--avatar-green);
  box-shadow: none;
}

.surprise-button span { color: currentColor; }

.discovery { margin-bottom: 24px; padding-top: 12px; }

.search-row {
  display: flex;
  align-items: stretch;
  gap: 12px;
}

.search-box {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  height: 54px;
  padding: 0 19px;
  border: 0;
  border-radius: var(--radius-control);
  background: var(--card);
  box-shadow: 0 1px 2px rgba(49, 26, 22, .07);
}

.search-box:focus-within { box-shadow: 0 0 0 3px color-mix(in srgb, var(--strong-action) 11%, transparent); }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 16px; }
.search-icon { width: 17px; height: 17px; border: 2px solid var(--green); border-radius: var(--radius-circle); margin-right: 13px; position: relative; }
.search-icon::after { content: ""; width: 7px; height: 2px; background: var(--green); position: absolute; right: -5px; bottom: -2px; transform: rotate(45deg); }

.filter-scroller {
  position: relative;
  margin-top: 15px;
}

.filter-row {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  overflow-x: visible;
  padding: 2px 0 5px;
}

.filter-chip {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 8px 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--surface);
  cursor: pointer;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.filter-chip:hover { color: var(--ink); background: color-mix(in srgb, var(--soft-accent) 38%, var(--surface)); }
.filter-chip .favorite-star-icon { width: 16px; height: 16px; }
.filter-chip .favorite-star-icon path { fill: transparent; stroke: currentColor; stroke-width: 1.35; stroke-linecap: round; stroke-linejoin: round; }
.filter-chip-favorites { color: var(--strong-action); background: color-mix(in srgb, var(--accent) 18%, var(--surface)); }
.filter-chip-favorites .favorite-star-icon path { fill: var(--accent); stroke: var(--accent); }
.filter-chip.is-active { color: var(--surface); background: var(--green); }
.filter-chip.is-active:hover { color: var(--surface); background: var(--green-dark); }
.filter-chip-favorites.is-active .favorite-star-icon path { fill: currentColor; stroke: currentColor; }

.section-heading { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 16px; }
.section-heading h2 { font-size: 30px; line-height: 1.1; letter-spacing: -.02em; }
.recipe-count { margin: 0; color: var(--muted); font-size: 13px; font-weight: 600; }
.recipe-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; padding-bottom: 72px; }

.recipe-card {
  min-height: 242px;
  border: 0;
  border-radius: var(--radius-card);
  background: var(--card);
  box-shadow: 0 1px 2px rgba(49, 26, 22, .07);
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow .18s ease;
  display: flex;
  flex-direction: column;
  -webkit-tap-highlight-color: transparent;
}

.recipe-card:focus { outline: none; }
.recipe-card:focus-visible { outline: 2px solid color-mix(in srgb, var(--strong-action) 62%, transparent); outline-offset: 3px; }
.recipe-card:hover { box-shadow: 0 10px 30px rgba(49, 26, 22, .11); }
.card-art { min-height: 172px; padding: 18px; display: flex; justify-content: space-between; align-items: start; background: linear-gradient(135deg, var(--card-color), color-mix(in srgb, var(--card-color) 60%, var(--surface))); position: relative; overflow: hidden; }
.card-art-image { position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%; display: block; object-fit: cover; }
.card-art.has-image::before { content: ""; position: absolute; inset: 0; z-index: 1; background: linear-gradient(rgba(49,26,22,.04), rgba(49,26,22,.1)); pointer-events: none; }
.card-art::after { content: attr(data-letter); position: absolute; right: 16px; bottom: -24px; color: rgba(255,255,255,.28); font: 700 82px/1 "DM Sans", sans-serif; }
.card-art.has-image::after { display: none; }
.category-pill { position: relative; z-index: 2; padding: 6px 10px; border: 1px solid rgba(104,73,31,.12); border-radius: var(--radius-pill); color: var(--category-chip-ink); background: var(--category-chip-bg); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.favorite-button { position: relative; z-index: 2; width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid color-mix(in srgb, var(--strong-action) 10%, transparent); border-radius: var(--radius-circle); color: color-mix(in srgb, var(--strong-line) 58%, transparent); background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: blur(8px); cursor: pointer; transition: color .16s ease, background .16s ease, transform .16s ease; }
.favorite-button svg { width: 21px; height: 21px; overflow: visible; }
.favorite-button path { fill: rgba(255, 255, 255, .28); stroke: currentColor; stroke-width: 1.35; stroke-linecap: round; stroke-linejoin: round; }
.favorite-button:hover { color: var(--gold); background: color-mix(in srgb, var(--surface) 95%, transparent); transform: scale(1.04); }
.favorite-button.is-saving { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 28%, transparent); }
.favorite-button.is-favorite { color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--panel)); }
.favorite-button.is-favorite path { fill: currentColor; stroke-width: 1.1; }
.favorite-button.is-partial path { fill: color-mix(in srgb, var(--accent) 55%, transparent); }
.card-body { padding: 19px; display: flex; flex-direction: column; flex: 1; }
.card-title-row { margin-bottom: 8px; }
.card-title-row h3 { margin: 0; font-size: 19px; line-height: 1.3; }
.card-contributors { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 5px; }
.card-contributors span { padding: 4px 8px; border: 1px solid rgba(45,89,72,.1); border-radius: var(--radius-pill); color: var(--contributor-chip-ink); background: var(--contributor-chip-bg); font-size: 11px; font-weight: 700; line-height: 1.2; }
.card-tags, .detail-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 15px; }
.card-tags span, .detail-tags span { padding: 5px 8px; border: 1px solid rgba(63,72,68,.08); border-radius: var(--radius-pill); color: var(--tag-chip-ink); background: var(--tag-chip-bg); font-size: 11px; font-weight: 700; }
.card-meta { margin: auto 0 0; min-height: 25px; display: flex; align-items: center; justify-content: flex-end; color: var(--muted); font-size: 13px; }
.card-meta .contributor-stack { margin-left: auto; justify-content: flex-end; }

.status-card { padding: 60px 24px; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius-card); color: var(--muted); }
.status-card h3 { color: var(--ink); }
.loader { display: inline-block; width: 28px; height: 28px; border-radius: var(--radius-circle); border: 3px solid var(--sage); border-top-color: var(--green); animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.status-error { margin-bottom: 18px; padding: 24px; border-color: color-mix(in srgb, var(--strong-line) 28%, var(--warning)); background: var(--warning); }

.button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 0; border-radius: var(--radius-control); padding: 11px 16px; cursor: pointer; font-weight: 700; }
.button.add-recipe-fab { border-radius: var(--radius-circle); }
.button.surprise-button { min-width: 142px; height: 54px; min-height: 54px; border: 0; border-radius: var(--radius-control); }
.surprise-button:hover { background: color-mix(in srgb, var(--avatar-green) 82%, var(--strong-action)); }

.button-primary { color: var(--surface); background: var(--green); }
.button-primary:hover { background: var(--green-dark); }
.button:disabled { cursor: wait; opacity: .65; }
.button-secondary { color: var(--green); background: var(--sage-light); }
.button-secondary:hover { background: var(--sage); }
.empty-add-button { color: var(--surface); background: var(--avatar-green); }
.empty-add-button:hover { color: var(--surface); background: color-mix(in srgb, var(--avatar-green) 82%, var(--strong-action)); }
.button-quiet { color: var(--muted); background: transparent; }
.button-danger { color: var(--strong-line); background: var(--warning); }
.button-danger:hover { color: var(--strong-action); background: color-mix(in srgb, var(--warning) 82%, var(--strong-line)); }
.icon-button { width: 38px; height: 38px; display: grid; place-items: center; border: 0; border-radius: var(--radius-circle); background: color-mix(in srgb, var(--soft-accent) 32%, var(--surface)); cursor: pointer; font-size: 24px; }
.icon-button:hover { background: color-mix(in srgb, var(--soft-accent) 50%, var(--surface)); }

dialog { width: min(620px, calc(100% - 28px)); max-height: calc(100vh - 32px); max-height: calc(100dvh - 24px); border: 0; border-radius: var(--radius-large); padding: 0; color: var(--ink); background: var(--card); box-shadow: 0 30px 100px rgba(49, 26, 22, .3); }
dialog::backdrop { background: rgba(49, 26, 22, .48); backdrop-filter: blur(3px); }
html.dialog-open { height: 100%; overflow: hidden; overscroll-behavior: none; }
body.dialog-open { position: fixed; top: var(--dialog-scroll-offset, 0); right: 0; left: 0; width: 100%; overflow: hidden; overscroll-behavior: none; }
.add-dialog { overflow: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
#addDialog { position: fixed; top: 12px; right: 0; bottom: auto; left: 0; width: min(640px, calc(100% - 28px)); margin: 0 auto; overflow: hidden; }
#addDialog[open] { display: grid; grid-template-rows: auto auto minmax(0, 1fr); }
.dialog-header { display: flex; justify-content: space-between; gap: 20px; padding: 28px 28px 0; }
.dialog-header h2 { font-size: 38px; }
.add-dialog form { padding: 18px 28px 28px; }
#addDialog .dialog-header { padding-top: 24px; }
#addDialog .dialog-header h2 { font-size: 34px; }
#addDialog form { min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; overflow: hidden; padding: 0; }
.add-dialog-content { min-height: 0; overflow-y: auto; padding: 16px 28px 24px; scroll-padding-block: 16px; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.add-dialog label { display: grid; gap: 7px; margin-top: 16px; font-size: 13px; font-weight: 700; }
.add-dialog label span { font-weight: 400; color: var(--muted); }
.add-dialog .field-label-line { color: var(--ink); font-weight: 700; }
.add-dialog .field-label-line .field-hint { margin-left: 3px; color: var(--muted); font-weight: 400; }
.add-dialog input, .add-dialog select, .add-dialog textarea { width: 100%; border: 1px solid var(--line); border-radius: var(--radius-control); padding: 12px 13px; color: var(--ink); background: var(--panel); outline: 0; }
.add-dialog select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 44px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23422e29' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 18px;
}
.add-dialog input:focus, .add-dialog select:focus, .add-dialog textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--strong-action) 10%, transparent); }
.add-dialog input::placeholder, .add-dialog textarea::placeholder { color: color-mix(in srgb, var(--muted-ink) 58%, var(--panel)); opacity: 1; }
.add-dialog input:-webkit-autofill, .add-dialog input:-webkit-autofill:hover, .add-dialog input:-webkit-autofill:focus { -webkit-text-fill-color: var(--ink); box-shadow: 0 0 0 1000px var(--panel) inset; transition: background-color 9999s ease-out; }
.add-dialog .image-upload-button { justify-self: start; min-height: 44px; padding: 11px 16px; border: 0; color: var(--ink); background: color-mix(in srgb, var(--soft-accent) 30%, var(--panel)); font-weight: 700; }
.add-dialog .image-upload-field:hover .image-upload-button { background: color-mix(in srgb, var(--soft-accent) 50%, var(--panel)); }
.add-dialog .image-upload-field:has(.image-upload-input:focus-visible) .image-upload-button { outline: 3px solid color-mix(in srgb, var(--strong-action) 18%, transparent); outline-offset: 2px; }
.add-dialog .image-upload-field:has(.image-upload-input:disabled) .image-upload-button { cursor: wait; opacity: .65; }
.add-dialog .image-upload-input { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.add-mode-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: var(--radius-control); background: color-mix(in srgb, var(--soft-accent) 30%, var(--panel)); }
.add-mode-tab { min-height: 42px; padding: 9px 12px; border: 0; border-radius: var(--radius-small); color: var(--muted); background: transparent; cursor: pointer; font-weight: 600; }
.add-mode-tab.is-active { color: var(--strong-action); background: var(--surface); box-shadow: 0 2px 8px rgba(49, 26, 22, .08); }
.add-mode-tab:focus-visible { outline: 3px solid color-mix(in srgb, var(--strong-action) 18%, transparent); outline-offset: 2px; }
.link-preview-fields { margin-top: 18px; padding: 18px; border: 0; border-radius: var(--radius-card); background: color-mix(in srgb, var(--soft-accent) 22%, var(--panel)); }
.link-preview-heading { display: grid; gap: 3px; }
.link-preview-heading .eyebrow { margin: 0; }
.link-preview-heading h3 { color: var(--ink); font-size: 24px; line-height: 1.1; }
.link-image-stage { position: relative; min-height: 140px; margin-top: 14px; overflow: hidden; border: 0; border-radius: var(--radius-card); background: color-mix(in srgb, var(--soft-accent) 34%, var(--surface)); }
.link-image-preview { width: 100%; height: 100%; min-height: 140px; max-height: 240px; display: block; object-fit: cover; background: var(--sage-light); }
.image-replace-pill { position: absolute; right: 10px; bottom: 10px; min-height: 34px; padding: 7px 11px; display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: var(--radius-pill); color: var(--ink); background: color-mix(in srgb, var(--panel) 90%, transparent); box-shadow: 0 3px 12px rgba(49,26,22,.12); cursor: pointer; font-size: 13px; font-weight: 600; backdrop-filter: blur(5px); }
.image-replace-pill:hover { background: var(--panel); }
.image-replace-pill span { color: var(--ink); font-size: 16px; line-height: 1; }
.link-image-actions { display: flex; align-items: start; gap: 10px; }
.image-url-escape { flex: 1; margin: 0 !important; }
.manual-image-preview { width: min(180px, 100%); max-height: 120px; border: 1px solid var(--line); border-radius: var(--radius-small); object-fit: cover; }
.tag-input { min-height: 44px; padding: 6px 8px; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--panel); }
.tag-input:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--strong-action) 10%, transparent); }
.add-dialog .tag-input input[data-tag-entry] { width: 110px; min-width: 80px; flex: 1; padding: 4px; border: 0; box-shadow: none; }
.tag-chips { display: contents; }
.tag-chip { min-height: 28px; padding: 4px 8px; display: inline-flex; align-items: center; gap: 5px; border: 0; border-radius: var(--radius-pill); color: var(--tag-chip-ink); background: var(--tag-chip-bg); cursor: pointer; font-size: 12px; }
.tag-chip span { color: var(--muted); font-size: 15px; line-height: 1; }
#addRecipeSubmit:disabled::before { content: ""; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.45); border-top-color: white; border-radius: var(--radius-circle); animation: spin .7s linear infinite; }
.add-dialog .checkbox-label { display: flex; grid-template-columns: none; align-items: center; gap: 9px; font-weight: 600; }
.add-dialog .checkbox-label input { width: 18px; height: 18px; margin: 0; accent-color: var(--green); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.dialog-actions { margin-top: 24px; display: flex; justify-content: flex-end; gap: 8px; }
.add-dialog-actions { position: relative; z-index: 2; margin: 0; padding: 14px 28px 18px; background: color-mix(in srgb, var(--soft-accent) 16%, var(--panel)); box-shadow: 0 -10px 28px rgba(49,26,22,.04); }
#addDialog .add-dialog-actions .button { min-width: 148px; min-height: 48px; }
#addDialog .add-dialog-actions .button-quiet { background: color-mix(in srgb, var(--soft-accent) 30%, var(--panel)); }
#addDialog .add-dialog-actions .button-quiet:hover { color: var(--ink); background: color-mix(in srgb, var(--soft-accent) 48%, var(--panel)); }
#addRecipeSubmit { min-width: 148px; color: var(--surface); background: var(--avatar-green); }
#addRecipeSubmit:hover { background: color-mix(in srgb, var(--avatar-green) 82%, var(--strong-action)); }
.dialog-feedback { margin: 0 28px 2px; padding: 11px 13px; border-radius: var(--radius-small); color: var(--green-dark); background: var(--sage-light); font-size: 13px; font-weight: 600; line-height: 1.45; }
.dialog-feedback[data-tone="error"] { color: var(--strong-line); background: var(--warning); }
.recipe-dialog > .dialog-feedback { position: absolute; top: 14px; left: 50%; z-index: 5; width: max-content; max-width: calc(100% - 128px); margin: 0; padding: 10px 14px; transform: translateX(-50%); border: 1px solid color-mix(in srgb, var(--strong-action) 12%, transparent); border-radius: var(--radius-pill); box-shadow: 0 8px 24px rgba(49,26,22,.18); }

.recipe-dialog { overflow: auto; overscroll-behavior: none; -webkit-overflow-scrolling: auto; }
.dialog-close { position: absolute; top: 18px; right: 18px; z-index: 2; }
.detail-art { min-height: 180px; padding: 26px; display: flex; align-items: end; background: linear-gradient(135deg, var(--detail-color), color-mix(in srgb, var(--detail-color) 55%, var(--surface))); }
.detail-art.has-image { min-height: 280px; background-position: center; background-size: cover; }
.detail-art > span { padding: 7px 11px; border: 1px solid rgba(104,73,31,.12); border-radius: var(--radius-pill); color: var(--category-chip-ink); background: var(--category-chip-bg); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.detail-body { padding: 28px; }
.detail-body h2 { font-size: 40px; line-height: 1.05; margin-bottom: 11px; padding-right: 30px; }
.source-list { display: grid; gap: 10px; margin-top: 24px; }
.source-item { display: grid; gap: 6px; }
.source-row { display: grid; grid-template-columns: minmax(0, 1fr) 46px; align-items: stretch; gap: 8px; }
.source-link { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 10px 15px; border: 1px solid var(--line); border-radius: var(--radius-control); color: var(--ink); text-decoration: none; font-weight: 600; }
.source-link:hover { border-color: var(--green); background: var(--sage-light); }
.source-link-copy { min-width: 0; display: flex; align-items: center; }
.source-host { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-link-arrow { width: 20px; height: 20px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.source-meta { min-height: 34px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 10px; padding: 0 54px 2px 2px; }
.source-contributors { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; }
.source-contributors span { padding: 3px 7px; border: 1px solid rgba(45,89,72,.1); border-radius: var(--radius-pill); color: var(--contributor-chip-ink); background: var(--contributor-chip-bg); font-size: 10px; font-weight: 700; line-height: 1.2; }
.source-favorite-button { width: 46px; height: auto; min-height: 46px; align-self: stretch; border-radius: var(--radius-control); background: var(--paper); backdrop-filter: none; }
.source-favorite-button:focus-visible { outline: 3px solid color-mix(in srgb, var(--strong-action) 20%, transparent); outline-offset: 2px; }
.source-notes { display: grid; gap: 6px; padding: 0 54px 2px 0; }
.source-note { display: flex; align-items: flex-start; gap: 8px; margin: 0; padding: 9px 12px; border-radius: var(--radius-small); color: var(--muted); background: var(--paper); font-size: 13px; line-height: 1.45; }
.source-owner-actions { display: flex; justify-content: flex-end; gap: 6px; margin-left: auto; }
.source-owner-actions .button { min-height: 34px; padding: 7px 10px; font-size: 12px; }
.source-edit-button { color: var(--green); background: var(--sage-light); }
.source-edit-button:hover { background: var(--sage); }
.no-source { margin-top: 22px; padding: 14px; border-radius: var(--radius-control); color: var(--muted); background: var(--paper); font-size: 14px; }
.manual-recipe-content { display: grid; gap: 22px; margin-top: 12px; padding: 12px 14px; border: .5px solid var(--line); border-radius: var(--radius-card); background: var(--card); }
.manual-detail-actions { position: relative; z-index: 3; width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 6px; min-height: 36px; }
.manual-detail-favorite-button { width: 32px; height: 32px; flex: 0 0 32px; margin-left: auto; padding: 0; }
.manual-detail-favorite-button:focus-visible { outline: 3px solid color-mix(in srgb, var(--strong-action) 20%, transparent); outline-offset: 2px; }
.manual-recipe-section h3 { margin: 0 0 10px; font-size: 17px; }
.manual-recipe-section ul, .manual-recipe-section ol { margin: 0; padding-left: 24px; display: grid; gap: 8px; color: var(--ink); line-height: 1.55; }
.manual-recipe-section li::marker { color: var(--green); font-weight: 700; }
.manual-recipe-notes { padding: 14px 16px; border-radius: var(--radius-control); background: var(--paper); }
.manual-recipe-notes p { margin: 0; color: var(--muted); line-height: 1.55; white-space: pre-wrap; }

.toast { position: fixed; left: 50%; bottom: 24px; width: max-content; min-height: 44px; max-width: calc(100vw - 28px); box-sizing: border-box; display: grid; place-items: center; transform: translate(-50%, 20px); padding: 12px 17px; border-radius: var(--radius-pill); color: var(--surface); background: var(--strong-action); opacity: 0; pointer-events: none; transition: .2s ease; z-index: 30; font-weight: 600; font-size: 14px; line-height: 1.35; text-align: center; }
.toast-message { width: 100%; text-align: center; text-wrap: balance; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
[hidden] { display: none !important; }

@media (max-width: 850px) {
  .recipe-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-scroller::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    width: 30px;
    pointer-events: none;
    background: linear-gradient(90deg, transparent, var(--background));
  }
  .filter-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-right: 24px;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .filter-row::-webkit-scrollbar { display: none; width: 0; height: 0; }
}

@media (max-width: 560px) {
  main { width: min(100% - 28px, 1180px); }
  dialog { max-height: calc(100dvh - 16px); }
  .topbar { height: 56px; padding: 0 14px; }
  .topbar { gap: 9px; }
  .discovery { margin-bottom: 22px; padding-top: 8px; }
  .search-row { gap: 8px; }
  .add-dialog input, .add-dialog select, .add-dialog textarea { font-size: 16px; }
  .button.surprise-button { width: 54px; min-width: 54px; padding: 0; }
  .surprise-button .surprise-label { display: none; }
  #searchInput::placeholder { opacity: 0; }
  h1 { font-size: 40px; }
  .recipe-grid { grid-template-columns: 1fr; }
  .section-heading { flex-direction: column; align-items: flex-start; gap: 4px; margin-bottom: 14px; }
  .section-heading h2 { font-size: 28px; }
  .form-row { grid-template-columns: 1fr; gap: 0; }
  .dialog-header, .add-dialog form, .detail-body { padding-left: 20px; padding-right: 20px; }
  .dialog-feedback { margin-left: 20px; margin-right: 20px; }
  .add-dialog form, .detail-body { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
  .add-dialog, .recipe-dialog { scroll-padding-block: 16px calc(88px + env(safe-area-inset-bottom)); }
  #addDialog .dialog-header { padding: 20px 20px 0; }
  #addDialog .dialog-header h2 { font-size: 32px; }
  #addDialog { top: 8px; }
  #addDialog .add-dialog-content { padding: 14px 20px 20px; }
  #addDialog .add-dialog-actions { padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); }
  #addDialog .add-dialog-actions .button { min-width: 0; min-height: 48px; flex: 1 1 0; }
  #addRecipeSubmit { min-width: 0; flex: 1 1 0; }
  #addDialog[data-active-add-mode="link"]:not(.has-link-preview)[open] { height: fit-content; min-height: 0; max-height: min(420px, calc(100dvh - 16px)); grid-template-rows: max-content max-content max-content; align-content: start; }
  #addDialog[data-active-add-mode="link"]:not(.has-link-preview) form { height: fit-content; min-height: 0; grid-template-rows: max-content max-content; align-content: start; overflow: visible; }
  #addDialog[data-active-add-mode="link"]:not(.has-link-preview) .add-dialog-content { height: auto; min-height: 0; align-self: start; overflow: visible; }
}

/* Recipe card and version detail */
.recipe-card { min-height: 226px; border-radius: var(--radius-card); }
.card-art { min-height: 140px; height: 140px; padding: 10px; }
.category-pill { padding: 4px 10px; border: 0; text-transform: none; letter-spacing: .04em; font-weight: 500; }
.favorite-button { width: 30px; height: 30px; border: 0; background: color-mix(in srgb, var(--surface) 90%, transparent); }
.favorite-button svg { width: 15px; height: 15px; }
.card-art .favorite-button::before { content: ""; position: absolute; inset: -7px; }
.card-body { padding: 12px 14px; }
.card-title-row { margin: 0; }
.card-title-row h3 { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; font-size: 15px; font-weight: 500; line-height: 1.35; }
.card-meta { min-height: 20px; margin: auto 0 0; padding-top: 8px; font-size: 12px; }
.contributor-stack { display: flex; align-items: center; padding-left: 6px; }
.contributor-avatar { --avatar-mid: #4f7594; --avatar-ink: #fff; width: 36px; height: 36px; flex: 0 0 auto; display: inline-grid; place-items: center; border-radius: var(--radius-circle); color: var(--avatar-ink); background: var(--avatar-mid); font-size: 14px; font-weight: 600; }
.contributor-avatar-small { width: 20px; height: 20px; margin-left: -6px; border: 1.5px solid var(--card); font-size: 11px; }
.contributor-overflow { --avatar-mid: var(--soft-accent); --avatar-ink: var(--strong-line); margin-left: -6px; }
.contributor-tone-0 { --avatar-mid: #4f7594; }
.contributor-tone-1 { --avatar-mid: #5f7657; }
.contributor-tone-2 { --avatar-mid: #477a75; }
.contributor-tone-3 { --avatar-mid: #c27346; }
.contributor-tone-4 { --avatar-mid: #c8a24a; }
.contributor-tone-5 { --avatar-mid: #b75447; }
.contributor-tone-6 { --avatar-mid: #55425f; }
.contributor-tone-7 { --avatar-mid: #a791b2; }
.contributor-tone-8 { --avatar-mid: #713a46; }
.contributor-tone-9 { --avatar-mid: #c4848d; }
.contributor-tone-10 { --avatar-mid: #34495e; }
.contributor-tone-11 { --avatar-mid: #7da99b; }
.contributor-tone-12 { --avatar-mid: #7f814c; }
.contributor-tone-13 { --avatar-mid: #d79a72; }
.contributor-tone-14 { --avatar-mid: #858db7; }

.recipe-dialog { width: min(420px, calc(100% - 28px)); border: 0; border-radius: var(--radius-card); overflow: auto; }
.recipe-dialog::backdrop { background: rgba(49,26,22,.45); backdrop-filter: none; }
.dialog-close { top: 12px; right: 12px; width: 32px; height: 32px; color: var(--ink); background: color-mix(in srgb, var(--soft-accent) 32%, var(--surface)); font-size: 20px; }
.dialog-close:hover { background: color-mix(in srgb, var(--soft-accent) 50%, var(--surface)); }
.dialog-close:focus { outline: 0; }
.dialog-close:focus-visible { outline: 3px solid color-mix(in srgb, var(--strong-action) 35%, transparent); outline-offset: 2px; }
.detail-art, .detail-art.has-image { position: relative; width: 100%; min-height: 160px; height: 160px; overflow: hidden; padding: 0; border-radius: var(--radius-card) var(--radius-card) 0 0; background-position: center; background-repeat: no-repeat; background-size: cover; }
.detail-art::after { content: ""; position: absolute; inset: 28% 0 0; z-index: 1; background: linear-gradient(180deg, transparent, rgba(49,26,22,.76)); pointer-events: none; }
.detail-art:not(.has-image)::before { content: attr(data-letter); position: absolute; right: 22px; bottom: 10px; z-index: 0; color: color-mix(in srgb, var(--surface) 20%, transparent); font: 700 112px/1 "DM Sans", sans-serif; }
.detail-title-block { position: absolute; right: 0; bottom: 0; left: 0; z-index: 2; padding: 14px 20px; color: var(--surface); background: transparent; }
.detail-title-block h2 { margin: 0; padding: 0; color: var(--surface); font-size: 22px; font-weight: 500; line-height: 1.2; }
.detail-title-block p { margin: 4px 0 0; color: color-mix(in srgb, var(--surface) 85%, transparent); font-size: 13px; }
.detail-body { padding: 0 20px 20px; }
.detail-tags { margin: 0 -20px; padding: 14px 20px 6px; gap: 6px; }
.detail-tags span { padding: 4px 10px; border: 0; font-size: 12px; font-weight: 400; }
.source-list { display: grid; gap: 10px; margin-top: 10px; overflow: visible; border: 0; border-radius: 0; background: transparent; }
.source-item { position: relative; padding: 12px; border-radius: var(--radius-card); background: color-mix(in srgb, var(--soft-accent) 22%, var(--panel)); }
.source-item:not(:last-child) { border-bottom: 0; }
.source-row { display: flex; align-items: center; gap: 10px; border-radius: var(--radius-small); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.source-row:focus-visible { outline: 2px solid color-mix(in srgb, var(--strong-action) 35%, transparent); outline-offset: 3px; }
.source-link-copy { flex: 1; min-width: 0; display: grid; gap: 2px; }
.source-link-copy strong { overflow: hidden; color: var(--ink); font-size: 14px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.source-link-copy > span { min-width: 0; display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; }
.source-link-arrow { width: 13px; height: 13px; flex: 0 0 auto; }
.source-favorite-button { width: 36px; height: 36px; min-height: 36px; flex: 0 0 36px; align-self: center; display: grid; place-items: center; padding: 0; color: var(--accent); background: color-mix(in srgb, var(--accent) 13%, var(--surface)); }
.source-favorite-button svg, .manual-detail-favorite-button svg { width: 18px; height: 18px; display: block; place-self: center; }
.source-favorite-button path { fill: color-mix(in srgb, var(--accent) 18%, transparent); }
.manual-detail-favorite-button { background: var(--surface); }
.source-favorite-button:hover,
.manual-detail-favorite-button:hover { color: var(--accent); background: color-mix(in srgb, var(--accent) 20%, var(--surface)); }
.source-favorite-button.is-favorite,
.manual-detail-favorite-button.is-favorite { color: var(--surface); background: var(--accent); }
.source-favorite-button.is-favorite path,
.manual-detail-favorite-button.is-favorite path { fill: currentColor; }
.source-notes { display: block; padding: 0; }
.source-note { position: relative; display: block; margin: 10px 0 0 48px; padding: 8px 12px; border-left: 2px solid var(--avatar-mid); border-radius: 0 var(--radius-small) var(--radius-small) 0; background: var(--paper); font-size: 13px; line-height: 1.5; }
.source-note-copy { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.source-note.is-expanded .source-note-copy { display: block; overflow: visible; -webkit-line-clamp: unset; white-space: pre-wrap; }
.source-note-toggle { display: block; margin: 4px 0 0 auto; padding: 0; border: 0; color: var(--green); background: transparent; cursor: pointer; font-size: 12px; font-weight: 700; line-height: 1.3; }
.source-note-toggle:hover { text-decoration: underline; }
.source-owner-actions { position: relative; flex: 0 0 auto; margin: 0; }
.source-owner-actions summary { width: 28px; height: 32px; display: grid; place-items: center; border-radius: var(--radius-small); color: var(--muted); cursor: pointer; font-size: 15px; font-weight: 400; letter-spacing: 1px; list-style: none; }
.source-owner-actions summary::-webkit-details-marker { display: none; }
.source-owner-actions summary:hover { color: var(--ink); background: var(--paper); }
.source-owner-actions summary:focus-visible { outline: 2px solid color-mix(in srgb, var(--strong-action) 35%, transparent); outline-offset: 2px; }
.source-owner-menu { position: absolute; right: 0; bottom: 34px; z-index: 4; width: 154px; padding: 5px; border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--card); box-shadow: 0 12px 28px rgba(49,26,22,.16); }
.manual-owner-actions .source-owner-menu { top: 38px; right: auto; bottom: auto; left: 0; }
.source-menu-button { width: 100%; padding: 9px 10px; border: 0; border-radius: var(--radius-small); color: var(--ink); background: transparent; cursor: pointer; text-align: left; font-size: 12px; }
.source-menu-button:hover { background: var(--sage-light); }
.source-menu-button.is-danger { color: var(--strong-line); }

.version-discussion { margin: 10px 0 0 46px; cursor: default; }
.version-discussion-label { margin: 0 0 8px; color: var(--green); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.contributor-note { padding: 9px 12px; border-left: 2px solid var(--avatar-mid); border-radius: 0 var(--radius-small) var(--radius-small) 0; background: var(--paper); }
.contributor-note strong { display: block; margin-bottom: 3px; color: var(--muted); font-size: 11px; letter-spacing: .03em; text-transform: uppercase; }
.contributor-note p { margin: 0; font-size: 13px; line-height: 1.5; white-space: pre-wrap; }
.family-note-thread { margin-top: 10px; padding-top: 0; border-top: 0; }
.family-note-list { display: grid; gap: 8px; }
.family-note { position: relative; padding: 9px 12px; border-left: 2px solid var(--avatar-mid); border-radius: 0 var(--radius-small) var(--radius-small) 0; background: var(--paper); outline: 0; transition: background .2s ease, box-shadow .2s ease; }
.family-note-byline { min-width: 0; display: block; margin-bottom: 3px; padding-right: 32px; }
.family-note-byline > strong { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; }
.family-note > p { margin: 0; font-size: 13px; line-height: 1.5; white-space: pre-wrap; }
.family-note-owner-actions { position: absolute; top: 4px; right: 8px; }
.family-note-owner-actions summary { width: 28px; height: 28px; }
.family-note-owner-menu { top: 30px; right: 0; bottom: auto; }
.family-note-form, .family-note-edit-form { display: grid; gap: 8px; margin-top: 10px; }
.family-note-form { margin-top: 0; }
.family-note-list + .family-note-form { margin-top: 8px; }
.family-note-trigger { width: 100%; min-height: 44px; display: flex; align-items: center; justify-content: flex-start; gap: 8px; margin: 0; padding: 10px 12px; border: 0; border-radius: var(--radius-control); color: var(--muted); background: color-mix(in srgb, var(--surface) 76%, transparent); cursor: pointer; text-align: left; font-size: 13px; font-weight: 600; }
.family-note-trigger:hover { color: var(--ink); background: var(--surface); }
.family-note-trigger:focus-visible { outline: 3px solid color-mix(in srgb, var(--strong-action) 18%, transparent); outline-offset: 2px; }
.family-note-trigger span { color: currentColor; font-size: 17px; font-weight: 400; line-height: 1; }
.family-note-list + .family-note-trigger { margin-top: 8px; }
.family-note-form textarea, .family-note-edit-form textarea { width: 100%; min-height: 64px; resize: vertical; border: 0; border-radius: var(--radius-control); padding: 11px 12px; color: var(--ink); background: var(--panel); outline: 0; font-size: 13px; line-height: 1.4; }
.family-note-form textarea:focus, .family-note-edit-form textarea:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--strong-action) 14%, transparent); }
.family-note-form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; }
.family-note-form-actions .button { min-height: 36px; padding: 7px 12px; font-size: 12px; }
.family-note-form-actions .button-primary { color: var(--surface); background: var(--avatar-green); }
.family-note-form-actions .button-primary:hover { background: color-mix(in srgb, var(--avatar-green) 82%, var(--strong-action)); }
.family-note-error { margin: 0; color: var(--strong-line); font-size: 11px; line-height: 1.4; }
.family-note-thread.is-notification-target, .family-note.is-notification-target { background: var(--callout); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }

@media (min-width: 851px) {
  .recipe-dialog { width: min(760px, calc(100% - 56px)); border-radius: var(--radius-large); }
  .detail-art, .detail-art.has-image { min-height: 280px; height: 280px; border-radius: var(--radius-large) var(--radius-large) 0 0; }
  .detail-title-block { padding: 20px 24px; }
  .detail-title-block h2 { font-size: 28px; }
  .detail-title-block p { font-size: 14px; }
  .detail-body { padding-right: 24px; padding-left: 24px; }
  .detail-tags { margin-right: -24px; margin-left: -24px; padding-right: 24px; padding-left: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .family-note { transition: none; }
  .notification-dialog[open] { animation: none; }
}

@media (pointer: coarse) {
  .recipe-card:focus-visible { outline: none; }
  .confirmation-dialog .button:focus-visible { outline: none; }

  .family-note-form-actions .button,
  .notification-dismiss { min-width: 44px; min-height: 44px; }
  .notification-clear-all { min-width: 44px; }
  .source-favorite-button,
  .manual-detail-favorite-button { width: 44px; height: 44px; min-height: 44px; flex: 0 0 44px; }
  .source-favorite-button svg,
  .manual-detail-favorite-button svg { width: 22px; height: 22px; }
  .source-owner-actions summary { width: 44px; height: 44px; font-size: 19px; }
  .source-owner-menu { width: 190px; padding: 7px; bottom: 48px; border-radius: var(--radius-control); }
  .manual-owner-actions .source-owner-menu { top: 48px; bottom: auto; }
  .family-note-owner-menu { top: 48px; bottom: auto; }
  .source-menu-button { min-height: 48px; padding: 12px 13px; font-size: 14px; }
}

@media (max-width: 560px) {
  * { scrollbar-width: none; -ms-overflow-style: none; }
  *::-webkit-scrollbar { display: none; width: 0; height: 0; }
  .detail-body { padding-right: 20px; padding-bottom: calc(28px + env(safe-area-inset-bottom)); padding-left: 20px; }
  .notification-dialog { width: calc(100vw - 24px); max-height: min(60dvh, 480px); transform-origin: center top; }
  .notification-dialog-header { padding: 16px 16px 10px; }
  .notification-list { max-height: calc(60dvh - 72px); padding: 0 8px 8px; }
  .confirmation-dialog { padding: 22px; }
  .version-discussion { margin-left: 0; }
  .contributor-note p,
  .family-note > p,
  .family-note-form textarea,
  .family-note-edit-form textarea { font-size: 13px; line-height: 1.5; }
}

/* Multi-vault additions intentionally reuse the existing Dished Between Us tokens and controls. */
:root {
  --system-green: var(--avatar-green);
  --system-red: #b75447;
}

.invite-banner {
  margin: 12px 0 4px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid color-mix(in srgb, var(--avatar-green) 20%, var(--line));
  border-radius: var(--radius-card);
  background: var(--callout);
}
.invite-banner > div { min-width: 0; display: grid; gap: 3px; }
.invite-banner strong { font-size: 14px; }
.invite-banner span { color: var(--muted); font-size: 13px; line-height: 1.4; }
.invite-banner .button { flex: 0 0 auto; }

.vault-navigation {
  min-width: 0;
  margin: 10px 0 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.vault-navigation .vault-scroller { min-width: 0; flex: 1; margin: 0; }
.vault-navigation .filter-row { padding-bottom: 2px; }
.vault-navigation .filter-chip { background: color-mix(in srgb, var(--soft-accent) 28%, var(--surface)); }
.vault-navigation .filter-chip.is-active { background: var(--green); }
.vault-create-chip { color: var(--strong-action); border: 1px dashed color-mix(in srgb, var(--strong-action) 28%, var(--line)); background: transparent !important; }
.vault-create-chip:hover { background: var(--surface) !important; }
.vault-settings-button {
  width: 40px;
  min-width: 40px;
  height: 40px;
  padding: 0;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-circle);
  color: var(--muted);
  background: var(--surface);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1px;
}
.vault-settings-button:hover { color: var(--ink); background: color-mix(in srgb, var(--soft-accent) 38%, var(--surface)); }
.vault-destinations {
  margin: 20px 0 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: color-mix(in srgb, var(--soft-accent) 16%, var(--panel));
}
.vault-destinations legend { padding: 0 5px; color: var(--ink); font-size: 13px; font-weight: 700; }
.vault-choice-list { display: grid; gap: 8px; }
.add-dialog .vault-choice {
  min-height: 44px;
  margin: 0;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  color: var(--ink);
  background: var(--surface);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}
.add-dialog .vault-choice:has(input:checked),
.add-dialog .vault-choice:has(input:indeterminate) { border-color: color-mix(in srgb, var(--strong-action) 38%, var(--line)); background: var(--callout); }
.add-dialog .vault-choice input { width: 18px; height: 18px; margin: 0; padding: 0; accent-color: var(--green); box-shadow: none; }
.add-dialog .vault-choice span { color: var(--ink); font-weight: 600; }
.vault-choice-empty { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }

.vault-badges { min-width: 0; display: flex; align-items: center; gap: 5px; overflow: hidden; }
.vault-badge { max-width: 112px; padding: 3px 7px; overflow: hidden; border-radius: var(--radius-pill); color: var(--muted); background: color-mix(in srgb, var(--soft-accent) 38%, var(--surface)); font-size: 10px; font-weight: 700; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.vault-badge-more { flex: 0 0 auto; }
.detail-body > .vault-badges { margin: 14px 0 2px; overflow: visible; }
.detail-body > .vault-badges .vault-badge { max-width: 180px; font-size: 11px; }

.vault-dialog { width: min(560px, calc(100% - 28px)); }
.vault-dialog .dialog-close { position: static; flex: 0 0 auto; }
.vault-dialog .dialog-header { align-items: start; }
.vault-dialog .dialog-header .eyebrow { margin-bottom: 5px; }
.vault-dialog .dialog-header h2 { font-size: 32px; }
.vault-dialog-content { padding: 4px 28px 28px; }
.vault-create-panel form { padding: 18px 0 0; }
.vault-dialog-copy { margin: 12px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.vault-summary { margin: 14px 0 18px; padding: 14px 15px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-radius: var(--radius-card); background: color-mix(in srgb, var(--soft-accent) 22%, var(--panel)); }
.vault-summary > div { min-width: 0; display: grid; gap: 3px; }
.vault-summary strong { overflow: hidden; font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
.vault-summary span:not(.vault-role-pill) { color: var(--muted); font-size: 12px; }
.vault-bring-recipes { width: 100%; margin: 0 0 18px; }
.vault-role-pill { padding: 5px 9px; border-radius: var(--radius-pill); color: var(--surface); background: var(--system-green); font-size: 11px; font-weight: 700; text-transform: capitalize; }
.vault-invite-form { padding: 0 !important; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 10px; }
.vault-invite-form label { margin: 0; }
.vault-invite-form .button { min-height: 43px; }
.vault-admin-section { margin-top: 22px; }
.vault-admin-section h3 { margin: 0 0 9px; font-size: 14px; }
.vault-admin-list { display: grid; gap: 7px; }
.vault-admin-empty { margin: 0; padding: 12px; border-radius: var(--radius-control); color: var(--muted); background: color-mix(in srgb, var(--soft-accent) 16%, var(--panel)); font-size: 12px; }
.vault-admin-row { min-height: 48px; padding: 9px 10px 9px 12px; display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--surface); }
.vault-admin-copy { min-width: 0; flex: 1; display: grid; gap: 2px; }
.vault-admin-copy strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.vault-admin-copy span { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.vault-admin-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 5px; }
.vault-admin-actions .button { min-height: 34px; padding: 7px 9px; border-radius: var(--radius-small); font-size: 11px; }
.vault-danger-zone { margin-top: 24px; padding-top: 0; border: 0; }
.vault-danger-zone .button { width: 100%; }
.vault-danger-zone .button-danger { color: var(--surface); background: var(--system-red); }
.vault-danger-zone .button-danger:hover { color: var(--surface); background: color-mix(in srgb, var(--system-red) 84%, var(--strong-line)); }

.joined-vault-recipes-dialog { position: fixed; top: 12px; right: 0; bottom: auto; left: 0; width: min(600px, calc(100% - 28px)); margin: 0 auto; overflow: hidden; }
.joined-vault-recipes-dialog[open] { display: grid; grid-template-rows: auto auto minmax(0, 1fr); }
.joined-vault-recipes-dialog .dialog-header { align-items: start; }
.joined-vault-recipes-dialog .dialog-header .eyebrow { margin-bottom: 5px; }
.joined-vault-recipes-dialog .dialog-header h2 { font-size: 32px; }
.joined-vault-recipes-dialog form { min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; overflow: hidden; padding: 0; }
.joined-vault-recipes-content { min-height: 0; overflow-y: auto; padding: 16px 28px 24px; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.joined-vault-recipes-copy { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.joined-vault-recipes-toolbar { margin-top: 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.joined-vault-recipes-toolbar .button { min-height: 34px; padding: 7px 10px; color: var(--strong-action); background: color-mix(in srgb, var(--soft-accent) 30%, var(--panel)); font-size: 12px; }
.joined-vault-recipes-toolbar span { color: var(--muted); font-size: 12px; font-weight: 600; }
.joined-vault-recipes-list { margin-top: 10px; display: grid; gap: 8px; }
.add-dialog .joined-vault-recipe-choice { min-width: 0; min-height: 64px; margin: 0; padding: 9px 12px; display: grid; grid-template-columns: 20px 42px minmax(0, 1fr); align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--surface); cursor: pointer; }
.add-dialog .joined-vault-recipe-choice:has(input:checked) { border-color: color-mix(in srgb, var(--strong-action) 38%, var(--line)); background: var(--callout); }
.add-dialog .joined-vault-recipe-choice input { width: 18px; height: 18px; margin: 0; padding: 0; border: 0; border-radius: 4px; accent-color: var(--green); box-shadow: none; }
.add-dialog .joined-vault-recipe-art { width: 42px; height: 42px; display: grid; place-items: center; border-radius: var(--radius-small); color: var(--surface); background: linear-gradient(135deg, var(--joined-recipe-color), color-mix(in srgb, var(--joined-recipe-color) 58%, var(--surface))); font-size: 18px; font-weight: 700; }
.joined-vault-recipe-copy { min-width: 0; display: grid; gap: 3px; }
.joined-vault-recipe-copy strong { overflow: hidden; color: var(--ink); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.add-dialog .joined-vault-recipe-copy span { overflow: hidden; color: var(--muted); font-size: 11px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.joined-vault-recipes-empty { min-height: 90px; margin: 0; padding: 18px; display: grid; place-items: center; gap: 10px; border: 1px dashed var(--line); border-radius: var(--radius-card); color: var(--muted); background: color-mix(in srgb, var(--soft-accent) 14%, var(--panel)); text-align: center; font-size: 13px; }
.joined-vault-recipes-empty strong { color: var(--ink); }
.joined-vault-recipes-dialog .add-dialog-actions .button { min-width: 132px; min-height: 48px; }

@media (max-width: 650px) {
  .vault-navigation { margin-right: -8px; }
  .vault-navigation .filter-row { flex-wrap: nowrap; overflow-x: auto; padding-right: 12px; scrollbar-width: none; }
  .vault-navigation .filter-row::-webkit-scrollbar { display: none; }
  .invite-banner { align-items: flex-start; flex-direction: column; }
  .invite-banner .button { width: 100%; }
  .vault-dialog .dialog-header, .vault-dialog-content { padding-right: 20px; padding-left: 20px; }
  .vault-invite-form { grid-template-columns: 1fr; }
  .vault-invite-form .button { width: 100%; }
  .vault-admin-row { align-items: flex-start; }
  .vault-admin-actions { flex-direction: column; align-items: stretch; }
  .joined-vault-recipes-dialog .dialog-header, .joined-vault-recipes-content { padding-right: 20px; padding-left: 20px; }
  .joined-vault-recipes-dialog .add-dialog-actions { padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); }
  .joined-vault-recipes-dialog .add-dialog-actions .button { min-width: 0; flex: 1 1 0; }
}
