/* =============================================================================
   Custom Card (isolated from Planner/Body styles)
   ============================================================================= */

.card.custom{
  --plan-row-bg: #d9e5f1;
  --plan-row-bg-open: #d9e5f1;
  --plan-row-border: .5px solid #203a61;
  --plan-row-border-open: .5px solid #203a61;
  --plan-panel-bg: #edf4fbd9;
  --plan-panel-border: .5px solid #203a61;
}

.card.custom .titlebar{
  border-bottom-color:#12a793;
}

/* Per-accordion row colors */
.card.custom .plan-row[data-kind="custom-meal"]{
  --plan-row-bg: #ace0d3;
  --plan-row-bg-open: #9cebd7;
  --plan-row-border: .5px solid #31574d;
  --plan-row-border-open: .5px solid #31574d;
}

.card.custom .plan-row[data-kind="custom-workout"]{
  --plan-row-bg: #61c4ab;
  --plan-row-bg-open: #61c4ab;
  --plan-row-border: .5px solid #31574d;
  --plan-row-border-open: .5px solid #31574d;
}

/* Per-accordion panel colors */
.card.custom #panel-custom-meal.plan-panel{
  --plan-panel-bg: #d9f0ea;
  --plan-panel-border: .5px solid #31574d;
}

.card.custom #panel-custom-workout.plan-panel{
  --plan-panel-bg: #d9f0ea;
  --plan-panel-border: .5px solid #31574d;
}

.card.custom .plan-row{
  display:flex;
  align-items:center;
  gap:12px;
  width:100%;
  padding:12px 14px;
  border-radius:12px;
  cursor:pointer;
  text-align:left;
  border: var(--plan-row-border, 1px solid #3c5e5c);
  background: var(--plan-row-bg, #9cd7daaf) !important;
  font:800 16px/1 system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial;
  -webkit-appearance:none;
  appearance:none;
  background-image:none;
  -webkit-tap-highlight-color:transparent;
  position:relative;
  transform:translateY(var(--acc-lift));
  box-shadow:var(--acc-row-shadow);
  z-index:1;
  transition: box-shadow .18s ease, transform .12s ease, background-color .12s ease;
  color:#0f172a;
}
.card.custom .plan-row .label{ flex:1 1 auto; }
.card.custom .plan-row .row-right{ margin-left:auto; display:flex; align-items:center; gap:8px; }
.card.custom .plan-row .plan-chev{ font-size:18px; line-height:1; user-select:none; transition:transform .18s ease; }

@media (hover:hover) and (pointer:fine){
  .card.custom .plan-row[aria-expanded="false"]:hover{
    background: var(--plan-row-bg, #9cd7daaf) !important;
    box-shadow: var(--acc-row-shadow-strong);
    border: var(--plan-row-border, 1px solid #3c5e5c);
  }
}

.card.custom .plan-row:focus-visible{
  outline:2px solid var(--pill-focus-ring);
  outline-offset:3px;
  border-radius:12px;
}

.card.custom .plan-row[aria-expanded="true"] .plan-chev{ transform: rotate(180deg); }
.card.custom .plan-row[aria-expanded="true"]{
  box-shadow:var(--acc-row-shadow-strong);
  border-bottom: var(--plan-row-border-open, var(--plan-row-border, 1px solid #3c5e5c));
  border-radius:12px 12px 0 0;
  background: var(--plan-row-bg-open, var(--plan-row-bg, #9cd7daaf)) !important;
}
.card.custom .plan-row:active{
  background: var(--plan-row-bg, #9cd7daaf) !important;
}

@media (hover:none){
  .card.custom .plan-row:hover,
  .card.custom .plan-row:active{
    background: var(--plan-row-bg, #9cd7daaf) !important;
    border: var(--plan-row-border, 1px solid #3c5e5c);
    box-shadow: var(--acc-row-shadow-strong);
  }
}

.card.custom .plan-panel{
  background: var(--plan-panel-bg, #edfcfcb0);
  border: var(--plan-panel-border, 1px solid #3c5e5c);
  border-radius:12px;
  padding:10px 12px;
  position:relative;
  transform:none;
  box-shadow:var(--acc-row-shadow);
  overflow:visible;
  margin-top:-12px;
  border-top:0;
  border-radius:0 0 12px 12px;
}
.card.custom .plan-panel::before{
  content:"";
  position:absolute;
  left:calc(var(--acc-ground-inset) - 2px);
  right:calc(var(--acc-ground-inset) - 2px);
  bottom:-10px;
  height:calc(var(--acc-ground-spread) + 2px);
  pointer-events:none;
  background: radial-gradient(50% 50% at 50% 50%, rgba(0,0,0,.16), rgba(0,0,0,0) 70%);
  filter:blur(6px);
  opacity:var(--acc-ground-opacity);
  z-index:0;
}
.card.custom .plan-panel > *{ position:relative; z-index:1; }

.cm-form-rows{
  display:grid;
  gap:10px;
  margin:10px 0 4px;
}
.cm-form-row{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:10px;
  align-items:center;
}
.cm-form-row > label{
  margin:0;
  font-size:13px;
  font-weight:600;
  color:#1f2937;
}
.cm-form-row > .form-input{
  width:100%;
}

.cm-excl-wrap{
  display:grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap:8px;
}
.cm-excl-btn{
  border:1px solid #9bb2cb;
  background:#f5f9ff;
  color:#1e293b;
  border-radius:999px;
  padding:6px 4px;
  font:600 12px/1.2 system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial;
  text-align:center;
  white-space:nowrap;
  cursor:pointer;
}
.cm-excl-btn[aria-pressed="true"]{
  background:#d9e8fb;
  border-color:#5f7ea8;
}

#customMealResults{
  list-style:none;
  margin:8px 0 0;
  padding-left:0;
}
#customMealResults .cm-meal{
  list-style:none;
  margin:0 0 calc(8px + var(--meal-dots-gap, 0.5px)) 0;
  display:grid;
  grid-template-columns: 1fr;
  align-items:start;
  gap:8px;
  position:relative;
}
#customMealResults .cm-meal::after{
  content:"• • • • • • • • •";
  display:block;
  text-align:center;
  color:rgb(168, 224, 179);
  font-weight:700;
  letter-spacing:.18em;
  margin-top:var(--meal-dots-gap, 0.5px);
  pointer-events:none;
}
#customMealResults .cm-meal:last-child::after{
  content:none;
}
#customMealResults .cm-meal-row{
  display:flex;
  align-items:flex-start;
  gap:8px;
}
#customMealResults .cm-meal-text{
  flex:1;
  min-width:0;
}
#customMealResults .cm-top{
  font-weight:600;
  line-height:1.2;
}
#customMealResults .cm-macros{
  font-size:13px;
}

/* Copied from Body recipe directions, but namespaced to custom card */
#customMealResults .cm-directions{
  margin-top:6px;
  margin-bottom:0;
  border:1px solid var(--recipe-pill-border);
  border-radius:10px;
  background:var(--recipe-pill-bg);
  position:relative;
  transform:translateY(var(--pill-lift));
  box-shadow:var(--pill-shadow-const);
  overflow:visible;
}
#customMealResults .cm-directions::before{
  content:"• • • • • • • • •";
  position:absolute;
  left:var(--pill-oval-inset);
  right:var(--pill-oval-inset);
  bottom:-10px;
  height:var(--pill-oval-height);
  pointer-events:none;
  background:radial-gradient(50% 50% at 50% 50%, rgba(0,0,0,.18), rgba(0,0,0,0) 70%);
  filter:blur(6px);
  opacity:var(--pill-oval-opacity);
  z-index:0;
}
#customMealResults .cm-directions > *{
  position:relative;
  z-index:1;
}
#customMealResults .cm-directions > summary{
  list-style:none;
  cursor:pointer;
  user-select:none;
  padding:8px 26px 8px 10px;
  font-family:var(--recipe-pill-font);
  font-size:var(--recipe-pill-size);
  font-weight:var(--recipe-pill-weight);
  color:var(--recipe-pill-text);
  line-height:1.2;
  -webkit-tap-highlight-color:transparent;
  border-radius:10px;
  background:var(--recipe-pill-bg);
  transition:background-color .15s ease, color .15s ease;
}
@media (hover:hover) and (pointer:fine){
  #customMealResults .cm-directions > summary:hover{ background:var(--recipe-pill-hover); }
}
@media (hover:none), (pointer:coarse){
  #customMealResults .cm-directions > summary:hover,
  #customMealResults .cm-directions > summary:active{ background:var(--recipe-pill-bg) !important; }
}
#customMealResults .cm-directions > summary::after{
  content:var(--recipe-pill-caret);
  position:absolute;
  right:10px;
  top:50%;
  transform:translateY(-50%);
  font-size:var(--recipe-pill-caret-size);
  color:var(--recipe-pill-caret-ink);
  opacity:.9;
}
#customMealResults .cm-directions[open] > summary{
  background:var(--recipe-pill-open);
  border-bottom:1px solid var(--recipe-pill-border);
  border-radius:10px 10px 0 0;
}
#customMealResults .cm-directions[open] > summary::after{
  content:var(--recipe-pill-caret-open);
}
#customMealResults .cm-directions > summary:focus-visible{
  outline:2px solid var(--pill-focus-ring);
  outline-offset:3px;
  border-radius:10px;
}
#customMealResults .cm-dir-body{
  padding:8px 10px;
  color:var(--muted);
  font-size:13px;
  background:#fff;
  border-radius:0 0 10px 10px;
}
#customMealResults .cm-dir-body ul,
#customMealResults .cm-dir-body ol{
  margin:6px 0 0 18px;
  padding-left:0;
  list-style-position:outside;
}
#customMealResults .cm-dir-body li{
  margin:4px 0;
}
#customMealResults .cm-dir-body .ing-head,
#customMealResults .cm-dir-body .step-head{
  font-weight:700;
  color:#0f172a;
  margin:6px 0 4px 0;
}

#customWorkoutResults{
  list-style:none;
  margin:8px 0 0;
  padding-left:0;
}
#customWorkoutResults .cw-exercise{
  list-style:none;
  margin:0 0 calc(8px + var(--meal-dots-gap, 0.5px)) 0;
  display:grid;
  grid-template-columns: 1fr;
  align-items:start;
  gap:8px;
  position:relative;
}
#customWorkoutResults .cw-exercise::after{
  content:"• • • • • • • • •";
  display:block;
  text-align:center;
  color:rgb(168, 224, 179);
  font-weight:700;
  letter-spacing:.18em;
  margin-top:var(--meal-dots-gap, 0.5px);
  pointer-events:none;
}
#customWorkoutResults .cw-exercise:last-child::after{
  content:none;
}
#customWorkoutResults .cw-exercise-row{
  display:flex;
  align-items:flex-start;
  gap:8px;
}
#customWorkoutResults .cw-exercise-text{
  flex:1;
  min-width:0;
}
#customWorkoutResults .cw-top{
  font-weight:600;
  line-height:1.2;
}
#customWorkoutResults .cw-meta{
  font-size:13px;
}
#customWorkoutResults .cw-details{
  margin-top:6px;
  margin-bottom:0;
  border:1px solid var(--recipe-pill-border);
  border-radius:10px;
  background:var(--recipe-pill-bg);
  position:relative;
  transform:translateY(var(--pill-lift));
  box-shadow:var(--pill-shadow-const);
  overflow:visible;
}
#customWorkoutResults .cw-details::before{
  content:"• • • • • • • • •";
  position:absolute;
  left:var(--pill-oval-inset);
  right:var(--pill-oval-inset);
  bottom:-10px;
  height:var(--pill-oval-height);
  pointer-events:none;
  background:radial-gradient(50% 50% at 50% 50%, rgba(0,0,0,.18), rgba(0,0,0,0) 70%);
  filter:blur(6px);
  opacity:var(--pill-oval-opacity);
  z-index:0;
}
#customWorkoutResults .cw-details > *{
  position:relative;
  z-index:1;
}
#customWorkoutResults .cw-details > summary{
  list-style:none;
  cursor:pointer;
  user-select:none;
  padding:8px 26px 8px 10px;
  font-family:var(--recipe-pill-font);
  font-size:var(--recipe-pill-size);
  font-weight:var(--recipe-pill-weight);
  color:var(--recipe-pill-text);
  line-height:1.2;
  -webkit-tap-highlight-color:transparent;
  border-radius:10px;
  background:var(--recipe-pill-bg);
  transition:background-color .15s ease, color .15s ease;
}
@media (hover:hover) and (pointer:fine){
  #customWorkoutResults .cw-details > summary:hover{ background:var(--recipe-pill-hover); }
}
@media (hover:none), (pointer:coarse){
  #customWorkoutResults .cw-details > summary:hover,
  #customWorkoutResults .cw-details > summary:active{ background:var(--recipe-pill-bg) !important; }
}
#customWorkoutResults .cw-details > summary::after{
  content:var(--recipe-pill-caret);
  position:absolute;
  right:10px;
  top:50%;
  transform:translateY(-50%);
  font-size:var(--recipe-pill-caret-size);
  color:var(--recipe-pill-caret-ink);
  opacity:.9;
}
#customWorkoutResults .cw-details[open] > summary{
  background:var(--recipe-pill-open);
  border-bottom:1px solid var(--recipe-pill-border);
  border-radius:10px 10px 0 0;
}
#customWorkoutResults .cw-details[open] > summary::after{
  content:var(--recipe-pill-caret-open);
}
#customWorkoutResults .cw-details > summary:focus-visible{
  outline:2px solid var(--pill-focus-ring);
  outline-offset:3px;
  border-radius:10px;
}
#customWorkoutResults .cw-body{
  padding:8px 10px;
  color:var(--muted);
  font-size:13px;
  background:#fff;
  border-radius:0 0 10px 10px;
}
#customWorkoutResults .cw-body ul,
#customWorkoutResults .cw-body ol{
  margin:6px 0 0 18px;
  padding-left:0;
  list-style-position:outside;
}
#customWorkoutResults .cw-body li{
  margin:4px 0;
}
