/* ============================================================================
   APP CHROME — the pieces the static design didn't need: top bar / nav, auth
   screens, and the management panels (schedules, meal times, preferences).
   All on the Warm Slab tokens defined in system.css.
   ========================================================================== */

/* ---- Top bar + nav ----------------------------------------------------- */
.app-bar { border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 92%, transparent); }
.app-bar-inner {
  max-width: var(--board-max); margin: 0 auto; display: flex; align-items: center; gap: 18px;
  padding: 12px 28px;
}
.wordmark { display: inline-flex; align-items: center; gap: 9px; font-family: var(--font-brand); font-weight: 600; font-size: 1.3rem; color: var(--accent-strong); text-decoration: none; letter-spacing: .01em; }
.wordmark:hover { color: var(--accent); }
.wordmark-mark { width: 1.75em; height: 1.75em; display: block; flex: none; }
.wordmark-text { line-height: 1; }

.nav-toggle {
  display: none; margin-left: auto; width: 40px; height: 40px; align-items: center; justify-content: center;
  font-size: 1.25rem; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  border-radius: var(--radius); cursor: pointer; line-height: 1;
}
.nav-toggle:hover { border-color: var(--accent); color: var(--accent); }

.app-menu { display: flex; flex: 1; align-items: center; gap: 18px; }
.app-nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.app-nav a {
  font-weight: 600; font-size: .88rem; color: var(--ink-soft); text-decoration: none; padding: 6px 11px;
  border-radius: var(--radius); line-height: 1.1;
}
.app-nav a:hover { color: var(--accent-strong); background: var(--accent-soft); }
.app-nav a.active { color: var(--accent-strong); background: var(--accent-soft); font-weight: 700; }

/* Links styled as buttons must not carry the default underline. The week-nav arrows are
   <a> (real navigation) so they need flex centering to honor the design's 34x34 sizing. */
.btn-primary, .btn-ghost, .btn, .add-btn, .menu-new, .head-add, .library-card, .icon-btn, .move-day { text-decoration: none; }
.weeknav .nav-btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }

.app-bar-right { display: flex; align-items: center; gap: 6px; }
.bar-form { margin: 0; }
.bar-link {
  font: inherit; font-weight: 600; font-size: .82rem; color: var(--ink-soft); background: transparent; border: none;
  cursor: pointer; padding: 6px 10px; border-radius: var(--radius);
}
.bar-link:hover { color: var(--accent-strong); background: var(--accent-soft); }

@media (max-width: 720px) {
  .app-bar-inner { flex-wrap: wrap; padding: 10px 16px; }
  .nav-toggle { display: inline-flex; }
  .app-menu { display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; gap: 4px; padding-top: 6px; }
  .app-menu.open { display: flex; }
  .app-nav { flex-direction: column; flex: none; gap: 2px; }
  .app-nav a { padding: 10px 11px; }
  .app-bar-right { padding-top: 8px; margin-top: 4px; border-top: 1px solid var(--line); }
}

/* ---- Board card open-link wrapper -------------------------------------- */
/* Hover fades the card content so the edit/swap/remove actions stand out (Kathy Sierra:
   hover only ever changes opacity & color — nothing reflows). */
.card-open { display: block; color: inherit; text-decoration: none; transition: opacity .15s ease; }
.card:hover .card-open, .card:focus-within .card-open { opacity: .5; }
.card-action-form { margin: 0; }
.day-head-link { text-decoration: none; color: inherit; display: block; }
.day-head-link:hover .day-name { color: var(--accent-strong); }

/* ---- Auth screens ------------------------------------------------------ */
.auth-shell { max-width: 420px; margin: 0 auto; padding: 64px 24px; }
.auth-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg, 11px); padding: 34px 30px; }
.auth-head { text-align: center; margin-bottom: 26px; }
.auth-logo { width: 76px; height: 76px; display: block; margin: 0 auto 10px; }
.auth-title { font-family: var(--font-brand); font-weight: 600; font-size: 2.1rem; color: var(--accent-strong); margin: 0; }
.auth-tagline { color: var(--ink-soft); margin: 4px 0 0; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-submit { margin-top: 6px; }
.auth-links { display: flex; flex-direction: column; gap: 8px; margin-top: 20px; }
.auth-links a { color: var(--accent); font-weight: 600; font-size: .88rem; text-decoration: none; }
.auth-links a:hover { color: var(--accent-strong); }
.form-errors { background: #FBE3DD; color: #93000A; border-radius: var(--radius); padding: 10px 14px; font-size: .88rem; font-weight: 600; }

/* ---- Management panels (schedules / meal times / preferences / library) - */
.page { max-width: var(--board-max); margin: 0 auto; padding: 14px 28px 60px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 14px 0 22px; }
.page-title { font-family: var(--font-display); font-weight: 700; font-size: 1.8rem; margin: 0; color: var(--ink); }
.page-sub { color: var(--ink-soft); margin: 4px 0 0; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg, 11px); padding: 20px 22px; margin-bottom: 16px; }
.panel + .panel { margin-top: 0; }
.panel-title { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; margin: 0 0 12px; }

.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.row-spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.row-spread:last-child { border-bottom: none; }
.muted { color: var(--ink-soft); font-size: .86rem; }
.pill { display: inline-block; background: var(--accent-soft); color: var(--accent-strong); font-weight: 700; font-size: .72rem; padding: 3px 9px; border-radius: 99px; letter-spacing: .04em; }

.weekday-set { display: flex; flex-wrap: wrap; gap: 8px; }
.weekday-set label {
  display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line-strong); background: var(--surface);
  padding: 7px 12px; font-weight: 700; font-size: .82rem; cursor: pointer; border-radius: var(--radius);
}
.weekday-set label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); }
.weekday-set input { accent-color: var(--accent); }

.meal-time-set { display: grid; gap: 8px; margin-top: 6px; }
.meal-time-option { display: flex; align-items: baseline; gap: 9px; cursor: pointer; }
.meal-time-option input { accent-color: var(--accent); }
.meal-time-option .muted { display: block; }

.component-rows { display: grid; gap: 12px; margin: 8px 0; }
.component-row { display: grid; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius-control); }
.comp-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.component-row .count-input { width: 72px; flex: none; }
.component-row .course-chips { flex: 1; min-width: 160px; }
.course-chips .chip { padding: 5px 10px; font-size: .78rem; }
.component-row .pin-select { flex: 1; min-width: 150px; }
.component-row .servings-input { width: 96px; flex: none; }
.component-row .component-note { flex: 1; min-width: 120px; }
.meal-time-notes { margin: 4px 0 0; }

/* Recipe pairings & rules panel (recipe edit modal) */
.recipe-links { border-top: 1px solid var(--line); }
.link-list { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 6px; }
.link-row { display: flex; align-items: center; gap: 8px; }
.link-other { flex: 1; font-weight: 600; }
.link-tag { font-size: .72rem; font-weight: 700; padding: 3px 8px; border-radius: var(--radius-control);
  border: 1px solid var(--line-strong); white-space: nowrap; }
.link-pairs-nicely { background: var(--accent-soft); color: var(--accent-strong); border-color: var(--accent); }
.link-never-together { background: #fbe4e2; color: #9b2c1c; border-color: #eebcb4; }
.link-always-together { background: #e4f0e6; color: #1f6b3f; border-color: #bcdcc4; }
.link-add { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.link-add .field-input { flex: 1; min-width: 140px; }
/* The suggestions list is hidden until the search field is focused (link-combo#open adds
   is-open), then opens as a dropUP — overlaying the content above the field rather than
   pushing the layout. Absolute (out of flow) so showing/hiding never reflows or shifts the
   scroll; opening upward keeps it inside the scrollable card (an absolute dropdown would be
   clipped past the card's bottom edge). */
.link-combo { position: relative; }
.link-combo .link-dropdown { display: none; position: absolute; bottom: 100%; left: 0; right: 0;
  margin-bottom: 6px; z-index: 40; max-height: 260px; overflow: auto; background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--radius-control);
  box-shadow: 0 -10px 28px rgba(0, 0, 0, .16); }
.link-combo.is-open .link-dropdown { display: block; }

.actions-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }

/* recipe library grid */
.library-section { margin-bottom: 30px; }
.library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.library-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg, 11px); overflow: hidden; text-decoration: none; color: inherit; display: block; transition: border-color .15s; }
.library-card:hover { border-color: var(--accent); }
.library-card .thumb { position: relative; height: 120px; border-bottom: none; background: var(--tint); display: block; }
.library-card .ph-icon { width: 34%; max-width: 92px; }
.library-card .card-body { padding: 12px 14px 14px; }
.library-card:hover .card-title { color: var(--accent-strong); }

.menu-empty { padding: 22px 14px; color: var(--ink-soft); }

/* ---- Admin: ingredient curation ----------------------------------------- */
.pending-row { flex-wrap: wrap; }
.pending-actions { margin-top: 0; align-items: center; }
.target-form { display: flex; gap: 8px; align-items: center; margin: 0; }
.target-form .field-input { width: 200px; }
.catalog-search { margin-bottom: 10px; }
.catalog-search .field-input { max-width: 320px; }

/* ---- Week / day plan notes ---------------------------------------------- */
/* Alignment wrappers match the day sheet (760) and the week board (board-max). */
.note-region { max-width: 760px; margin: 0 auto; padding: 0 26px; }
.note-region--week { max-width: var(--board-max); padding: 0 28px; }

.note-frame { display: block; }
.note { margin: 0; border-bottom: 1px dotted var(--line-strong); }
.note-summary { list-style: none; cursor: pointer; padding: 8px 0; display: flex; align-items: baseline; gap: 8px; }
.note-summary::-webkit-details-marker { display: none; }
.note[open] .note-summary { color: var(--accent); }
.note-text { font-family: var(--font-hand); font-size: 1.2rem; color: var(--ink); white-space: pre-line; line-height: 1.25; }
.note-add { font-size: .85rem; color: var(--ink-soft); }
.note-add::before { content: "＋ "; }
.note-form { display: grid; gap: 8px; padding: 4px 0 12px; }
.note-input { width: 100%; resize: vertical; font-family: var(--font-hand); font-size: 1.15rem; line-height: 1.3; }
.note-actions { display: flex; align-items: center; gap: 12px; }
.note-clear-hint { font-size: .72rem; }

/* read-only day note on the week board, links through to the day view */
.day-note-chip { display: block; margin: 0; padding: 8px 16px 0; font-family: var(--font-hand);
  font-size: 1.02rem; line-height: 1.2; color: var(--ink-soft); text-decoration: none; white-space: pre-line; }
.day-note-chip:hover { color: var(--accent); }

/* ---- Auto-planner ------------------------------------------------------- */
/* Note box takes the row; the auto-plan button rides its right edge. */
.plan-bar { display: flex; align-items: flex-start; gap: 12px; }
.plan-bar .note-frame { flex: 1; min-width: 0; }
.autoplan-form { margin: 0; flex: none; padding-top: 6px; }
.autoplan-btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; cursor: pointer;
  font-family: var(--font-body); font-weight: 700; font-size: .8rem; line-height: 1; white-space: nowrap;
  color: var(--accent-strong); background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius-control); transition: border-color .12s, color .12s, background .12s; }
.autoplan-btn:hover { border-color: var(--accent); background: var(--accent-soft); }
.autoplan-btn svg { flex: none; }

/* small ⟳ chip: per-day (board head), per-meal-time (board block + agenda group head) */
.regen-form { margin: 0; display: inline-flex; }
.regen-chip { display: inline-grid; place-items: center; width: 24px; height: 24px; padding: 0; cursor: pointer;
  font: inherit; font-size: .95rem; line-height: 1; color: var(--accent); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--radius-control);
  transition: border-color .12s, color .12s, background .12s; }
.regen-chip:hover { border-color: var(--accent); color: var(--accent-strong); background: var(--accent-soft); }
.day-panel-head .regen-form { position: absolute; top: 8px; right: 8px; z-index: 2; }
.group-head .regen-form { margin-left: 10px; }

/* Primary week actions — plan / shopping list / print — a centered row sitting between
   the date navigation and the week notes. */
.week-actions { max-width: var(--board-max); margin: 0 auto; padding: 2px 28px 12px;
  display: flex; justify-content: center; align-items: center; gap: 10px; flex-wrap: wrap; }
.week-actions .autoplan-form { padding-top: 0; }

/* Shopping-list button — a secondary (ghost) sibling of the auto-plan button. */
.shoplist-btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; cursor: pointer;
  font-family: var(--font-body); font-weight: 700; font-size: .8rem; line-height: 1; white-space: nowrap; text-decoration: none;
  color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius-control); transition: border-color .12s, color .12s, background .12s; }
.shoplist-btn:hover { border-color: var(--accent); color: var(--accent-strong); background: var(--accent-soft); }
.shoplist-glyph { font-size: .95rem; line-height: 1; }

/* ---- Shopping list page ------------------------------------------------- */
.back-link { display: inline-block; font-weight: 600; font-size: .82rem; color: var(--ink-soft); text-decoration: none; margin-bottom: 6px; }
.back-link:hover { color: var(--accent-strong); }

/* The user's own note for the store, shown atop the list with a copy button. */
.sl-note { max-width: 820px; display: flex; align-items: flex-start; gap: 14px; margin: 0 0 22px;
  padding: 12px 14px; background: var(--accent-soft); border: 1px solid var(--line); border-radius: 10px; }
.sl-note-body { flex: 1; min-width: 0; }
.sl-note-label { display: block; font-size: .7rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--accent-strong); margin-bottom: 4px; }
.sl-note-text { color: var(--ink); line-height: 1.45; word-break: break-word; }
.sl-note-text p { margin: 0 0 6px; }
.sl-note-text p:last-child { margin-bottom: 0; }
.sl-note-copy { flex: none; font: inherit; font-size: .8rem; font-weight: 700; padding: 6px 12px; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); border-radius: 8px; }
.sl-note-copy:hover { border-color: var(--accent); color: var(--accent-strong); }

/* Aisles flow into two balanced columns on wide screens, one on mobile. */
.sl-sheet { max-width: 820px; columns: 2; column-gap: 30px; }
.sl-section { break-inside: avoid; margin: 0 0 22px; }
.sl-aisle { font-family: var(--font-display); font-weight: 700; font-size: .8rem; letter-spacing: .06em; text-transform: uppercase;
  color: var(--accent-strong); margin: 0 0 6px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.sl-list { list-style: none; margin: 0; padding: 0; }
.sl-item { border-bottom: 1px solid var(--line); }
.sl-item:last-child { border-bottom: none; }
.sl-row { display: flex; align-items: flex-start; gap: 10px; padding: 9px 2px; }
.sl-check { flex: none; width: 16px; height: 16px; margin-top: 3px; accent-color: var(--accent); cursor: pointer; }
.sl-body { flex: 1; min-width: 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; transition: opacity .12s; }
.sl-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.sl-name { font-weight: 600; color: var(--ink); line-height: 1.25; cursor: pointer; }
a.sl-name--link { text-decoration: none; }
a.sl-name--link:hover { color: var(--accent-strong); text-decoration: underline; text-underline-offset: 2px; }
.sl-for { font-size: .76rem; color: var(--ink-soft); line-height: 1.2; cursor: pointer; }
.sl-qty { flex: none; font-weight: 700; font-size: .82rem; color: var(--accent-strong); white-space: nowrap;
  font-variant-numeric: tabular-nums; padding-top: 1px; cursor: pointer; }
.sl-check:checked ~ .sl-body { opacity: .55; }
.sl-check:checked ~ .sl-body .sl-name { text-decoration: line-through; color: var(--ink-soft); }

/* per-item row actions: where-to-buy panel, search loupe, replace-for-this-week */
.sl-actions { flex: none; display: flex; align-items: flex-start; gap: 2px; margin-top: -2px; }
.sl-act { display: inline-grid; place-items: center; width: 28px; height: 28px;
  color: var(--ink-soft); text-decoration: none; line-height: 1; font-size: 1rem;
  border: 1px solid transparent; border-radius: var(--radius-control);
  transition: color .12s, background .12s, border-color .12s; }
.sl-act:hover { color: var(--accent-strong); background: var(--accent-soft); border-color: var(--line); }
.sl-act svg { display: block; }
.sl-check:checked ~ .sl-actions { opacity: .4; }

/* per-item "where to buy" dropdown: pick a product, star the favorite, hover to see its stores */
.sl-buy { position: relative; display: inline-flex; }
.sl-buy-btn { display: inline-flex; align-items: center; width: auto; gap: 1px; padding: 0 4px;
  background: none; font: inherit; cursor: pointer; }
.sl-buy-caret { transition: transform .12s; }
.sl-buy-btn[aria-expanded="true"] .sl-buy-caret { transform: rotate(180deg); }
.sl-menu { position: absolute; top: calc(100% + 6px); right: 0; z-index: 30; min-width: 244px;
  display: flex; flex-direction: column; gap: 1px; background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius-control); padding: 6px; box-shadow: 0 6px 22px rgba(53, 44, 36, .16); }
.sl-menu[hidden] { display: none; }
.sl-menu-head { font-size: .64rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--ink-soft); padding: 3px 6px 4px; }
.sl-opt { display: flex; align-items: center; gap: 6px; padding: 2px; border-radius: var(--radius-control); }
.sl-opt:hover { background: var(--accent-soft); }
.sl-opt-star-form { margin: 0; display: flex; }
.sl-opt-star { display: grid; place-items: center; width: 26px; height: 26px; padding: 0; flex: none;
  border: none; background: none; border-radius: var(--radius-control); color: var(--line-strong); cursor: pointer; }
.sl-opt-star:hover { color: var(--accent); background: var(--line); }
.sl-opt.is-fav .sl-opt-star { color: var(--accent); }
.sl-opt-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; padding: 4px 2px; text-decoration: none; }
.sl-opt-name { font-weight: 600; font-size: .82rem; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sl-opt-body:hover .sl-opt-name { color: var(--accent-strong); }
.sl-opt-sub { font-size: .72rem; color: var(--ink-soft); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sl-badge { font-size: .64rem; font-weight: 700; padding: 0 6px; border-radius: 99px; border: 1px solid var(--line-strong); color: var(--ink-soft); }
.sl-opt-open { flex: none; color: var(--ink-soft); display: grid; place-items: center; padding-right: 4px; }
.sl-menu-foot { display: flex; align-items: center; gap: 6px; margin-top: 3px; padding: 8px 6px 3px;
  border-top: 1px solid var(--line); font-size: .78rem; font-weight: 600; color: var(--accent-strong); text-decoration: none; }
.sl-menu-foot:hover { color: var(--accent); }
/* the in-person store group inside the buy menu */
.sl-menu-head--sub { display: flex; align-items: center; gap: 6px; border-top: 1px solid var(--line);
  margin-top: 4px; padding-top: 7px; }
.sl-opt--store { width: 100%; font: inherit; text-align: left; border: none; background: none; cursor: pointer; }
.sl-opt--store.is-sel { background: var(--accent-soft); }
.sl-opt-store-form { margin: 0; display: block; }
.sl-opt-pin { flex: none; display: grid; place-items: center; width: 26px; height: 26px; color: var(--accent); }

/* Online / in-person tabs and the in-person (per-store) tab */
.sl-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 0; }
.sl-tab { font: inherit; font-weight: 600; font-size: .9rem; padding: 9px 14px; border: none; background: none;
  color: var(--ink-soft); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.sl-tab:hover { color: var(--accent-strong); }
.sl-tab.is-active { color: var(--accent-strong); border-bottom-color: var(--accent); }
.sl-tab-count { font-size: .68rem; font-weight: 700; background: var(--accent-soft); color: var(--accent-strong);
  border-radius: 99px; padding: 1px 7px; margin-left: 4px; }
.sl-panel { padding-top: 14px; }
.sl-empty-tab { color: var(--ink-soft); font-size: .9rem; padding: 8px 2px; }
.sl-inperson-top { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.sl-store-head { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin: 0 0 6px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.sl-store-name { margin: 0; padding: 0; border: none; display: flex; align-items: center; gap: 7px; }
.sl-loc { color: var(--accent); display: inline-flex; }
.sl-loc:hover { color: var(--accent-strong); }
.sl-copy { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-weight: 600; font-size: .76rem;
  padding: 5px 11px; border: 1px solid var(--line-strong); border-radius: var(--radius-control);
  background: var(--surface); color: var(--accent-strong); cursor: pointer; }
.sl-copy:hover { border-color: var(--accent); background: var(--accent-soft); }
.sl-copy svg { display: block; }
.rep-note { margin: 14px 0 0; color: var(--ink-soft); font-size: .85rem; line-height: 1.35; }

/* "where do I buy this" panel */
.prod-options { border: none; margin: 6px 0 4px; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.prod-options legend { padding: 0; margin-bottom: 4px; }
.prod-option { display: flex; align-items: flex-start; gap: 8px; padding: 6px 8px; border: 1px solid var(--line);
  border-radius: var(--radius-control); cursor: pointer; }
.prod-option:hover { border-color: var(--line-strong); }
.prod-option input { margin-top: 3px; accent-color: var(--accent); }
.prod-option-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.prod-option-name { font-weight: 600; color: var(--ink); }
.prod-meta { display: flex; gap: 10px; }
.prod-meta .field { flex: 1; }
.check-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; cursor: pointer; color: var(--ink); }
.check-row input { accent-color: var(--accent); }

.store-link { color: var(--accent); text-decoration: none; word-break: break-all; }
.store-link:hover { color: var(--accent-strong); text-decoration: underline; }
.sl-empty { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; color: var(--ink-soft); }

/* ---- API tokens (Preferences) ------------------------------------------ */
.token-reveal { background: var(--accent-soft); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px; }
.token-reveal-label { margin: 0 0 8px; font-weight: 700; color: var(--accent-strong); }
.token-reveal-row { display: flex; gap: 8px; align-items: center; }
.token-value { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .82rem; }
.token-reveal-warn { margin: 8px 0 0; font-size: .8rem; color: var(--ink-soft); }
.token-list { margin: 16px 0; }
.token-new { margin-top: 8px; }
.token-new .field-input { max-width: 260px; }

@media (max-width: 640px) { .sl-sheet { columns: 1; } }

/* --- AI recipe generation -------------------------------------------------- */

/* "Generate with AI" block at the foot of the add-meal modal. */
.gen-block { padding: 6px 24px 22px; }
.gen-sep { display: flex; align-items: center; gap: 12px; margin: 2px 0 14px; }
.gen-sep span { font-family: var(--font-display); font-weight: 700; font-size: .72rem; letter-spacing: .14em;
  text-transform: uppercase; color: var(--accent); white-space: nowrap; }
.gen-sep::before, .gen-sep::after { content: ''; flex: 1; border-bottom: 2px dotted var(--accent); opacity: .4; }
.gen-form { display: flex; flex-direction: column; gap: 10px; }
.gen-input { width: 100%; resize: vertical; min-height: 48px; padding: 12px 14px; border: 1px solid var(--line-strong);
  border-radius: var(--radius-control); background: var(--bg); font: inherit; color: var(--ink); line-height: 1.4; }
.gen-input::placeholder { color: var(--ink-soft); }
.gen-input:focus { outline: none; border-color: var(--accent); }
.gen-submit { align-self: flex-end; display: inline-flex; align-items: center; gap: 8px; border: none; cursor: pointer;
  background: var(--accent); color: #fff; font: inherit; font-weight: 700; padding: 11px 20px;
  border-radius: var(--radius-control); transition: background .15s ease; }
.gen-submit:hover { background: var(--accent-strong); }
.gen-submit:disabled { opacity: .65; cursor: default; }
.gen-glyph { font-size: .95em; }
.gen-hint { margin: 10px 0 0; font-size: .76rem; color: var(--ink-soft); line-height: 1.4; }

/* In-flight placeholder card — mirrors a normal .card but shows a working spinner. */
.card--generating { cursor: default; }
.card--generating .card-open { opacity: 1; }
.card--generating .card-title { color: var(--ink-soft); }
.gen-desc { font-style: italic; }
.gen-spinner { display: block; width: 26px; height: 26px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--accent); animation: genSpin .8s linear infinite; }
@keyframes genSpin { to { transform: rotate(360deg); } }

/* Stalled generation — the job never reported back. Drop the spinner and offer a way out. */
.card--timeout .gen-spinner { animation: none; border-top-color: var(--line); opacity: .4; }
.card--timeout .card-title { color: var(--ink-soft); }
.gen-actions { margin-top: .5rem; }
.gen-dismiss { font-size: .85rem; padding: .25rem .6rem; }

/* Brief highlight on a freshly streamed-in card (added by highlight_controller). */
.card.is-new { animation: cardArrive 2.4s ease; }
@keyframes cardArrive {
  0%   { box-shadow: 0 0 0 0 var(--accent); transform: scale(.985); }
  12%  { box-shadow: 0 0 0 3px var(--accent-soft); transform: scale(1); }
  100% { box-shadow: 0 0 0 0 rgba(0, 0, 0, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .gen-spinner { animation: none; }
  .card.is-new { animation: none; }
}

/* --- Admin sub-nav + prompt editor ---------------------------------------- */
.admin-tabs { display: flex; gap: 4px; margin: 8px 0 2px; border-bottom: 1px solid var(--line); }
.admin-tabs a { padding: 9px 16px; text-decoration: none; color: var(--ink-soft); font-weight: 600;
  border-bottom: 2px solid transparent; margin-bottom: -1px; }
.admin-tabs a:hover { color: var(--accent); }
.admin-tabs a.active { color: var(--accent-strong); border-bottom-color: var(--accent); }

.prompt-body { min-height: 360px; font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: .82rem; line-height: 1.55; }
.prompt-hint { margin: 0 0 2px; }
.prompt-hint code { background: var(--accent-soft); color: var(--accent-strong);
  padding: 1px 6px; border-radius: 4px; font-size: .8rem; }

/* ---- "Common" meals ----------------------------------------------------- */
/* A common meal (eggs, oatmeal…) has obvious ingredients. On screen its list is
   de-emphasized as a hint; in print it's hidden entirely (see @media print). The
   toggle (board meal popup / recipe popup) shows an accent-filled active state. */
.card--common .ingredients { opacity: .5; }
.icon-btn.is-common { border-color: var(--accent); background: var(--accent); color: #fff; }
.icon-btn.is-common:hover { border-color: var(--accent-strong); background: var(--accent-strong); color: #fff; }

/* ---- Deactivated recipes ------------------------------------------------ */
/* A deactivated recipe stays in the library — dimmed and flagged so you can reactivate it —
   but the planner never auto-selects it. Its popup toggle reads dashed/muted when off. */
.icon-btn.is-inactive { color: #9a9a9a; border-style: dashed; }
.library-card--inactive { opacity: .5; }
.library-card--inactive:hover { opacity: 1; }
.recipe-flag { display: inline-block; margin: 2px 0 4px; font-family: var(--font-display);
  font-weight: 700; font-size: .6rem; letter-spacing: .12em; text-transform: uppercase; color: #9a9a9a; }

/* ---- Print split button + config popup (week actions row) --------------- */
.print-split { position: relative; display: inline-flex; vertical-align: middle; }
.print-btn { font: inherit; font-weight: 700; font-size: .8rem; line-height: 1; cursor: pointer;
  color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong);
  padding: 7px 12px; transition: border-color .12s, color .12s, background .12s; }
.print-btn:hover { border-color: var(--accent); color: var(--accent-strong); background: var(--accent-soft); }
.print-btn--main { border-radius: var(--radius-control) 0 0 var(--radius-control); }
.print-btn--caret { border-radius: 0 var(--radius-control) var(--radius-control) 0; border-left: none;
  padding: 7px 9px; }
/* opens downward — the control now sits near the top of the page */
.print-config { position: absolute; top: calc(100% + 8px); right: 0; z-index: 30; min-width: 210px;
  display: flex; flex-direction: column; gap: 12px; text-align: left;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-control);
  padding: 14px; box-shadow: 0 6px 22px rgba(53, 44, 36, .14); }
.print-config[hidden] { display: none; }
.print-config-row { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  font-size: .82rem; font-weight: 600; color: var(--ink); }
.print-config-row select { font: inherit; padding: 6px 8px; border: 1px solid var(--line-strong);
  border-radius: var(--radius-control); background: var(--bg); color: var(--ink); }
.print-config-go { align-self: stretch; padding: 9px 14px; font-size: .85rem; }

/* ---- Split action button (Remove | Deactivate-and-remove) --------------- */
/* A primary action welded to a small icon segment doing a related, heavier action —
   two forms (different verbs) presented as one control, like the print split button.
   Inline in the meal popup; full-width in the board card's action stack. */
.split-btn { display: inline-flex; align-items: stretch; }
.split-btn > .bar-form, .split-btn > .card-action-form { margin: 0; display: inline-flex; }
.split-main { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.split-extra { border-top-left-radius: 0; border-bottom-left-radius: 0; border-left: none; }
.split-extra.btn-ghost { padding-left: 13px; padding-right: 13px; }
.card-actions .split-btn { width: 100%; }
.card-actions .split-btn > .split-main-form { flex: 1 1 auto; width: auto; }
.card-actions .split-btn > .split-extra-form { flex: 0 0 auto; width: auto; }
.card-actions .split-extra { padding: 0 9px; }

/* ============================================================================
   PRINT — printable weekly plan (triggered by the footer "Print" button →
   print_controller, or the browser's own print). Unrolls the horizontal day
   scroller into a wrapping grid that flows down the page, drops every bit of
   chrome + the recipe thumbnails, and enlarges the type for fridge-door
   legibility. Loaded last so these rules win any same-specificity conflicts.
   ========================================================================== */
@media print {
  @page { size: landscape; margin: 12mm; }

  /* white paper, no dotted texture, full-bleed */
  body { background: #fff; }
  main { padding: 0; }

  /* drop all interactive chrome, plus the week date-range header (.masthead) and
     the actions row (plan / shopping list / print) */
  .app-bar, #flash, #day-pager, .edge, .app-footer, .masthead, .week-actions,
  .note-form, .note-add,
  .card-actions, .add-btn, .head-add, .regen-form,
  turbo-frame#modal { display: none !important; }

  /* hide recipe thumbnails (key requirement) and the in-flight spinner */
  .thumb { display: none !important; }

  /* keep a week note if present (drop its editing affordances + dotted rule);
     hide the whole row when there's no note so the sheet starts at the columns */
  .note-region, .note-region--week { max-width: none; padding: 0 0 8px; }
  .note-region--week:not(:has(.note-text)) { display: none; }
  .note { border-bottom: none; }
  .note-summary { padding: 0; }
  .note-text { font-size: 1.2rem; }

  /* unroll the scroller: one equal-width column per day, side by side, all the
     same (full) height so the dividers between them run top to bottom */
  .board-wrap { max-width: none; margin: 0; }
  .board { overflow: visible; }
  .calendar.daycol {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    align-items: stretch; gap: 0;
  }
  /* optional fixed columns-per-page (footer split-button popup → print_controller):
     N equal day-columns per page. print_controller tags the first day of each new
     row with .print-page-break so the next N days start a fresh page — days are never
     stacked within a column on the same page. */
  html.print-fixed-cols .calendar.daycol {
    grid-auto-flow: row; grid-auto-columns: auto;
    grid-template-columns: repeat(var(--print-cols, 3), 1fr);
  }
  .day-panel.print-page-break { break-before: page; }

  /* borderless days; strip the inner head/meal padding so a narrow column keeps
     its width, and inset the content so the divider has breathing room. No
     break-inside:avoid here — a full day is usually taller than a landscape
     page, so let columns flow from the top and fragment cleanly between cards. */
  .day-panel { padding: 0 13px; }
  /* no underline — the meal-time label (DESAYUNO/…) already separates the day
     name from its meals */
  .day-panel-head { background: transparent; border-bottom: none; padding: 10px 0 6px; }
  /* don't single out the current day: no header tint, no accented day name */
  .day-panel.is-today .day-panel-head { background: transparent; }
  .day-panel.is-today .day-name { color: var(--ink); }
  /* tightened vertical rhythm (spacing only — type stays large) so more of the
     week fits per page */
  .meal-block { padding: 0 0 4px; }
  .block-label { margin-bottom: 6px; }
  .slot { gap: 7px; }
  .card-body { padding: 2px 0 0; }

  /* a single vertical rule BETWEEN day columns: border every visible day that
     follows another visible day (so the first column has none, and hidden empty
     days never leave a stray line). The first day of each page (a row start in
     fixed-columns mode) is excluded, so no stray rule at the left edge. */
  .day-panel:has(.card) ~ .day-panel:has(.card):not(.print-page-break) { border-left: 1px solid var(--line-strong); }

  /* drop empty meal sections, and any day with no meals at all, so the sheet
     shows only what's actually planned (no lonely day headers) */
  .meal-block:not(:has(.card)) { display: none; }
  .day-panel:not(:has(.card)) { display: none; }

  /* enlarge the type for legibility; the per-day date is hidden */
  .day-panel-head .day-name { font-size: 1.3rem; }
  .day-panel-head .day-date { display: none; }
  .meal-name { font-size: .82rem; }
  .card-title { font-size: 1.18rem; line-height: 1.14; }
  .ingredients { font-size: .95rem; line-height: 1.32; }
  /* "common" meals: hide the ingredient line entirely (just the dish name prints) */
  .card--common .ingredients { display: none; }

  /* cards: borderless + flat on paper, full opacity, avoid page/column splits */
  .card { border: none; box-shadow: none; cursor: auto; break-inside: avoid; }
  .card-open { opacity: 1 !important; }
  /* a very slight rule between meals sharing one meal time (cards in the same
     slot); meals in different meal times are already split by the time label */
  .slot .card + .card { border-top: 1px solid var(--line); padding-top: 6px; }
}

/* ---- Admin · structured-steps editor ----------------------------------- */
.step-cards { display: flex; flex-direction: column; gap: 12px; margin: 14px 0; }
.step-card { border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); padding: 14px 16px; }
.step-card[hidden] { display: none; }
.step-card.dragging { opacity: .5; background: var(--accent-soft); }
.step-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.step-handle { flex: 0 0 22px; height: 26px; display: grid; place-items: center; color: var(--ink-soft); cursor: grab; border: 1px solid var(--line-strong); background: var(--bg); border-radius: var(--radius-control); }
.step-handle:active { cursor: grabbing; }
.step-handle svg { display: block; fill: currentColor; }
.step-num { font-family: var(--font-display); font-weight: 700; font-size: .9rem; }
.step-num::before { content: "#"; }
.step-card-head .ing-del { margin-left: auto; }
.step-params { display: flex; flex-wrap: wrap; gap: 12px; margin: 10px 0; }
.param-field { display: block; }
.param-field[hidden] { display: none; }
.param-field .field-input { width: auto; min-width: 92px; }
.input-rows { display: flex; flex-direction: column; gap: 7px; margin-top: 6px; }
.input-row { display: flex; gap: 7px; align-items: center; }
.input-row[hidden] { display: none; }
.role-select { flex: 0 0 96px; padding: 8px 10px; border: 1px solid var(--line-strong); background: var(--bg); font: inherit; color: var(--ink); border-radius: var(--radius-control); }
.kind-select { flex: 0 0 124px; padding: 8px 10px; border: 1px solid var(--line-strong); background: var(--bg); font: inherit; color: var(--ink); border-radius: var(--radius-control); }
.from-node-select, .sub-recipe-select { flex: 1; min-width: 0; padding: 8px 10px; border: 1px solid var(--line-strong); background: var(--bg); font: inherit; color: var(--ink); border-radius: var(--radius-control); }
.input-row .is-hidden { display: none; }
.input-link { padding: 4px 0; }
.link-chip { display: inline-flex; align-items: center; background: var(--accent-soft); color: var(--accent-strong); font-weight: 700; font-size: .82rem; padding: 6px 12px; border-radius: var(--radius-control); }
.role-tag { font-size: .72rem; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .08em; }
.ing-add-sm { width: auto; padding: 7px 14px; margin-top: 8px; }
.step-preview { min-height: 38px; }
.preview-langs { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.preview-lang .preview-lbl { font-family: var(--font-display); font-weight: 700; font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; color: var(--accent); display: block; margin-bottom: 8px; }
.preview-steps { margin: 0; padding-left: 1.2em; }
.preview-steps li { line-height: 1.5; margin-bottom: 6px; }
.preview-steps li::marker { color: var(--accent); font-weight: 700; }
@media (max-width: 720px) { .preview-langs { grid-template-columns: 1fr; } }
.op-creator { border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 14px 16px; margin-top: 10px; background: var(--bg); }
.op-creator-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.op-creator-row .field-input { flex: 1; min-width: 140px; width: auto; }
.op-creator-params { margin: 8px 0; }
.op-creator-actions { display: flex; gap: 8px; margin-top: 10px; }
