.main-stage.places-active {
  background: #d9c291 url('/assets/images/parchment.png') center / 540px;
}

.main-stage.places-active > .topbar,
.main-stage.places-active > .tree-viewport {
  display: none;
}

.places-view {
  height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at 88% 8%, rgba(100, 100, 61, 0.15), transparent 30%),
    linear-gradient(rgba(244, 229, 191, 0.8), rgba(218, 191, 137, 0.88)),
    url('/assets/images/parchment.png') center / 540px;
}

.places-header {
  min-height: 128px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  padding: 24px clamp(24px, 4vw, 58px) 20px;
  border-bottom: 1px solid rgba(92, 68, 31, 0.3);
  box-shadow: inset 0 -1px rgba(255, 250, 226, 0.45);
}

.places-header h1 {
  margin: 0;
  color: #42331f;
  font-family: var(--font-display);
  font-size: clamp(30px, 3.1vw, 44px);
  font-weight: 500;
  line-height: 1;
}

.places-header p:last-child {
  margin: 9px 0 0;
  color: var(--ink-soft);
  font-size: 15px;
}

.places-header .eyebrow { margin-bottom: 8px; }
.places-mobile-menu { display: none; }
.places-add { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; }
.places-add svg { width: 17px; height: 17px; }

.places-tools {
  min-height: 76px;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) repeat(3, minmax(145px, 0.32fr)) auto;
  align-items: end;
  gap: 12px;
  padding: 14px clamp(24px, 4vw, 58px);
  border-bottom: 1px solid rgba(92, 68, 31, 0.24);
  background: rgba(250, 239, 205, 0.28);
}

.places-tools label { display: grid; gap: 5px; }

.places-tools label > span {
  color: #675236;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.places-tools input,
.places-tools select,
.place-dialog textarea,
.place-link-dialog textarea {
  width: 100%;
  min-height: 39px;
  border: 1px solid rgba(91, 68, 33, 0.33);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 249, 227, 0.55);
  font: inherit;
}

.places-tools input,
.places-tools select { padding: 7px 10px; }

.places-tools input:focus,
.places-tools select:focus,
.place-dialog textarea:focus,
.place-link-dialog textarea:focus {
  outline: 2px solid rgba(184, 137, 53, 0.5);
  outline-offset: 1px;
}

.places-search { position: relative; }
.places-search svg { position: absolute; left: 12px; bottom: 10px; width: 17px; height: 17px; color: #756347; }
.places-search input { padding-left: 38px; }
.places-clear { align-self: center; margin-top: 16px; padding: 7px 5px; white-space: nowrap; }

.places-workspace {
  height: calc(100vh - 204px);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  overflow: hidden;
}

.places-workspace.has-detail { grid-template-columns: minmax(310px, 1fr) minmax(390px, 0.92fr); }

.places-index {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  align-content: start;
  gap: 16px;
  overflow-y: auto;
  padding: 24px clamp(24px, 4vw, 58px) 48px;
  scrollbar-color: rgba(93, 75, 45, 0.4) transparent;
}

.places-workspace.has-detail .places-index {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  padding-right: 24px;
}

.place-card {
  position: relative;
  min-height: 174px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 13px;
  padding: 18px 18px 15px;
  border: 1px solid rgba(91, 68, 33, 0.34);
  border-radius: 13px;
  text-align: left;
  background:
    linear-gradient(145deg, rgba(252, 242, 208, 0.82), rgba(225, 200, 149, 0.72)),
    url('/assets/images/parchment.png') center / 420px;
  box-shadow: 0 6px 15px rgba(72, 51, 22, 0.12), inset 0 0 0 2px rgba(255, 250, 226, 0.25);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.place-card::after {
  content: '⌖';
  position: absolute;
  right: 14px;
  top: 11px;
  color: rgba(99, 101, 62, 0.28);
  font-size: 29px;
}

.place-card:hover,
.place-card.selected {
  transform: translateY(-2px);
  border-color: rgba(107, 86, 43, 0.66);
  box-shadow: 0 10px 23px rgba(72, 51, 22, 0.18), inset 0 0 0 2px rgba(255, 250, 226, 0.3);
}

.place-card:focus-visible { outline: 3px solid rgba(83, 88, 53, 0.55); outline-offset: 2px; }
.place-card h2 { max-width: calc(100% - 25px); margin: 0; font-family: var(--font-display); font-size: 24px; font-weight: 500; line-height: 1.12; }
.place-card-address { margin: 6px 0 0; color: var(--ink-soft); font-size: 14px; }
.place-card-notes { display: -webkit-box; margin: 0; overflow: hidden; color: #5c4b34; font-size: 13px; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.place-card-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 11px; border-top: 1px solid rgba(90, 69, 35, 0.2); color: #6a593f; font-size: 12px; }
.place-card-meta span { display: inline-flex; align-items: center; gap: 6px; }
.place-card-meta svg { width: 14px; height: 14px; }
.place-card-coordinates { font-variant-numeric: tabular-nums; }

.places-empty {
  grid-column: 1 / -1;
  min-height: 320px;
  display: grid;
  place-items: center;
  padding: 40px;
  border: 1px dashed rgba(89, 67, 32, 0.35);
  border-radius: 15px;
  text-align: center;
  background: rgba(250, 239, 205, 0.2);
}

.places-empty svg { width: 45px; height: 45px; color: var(--olive); }
.places-empty h2 { margin: 13px 0 5px; font-family: var(--font-display); font-size: 27px; font-weight: 500; }
.places-empty p { max-width: 410px; margin: 0 auto 18px; color: var(--ink-soft); line-height: 1.5; }

.place-detail {
  position: relative;
  overflow-y: auto;
  padding: 34px clamp(28px, 3vw, 45px) 50px;
  border-left: 1px solid rgba(91, 68, 33, 0.35);
  background:
    linear-gradient(rgba(239, 219, 174, 0.91), rgba(225, 197, 141, 0.95)),
    url('/assets/images/parchment.png') center / 480px;
  box-shadow: -10px 0 28px rgba(66, 48, 22, 0.1);
}

.place-detail-close { position: absolute; top: 17px; right: 18px; display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border-radius: 50%; background: rgba(255, 248, 220, 0.36); }
.place-detail-close svg { width: 17px; height: 17px; }
.place-detail-kicker { display: inline-flex; align-items: center; gap: 7px; margin: 0 42px 8px 0; color: var(--olive-dark); font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
.place-detail-kicker svg { width: 15px; height: 15px; }
.place-detail h2 { margin: 0; font-family: var(--font-display); font-size: clamp(31px, 3vw, 42px); font-weight: 500; line-height: 1.05; }
.place-detail-address { margin: 9px 0 0; color: var(--ink-soft); font-size: 16px; }
.place-detail-actions { display: flex; gap: 9px; margin: 20px 0 22px; }
.place-detail-actions button { display: inline-flex; align-items: center; gap: 6px; }
.place-detail-actions svg { width: 15px; height: 15px; }
.place-notes { margin: 0 0 22px; padding: 16px 18px; border: 1px solid rgba(92, 70, 34, 0.22); border-radius: 11px; background: rgba(255, 247, 216, 0.26); color: #55452f; line-height: 1.55; white-space: pre-wrap; }

.place-coordinate-card {
  position: relative;
  min-height: 112px;
  display: grid;
  align-content: center;
  gap: 5px;
  margin-bottom: 27px;
  padding: 18px 88px 18px 20px;
  overflow: hidden;
  border: 1px solid rgba(76, 80, 47, 0.35);
  border-radius: 12px;
  background: radial-gradient(circle at 86% 48%, rgba(72, 77, 47, 0.18), transparent 23%), rgba(102, 103, 62, 0.09);
}

.place-coordinate-card::after { content: 'N'; position: absolute; right: 31px; top: 15px; width: 45px; height: 45px; display: grid; place-items: center; border: 1px solid rgba(69, 73, 45, 0.38); border-radius: 50%; color: var(--olive-dark); font: 12px/1 Georgia, serif; box-shadow: inset 0 0 0 7px rgba(255, 248, 220, 0.23); }
.place-coordinate-card small { color: #6e6549; font-size: 10px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.place-coordinate-card strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.place-coordinate-card span { color: #6b5b3e; font-size: 12px; }

.place-people-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 0 0 12px; }
.place-people-heading h3 { margin: 0; font-family: var(--font-display); font-size: 22px; font-weight: 500; }
.place-people-heading button { padding-inline: 13px; }
.place-timeline { position: relative; display: grid; gap: 10px; margin-left: 5px; }
.place-timeline::before { content: ''; position: absolute; top: 15px; bottom: 15px; left: 15px; width: 1px; background: rgba(89, 85, 48, 0.35); }

.place-person-link {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 31px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 10px 10px 0;
  border: 1px solid rgba(91, 68, 33, 0.22);
  border-radius: 10px;
  background: rgba(253, 243, 210, 0.46);
}

.place-person-marker { width: 9px; height: 9px; justify-self: center; border: 3px solid #e3c982; border-radius: 50%; background: var(--olive); box-sizing: content-box; }
.place-person-identity { min-width: 0; padding: 0; text-align: left; background: transparent; }
.place-person-identity:hover strong { text-decoration: underline; }
.place-person-link strong, .place-person-link small { display: block; }
.place-person-link strong { font-size: 15px; }
.place-person-link small { margin-top: 2px; color: var(--ink-soft); font-size: 12px; }
.place-person-link time { color: #655638; font-size: 12px; font-variant-numeric: tabular-nums; }
.place-person-edit { padding: 5px 7px; border-radius: 6px; color: #655638; background: rgba(255, 248, 222, 0.38); font-size: 11px; }
.place-person-notes { grid-column: 2 / -1; margin: -3px 0 0; color: #6a583e; font-size: 12px; line-height: 1.35; }
.place-person-empty { margin: 0; padding: 18px; border: 1px dashed rgba(91, 68, 33, 0.3); border-radius: 10px; color: var(--ink-soft); text-align: center; }

.place-dialog { width: min(650px, calc(100vw - 30px)); }
.place-dialog textarea,
.place-link-dialog textarea { min-height: 78px; resize: vertical; padding: 9px 10px; }
.place-form-grid small,
.place-link-dialog label small { color: #766449; font-weight: 400; }

@media (max-width: 1120px) {
  .places-tools { grid-template-columns: minmax(220px, 1fr) repeat(3, minmax(120px, 0.28fr)); }
  .places-clear { grid-column: 1 / -1; justify-self: start; margin-top: 0; }
  .places-workspace { height: calc(100vh - 238px); }
}

@media (max-width: 960px) {
  .places-header { grid-template-columns: 38px minmax(0, 1fr) auto; }
  .places-mobile-menu { display: grid; align-self: start; width: 38px; height: 38px; margin-top: 1px; border: 1px solid rgba(92, 68, 31, 0.25); border-radius: 8px; background: rgba(255, 248, 222, 0.35); }
  .places-workspace.has-detail { grid-template-columns: minmax(0, 1fr); }
  .place-detail { position: absolute; z-index: 7; inset: 204px 0 0 auto; width: min(520px, calc(100vw - 270px)); border-left: 1px solid rgba(91, 68, 33, 0.4); box-shadow: -18px 0 45px rgba(44, 34, 20, 0.24); }
}

@media (max-width: 700px) {
  .places-view { overflow-y: auto; }
  .places-header { min-height: 126px; grid-template-columns: 38px minmax(0, 1fr); gap: 10px; padding: 17px 16px 15px; }
  .places-header h1 { font-size: 29px; }
  .places-header p:last-child { font-size: 13px; line-height: 1.35; }
  .places-add { grid-column: 1 / -1; justify-content: center; width: 100%; }
  .places-tools { grid-template-columns: 1fr 1fr; padding: 13px 16px; }
  .places-search { grid-column: 1 / -1; }
  .places-tools label:nth-of-type(4) { grid-column: 1 / -1; }
  .places-workspace, .places-workspace.has-detail { height: auto; min-height: calc(100vh - 327px); overflow: visible; }
  .places-index, .places-workspace.has-detail .places-index { grid-template-columns: 1fr; overflow: visible; padding: 17px 16px 36px; }
  .place-card { min-height: 155px; }
  .place-detail { position: fixed; z-index: 20; inset: 0; width: 100%; padding: 35px 24px 60px; border: 0; }
  .place-detail h2 { font-size: 35px; }
  .places-empty { min-height: 270px; padding: 30px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .place-card { transition: none; }
}
