:root {
  --custom-bg: #faf8f5;
  --custom-card: #fff;
  --custom-ink: #28252d;
  --custom-muted: #655e6c;
  --custom-purple: #6c4cf1;
  --custom-orange: #ff8a34;
  --custom-line: #ece7e2;
}

.custom-plan-page {
  min-height: 100dvh;
  color: var(--custom-ink);
  background: var(--custom-bg);
}

.custom-plan-scroll {
  min-height: 100dvh;
  padding-bottom: calc(94px + env(safe-area-inset-bottom));
}

.custom-plan-top {
  min-height: 64px;
  padding: max(8px, env(safe-area-inset-top)) 14px 0;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
}

.custom-plan-top > div {
  text-align: center;
  font-size: 19px;
  font-weight: 700;
}

.custom-plan-back {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  display: grid;
  place-items: center;
  color: var(--custom-ink);
  background: transparent;
}

.custom-plan-back svg,
.custom-plan-page svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.custom-plan-back svg {
  width: 22px;
  height: 22px;
}

.custom-plan-content {
  padding: 4px 14px 28px;
}

.custom-plan-headline {
  margin: 4px 2px 10px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
}

.custom-plan-headline h1,
.custom-plan-form-intro h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.25;
}

.custom-plan-link {
  min-height: 44px;
  padding: 0 2px;
  border: 0;
  flex: none;
  color: var(--custom-purple);
  background: transparent;
  font-size: 13px;
  font-weight: 700;
}

.custom-plan-sub,
.custom-plan-form-intro p {
  margin: 0 2px 13px;
  color: var(--custom-muted);
  font-size: 13px;
  line-height: 1.55;
}

.custom-plan-targets {
  display: grid;
  gap: 10px;
}

.custom-plan-target {
  width: 100%;
  min-height: 94px;
  padding: 13px;
  border: 1px solid var(--custom-line);
  border-radius: 18px;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 26px;
  gap: 12px;
  align-items: center;
  color: var(--custom-ink);
  background: var(--custom-card);
  text-align: left;
}

.custom-plan-target.on {
  border-color: #beb0f6;
  background: #fefdff;
}

.custom-plan-target-icon {
  width: 48px;
  height: 48px;
  border-radius: 15px;
  display: grid;
  place-items: center;
}

.custom-plan-target-icon svg {
  width: 25px;
  height: 25px;
}

.custom-plan-target-icon.money { color: #c96b24; background: #fff2e7; }
.custom-plan-target-icon.sugar { color: var(--custom-purple); background: #f2eeff; }
.custom-plan-target-icon.energy { color: #5c9a82; background: #edf7f2; }

.custom-plan-target b {
  display: block;
  margin-bottom: 4px;
  font-size: 16px;
}

.custom-plan-target small {
  display: block;
  color: var(--custom-muted);
  font-size: 12px;
  line-height: 1.48;
}

.custom-plan-pick {
  width: 24px;
  height: 24px;
  border: 1.5px solid #d5ced9;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #fff;
}

.custom-plan-target.on .custom-plan-pick {
  border-color: var(--custom-purple);
  background: var(--custom-purple);
}

.custom-plan-target.on .custom-plan-pick::after {
  content: "✓";
  font-size: 14px;
  font-weight: 800;
}

.custom-plan-combine {
  min-height: 44px;
  margin-top: 3px;
  padding: 0 3px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--custom-muted);
  font-size: 12px;
}

.custom-plan-combine i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
  background: var(--custom-purple);
  opacity: .6;
}

.custom-plan-start {
  width: 100%;
  min-height: 52px;
  margin-top: 8px;
  padding: 0 16px;
  border: 0;
  border-radius: 16px;
  color: #35251d;
  background: var(--custom-orange);
  font-size: 16px;
  font-weight: 800;
}

.custom-plan-start:disabled { opacity: .62; }

.custom-plan-section-head {
  margin: 19px 2px 9px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.custom-plan-section-head b { font-size: 17px; }
.custom-plan-section-head span { color: var(--custom-muted); font-size: 12px; text-align: right; }

.custom-plan-empty {
  width: 100%;
  min-height: 84px;
  padding: 13px 14px;
  border: 1px solid var(--custom-line);
  border-radius: 17px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--custom-ink);
  background: var(--custom-card);
  text-align: left;
}

.custom-plan-empty-icon {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  flex: none;
  color: #8b838d;
  background: #f5f2ef;
}

.custom-plan-empty-icon svg { width: 22px; height: 22px; }
.custom-plan-empty b { display: block; font-size: 15px; }
.custom-plan-empty small,
.custom-plan-saved-copy span {
  display: block;
  margin-top: 3px;
  color: var(--custom-muted);
  font-size: 12px;
  line-height: 1.45;
}

.custom-plan-saved-copy { min-width: 0; }
.custom-plan-saved-copy b { overflow-wrap: anywhere; }

.custom-plan-tools {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.custom-plan-tool {
  min-height: 82px;
  padding: 10px 6px;
  border: 1px solid var(--custom-line);
  border-radius: 16px;
  color: var(--custom-ink);
  background: var(--custom-card);
  text-align: center;
}

.custom-plan-tool svg { width: 22px; height: 22px; margin-bottom: 5px; color: var(--custom-purple); }
.custom-plan-tool b { display: block; font-size: 13px; }
.custom-plan-tool span { display: block; margin-top: 3px; color: var(--custom-muted); font-size: 12px; line-height: 1.3; }

.custom-plan-form-intro { margin: 4px 2px 17px; }
.custom-plan-form-intro p { margin: 7px 0 0; }

.custom-plan-form fieldset {
  margin: 0 0 14px;
  padding: 14px;
  border: 1px solid var(--custom-line);
  border-radius: 17px;
  background: var(--custom-card);
}

.custom-plan-form legend {
  padding: 0 5px;
  font-size: 15px;
  font-weight: 800;
}

.custom-plan-choice-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.custom-plan-choice-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.custom-plan-selected-goals > span {
  min-height: 44px;
  padding: 7px 8px;
  border: 1px solid #b9aaf7;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #5938df;
  background: #f2eeff;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}
.custom-plan-choice-grid label,
.custom-plan-switches label { position: relative; }
.custom-plan-choice-grid input,
.custom-plan-switches input { position: absolute; opacity: 0; pointer-events: none; }
.custom-plan-choice-grid label > span,
.custom-plan-switches label > span {
  min-height: 44px;
  padding: 7px 8px;
  border: 1px solid #ded8e2;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--custom-muted);
  font-size: 13px;
  text-align: center;
}

.custom-plan-choice-grid input:checked + span,
.custom-plan-switches input:checked + span {
  border-color: #b9aaf7;
  color: #5938df;
  background: #f2eeff;
  font-weight: 700;
}

.custom-plan-switches { display: grid; gap: 8px; }
.custom-plan-switches label > span { justify-content: flex-start; padding-inline: 12px; }

.custom-plan-field {
  display: grid;
  gap: 7px;
  margin-top: 12px;
  color: var(--custom-muted);
  font-size: 12px;
}

.custom-plan-field input,
.custom-plan-field select {
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid #ded8e2;
  border-radius: 12px;
  color: var(--custom-ink);
  background: #fff;
  font: inherit;
  font-size: 14px;
}

.custom-plan-note {
  margin: 10px 1px 0;
  color: var(--custom-muted);
  font-size: 12px;
  line-height: 1.5;
}

.custom-plan-detail { padding-top: 16px; }
.custom-plan-detail-card {
  padding: 18px;
  border: 1px solid var(--custom-line);
  border-radius: 18px;
  background: var(--custom-card);
}

.custom-plan-detail-card h1 { margin: 0 0 8px; font-size: 21px; }
.custom-plan-detail-card > p { margin: 16px 0 4px; color: var(--custom-muted); font-size: 13px; line-height: 1.6; }
.custom-plan-status {
  display: inline-flex;
  min-height: 28px;
  margin-bottom: 13px;
  padding: 0 10px;
  border-radius: 14px;
  align-items: center;
  color: #4a328e;
  background: #f2eeff;
  font-size: 12px;
  font-weight: 700;
}

@media (max-width: 380px) {
  .custom-plan-content { padding-right: 12px; padding-left: 12px; }
  .custom-plan-headline h1,
  .custom-plan-form-intro h1 { font-size: 21px; }
  .custom-plan-target { min-height: 90px; padding: 11px; grid-template-columns: 44px minmax(0, 1fr) 24px; gap: 10px; }
  .custom-plan-target-icon { width: 44px; height: 44px; }
  .custom-plan-tools { gap: 7px; }
  .custom-plan-tool { padding-right: 4px; padding-left: 4px; }
  .custom-plan-choice-grid.members { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
