:root {
  --bg: #f3f1ec;
  --paper: #fbfaf7;
  --ink: #241c2c;
  --muted: #756186;
  --line: #ddd9d1;
  --accent: #523c66;
  --accent-dark: #3b284b;
  --soft: #eae7ed;
  --gold: #aa844c;
  --shadow: 0 16px 45px rgba(31, 41, 37, 0.08);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family: Inter, system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
}
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 250px;
  background: #2d1e3a;
  color: #fff;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  z-index: 20;
}
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 4px 4px 28px;
}
.brand-mark {
  width: 44px;
  height: 44px;
  border: 1px solid #ffffff59;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: "Playfair Display";
}
.brand h1 {
  font-family: "Playfair Display";
  font-size: 18px;
  margin: 0;
}
.brand p {
  color: #beb3c8;
  font-size: 11px;
  margin: 3px 0 0;
}
.nav {
  display: grid;
  gap: 7px;
}
.nav-btn,
.ghost-btn {
  border: 0;
  background: transparent;
  color: #cec5d5;
  padding: 13px 14px;
  border-radius: 12px;
  text-align: left;
  display: flex;
  gap: 12px;
  align-items: center;
}
.nav-btn:hover,
.nav-btn.active {
  background: #ffffff17;
  color: #fff;
}
.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 7px;
}
.ghost-btn {
  border: 1px solid #ffffff1f;
  justify-content: center;
  font-size: 12px;
}
.import-label,
.upload-label {
  cursor: pointer;
}
.main {
  margin-left: 250px;
  min-height: 100vh;
  padding: 34px 44px 60px;
}
.topbar,
.place-detail-head,
.trip-hero,
.map-panel-header,
.section-heading,
.title-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}
.topbar {
  margin-bottom: 30px;
}
.topbar h2 {
  margin: 0;
  font: 700 36px "Playfair Display";
}
.top-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}
.eyebrow {
  margin: 0 0 7px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: #8d799e;
}
.primary-btn,
.secondary-btn,
.back-btn {
  border: 0;
  border-radius: 12px;
  padding: 12px 17px;
  font-weight: 600;
}
.primary-btn {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 20px #523c662e;
}
.primary-btn:hover {
  background: var(--accent-dark);
}
.secondary-btn {
  background: #efecf1;
  color: var(--ink);
}
.back-btn {
  background: transparent;
  padding-left: 0;
  color: var(--accent);
}
.full {
  width: 100%;
  margin-top: 5px;
}
.view {
  display: none;
}
.view.active {
  display: block;
}
.hero-card {
  background: #e3dde8;
  border-radius: 28px;
  min-height: 315px;
  padding: 46px 50px;
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  align-items: center;
  overflow: hidden;
}
.hero-card h3 {
  margin: 0;
  max-width: 680px;
  font: 700 44px/1.05 "Playfair Display";
}
.hero-card p:not(.eyebrow) {
  max-width: 620px;
  color: #655474;
  line-height: 1.7;
}
.hero-actions {
  display: flex;
  gap: 10px;
  margin-top: 25px;
}
.hero-orbit {
  display: grid;
  place-items: center;
}
.mini-globe {
  width: 210px;
  height: 210px;
  border-radius: 50%;
  border: 1px solid #2d1e3a40;
  display: grid;
  place-items: center;
  font-size: 40px;
  background: #d2c8db;
  box-shadow: var(--shadow);
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin: 18px 0 40px;
}
.stat-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px;
}
.stat-card span,
.place-meta,
.place-date {
  color: var(--muted);
  font-size: 12px;
}
.stat-card strong {
  display: block;
  margin-top: 7px;
  font: 700 30px "Playfair Display";
}
.section-heading {
  align-items: end;
  margin-bottom: 16px;
}
.section-heading h3 {
  margin: 0;
  font: 700 26px "Playfair Display";
}
.toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}
.search,
.select,
.modal input,
.modal select,
.modal textarea {
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--ink);
}
.search {
  flex: 1;
}
.select {
  min-width: 190px;
}
.select.small {
  min-width: 130px;
}
.place-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
}
.place-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  transition: 0.18s;
  cursor: pointer;
}
.place-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}
.place-cover {
  height: 175px;
  background: linear-gradient(135deg, #d4cdda, #e8e6df);
  display: grid;
  place-items: center;
  overflow: hidden;
  position: relative;
}
.place-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.place-placeholder {
  font: 700 42px "Playfair Display";
  color: #8b779c;
}
.card-favorite {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  color: var(--gold);
  box-shadow: 0 5px 15px #0002;
}
.place-body {
  padding: 17px;
}
.place-body h4 {
  margin: 0 0 7px;
  font: 700 21px "Playfair Display";
}
.place-date {
  margin-top: 6px;
}
.place-count {
  display: inline-block;
  margin-top: 12px;
  padding: 6px 9px;
  border-radius: 999px;
  background: var(--soft);
  font-size: 11px;
}
.tag-row {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 9px;
}
.tag {
  background: #f0edf2;
  border-radius: 999px;
  padding: 4px 7px;
  font-size: 10px;
  color: #665575;
}
.hidden {
  display: none !important;
}
.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--muted);
}
.empty-state h3 {
  color: var(--ink);
  font-family: "Playfair Display";
}
.map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 285px;
  gap: 18px;
}
.map-panel,
.country-panel,
.detail-map-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 22px;
}
.map-panel,
.country-panel {
  min-height: 630px;
}
.map-panel,
.detail-map-card {
  padding: 20px;
}
.map-panel-header {
  align-items: end;
  margin-bottom: 8px;
}
.map-panel-header h3 {
  margin: 0;
  font: 700 25px "Playfair Display";
}
.muted {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}
.globe-container {
  height: 520px;
  border-radius: 16px;
  overflow: hidden;
  background: radial-gradient(circle at center, #f0edf3, #dfd9e4);
}
#flatMap {
  width: 100%;
  height: 520px;
  background: #efecf1;
  border-radius: 16px;
}
.country {
  fill: #dad4e0;
  stroke: #f8f7f3;
  stroke-width: 0.6;
  cursor: pointer;
  transition: fill 0.15s;
}
.country:hover {
  fill: #b5a9c0;
}
.country.has-memories {
  fill: #654e7a;
}
.country.has-memories:hover {
  fill: #422e53;
}
.country-panel {
  padding: 26px;
}
.country-panel h3 {
  font: 700 27px "Playfair Display";
  margin: 0 0 10px;
}
.country-place-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}
.country-place-item {
  padding: 11px 12px;
  background: var(--soft);
  border-radius: 11px;
  cursor: pointer;
}
.map-status {
  font-size: 11px;
  color: var(--muted);
  margin-top: 10px;
}
.continent-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.continent-tab {
  border: 1px solid var(--line);
  background: var(--paper);
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--muted);
}
.continent-tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.country-hero,
.trip-hero {
  background: #e3dde8;
  padding: 30px 34px;
  border-radius: 22px;
  margin: 10px 0 24px;
}
.country-hero h3,
.trip-hero h3 {
  margin: 0;
  font: 700 38px "Playfair Display";
}
.detail-map-card {
  margin-bottom: 26px;
}
.detail-map-card > svg {
  width: 100%;
  height: 500px;
  background: #efecf1;
  border-radius: 16px;
}
.region-shape {
  fill: #d8d2de;
  stroke: #fff;
  stroke-width: 1;
  cursor: pointer;
  transition: 0.15s;
}
.region-shape:hover {
  fill: #a798b5;
}
.region-shape.has-memories {
  fill: #654e7a;
}
.region-shape.has-memories:hover {
  fill: #422e53;
}
.region-block {
  margin: 22px 0 30px;
  scroll-margin-top: 20px;
}
.region-block h4 {
  font: 700 24px "Playfair Display";
  margin: 0 0 13px;
}
.region-focus {
  padding: 18px;
  border: 1px solid #9b8aaa;
  border-radius: 18px;
  background: #f9f7fb;
}
.place-detail-head {
  align-items: end;
  margin: 10px 0 18px;
}
.place-detail-head h3 {
  font: 700 38px "Playfair Display";
  margin: 0;
}
.favorite-btn {
  border: 0;
  background: transparent;
  color: var(--gold);
  font-size: 28px;
  padding: 0;
}
.memory-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.meta-chip {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 13px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 12px;
}
.meta-chip b {
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #8d799e;
}
.photo-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 9px;
}
.photo-grid {
  columns: 4 230px;
  column-gap: 14px;
}
.photo-card {
  break-inside: avoid;
  margin: 0 0 14px;
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background: #ddd;
  cursor: zoom-in;
}
.photo-card img {
  width: 100%;
  display: block;
}
.photo-delete,
.photo-cover {
  position: absolute;
  top: 8px;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: #0008;
  color: #fff;
  opacity: 0;
  transition: 0.15s;
}
.photo-delete {
  right: 8px;
}
.photo-cover {
  right: 45px;
  color: #f4d69b;
}
.photo-card:hover .photo-delete,
.photo-card:hover .photo-cover {
  opacity: 1;
}
.trip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}
.trip-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 24px;
  cursor: pointer;
  transition: 0.18s;
}
.trip-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}
.trip-card h3 {
  font: 700 25px "Playfair Display";
  margin: 14px 0 8px;
}
.trip-card p {
  color: var(--muted);
  font-size: 13px;
  min-height: 40px;
}
.trip-card-head,
.trip-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 11px;
}
.trip-symbol {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #e5e0e9;
  color: var(--accent);
}
.trip-stats {
  border-top: 1px solid var(--line);
  padding-top: 15px;
  margin-top: 18px;
}
.modal,
.photo-modal {
  border: 0;
  border-radius: 22px;
  padding: 0;
  box-shadow: 0 30px 100px #00000047;
}
.modal::backdrop,
.photo-modal::backdrop {
  background: #140e1a85;
  backdrop-filter: blur(3px);
}
.modal form {
  width: min(680px, 90vw);
  max-height: 88vh;
  overflow: auto;
  padding: 27px;
  display: grid;
  gap: 14px;
}
.modal-head {
  display: flex;
  justify-content: space-between;
}
.modal-head h3 {
  margin: 0;
  font: 700 28px "Playfair Display";
}
.modal label {
  display: grid;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.check-row {
  display: flex !important;
  grid-template-columns: auto 1fr !important;
  align-items: center;
  gap: 9px !important;
}
.check-row input {
  width: auto;
}
.place-picker {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}
.place-picker legend {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  padding: 0 6px;
}
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.place-check {
  display: flex !important;
  flex-direction: row;
  gap: 9px !important;
  align-items: center;
  padding: 9px;
  border-radius: 10px;
  background: var(--soft);
}
.place-check input {
  width: auto;
}
.place-check span {
  display: flex;
  flex-direction: column;
}
.place-check small {
  font-weight: 400;
  color: var(--muted);
  margin-top: 2px;
}
.icon-btn {
  border: 0;
  background: transparent;
  font-size: 27px;
  color: var(--muted);
}
.photo-modal {
  background: #18141b;
  color: #fff;
  width: fit-content;
  min-width: min(300px, 94vw);
  max-width: min(1100px, 94vw);
  max-height: 94vh;
  max-height: 94dvh;
  overflow: hidden;
}
.photo-modal img {
  width: auto;
  height: auto;
  max-width: min(1100px, 94vw);
  max-height: calc(94vh - 64px);
  max-height: calc(94dvh - 64px);
  object-fit: contain;
  display: block;
  margin: 0 auto;
}
.photo-viewer-toolbar {
  height: 64px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  position: relative;
  z-index: 2;
}
.photo-caption {
  flex: 1;
  min-width: 0;
  width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #e9e5ec;
  font-size: 13px;
}
.photo-close,
.photo-actions summary {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  line-height: 1;
  font-size: 28px;
  color: #fff;
  background: #3b284b;
  border: 1px solid #9a87ab;
  border-radius: 50%;
  cursor: pointer;
}
.photo-close:focus-visible,
.photo-actions summary:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
}
.photo-actions { flex: 0 0 44px; }
.photo-actions summary { list-style: none; }
.photo-actions summary::-webkit-details-marker { display: none; }
.photo-actions-menu {
  position: absolute;
  top: 56px;
  right: 64px;
  max-width: calc(100% - 76px);
  padding: 8px;
  border: 1px solid #9a87ab;
  border-radius: 10px;
  background: #2d1e3a;
  box-shadow: 0 8px 24px #0006;
}
.photo-actions-menu a {
  display: block;
  padding: 10px 14px;
  color: #fff;
  text-decoration: none;
}
.photo-actions-menu a:hover,
.photo-actions-menu a:focus-visible { background: #523c66; }
@media (max-width: 1000px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .toolbar {
    flex-wrap: wrap;
  }
  .search {
    min-width: 100%;
  }
}
@media (max-width: 900px) {
  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    padding: 12px;
  }
  .nav {
    grid-template-columns: repeat(5, 1fr);
  }
  .brand,
  .sidebar-footer {
    display: none;
  }
  .nav-btn {
    justify-content: center;
    font-size: 12px;
  }
  .main {
    margin-left: 0;
    padding: 24px 18px;
  }
  .hero-card {
    grid-template-columns: 1fr;
    padding: 30px;
  }
  .hero-card h3 {
    font-size: 34px;
  }
  .hero-orbit {
    display: none;
  }
  .map-layout {
    grid-template-columns: 1fr;
  }
  .country-panel {
    min-height: 0;
  }
  .topbar {
    align-items: flex-start;
  }
  .top-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .form-row,
  .checkbox-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 600px) {
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
  .nav-btn span {
    display: none;
  }
  .place-detail-head,
  .trip-hero {
    align-items: flex-start;
    flex-direction: column;
  }
  .topbar {
    flex-direction: column;
  }
  .detail-map-card > svg {
    height: 390px;
  }
}

.place-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.danger-btn {
  border: 1px solid #b85c5c;
  background: #fff7f7;
  color: #9b3d3d;
  border-radius: 12px;
  padding: 12px 17px;
  font-weight: 600;
}
.danger-btn:hover {
  background: #fbeaea;
}

.storage-status {
  font-size: 10px;
  color: #b5a9c0;
  padding: 2px 8px 8px;
  line-height: 1.4;
}
.leaflet-map {
  height: 460px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #e9e5ed;
}
.leaflet-map.picker {
  height: 310px;
}
.location-picker-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  background: #f7f7f4;
}
.map-panel-header.compact {
  margin-bottom: 10px;
  align-items: center;
}
.map-panel-header.compact p {
  margin: 3px 0 0;
}
.timeline {
  display: grid;
  gap: 28px;
}
.timeline-year {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 20px;
}
.timeline-year > h3 {
  font: 700 34px "Playfair Display";
  margin: 0;
  color: var(--accent);
}
.timeline-items {
  border-left: 2px solid #d9d3df;
  padding-left: 22px;
  display: grid;
  gap: 12px;
}
.timeline-item {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  cursor: pointer;
}
.timeline-item:hover {
  box-shadow: var(--shadow);
}
.timeline-item .kind {
  font-size: 10px;
  letter-spacing: 0.13em;
  color: var(--muted);
  font-weight: 700;
}
.timeline-item h4 {
  margin: 5px 0;
  font: 700 20px "Playfair Display";
}
.trip-stop-editor {
  display: grid;
  gap: 8px;
}
.trip-stop-row {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) 90px 90px;
  gap: 8px;
  align-items: center;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #faf9f6;
}
.trip-stop-row .stop-main {
  display: flex;
  gap: 8px;
  align-items: center;
}
.trip-stop-row input[type="number"] {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.trip-day {
  margin: 26px 0;
}
.trip-day h4 {
  font: 700 24px "Playfair Display";
  margin: 0 0 12px;
}
.trip-day-list {
  display: grid;
  gap: 8px;
}
.trip-stop-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px;
  cursor: pointer;
}
.region-focus {
  outline: 2px solid #89749b;
  outline-offset: 5px;
}
.region-shape {
  fill: #dbd5e1;
  stroke: #fff;
  stroke-width: 1;
  cursor: pointer;
}
.region-shape:hover {
  fill: #a99ab6;
}
.region-shape.has-memories {
  fill: #654e7a;
}
.photo-storage-badge {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.55);
  color: white;
  border-radius: 999px;
  padding: 4px 7px;
  font-size: 9px;
}
@media (max-width: 700px) {
  .timeline-year {
    grid-template-columns: 1fr;
  }
  .trip-stop-row {
    grid-template-columns: 1fr 80px 80px;
  }
}

.trip-cover {
  height: 160px;
  margin: -1px -1px 14px;
  overflow: hidden;
  border-radius: 18px 18px 0 0;
  background: #e3dfe7;
}
.trip-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Atlas v1.5 · iPhone / PWA / NFC */
.nfc-arrival {
  display: flex;
  gap: 13px;
  align-items: flex-start;
  background: #f0ecf4;
  border: 1px solid #d3c9dc;
  border-radius: 16px;
  padding: 14px 16px;
  margin: 12px 0 18px;
}
.nfc-arrival p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}
.nfc-icon {
  font-size: 26px;
}
@supports (padding: max(0px)) {
  body {
    padding-bottom: env(safe-area-inset-bottom);
  }
}
@media (max-width: 700px) {
  body {
    background: var(--paper);
  }
  .sidebar {
    position: fixed;
    z-index: 50;
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    width: auto;
    height: auto;
    padding: 7px max(8px, env(safe-area-inset-right))
      max(7px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    background: #2d1e3a;
  }
  .nav {
    grid-template-columns: repeat(6, 1fr);
    gap: 2px;
  }
  .nav-btn {
    padding: 8px 2px;
    display: grid;
    gap: 2px;
    justify-items: center;
    font-size: 18px;
  }
  .nav-btn span {
    font-size: 8px;
    line-height: 1.05;
  }
  .sidebar-footer,
  .brand {
    display: none;
  }
  .main {
    margin-left: 0;
    padding: 20px 14px calc(88px + env(safe-area-inset-bottom));
  }
  .topbar {
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 20px;
  }
  .topbar h2 {
    font-size: 29px;
  }
  .top-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .top-actions button,
  .top-actions label {
    padding: 9px 10px;
    font-size: 11px;
  }
  .hero-card {
    padding: 25px 20px;
    min-height: 0;
    border-radius: 20px;
  }
  .hero-card h3 {
    font-size: 32px;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 9px;
  }
  .stat-card {
    padding: 15px;
  }
  .toolbar {
    display: grid;
  }
  .select {
    min-width: 0;
    width: 100%;
  }
  .map-layout {
    grid-template-columns: 1fr;
  }
  .country-panel {
    order: -1;
    padding: 18px;
  }
  .map-panel,
  .country-panel {
    min-height: 0;
  }
  .globe-container,
  #flatMap {
    height: 430px;
  }
  .photo-grid {
    columns: 2 150px;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  .modal form {
    width: min(96vw, 620px);
    max-height: 88vh;
    overflow: auto;
    padding: 20px;
  }
  .place-detail-head,
  .trip-hero {
    display: grid;
  }
  .continent-tabs {
    overflow: auto;
    flex-wrap: nowrap;
    padding-bottom: 5px;
  }
  .continent-tab {
    white-space: nowrap;
  }
}

/* ===== Atlas v1.6 · aportaciones ===== */
.contribution-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.contribution-list,
.pending-photo-list {
  display: grid;
  gap: 10px;
}
.contribution-card,
.pending-card {
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 14px;
  padding: 14px;
}
.contribution-card-head,
.pending-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.contribution-actions,
.pending-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.count-badge {
  display: grid;
  place-items: center;
  min-width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  font-weight: 700;
}
.status-pill {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  background: #efecf1;
}
.status-pill.off {
  background: #f4e7e7;
  color: #944;
}
.status-pill.expired {
  background: #f4efe1;
  color: #876c2a;
}
.contribute-shell {
  max-width: 640px;
  margin: 30px auto;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 28px;
}
.contribute-shell h3 {
  font: 700 34px "Playfair Display";
  margin: 5px 0 10px;
}
.contribute-form {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}
.contribute-form label {
  display: grid;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
}
.contribute-form input,
.contribute-form select {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: white;
}
.success-card {
  background: #f0ecf4;
  border: 1px solid #d3c9dc;
  border-radius: 16px;
  padding: 18px;
  text-align: center;
}
.pending-thumb {
  width: 84px;
  height: 84px;
  object-fit: cover;
  border-radius: 10px;
  background: #ddd;
}
.pending-card {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 12px;
}
@media (max-width: 850px) {
  .contribution-layout {
    grid-template-columns: 1fr;
  }
}

/* ===== Atlas v1.7 · perfiles locales ===== */
.profile-switcher {
  margin: 0 0 16px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  display: grid;
  gap: 6px;
}
.profile-switcher label {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #beb3c8;
  font-weight: 700;
}
.profile-switcher select {
  width: 100%;
  background: #372745;
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 9px;
  padding: 9px;
}
.profile-switcher small {
  font-size: 9px;
  color: #a89ab6;
  line-height: 1.3;
}
.profile-scope-badge {
  display: inline-block;
  margin-top: 7px;
  padding: 5px 8px;
  border-radius: 999px;
  background: #e9e5ec;
  color: #544562;
  font-size: 10px;
  font-weight: 700;
}
.owner-badge {
  display: inline-block;
  margin-top: 7px;
  padding: 4px 7px;
  border-radius: 999px;
  background: #efecf1;
  color: #705d81;
  font-size: 9px;
}
@media (max-width: 700px) {
  .profile-switcher {
    display: none;
  }
  .nav {
    grid-template-columns: repeat(7, 1fr);
  }
}

/* Atlas v1.7.1 · mapa de región */
.region-outline-map {
  background:
    radial-gradient(
      circle at 35% 30%,
      rgba(255, 255, 255, 0.8),
      rgba(255, 255, 255, 0) 35%
    ),
    #f0edf3;
}
.region-outline-map .leaflet-control-container {
  font-family: Inter, sans-serif;
}

.signed-out > .sidebar,
.signed-out > .main {
  display: none;
}
body:not(.signed-out) > #loginView {
  display: none;
}
#notice {
  position: fixed;
  right: 20px;
  top: 10px;
  z-index: 500;
  background: #fff3df;
  color: #49391f;
  border: 1px solid #aa844c;
  padding: 16px;
  max-width: 80vw;
  border-radius: 12px;
}
.photo-card:focus-within .photo-delete,
.photo-card:focus-within .photo-cover {
  opacity: 1;
}
.guest-mode .sidebar,
.guest-mode .topbar {
  display: none;
}
.guest-mode .main {
  margin: 0;
}
.guest-mode #loginView {
  display: none;
}
@media (hover: none) {
  .photo-delete,
  .photo-cover {
    opacity: 1;
  }
}
.mobile-session {
  display: none;
}
@media (max-width: 700px) {
  .mobile-session {
    display: inline-block;
  }
  .nav-btn span {
    display: block;
  }
}

/* Photo selection actions */
.photo-selection-bar {display:flex;flex-wrap:wrap;align-items:center;gap:10px;margin:16px 0;}
.photo-selection-bar button {min-height:44px;padding:8px 16px;border:1px solid var(--line);border-radius:12px;background:var(--paper);color:var(--ink);cursor:pointer;}
.photo-selection-bar button:disabled {opacity:.5;cursor:default;}
.photo-selection-bar [hidden], .photo-select[hidden] {display:none!important;}
.photo-select {position:absolute;top:12px;left:12px;width:28px;height:28px;z-index:2;accent-color:#523c66;cursor:pointer;}
.photo-selected {outline:3px solid #523c66;outline-offset:3px;}
.photo-selecting .photo-cover,.photo-selecting .photo-delete,.photo-selecting .photo-storage-badge {display:none;}

.upload-panel {position:fixed;right:12px;bottom:12px;z-index:1000;width:min(420px,calc(100vw - 24px));max-height:35vh;overflow:auto;background:var(--paper);color:var(--ink);padding:16px;border:1px solid var(--line);border-radius:14px;box-shadow:0 4px 24px #0003}
.upload-row {display:flex;flex-wrap:wrap;gap:8px;margin:10px 0}.upload-row span {width:100%;overflow-wrap:anywhere}.upload-row progress {flex:1}
#trashDialog {padding:24px;max-width:90vw;max-height:85dvh;overflow:auto}#trashList>div {display:flex;gap:16px;align-items:center;justify-content:space-between;padding:12px 0;border-bottom:1px solid var(--line)}
.photo-pending {min-height:160px;background:#e3dde8}
button:focus-visible,input:focus-visible,summary:focus-visible {outline:3px solid #af791b;outline-offset:3px}

@media(max-width:700px){.upload-panel{bottom:80px;max-height:30dvh}.toolbar{flex-wrap:wrap}.toolbar label{font-size:13px}.toolbar input[type=date]{max-width:140px}}

.main, .view { min-width: 0 }
.album-tiles { display:grid; width:100%; height:100%; grid-template-columns:1.4fr 1fr; grid-template-rows:1fr 1fr; gap:3px; overflow:hidden; background:var(--paper) }
.album-tiles img { display:block; width:100%; height:100%; min-width:0; min-height:0; object-fit:cover }
.album-tiles[data-count="1"] img, .album-tiles[data-count="3"] img:first-child { grid-row:span 2 }
.album-tiles[data-count="1"] img { grid-column:span 2 }
.album-tiles[data-count="2"] img { grid-row:span 2 }
.album-tiles[data-count="4"] { grid-template-columns:1fr 1fr }
.album-front { position:relative; overflow:hidden; border-radius:18px; height:clamp(185px,28vw,350px); margin:12px 0 20px }
.album-front:empty { display:none }
.album-navigation { position:absolute; bottom:12px; right:12px; display:flex; align-items:center; gap:6px; background:#231431ed; color:white; border-radius:24px; padding:3px 6px }
.album-navigation button { background:transparent; color:white; border:0; border-radius:50%; width:38px; height:38px; font-size:24px; cursor:pointer }
.album-page { font-size:12px; font-variant-numeric:tabular-nums }
.journal { max-width:100%; min-width:0; overflow:hidden; padding:clamp(12px,2vw,24px); border-radius:18px; background:#faf8f1; border:1px solid var(--line); color:#342342 }
.journal:empty { display:none }
.journal-scroll { overflow-x:auto; overscroll-behavior-x:contain; scrollbar-color:#857097 #e5e4d7; padding-bottom:8px }
.journal-track { position:relative; display:flex; min-width:100%; width:calc(var(--years) * 720px) }
#recentPlaces .journal-track { width:100%; min-width:290px }
@media (max-width:600px) { #recentPlaces .journal-months span { font-size:9px; padding-left:1px } }
.journal-year { flex:1; min-width:0; padding-top:4px; border-left:1px solid #d1c5db; background:repeating-linear-gradient(to right,transparent 0 calc(8.3333% - 1px), #927ea41a calc(8.3333% - 1px) 8.3333%) }
.journal-year strong { font:600 26px "Playfair Display",serif; padding-left:8px }
.journal-months { margin-top:7px; display:grid; grid-template-columns:repeat(12,1fr); color:#5e4e6c; font-size:11px; font-weight:600 }
.journal-months span { padding-left:6px }
.journal-axis,.journal-duration { position:absolute; top:68px; height:3px; background:#aa9cb7 }
.journal-axis { left:0; right:0; background:linear-gradient(to right,#623a86 var(--elapsed,0%),#aa9cb7 var(--elapsed,0%)) }
.journal-today { position:absolute; right:clamp(0px,calc(100% - var(--elapsed)),calc(100% - 28px)); top:4px; font-size:10px; color:#503a64 }
.journal-duration { height:5px; background:#765990; border-radius:3px }
.journal-point { position:absolute; top:68px; width:1px; height:calc(var(--drop) + 8px); background:#9683a6 }
.journal-point::before { content:""; position:absolute; top:-3px; left:-4px; width:9px; height:9px; border-radius:50%; background:#462860 }
.journal-trip,.journal-undated button,.journal-nav button { border:1px solid #bcb0c7; color:#3b2151; background:#fffef8; border-radius:9px; font:inherit; cursor:pointer }
.journal-trip { position:absolute; text-align:left; padding:6px 10px; max-width:142px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:13px; box-shadow:0 2px 5px #321f4310 }
.journal button:hover,.journal button:focus-visible { background:#e5dced }
.journal-nav { display:flex; justify-content:flex-end; gap:8px; margin-bottom:8px }
.journal-nav button,.journal-undated button { padding:7px 12px }
.journal-preview:not([hidden]) { display:flex; align-items:center; gap:14px; padding:12px; border-top:1px solid var(--line); margin-top:8px }
.journal-preview img { width:104px; height:72px; border-radius:9px; object-fit:cover }
.journal-link { display:block; font:600 19px "Playfair Display",serif; color:#3b2151; background:transparent; border:0; padding:3px 0; cursor:pointer }
.journal-preview small { color:#5b4c69 }
.journal-undated { margin-top:14px }
.journal-undated h4 { margin:0 0 8px }
.journal-undated button { margin:0 6px 4px 0 }

:root { --bg:#f8f4f9; --paper:#fffafc; --ink:#392f43; --muted:#706577; --line:#e5dbea; --accent:#795493; --accent-dark:#593968; --soft:#eee3f5; --shadow:0 12px 34px #593b7014 }
.sidebar { background:linear-gradient(165deg,#efe4f8,#dfcdeb 72%,#e8d8ed); color:#41304e; border-right:1px solid #d5c3e1 }
.sidebar .brand-mark { border-color:#a785ba; background:#ffffff55 }
.sidebar .nav-btn,.sidebar .ghost-btn,.sidebar .brand p,.sidebar .profile-switcher label,.sidebar .profile-switcher small,.sidebar .sidebar-footer small,.sidebar .sidebar-footer p { color:#543e64 }
.sidebar .nav-btn:hover,.sidebar .nav-btn.active { background:#fff9ffb8; color:#502d66 }
.sidebar .profile-switcher,.sidebar .ghost-btn { border-color:#bfa9cc; background:#ffffff40 }
.sidebar .profile-switcher select { background:#f7f0fb; color:#493453; border-color:#cbb4d6 }
.journal { position:relative; background:radial-gradient(ellipse at top left,#f0e2f7,transparent 57%),linear-gradient(115deg,#fffaf8,#fbf4fb); border:1px solid #e3d2e9; border-radius:24px; box-shadow:0 14px 36px #6e427110; padding:clamp(14px,2.3vw,30px) }
.journal-scroll { scrollbar-color:#b99bc9 #f3eaf4; padding-bottom:14px }
.journal-track { width:calc(var(--years) * 1140px) }
#recentPlaces .journal-track { min-width:296px }
.journal-year { border-left:1px dashed #cdb8d5; background:repeating-linear-gradient(to right,transparent 0 calc(8.3333% - 1px),#a080b010 calc(8.3333% - 1px) 8.3333%) }
.journal-year strong { font:italic 600 34px "Playfair Display",Georgia,serif; color:#694977; padding-left:12px }
.journal-axis,.journal-duration { top:var(--axis-y); border-radius:6px }
.journal-axis { height:3px; background:linear-gradient(to right,#a27ab7 var(--elapsed,0%),#d9c9df var(--elapsed,0%)) }
.journal-duration { background:#a982bd; pointer-events:none }
.journal-point { background:#c7abcF; pointer-events:none }
.journal-point::before { background:#956ca7; box-shadow:0 0 0 3px #eaddee; border:1px solid #fff }
.journal-point.above::before { top:auto; bottom:-5px }
.journal-trip { width:152px; max-width:152px; height:40px; box-sizing:border-box; text-align:center; font:600 15px "Playfair Display",Georgia,serif; border:1px solid #d8c1e0; border-radius:11px 16px 12px 9px; background:#fffafd; color:#54365e; box-shadow:0 4px 10px #63406d12; padding:7px 12px }
.journal-trip:hover,.journal-trip:focus-visible { background:#f4e7fb; border-color:#a27bb1 }
.journal-picker { display:inline-flex; align-items:center; gap:10px; margin-bottom:12px; padding:4px 6px 4px 15px; border:1px solid #d4bbdf; border-radius:24px; background:#fff9ff; color:#62476e; font-size:13px }
.journal-picker select { font:600 16px "Playfair Display",Georgia,serif; width:auto; border:0; border-radius:18px; background:#ebdcf3; color:#493057; padding:5px 9px; cursor:pointer }
.journal-preview:not(:popover-open) { display:none !important }
.journal-preview:popover-open:not([hidden]) { position:fixed; inset:auto; margin:0; display:block; width:min(222px,calc(100vw - 16px)); max-height:calc(100dvh - 16px); overflow:auto; padding:8px; border:1px solid #dbc8df; border-radius:14px; color:#503558; background:#fffbfd; box-shadow:0 12px 34px #4b2a5933,0 2px 6px #58345b18 }
.journal-print { height:115px; overflow:hidden; background:linear-gradient(115deg,#efe1f6,#f9edf1); border-radius:8px }
.journal-preview .journal-print img { width:100%; height:100%; border-radius:0; object-fit:cover }
.journal-caption { padding:7px 6px 3px }
.journal-location { font:600 12px system-ui; color:#775884 }
.journal-caption .journal-link { text-align:left; color:#503558; line-height:1.25 }
.journal-preview small { color:#75617d }

.sidebar { background:var(--accent); color:white }
.sidebar .nav-btn,.sidebar .ghost-btn,.sidebar .brand p,.sidebar .profile-switcher label,.sidebar .profile-switcher small,.sidebar .storage-status { color:#fff }
.sidebar .brand-mark,.sidebar .profile-switcher,.sidebar .ghost-btn { background:#ffffff0d; border-color:#ffffff61 }
.sidebar .nav-btn:hover,.sidebar .nav-btn.active { background:#ffffffed; color:var(--accent-dark) }
.journal-axis { background:linear-gradient(to right,var(--accent) var(--elapsed,0%),#cbb8da var(--elapsed,0%)) }
.journal-duration,.journal-point::before { background:var(--accent) }
.journal-year strong,.journal-trip,.journal-picker,.journal-link { color:var(--accent) }
.journal-trip { width:max-content; min-width:66px; max-width:min(168px,100%); height:36px }
.journal-picker select { background:var(--accent); color:#fff }

.journal-outgoing { position:absolute; margin:0; overflow:hidden; pointer-events:none; z-index:2 }
.journal-nav { align-items:center; gap:6px; margin:0 0 16px auto; width:fit-content; padding:4px; border-radius:32px; background:#eee3f4 }
.journal-nav .journal-page { display:inline-flex; align-items:center; justify-content:center; gap:8px; min-height:42px; padding:4px 12px; border:0; border-radius:24px; background:#fffaff; color:var(--accent-dark); font:600 14px "Playfair Display",Georgia,serif; box-shadow:0 2px 5px #69477a19 }
.journal-page .journal-arrow { display:grid; place-items:center; width:25px; height:25px; border-radius:50%; background:var(--accent); color:white; font:22px/1 Georgia,serif }
.journal-nav .journal-page:hover:not(:disabled),.journal-nav .journal-page:focus-visible { background:#e2cdec }
.journal-nav .journal-page:disabled { opacity:.55; cursor:default; box-shadow:none }

#timelineContainer .journal-track { width:calc(100% * var(--years)); min-width:0 }
#timelineContainer .journal-scroll { overflow-x:auto; touch-action:auto; scroll-snap-type:x mandatory; scrollbar-width:auto }
#timelineContainer .journal-year { flex:1 1 0; scroll-snap-align:start }
#approvalStatus:empty, #approveAllPending[hidden] { display:none }
@media(max-width:600px){ #timelineContainer .journal-months span { font-size:9px; padding-left:1px } }

:root { --accent:#593968; --accent-dark:#462b54 }

.sidebar .brand-mark { background:#faf4fc; border:0; flex-shrink:0 }
.brand-mark img { display:block; object-fit:contain }
.atlas-silueta { max-width:100%; height:auto; object-fit:contain }

#tripFeatured:not([hidden]) { display:block; width:min(100%,520px); max-height:300px; object-fit:contain; object-position:left center; border-radius:16px; margin:16px 0 }
#tripDetailDescription:not(:empty) { border-inline-start:3px solid #b99bc9; padding-inline-start:14px; font:italic 20px/1.5 "Playfair Display",Georgia,serif; white-space:pre-wrap; overflow-wrap:anywhere }
