:root {
  --bg: #f4f4f2;
  --surface: #ffffff;
  --surface-2: #efefed;
  --text: #111111;
  --muted: #727272;
  --line: #d8d8d4;
  --dark: #141414;
  --dark-2: #252525;
  --danger: #9f2f2f;
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 16px;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.08);
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  font-family: 'Montserrat', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

button,
input,
textarea {
  font: inherit;
}

a { color: inherit; }

.btn,
.mini-btn {
  border: 0;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform .18s ease, background .18s ease, color .18s ease, border-color .18s ease, opacity .18s ease;
}

.btn:hover,
.mini-btn:hover {
  transform: translateY(-1px);
}

.btn {
  min-height: 48px;
  padding: 13px 20px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
}

.btn-dark {
  background: var(--dark);
  color: #fff;
}

.btn-dark:hover { background: #000; }

.btn-light {
  background: #fff;
  color: var(--dark);
  border: 1px solid var(--line);
}

.btn-ghost {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255,255,255,.24);
}

.btn-danger {
  background: #fff;
  color: var(--danger);
  border: 1px solid rgba(159,47,47,.28);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: .48;
  transform: none;
}

.mini-btn {
  height: 34px;
  border-radius: 999px;
  padding: 0 12px;
  color: var(--muted);
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 600;
}

.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top left, rgba(0,0,0,.08), transparent 32%),
    var(--bg);
}

.auth-card {
  width: min(100%, 460px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 40px;
  box-shadow: var(--shadow);
}

.auth-kicker,
.public-kicker,
.section-kicker,
.topbar-kicker,
.modal-kicker {
  font-size: 11px;
  line-height: 1.2;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

.auth-card h1,
.public-sidebar h1,
.admin-topbar h1,
.panel-card h2,
.modal-card h2 {
  margin: 10px 0 0;
  line-height: .98;
  letter-spacing: -.04em;
}

.auth-card h1 { font-size: 40px; }
.auth-card p { color: var(--muted); line-height: 1.55; }

.notice {
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font-size: 14px;
  margin: 20px 0;
}

.notice-error {
  color: var(--danger);
  background: rgba(159,47,47,.08);
  border: 1px solid rgba(159,47,47,.18);
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

label span,
.compact-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="file"],
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 16px;
  padding: 14px 16px;
  outline: 0;
  transition: border-color .18s ease, box-shadow .18s ease;
}

textarea { resize: vertical; }

input:focus,
textarea:focus {
  border-color: #111;
  box-shadow: 0 0 0 4px rgba(0,0,0,.06);
}

input[type="file"] {
  padding: 11px 12px;
  font-size: 13px;
}

.admin-body {
  min-height: 100vh;
  background: var(--bg);
}

.admin-topbar {
  min-height: 104px;
  margin: 18px;
  padding: 22px 26px;
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, #111 0%, #252525 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  box-shadow: var(--shadow);
}

.admin-topbar h1 {
  font-size: clamp(28px, 3vw, 48px);
}

.admin-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.admin-upload-card,
.panel-card,
.map-editor-card,
.public-sidebar,
.public-map-wrap {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.86);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.admin-upload-card {
  margin: 0 18px 18px;
  padding: 18px;
}

.upload-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1fr) auto;
  gap: 14px;
  align-items: end;
}

.small-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.admin-layout {
  display: grid;
  grid-template-columns: 460px minmax(0, 1fr);
  gap: 18px;
  padding: 0 18px 18px;
}

.admin-sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.panel-card,
.map-editor-card {
  padding: 18px;
}

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

.panel-card h2 {
  font-size: 28px;
}

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

.checkbox-line {
  min-height: 51px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 25px;
}

.checkbox-line input {
  width: 18px;
  height: 18px;
  accent-color: #111;
}

.checkbox-line span {
  margin: 0;
  color: var(--text);
}

.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.button-row .btn { flex: 1; }

.object-list-card {
  min-height: 220px;
}

.admin-objects-list,
.public-objects-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.empty-list {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.object-item {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 20px;
  padding: 16px;
  text-align: left;
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, transform .18s ease, box-shadow .18s ease;
}

.object-item:hover,
.object-item.is-active {
  border-color: #111;
  background: #f8f8f7;
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(0,0,0,.06);
}

.object-item-title {
  display: block;
  font-weight: 700;
  line-height: 1.25;
}

.object-item-meta {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.object-pill {
  border-radius: 999px;
  background: var(--surface-2);
  padding: 6px 9px;
}

.map-toolbar-note {
  margin-bottom: 12px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  font-size: 14px;
  line-height: 1.55;
}

.admin-map,
.public-map {
  height: calc(100vh - 240px);
  min-height: 620px;
  width: 100%;
  overflow: hidden;
  border-radius: 28px;
  border: 1px solid var(--line);
  background: #e7e7e3;
}

.public-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
}

.public-sidebar {
  padding: 32px;
  display: flex;
  flex-direction: column;
}

.public-sidebar h1 {
  font-size: clamp(34px, 4vw, 58px);
}

.public-sidebar p {
  margin: 18px 0 28px;
  color: var(--muted);
  line-height: 1.6;
}

.public-map-wrap {
  padding: 18px;
}

.public-map {
  min-height: calc(100vh - 72px);
  height: calc(100vh - 72px);
}

.map-empty {
  display: grid;
  place-items: center;
}

.empty-map-message {
  max-width: 420px;
  text-align: center;
  color: var(--muted);
  background: rgba(255,255,255,.78);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 24px;
}

.leaflet-container {
  background: #e7e7e3;
  font-family: 'Montserrat', Arial, sans-serif;
}

.leaflet-control-container .leaflet-bar {
  border: 0;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  border-radius: 14px;
  overflow: hidden;
}

.leaflet-bar a,
.leaflet-bar a:hover {
  color: #111;
  background: #fff;
}

.leaflet-interactive {
  cursor: pointer;
}

.leaflet-tooltip {
  border: 0;
  border-radius: 999px;
  box-shadow: 0 12px 30px rgba(0,0,0,.16);
  padding: 8px 12px;
  font-weight: 700;
  color: #111;
}

.modal[hidden] { display: none; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.48);
  backdrop-filter: blur(5px);
}

.modal-card {
  position: relative;
  width: min(100%, 940px);
  background: #fff;
  border-radius: 34px;
  box-shadow: 0 35px 100px rgba(0,0,0,.26);
  overflow: hidden;
}

.modal-close {
  position: absolute;
  z-index: 2;
  top: 16px;
  right: 16px;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: #111;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

.modal-grid {
  display: grid;
  grid-template-columns: 44% 1fr;
  min-height: 430px;
}

.modal-plan {
  background: #e7e7e3;
  min-height: 320px;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
  padding: 20px;
}

.modal-plan img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.modal-content {
  padding: 46px 42px;
}

.modal-content h2 {
  font-size: clamp(32px, 4vw, 54px);
}

.modal-meta {
  margin: 22px 0;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.modal-meta div {
  padding: 9px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 13px;
  font-weight: 700;
}

.modal-content p {
  color: var(--muted);
  line-height: 1.72;
  margin: 0;
  white-space: pre-wrap;
}

.toast {
  position: fixed;
  z-index: 10000;
  right: 22px;
  bottom: 22px;
  max-width: 420px;
  padding: 14px 16px;
  border-radius: 18px;
  background: #111;
  color: #fff;
  box-shadow: 0 24px 80px rgba(0,0,0,.22);
  font-size: 14px;
  line-height: 1.45;
}

.toast.is-error { background: var(--danger); }

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

  .admin-map,
  .public-map {
    height: 72vh;
    min-height: 520px;
  }

  .public-map {
    min-height: 520px;
  }

  .upload-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .admin-topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-layout,
  .public-shell {
    padding: 0 10px 10px;
  }

  .admin-topbar,
  .admin-upload-card {
    margin: 10px;
  }

  .public-shell {
    padding-top: 10px;
  }

  .public-sidebar,
  .panel-card,
  .map-editor-card,
  .public-map-wrap {
    padding: 14px;
    border-radius: 24px;
  }

  .form-grid-2,
  .modal-grid {
    grid-template-columns: 1fr;
  }

  .modal-content {
    padding: 28px 22px 32px;
  }

  .auth-card {
    padding: 28px;
  }
}
