/* WMS 타일 선명도 강화 (건축물 등) */
.lm-wms-crisp img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* 기본: Leaflet의 pointer(손가락) 커서 유지 — 관심필지/다중필지 모드 */
/* 룰러 모드 커서 (crosshair) */
.leaflet-container.ruler-active,
.leaflet-container.ruler-active canvas,
.leaflet-container.ruler-active .leaflet-interactive { cursor: crosshair !important; }
/* 반경 모드 커서 (crosshair) */
.leaflet-container.radius-active,
.leaflet-container.radius-active canvas,
.leaflet-container.radius-active .leaflet-interactive { cursor: crosshair !important; }

/* GAG_ORDER_088: UX/UI 개선 1단계 공통 테마 변수 */
:root {
    /* 주요 컬러 (Trust Blue & Subtle Gray) */
    --lm-color-primary: #2B5C92;
    --lm-color-primary-hover: #1E4675;
    --lm-color-accent: #E76F51;
    --lm-color-accent-hover: #D65A3D;

    /* 시맨틱 컬러 (C62 추가) */
    --lm-color-danger: #dc2626;
    --lm-color-danger-hover: #b91c1c;
    --lm-color-success: #059669;
    --lm-color-success-hover: #047857;
    --lm-color-warning: #d97706;
    --lm-color-warning-hover: #b45309;
    --lm-color-info: #0369a1;

    /* 그레이스케일 텍스트/표면 체계 */
    --lm-color-text-main: #111827;
    --lm-color-text-muted: #6B7280;
    --lm-color-bg-panel: rgba(255, 255, 255, 0.98);
    --lm-color-bg-body: #F3F4F6;
    --lm-border-color: #E5E7EB;

    /* 외형 속성 체계 */
    --lm-radius-base: 8px;
    /* 일반 버튼, 카드 등 */
    --lm-radius-pill: 24px;
    /* 메인 검색창, 토글 등 */
    --lm-radius-sm: 6px;

    /* 그림자 체계 */
    --lm-shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.05);
    --lm-shadow-panel: -5px 0 20px rgba(0, 0, 0, 0.1);
    --lm-shadow-floating: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

    /* 타이포그래피 */
    --lm-font-family: 'Pretendard', 'Noto Sans KR', sans-serif;
}

/* 공통 버튼 스타일 시스템 */
.action-btn {
    font-family: var(--lm-font-family);
    border-radius: var(--lm-radius-base) !important;
    font-weight: 600;
    transition: all 0.2s ease-in-out;
}

/* Primary Button */
.btn-blue,
.btn-primary {
    background: var(--lm-color-primary) !important;
    color: white !important;
    border: none !important;
}

.btn-blue:hover,
.btn-primary:hover {
    background: var(--lm-color-primary-hover) !important;
    box-shadow: var(--lm-shadow-card);
}

/* Accent Button (긍정적인 주요 동작 시) */
.btn-green {
    background: var(--lm-color-accent) !important;
    color: white !important;
    border: none !important;
}

.btn-green:hover {
    background: var(--lm-color-accent-hover) !important;
    box-shadow: var(--lm-shadow-card);
}

/* Ghost / Secondary Button */
.btn-gray {
    background: transparent !important;
    color: var(--lm-color-text-muted) !important;
    border: 1px solid var(--lm-border-color) !important;
}

.btn-gray:hover {
    background: #F9FAFB !important;
    color: var(--lm-color-text-main) !important;
    border-color: #D1D5DB !important;
}

/* Danger Button (삭제/초기화) */
.btn-danger {
    background: #fff1f2 !important;
    color: var(--lm-color-danger) !important;
    border: 1px solid #fecaca !important;
}

.btn-danger:hover {
    background: #fee2e2 !important;
    color: var(--lm-color-danger-hover) !important;
}

/* Warning Button (경고성 액션) */
.btn-warning {
    background: var(--lm-color-warning) !important;
    color: white !important;
    border: none !important;
}

.btn-warning:hover {
    background: var(--lm-color-warning-hover) !important;
    box-shadow: var(--lm-shadow-card);
}

/* ────────────────────────────────────
   C62: 사이드바 토글 버튼 (보기 설정)
   ──────────────────────────────────── */
.lm-toggle-btn {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #cbd5e1;
    border-radius: var(--lm-radius-sm);
    background: #f8fafc;
    color: #475569;
    font-size: 12px;
    cursor: pointer;
    text-align: center;
    transition: all 0.15s ease;
    font-family: var(--lm-font-family);
}

.lm-toggle-btn:hover {
    background: #f0f4f8;
    border-color: #94a3b8;
    color: var(--lm-color-text-main);
}

.lm-toggle-btn[data-active="true"],
.lm-toggle-btn.active {
    background: var(--lm-color-primary);
    color: white;
    border-color: var(--lm-color-primary);
}

/* ────────────────────────────────────
   C62: 데이터 출력 버튼
   ──────────────────────────────────── */
.lm-data-btn {
    width: 100%;
    padding: 8px 12px;
    border-radius: var(--lm-radius-sm);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
    font-family: var(--lm-font-family);
}

.lm-data-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--lm-shadow-card);
}

.lm-data-btn.data-info {
    background: #f0f9ff;
    color: var(--lm-color-info);
    border: 1px solid #bae6fd;
}

.lm-data-btn.data-dark {
    background: #0f172a;
    color: #38bdf8;
    border: 1px solid #334155;
}

.lm-data-btn.data-purple {
    background: #f0f9ff;
    color: #6366f1;
    border: 1px solid #c7d2fe;
}

.lm-data-btn.data-green {
    background: #f0f9ff;
    color: var(--lm-color-success);
    border: 1px solid #a7f3d0;
}

/* ────────────────────────────────────
   C62: 프리셋 소형 버튼
   ──────────────────────────────────── */
.lm-preset-btn {
    flex: 1;
    padding: 4px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    background: white;
    font-size: 10px;
    cursor: pointer;
    color: #475569;
    transition: all 0.15s ease;
}

.lm-preset-btn:hover {
    background: #f0f9ff;
    border-color: var(--lm-color-primary);
    color: var(--lm-color-primary);
}

/* ────────────────────────────────────
   C62: CTA 버튼 (로그인, 온보딩 등)
   ──────────────────────────────────── */
.lm-cta-primary {
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, var(--lm-color-primary), var(--lm-color-primary-hover));
    color: white;
    border: none;
    border-radius: var(--lm-radius-base);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(43, 92, 146, 0.3);
}

.lm-cta-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(43, 92, 146, 0.4);
}

.lm-cta-success {
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, #10b981, var(--lm-color-success));
    color: white;
    border: none;
    border-radius: var(--lm-radius-base);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.3);
}

.lm-cta-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.4);
}

.lm-cta-danger {
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, #ef4444, var(--lm-color-danger));
    color: white;
    border: none;
    border-radius: var(--lm-radius-base);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
}

.lm-cta-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
}

/* ────────────────────────────────────
   C62: 아이콘 전용 버튼 (닫기, 이모지 등)
   ──────────────────────────────────── */
.lm-icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 6px;
    font-size: 16px;
    color: #94a3b8;
    transition: color 0.15s;
    line-height: 1;
}

.lm-icon-btn:hover {
    color: var(--lm-color-text-main);
}

/* ────────────────────────────────────
   C63: 아코디언 섹션
   ──────────────────────────────────── */
.lm-accordion {
    margin-bottom: 12px;
}

.lm-accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    cursor: pointer;
    user-select: none;
    border-radius: var(--lm-radius-sm);
    transition: background 0.15s;
}

.lm-accordion-header:hover {
    background: #f0f4f8;
}

.lm-accordion-header h3 {
    font-size: 12px;
    color: #64748b;
    margin: 0;
    text-transform: uppercase;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 4px;
}

.lm-accordion-arrow {
    font-size: 10px;
    color: #94a3b8;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.lm-accordion.collapsed .lm-accordion-arrow {
    transform: rotate(-90deg);
}

.lm-accordion-body {
    overflow: hidden;
    max-height: 2000px;
    transition: max-height 0.3s ease, opacity 0.2s ease;
    opacity: 1;
}

.lm-accordion.collapsed .lm-accordion-body {
    max-height: 0;
    opacity: 0;
    padding: 0 !important;
    margin: 0 !important;
}

/* 패널 공통 */
.control-panel,
.land-item {
    border-radius: var(--lm-radius-base) !important;
    border: 1px solid var(--lm-border-color) !important;
    box-shadow: var(--lm-shadow-card) !important;
    background: var(--lm-color-bg-panel) !important;
}

.panel-title {
    color: var(--lm-color-primary) !important;
    /* 약간 전문적인 포인트 */
    font-weight: 700 !important;
}

/* 스위치 및 라벨 */
.switch-row input {
    accent-color: var(--lm-color-primary) !important;
}

/* 1-5 지도 컨트롤 디자인 오버라이드 */
.leaflet-bar {
    border: none !important;
    box-shadow: var(--lm-shadow-card) !important;
    border-radius: var(--lm-radius-base) !important;
    overflow: hidden;
}

.leaflet-bar a {
    background-color: var(--lm-color-bg-panel) !important;
    color: var(--lm-color-text-main) !important;
    border-bottom: 1px solid var(--lm-border-color) !important;
    transition: all 0.2s;
}

.leaflet-bar a:hover {
    background-color: var(--lm-color-bg-body) !important;
    color: var(--lm-color-primary) !important;
}

/* 모드 상태 알림 플로팅 뱃지 */
#area-status-msg {
    display: inline-block !important;
    background: var(--lm-color-accent) !important;
    color: white !important;
    padding: 8px 16px !important;
    border-radius: var(--lm-radius-pill) !important;
    font-weight: 700 !important;
    box-shadow: var(--lm-shadow-floating) !important;
    position: fixed !important;
    top: 80px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    z-index: 3000 !important;
    font-size: 14px !important;
    pointer-events: none !important;
}

/* 인체공학적 UI (행동 흐름 기반 모드 분리) */
.ergonomic-block {
    background: var(--lm-color-bg-panel);
    border: 1px solid var(--lm-border-color);
    border-radius: var(--lm-radius-base);
    padding: 12px;
    margin-bottom: 16px;
    box-shadow: var(--lm-shadow-card);
}

.ergonomic-block-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--lm-color-primary);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--lm-border-color);
}

.ergonomic-block-desc {
    font-size: 11px;
    color: var(--lm-color-text-muted);
    margin-bottom: 12px;
    line-height: 1.4;
}

/* ========================================
   Land Analysis Modal (연도별 공시지가 조회)
   ======================================== */
.la-modal-overlay {
    position: fixed; inset: 0;
    background: rgba(11, 18, 32, 0.96);
    z-index: 100000;
    display: none; flex-direction: column;
    opacity: 0; transition: opacity 0.25s ease;
    font-family: "Malgun Gothic", system-ui, -apple-system, sans-serif;
    color: #e8eefc;
    cursor: default;
}
.la-modal-overlay.show { display: flex; opacity: 1; }

/* Header */
.la-modal-overlay .la-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 18px; background: #0b1429;
    border-bottom: 1px solid rgba(255,255,255,0.1); flex-shrink: 0;
}
.la-modal-overlay .la-header-left { display: flex; align-items: center; gap: 10px; }
.la-modal-overlay .la-header-left h2 { margin: 0; font-size: 18px; color: #38bdf8; font-weight: 800; }
.la-modal-overlay .la-header-right { display: flex; align-items: center; gap: 8px; }
.la-modal-overlay .la-year-label { font-size: 12px; color: #a9b7d6; display: flex; align-items: center; gap: 4px; }
.la-modal-overlay .la-year-input {
    width: 70px; padding: 4px 6px; background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12); border-radius: 6px;
    color: #e8eefc; font-size: 13px; text-align: center;
}
.la-modal-overlay .la-status { font-size: 12px; color: #a9b7d6; }

/* Buttons */
.la-modal-overlay .la-btn {
    border: none; padding: 7px 12px; border-radius: 8px; font-weight: 700;
    cursor: pointer; font-size: 12px; color: #fff;
}
.la-modal-overlay .la-btn-close { background: rgba(255,255,255,0.08); color: #e8eefc; border: 1px solid rgba(255,255,255,0.12); }
.la-modal-overlay .la-btn-close:hover { background: rgba(255,255,255,0.15); }
.la-modal-overlay .la-btn-danger { background: rgba(255,91,108,0.18); color: #ffd5da; border: 1px solid rgba(255,91,108,0.45); }
.la-modal-overlay .la-btn-danger:disabled { opacity: 0.5; cursor: not-allowed; }
.la-modal-overlay .la-btn-secondary { background: rgba(255,255,255,0.08); color: #e8eefc; border: 1px solid rgba(255,255,255,0.12); }
.la-modal-overlay .la-btn-back { background: rgba(43,124,255,0.22); color: #d9e8ff; border: 1px solid rgba(43,124,255,0.42); }
.la-modal-overlay .la-link-btn {
    padding: 4px 10px; font-size: 11px; border-radius: 999px; border: none; cursor: pointer;
    background: rgba(43,124,255,0.22); border: 1px solid rgba(43,124,255,0.42); color: #d9e8ff; font-weight: 600;
}
.la-modal-overlay .la-link-btn:hover { background: rgba(43,124,255,0.35); }

/* Pills */
.la-modal-overlay .la-pill {
    display: inline-flex; align-items: center; padding: 3px 10px;
    border-radius: 999px; font-size: 11px; font-weight: 600;
    border: 1px solid rgba(255,255,255,0.12); background: rgba(255,255,255,0.06);
}
.la-modal-overlay .la-pill-ok { border-color: rgba(53,194,123,0.55); background: rgba(53,194,123,0.12); color: #c9ffe6; }
.la-modal-overlay .la-pill-bad { border-color: rgba(255,91,108,0.65); background: rgba(255,91,108,0.14); color: #ffd5da; }
.la-modal-overlay .la-pill-warn { border-color: rgba(255,176,32,0.55); background: rgba(255,176,32,0.12); color: #ffe6ba; }

/* Body */
.la-modal-overlay .la-body { flex: 1; overflow: auto; padding: 14px 18px; }

/* Table view */
.la-modal-overlay .la-results-table { width: 100%; border-collapse: collapse; border-radius: 10px; overflow: hidden; }
.la-modal-overlay .la-results-table th,
.la-modal-overlay .la-results-table td {
    border-bottom: 1px solid rgba(255,255,255,0.08); padding: 8px 8px; text-align: center; font-size: 12px;
}
.la-modal-overlay .la-results-table th { background: rgba(255,255,255,0.06); color: #a9b7d6; font-weight: 700; }
.la-modal-overlay .la-results-table td { background: rgba(255,255,255,0.02); }
.la-modal-overlay .la-pnu-cell { font-family: ui-monospace, monospace; font-size: 11px; }

/* Detail view (hidden by default) */
.la-modal-overlay .la-detail-view { display: none; }
.la-modal-overlay.la-view-detail .la-detail-view { display: block; }
.la-modal-overlay.la-view-detail .la-table-view { display: none; }

.la-modal-overlay .la-detail-top {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid rgba(255,255,255,0.1);
}
.la-modal-overlay .la-detail-title { flex: 1; }
.la-modal-overlay .la-detail-pnu { font-weight: 900; font-size: 14px; margin-right: 10px; }
.la-modal-overlay .la-detail-addr { font-size: 12px; color: #a9b7d6; }
.la-modal-overlay .la-detail-actions { display: flex; gap: 6px; }
.la-modal-overlay .la-detail-body { max-height: calc(100vh - 150px); overflow: auto; }

/* Detail cards grid */
.la-modal-overlay .la-detail-cols {
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
@media (max-width: 980px) {
    .la-modal-overlay .la-detail-cols { grid-template-columns: 1fr; }
}
.la-modal-overlay .la-card {
    background: #111f3d; border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px; padding: 12px;
}
.la-modal-overlay .la-card h3 { margin: 0 0 6px; font-size: 13px; color: #38bdf8; }
.la-modal-overlay .la-meta { color: #a9b7d6; font-size: 11px; margin: 0 0 8px; }
.la-modal-overlay .la-total-hint { margin-top: 10px; font-size: 12px; color: #a9b7d6; line-height: 1.5; }
.la-modal-overlay .la-total-hint b { color: #e8eefc; }

/* KV tables inside cards */
.la-modal-overlay .la-kv { width: 100%; border-collapse: collapse; border-radius: 8px; overflow: hidden; }
.la-modal-overlay .la-kv th,
.la-modal-overlay .la-kv td { padding: 6px 8px; font-size: 11px; text-align: left; border-bottom: 1px solid rgba(255,255,255,0.06); }
.la-modal-overlay .la-kv th { width: 42%; color: #a9b7d6; background: rgba(255,255,255,0.04); }
.la-modal-overlay .la-kv td { background: rgba(255,255,255,0.02); word-break: break-all; }

/* ────────────────────────────────────
   C64: 팝업 카드 스타일 (P1 간단 / P2 상세 / 검색)
   ──────────────────────────────────── */

/* Leaflet 팝업 컨테이너 오버라이드 */
.leaflet-popup-content-wrapper {
    border-radius: var(--lm-radius-base) !important;
    box-shadow: var(--lm-shadow-floating) !important;
    padding: 0 !important;
    overflow: hidden;
}
.leaflet-popup-content {
    margin: 0 !important;
    line-height: 1.5 !important;
}
.leaflet-popup-tip {
    box-shadow: none !important;
}

/* 기본 팝업 카드 */
.lm-popup-card {
    font-family: var(--lm-font-family);
    background: #fff;
    min-width: 200px;
    color: var(--lm-color-text-main);
    font-size: 13px;
    line-height: 1.5;
}

/* 팝업 헤더 */
.lm-popup-header {
    padding: 12px 14px 10px;
    border-bottom: 2px solid var(--lm-color-primary);
    text-align: center;
}
.lm-popup-header-title {
    font-weight: 800;
    font-size: 15px;
    color: var(--lm-color-text-main);
    word-break: keep-all;
    line-height: 1.4;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex-wrap: wrap;
}
.lm-popup-header-sub {
    font-size: 12px;
    color: var(--lm-color-text-muted);
    margin-top: 2px;
    font-weight: 500;
}

/* P2 상세 팝업 헤더 — 좀 더 넓게 */
.lm-popup-header-detail {
    padding: 14px 16px 10px;
    border-bottom: 2px solid var(--lm-color-primary);
    text-align: center;
}
.lm-popup-header-detail .lm-popup-header-title {
    font-size: 16px;
}
.lm-popup-header-detail .lm-popup-header-sub {
    font-size: 13px;
    margin-top: 4px;
}

/* 팝업 본문 */
.lm-popup-body {
    padding: 10px 14px 14px;
}

/* 정보 섹션 (색상 있는 박스) */
.lm-popup-section {
    padding: 8px 10px;
    border-radius: var(--lm-radius-sm);
    margin-bottom: 8px;
    border: 1px solid var(--lm-border-color);
    text-align: left;
}
.lm-popup-section:last-child {
    margin-bottom: 0;
}
.lm-popup-section-title {
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 4px;
}
.lm-popup-section-value {
    font-size: 14px;
    font-weight: 700;
    color: var(--lm-color-text-main);
}

/* 색상 변형 섹션들 */
.lm-popup-section.section-default  { background: #f8fafc; border-color: #e2e8f0; }
.lm-popup-section.section-warn     { background: #fef3c7; border-color: #fde68a; }
.lm-popup-section.section-price    { background: #eff6ff; border-color: #bfdbfe; }
.lm-popup-section.section-green    { background: #f0fdf4; border-color: #dcfce7; }
.lm-popup-section.section-housing  { background: #f0fdf4; border-color: #bbf7d0; }
.lm-popup-section.section-area-ok  { background: #f0fdf4; border-color: #dcfce7; }
.lm-popup-section.section-area-mid { background: #fffbeb; border-color: #fde68a; }
.lm-popup-section.section-area-bad { background: #fef2f2; border-color: #fecaca; }
.lm-popup-section.section-bcr      { background: #fef3c7; border-color: #fde68a; }
.lm-popup-section.section-reg      { background: #f0fdf4; border-color: #dcfce7; }
.lm-popup-section.section-danger   { background: #fef2f2; border-color: #fecaca; border-width: 2px; border-style: dashed; }
.lm-popup-section.section-building { background: #dbeafe; border-color: #bfdbfe; }
.lm-popup-section.section-history  { background: #faf5ff; border-color: #e9d5ff; }
.lm-popup-section.section-sibling  { background: #eff6ff; border-color: #bfdbfe; }
.lm-popup-section.section-docs     { background: #f0fdf4; border-color: #bbf7d0; }
.lm-popup-section.section-trade    { /* 동적 로딩 영역 */ }
.lm-popup-section.section-road-ok  { background: #f0fdf4; border-color: #dcfce7; }
.lm-popup-section.section-road-bad { background: #fef2f2; border-color: #fecaca; }

/* 키-값 행 */
.lm-popup-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 12px;
    color: #475569;
    padding: 2px 0;
}
.lm-popup-row b {
    color: var(--lm-color-text-main);
}
.lm-popup-row + .lm-popup-row {
    border-top: 1px solid rgba(0, 0, 0, 0.04);
}

/* 팝업 내 버튼 */
.lm-popup-btn {
    font-family: var(--lm-font-family);
    padding: 7px 10px;
    border: none;
    border-radius: var(--lm-radius-sm);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    text-align: center;
}
.lm-popup-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--lm-shadow-card);
}
.lm-popup-btn.btn-popup-primary {
    background: var(--lm-color-primary);
    color: white;
}
.lm-popup-btn.btn-popup-primary:hover {
    background: var(--lm-color-primary-hover);
}
.lm-popup-btn.btn-popup-register {
    background: #f59e0b;
    color: white;
}
.lm-popup-btn.btn-popup-register:hover {
    background: #d97706;
}
.lm-popup-btn.btn-popup-delete {
    background: #fff1f2;
    color: #ef4444;
    border: 1px solid #fee2e2;
}
.lm-popup-btn.btn-popup-delete:hover {
    background: #fee2e2;
}
.lm-popup-btn.btn-popup-save {
    background: var(--lm-color-primary);
    color: white;
}
.lm-popup-btn.btn-popup-save:hover {
    background: var(--lm-color-primary-hover);
}

/* P1 편집 영역 (그룹명 + 메모 + 색상) */
.lm-popup-edit-section {
    padding: 6px 0 4px;
    border-bottom: 1px solid var(--lm-color-border-light, #e2e8f0);
    margin-bottom: 6px;
}

.lm-popup-edit-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.lm-p1-input {
    flex: 1;
    min-width: 0;
    padding: 6px 8px;
    font-size: 13px;
    border: 1px solid var(--lm-color-border-light, #e2e8f0);
    border-radius: 6px;
    outline: none;
}

.lm-p1-input:focus {
    border-color: var(--lm-color-primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.lm-p1-textarea {
    width: 100%;
    padding: 6px 8px;
    font-size: 12px;
    border: 1px solid var(--lm-color-border-light, #e2e8f0);
    border-radius: 6px;
    outline: none;
    resize: vertical;
    min-height: 36px;
    font-family: inherit;
    line-height: 1.4;
}

.lm-p1-textarea:focus {
    border-color: var(--lm-color-primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

/* 🎨 색상 선택 팔레트 */
.lm-popup-color-row {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0;
    flex-shrink: 0;
}

.lm-color-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.15s, border-color 0.15s;
    flex-shrink: 0;
}

.lm-color-dot:hover {
    transform: scale(1.2);
    border-color: rgba(0, 0, 0, 0.3);
}

.lm-color-dot.active {
    border-color: #1e293b;
    transform: scale(1.15);
    box-shadow: 0 0 0 2px white, 0 0 0 4px #1e293b;
}

/* 버튼 그룹 */
.lm-popup-btn-group {
    display: flex;
    gap: 6px;
    margin-top: 10px;
}
.lm-popup-btn-group .lm-popup-btn {
    flex: 1;
}

/* 서류 링크 버튼 */
.lm-popup-link {
    flex: 1;
    min-width: 120px;
    display: inline-block;
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
    padding: 5px 8px;
    border-radius: 4px;
    font-size: 11px;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s ease;
}
.lm-popup-link:hover {
    background: #bbf7d0;
    transform: translateY(-1px);
}

/* 팝업 내 폼 영역 */
.lm-popup-form {
    margin-top: 10px;
    border-top: 1px solid var(--lm-border-color);
    padding-top: 10px;
    text-align: left;
}
.lm-popup-form label {
    font-size: 11px;
    color: var(--lm-color-text-muted);
    font-weight: 600;
    display: block;
    margin-bottom: 2px;
}
.lm-popup-form input,
.lm-popup-form textarea {
    width: 100%;
    padding: 6px 8px;
    font-size: 12px;
    border: 1px solid var(--lm-border-color);
    border-radius: var(--lm-radius-sm);
    margin-bottom: 6px;
    font-family: var(--lm-font-family);
    transition: border-color 0.15s;
}
.lm-popup-form input:focus,
.lm-popup-form textarea:focus {
    outline: none;
    border-color: var(--lm-color-primary);
    box-shadow: 0 0 0 2px rgba(43, 92, 146, 0.1);
}
.lm-popup-form textarea {
    height: 40px;
    resize: vertical;
}

/* 면적 텍스트 */
.lm-popup-area-text {
    font-size: 13px;
    color: #475569;
}

/* 추정가 강조 박스 */
.lm-popup-estimate {
    background: #eff6ff;
    color: #2563eb;
    padding: 8px;
    border-radius: var(--lm-radius-base);
    margin-top: 8px;
    font-weight: 700;
    text-align: center;
}

/* 면적 오차 결과 */
.lm-popup-area-result {
    font-size: 12px;
    font-weight: 700;
    margin-top: 4px;
}

/* 뱃지 (P1 인라인 뱃지) */
.lm-popup-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
}
.lm-popup-badge.badge-error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}
.lm-popup-badge.badge-warn {
    background: #fffbeb;
    color: #b45309;
    border: 1px solid #fde68a;
}

/* 토글 링크 (접함/저촉 펼침) */
.lm-popup-toggle {
    font-size: 11px;
    color: var(--lm-color-text-muted);
    cursor: pointer;
    padding: 4px 0 2px;
}
.lm-popup-toggle:hover {
    color: var(--lm-color-primary);
}

/* ════════════════════════════════════════════
   C65: 반응형 모바일 레이아웃
   ════════════════════════════════════════════ */
@media (max-width: 768px) {

    /* ─── 사이드바: 전체 폭 오버레이 ─── */
    .sidebar {
        width: 100vw !important;
    }

    #sidebar-left {
        left: -100vw !important;
    }

    #sidebar-left.open {
        left: 0 !important;
    }

    #sidebar-right {
        right: -100vw !important;
        width: 100vw !important;
    }

    #sidebar-right.open {
        right: 0 !important;
    }

    /* ─── 지도: 전체 화면 ─── */
    #map-container {
        width: 100vw !important;
        min-width: 100vw !important;
    }

    /* ─── 패널 토글 버튼 → 하단 플로팅 바 ─── */
    .panel-toggle-btn {
        position: fixed !important;
        top: auto !important;
        bottom: 16px !important;
        left: 16px !important;
        right: auto !important;
        z-index: 2100 !important;
        padding: 10px 14px !important;
        font-size: 13px !important;
        border-radius: var(--lm-radius-pill) !important;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25) !important;
    }

    .panel-toggle-btn-right {
        left: auto !important;
        right: 16px !important;
    }

    /* ─── 플로팅 검색바: 모바일 대응 ─── */
    #floating-search {
        width: calc(100vw - 32px) !important;
        top: 8px !important;
        padding: 3px 3px 3px 10px !important;
    }

    #floating-search-input {
        font-size: 13px !important;
        padding: 8px 4px !important;
    }

    #floating-search-input::placeholder {
        font-size: 11px !important;
    }

    #floating-search-btn {
        padding: 0 12px !important;
        font-size: 12px !important;
        height: 32px !important;
    }

    #floating-myloc-btn {
        width: 32px !important;
        height: 32px !important;
        font-size: 14px !important;
    }

    #floating-search-msg {
        top: 52px !important;
        max-width: calc(100vw - 40px) !important;
        font-size: 11px !important;
    }

    /* ─── 공지 바로가기: 모바일 위치 조정 ─── */
    #notice-link {
        top: auto !important;
        bottom: 60px !important;
        right: auto !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        padding: 6px 12px !important;
        font-size: 12px !important;
        z-index: 2050 !important;
    }

    /* ─── Leaflet 팝업: 모바일 너비 조정 ─── */
    .leaflet-popup-content-wrapper {
        max-width: calc(100vw - 40px) !important;
    }

    .leaflet-popup-content {
        max-width: calc(100vw - 60px) !important;
        font-size: 13px !important;
    }

    .lm-popup-card {
        min-width: unset !important;
        max-width: calc(100vw - 60px) !important;
    }

    /* ─── Leaflet 줌 컨트롤: 모바일 위치 ─── */
    .leaflet-control-zoom {
        margin-top: 56px !important;
    }

    /* ─── 규제 패널: 모바일 위치 조정 ─── */
    #regulation-panel {
        left: 16px !important;
        right: 16px !important;
        width: auto !important;
        bottom: 70px !important;
    }

    /* ─── 모드 상태 뱃지: 모바일 위치 ─── */
    #area-status-msg {
        top: 60px !important;
        font-size: 12px !important;
        padding: 6px 12px !important;
        max-width: calc(100vw - 40px) !important;
    }

    /* ─── 컨트롤 패널 내부: 터치 타겟 확대 ─── */
    .switch-row {
        min-height: 40px !important;
        padding: 4px 0 !important;
    }

    .switch-row input {
        transform: scale(1.4) !important;
        margin-right: 12px !important;
    }

    .lm-toggle-btn {
        padding: 10px 12px !important;
        font-size: 13px !important;
        min-height: 40px !important;
    }

    .lm-data-btn {
        padding: 12px 14px !important;
        font-size: 13px !important;
        min-height: 44px !important;
    }

    .lm-preset-btn {
        padding: 8px !important;
        font-size: 12px !important;
        min-height: 36px !important;
    }

    .action-btn {
        min-height: 44px !important;
        font-size: 14px !important;
    }

    /* ─── CTA 버튼: 모바일 터치 타겟 ─── */
    .lm-cta-primary,
    .lm-cta-success,
    .lm-cta-danger {
        padding: 16px 20px !important;
        font-size: 16px !important;
    }

    /* ─── 온보딩 모달: 모바일 대응 ─── */
    .onboarding-modal {
        max-width: calc(100vw - 24px) !important;
        padding: 20px !important;
    }

    .onboarding-modal h2 {
        font-size: 18px !important;
    }

    /* ─── Land Analysis 모달: 모바일 대응 ─── */
    .la-modal-overlay .la-header {
        padding: 10px 12px !important;
        flex-wrap: wrap !important;
    }

    .la-modal-overlay .la-header-left h2 {
        font-size: 15px !important;
    }

    .la-modal-overlay .la-body {
        padding: 10px 12px !important;
    }

    .la-modal-overlay .la-detail-cols {
        grid-template-columns: 1fr !important;
    }

    .la-modal-overlay .la-results-table th,
    .la-modal-overlay .la-results-table td {
        padding: 6px 4px !important;
        font-size: 11px !important;
    }

    .la-modal-overlay .la-detail-top {
        flex-direction: column !important;
        align-items: flex-start !important;
    }

    .la-modal-overlay .la-detail-actions {
        width: 100% !important;
    }

    .la-modal-overlay .la-detail-actions .la-btn {
        flex: 1 !important;
        text-align: center !important;
    }

    /* ─── 사이드바 헤더: 모바일 패딩 ─── */
    .sidebar-header {
        padding: 12px 14px !important;
    }

    .header-title {
        font-size: 14px !important;
    }

    /* ─── 사이드바 콘텐츠: 모바일 패딩 ─── */
    .sidebar-content {
        padding: 12px !important;
    }

    /* ─── 아코디언: 모바일 터치 타겟 ─── */
    .lm-accordion-header {
        padding: 10px 12px !important;
        min-height: 40px !important;
    }

    /* ─── 크레딧 모달: 모바일 대응 ─── */
    .credit-modal-overlay .deduct-modal-content,
    .credit-modal-overlay .charge-modal-content {
        max-width: calc(100vw - 32px) !important;
        margin: 0 16px !important;
    }

    /* ─── 플로팅 검색 드롭다운: 모바일 너비 ─── */
    #floating-search-dropdown {
        max-height: 200px !important;
    }

    /* ─── 팝업 버튼: 모바일 터치 타겟 ─── */
    .lm-popup-btn {
        padding: 10px 12px !important;
        font-size: 13px !important;
        min-height: 40px !important;
    }

    .lm-popup-btn-group {
        flex-wrap: wrap !important;
    }

    /* ─── 팝업 폼: 모바일 입력 필드 확대 ─── */
    .lm-popup-form input,
    .lm-popup-form textarea {
        font-size: 14px !important;
        padding: 8px 10px !important;
    }
}

/* 소스 참고 문구 */
.lm-popup-footnote {
    font-size: 9px;
    color: #94a3b8;
    margin-top: 4px;
    line-height: 1.3;
}

/* ────────────────────────────────────
   C61: 사이드바 검색 자동완성 드롭다운
   ──────────────────────────────────── */
.lm-search-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--lm-border-color);
    border-radius: 0 0 var(--lm-radius-base) var(--lm-radius-base);
    box-shadow: var(--lm-shadow-floating);
    z-index: 100;
    max-height: 240px;
    overflow-y: auto;
}

.lm-search-dropdown.visible {
    display: block;
}

.lm-search-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    font-size: 11px;
    color: var(--lm-color-text-muted);
    border-bottom: 1px solid var(--lm-border-color);
    font-family: var(--lm-font-family);
}

.lm-search-dropdown-clear {
    font-size: 11px;
    color: var(--lm-color-text-muted);
    cursor: pointer;
    border: none;
    background: none;
    padding: 0;
    font-family: var(--lm-font-family);
    transition: color 0.15s ease;
}

.lm-search-dropdown-clear:hover {
    color: var(--lm-color-danger);
}

.lm-search-dropdown-item {
    padding: 10px 12px;
    font-size: 12px;
    color: var(--lm-color-text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.15s ease;
    font-family: var(--lm-font-family);
}

.lm-search-dropdown-item:hover {
    background: var(--lm-color-bg-body);
}

.lm-search-dropdown-item:last-child {
    border-radius: 0 0 var(--lm-radius-base) var(--lm-radius-base);
}

/* ────────────────────────────────────
   C60: 사이드바 서브탭
   ──────────────────────────────────── */
.lm-subtab-bar {
    display: flex;
    border-bottom: 2px solid var(--lm-border-color);
    background: var(--lm-color-bg-panel);
    position: sticky;
    top: 0;
    z-index: 11;
    margin: -15px -15px 0 -15px;
    padding: 0 4px;
}

.lm-subtab {
    flex: 1;
    padding: 10px 8px;
    text-align: center;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: var(--lm-color-text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.15s ease;
    font-family: var(--lm-font-family);
    user-select: none;
}

.lm-subtab:hover {
    color: var(--lm-color-primary);
    background: #f0f4f8;
}

.lm-subtab.active {
    color: var(--lm-color-primary);
    border-bottom-color: var(--lm-color-primary);
}

.lm-subtab-content {
    display: none;
}

.lm-subtab-content.active {
    display: block;
}

/* 모바일 서브탭 */
@media (max-width: 768px) {
    .lm-subtab {
        padding: 12px 8px !important;
        font-size: 13px !important;
        min-height: 44px !important;
    }
}