:root {
  --bg-1: #f4f7fb;
  --bg-2: #e8f0fa;
  --panel: #ffffff;
  --text: #132238;
  --muted: #4f6076;
  --line: #d4deeb;
  --primary: #0e4d92;
  --primary-hover: #0b3d73;
  --danger: #b42318;
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  font-family: "Pretendard", "Noto Sans KR", sans-serif;
  color: var(--text);
  background: linear-gradient(150deg, var(--bg-1), var(--bg-2));
}

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

.layout {
  min-height: 100%;
  padding: 16px;
}

.panel {
  max-width: 420px;
  margin: 48px auto;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 14px 40px rgba(7, 34, 71, 0.08);
  display: grid;
  gap: 14px;
}

.status {
  min-height: 24px;
  color: var(--muted);
}

.muted {
  color: var(--muted);
  font-size: 14px;
}

.hidden {
  display: none !important;
}

.app-shell {
  height: calc(100vh - 32px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 12px 36px rgba(13, 32, 63, 0.09);
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

.topbar {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.topbar-texts {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.topbar-title {
  font-size: 19px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-message {
  margin: 0;
  font-size: 12px;
  color: #3a5274;
  line-height: 1.35;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

.topbar-message-link {
  font-weight: 600;
}

.topbar-message-divider {
  color: #6f87a8;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.workspace {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  grid-template-areas: "panel map";
}

.side-panel {
  grid-area: panel;
  border-right: 1px solid var(--line);
  padding: 16px;
  overflow: auto;
}

.map-wrap {
  grid-area: map;
  position: relative;
  min-width: 0;
  transition: opacity 0.18s ease;
}

.map-wrap.map-wrap-initializing {
  opacity: 0;
  pointer-events: none;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f5f8fc;
  color: #223450;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
}

.icon-btn:hover {
  background: #eaf0f8;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.spot-form-sheet {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #fbfdff;
}

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

.spot-form-head h3 {
  margin: 0;
}

.spot-form-close-btn {
  display: none;
}

.spot-form-hint {
  margin-bottom: 10px;
}

.spot-issue-ref-field {
  display: grid;
  gap: 6px;
}

.field-note {
  margin: 0;
  font-size: 12px;
  color: #567091;
}

#spot-form {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

label {
  font-size: 13px;
  color: var(--muted);
}

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

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

input[readonly],
textarea[readonly] {
  background: #f5f8fd;
  color: #354a68;
}

textarea {
  resize: vertical;
}

.coord-box {
  margin-top: 4px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

#selected-coord {
  flex: 1 1 150px;
  font-size: 13px;
  word-break: break-word;
}

.coord-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.btn-primary,
.btn-secondary {
  border: none;
  border-radius: 10px;
  cursor: pointer;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  padding: 10px 12px;
  font-weight: 600;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: #eff3f8;
  color: #223450;
  padding: 9px 11px;
}

.btn-small {
  font-size: 12px;
  padding: 6px 9px;
}

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

.form-actions .btn-primary {
  flex: 1;
}

.list-title {
  margin-top: 18px;
}

.pledge-panel {
  margin-top: 12px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #f9fbff;
}

.pledge-panel h3 {
  font-size: 15px;
}

.pledge-list {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.pledge-item {
  border: 1px solid #d7e1f0;
  border-radius: 10px;
  padding: 8px 10px;
  background: #ffffff;
}

.pledge-item strong {
  display: block;
  font-size: 13px;
  margin-bottom: 2px;
}

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

.pledge-common-tags {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pledge-common-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  border: 1px solid #d8e5f8;
  background: #eef5ff;
  color: #1d4c8f;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  cursor: pointer;
  appearance: none;
}

.pledge-common-tag:hover {
  background: #e5f0ff;
  border-color: #bfd5f6;
}

.pledge-common-tag:focus-visible {
  outline: 2px solid #9bbcf0;
  outline-offset: 2px;
}

.pledge-common-tag-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #1d4c8f;
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

.spot-list {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.spot-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  cursor: pointer;
  background: #fcfdff;
}

.spot-item--no-memo {
  padding: 8px 10px;
}

.spot-item--no-memo .spot-category,
.spot-item--no-memo .spot-dong {
  margin-top: 4px;
}

.spot-item--no-memo .spot-item-actions {
  margin-top: 6px;
}

.spot-dong {
  margin-top: 6px;
  font-size: 12px;
  color: #2a4a72;
}

.spot-category {
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: #12335c;
  background: #e8f0ff;
  border: 1px solid transparent;
}

.spot-item:hover {
  background: #f4f8fd;
}

.spot-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.spot-group-item {
  background: #f9fbff;
}

.spot-group-item:hover {
  background: #eef4fd;
}

.spot-group-count {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  background: #e5edf8;
  color: #1d3a61;
  font-size: 11px;
  font-weight: 700;
}

.spot-group-hint {
  margin-top: 8px;
  font-size: 12px;
  color: #567091;
}

.spot-memo {
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
}

.spot-item-actions {
  margin-top: 8px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.spot-action-btn {
  border: 1px solid var(--line);
  background: #eef3fa;
}

.spot-action-btn-checked {
  background: #dce8f9;
  border-color: #afc6e8;
  color: #0b3d73;
  font-weight: 600;
}

.spot-action-btn.danger {
  background: #fdecec;
  color: var(--danger);
  border-color: #f6d1cd;
}

.spot-filter-row {
  margin-top: 8px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.spot-filter-row .spot-action-btn {
  margin-right: 2px;
}

.active-dong-filter {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  background: #eaf1fb;
  color: #1f3f66;
  font-size: 12px;
  font-weight: 600;
}

.issue-contact-banner {
  position: sticky;
  top: 0;
  z-index: 4;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid #c7d9f2;
  border-radius: 12px;
  background: linear-gradient(145deg, #f8fbff, #edf4ff);
  box-shadow: 0 4px 14px rgba(16, 48, 92, 0.08);
}

.issue-contact-copy {
  font-size: 13px;
  color: #274367;
  line-height: 1.45;
}

.issue-contact-actions {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 13px;
  color: #214064;
  font-weight: 600;
}

.issue-contact-divider {
  color: #6f87a8;
}

.issue-contact-link {
  color: inherit;
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.16s ease, border-color 0.16s ease;
}

.issue-contact-link:hover {
  color: #1c385d;
  border-bottom-color: #b7c9e2;
}

.issue-contact-link:focus-visible {
  outline: none;
  color: #1c385d;
  border-bottom-color: #8da9cb;
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 10px;
  color: var(--muted);
  font-size: 13px;
}

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

.mobile-map-action {
  display: none;
}

.mobile-form-backdrop {
  display: none;
}

body.modal-open {
  overflow: hidden;
}

.map-popup {
  position: absolute;
  transform: translate(-50%, calc(-100% - 10px));
  min-width: 200px;
  max-width: 260px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  color: #1b2d47;
  box-shadow: 0 10px 30px rgba(5, 23, 48, 0.18);
  pointer-events: none;
}

@media (max-width: 980px) {
  body[data-map-mode] {
    overflow: hidden;
  }

  .layout {
    height: 100%;
    padding: 8px;
  }

  .app-shell {
    height: calc(100vh - 16px);
    min-height: 0;
    border-radius: 12px;
  }

  @supports (height: 100dvh) {
    .app-shell {
      height: calc(100dvh - 16px);
    }
  }

  .workspace {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    grid-template-columns: 1fr;
    grid-template-rows: minmax(320px, 56vh) minmax(0, 1fr);
    grid-template-areas:
      "map"
      "panel";
  }

  .side-panel {
    border-right: none;
    border-top: 1px solid var(--line);
    padding: 12px;
  }

  .list-title {
    margin-top: 0;
  }

  .spot-form-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    border-radius: 16px 16px 0 0;
    border: 1px solid var(--line);
    border-bottom: none;
    background: #ffffff;
    box-shadow: 0 -12px 28px rgba(14, 24, 38, 0.2);
    transform: translateY(110%);
    transition: transform 0.22s ease;
    max-height: 78vh;
    overflow: auto;
    padding: 14px 14px calc(14px + env(safe-area-inset-bottom));
  }

  .spot-form-sheet.open {
    transform: translateY(0);
  }

  .spot-form-close-btn {
    display: inline-flex;
  }

  .mobile-map-action {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 999px;
    padding: 8px 12px;
    background: rgba(14, 77, 146, 0.92);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 6px 14px rgba(12, 31, 60, 0.25);
  }

  .mobile-map-action:disabled {
    opacity: 0.55;
  }

  .mobile-form-backdrop {
    position: fixed;
    inset: 0;
    z-index: 55;
    display: block;
    background: rgba(7, 17, 29, 0.4);
  }

  .mobile-form-backdrop.hidden {
    display: none !important;
  }

  .topbar-title {
    font-size: 17px;
    white-space: normal;
  }

  .topbar-message {
    font-size: 11px;
  }
}
