﻿:root {
  --bg: #f4f6f1;
  --panel: #ffffff;
  --ink: #1f2d1e;
  --sub: #5a6a58;
  --accent: #1f7a4f;
  --accent-soft: #dff1e6;
  --line: #d6dfd3;
  --warn: #a86500;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  font-family: "Pretendard", "Noto Sans KR", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 5% 0%, #d7ebe0 0, transparent 45%),
    linear-gradient(180deg, #f7faf7 0%, var(--bg) 100%);
}

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

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

.top-links a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.title {
  font-size: 20px;
  font-weight: 800;
}

.subtitle {
  color: var(--sub);
  font-size: 12px;
}

.page {
  padding: 14px;
  height: calc(100vh - 78px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  overflow: hidden;
}

.map-layout {
  display: grid;
  grid-template-columns: 320px 1fr 340px;
  gap: 12px;
  min-height: 0;
}

.map-layout-two {
  grid-template-columns: 1fr 360px;
}

.map-layout-with-detail {
  grid-template-columns: minmax(0, 1fr) minmax(360px, 420px) 360px;
}

.filter-top {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  overflow-x: auto;
  overflow-y: visible;
  padding-bottom: 2px;
}

.filter-top .field {
  min-width: 130px;
  margin-bottom: 0;
}

.filter-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.map-name-label {
  background: rgba(31, 122, 79, 0.9);
  color: #fff;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.map-name-label-btn {
  border: 0;
  cursor: pointer;
}

.map-group-badge {
  background: #1f7a4f;
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.map-group-list {
  width: 260px;
  max-height: 280px;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.25);
  padding: 6px;
}

.map-group-list-head {
  font-size: 12px;
  font-weight: 800;
  color: var(--ink);
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
}

.map-group-list-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 7px 8px;
  margin-top: 4px;
  border-radius: 8px;
  background: #f4faf6;
  color: #1f2d1e;
  border: 1px solid #dbe7df;
  font-weight: 600;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 4px 16px rgba(40, 60, 40, 0.06);
  min-height: 0;
}

.panel-head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  font-weight: 700;
}

.panel-body {
  padding: 12px 14px;
  min-height: 0;
}

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

#detailSection {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#detailSection.hidden {
  display: none;
}

#detailBody {
  overflow: auto;
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}

.inline-input {
  display: flex;
  gap: 6px;
  align-items: center;
}

.inline-input input {
  flex: 1;
}

label {
  font-size: 12px;
  color: var(--sub);
}

input,
select,
button {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
}

button {
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  font-weight: 700;
}

button.secondary {
  background: #edf3ee;
  color: var(--ink);
  border: 1px solid var(--line);
}

.map-wrap {
  position: relative;
  overflow: hidden;
}

#map {
  width: 100%;
  height: 100%;
  min-height: 0;
  position: relative;
}

.map-level-indicator {
  position: absolute;
  top: 10px;
  right: 52px;
  z-index: 1001;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.95);
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}

.map-reset-btn {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 1001;
}

#restaurantPanel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#restaurantList {
  flex: 1;
  overflow: auto;
}

.list {
  max-height: none;
  overflow: auto;
}

.item {
  padding: 10px;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}

.item:hover {
  border-color: var(--accent);
  background: #f7fcf8;
}

.item.active {
  border-color: var(--accent);
  background: #eaf6ee;
}

.item h4 {
  margin: 0 0 6px;
  font-size: 14px;
}

.meta {
  font-size: 12px;
  color: var(--sub);
  display: grid;
  gap: 4px;
}

.status {
  display: inline-block;
  font-size: 11px;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}

.status.warn {
  background: #f8e8cb;
  color: var(--warn);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.admin-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: 8px 6px;
  vertical-align: top;
}

th {
  background: #f3f8f4;
  font-weight: 700;
}

.hint {
  font-size: 12px;
  color: var(--sub);
}

.tab-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.data-page {
  display: block;
  height: auto;
  min-height: auto;
  overflow-y: auto;
  overflow-x: hidden;
  min-width: 0;
}

/* data ?붾㈃? 蹂몃Ц ?꾩껜瑜??몃줈 ?ㅽ겕濡?媛?ν빐????*/
.page.data-page {
  height: calc(100vh - 78px);
  overflow-y: auto;
  overflow-x: hidden;
  display: block;
}

.data-page > section {
  width: 100%;
  margin-bottom: 12px;
}

.store-page {
  display: block;
  height: calc(100vh - 78px);
  overflow-y: auto;
  overflow-x: hidden;
}

.store-page > section {
  width: 100%;
  margin-bottom: 12px;
}

.page.admin-page {
  height: calc(100vh - 78px);
  overflow-y: auto;
  overflow-x: hidden;
  display: block;
}

.data-page .filter-top {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 10px;
  align-items: start;
  overflow: visible;
}

.data-page .filter-top .field {
  min-width: 0;
}

.data-page .filter-top input,
.data-page .filter-top select {
  width: 100%;
}

.data-page .filter-actions {
  justify-content: flex-start;
}

.data-page .filter-actions button {
  white-space: nowrap;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.stat-card .panel-body {
  font-size: 16px;
}

.stat-card strong {
  font-size: 24px;
  margin-right: 4px;
}

.data-table-panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.data-table-head {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}

.data-table-body {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  overflow: visible;
}

.data-table-body .table-scroll {
  flex: 1;
  max-height: none;
}

.pager-row {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
}

.tab-btn {
  background: #eef4ef;
  color: #204026;
  border: 1px solid var(--line);
}

.tab-btn.active {
  background: var(--accent);
  color: #fff;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.fold-box {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: #fbfdfb;
}

.fold-box > summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 8px;
}

.fold-box[open] > summary {
  margin-bottom: 12px;
}

.fold-box[open] {
  max-height: none;
  overflow: visible;
}

.empty {
  padding: 10px;
  color: var(--sub);
  font-size: 13px;
}

.hidden {
  display: none;
}

.col-menu {
  position: absolute;
  min-width: 220px;
  max-width: 300px;
  max-height: 360px;
  overflow: auto;
  z-index: 1000;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
  padding: 10px;
}

.col-menu-head {
  font-weight: 700;
  margin-bottom: 8px;
  font-size: 13px;
}

.col-menu-text {
  width: 100%;
}

.col-menu-values {
  max-height: 160px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px;
  background: #fafcfb;
}

.col-menu-values label {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
}

.table-scroll {
  max-height: none;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  width: 100%;
}

.table-scroll table {
  min-width: 1200px;
}

.table-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}

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

.data-grid-details {
  min-height: 0;
}

.data-grid-details > summary {
  list-style: none;
}

.data-grid-details > summary::-webkit-details-marker {
  display: none;
}

.stat-top-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 12px;
}

.stat-top-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: #fbfdfb;
  min-height: 180px;
  display: flex;
  flex-direction: column;
}

.stat-top-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.top-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
  overflow: auto;
  max-height: 220px;
}

.top-list-empty {
  font-size: 12px;
  color: var(--sub);
  padding: 8px;
}

.top-list-item {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  font-size: 12px;
}

.top-list-item .rank {
  font-weight: 800;
  color: var(--accent);
}

.top-list-item .name {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-list-item .value {
  color: var(--sub);
  font-size: 11px;
  white-space: nowrap;
}

.stats-drill-link {
  color: var(--ink);
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 2px;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

.stats-drill-link:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

.layer-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
}

.layer-modal.hidden {
  display: none;
}

.layer-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 25, 20, 0.45);
}

.layer-modal-body {
  position: relative;
  width: min(1100px, calc(100vw - 36px));
  max-height: calc(100vh - 72px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.layer-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.layer-modal-content {
  padding: 12px;
  overflow: auto;
}

.leaflet-top.leaflet-right .map-level-indicator {
  position: static;
  margin-top: 44px;
  margin-right: 0;
}

@media (max-width: 1180px) {
  html,
  body {
    overflow: auto;
  }

  .page {
    height: auto;
    display: block;
    overflow: visible;
  }

  .map-layout {
    grid-template-columns: 1fr;
    min-height: 520px;
  }

  #map {
    min-height: 360px;
  }

  .list {
    max-height: none;
  }

  .admin-layout {
    grid-template-columns: 1fr;
  }

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

  .stat-top-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1400px) {
  .data-page .filter-top {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 1120px) {
  .data-page .filter-top {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .data-page .filter-top {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .data-page .filter-top {
    grid-template-columns: 1fr;
  }
}

@media (orientation: portrait) {
  #mapPanel {
    grid-area: map;
  }

  #restaurantPanel {
    grid-area: list;
  }

  #detailSection {
    grid-area: detail;
  }

  #mapLayout,
  #mapLayout.map-layout-two,
  #mapLayout.map-layout-with-detail {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) minmax(200px, 0.6fr);
    grid-template-areas:
      "map"
      "list";
    min-height: 0;
  }

  #mapPanel {
    min-height: 0;
  }

  #mapLayout.portrait-detail-open {
    grid-template-columns: minmax(0, 1fr) minmax(240px, 46vw);
    grid-template-rows: minmax(170px, 0.5fr) minmax(220px, 0.5fr);
    grid-template-areas:
      "map detail"
      "list list";
  }

  #mapLayout.portrait-detail-open #map {
    min-height: 0;
  }

  #detailSection {
    min-height: 0;
  }
}

