:root {
  --bg: #f5efe5;
  --bg-deep: #13262f;
  --panel: rgba(251, 247, 240, 0.92);
  --panel-strong: rgba(255, 251, 244, 0.98);
  --line: rgba(19, 38, 47, 0.12);
  --text: #17303a;
  --muted: #5c6f76;
  --brand: #cf6a2d;
  --brand-soft: rgba(207, 106, 45, 0.12);
  --innovation: #0d9488;
  --culture: #f97316;
  --nature: #eab308;
  --mobility: #2563eb;
  --shadow: 0 22px 70px rgba(19, 38, 47, 0.16);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background:
    radial-gradient(circle at top left, rgba(245, 173, 103, 0.18), transparent 38%),
    radial-gradient(circle at bottom right, rgba(13, 148, 136, 0.12), transparent 34%),
    linear-gradient(145deg, #f7efe4 0%, #efe4d5 50%, #f7f2eb 100%);
  color: var(--text);
  font-family: "IBM Plex Sans", sans-serif;
}

body {
  position: relative;
  min-height: 100dvh;
  overflow: hidden;
}

button,
input {
  font: inherit;
}

.background-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(23, 48, 58, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 48, 58, 0.045) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.2), transparent 88%);
  pointer-events: none;
}

.background-orb {
  position: fixed;
  width: 22rem;
  height: 22rem;
  border-radius: 999px;
  filter: blur(56px);
  opacity: 0.34;
  pointer-events: none;
}

.orb-one {
  top: -5rem;
  right: 10%;
  background: rgba(207, 106, 45, 0.46);
}

.orb-two {
  bottom: -7rem;
  left: 8%;
  background: rgba(37, 99, 235, 0.22);
}

.app-shell {
  position: relative;
  display: grid;
  grid-template-columns: minmax(300px, 390px) minmax(460px, 1fr) minmax(330px, 420px);
  gap: 1rem;
  height: 100dvh;
  min-height: 0;
  padding: 1rem;
}

.sidebar,
.map-stage,
.detail-card {
  position: relative;
  height: calc(100dvh - 2rem);
  min-height: 0;
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: var(--shadow);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.25rem;
  background: linear-gradient(180deg, rgba(255, 251, 245, 0.94), rgba(248, 240, 229, 0.9));
  backdrop-filter: blur(12px);
  border-radius: 32px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.sidebar::-webkit-scrollbar {
  width: 8px;
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(23, 48, 58, 0.14);
  border-radius: 999px;
}

.hero-panel,
.control-panel,
.list-panel {
  padding: 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
}

.eyebrow,
.detail-overline,
.legend-title {
  margin: 0 0 0.5rem;
  color: var(--brand);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: -0.03em;
}

h1 {
  font-size: clamp(2rem, 3.5vw, 3.2rem);
  line-height: 0.95;
}

.hero-copy {
  margin: 0.9rem 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.hero-visual {
  margin: 1rem 0 0;
}

.hero-visual img {
  display: block;
  width: 100%;
  border-radius: 22px;
  box-shadow: 0 16px 38px rgba(19, 38, 47, 0.12);
}

.account-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-top: 1rem;
  padding: 0.85rem;
  border: 1px solid rgba(19, 38, 47, 0.08);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
}

.account-strip span,
.account-strip small {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.account-strip strong {
  display: block;
  margin: 0.2rem 0;
  font-family: "Space Grotesk", sans-serif;
}

.logout-button {
  padding: 0.65rem 0.82rem;
  border: 1px solid rgba(19, 38, 47, 0.1);
  border-radius: 999px;
  background: rgba(19, 38, 47, 0.06);
  color: var(--text);
  cursor: pointer;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-top: 1.2rem;
}

.stat-card {
  padding: 0.95rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.85), rgba(255, 247, 239, 0.92));
  border: 1px solid rgba(19, 38, 47, 0.08);
  border-radius: var(--radius-md);
}

.stat-card strong {
  display: block;
  margin-top: 0.5rem;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.55rem;
}

.stat-label {
  color: var(--muted);
  font-size: 0.8rem;
}

.control-panel {
  display: grid;
  gap: 1rem;
}

.field-group {
  display: grid;
  gap: 0.65rem;
}

.field-group label,
.section-heading span,
#resultsCount {
  color: var(--muted);
  font-size: 0.88rem;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.search-wrap {
  position: relative;
}

.search-wrap::before {
  content: "Rechercher";
  position: absolute;
  top: -0.45rem;
  left: 1rem;
  padding: 0 0.35rem;
  background: rgba(251, 247, 240, 0.95);
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#searchInput {
  width: 100%;
  padding: 1rem 1rem 0.95rem;
  border: 1px solid rgba(19, 38, 47, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  outline: none;
}

#searchInput:focus {
  border-color: rgba(207, 106, 45, 0.55);
  box-shadow: 0 0 0 4px rgba(207, 106, 45, 0.1);
}

.chip-grid,
.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

#categoryFilters {
  display: grid;
  gap: 0.62rem;
}

.family-filter {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.8rem;
  width: 100%;
  padding: 0.82rem 0.9rem;
  border: 1px solid rgba(19, 38, 47, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  text-align: left;
}

.family-filter:hover,
.family-filter:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(19, 38, 47, 0.14);
  background: rgba(255, 255, 255, 0.9);
}

.family-filter.active {
  background: linear-gradient(135deg, #13262f, #224654);
  border-color: transparent;
  color: white;
  box-shadow: 0 14px 28px rgba(19, 38, 47, 0.18);
}

.family-filter-icon {
  display: grid;
  place-items: center;
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 12px;
  background: rgba(19, 38, 47, 0.08);
  color: var(--family-color, var(--text));
}

.family-filter.active .family-filter-icon {
  background: rgba(255, 255, 255, 0.14);
  color: white;
}

.family-filter-icon svg {
  width: 1.06rem;
  height: 1.06rem;
  stroke: currentColor;
  stroke-width: 1.9;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.family-filter-copy {
  display: grid;
  gap: 0.12rem;
}

.family-filter-copy strong {
  font-size: 0.96rem;
}

.family-filter-copy span {
  color: var(--muted);
  font-size: 0.74rem;
}

.family-filter.active .family-filter-copy span {
  color: rgba(255, 255, 255, 0.72);
}

.family-filter-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  padding: 0.28rem 0.48rem;
  border-radius: 999px;
  background: rgba(19, 38, 47, 0.08);
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 600;
}

.family-filter.active .family-filter-count {
  background: rgba(255, 255, 255, 0.14);
  color: white;
}

.chip-button,
.toolbar-chip,
.ghost-button,
.ghost-pill,
.secondary-button,
.primary-button {
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  transition:
    transform 160ms ease,
    background-color 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    box-shadow 160ms ease;
}

.chip-button {
  padding: 0.68rem 0.9rem;
  background: rgba(255, 255, 255, 0.82);
  border-color: rgba(19, 38, 47, 0.08);
  color: var(--text);
}

.chip-button:hover,
.toolbar-chip:hover,
.ghost-pill:hover,
.secondary-button:hover,
.primary-button:hover,
.ghost-button:hover {
  transform: translateY(-1px);
}

.chip-button.active {
  background: var(--bg-deep);
  color: white;
  box-shadow: 0 14px 28px rgba(19, 38, 47, 0.22);
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.primary-button,
.secondary-button,
.ghost-pill {
  padding: 0.82rem 1rem;
}

.primary-button {
  background: linear-gradient(135deg, #cb6f37, #dc8a45);
  color: white;
}

.secondary-button {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(19, 38, 47, 0.08);
  color: var(--text);
}

.ghost-button,
.ghost-pill {
  background: rgba(207, 106, 45, 0.08);
  border-color: rgba(207, 106, 45, 0.14);
  color: var(--brand);
}

.ghost-pill.active {
  background: rgba(19, 38, 47, 0.92);
  border-color: rgba(19, 38, 47, 0.92);
  color: white;
}

.list-panel {
  display: block;
  min-height: 0;
}

.places-list {
  display: grid;
  gap: 0.85rem;
  margin-top: 1rem;
  padding-right: 0.2rem;
}

.places-list::-webkit-scrollbar {
  width: 8px;
}

.places-list::-webkit-scrollbar-thumb {
  background: rgba(23, 48, 58, 0.16);
  border-radius: 999px;
}

.place-card {
  display: grid;
  gap: 0.8rem;
  padding: 1rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(251, 244, 235, 0.95));
  border: 1px solid rgba(19, 38, 47, 0.08);
  border-radius: 22px;
  cursor: pointer;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.place-image {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 8.7;
  object-fit: cover;
  border-radius: 18px;
  background: rgba(23, 48, 58, 0.06);
}

.catalog-preview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45rem;
  margin-top: -0.2rem;
}

.catalog-preview img {
  width: 100%;
  aspect-ratio: 1.5 / 1;
  object-fit: cover;
  border-radius: 12px;
  background: rgba(23, 48, 58, 0.06);
}

.place-card:hover {
  transform: translateY(-2px);
  border-color: rgba(207, 106, 45, 0.35);
  box-shadow: 0 12px 28px rgba(19, 38, 47, 0.1);
}

.place-card.active {
  border-color: rgba(207, 106, 45, 0.62);
  box-shadow: 0 18px 32px rgba(207, 106, 45, 0.14);
}

.place-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.place-card h3 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.08rem;
}

.place-subtitle,
.place-description,
.empty-state,
.detail-description,
.detail-meta {
  color: var(--muted);
  line-height: 1.55;
}

.place-description {
  margin: 0;
  font-size: 0.92rem;
}

.place-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.place-route {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: 16px;
  background: rgba(23, 48, 58, 0.055);
  color: var(--muted);
  font-size: 0.82rem;
}

.place-route strong {
  color: var(--text);
  white-space: nowrap;
}

.meta-badge,
.detail-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  font-size: 0.78rem;
}

.meta-badge {
  background: rgba(23, 48, 58, 0.06);
  color: var(--text);
}

.favorite-toggle {
  min-width: 2.45rem;
  height: 2.45rem;
  border: 1px solid rgba(19, 38, 47, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--muted);
}

.favorite-toggle.active {
  background: rgba(207, 106, 45, 0.12);
  border-color: rgba(207, 106, 45, 0.28);
  color: var(--brand);
}

.empty-state {
  padding: 1.2rem;
  border: 1px dashed rgba(23, 48, 58, 0.16);
  border-radius: 18px;
  text-align: center;
}

.map-stage {
  overflow: hidden;
  border-radius: 36px;
  background: linear-gradient(180deg, rgba(19, 38, 47, 0.92), rgba(12, 28, 35, 0.98));
}

.map-stage:fullscreen {
  width: 100vw;
  height: 100vh;
  border-radius: 0;
}

.map-canvas {
  position: absolute;
  inset: 0;
}

.map-toolbar-shell,
.map-control-panel,
.edit-tools-shell,
.legend-card {
  position: absolute;
  z-index: 450;
}

.map-toolbar-shell {
  top: 50%;
  left: 1rem;
  bottom: auto;
  width: auto;
  transform: translateY(-50%);
}

.map-floating-label {
  display: inline-flex;
  align-items: center;
  margin: 0 0 0.45rem;
  padding: 0.28rem 0.68rem;
  border-radius: 999px;
  background: rgba(19, 38, 47, 0.88);
  color: rgba(255, 247, 240, 0.96);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  box-shadow: 0 12px 26px rgba(7, 15, 18, 0.18);
  text-shadow: none;
}

.map-toolbar {
  display: grid;
  gap: 0.52rem;
  padding: 0.6rem;
  width: auto;
  background: rgba(255, 251, 245, 0.9);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 22px;
  box-shadow: 0 16px 34px rgba(10, 20, 24, 0.12);
}

.map-toolbar::-webkit-scrollbar {
  display: none;
}

.toolbar-chip {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 3rem;
  height: 3rem;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 15px;
  background: rgba(255, 251, 245, 0.92);
  color: var(--text);
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(10, 20, 24, 0.1);
  transition:
    transform 180ms ease,
    background 180ms ease,
    color 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease;
}

.toolbar-chip:hover,
.toolbar-chip:focus-visible {
  transform: translateX(2px);
  border-color: rgba(19, 38, 47, 0.18);
}

.toolbar-icon {
  display: grid;
  place-items: center;
  flex: 0 0 1.55rem;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 9px;
  background: rgba(19, 38, 47, 0.08);
}

.toolbar-icon svg,
.map-control-icon svg {
  width: 0.96rem;
  height: 0.96rem;
  stroke: currentColor;
  stroke-width: 1.9;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.toolbar-label {
  position: absolute;
  left: calc(100% + 0.72rem);
  top: 50%;
  max-width: 12rem;
  padding: 0.72rem 0.92rem;
  border: 1px solid rgba(255, 255, 255, 0.48);
  border-radius: 18px;
  background: rgba(255, 251, 245, 0.96);
  box-shadow: 0 14px 28px rgba(10, 20, 24, 0.14);
  opacity: 0;
  white-space: nowrap;
  font-size: 0.88rem;
  font-weight: 500;
  pointer-events: none;
  transform: translateY(-50%) translateX(-0.2rem);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.toolbar-chip.active {
  background: linear-gradient(135deg, #13262f, #224654);
  color: white;
  box-shadow: 0 12px 24px rgba(19, 38, 47, 0.22);
}

.toolbar-chip.active .toolbar-icon {
  background: rgba(255, 255, 255, 0.14);
}

.toolbar-chip:hover .toolbar-label,
.toolbar-chip:focus-visible .toolbar-label {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.map-control-panel {
  top: 1rem;
  right: 1rem;
  display: grid;
  gap: 0.42rem;
}

.edit-tools-shell {
  right: 1rem;
  bottom: 1rem;
}

.map-control-button {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 3rem;
  height: 3rem;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 15px;
  background: rgba(255, 251, 245, 0.92);
  color: var(--text);
  cursor: pointer;
  box-shadow: 0 14px 30px rgba(10, 20, 24, 0.12);
  transition:
    transform 180ms ease,
    background 180ms ease,
    color 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease;
}

.map-control-button:hover,
.map-control-button:focus-visible {
  transform: translateX(-2px);
  border-color: rgba(19, 38, 47, 0.18);
}

.map-control-icon {
  display: grid;
  place-items: center;
  flex: 0 0 1.55rem;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 9px;
  background: rgba(19, 38, 47, 0.08);
  color: var(--bg-deep);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.map-control-copy {
  position: absolute;
  right: calc(100% + 0.75rem);
  top: 50%;
  max-width: 12rem;
  padding: 0.72rem 0.92rem;
  border: 1px solid rgba(255, 255, 255, 0.48);
  border-radius: 18px;
  background: rgba(255, 251, 245, 0.96);
  box-shadow: 0 14px 28px rgba(10, 20, 24, 0.14);
  opacity: 0;
  font-size: 0.88rem;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  transform: translateY(-50%) translateX(0.2rem);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.map-control-button.active {
  background: linear-gradient(135deg, #13262f, #224654);
  color: white;
}

.map-control-button.active .map-control-icon {
  background: rgba(255, 255, 255, 0.14);
  color: white;
}

.map-control-button:hover .map-control-copy,
.map-control-button:focus-visible .map-control-copy {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.detail-card {
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1.1rem 1.2rem;
  background: rgba(255, 251, 245, 0.9);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.48);
  border-radius: 26px;
  box-shadow: 0 22px 56px rgba(7, 15, 18, 0.24);
}

.detail-card::-webkit-scrollbar {
  width: 8px;
}

.detail-card::-webkit-scrollbar-thumb {
  background: rgba(23, 48, 58, 0.16);
  border-radius: 999px;
}

.detail-image {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  margin-bottom: 0.95rem;
  border-radius: 20px;
  background: rgba(23, 48, 58, 0.06);
}

.detail-card h2 {
  margin-top: 0.15rem;
  font-size: 1.5rem;
}

.detail-meta,
.detail-description {
  margin: 0.7rem 0 0;
}

.image-credit,
.popup-credit {
  margin: 0.6rem 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.4;
}

.image-credit a {
  color: var(--brand);
  text-decoration: none;
}

.detail-tag {
  background: rgba(19, 38, 47, 0.06);
}

.quick-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(108px, 1fr));
  gap: 0.55rem;
  margin-top: 0.9rem;
}

.quick-info article {
  padding: 0.7rem;
  border-radius: 16px;
  background: rgba(19, 38, 47, 0.055);
  min-height: 4.4rem;
}

.quick-info span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
}

.quick-info strong {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.78rem;
  line-height: 1.3;
}

.detail-action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin-top: 0.8rem;
}

.route-button {
  width: 100%;
  margin-top: 0;
  padding: 0.82rem 1rem;
  border: 1px solid rgba(207, 106, 45, 0.18);
  border-radius: 999px;
  background: rgba(207, 106, 45, 0.1);
  color: var(--brand);
  cursor: pointer;
}

.export-button {
  width: 100%;
  padding: 0.82rem 1rem;
  border: 1px solid rgba(19, 38, 47, 0.12);
  border-radius: 999px;
  background: rgba(19, 38, 47, 0.92);
  color: white;
  cursor: pointer;
}

.route-button:disabled,
.export-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.detail-section {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(19, 38, 47, 0.1);
}

.compact-heading h3 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1rem;
}

.photo-catalog {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
  margin-top: 0.75rem;
}

.catalog-item {
  display: grid;
  gap: 0.35rem;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-decoration: none;
  text-align: left;
}

.catalog-item img {
  width: 100%;
  aspect-ratio: 1.3 / 1;
  object-fit: cover;
  border-radius: 14px;
  background: rgba(23, 48, 58, 0.06);
}

.catalog-item.active img {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

.catalog-item span {
  font-size: 0.78rem;
  font-weight: 700;
}

.catalog-item small {
  color: var(--muted);
  font-size: 0.66rem;
  line-height: 1.35;
}

.itinerary-list {
  display: grid;
  gap: 0.55rem;
  margin: 0.75rem 0 0;
  padding-left: 1.2rem;
  color: var(--muted);
  line-height: 1.45;
}

.stays-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.75rem;
}

.stay-card {
  padding: 0.58rem 0.72rem;
  border-radius: 999px;
  background: rgba(19, 38, 47, 0.06);
  color: var(--text);
  font-size: 0.78rem;
}

.legend-card {
  top: 1rem;
  left: 50%;
  bottom: auto;
  transform: translateX(-50%);
  width: auto;
  max-width: calc(100% - 16rem);
  padding: 0.55rem 0.68rem;
  background: linear-gradient(180deg, rgba(255, 251, 245, 0.94), rgba(247, 240, 231, 0.88));
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 22px;
  backdrop-filter: blur(12px);
  box-shadow: 0 16px 34px rgba(10, 20, 24, 0.12);
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.legend-head {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
}

.legend-head .legend-title {
  margin: 0;
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 0.3rem 0.72rem;
  border-radius: 999px;
  background: rgba(19, 38, 47, 0.9);
  color: rgba(255, 247, 240, 0.97);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  box-shadow: 0 10px 22px rgba(7, 15, 18, 0.16);
}

.legend-help {
  display: none;
}

.legend-list {
  display: flex;
  flex-direction: row;
  gap: 0.46rem;
  width: auto;
  align-items: center;
}

.legend-item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  padding: 0;
  border: 1px solid rgba(19, 38, 47, 0.09);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--text);
  cursor: pointer;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease,
    color 160ms ease;
}

.legend-item-copy {
  display: grid;
  place-items: center;
}

.legend-icon {
  display: grid;
  place-items: center;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 9px;
  background: rgba(19, 38, 47, 0.08);
  color: var(--legend-color);
}

.legend-icon svg {
  width: 0.98rem;
  height: 0.98rem;
  stroke: currentColor;
  stroke-width: 1.9;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.legend-label {
  position: absolute;
  left: 50%;
  top: calc(100% + 0.62rem);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.68rem 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.48);
  border-radius: 18px;
  background: rgba(255, 251, 245, 0.96);
  box-shadow: 0 14px 28px rgba(10, 20, 24, 0.14);
  opacity: 0;
  white-space: nowrap;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text);
  pointer-events: none;
  transform: translateX(-50%) translateY(-0.2rem);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.legend-label strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.8rem;
  padding: 0.18rem 0.42rem;
  border-radius: 999px;
  background: rgba(19, 38, 47, 0.08);
  color: var(--muted);
  font-size: 0.68rem;
}

.legend-item:hover,
.legend-item:focus-visible {
  transform: translateX(2px);
  border-color: rgba(19, 38, 47, 0.14);
  background: rgba(255, 255, 255, 0.86);
}

.legend-item.active {
  background: linear-gradient(135deg, #13262f, #224654);
  border-color: transparent;
  color: white;
  box-shadow: 0 14px 28px rgba(19, 38, 47, 0.18);
}

.legend-item.active .legend-icon {
  background: rgba(255, 255, 255, 0.14);
  color: white;
}

.legend-item.active .legend-label strong {
  background: rgba(19, 38, 47, 0.1);
  color: var(--text);
}

.legend-item.context {
  border-color: rgba(19, 38, 47, 0.14);
  background: rgba(19, 38, 47, 0.06);
}

.legend-item:hover .legend-label,
.legend-item:focus-visible .legend-label {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.legend-item:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.legend-item:disabled .legend-label {
  display: none;
}

.map-stage .leaflet-top.leaflet-left {
  top: auto;
  bottom: 1rem;
  left: 1rem;
  right: auto;
}

.leaflet-control-zoom {
  border: none;
  background: transparent;
  box-shadow: none;
}

.leaflet-control-zoom a {
  width: 44px;
  height: 44px;
  margin-bottom: 0.42rem;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 15px;
  background: rgba(255, 251, 245, 0.92);
  color: var(--bg-deep);
  line-height: 42px;
  box-shadow: 0 14px 26px rgba(10, 20, 24, 0.16);
}

.leaflet-right .leaflet-draw.leaflet-control {
  margin-top: 0;
  margin-bottom: 4.85rem;
  border: none;
  box-shadow: none;
}

.leaflet-draw-toolbar {
  display: flex;
  align-items: center;
  gap: 0.42rem;
}

.leaflet-draw-toolbar li {
  display: flex;
}

.leaflet-draw-toolbar a {
  width: 44px;
  height: 44px;
  margin-bottom: 0;
  margin-right: 0;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 15px;
  background-color: rgba(255, 251, 245, 0.92);
  box-shadow: 0 14px 26px rgba(10, 20, 24, 0.16);
}

.leaflet-touch .leaflet-draw-toolbar a {
  border-radius: 15px;
}

.leaflet-draw-toolbar a:hover {
  background-color: rgba(255, 255, 255, 0.98);
}

.leaflet-draw-toolbar-top a:first-child,
.leaflet-draw-toolbar-bottom a:last-child {
  border-radius: 15px;
}

.leaflet-draw.leaflet-control.collapsed .leaflet-draw-toolbar,
.leaflet-draw.leaflet-control.collapsed .leaflet-draw-actions {
  display: none;
}

.leaflet-draw-actions {
  position: static;
  left: auto;
  right: auto;
  display: flex;
  align-items: center;
  gap: 0.42rem;
  margin-left: 0.38rem;
  padding: 0;
  background: transparent;
  box-shadow: none;
  white-space: nowrap;
}

.leaflet-draw-actions li {
  display: flex;
}

.leaflet-draw-actions a {
  width: auto;
  height: auto;
  margin-bottom: 0;
  padding: 0.6rem 0.82rem;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 12px;
  background-color: rgba(255, 251, 245, 0.96);
  box-shadow: 0 10px 20px rgba(10, 20, 24, 0.12);
  color: var(--text) !important;
  text-decoration: none;
}

.leaflet-draw-tooltip {
  background: rgba(255, 251, 245, 0.98);
  color: var(--text);
  border: 1px solid rgba(19, 38, 47, 0.1);
  box-shadow: 0 12px 24px rgba(10, 20, 24, 0.14);
}

.leaflet-draw-tooltip::before {
  border-right-color: rgba(255, 251, 245, 0.98);
}

.leaflet-draw-tooltip-subtext {
  color: var(--muted);
}

.leaflet-error-draw-tooltip {
  color: #8f2d19;
  border-color: rgba(143, 45, 25, 0.18);
  background: rgba(255, 244, 241, 0.98);
}

.coord-chip-row {
  display: grid;
  gap: 0.35rem;
  margin-top: 0.7rem;
}

.coord-chip {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.48rem 0.6rem;
  border-radius: 12px;
  background: rgba(19, 38, 47, 0.05);
  font-size: 0.74rem;
}

.coord-chip span {
  color: var(--muted);
}

.coord-chip strong {
  color: var(--text);
  text-align: right;
}

.map-stage .leaflet-bottom.leaflet-right .leaflet-control-scale {
  margin-bottom: 5rem;
  border: none;
  background: transparent;
  box-shadow: none;
}

.map-stage .leaflet-bottom.leaflet-right .leaflet-control-scale-line {
  border-color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 251, 245, 0.88);
  color: var(--text);
}

.leaflet-touch .leaflet-bar a:first-child,
.leaflet-touch .leaflet-bar a:last-child {
  border-radius: 16px;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: rgba(255, 251, 245, 0.96);
}

.popup-card h3 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
}

.popup-image {
  display: block;
  width: 220px;
  max-width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  margin-bottom: 0.7rem;
  border-radius: 14px;
}

.popup-card p {
  margin: 0.45rem 0 0;
  color: var(--muted);
}

.popup-card .popup-credit {
  font-size: 0.68rem;
}

.popup-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.7rem;
}

.marker-halo {
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease;
}

.custom-marker {
  background: transparent;
  border: 0;
}

.marker-selected .marker-halo {
  transform: scale(1.22);
  box-shadow: 0 0 0 10px rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.92);
}

@media (max-width: 1220px) {
  body {
    overflow: auto;
  }

  .app-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: auto;
  }

  .sidebar,
  .map-stage,
  .detail-card {
    height: auto;
    min-height: auto;
  }

  .sidebar {
    overflow: visible;
  }

  .map-stage {
    height: 76vh;
  }

  .detail-card {
    max-height: none;
    overflow: visible;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 0.75rem;
  }

  .sidebar {
    padding: 0.85rem;
    border-radius: 26px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .map-toolbar {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
  }

  .map-toolbar-shell {
    top: 0.75rem;
    right: auto;
    left: 0.75rem;
    bottom: auto;
    width: auto;
    transform: none;
  }

  .map-control-panel {
    top: 0.75rem;
    right: 0.75rem;
    left: auto;
    bottom: auto;
    grid-template-columns: 1fr;
  }

  .edit-tools-shell {
    right: 0.75rem;
    bottom: 0.75rem;
  }

  .toolbar-chip,
  .map-control-button {
    width: 3rem;
    height: 3rem;
  }

  .toolbar-label,
  .map-control-copy {
    display: none;
  }

  .map-stage .leaflet-top.leaflet-left {
    top: auto;
    bottom: 0.75rem;
    left: 0.75rem;
    right: auto;
  }

  .legend-card {
    top: 4.55rem;
    left: 0.75rem;
    transform: none;
    max-width: calc(100% - 1.5rem);
    padding: 0.5rem 0.58rem;
  }

  .leaflet-right .leaflet-draw.leaflet-control {
    margin-bottom: 4.6rem;
  }

  .detail-action-row {
    grid-template-columns: 1fr;
  }

  .detail-card {
    width: auto;
  }

  .quick-info,
  .photo-catalog {
    grid-template-columns: 1fr;
  }
}
