:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-soft: #f8fbff;
  --ink: #162033;
  --muted: #6f7b90;
  --line: #e5ebf3;
  --primary: #397ef6;
  --primary-soft: rgba(57, 126, 246, 0.12);
  --success: #1f8f53;
  --success-soft: rgba(31, 143, 83, 0.12);
  --danger: #f05b4f;
  --danger-soft: rgba(240, 91, 79, 0.12);
  --warning: #f6a623;
  --warning-soft: rgba(246, 166, 35, 0.12);
  --shadow: 0 18px 45px rgba(26, 42, 68, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "PingFang SC", "Helvetica Neue", sans-serif;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 34px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand-row {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 28px;
}

.brand-logo {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
}

.topnav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topnav-link {
  padding: 10px 14px;
  border-radius: 12px;
  color: var(--muted);
}

.topnav-link.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}

.userbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.global-search {
  flex: 1;
  max-width: 560px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.global-search-input {
  min-width: 240px;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #edf2fb;
  color: var(--muted);
  font-weight: 700;
}

.page-shell {
  width: min(1280px, calc(100vw - 48px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.eyebrow {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary);
}

.page-title {
  margin: 10px 0 0;
  font-size: 42px;
  line-height: 1.15;
}

.page-subtitle {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.panel,
.stats-card,
.list-card,
.side-card,
.login-card,
.table-card,
.editor-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.stats-card {
  padding: 20px;
}

.stats-value {
  font-size: 34px;
  font-weight: 700;
}

.stats-label {
  margin-top: 8px;
  color: var(--muted);
}

.filters-bar,
.toolbar-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px;
  margin-bottom: 20px;
}

.filters-row,
.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.search-input,
.field,
textarea,
select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  outline: none;
}

.field-inline {
  min-width: 180px;
}

textarea {
  resize: vertical;
}

.primary-button,
.ghost-button,
.danger-button,
.text-button,
.icon-button {
  border: none;
  border-radius: 14px;
  padding: 11px 16px;
  transition: transform 140ms ease, opacity 140ms ease;
}

.primary-button:hover,
.ghost-button:hover,
.danger-button:hover,
.text-button:hover {
  transform: translateY(-1px);
}

.primary-button {
  background: var(--primary);
  color: #fff;
}

.ghost-button {
  background: #f2f5fb;
  color: #33425f;
}

.danger-button {
  background: var(--danger-soft);
  color: var(--danger);
}

.text-button {
  padding: 0;
  background: transparent;
  color: var(--primary);
}

.text-button.success {
  color: var(--success);
}

.icon-button {
  width: 38px;
  height: 38px;
  padding: 0;
  background: #f2f5fb;
  color: var(--muted);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 70px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.status-badge.draft {
  background: #eef2f7;
  color: #6d7788;
}

.status-badge.published {
  background: var(--success-soft);
  color: var(--success);
}

.status-badge.offline {
  background: var(--danger-soft);
  color: var(--danger);
}

.status-badge.enabled {
  background: var(--success-soft);
  color: var(--success);
}

.status-badge.disabled {
  background: #eef2f7;
  color: #6d7788;
}

.crumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  color: var(--muted);
}

.layout-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
}

.side-card,
.list-card,
.table-card,
.editor-card {
  padding: 20px;
}

.side-section + .side-section {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.section-title {
  margin: 0 0 12px;
  font-size: 18px;
}

.stack {
  display: grid;
  gap: 12px;
}

.region-group {
  display: grid;
  gap: 10px;
}

.region-name {
  color: var(--muted);
  font-size: 13px;
}

.country-list,
.city-list {
  display: grid;
  gap: 10px;
}

.country-item,
.city-item,
.poi-row-card,
.tag-row,
.country-row,
.city-row {
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
}

.country-item.active,
.city-item.active {
  border-color: rgba(57, 126, 246, 0.25);
  background: rgba(57, 126, 246, 0.08);
}

.country-top,
.city-top,
.row-top,
.row-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.country-meta,
.city-meta,
.helper-text,
.muted {
  color: var(--muted);
}

.empty-state {
  padding: 48px 20px;
  text-align: center;
  color: var(--muted);
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 18px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
}

.table tr:last-child td {
  border-bottom: none;
}

.poi-main {
  display: flex;
  align-items: center;
  gap: 14px;
}

.poi-cover {
  width: 76px;
  height: 76px;
  border-radius: 16px;
  object-fit: cover;
  background: #eef2f7;
}

.poi-name {
  font-size: 20px;
  font-weight: 700;
}

.row-links {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.row-link {
  color: var(--primary);
}

.row-link.danger {
  color: var(--danger);
}

.row-link.success {
  color: var(--success);
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-top: 18px;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ghost-button:disabled,
.primary-button:disabled,
.danger-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.region-toolbar {
  align-items: center;
}

.region-toolbar-title {
  font-size: 30px;
  font-weight: 700;
}

.region-toolbar-actions {
  justify-content: flex-end;
  width: 100%;
}

.region-search-form {
  flex: 1;
  min-width: 280px;
  max-width: 360px;
}

.region-search-input {
  min-width: 100%;
}

.region-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.region-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.region-card-head {
  padding: 22px 24px 0;
}

.region-card-title {
  margin: 0;
  font-size: 18px;
  line-height: 1.4;
}

.region-card-title span {
  color: var(--muted);
  font-weight: 500;
}

.region-card-body {
  padding: 18px 24px 24px;
}

.region-table-scroll {
  max-height: 560px;
  overflow: auto;
  border-radius: 18px;
}

.region-table {
  table-layout: fixed;
}

.region-table th,
.region-table td {
  padding: 16px 12px;
  font-size: 14px;
}

.region-table th:first-child,
.region-table td:first-child {
  width: 58%;
}

.region-table th:nth-child(2),
.region-table td:nth-child(2) {
  width: 18%;
}

.country-link-button {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--ink);
  font-weight: 600;
  text-align: left;
}

.country-link-button:hover {
  color: var(--primary);
}

.country-link-main,
.country-link-sub {
  display: block;
}

.country-link-main {
  font-weight: 700;
}

.country-link-sub {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.country-row-actions {
  margin-top: 6px;
}

.region-row-active td {
  background: rgba(57, 126, 246, 0.06);
}

.region-empty-cell {
  color: var(--muted);
  text-align: center;
}

.pagination-summary,
.page-indicator {
  color: var(--muted);
}

.region-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.region-card-summary {
  color: var(--muted);
  font-size: 13px;
}

.region-card-controls {
  flex-wrap: nowrap;
}

.region-card-controls .ghost-button {
  padding: 9px 14px;
  white-space: nowrap;
  min-width: 88px;
}

.region-card-controls .page-indicator {
  white-space: nowrap;
}

.geo-management-panel {
  padding: 24px;
}

.geo-management-head {
  margin-bottom: 16px;
}

.geo-management-title {
  font-size: 30px;
  margin: 8px 0 0;
}

.geo-city-table-card {
  padding: 0;
  border: 1px solid var(--line);
  box-shadow: none;
}

.geo-split-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  min-height: calc(100vh - 220px);
}

.geo-left-panel,
.geo-right-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.geo-left-panel {
  position: sticky;
  top: 96px;
  max-height: calc(100vh - 126px);
  overflow: auto;
  padding: 12px;
}

.geo-right-panel {
  min-width: 0;
  padding: 24px;
}

.country-region-section + .country-region-section {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.region-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-align: left;
}

.region-toggle:hover {
  background: var(--panel-soft);
  color: var(--ink);
}

.country-region-list {
  display: grid;
  gap: 6px;
  padding-top: 6px;
}

.country-row-button {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 8px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.country-row-button:hover,
.country-row-button.active {
  border-color: rgba(57, 126, 246, 0.2);
  background: rgba(57, 126, 246, 0.08);
}

.country-row-main {
  grid-column: 1;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.country-row-sub {
  grid-column: 1;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.country-code-badge {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  padding: 5px 8px;
  border-radius: 999px;
  background: #edf2fb;
  color: #50617e;
  font-size: 12px;
  font-weight: 800;
}

.right-panel-section {
  min-width: 0;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-tabs {
  display: inline-flex;
  gap: 6px;
  padding: 6px;
  margin-bottom: 18px;
  border-radius: 16px;
  background: #f2f5fb;
}

.panel-tab {
  border: none;
  border-radius: 12px;
  padding: 10px 16px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.panel-tab.active {
  background: #fff;
  color: var(--primary);
  box-shadow: 0 8px 20px rgba(26, 42, 68, 0.08);
}

.embedded-table-card {
  padding: 0;
  border: 1px solid var(--line);
  box-shadow: none;
  overflow: auto;
}

.country-poi-panel {
  display: grid;
  gap: 14px;
}

.local-poi-filters {
  justify-content: space-between;
}

.filter-pill-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
}

.filter-pill button {
  border: none;
  background: transparent;
  color: inherit;
  font-weight: 900;
  padding: 0 2px;
}

.local-poi-count {
  font-size: 13px;
}

.compact-poi-main .poi-name {
  font-size: 17px;
}

.global-result-list {
  display: grid;
  gap: 12px;
}

.global-result-card {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto 150px auto;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel-soft);
}

.global-result-thumb {
  width: 72px;
  height: 72px;
  border-radius: 14px;
  object-fit: cover;
  background: #eef2f7;
}

.global-result-main {
  min-width: 0;
}

.global-result-title {
  font-size: 17px;
  font-weight: 800;
}

.editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
}

.editor-card {
  display: grid;
  gap: 20px;
}

.editor-section + .editor-section {
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.editor-grid label,
.form-stack label {
  display: grid;
  gap: 8px;
}

.full-width {
  grid-column: 1 / -1;
}

.checkbox-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.checkbox-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
}

.editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.preview-card {
  position: sticky;
  top: 94px;
  padding: 20px;
}

.preview-cover {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: 18px;
  background: #eef2f7;
}

.preview-title {
  margin-top: 16px;
  font-size: 26px;
  font-weight: 700;
}

.preview-sub {
  margin-top: 10px;
  color: var(--muted);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.upload-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.upload-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-soft);
  padding-bottom: 12px;
}

.upload-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: #eef2f7;
}

.upload-caption {
  padding: 10px 12px 0;
  font-size: 12px;
  color: var(--muted);
  word-break: break-word;
  overflow-wrap: anywhere;
}

.upload-source-field {
  display: grid;
  gap: 6px;
  padding: 10px 12px 0;
}

.upload-source-field span {
  font-size: 12px;
  color: var(--muted);
}

.error-banner {
  margin-bottom: 4px;
  background: #fff2f0;
  border-color: #ffc8c2;
  color: #b42318;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: #eef4ff;
  color: var(--primary);
  font-size: 12px;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(480px, 100%);
  padding: 28px;
}

.login-grid {
  display: grid;
  gap: 14px;
  margin-top: 24px;
}

.message-banner {
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: 16px;
  background: #fff8e8;
  border: 1px solid #f4e2a2;
  color: #9a6a00;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
}

.modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(17, 25, 40, 0.4);
}

.modal-card {
  position: relative;
  width: min(520px, calc(100vw - 32px));
  margin: 12vh auto 0;
  background: #fff;
  border-radius: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  padding: 20px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.modal-head h3 {
  margin: 0;
  font-size: 22px;
}

.modal-body {
  margin-top: 16px;
  color: var(--muted);
  line-height: 1.7;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 90;
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(18, 30, 48, 0.92);
  color: #fff;
  box-shadow: var(--shadow);
}

@media (max-width: 1100px) {
  .layout-grid,
  .editor-layout {
    grid-template-columns: 1fr;
  }

  .region-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .preview-card {
    position: static;
  }
}

@media (max-width: 760px) {
  .topbar,
  .page-shell {
    width: calc(100vw - 24px);
    padding-left: 0;
    padding-right: 0;
  }

  .topbar {
    width: 100%;
    padding: 16px 12px;
    flex-direction: column;
    align-items: flex-start;
  }

  .brand-row,
  .topnav,
  .filters-row,
  .toolbar-actions,
  .page-head,
  .pagination {
    width: 100%;
    flex-wrap: wrap;
  }

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

  .region-card-grid {
    grid-template-columns: 1fr;
  }

  .page-shell {
    padding-top: 20px;
  }
}
