/* ===== 기본 설정 ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
.hidden { display: none !important; }

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
  --bg: #f1f5f9;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-sub: #64748b;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.06);
}

body {
  font-family: 'Pretendard', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ===== 헤더 ===== */
header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
header h1 { font-size: 1.35rem; font-weight: 700; color: var(--text); }
.header-actions { display: flex; gap: 8px; align-items: center; }

/* ===== 버튼 ===== */
.btn-primary {
  background: var(--primary); color: #fff; border: none;
  padding: 9px 18px; border-radius: 8px; font-size: 0.9rem;
  font-weight: 600; cursor: pointer; transition: background 0.15s;
}
.btn-primary:hover { background: var(--primary-dark); }

.btn-secondary {
  background: #fff; color: var(--text); border: 1px solid var(--border);
  padding: 9px 18px; border-radius: 8px; font-size: 0.9rem;
  font-weight: 500; cursor: pointer; transition: background 0.15s;
}
.btn-secondary:hover { background: var(--bg); }

.btn-outline {
  background: #fff; color: var(--text-sub); border: 1px solid var(--border);
  padding: 9px 16px; border-radius: 8px; font-size: 0.88rem;
  font-weight: 500; cursor: pointer; transition: all 0.15s;
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

.btn-danger {
  background: #fff; color: var(--danger); border: 1px solid #fca5a5;
  padding: 9px 18px; border-radius: 8px; font-size: 0.9rem;
  font-weight: 500; cursor: pointer; transition: background 0.15s;
}
.btn-danger:hover { background: #fef2f2; }

/* ===== 검색 & 필터 ===== */
.search-section {
  max-width: 1100px;
  margin: 24px auto 0;
  padding: 0 24px;
}
.search-wrap {
  position: relative;
  margin-bottom: 14px;
}
.search-wrap input {
  width: 100%; padding: 12px 16px 12px 44px;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 0.95rem; background: #fff; outline: none; transition: border-color 0.15s;
}
.search-wrap input:focus { border-color: var(--primary); }
.search-icon {
  position: absolute; left: 14px; top: 50%;
  transform: translateY(-50%); font-size: 1rem; pointer-events: none;
}

.filter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 10px;
}
.filter-section {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.filter-label {
  font-size: 0.78rem; font-weight: 700; color: var(--text-sub);
  text-transform: uppercase; letter-spacing: 0.05em;
  white-space: nowrap; min-width: 48px;
}
.filter-wrap { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-btn {
  padding: 5px 13px; border: 1px solid var(--border);
  border-radius: 20px; background: #fff; font-size: 0.82rem;
  cursor: pointer; transition: all 0.15s; color: var(--text-sub);
}
.filter-btn:hover { border-color: var(--primary); color: var(--primary); }
.filter-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* 뷰 토글 */
.view-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}
.view-btn {
  padding: 6px 14px; border: none; background: #fff;
  font-size: 0.85rem; cursor: pointer; color: var(--text-sub);
  transition: all 0.15s;
}
.view-btn:not(:last-child) { border-right: 1px solid var(--border); }
.view-btn.active { background: var(--primary); color: #fff; }

/* ===== 목록 뷰 ===== */
#list-view {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 24px 40px;
}
#list-view.hidden { display: none; }
.entries-count { font-size: 0.85rem; color: var(--text-sub); margin-bottom: 14px; }
.entries-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.loading {
  color: var(--text-sub); font-size: 0.9rem;
  padding: 40px 0; text-align: center; grid-column: 1 / -1;
}
.empty-state {
  text-align: center; padding: 60px 0;
  color: var(--text-sub); grid-column: 1 / -1;
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 12px; }

/* ===== 지도 뷰 ===== */
#map-view {
  display: flex;
  height: calc(100vh - 170px);
}
#map-view.hidden { display: none; }

#kakao-map {
  flex: 1;
  height: 100%;
}
#map-sidebar {
  width: 320px;
  background: #fff;
  border-left: 1px solid var(--border);
  overflow-y: auto;
  flex-shrink: 0;
}
.map-sidebar-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-sub);
  position: sticky;
  top: 0;
  background: #fff;
}
.map-entry-item {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}
.map-entry-item:hover { background: var(--bg); }
.map-entry-item.active { background: #eff6ff; border-left: 3px solid var(--primary); }
.map-entry-title { font-size: 0.9rem; font-weight: 600; margin-bottom: 4px; }
.map-entry-address { font-size: 0.8rem; color: var(--text-sub); margin-bottom: 4px; }
.map-entry-project { font-size: 0.75rem; }
.map-no-address {
  padding: 20px 16px;
  font-size: 0.85rem;
  color: var(--text-sub);
  text-align: center;
}

/* ===== 카드 ===== */
.entry-card {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: var(--shadow); display: flex; flex-direction: column;
}
.entry-card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.1); }
.card-header { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.type-badge {
  font-size: 0.75rem; padding: 3px 8px;
  border-radius: 12px; font-weight: 600; white-space: nowrap;
}
.type-note  { background: #dbeafe; color: #1d4ed8; }
.type-link  { background: #d1fae5; color: #065f46; }
.type-file  { background: #fef3c7; color: #92400e; }
.type-data  { background: #ede9fe; color: #5b21b6; }
.card-title {
  font-size: 1rem; font-weight: 600; color: var(--text);
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card-address {
  font-size: 0.8rem; color: var(--text-sub);
  margin-bottom: 6px; display: flex; align-items: center; gap: 4px;
}
.card-content {
  font-size: 0.88rem; color: var(--text-sub); line-height: 1.6;
  overflow: hidden; display: -webkit-box;
  -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  margin-bottom: 12px; flex: 1;
}
.card-footer {
  display: flex; align-items: flex-end;
  justify-content: space-between; flex-wrap: wrap; gap: 6px; margin-top: auto;
}
.card-footer-left { display: flex; flex-direction: column; gap: 5px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 5px; }
.tag {
  font-size: 0.75rem; padding: 2px 8px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text-sub);
}
.card-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.card-date { font-size: 0.73rem; color: #94a3b8; white-space: nowrap; }
.card-time { font-size: 0.7rem; color: #b0bec5; white-space: nowrap; }
.project-badge-card {
  display: inline-block; font-size: 0.72rem; padding: 2px 8px;
  border-radius: 10px; font-weight: 600; color: #fff; white-space: nowrap;
}
.card-project-top { margin-bottom: 8px; }

/* ===== 모달 공통 ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45);
  z-index: 200; display: flex; align-items: center;
  justify-content: center; padding: 16px;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: #fff; border-radius: 16px; width: 100%;
  max-width: 580px; max-height: 90vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.modal-detail { max-width: 640px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 16px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: #fff; z-index: 1;
}
.modal-header h2 { font-size: 1.1rem; font-weight: 700; }
.modal-close {
  border: none; background: none; font-size: 1.1rem;
  cursor: pointer; color: var(--text-sub); padding: 4px 8px; border-radius: 6px;
}
.modal-close:hover { background: var(--bg); }
.modal-body { padding: 20px 24px; }
.modal-footer {
  padding: 16px 24px; border-top: 1px solid var(--border);
  display: flex; gap: 8px; justify-content: flex-end;
  position: sticky; bottom: 0; background: #fff;
}

/* ===== 폼 ===== */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block; font-size: 0.85rem; font-weight: 600;
  color: var(--text-sub); margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: 0.03em;
}
.form-group input[type="text"],
.form-group input[type="url"],
.form-group textarea,
.form-group select {
  width: 100%; padding: 10px 14px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 0.95rem; font-family: inherit;
  outline: none; transition: border-color 0.15s; background: #fff;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus { border-color: var(--primary); }
.form-group textarea { resize: vertical; }
.form-group select { cursor: pointer; }

/* 주소 입력 */
.address-wrap { display: flex; gap: 8px; }
.address-wrap input { flex: 1; }
.btn-geocode { white-space: nowrap; font-size: 0.82rem; padding: 8px 12px; }
.geocode-result {
  margin-top: 8px; padding: 8px 12px;
  background: #f0fdf4; border: 1px solid #bbf7d0;
  border-radius: 8px; font-size: 0.85rem; color: #065f46;
}
.geocode-result.error { background: #fef2f2; border-color: #fca5a5; color: var(--danger); }
.geocode-result.hidden { display: none; }

/* 폼 지도 미리보기 */
.form-map-preview {
  width: 100%;
  height: 200px;
  border-radius: 8px;
  margin-top: 10px;
  border: 1px solid var(--border);
  overflow: hidden;
}

/* 유형 선택 버튼 */
.type-select { display: flex; gap: 8px; flex-wrap: wrap; }
.type-btn {
  padding: 8px 14px; border: 1px solid var(--border); border-radius: 8px;
  background: #fff; font-size: 0.85rem; cursor: pointer;
  transition: all 0.15s; color: var(--text-sub);
}
.type-btn:hover { border-color: var(--primary); color: var(--primary); }
.type-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* 파일 업로드 */
.file-drop-zone {
  border: 2px dashed var(--border); border-radius: 10px;
  padding: 28px; text-align: center; cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.file-drop-zone:hover, .file-drop-zone.dragover {
  border-color: var(--primary); background: #eff6ff;
}
.file-icon { font-size: 2rem; }
.file-drop-inner p { font-size: 0.9rem; color: var(--text-sub); margin-top: 6px; }
.file-hint { font-size: 0.78rem; color: #94a3b8; }
.file-preview {
  margin-top: 10px; padding: 10px 14px; background: var(--bg);
  border-radius: 8px; display: flex; align-items: center;
  gap: 10px; font-size: 0.88rem;
}
.file-preview.hidden { display: none; }
.file-preview-name { flex: 1; font-weight: 500; }
.file-preview-remove { border: none; background: none; cursor: pointer; color: var(--text-sub); font-size: 1rem; }

/* ===== 상세 보기 ===== */
.detail-badges { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.detail-type-badge .type-badge { font-size: 0.85rem; padding: 4px 12px; }
.detail-project-badge {
  font-size: 0.82rem; padding: 4px 12px;
  border-radius: 12px; font-weight: 600; color: #fff;
}
#detail-title { font-size: 1.4rem; font-weight: 700; margin: 12px 0 10px; line-height: 1.4; }
.detail-address {
  margin: 10px 0; padding: 10px 14px;
  background: #f8fafc; border: 1px solid var(--border);
  border-radius: 8px; font-size: 0.88rem; color: var(--text-sub);
  display: flex; align-items: center; gap: 6px;
}
.detail-content { font-size: 0.95rem; line-height: 1.8; color: var(--text); white-space: pre-wrap; margin: 14px 0; }
.detail-url {
  margin: 14px 0; padding: 12px 16px; background: #f0fdf4;
  border: 1px solid #bbf7d0; border-radius: 8px; font-size: 0.9rem;
}
.detail-url a { color: #059669; text-decoration: none; word-break: break-all; }
.detail-url a:hover { text-decoration: underline; }
.detail-file {
  margin: 14px 0; padding: 12px 16px; background: #fffbeb;
  border: 1px solid #fde68a; border-radius: 8px; font-size: 0.9rem;
  display: flex; align-items: center; gap: 10px;
}
.detail-file a { color: #b45309; text-decoration: none; font-weight: 500; }
.detail-file a:hover { text-decoration: underline; }
.detail-date {
  margin-top: 18px; font-size: 0.82rem; color: #94a3b8;
  border-top: 1px solid var(--border); padding-top: 12px; line-height: 1.8;
}

/* ===== 관련 링크 ===== */
.btn-add-link {
  margin-top: 8px; padding: 7px 14px;
  border: 1px dashed var(--border); border-radius: 8px;
  background: #fff; font-size: 0.85rem; cursor: pointer;
  color: var(--primary); width: 100%; transition: all 0.15s;
}
.btn-add-link:hover { background: #eff6ff; border-color: var(--primary); }

.link-item {
  display: flex; gap: 8px; margin-bottom: 8px; align-items: center;
}
.link-item input { flex: 1; }
.link-item-title { max-width: 140px; flex-shrink: 0; }
.link-item-remove {
  border: none; background: none; cursor: pointer;
  color: #94a3b8; font-size: 1.1rem; padding: 4px;
  border-radius: 4px; flex-shrink: 0;
}
.link-item-remove:hover { color: var(--danger); background: #fef2f2; }

.detail-links {
  margin: 14px 0; padding: 14px 16px;
  background: #f8fafc; border: 1px solid var(--border);
  border-radius: 8px;
}
.detail-links-title {
  font-size: 0.8rem; font-weight: 700; color: var(--text-sub);
  text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 10px;
}
.detail-link-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 0; border-bottom: 1px solid var(--border);
}
.detail-link-item:last-child { border-bottom: none; padding-bottom: 0; }
.detail-link-label { font-size: 0.85rem; font-weight: 500; color: var(--text); min-width: 80px; }
.detail-link-url a { font-size: 0.85rem; color: var(--primary); text-decoration: none; word-break: break-all; }
.detail-link-url a:hover { text-decoration: underline; }

/* ===== 프로젝트 관리 ===== */
.project-add-row { display: flex; gap: 8px; margin-bottom: 10px; }
.project-add-row input { flex: 1; }
.project-add-row .btn-primary { white-space: nowrap; }
.color-picker { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.color-swatch {
  width: 26px; height: 26px; border-radius: 50%; cursor: pointer;
  border: 3px solid transparent; transition: transform 0.1s, border-color 0.1s;
}
.color-swatch:hover { transform: scale(1.15); }
.color-swatch.selected { border-color: #1e293b; }
.project-list-wrap { margin-top: 8px; }
.project-list-wrap label {
  display: block; font-size: 0.85rem; font-weight: 600;
  color: var(--text-sub); margin-bottom: 10px;
  text-transform: uppercase; letter-spacing: 0.03em;
}
#project-list { display: flex; flex-direction: column; gap: 8px; }
.project-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; background: var(--bg); border-radius: 8px;
}
.project-item-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.project-item-name { flex: 1; font-size: 0.9rem; font-weight: 500; }
.project-item-count { font-size: 0.8rem; color: var(--text-sub); }
.project-item-delete {
  border: none; background: none; cursor: pointer;
  color: #94a3b8; font-size: 0.9rem; padding: 2px 6px; border-radius: 4px;
}
.project-item-delete:hover { color: var(--danger); background: #fef2f2; }
.project-item-rename {
  border: none; background: none; cursor: pointer;
  color: #94a3b8; font-size: 0.9rem; padding: 2px 6px; border-radius: 4px;
}
.project-item-rename:hover { color: var(--primary); background: #eff6ff; }
.project-item-name-input {
  flex: 1; border: 1px solid #cbd5e1; border-radius: 4px;
  padding: 2px 6px; font-size: 0.9rem; outline: none;
}
.project-item-name-input:focus { border-color: var(--primary); }
.project-item-confirm {
  border: none; background: var(--primary); color: #fff; cursor: pointer;
  font-size: 0.85rem; padding: 2px 8px; border-radius: 4px;
}
.project-item-confirm:hover { background: var(--primary-dark); }
.project-item-cancel {
  border: none; background: none; cursor: pointer;
  color: #94a3b8; font-size: 0.85rem; padding: 2px 6px; border-radius: 4px;
}
.project-item-cancel:hover { color: var(--danger); background: #fef2f2; }
.project-empty { text-align: center; padding: 20px; color: var(--text-sub); font-size: 0.9rem; }

/* ===== 등록 Step 1: 프로젝트 선택 ===== */
.step-intro {
  font-size: 0.92rem;
  color: var(--text-sub);
  margin-bottom: 14px;
}
.project-choice-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}
.project-choice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  transition: all 0.15s;
}
.project-choice:hover { border-color: var(--primary); background: #eff6ff; }
.project-choice.selected { border-color: var(--primary); background: #eff6ff; }
.project-choice-dot {
  width: 12px; height: 12px;
  border-radius: 50%; flex-shrink: 0;
}
.project-choice-icon { font-size: 1rem; flex-shrink: 0; }
.project-choice-name { flex: 1; font-size: 0.92rem; font-weight: 500; color: var(--text); }
.project-choice-count { font-size: 0.8rem; color: var(--text-sub); }
.new-project-form {
  padding: 14px 16px;
  background: var(--bg);
  border-radius: 10px;
  margin-top: 4px;
}
.new-project-form .form-group { margin-bottom: 12px; }
.new-project-form .form-group:last-child { margin-bottom: 0; }

/* 선택된 프로젝트 뱃지 (Step 2 상단) */
.selected-project-badge-wrap {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.selected-project-badge {
  display: inline-block;
  font-size: 0.85rem;
  padding: 5px 14px;
  border-radius: 12px;
  font-weight: 600;
  color: #fff;
}

/* ===== 폼 섹션 구분선 ===== */
.form-section-divider {
  font-size: 0.78rem; font-weight: 700; color: var(--text-sub);
  text-transform: uppercase; letter-spacing: 0.05em;
  padding: 6px 0 8px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}
.form-section-divider:first-child { border-top: none; margin-top: 0; }

/* ===== 면적 입력 ===== */
.area-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.area-field {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
}
.area-field input {
  flex: 1;
  width: 0; /* flex-shrink fix */
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
  background: #fff;
}
.area-field input:focus { border-color: var(--primary); }
.area-unit {
  font-size: 0.85rem;
  color: var(--text-sub);
  white-space: nowrap;
  flex-shrink: 0;
}
.area-sep {
  font-size: 1rem;
  color: var(--text-sub);
  flex-shrink: 0;
}

/* ===== 폼 인라인 행 ===== */
.form-inline-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.form-inline-item {
  flex: 1;
  min-width: 120px;
}

/* ===== 카드 건축 정보 칩 ===== */
.card-bld-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 8px;
}
.bld-chip {
  font-size: 0.73rem;
  padding: 2px 8px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  color: #1d4ed8;
  white-space: nowrap;
}

/* ===== 상세 건축 정보 ===== */
.detail-building-info {
  margin: 12px 0;
  padding: 14px 16px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.bld-info-title {
  font-size: 0.78rem; font-weight: 700; color: var(--text-sub);
  text-transform: uppercase; letter-spacing: 0.05em;
  margin-bottom: 10px;
}
.bld-info-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 14px;
  align-items: baseline;
}
.bld-info-key {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-sub);
  white-space: nowrap;
}
.bld-info-val {
  font-size: 0.9rem;
  color: var(--text);
}

/* ===== 금융 정보 / Tranche ===== */
.detail-finance-info, .detail-tranche-info {
  margin: 12px 0;
  padding: 14px 16px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.form-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}
@media (max-width: 500px) { .form-two-col { grid-template-columns: 1fr; } }

/* Tranche 아코디언 */
.tranche-sections { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.tranche-block { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.tranche-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; background: #f1f5f9; cursor: pointer;
  user-select: none;
}
.tranche-header:hover { background: #e2e8f0; }
.tranche-label { font-weight: 700; font-size: 0.95rem; color: var(--primary); }
.tranche-toggle-icon { font-size: 0.75rem; color: var(--text-sub); }
.tranche-body { padding: 14px; background: #fff; }

/* 참여기관 행 */
.tranche-participant-row {
  display: flex; gap: 8px; align-items: center; margin-bottom: 6px;
}
.participant-name { flex: 2; }
.participant-amount { flex: 1; }
.tranche-participant-row input { border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; font-size: 0.9rem; width: 100%; }

/* 상세 모달 Tranche */
.tranche-detail-block {
  margin-bottom: 14px; padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.tranche-detail-block:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.tranche-detail-label {
  font-weight: 700; font-size: 0.9rem; color: var(--primary);
  margin-bottom: 8px;
}
.tranche-detail-notes {
  margin-top: 8px; font-size: 0.85rem; color: var(--text-sub);
  white-space: pre-wrap; background: #f8fafc; padding: 6px 10px; border-radius: 6px;
}
.tranche-detail-participants { margin-top: 8px; }
.tranche-participant-detail {
  display: flex; gap: 12px; font-size: 0.85rem; padding: 3px 0;
  border-bottom: 1px dashed var(--border);
}
.tranche-participant-detail:last-child { border-bottom: none; }
.tp-name { font-weight: 600; flex: 1; }
.tp-amount { color: var(--text-sub); }

/* ===== 태그 피커 ===== */
.tag-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  min-height: 46px;
}
.tag-picker:empty { display: none; }
.tag-chip {
  padding: 5px 13px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: #fff;
  font-size: 0.83rem;
  cursor: pointer;
  color: var(--text-sub);
  transition: all 0.15s;
  font-family: inherit;
}
.tag-chip:hover { border-color: var(--primary); color: var(--primary); }
.tag-chip.selected {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.tag-picker-hint {
  font-size: 0.82rem;
  color: var(--text-sub);
  margin-top: 6px;
}
.tag-picker-hint.hidden { display: none; }
.tag-item-dot { font-size: 0.85rem; }

/* ===== 토스트 ===== */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  background: #1e293b; color: #fff; padding: 12px 22px;
  border-radius: 24px; font-size: 0.9rem; z-index: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2); transition: opacity 0.3s;
}
.toast.hidden { display: none; }

/* ===== 비밀번호 화면 ===== */
#auth-overlay {
  position: fixed; inset: 0;
  background: #f1f5f9;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
#auth-overlay.hidden { display: none; }
.auth-card {
  background: #fff;
  border-radius: 20px;
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0,0,0,0.1);
}
.auth-icon { font-size: 2.8rem; margin-bottom: 14px; }
.auth-title { font-size: 1.3rem; font-weight: 700; margin-bottom: 8px; }
.auth-subtitle { font-size: 0.88rem; color: #64748b; margin-bottom: 24px; }
.auth-input-wrap { margin-bottom: 10px; }
.auth-input-wrap input {
  width: 100%;
  padding: 13px 16px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-size: 1rem;
  text-align: center;
  outline: none;
  letter-spacing: 0.1em;
  transition: border-color 0.15s;
}
.auth-input-wrap input:focus { border-color: #2563eb; }
.auth-error {
  font-size: 0.83rem;
  color: #dc2626;
  margin-bottom: 10px;
}
.auth-btn {
  width: 100%;
  padding: 13px;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 4px;
  transition: background 0.15s;
}
.auth-btn:hover { background: #1d4ed8; }

/* ===== 반응형 ===== */
@media (max-width: 600px) {
  .header-inner { padding: 12px 16px; flex-wrap: wrap; gap: 10px; }
  .search-section { padding: 0 16px; }
  #list-view { padding: 16px 16px 40px; }
  .entries-grid { grid-template-columns: 1fr; }
  .modal-body, .modal-footer, .modal-header { padding-left: 18px; padding-right: 18px; }
  #map-view { flex-direction: column; }
  #map-sidebar { width: 100%; height: 200px; border-left: none; border-top: 1px solid var(--border); }
  #kakao-map { flex: none; height: calc(100% - 200px); }
}
