:root {
  color-scheme: light;
  --bg: #f5f1e8;
  --panel: #fffaf1;
  --ink: #17221d;
  --muted: #66726a;
  --line: #d8d0c0;
  --green: #2f6046;
  --green-dark: #183b2b;
  --blue: #315f7b;
  --red: #a7352a;
  --shadow: 0 18px 50px rgba(33, 42, 35, 0.18);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  overflow: hidden;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: #fffdf7;
  color: var(--ink);
  border-radius: 8px;
  cursor: pointer;
}

button:hover {
  border-color: #9aa891;
}

.shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
}

.map-area {
  position: relative;
  min-width: 0;
  overflow: hidden;
  min-height: 100vh;
}

#map {
  position: absolute;
  inset: 0;
}

.map-topbar {
  position: absolute;
  z-index: 600;
  top: 16px;
  left: 16px;
  display: flex;
  gap: 8px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  font-size: 24px;
  font-weight: 700;
  box-shadow: var(--shadow);
}

.icon-button.active {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.panel {
  position: relative;
  z-index: 700;
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 420px;
  min-height: 100vh;
  max-height: 100vh;
  overflow: auto;
  border-left: 1px solid var(--line);
  background: var(--panel);
  padding: 22px;
}

.panel-header,
.list-head,
.sun-card-head,
.actions,
.coord-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.panel-header,
.list-head,
.sun-card-head {
  justify-content: space-between;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  font-size: 26px;
  line-height: 1.1;
}

h2 {
  font-size: 16px;
}

.status,
#pinCount {
  min-width: 74px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
  font-weight: 700;
}

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

.empty-state {
  display: grid;
  gap: 6px;
  min-height: 120px;
  align-content: center;
  color: var(--muted);
}

.empty-state strong {
  color: var(--ink);
}

.hidden {
  display: none !important;
}

.pin-form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  color: var(--ink);
  padding: 10px 11px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(47, 96, 70, 0.14);
}

.coord-row label {
  flex: 1;
}

.sun-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fffdf8;
}

.sun-card-head span {
  color: var(--muted);
  font-size: 12px;
}

.sun-grid {
  display: grid;
  gap: 8px;
}

.sun-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}

.sun-row span:first-child {
  color: var(--muted);
  font-weight: 700;
}

.primary {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
  font-weight: 800;
}

.danger {
  background: #fff8f7;
  border-color: #d7afa9;
  color: var(--red);
  font-weight: 800;
}

.actions button {
  min-height: 40px;
  padding: 0 14px;
}

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

.pin-list {
  display: grid;
  gap: 10px;
}

.pin-item {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  padding: 9px;
  text-align: left;
}

.pin-thumb,
.pin-thumb-empty {
  width: 64px;
  height: 54px;
  border-radius: 7px;
  object-fit: cover;
  background: #dae4d6;
}

.pin-thumb-empty {
  display: grid;
  place-items: center;
  color: var(--green);
  font-weight: 900;
}

.pin-item strong,
.pin-item span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pin-item span {
  color: var(--muted);
  font-size: 12px;
}

.camp-icon {
  width: 46px;
  height: 46px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
  overflow: hidden;
}

.camp-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camp-icon span {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: #fff;
  font-weight: 900;
}

.leaflet-popup-content {
  width: 260px !important;
  margin: 12px;
}

.popup {
  display: grid;
  gap: 10px;
}

.popup-image img {
  width: 100%;
  max-height: 150px;
  object-fit: cover;
  border-radius: 8px;
}

.popup h3 {
  font-size: 17px;
}

.popup p {
  color: var(--muted);
  white-space: pre-wrap;
}

.popup-sun {
  display: grid;
  gap: 4px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
  font-size: 12px;
}

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

.popup-actions button {
  flex: 1;
  min-height: 34px;
}

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

  .shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .map-area {
    min-height: 58vh;
  }

  .panel {
    width: 100%;
    min-height: auto;
    max-height: none;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 520px) {
  .panel {
    padding: 16px;
  }

  .panel-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .status {
    text-align: left;
  }

  .coord-row,
  .actions {
    align-items: stretch;
    flex-direction: column;
  }

  .sun-row {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}
