/* Lavi design CSS module 4/4. Current cooking card and recipe modal designs, reversible lime accent; last in cascade.
   Keep stylesheet link order: calendar-redesign -> surfaces -> interactions -> cooking.
   Moving rules between modules requires responsive regression because order is part of the cascade. */
/* Approved cooking layout: share the calendar's outer shell and the week
   metric / water card surfaces, while retaining preparation drag/drop logic. */
#view .cooking-page .cooking-plans-shell{
  display:grid;
  gap:20px;
  box-sizing:border-box;
  width:100%;
  min-width:0;
  padding:18px;
  background:rgba(252,251,255,.88);
  border:1px solid var(--line);
  border-radius:28px;
  box-shadow:var(--lavi-shadow);
}
#view .cooking-page .cooking-plans-shell .cooking-day-section{
  min-width:0;
  padding:0;
  margin:0;
  background:transparent;
  border:0;
  border-radius:0;
  box-shadow:none;
}
#view .cooking-page .cooking-plans-shell .cooking-day-section.cook-drop-target{
  outline:2px dashed #BEB4E6;
  outline-offset:5px;
  background:transparent;
}
#view .cooking-page .cooking-plans-shell .cookheading{
  display:flex;
  justify-content:space-between;
  align-items:center;
  flex-wrap:wrap;
  gap:6px 12px;
  margin:0 0 10px;
  padding:11px 13px;
  background:var(--lavi-surface-selected);
  border-radius:12px;
  color:var(--lavi-ink);
  font:700 14px/1.35 Manrope,system-ui,sans-serif;
}
#view .cooking-page .cooking-section-count{
  margin-left:auto;
  color:var(--lavi-caption);
  font:400 12px/1.35 Manrope,system-ui,sans-serif;
}
#view .cooking-page .cooking-section-count strong{
  color:var(--lavi-ink);
  font-weight:650;
}
#view .cooking-page .cooking-plans-shell .cook-grid{
  margin:0;
  gap:12px;
  align-items:stretch;
}
#view .cooking-page .cooking-plans-shell .cook-grid > .cookrow{
  display:flex;
  flex-direction:column;
  gap:9px;
  box-sizing:border-box;
  min-width:0;
  height:100%;
  margin:0;
  padding:15px;
  background:#fff;
  border:1px solid var(--line);
  border-radius:20px;
  box-shadow:var(--lavi-shadow);
  color:var(--lavi-ink);
  transition:box-shadow 260ms ease;
}
@media(hover:hover) and (pointer:fine){
  #view .cooking-page .cooking-plans-shell .cook-grid > .cookrow:hover{
    background:#fff;
    border-color:var(--line);
    box-shadow:var(--lavi-shadow),inset 0 0 0 1px rgba(0,0,0,.04);
  }
}
#view .cooking-page .cooking-plans-shell .cook-card-top{
  display:flex;
  flex-wrap:nowrap;
  align-items:flex-start;
  justify-content:space-between;
  gap:8px;
  min-width:0;
}
#view .cooking-page .cooking-plans-shell .cook-card-top > .hint{
  flex:1 1 auto;
  min-width:0;
  margin:2px 0 0;
  font:400 12px/1.35 Manrope,system-ui,sans-serif;
}
#view .cooking-page .cooking-plans-shell .cook-card-days{
  display:flex;
  flex:0 1 auto;
  justify-content:flex-end;
  flex-wrap:wrap;
  min-width:0;
  gap:4px;
}
#view .cooking-page .cooking-plans-shell .cook-card-days .cooktag{
  margin:0;
  padding:4px 7px;
  background:var(--lavi-surface-selected);
  border-radius:9px;
  color:var(--lavi-caption);
  font:400 11px/1.3 Manrope,system-ui,sans-serif;
}
#view .cooking-page .cooking-plans-shell .cook-card-simple h3{
  margin:0;
  min-width:0;
}
#view .cooking-page .cooking-plans-shell .cook-card-simple .recipe-link{
  color:var(--lavi-ink);
  font:700 15px/1.4 Manrope,system-ui,sans-serif;
}
#view .cooking-page .cooking-plans-shell .cook-card-amount{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  align-items:baseline;
  gap:8px;
  min-width:0;
  margin:4px 0 0;
}
#view .cooking-page .cooking-plans-shell .cook-card-amount > .hint{
  font:400 12px/1.35 Manrope,system-ui,sans-serif;
  min-width:0;
}
#view .cooking-page .cooking-plans-shell .cook-card-amount > strong{
  flex:none;
  white-space:nowrap;
  font:700 21px/1.2 Manrope,system-ui,sans-serif;
  color:var(--lavi-ink);
  font-variant-numeric:tabular-nums;
}
#view .cooking-page .cooking-plans-shell .cook-card-progress{
  margin:0 0 3px;
  min-width:0;
  color:var(--lavi-caption);
  font:400 12px/1.4 Manrope,system-ui,sans-serif;
}
#view .cooking-page .cooking-plans-shell .cook-card-actions{
  display:flex;
  flex-wrap:nowrap;
  align-items:stretch;
  gap:7px;
  min-width:0;
  margin-top:auto;
}
#view .cooking-page .cooking-plans-shell .cook-card-actions > button{
  box-sizing:border-box;
  min-height:42px;
  min-width:0;
  padding:8px 10px;
  border-radius:12px;
  white-space:nowrap;
  font:600 12px/1.25 Manrope,system-ui,sans-serif;
}
#view .cooking-page .cooking-plans-shell .cook-card-actions > button:first-child{
  flex:1 1 auto;
  background:var(--lavi-generator)!important;
  color:var(--lavi-ink)!important;
}
#view .cooking-page .cooking-plans-shell .cook-card-actions > button.outline{
  flex:0 1 auto;
  background:#fff!important;
  border:1px solid var(--lavi-border);
  color:var(--lavi-ink);
}
#view .cooking-page .cooking-plans-shell .cook-card-actions .cook-card-menu > summary{
  box-sizing:border-box;
  width:42px;
  min-width:42px;
  height:42px;
  min-height:42px;
  border:1px solid var(--lavi-border);
  border-radius:12px;
  background:#fff!important;
}
@media(max-width:720px){
  /* On phones, one full-width preparation card per row. Legacy styles.css
     has a later <=720px two-column rule, so scope this to the redesigned shell. */
  #view .cooking-page .cooking-plans-shell .cook-grid{
    grid-template-columns:minmax(0,1fr);
  }
  #view .cooking-page .cooking-plans-shell{padding:12px;gap:16px;border-radius:22px}
  #view .cooking-page .cooking-plans-shell .cookheading{padding:10px 12px}
  #view .cooking-page .cooking-plans-shell .cook-grid > .cookrow{padding:13px}
  #view .cooking-page .cooking-plans-shell .cook-card-top > .hint{font-size:11px}
}
@media(max-width:420px){
  #view .cooking-page .cooking-plans-shell .cook-card-actions{flex-wrap:wrap}
  #view .cooking-page .cooking-plans-shell .cook-card-actions > button:first-child{flex:1 1 100%}
  #view .cooking-page .cooking-plans-shell .cook-card-actions > button.outline{flex:1 1 auto}
  #view .cooking-page .cooking-plans-shell .cook-card-amount > strong{font-size:19px}
}
@media(prefers-reduced-motion:reduce){
  #view .cooking-page .cooking-plans-shell .cook-grid > .cookrow{transition:none}
}

/* Touch devices use the existing explicit move menu instead of unreliable
   HTML5 card drag/drop. Do not show inactive desktop drop zones on iOS. */
#view .cooking-page .cooking-touch-move-hint{display:none}
@media (hover:none) and (pointer:coarse){
  #view .cooking-page .cooking-drop-targets{display:none}
  #view .cooking-page .cooking-touch-move-hint{
    display:block;
    margin:8px 0 0;
    font:500 12px/1.5 Manrope,system-ui,sans-serif;
    color:var(--lavi-caption);
  }
  #view .cooking-page .cookrow{cursor:default}
}


/* Visual rule: borders-only grouping surfaces stay flat. Elevation belongs to
   independent meal cards and the actual modal overlay, not its inner frames. */
#view .cooking-page .cooking-plans-shell,
#view .cooking-page .cooking-drop-targets{
  box-shadow:none;
}

/* Recipe preparation details. Keep the existing working cooking/profile
   calculations and scrollable modal shell; replace the flat audit text with
   aligned rows and calmer typography. */
#modalroot .modal:has(> .cooking-recipe-detail){
  box-sizing:border-box;
  width:min(620px,100%);
}
#modalroot .cooking-recipe-detail{
  color:var(--lavi-ink);
  min-width:0;
}
#modalroot .cooking-recipe-detail .cook-detail-header{
  margin-bottom:17px;
}
#modalroot .cooking-recipe-detail .cook-detail-header h2{
  margin:0;
  font:700 clamp(23px,3vw,28px)/1.2 "Playfair Display",Georgia,serif;
  letter-spacing:-.015em;
  overflow-wrap:anywhere;
}
#modalroot .cooking-recipe-detail .cook-detail-summary{
  padding:18px 20px;
  border:1px solid var(--lavi-border);
  border-radius:16px;
  background:#fff;
  box-shadow:none;
}
#modalroot .cooking-recipe-detail .cook-detail-summary-main{
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  gap:2px;
  color:var(--lavi-caption);
  font:500 12px/1.5 Manrope,system-ui,sans-serif;
}
#modalroot .cooking-recipe-detail .cook-detail-summary-main strong{
  color:var(--lavi-ink);
  font:750 26px/1.3 Manrope,system-ui,sans-serif;
  letter-spacing:-.025em;
  font-variant-numeric:tabular-nums;
}
#modalroot .cooking-recipe-detail .cook-detail-summary-people{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:0;
  margin-top:15px;
  padding-top:13px;
  border-top:1px solid var(--lavi-border);
}
#modalroot .cooking-recipe-detail .cook-detail-summary-people > span{
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  gap:3px;
  min-width:0;
  padding-right:12px;
}
#modalroot .cooking-recipe-detail .cook-detail-summary-people > span + span{
  padding:0 0 0 18px;
  border-left:1px solid var(--lavi-border);
}
#modalroot .cooking-recipe-detail .cook-detail-summary-people > span:only-child{
  grid-column:1 / -1;
}
#modalroot .cooking-recipe-detail .cook-detail-person-label{
  color:var(--lavi-caption);
  font:500 12px/1.4 Manrope,system-ui,sans-serif;
  overflow-wrap:anywhere;
}
#modalroot .cooking-recipe-detail .cook-detail-summary-people strong{
  color:var(--lavi-ink);
  font:700 16px/1.4 Manrope,system-ui,sans-serif;
  font-variant-numeric:tabular-nums;
  white-space:nowrap;
}
#modalroot .cooking-recipe-detail .cook-detail-section{
  margin:22px 0 0;
}
#modalroot .cooking-recipe-detail .cook-detail-section > h3{
  margin:0 0 12px;
  font:700 16px/1.35 Manrope,system-ui,sans-serif;
  color:var(--lavi-ink);
}
#modalroot .cooking-recipe-detail .cook-detail-audit-button{
  min-height:34px;
  padding:6px 10px;
  font:600 12px/1.4 Manrope,system-ui,sans-serif;
}
#modalroot .cooking-recipe-detail .cook-detail-day-list{
  border:1px solid var(--lavi-border);
  border-radius:14px;
  background:#fff;
  box-shadow:none;
  overflow:hidden;
}
#modalroot .cooking-recipe-detail .cook-detail-day-row{
  display:grid;
  grid-template-columns:42px 100px minmax(0,1fr);
  gap:10px;
  align-items:center;
  min-width:0;
  padding:10px 14px;
  border-bottom:1px solid var(--lavi-border);
  font:500 12px/1.45 Manrope,system-ui,sans-serif;
}
#modalroot .cooking-recipe-detail .cook-detail-day-row:last-child{
  border-bottom:0;
}
#modalroot .cooking-recipe-detail .cook-detail-day-name{
  color:var(--lavi-ink);
  font-weight:750;
}
#modalroot .cooking-recipe-detail .cook-detail-day-count{
  color:var(--lavi-caption);
}
#modalroot .cooking-recipe-detail .cook-detail-day-portions{
  display:flex;
  justify-content:flex-end;
  flex-wrap:wrap;
  gap:2px 12px;
  min-width:0;
  color:var(--lavi-ink);
  text-align:right;
}
#modalroot .cooking-recipe-detail .cook-detail-day-portions strong{
  font-weight:700;
  white-space:nowrap;
  font-variant-numeric:tabular-nums;
}
#modalroot .cooking-recipe-detail .cook-detail-components .hint{
  margin:0 0 12px;
}
#modalroot .cooking-recipe-detail .cook-detail-person-tabs{
  margin:0 0 12px;
  gap:8px;
  flex-wrap:wrap;
}
#modalroot .cooking-recipe-detail .cook-detail-person-tabs > button{
  min-height:38px;
  padding:8px 13px;
  font-size:12px;
}
#modalroot .cooking-recipe-detail .cook-detail-selected-yield{
  display:flex;
  justify-content:space-between;
  align-items:baseline;
  flex-wrap:wrap;
  gap:6px 12px;
  padding:0 0 9px;
  color:var(--lavi-caption);
  font:500 12px/1.5 Manrope,system-ui,sans-serif;
}
#modalroot .cooking-recipe-detail .cook-detail-selected-yield strong{
  color:var(--lavi-ink);
  font-size:15px;
  font-weight:750;
  font-variant-numeric:tabular-nums;
}
#modalroot .cooking-recipe-detail .cook-detail-ingredient-rows > .item{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin:0;
  padding:11px 0;
  border:0;
  border-bottom:1px solid var(--lavi-border);
  border-radius:0;
  box-shadow:none;
  background:transparent;
}
#modalroot .cooking-recipe-detail .cook-detail-ingredient-rows > .item:first-child{
  border-top:1px solid var(--lavi-border);
}
#modalroot .cooking-recipe-detail .cook-detail-ingredient-rows > .item b{
  white-space:nowrap;
  color:var(--lavi-ink);
  font-variant-numeric:tabular-nums;
}
#modalroot .cooking-recipe-detail .cook-detail-bottom-actions{
  margin-top:16px;
  gap:8px;
  flex-wrap:wrap;
}
@media(max-width:560px){
  #modalroot .cooking-recipe-detail .cook-detail-summary{padding:15px 16px}
  #modalroot .cooking-recipe-detail .cook-detail-summary-main strong{font-size:24px}
  #modalroot .cooking-recipe-detail .cook-detail-summary-people > span + span{padding-left:12px}
  #modalroot .cooking-recipe-detail .cook-detail-day-row{
    grid-template-columns:32px minmax(0,1fr);
    column-gap:12px;
    row-gap:1px;
    padding:9px 12px;
  }
  #modalroot .cooking-recipe-detail .cook-detail-day-name{
    grid-row:span 2;
    align-self:start;
    padding-top:2px;
  }
  #modalroot .cooking-recipe-detail .cook-detail-day-portions{
    grid-column:2;
    justify-content:flex-start;
    text-align:left;
    gap:2px 10px;
  }
  #modalroot .cooking-recipe-detail .cook-detail-section{margin-top:19px}
}


/* Experimental secondary accent (PR #73 only): revert this block and the
   three cook-detail/cooktag hooks if the lime + lavender pairing is declined.
   Every glyph on a lime surface uses the requested dark olive #465340. */
:root{
  --lavi-lime:#E6FDA8;
  --lavi-lime-ink:#465340;
}
#view .cooking-page .cooking-plans-shell .cook-card-days .cooktag,
#modalroot .prepared-fields .prepared-portion-chip{
  background:var(--lavi-lime);
  color:var(--lavi-lime-ink);
  font-weight:650;
}
#modalroot .prepared-profile-heading{
  display:flex;align-items:center;justify-content:space-between;gap:8px;min-width:0;
}
#modalroot .prepared-fields .prepared-profile-heading .prepared-portion-chip{
  flex:none;margin:0;padding:4px 7px;border-radius:9px;
  font:650 11px/1.3 Manrope,system-ui,sans-serif;white-space:nowrap;
}
/* Preserve the approved white, border-only summary; add a small lime label
   instead of tinting the full panel or changing the meaning of a cooking state. */
#modalroot .cooking-recipe-detail .cook-detail-summary{
  position:relative;
}
#modalroot .cooking-recipe-detail .cook-detail-summary-main{
  padding-right:92px;
}
#modalroot .cooking-recipe-detail .cook-detail-summary-badge{
  position:absolute;
  top:18px;
  right:18px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:30px;
  max-width:90px;
  padding:5px 12px;
  border-radius:999px;
  background:var(--lavi-lime);
  color:var(--lavi-lime-ink);
  font:650 12px/1.3 Manrope,system-ui,sans-serif;
  text-align:center;
  white-space:nowrap;
}
/* Lavender stays the secondary/inactive state; lime appears only while
   the corresponding ingredient scope is actually selected. */
#modalroot .cooking-recipe-detail .cook-detail-person-tabs > button[aria-pressed="true"]{
  background:var(--lavi-lime)!important;
  color:var(--lavi-lime-ink)!important;
  border-color:transparent!important;
  box-shadow:none;
}
#modalroot .cooking-recipe-detail .cook-detail-person-tabs > button[aria-pressed="true"]:hover,
#modalroot .cooking-recipe-detail .cook-detail-person-tabs > button[aria-pressed="true"]:active{
  background:var(--lavi-lime)!important;
  color:var(--lavi-lime-ink)!important;
}
@media(max-width:560px){
  #modalroot .cooking-recipe-detail .cook-detail-summary-main{padding-right:82px}
  #modalroot .cooking-recipe-detail .cook-detail-summary-badge{
    top:15px;
    right:15px;
    min-height:28px;
    padding:5px 10px;
    font-size:11px;
  }
}


/* Portion planning and batch review dialogs */
#modalroot .meal-add-dialog{gap:16px}
#modalroot .meal-add-dialog .meal-edit-header{margin-bottom:0}
#modalroot .meal-add-dialog .meal-add-person{
  border-color:var(--lavi-border);
  background:var(--lavi-surface-muted);
}
#modalroot .meal-add-dialog .meal-add-person:only-child{grid-column:1/-1}
#modalroot .meal-add-dialog .meal-add-person-head input{accent-color:#7162bf}
#modalroot .meal-add-dialog .nourish-days input + span{border-color:var(--lavi-border);color:var(--lavi-ink)}
#modalroot .meal-add-dialog .nourish-days input:checked + span{
  background:var(--lavi-lime);
  color:var(--lavi-lime-ink);
  border-color:var(--lavi-lime);
}
#modalroot .meal-add-dialog .nourish-days input:focus-visible + span{
  outline:2px solid #7162bf;
  outline-offset:1px;
}
#modalroot .cook-detail-days{
  padding:10px 12px;
  background:var(--lavi-surface-muted);
  border:1px solid var(--lavi-border);
  border-radius:12px;
}
#modalroot .cook-detail-days summary{
  padding:4px 0;
  cursor:pointer;
  font:650 14px/1.5 Manrope,sans-serif;
}
#modalroot .cook-detail-days[open] .cook-detail-day-list,
#modalroot .cook-detail-days .cook-detail-audit-button{margin-top:8px}
#modalroot .portion-audit{display:grid;gap:14px;min-width:0;overflow-wrap:anywhere}
#modalroot .portion-audit .lavi-dialog-titlebar{margin:0}
#modalroot .portion-audit-totals{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  border-radius:12px;
  background:#eeecfa;
  padding:12px;
  color:#535968;
  font:550 13px/1.5 Manrope,sans-serif;
}
#modalroot .portion-audit-totals > div + div{border-inline-start:1px solid #d5d0e8;padding-inline-start:12px}
#modalroot .portion-audit-totals strong{display:block;color:var(--lavi-ink);font-size:19px}
#modalroot .portion-audit table{
  width:100%;
  border-spacing:0;
  table-layout:fixed;
  text-align:left;
  font:550 13px/1.45 Manrope,sans-serif;
  font-variant-numeric:tabular-nums;
}
#modalroot .portion-audit :is(td,th){padding:8px 4px;border-bottom:1px solid var(--lavi-border)}
#modalroot .portion-audit thead th{color:#535968;font-size:12px}
#modalroot .portion-audit tbody tr:last-child :is(td,th){border-bottom:0}
#modalroot .portion-audit tr > :last-child{width:92px;text-align:right}
#modalroot .portion-audit th small{display:block;font-weight:500}
#modalroot .portion-audit button.mini:not(.icon-square){min-height:34px;padding:6px 9px;font-size:12px;white-space:nowrap}
/* Compact calendar and cooking dialogs. Content remains reachable by touch or keyboard. */
#modalroot .modal:has(:is(.calendar-recipe-detail,.meal-profile-grid,.prepared-dialog)){
  scrollbar-width:none;
}
#modalroot .modal:has(:is(.calendar-recipe-detail,.meal-profile-grid,.prepared-dialog))::-webkit-scrollbar{
  display:none;
}
#modalroot :is(.meal-edit-context,.calendar-portion-panel){
  padding:12px 14px;border:1px solid var(--lavi-border);border-radius:14px;
  background:var(--lavi-surface-muted);
}
#modalroot .meal-edit-context{
  display:flex;align-items:center;justify-content:space-between;gap:10px;overflow-wrap:anywhere;
}
#modalroot .lavi-lime-chip{
  background:var(--lavi-lime);color:var(--lavi-lime-ink);border-radius:9px;
  padding:4px 8px;font-weight:700;text-align:right;
}
#modalroot .meal-profile-grid .meal-person-column{background:var(--lavi-surface-muted);gap:8px}
#modalroot .meal-profile-grid .meal-person-column h3{overflow-wrap:anywhere}
#modalroot .meal-profile-grid .meal-profile-lock{
  flex-direction:row;align-items:center;padding:5px 7px;border-radius:8px;
}
#modalroot .meal-profile-grid .meal-profile-lock input{width:auto;margin:0;flex:none;accent-color:var(--lavi-lime-ink)}
#modalroot .meal-profile-lock:has(input:checked){background:var(--lavi-lime);color:var(--lavi-lime-ink)}
#modalroot .calendar-recipe-detail .nutrition-summary{margin:12px 0}
#modalroot .calendar-recipe-detail .nutrition-metric{background:var(--lavi-surface-muted);border-color:var(--lavi-border)}
#modalroot .calendar-recipe-detail .nutrition-metric:first-child{background:var(--lavi-lime)}
#modalroot .calendar-recipe-detail .nutrition-metric:first-child :is(small,strong,em){color:var(--lavi-lime-ink)}
#modalroot .calendar-portion-profiles{margin-top:8px;gap:6px}
#modalroot .calendar-portion-profiles button{min-width:0;white-space:normal;overflow-wrap:anywhere}
#modalroot .calendar-portion-panel .nutrition-yield strong{font-size:14px}
#modalroot :is(.calendar-portion-ingredients,.calendar-recipe-section){
  margin-top:8px;padding:8px 10px;border-radius:10px;border:1px solid var(--lavi-border);background:#fff;
}
#modalroot :is(.calendar-portion-ingredients,.calendar-recipe-section) summary{cursor:pointer;font-weight:650}
#modalroot .calendar-recipe-detail .recipe-change-note{margin-top:10px}

#modalroot .calendar-recipe-detail .nutrition-mode-switch button:not(.active){background:transparent}
#modalroot .calendar-recipe-detail .nutrition-mode-switch button.active{
  background:var(--lavi-lime);color:var(--lavi-lime-ink);
}
@media(max-width:480px){
  #modalroot .calendar-portion-profiles{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}
  #modalroot .calendar-portion-profiles button{padding-inline:6px}
  #modalroot .calendar-portion-profiles button[data-view="all"]{grid-column:1/-1}
}
