/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --danger: #dc2626;
    --success: #16a34a;
    --bg: #f1f5f9;
    --card: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --radius: 12px;
}

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 24px 16px 48px;
}

/* ── Header ──────────────────────────────────────────────── */
header {
    text-align: center;
    margin-bottom: 24px;
}

header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
}

.btn-kakao {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-top: 14px;
    padding: 9px 20px;
    background: #FEE500;
    color: #191919;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    transition: background 0.15s, transform 0.1s;
}
.btn-kakao:hover  { background: #f5db00; transform: translateY(-1px); }
.btn-kakao:active { transform: translateY(0); box-shadow: none; }

.subtitle {
    color: var(--text-light);
    font-size: 0.95rem;
}

/* ── Card ────────────────────────────────────────────────── */
.card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.card h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text);
}

.card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 24px 0 12px;
}

/* ── Search ──────────────────────────────────────────────── */
.search-row {
    display: flex;
    gap: 8px;
}

.search-row input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

.search-row input:focus {
    border-color: var(--primary);
}

/* ── Select Grid ─────────────────────────────────────────── */
.select-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

/* ── List Box (단지 목록) ────────────────────────────────── */
.list-box {
    margin-top: 12px;
    max-height: 240px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
}

button {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

button:hover { background: var(--primary-dark); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Address Results ─────────────────────────────────────── */
#address-results {
    margin-top: 12px;
}

.addr-item {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    font-size: 0.93rem;
}

.addr-item:hover {
    background: #eff6ff;
    border-color: var(--primary);
}

/* ── Select Row ──────────────────────────────────────────── */
.select-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
    align-items: end;
}

#btn-fetch-price {
    grid-column: 1 / -1;
    width: 100%;
}

.select-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 120px;
}

.select-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-light);
}

.select-group select {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    background: #fff;
    outline: none;
}

.info-text {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 12px;
}

/* ── Loading ─────────────────────────────────────────────── */
#loading {
    text-align: center;
    padding: 32px;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 12px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Info Box ────────────────────────────────────────────── */
.info-box {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.info-item {
    display: flex;
    flex-direction: column;
}

.info-item:last-child {
    grid-column: 1 / -1;
}

.info-item .label {
    font-size: 0.8rem;
    color: var(--text-light);
    font-weight: 500;
}

.info-item .value {
    font-size: 1rem;
    font-weight: 600;
}

/* ── Table ───────────────────────────────────────────────── */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

thead th {
    background: var(--primary);
    color: #fff;
    padding: 10px 12px;
    text-align: right;
    font-weight: 600;
    font-size: 0.9rem;
    border-bottom: 2px solid var(--primary-dark);
    white-space: nowrap;
}

thead th:first-child {
    text-align: left;
}

tbody td {
    padding: 10px 12px;
    text-align: right;
    border-bottom: 1px solid var(--border);
}

tbody td:first-child {
    text-align: left;
    font-weight: 500;
}

/* 마지막 행 스타일은 .total-row에서 개별 정의 */

.positive { color: var(--danger); }
.negative { color: var(--success); }

/* ── Detail Grid ─────────────────────────────────────────── */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 24px;
}

.detail-col {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px 12px;
    min-width: 0;
}

.detail-col h4 {
    font-size: 0.95rem;
    margin-bottom: 12px;
    color: var(--primary);
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 0.88rem;
    border-bottom: 1px solid #e9ecef;
}

.detail-row:last-child { border-bottom: none; }

.detail-row .dl { color: var(--text-light); }
.detail-row .dv { font-weight: 600; }

.detail-row.total {
    border-top: 2px solid var(--primary);
    margin-top: 4px;
    padding-top: 8px;
    font-weight: 700;
}

/* ── Footer ──────────────────────────────────────────────── */
footer {
    text-align: center;
    margin-top: 32px;
    color: var(--text-light);
    font-size: 0.82rem;
    line-height: 1.7;
}

/* ── Address Search Grid ─────────────────────────────────── */
.addr-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.addr-row .select-group {
    flex: 1;
    min-width: 120px;
}

#apt-name-input-j,
#apt-name-input-r {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

#apt-name-input-j:focus,
#apt-name-input-r:focus {
    border-color: var(--primary);
    outline: none;
}

.addr-input-row .select-group input[type="text"] {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.addr-input-row .select-group input[type="text"]:focus {
    border-color: var(--primary);
}

.bunji-inputs {
    display: flex;
    align-items: center;
    gap: 6px;
}

.bunji-inputs input {
    flex: 1;
    min-width: 0;
    padding: 10px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

.bunji-inputs input:focus {
    border-color: var(--primary);
}

.dash {
    color: var(--text-light);
    font-weight: 600;
    flex-shrink: 0;
}

/* ── Search Type Toggle ──────────────────────────────────── */
.search-type-bar {
    display: flex;
    gap: 0;
    margin-bottom: 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    width: fit-content;
}

.sub-mode-row {
    display: flex;
    gap: 16px;
}

.sub-mode-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.88rem;
    color: var(--text);
    cursor: pointer;
}

.stype-btn {
    background: #fff;
    color: var(--text-light);
    border: none;
    border-radius: 0;
    padding: 8px 20px;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.stype-btn:hover {
    background: #f1f5f9;
    color: var(--text);
}

.stype-btn.active {
    background: var(--primary);
    color: #fff;
    font-weight: 600;
}

/* ── Road List UI ────────────────────────────────────────── */
.road-list-wrap {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.road-alpha-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.alpha-btn {
    padding: 5px 10px;
    font-size: 0.82rem;
    font-weight: 600;
    background: #f1f5f9;
    color: var(--text);
    border: 1px solid #dde3ea;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    line-height: 1.2;
    min-width: 32px;
    text-align: center;
}

.alpha-btn:hover { background: #e2e8f0; }

.alpha-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

#road-list {
    width: 100%;
    border: 1px solid #dde3ea;
    border-radius: 6px;
    padding: 4px;
    font-size: 0.9rem;
    color: var(--text);
    background: #fff;
    box-sizing: border-box;
}

.search-btn-row {
    margin-top: 4px;
}

.search-btn-row button {
    padding: 10px 28px;
}


/* ── Property Card (주택 목록) ───────────────────────────── */
.property-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 8px;
    background: #f8fafc;
    flex-wrap: wrap;
}

.property-card-main {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 200px;
}

.property-no {
    font-size: 0.78rem;
    font-weight: 700;
    background: var(--primary);
    color: #fff;
    border-radius: 4px;
    padding: 2px 7px;
    white-space: nowrap;
}

.property-name {
    font-size: 0.93rem;
    font-weight: 600;
    color: var(--text);
}

.property-area {
    font-size: 0.82rem;
    color: var(--text-light);
    white-space: nowrap;
}

.property-card-prices {
    display: flex;
    gap: 16px;
    font-size: 0.85rem;
    color: var(--text-light);
    flex-wrap: wrap;
}

.btn-remove {
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
    padding: 5px 12px;
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: 6px;
    white-space: nowrap;
}

.btn-remove:hover {
    background: #fef2f2;
}

/* ── 보유 주택 목록 헤더 ─────────────────────────────────── */
.properties-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.properties-header h2 {
    margin-bottom: 0;
}

.btn-add-toggle {
    background: var(--primary);
    color: #fff;
    padding: 8px 16px;
    font-size: 0.88rem;
    font-weight: 600;
    border-radius: 8px;
    white-space: nowrap;
    flex-shrink: 0;
}

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

/* ── 빈 상태 메시지 ──────────────────────────────────────── */
.empty-state {
    padding: 24px 0 8px;
    text-align: center;
}

.empty-msg {
    font-size: 0.95rem;
    color: var(--text-light);
    margin-bottom: 4px;
}

.empty-hint {
    font-size: 0.82rem;
    color: #94a3b8;
}

/* ── 계산 버튼 행 ─────────────────────────────────────────── */
.property-calc-row {
    display: flex;
    justify-content: flex-end;
    margin-top: 14px;
}

.btn-calc {
    padding: 11px 28px;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 8px;
    background: #1e293b;
}

.btn-calc:hover {
    background: #0f172a;
}

/* ── 주택 추가 패널 ──────────────────────────────────────── */
.add-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.add-panel-header h2 {
    margin-bottom: 0;
    color: var(--primary);
}

.btn-close-panel {
    background: transparent;
    color: var(--text-light);
    border: 1px solid var(--border);
    padding: 6px 14px;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 8px;
}

.btn-close-panel:hover {
    background: #f1f5f9;
    color: var(--text);
}

.panel-sub-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}

.panel-divider {
    border-top: 1px solid var(--border);
    margin: 20px 0;
}

.property-actions {
    display: flex;
    gap: 10px;
    margin-top: 14px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.btn-secondary {
    background: #fff;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-secondary:hover {
    background: #eff6ff;
}

/* ── Detail 서브헤더 / 들여쓰기 ──────────────────────────── */
.detail-row.sub-header {
    border-bottom: 1px solid var(--border);
    padding-top: 10px;
    margin-top: 6px;
}

.detail-row.sub-header .dl {
    color: var(--text);
    font-weight: 600;
    font-size: 0.88rem;
}

.detail-row.indent .dl {
    padding-left: 12px;
    color: var(--text-light);
}

/* ── 공시가격 다주택 테이블 ──────────────────────────────── */
.price-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.price-table th, .price-table td {
    padding: 8px 10px;
    text-align: right;
    border-bottom: 1px solid var(--border);
}

.price-table th:first-child, .price-table td:first-child {
    text-align: left;
}

.price-table thead th {
    background: #f1f5f9;
    color: var(--text);
    font-weight: 600;
    border-bottom: 2px solid var(--border);
}

.price-total-row td {
    font-weight: 700;
    border-top: 2px solid var(--border);
    white-space: nowrap;
}

/* ── Utility ─────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Compare Table 행 타입별 스타일 ─────────────────────── */

/* 카테고리 헤더 행 (공시가격 합계 / 재산세 합계 / 종부세 합계) */
tbody tr.category-row td {
    font-weight: 700;
    font-size: 0.93rem;
    background: #f1f5f9;
    border-top: 2px solid #cbd5e1;
    padding-top: 12px;
    padding-bottom: 10px;
    white-space: nowrap;
}

/* 첫 번째 category-row는 위 구분선 없애기 */
tbody tr.category-row:first-child td {
    border-top: none;
}

/* 구성 항목 행 (들여쓰기) */
tbody tr.sub-row td {
    color: var(--text-light);
    font-size: 0.85rem;
    padding-top: 6px;
    padding-bottom: 6px;
}

tbody tr.sub-row td:first-child {
    padding-left: 22px;
    font-weight: 400;
}

/* 보유세 합계 행 */
tbody tr.total-row td {
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    border-top: 2px solid var(--primary-dark);
    padding-top: 8px;
    padding-bottom: 8px;
}

tbody tr.total-row td.positive { color: #fca5a5; }
tbody tr.total-row td.negative { color: #86efac; }

/* ── 세액 계산 상세 (calc-section) ────────────────────────── */
.calc-year-title {
    font-size: 0.97rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--primary);
}

.calc-section {
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 10px;
}

.calc-section-title {
    background: var(--primary);
    color: #fff;
    padding: 6px 12px;
    font-size: 0.84rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.calc-section-sum .calc-section-title {
    background: #1e293b;
}

.calc-item-header {
    background: #f1f5f9;
    padding: 5px 12px;
    font-size: 0.80rem;
    font-weight: 600;
    color: var(--text);
    border-bottom: 1px solid var(--border);
}

.calc-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 12px;
    font-size: 0.82rem;
    border-bottom: 1px solid #f1f5f9;
    gap: 8px;
}

.calc-row:last-child { border-bottom: none; }

.calc-row .cl {
    color: var(--text-light);
    flex: 1;
}

.calc-row .cv {
    font-weight: 500;
    text-align: right;
    white-space: nowrap;
    min-width: 60px;
}

.calc-row.formula {
    background: #fafafa;
    padding-left: 20px;
}

.calc-row.formula .cl {
    font-style: italic;
    color: var(--text-light);
}

.calc-row.result {
    background: #eff6ff;
}

.calc-row.result .cl {
    color: var(--primary);
    font-weight: 600;
}

.calc-row.result .cv {
    color: var(--primary);
    font-weight: 700;
}

.calc-row.bracket {
    background: #fef9c3;
    padding: 3px 12px;
    border-bottom: 1px solid #fde68a;
}

.calc-row.bracket .cl {
    color: #92400e;
    font-size: 0.78rem;
    font-weight: 600;
}

.calc-row .cl.indent {
    padding-left: 14px;
}

.calc-row.subtotal {
    background: #f8fafc;
    border-top: 1px solid var(--border);
}

.calc-row.subtotal .cl {
    color: var(--text);
    font-weight: 700;
}

.calc-row.subtotal .cv {
    font-weight: 700;
}

.calc-row.total {
    background: #1e293b;
    border-top: none;
}

.calc-row.total .cl,
.calc-row.total .cv {
    color: #fff;
    font-weight: 700;
}

.calc-row.exempt {
    background: #f0fdf4;
    padding: 6px 12px;
}

.calc-row.exempt .cl {
    color: var(--success);
    font-weight: 600;
    font-size: 0.80rem;
}

.cv.negative { color: var(--success); }

/* ── 세액 상세 통합 3컬럼 테이블 (cm-table) ─────────────── */
.cm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    margin-top: 24px;
    table-layout: fixed;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid var(--primary);
}
.cm-table .cm-th-lbl {
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    font-size: 0.88rem;
    padding: 11px 12px;
    text-align: left;
    width: 42%;
}
.cm-table .cm-th-val {
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    font-size: 0.88rem;
    padding: 11px 8px;
    text-align: right;
    width: 29%;
}
.cm-table .cm-th-val:last-child { }

/* 기본 셀 */
.cm-table td {
    padding: 7px 10px;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: middle;
    word-break: break-word;
    overflow-wrap: break-word;
}
.cm-table .cm-lbl  { color: var(--text-light); }
.cm-table .cm-v    { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* 섹션 헤더 */
.cm-table tr.cm-sec td {
    background: #dbeafe;
    color: #1d4ed8;
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: 0.04em;
    padding: 7px 12px;
    border-bottom: 1px solid #bfdbfe;
    border-top: 3px solid var(--primary);
    text-align: center;
}
/* 주택별 소헤더 (다주택) */
.cm-table tr.cm-ihdr td {
    background: #e8edf3;
    color: #1e293b;
    font-size: 0.88rem;
    font-weight: 600;
    padding: 8px 12px;
    border-bottom: 1px solid #cbd5e1;
    text-align: center;
    letter-spacing: -0.01em;
}
/* 곱셈/빼기 행 — 재산세 본세와 동일한 서식 */
.cm-table tr.cm-formula td.cm-lbl   { padding-left: 20px; font-size: 0.84rem; color: var(--text-light); }
.cm-table tr.cm-formula td.cm-v     { font-size: 0.84rem; color: var(--text-light); white-space: normal; word-break: break-word; overflow-wrap: break-word; }
/* 결과(=) 행 — 재산세 본세와 동일한 서식 */
.cm-table tr.cm-result td.cm-lbl    { padding-left: 20px; font-size: 0.84rem; color: var(--text-light); }
.cm-table tr.cm-result td.cm-v      { font-size: 0.84rem; color: var(--text-light); white-space: normal; word-break: break-word; overflow-wrap: break-word; }
/* 세율 구간 행 — 재산세 본세와 동일한 서식 */
.cm-table tr.cm-bracket td.cm-lbl   { padding-left: 20px; font-size: 0.84rem; color: var(--text-light); }
.cm-table tr.cm-bracket td.cm-v     { font-size: 0.84rem; color: var(--text-light); white-space: normal; word-break: break-word; overflow-wrap: break-word; }
/* 들여쓰기 구성 항목 */
.cm-table tr.cm-indent td.cm-lbl    { padding-left: 20px; font-size: 0.84rem; }
/* 음수(공제) 항목 */
.cm-table tr.cm-indent-neg td.cm-lbl { padding-left: 20px; font-size: 0.84rem; }
.cm-table tr.cm-indent-neg td.cm-v   { color: var(--danger); }
/* 소계 */
.cm-table tr.cm-subtotal td         { background: #f1f5f9; border-top: 2px solid #cbd5e1; }
.cm-table tr.cm-subtotal td.cm-lbl  { font-weight: 700; color: var(--text); }
.cm-table tr.cm-subtotal td.cm-v    { font-weight: 700; }
/* 재산세 합계(전체) — 다주택 */
.cm-table tr.cm-grand-subtotal td   { background: #e2e8f0; border-top: 2px solid #94a3b8; }
.cm-table tr.cm-grand-subtotal td.cm-lbl { font-weight: 700; color: var(--text); }
.cm-table tr.cm-grand-subtotal td.cm-v   { font-weight: 700; }
/* 보유세 합계 */
.cm-table tr.cm-grand-total td      { background: var(--primary); color: #fff; font-weight: 700; font-size: 0.95rem; border-top: 3px solid var(--primary-dark); }
/* 비과세 */
.cm-table tr.cm-exempt td           { background: #f0fdf4; color: var(--success); font-weight: 600; font-size: 0.83rem; padding: 8px 16px; }
/* 일반 행 */
.cm-table tr.cm-normal td.cm-lbl    { color: var(--text-light); }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 640px) {
    /* 컨테이너 */
    .container { padding: 16px 12px 40px; }

    /* 헤더 */
    header h1 { font-size: 1.35rem; }
    .subtitle  { font-size: 0.82rem; }
    .btn-kakao { font-size: 0.88rem; padding: 8px 16px; }

    /* 카드 */
    .card { padding: 16px 14px; }

    /* 주택 목록 카드 */
    .property-card { flex-wrap: wrap; gap: 8px; }
    .property-card-main { flex-wrap: wrap; gap: 6px; }
    .property-card-prices {
        width: 100%;
        flex-direction: column;
        gap: 2px;
        font-size: 0.82rem;
    }

    /* 주소 검색 */
    .addr-row { flex-direction: column; gap: 8px; }
    .addr-row .select-group { min-width: 0; }
    .bunji-inputs input { padding: 8px; }

    /* 단지·동·호 선택 */
    .select-row { grid-template-columns: 1fr; }

    /* info-box (1주택 정보) */
    .info-box { grid-template-columns: 1fr 1fr; }

    /* 비교 테이블 — 폰트·패딩 축소 */
    table { font-size: 0.78rem; }
    thead th { padding: 7px 5px; font-size: 0.76rem; white-space: nowrap; }
    tbody td { padding: 6px 5px; }
    tbody tr.category-row td { padding-top: 8px; padding-bottom: 7px; font-size: 0.8rem; white-space: normal; }
    tbody tr.sub-row td { font-size: 0.73rem; padding-top: 4px; padding-bottom: 4px; }
    tbody tr.sub-row td:first-child { padding-left: 12px; }
    tbody tr.total-row td { padding: 7px 5px; font-size: 0.8rem; }

    /* compare-table: 항목명 열 sticky 고정 → 가로 스크롤 시 항목명 항상 표시 */
    #compare-table { min-width: 400px; }
    #compare-table th:first-child,
    #compare-table td:first-child {
        position: sticky;
        left: 0;
        z-index: 2;
        box-shadow: 2px 0 5px rgba(0,0,0,0.08);
    }
    #compare-table th:first-child { background: var(--primary); }
    #compare-table tbody tr td:first-child { background: #fff; }
    #compare-table tbody tr.category-row td:first-child { background: #f1f5f9; }
    #compare-table tbody tr.total-row td:first-child { background: var(--primary); }

    /* 상세 내역 테이블 — 가로 스크롤 없이 3열 고정 */
    .cm-table { font-size: 0.75rem; }
    .cm-table .cm-th-lbl { width: 42%; font-size: 0.76rem; }
    .cm-table .cm-th-val { width: 29%; font-size: 0.76rem; }
    .cm-table td { padding: 5px 5px; }
    .cm-table .cm-lbl { white-space: normal; word-break: break-word; }
    .cm-table .cm-v { white-space: normal; word-break: break-word; }
    .cm-table tr.cm-sec td { font-size: 0.9rem; padding: 6px 5px; }
    .cm-table tr.cm-ihdr td { font-size: 0.76rem; }
    .cm-table tr.cm-formula td.cm-lbl,
    .cm-table tr.cm-result  td.cm-lbl,
    .cm-table tr.cm-bracket td.cm-lbl,
    .cm-table tr.cm-indent  td.cm-lbl,
    .cm-table tr.cm-indent-neg td.cm-lbl { padding-left: 10px; }
    .cm-table tr.cm-grand-total td { font-size: 0.82rem; }

    /* detail-grid 폴백 */
    .detail-grid { grid-template-columns: 1fr; }
}
