:root {
  --rm-pane-bg: #ffffff;
  --rm-pane-muted-bg: #f6f7fb;
  --rm-pane-border: #e3e7ef;
  --rm-pane-shadow: rgba(15, 30, 70, 0.05);
  --rm-heading: #1f2736;
  --rm-text-muted: #6c778b;
  --rm-accent: #1353b4;
  --rm-accent-soft: rgba(19, 83, 180, 0.08);
  --rm-badge-major: #0d6efd;
  --rm-badge-town: #28a745;
  --rm-badge-variant: #ffc107;
}

.town-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1rem;
  background: var(--rm-pane-muted-bg);
  height: 100%;
  overflow: hidden;
}

.poi-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1rem;
  background: var(--rm-pane-muted-bg);
  height: 100%;
  overflow: hidden;
}

@media (max-width: 900px) {
  .town-screen {
    padding: 0.75rem;
  }

  .poi-screen {
    padding: 0.75rem;
  }
}

.town-screen__layout {
  flex: 1;
  min-height: 0;
}

.poi-screen__layout {
  flex: 1;
  min-height: 0;
}

.split-view {
  display: grid;
  grid-template-columns: minmax(260px, var(--split-view-sidebar-width, 360px)) minmax(0, 1fr);
  gap: var(--split-view-gap, 1.25rem);
  height: 100%;
  min-height: 0;
}

.split-view__pane {
  background: var(--rm-pane-bg);
  border: 1px solid var(--rm-pane-border);
  border-radius: 16px;
  box-shadow: 0 8px 22px var(--rm-pane-shadow);
  display: flex;
  flex-direction: column;
  padding: 0;
  min-height: 0;
}

.split-view__pane-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.split-view__pane--sidebar {
  background: var(--rm-pane-bg);
}

.split-view__pane--detail {
  background: var(--rm-pane-bg);
}

.split-view__mobile-header {
  display: none;
}

.split-view__mobile-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--rm-heading);
}

.split-view__back-button {
  border: none;
  background: none;
  color: var(--rm-accent);
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.4rem;
  border-radius: 999px;
  font-size: 0.95rem;
}

.split-view__back-button::before {
  content: '←';
  font-size: 0.9rem;
}

.split-view__back-button:hover {
  background: var(--rm-accent-soft);
}

@media (max-width: 900px) {
  .split-view {
    grid-template-columns: 1fr;
  }

  .split-view__mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--rm-pane-border);
    gap: 0.75rem;
  }

  .split-view--stacked .split-view__pane {
    display: none;
  }

  .split-view--stacked .split-view__pane.is-active {
    display: flex;
  }
}

.town-screen__pane-header {
  padding: 1rem 1.25rem 0.5rem;
  border-bottom: none;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.poi-screen__pane-header {
  padding: 1rem 1.25rem 0.75rem;
  border-bottom: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.town-screen__pane-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--rm-heading);
}

.poi-screen__pane-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--rm-heading);
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
}

.town-screen__count {
  font-size: 0.9rem;
  color: var(--rm-text-muted);
  font-weight: 500;
}

.poi-screen__count {
  font-size: 0.9rem;
  color: var(--rm-text-muted);
  font-weight: 500;
}

.poi-screen__new-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  font-size: 0.9rem;
}

.poi-screen__new-btn-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.poi-screen__new-menu {
  position: absolute;
  top: calc(100% + 0.35rem);
  right: 0;
  display: none;
  flex-direction: column;
  background: #ffffff;
  border: 1px solid var(--rm-pane-border);
  border-radius: 0.65rem;
  box-shadow: 0 15px 35px rgba(15, 23, 42, 0.15);
  padding: 0.35rem;
  min-width: 200px;
  z-index: 10;
}

.poi-screen__new-menu.is-visible {
  display: flex;
}

.poi-screen__new-menu-item {
  border: none;
  background: transparent;
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-radius: 0.45rem;
  font-size: 0.9rem;
  color: var(--rm-heading);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.poi-screen__new-menu-item:hover {
  background: rgba(13, 110, 253, 0.08);
  color: #0d6efd;
}

.town-screen__search {
  padding: 0.25rem 1.25rem 0.75rem;
  border-bottom: none;
}

.poi-screen__filters {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0 1.25rem 0.75rem;
}

.poi-screen__filter-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--rm-heading);
}

.poi-screen__filter-select {
  width: 100%;
  border-radius: 0.5rem;
  border: 1px solid var(--rm-pane-border);
  padding: 0.5rem 0.75rem;
  font-size: 0.95rem;
}

.poi-screen__checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--rm-heading);
  cursor: pointer;
}

.town-screen__search-input {
  width: 100%;
  border: none;
  border-radius: 999px;
  padding: 0.65rem 1rem;
  background: #eef1f6;
  font-size: 0.95rem;
  color: var(--rm-heading);
  outline: none;
  transition: box-shadow 0.2s ease, background 0.2s ease;
}

.poi-screen__search-input {
  width: 100%;
  border-radius: 999px;
  border: none;
  padding: 0.65rem 1rem;
  background: #eef1f6;
  font-size: 0.95rem;
  color: var(--rm-heading);
  outline: none;
  transition: box-shadow 0.2s ease, background 0.2s ease;
}

.poi-screen__search-input:focus {
  background: #e4e8f1;
  box-shadow: 0 0 0 2px var(--rm-accent-soft);
}

.town-screen__search-input:focus {
  background: #e4e8f1;
  box-shadow: 0 0 0 2px var(--rm-accent-soft);
}

.town-screen__search-input::placeholder {
  color: rgba(31, 39, 54, 0.45);
}

.poi-screen__search-input::placeholder {
  color: rgba(31, 39, 54, 0.45);
}

.town-screen__list {
  flex: 1;
  padding: 1rem 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow-y: auto;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}

.poi-screen__list {
  flex: 1;
  padding: 0.75rem 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  overflow-y: auto;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}

.town-screen__list--empty {
  justify-content: center;
  align-items: center;
}

.poi-screen__list--empty {
  justify-content: center;
  align-items: center;
}

.town-screen__empty {
  text-align: center;
  color: var(--rm-text-muted);
  padding: 2rem 1rem;
  line-height: 1.6;
}

.poi-screen__empty {
  text-align: center;
  color: var(--rm-text-muted);
  padding: 2rem 1rem;
  line-height: 1.6;
}

.poi-card {
  padding: 0.85rem 1rem;
  border: 1px solid var(--rm-pane-border);
  border-radius: 14px;
  background: #f8f9fb;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.1s ease;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.poi-card:hover {
  border-color: var(--rm-accent);
}

.poi-card--selected {
  border-color: var(--rm-accent);
  box-shadow: 0 0 0 2px var(--rm-accent-soft);
  background: #fff;
}

.poi-card__name {
  font-weight: 600;
  color: var(--rm-heading);
  font-size: 1rem;
}

.poi-card__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.poi-card__meta {
  font-size: 0.85rem;
  color: var(--rm-text-muted);
}

.poi-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--rm-pane-muted-bg);
  color: var(--rm-heading);
}

.poi-badge--category {
  background: #6c757d;
  color: #fff;
}

.poi-badge--alert {
  background: #dc3545;
  color: #fff;
}

.poi-badge--archived {
  background: #dc3545;
  color: #fff;
}

.poi-screen__details-content {
  padding: 1.5rem;
  overflow-y: auto;
  min-height: 0;
  background: transparent;
}

.poi-screen__editor-placeholder {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--rm-text-muted);
}

.poi-screen__summary {
  background: var(--rm-pane-muted-bg);
  border: 1px solid var(--rm-pane-border);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

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

.poi-summary__actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.poi-summary__archive {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: var(--rm-heading);
}

.poi-summary__meta {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--rm-text-muted);
}

.poi-summary__meta strong {
  color: var(--rm-heading);
  font-weight: 600;
}

.poi-summary__section {
  border-top: 1px solid var(--rm-pane-border);
  padding-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.poi-summary__section-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--rm-heading);
}

.poi-summary__row {
  font-size: 0.85rem;
  color: var(--rm-text-muted);
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.poi-summary__row span {
  color: var(--rm-heading);
}

.poi-summary__coordinates {
  font-size: 0.85rem;
  color: var(--rm-text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.poi-summary__coord-saved {
  color: #198754;
  font-weight: 600;
}

.poi-summary__coord-pending {
  color: #ff6b35;
  font-weight: 600;
}

.poi-summary__coord-save {
  align-self: flex-start;
}

.poi-summary__description {
  font-size: 0.9rem;
  color: var(--rm-text-muted);
  margin: 0;
}

.town-card {
  padding: 0.75rem 0;
  cursor: pointer;
  transition: color 0.2s ease;
  border-bottom: 1px solid var(--rm-pane-border);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.town-card:last-child {
  border-bottom: none;
}

.town-card:hover .town-card__name {
  color: var(--rm-accent);
}

.town-card--selected {
  font-weight: 600;
  background: var(--rm-accent-soft);
  border-radius: 12px;
  margin: 0 -0.5rem;
  padding: 0.75rem 0.5rem;
}

.town-card--selected .town-card__name {
  color: var(--rm-accent);
}

.town-card__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.town-card__badges {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  flex-wrap: wrap;
}

.town-card__name {
  font-weight: 600;
  color: var(--rm-heading);
  font-size: 1rem;
}

.town-badge {
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  background: #e2e7f1;
  color: var(--rm-heading);
}

.town-badge--major {
  background: var(--rm-badge-major);
  color: #fff;
}

.town-badge--town {
  background: var(--rm-badge-town);
  color: #fff;
}

.town-badge--variant {
  background: var(--rm-badge-variant);
  color: #1e2023;
}

.town-badge--merge {
  background: linear-gradient(135deg, #dc3545, #c82333);
  color: #fff;
}

.town-card__nickname {
  font-size: 0.9rem;
  color: var(--rm-text-muted);
  font-style: italic;
}

.town-card__meta {
  font-size: 0.85rem;
  color: var(--rm-text-muted);
  font-family: Menlo, Consolas, 'Roboto Mono', monospace;
  margin-top: 0.4rem;
  line-height: 1.5;
}

.town-screen__details-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  padding-bottom: 5rem;
  min-height: 0;
  position: relative;
}

@media (max-width: 640px) {
  .town-screen__details-content {
    padding: 1rem;
    padding-bottom: 4rem;
  }
}

.split-view__detail-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid var(--rm-pane-border);
  background: var(--rm-pane-muted-bg);
  position: sticky;
  top: 0;
  z-index: 5;
}

.split-view__detail-toolbar-left {
  display: flex;
  align-items: center;
}

@media (max-width: 640px) {
  .split-view__detail-toolbar {
    padding: 0.75rem 1rem;
  }
}

.town-editor {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  min-height: 100%;
}


.town-form-grid {
  display: grid;
  gap: 0.75rem;
}

.town-name-nickname-row {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.town-coords-elevation-row {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.town-screen .poi-editor-column {
  border: none;
  box-shadow: none;
  min-width: 0;
  padding: 0;
  background: transparent;
}

.town-screen .poi-editor-column .form-group label {
  color: var(--rm-heading);
}

.mui-textfield {
  margin-bottom: 0;
}

.mui-textfield>input,
.mui-textfield>textarea {
  border: 1px solid var(--rm-pane-border);
  border-radius: 10px;
  padding: 0.9rem 0.95rem;
  background: var(--rm-pane-bg);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  box-shadow: none;
  min-height: 48px;
  color: var(--rm-heading);
}

.mui-textfield>input:focus,
.mui-textfield>textarea:focus {
  border-color: var(--rm-accent);
  box-shadow: 0 0 0 3px var(--rm-accent-soft);
}

.mui-textfield>input,
.mui-textfield>textarea {
  border-bottom: none;
}

.mui-textfield:before,
.mui-textfield:after {
  display: none !important;
}

.mui-textfield>textarea {
  min-height: 45px;
  resize: vertical;
}

.mui-textfield>input::placeholder,
.mui-textfield>textarea::placeholder {
  color: rgba(31, 39, 54, 0.45);
}

.town-editor .form-group {
  margin-bottom: 1rem;
}

.town-editor__title {
  margin-bottom: 1.5rem;
}

.town-editor__title h3 {
  margin: 0;
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--rm-heading);
}

.town-editor__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-top: 0.65rem;
}

.town-editor__distance {
  font-size: 0.95rem;
  color: var(--rm-text-muted);
}

.town-editor__badges {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.town-checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  align-items: center;
}

.town-checkbox-group .mui-checkbox input[type="checkbox"] {
  margin-right: 0.4rem;
}

.mui-checkbox.is-hidden {
  display: none;
}

.mui-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.95rem;
  color: var(--rm-heading);
  line-height: 1.1;
}

.mui-checkbox input[type="checkbox"] {
  margin: 0;
  position: relative;
  top: 0;
}

.town-editor .mui-textfield label {
  color: var(--rm-accent);
}

.town-services__header {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--rm-heading);
  margin-bottom: 0.75rem;
}

.town-services__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
}

@media (max-width: 640px) {
  .town-services__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* POI Details Tabs */
.poi-details-tabs {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.poi-details-tabs__header {
  display: flex;
  gap: 0.5rem;
  padding: 0.35rem;
  border: 1px solid var(--rm-pane-border);
  border-radius: 999px;
  background: var(--rm-pane-muted-bg);
  margin-bottom: 1.5rem;
}

.poi-details-tabs__tab {
  background: #ffffff;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.45rem 1.35rem;
  cursor: pointer;
  font-size: 0.93rem;
  font-weight: 500;
  color: var(--rm-text-muted);
  transition: all 0.2s ease;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.poi-details-tabs__tab:hover {
  color: var(--rm-accent);
  border-color: rgba(19, 83, 180, 0.35);
  box-shadow: 0 2px 6px rgba(19, 83, 180, 0.15);
}

.poi-details-tabs__tab.active {
  color: #fff;
  background: var(--rm-accent);
  border-color: var(--rm-accent);
  box-shadow: 0 4px 10px rgba(19, 83, 180, 0.35);
}

.poi-details-tabs__content {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

/* POI Read-Only Details */
.poi-details {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.poi-details__section {
  background: var(--rm-pane-muted-bg);
  border: 1px solid var(--rm-pane-border);
  border-radius: 12px;
  padding: 1rem 1.25rem;
}

.poi-details__section-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--rm-heading);
  margin: 0 0 0.75rem 0;
}

.poi-details__section-content {
  font-size: 0.9rem;
  color: var(--rm-text-muted);
  line-height: 1.6;
}

.poi-details__section-content strong {
  color: var(--rm-heading);
}

.poi-details__section-content a {
  color: var(--rm-accent);
  text-decoration: none;
}

.poi-details__section-content a:hover {
  text-decoration: underline;
}

.poi-details__header {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.poi-details__name {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--rm-heading);
}

.poi-details__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.poi-details__list {
  margin: 0;
  padding: 0 0 0 1.25rem;
}

.poi-details__list li {
  margin-bottom: 0.5rem;
}

.poi-details__images-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.75rem;
}

.poi-details__image {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--rm-pane-border);
}

.poi-details__image img {
  width: 100%;
  height: 120px;
  object-fit: cover;
}

.poi-details__image-badge {
  position: absolute;
  top: 0.35rem;
  left: 0.35rem;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
}
.poi-details__portal-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.poi-details__portal-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  max-width: 220px;
}

.poi-details__id {
  font-size: 0.8rem;
  color: var(--rm-text-muted);
  background: #f0f2f5;
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  font-family: Menlo, Consolas, monospace;
  user-select: all;
}
