.map-desk,
.editor-shell {
  width: min(1240px, calc(100% - 2rem));
  min-height: 100vh;
  margin: 0 auto;
  padding: 2.5rem 0 4rem;
}

.desk-header,
.editor-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  padding-bottom: 2rem;
}

.map-desk .desk-header { padding-top: 0; }

.desk-header h1,
.editor-header h1 {
  max-width: 26ch;
  margin: 0;
  font-family: var(--font-heading);
  font-size: clamp(2.4rem, 4vw, 4rem);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.05;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.section-heading .eyebrow { margin: 0; }
.section-heading__action { margin: 0; }

.place-search h2,
.place-results h2 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 500;
  letter-spacing: -0.04em;
}

.map-settings,
.place-search {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius-m);
  box-shadow: var(--shadow);
}

/* Both headers, as everywhere else in this file. Left as .editor-header alone,
   a back link in a .desk-header stays `display: inline`, its vertical padding
   buys no layout, and the heading below is drawn over the top of it: the link
   reads perfectly and takes no clicks. */
.desk-header .text-button,
.editor-header .text-button {
  display: inline-block;
  margin-bottom: 1rem;
  text-decoration: none;
}

.editor-shell .editor-header { padding-top: 0; }

.editor-shell > .flash { max-width: 36rem; }

.map-settings,
.place-search {
  margin-bottom: 2rem;
  padding: 0.5rem 1.25rem;
}

.map-settings summary {
  padding: 0.75rem 0;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0;
}

.map-settings[open] { padding-bottom: 1.5rem; }
.map-settings[open] summary { margin-bottom: 1rem; }

.danger-zone {
  margin: 3rem 0 1rem;
  padding: 0.25rem clamp(1.25rem, 4vw, 2.5rem) 0.5rem;
  border: 1px solid rgba(156, 61, 46, 0.32);
  background: rgba(156, 61, 46, 0.035);
}

.danger-zone summary {
  padding: 0.75rem 0;
  cursor: pointer;
  color: #9c3d2e;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0;
}

.danger-zone__warning {
  max-width: 46ch;
  margin: 0.5rem 0 1.25rem;
  color: var(--ink-soft);
}
.map-settings form:last-child { margin-top: 1.5rem; }

.text-button--danger {
  color: #9c3d2e;
  border-bottom-color: #9c3d2e;
}

.place-finder {
  margin-bottom: 2rem;
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.place-finder__header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.65rem 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
}

.place-finder__header .eyebrow,
.place-finder__header h2 { grid-column: 1; }
.place-finder__header h2 { margin: 0; font-size: 1.4rem; }
.place-finder__header > p:last-of-type { max-width: 42rem; margin: 0; color: var(--ink-soft); line-height: 1.6; }

.place-source-nav {
  display: flex;
  grid-column: 2;
  grid-row: 1 / span 3;
  align-items: center;
  gap: 0.5rem;
}

.place-source-nav a {
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-s);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-decoration: none;
  text-transform: uppercase;
}

.place-source-nav a:hover { color: var(--accent); background: var(--accent-wash); }
.place-source { padding: 2rem 0; scroll-margin-top: 1rem; }
.place-source + .place-source { border-top: 1px dashed var(--line); }
.place-source > h3 { margin: 0 0 0.75rem; font-size: 1.1rem; }
.place-source > p:not(.eyebrow) { max-width: 46rem; color: var(--ink-soft); line-height: 1.6; }

.place-search__form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 0.8rem;
}

.place-search__form .primary-button { min-width: 10rem; }

.place-results {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--line);
}

.place-result-list {
  display: grid;
  gap: 0.8rem;
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
}

.place-result {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: var(--surface-soft);
}

.place-result > div:first-child { min-width: 0; }
.place-result h3 { margin: 0 0 0.35rem; font-size: 1.2rem; }
.place-result h4 { margin: 0 0 0.35rem; font-size: 1.2rem; }
.place-result address { color: var(--ink-soft); font-style: normal; line-height: 1.5; }
.place-result__action { width: min(23rem, 48%); }
.place-result__attribution { margin: 0.5rem 0 0; color: #5e5e5e; font-family: var(--font-body); font-size: 0.75rem; font-weight: 400; letter-spacing: 0; line-height: 1.5; text-transform: none; }
.place-result__form { display: grid; gap: 0.65rem; margin-top: 0.8rem; }

.place-result__form label {
  font-family: var(--font-body);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.place-result__form input[type="text"] {
  width: 100%;
  min-height: 2.8rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--line);
  background: var(--surface);
}

.place-result__form .primary-button { min-height: 2.8rem; }
.place-results__empty, .place-results__guidance { color: var(--ink-soft); }
.saved-place-results > h4 { margin: 0; font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; }
.saved-place-result__note { max-width: 48rem; margin: 0.75rem 0 0; overflow-wrap: anywhere; color: var(--ink); font-style: italic; line-height: 1.5; }

.saved-place-prefecture,
.saved-place-city {
  margin-top: 0.8rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.62);
}

.saved-place-prefecture > summary,
.saved-place-city > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.saved-place-prefecture > summary { background: rgba(57, 122, 235, 0.08); }

.saved-place-prefecture > summary span:last-child,
.saved-place-city > summary span:last-child { color: var(--ink-soft); }

.saved-place-cities { padding: 0 0.8rem 0.8rem; }
.saved-place-results > .saved-place-cities { padding: 0; }
.saved-place-city .place-result-list { margin: 0; padding: 0 0.8rem 0.8rem; }

.placement-ledger {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(20rem, 1fr);
  align-items: start;
  gap: 2rem;
  margin-bottom: 2rem;
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  background: var(--surface);
}

.placement-ledger > .public-map__map-stage {
  width: 100%;
  height: clamp(34rem, calc(100vh - 2rem), 44rem);
  margin: 0;
}

.placement-ledger__rail {
  min-width: 0;
  height: clamp(34rem, calc(100vh - 2rem), 44rem);
  display: flex;
  flex-direction: column;
}

.placement-ledger__rail h2 {
  margin: 0 0 1rem;
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.4;
}

.placement-list {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 1rem;
  margin: 0;
  padding: 0 0.4rem 0 0;
  overflow-y: auto;
  scrollbar-gutter: stable;
  list-style: none;
}

.placement-list turbo-frame { display: block; }
.placement-ledger__empty { margin: 0; color: var(--ink-soft); }

.editor-workspace {
  margin-bottom: 2rem;
}

.editor-workspace .place-finder { margin: 0; }

.place-link-source .place-import__form textarea {
  min-height: 5.5rem;
  resize: vertical;
}

.place-link-source .place-import__results {
  margin-top: 1.5rem;
}

.placement-card {
  display: grid;
  gap: 0.75rem;
  min-width: 0;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius-m);
}

.placement-card > .flash { margin: 0; }
.placement-card__place { min-width: 0; }
.placement-card h3 {
  margin: 0 0 0.25rem;
  overflow: hidden;
  font-size: 1.12rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.placement-card address {
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 0.88rem;
  font-style: normal;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.placement-card .place-result__attribution { margin-top: 0.75rem; text-align: left; }

.placement-note {
  margin: 0;
  padding-left: 0.75rem;
  overflow: hidden;
  border-left: 2px solid var(--signal);
  color: var(--ink-soft);
  display: -webkit-box;
  font-style: italic;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.placement-card__footer {
  display: flex;
  align-items: center;
  gap: 0.55rem 0.9rem;
  flex-wrap: wrap;
  padding-top: 0.7rem;
  border-top: 1px solid var(--line);
}

.placement-card__footer > form { margin: 0; }

.placement-card__editor > summary {
  cursor: pointer;
  color: var(--accent-strong);
  font-family: var(--font-body);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  list-style: none;
  text-transform: uppercase;
}

.placement-card__editor > summary::-webkit-details-marker { display: none; }
.placement-card__editor > summary::before { content: "+ "; }
.placement-card__editor[open] { flex: 1 0 100%; }
.placement-card__editor[open] > summary { margin-bottom: 0.8rem; }
.placement-card__editor[open] > summary::before { content: "\2212  "; }

.placement-note-form { display: grid; gap: 0.7rem; }
.placement-note-form .field { gap: 0.45rem; }
.placement-note-form .field textarea { min-height: 4.6rem; }
.placement-note-form .text-button { justify-self: start; }

.category-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0.45rem 0 0;
  color: var(--ink-soft);
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.category-badge__marker {
  width: 1.25rem;
  height: 1.25rem;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border: 2px solid #fffdf7;
  border-radius: 50% 50% 50% 0;
  color: #fffdf7;
  background: var(--category-color);
  box-shadow: 0 0 0 1px rgba(11, 41, 66, 0.22);
  transform: rotate(-45deg);
}

.category-badge__svg {
  width: 0.76rem;
  height: 0.76rem;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transform: rotate(45deg);
}

@media (max-width: 760px) {
  .desk-header, .editor-header { align-items: flex-start; flex-direction: column; }
  .place-finder__header { grid-template-columns: 1fr; }
  .place-source-nav { grid-column: 1; grid-row: auto; flex-wrap: wrap; }
  .place-search__form { grid-template-columns: 1fr; }
  .place-link-source .place-import__form { grid-template-columns: 1fr; }
  .place-link-source .place-import__form .primary-button,
  .place-link-source .place-import-candidate form,
  .place-link-source .place-import-candidate .primary-button { width: 100%; }
  .place-result { align-items: flex-start; flex-direction: column; }
  .place-result__action { width: 100%; }
  .place-result__attribution { text-align: left; }
}

@media (max-width: 1040px) {
  .placement-ledger { grid-template-columns: 1fr; padding: 1rem; }

  .placement-ledger > .public-map__map-stage {
    height: clamp(16rem, 50vw, 24rem);
  }

  .placement-ledger__rail { height: auto; }
  .placement-list { overflow: visible; padding-right: 0; }
}
