:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --border: #e2e5ea;
  --text: #1f2430;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;

  --c-walk: #e4572e;
  --c-const: #f2a900;
  --c-rent: #2a9d8f;
  --c-infra: #4361ee;
  --c-facil: #7209b7;
  --c-etc: #6c757d;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: "Pretendard", -apple-system, BlinkMacSystemFont, "Segoe UI", "Malgun Gothic", sans-serif;
  color: var(--text);
  background: var(--bg);
  height: 100%;
}

.topbar {
  padding: 12px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.topbar h1 { margin: 0; font-size: 18px; }
.topbar .sub { margin: 2px 0 0; font-size: 12px; color: var(--muted); }

.layout {
  display: flex;
  height: calc(100vh - 54px);
}

.map-wrap {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
}
#map { width: 100%; height: 100%; background: #dfe3e8; }

.map-controls {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 5;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.map-controls button {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,.12);
}
.map-controls button:hover { background: #f0f2f5; }

.pick-hint {
  position: absolute;
  top: 56px;
  left: 12px;
  z-index: 5;
  background: #1f2430;
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
}
.pick-hint button {
  background: none;
  border: none;
  color: #93c5fd;
  cursor: pointer;
  text-decoration: underline;
  font-size: 13px;
}

.setup-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: rgba(244, 245, 247, .96);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.setup-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  max-width: 460px;
  box-shadow: 0 10px 30px rgba(0,0,0,.12);
}
.setup-card h2 { margin-top: 0; font-size: 16px; }
.setup-card ol { padding-left: 20px; font-size: 13px; line-height: 1.7; }
.setup-card code {
  background: #eef1f4;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12px;
}
.setup-card pre {
  background: #1f2430;
  color: #e5e7eb;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 12px;
  overflow-x: auto;
}
.muted, .setup-card .muted { color: var(--muted); font-size: 12px; }

.panel {
  flex: 0 0 380px;
  background: var(--panel);
  border-left: 1px solid var(--border);
  overflow-y: auto;
}
.panel-block {
  padding: 16px 18px;
  border-bottom: 8px solid var(--bg);
}
.panel-block h2 { margin: 0 0 12px; font-size: 15px; }

#report-form label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin: 10px 0 4px;
}
#report-form input[type="text"],
#report-form textarea,
#report-form select,
#filter-category {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
}
#report-form textarea { resize: vertical; }

.loc-display {
  font-size: 13px;
  font-weight: 600;
  padding: 8px 10px;
  background: #eef1f4;
  border-radius: 8px;
}
.loc-display.set { background: #e7f0ff; color: var(--primary-dark); }
.loc-address { font-size: 11px; color: var(--muted); margin-top: 4px; min-height: 14px; }

.photo-preview {
  display: block;
  max-width: 100%;
  border-radius: 8px;
  margin-top: 8px;
  border: 1px solid var(--border);
}

button.primary, #report-form button[type="submit"] {
  width: 100%;
  margin-top: 14px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
button.primary:hover { background: var(--primary-dark); }

.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.list-head h2 { margin: 0; }
.list-head #filter-category { width: auto; flex: 0 0 auto; }
#count-badge {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  border-radius: 10px;
  padding: 1px 7px;
  vertical-align: middle;
}

.report-list { list-style: none; margin: 0; padding: 0; }
.report-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 8px;
  cursor: pointer;
}
.report-item:hover { background: #f8f9fb; }
.report-item .r-top {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}
.tag {
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
}
.tag.walk { background: var(--c-walk); }
.tag.const { background: var(--c-const); }
.tag.rent { background: var(--c-rent); }
.tag.infra { background: var(--c-infra); }
.tag.facil { background: var(--c-facil); }
.tag.etc { background: var(--c-etc); }

.status-pill {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  border: 1px solid var(--border);
  color: var(--muted);
  margin-left: auto;
}
.status-pill.검토중 { border-color: #f2a900; color: #b07d00; }
.status-pill.처리완료 { border-color: #2a9d8f; color: #1f766b; }
.status-pill.검수대기 { border-color: #9ca3af; color: #6b7280; background: #f3f4f6; }

.report-item .r-title { font-size: 13px; font-weight: 600; }
.report-item .r-meta { font-size: 11px; color: var(--muted); margin-top: 3px; }

.list-footer { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.list-footer button {
  flex: 1;
  background: #eef1f4;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px;
  font-size: 12px;
  cursor: pointer;
}

.iw {
  padding: 10px 12px;
  max-width: 240px;
  font-size: 12px;
  line-height: 1.5;
}
.iw h3 { margin: 4px 0 6px; font-size: 13px; }
.iw img { max-width: 100%; border-radius: 6px; margin: 6px 0; }
.iw .iw-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.iw .iw-actions button, .iw select {
  font-size: 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  background: #fff;
  cursor: pointer;
}
.iw .vote { font-weight: 700; color: var(--primary); }
.iw .del { color: #dc2626; }

.hidden { display: none !important; }

/* 동의/정책 모달 */
.consent-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(31, 36, 48, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}
.consent-overlay.hidden { display: none; }
.consent-card {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .25);
}
.consent-card h2 { margin-top: 0; font-size: 17px; }
.consent-card h3 { font-size: 13px; margin: 16px 0 6px; }
.consent-card p, .consent-card li { font-size: 13px; line-height: 1.6; }
.consent-card ul { padding-left: 18px; margin: 6px 0; }
.consent-actions { display: flex; gap: 8px; margin-top: 18px; }
.consent-actions button { flex: 1; }
.consent-actions .primary { margin-top: 0; }
.consent-actions #consent-close {
  background: #eef1f4;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  font-size: 14px;
  cursor: pointer;
}

/* ===== 공개 화면 푸터 ===== */
.site-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  font-size: 12px;
  color: var(--muted);
  background: var(--panel);
  border-top: 1px solid var(--border);
}
.site-foot a { color: var(--muted); text-decoration: none; }
.site-foot a:hover { color: var(--primary); text-decoration: underline; }

/* ===== 관리 콘솔 (/admin) ===== */
.admin-body { background: var(--bg); }

.admin-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.admin-login-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .08);
}
.admin-login-card h1 { margin: 0 0 4px; font-size: 18px; }
.admin-login-card label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin: 14px 0 4px;
}
.admin-login-card input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 10px;
  font-size: 13px;
  font-family: inherit;
}
.login-err {
  font-size: 12px;
  color: #dc2626;
  margin: 10px 0 0;
}
.back-link { display: inline-block; margin-top: 14px; font-size: 12px; text-decoration: none; }

.admin-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.admin-top h1 { margin: 0; font-size: 16px; }
.admin-top-actions { display: flex; gap: 8px; }
.btn-plain {
  background: #eef1f4;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 13px;
  text-decoration: none;
  color: var(--text);
  cursor: pointer;
}
.btn-plain:hover { background: #e2e6ec; }

.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
}
.stat-tiles { display: flex; gap: 10px; flex-wrap: wrap; }
.stat-tile {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 14px;
  text-align: center;
  min-width: 68px;
}
.stat-tile.urgent { border-color: var(--c-walk); background: #fdeee9; }
.stat-tile .stat-n { display: block; font-size: 18px; font-weight: 700; }
.stat-tile .stat-l { display: block; font-size: 11px; color: var(--muted); }
.admin-filters { display: flex; gap: 8px; align-items: center; }
.admin-filters select {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 13px;
  background: #fff;
}

.admin-table-wrap { padding: 0 20px 40px; overflow-x: auto; }
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.admin-table th, .admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.admin-table th {
  background: #f5f6f8;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr.row-pending { background: #fdf6f3; }
.admin-table .t-title { font-weight: 600; }
.admin-table .t-desc { color: var(--muted); font-size: 12px; margin-top: 2px; max-width: 320px; }
.admin-table .t-thumb {
  width: 54px;
  height: 54px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
}
.admin-table .st {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 12px;
  background: #fff;
}
.admin-table .t-del {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  color: #dc2626;
  background: #fff;
  cursor: pointer;
}
.admin-table .t-del:hover { background: #fef2f2; }

/* 폼 안내 문구 */
.form-note {
  font-size: 11px;
  color: var(--muted);
  background: #f8f9fb;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  margin: 0 0 4px;
  line-height: 1.5;
}
.field-hint {
  font-size: 11px;
  color: var(--muted);
  margin: 4px 0 0;
  line-height: 1.4;
}
.turnstile-box { margin: 12px 0 0; min-height: 0; }
.turnstile-box:empty { margin: 0; }
.pending-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 10px;
  cursor: pointer;
}

@media (max-width: 860px) {
  .layout { flex-direction: column; height: auto; }
  .map-wrap { height: 55vh; }
  .panel { flex: none; width: 100%; border-left: none; border-top: 1px solid var(--border); }
}
