:root {
  color-scheme: light;
  --page: #eef2f1;
  --panel: #ffffff;
  --panel-strong: #f8faf9;
  --text: #18211f;
  --muted: #64706d;
  --line: #d7dedb;
  --line-strong: #bdc9c4;
  --primary: #0f766e;
  --primary-strong: #0b5f59;
  --primary-soft: #d9f2ef;
  --danger: #b42318;
  --danger-soft: #fee4df;
  --blue: #2563eb;
  --shadow: 0 18px 45px rgba(22, 34, 31, 0.16);
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  color: var(--text);
  background: var(--page);
  overflow: hidden;
}

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

button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition:
    background 150ms ease,
    border-color 150ms ease,
    color 150ms ease,
    box-shadow 150ms ease;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.24);
  outline-offset: 2px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--text);
  background: #fff;
}

input,
select {
  height: 42px;
  padding: 0 12px;
}

textarea {
  min-height: 88px;
  padding: 10px 12px;
  resize: vertical;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.app-shell {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  width: 100vw;
  height: 100vh;
}

.map-stage {
  position: relative;
  min-width: 0;
  background: #d7e5e1;
}

.map {
  width: 100%;
  height: 100%;
}

.control-panel {
  z-index: 800;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  height: 100vh;
  padding: 18px;
  overflow-y: auto;
  background: var(--panel);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 2px;
}

.panel-header h1 {
  font-size: 23px;
  line-height: 1.22;
  font-weight: 750;
}

.panel-header p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.panel-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.panel-section h2 {
  font-size: 14px;
  line-height: 1.3;
  font-weight: 740;
  color: #263330;
}

.search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px;
  gap: 8px;
}

.search-form button,
.parking-form button[type="submit"],
.primary-button {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}

.search-form button:hover,
.parking-form button[type="submit"]:hover,
.primary-button:hover {
  background: var(--primary-strong);
  border-color: var(--primary-strong);
}

.secondary-button,
.icon-button {
  color: #1e2a27;
  background: var(--panel-strong);
  border-color: var(--line-strong);
}

.secondary-button:hover,
.icon-button:hover {
  background: #edf3f1;
  border-color: #aebbb6;
}

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

.danger-button:hover {
  color: #8f1d14;
  background: #ffd8d0;
  border-color: #ffb3a6;
}

.icon-button {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 40px;
  padding: 0;
  font-size: 20px;
  line-height: 1;
}

.add-tools,
.filter-actions,
.form-actions,
.item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.add-tools > button,
.filter-actions > button,
.form-actions > button,
.item-actions > button {
  flex: 1 1 0;
  min-width: 104px;
  padding: 0 12px;
}

.muted-text {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.result-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 176px;
  overflow-y: auto;
}

.result-item {
  min-height: auto;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: #263330;
  background: var(--panel-strong);
  text-align: left;
  line-height: 1.35;
}

.result-item:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.parking-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.parking-form label,
.scope-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.parking-form span,
.scope-grid span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

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

.list-section {
  padding-bottom: 0;
}

.parking-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.parking-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-strong);
}

.parking-item h3 {
  margin-bottom: 6px;
  font-size: 15px;
  line-height: 1.3;
  font-weight: 740;
}

.parking-address,
.parking-note,
.parking-meta {
  font-size: 12px;
  line-height: 1.45;
}

.parking-address {
  color: #42504d;
}

.parking-note {
  margin-top: 6px;
  color: #263330;
}

.parking-meta {
  margin-top: 6px;
  color: var(--muted);
}

.item-actions {
  margin-top: 10px;
}

.empty-state {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.toast {
  position: fixed;
  right: 410px;
  bottom: 24px;
  z-index: 1200;
  max-width: min(360px, calc(100vw - 32px));
  padding: 12px 14px;
  border-radius: var(--radius);
  color: #fff;
  background: #1f2a27;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
  font-size: 14px;
  line-height: 1.4;
}

.hidden {
  display: none !important;
}

.leaflet-control-zoom {
  border: 0 !important;
  box-shadow: 0 10px 24px rgba(22, 34, 31, 0.16) !important;
}

.leaflet-control-zoom a {
  color: var(--text) !important;
  border-color: var(--line) !important;
}

.pending-pin {
  display: grid;
  place-items: center;
  border-radius: 999px 999px 999px 2px;
  color: #fff;
  box-shadow: 0 7px 16px rgba(20, 56, 51, 0.3);
  transform: rotate(45deg);
}

.parking-pin {
  display: grid;
  justify-items: center;
  align-items: start;
  color: #fff;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.pending-pin {
  background: var(--blue);
  border: 2px solid #fff;
}

.parking-pin::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 28px;
  z-index: 0;
  width: 15px;
  height: 15px;
  background: linear-gradient(135deg, #0f766e, #13a395);
  border-right: 3px solid #fff;
  border-bottom: 3px solid #fff;
  border-radius: 0 0 4px 0;
  box-shadow: 7px 8px 16px rgba(10, 48, 43, 0.28);
  transform: translateX(-50%) rotate(45deg);
}

.parking-pin::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 12px;
  height: 5px;
  border-radius: 999px;
  background: rgba(10, 48, 43, 0.24);
  filter: blur(1px);
  transform: translateX(-50%);
}

.parking-pin__badge {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 3px solid #fff;
  border-radius: 11px;
  background:
    radial-gradient(circle at 30% 22%, rgba(255, 255, 255, 0.24), transparent 26%),
    linear-gradient(135deg, #0f766e 0%, #13a395 100%);
  box-shadow:
    0 10px 20px rgba(10, 48, 43, 0.3),
    inset 0 -2px 0 rgba(0, 0, 0, 0.12);
  color: #fff;
  font-size: 21px;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.pending-pin span {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  font-weight: 800;
  transform: rotate(-45deg);
}

.point-popup {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 190px;
}

.point-popup strong {
  font-size: 15px;
  line-height: 1.3;
}

.point-popup p,
.point-popup span {
  color: #485551;
  font-size: 12px;
  line-height: 1.4;
}

.point-popup button {
  width: 100%;
  min-height: 34px;
  margin-top: 2px;
}

.filter-box,
.search-box {
  stroke-dasharray: 7 6;
}

.adding-point .map {
  cursor: crosshair;
}

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

  .app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    height: auto;
  }

  .map-stage {
    height: 56vh;
    min-height: 390px;
  }

  .control-panel {
    height: auto;
    min-height: 44vh;
    padding: 16px;
    border-left: 0;
    border-top: 1px solid var(--line);
    box-shadow: 0 -12px 30px rgba(22, 34, 31, 0.12);
  }

  .toast {
    right: 16px;
    bottom: 16px;
  }
}

@media (max-width: 520px) {
  .map-stage {
    min-height: 340px;
  }

  .panel-header h1 {
    font-size: 20px;
  }

  .scope-grid,
  .search-form {
    grid-template-columns: 1fr;
  }

  .add-tools > button,
  .filter-actions > button,
  .form-actions > button,
  .item-actions > button {
    flex-basis: 100%;
  }
}
