.plan-editor {
  display: grid;
  gap: 14px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: rgba(255,253,248,.82);
  box-shadow: var(--shadow);
}
.plan-editor-list { display: grid; gap: 10px; }
.plan-edit-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  background: var(--paper);
}
.plan-edit-main {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 6px 10px;
  border: 0;
  background: transparent;
  padding: 14px;
  text-align: left;
}
.plan-day, .plan-origin { font-size: 11px; font-weight: 800; color: var(--muted); }
.plan-origin { justify-self: start; }
.plan-edit-main strong { grid-column: 1 / -1; font-size: 15px; letter-spacing: -.02em; }
.plan-edit-main small { grid-column: 1 / -1; color: var(--muted); }
.plan-edit-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px;
  border-left: 1px solid var(--line);
  background: rgba(247,243,235,.58);
}

.replace-sheet {
  width: min(760px, calc(100vw - 20px));
  max-height: min(88vh, 850px);
  overflow: auto;
  margin: auto;
  border-radius: 28px;
  background: var(--paper);
  box-shadow: 0 24px 80px rgba(32,48,42,.22);
  padding: 10px 18px 22px;
}
.replace-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 2px 12px;
}
.replace-head h2 { margin-bottom: 6px; }
.replace-head p { margin: 0; color: var(--muted); }
.current-choice {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  margin-bottom: 10px;
}
.current-choice > span { font-size: 28px; }
.current-choice div { display: grid; gap: 2px; }
.current-choice small, .current-choice em { color: var(--muted); font-style: normal; }
.current-choice strong { font-size: 15px; }
.random-choice {
  width: 100%;
  display: flex;
  gap: 12px;
  align-items: center;
  text-align: left;
  border: 0;
  border-radius: 18px;
  padding: 14px;
  background: linear-gradient(145deg, #315c4f, #203b33);
  color: white;
}
.random-choice > span { font-size: 26px; }
.random-choice div { display: grid; gap: 3px; }
.random-choice small { color: rgba(255,255,255,.78); line-height: 1.35; }
.replace-separator {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .12em;
  font-weight: 800;
  margin: 17px 0 12px;
}
.replace-separator::before, .replace-separator::after {
  content: '';
  height: 1px;
  flex: 1;
  background: var(--line);
}
.replace-search {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 15px;
  padding: 0 12px;
}
.replace-search span { color: var(--muted); font-size: 18px; }
.replace-search input {
  width: 100%;
  border: 0;
  outline: 0;
  padding: 12px 0;
  background: transparent;
}
.replace-filters {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 10px 0 12px;
  scrollbar-width: none;
}
.replace-filters::-webkit-scrollbar { display: none; }
.replace-results { display: grid; gap: 8px; }
.replace-recipe {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  padding: 12px;
}
.replace-recipe:hover { transform: translateY(-1px); }
.replace-flag { font-size: 24px; }
.replace-recipe div { min-width: 0; display: grid; gap: 3px; }
.replace-recipe strong { font-size: 14px; }
.replace-recipe small { color: var(--muted); line-height: 1.35; }
.replace-arrow { color: var(--muted); font-size: 24px; }
.replace-empty {
  padding: 24px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 16px;
  color: var(--muted);
}

@media (max-width: 620px) {
  .plan-editor { padding: 15px; }
  .plan-edit-row { grid-template-columns: 1fr; }
  .plan-edit-actions {
    border-left: 0;
    border-top: 1px solid var(--line);
    justify-content: flex-end;
  }
  .replace-sheet {
    width: 100%;
    max-height: 92vh;
    margin: auto 0 0;
    border-radius: 26px 26px 0 0;
    padding-bottom: calc(22px + env(safe-area-inset-bottom));
  }
}
