:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --text: #1f2937;
    --text-light: #6b7280;
    --text-lighter: #9ca3af;
    --border: #e5e7eb;
    --bg: #ffffff;
    --bg-soft: #f9fafb;
    --bg-sky: #f0f9ff;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.1);
    --radius: 12px;
    --radius-sm: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
    font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", "Apple SD Gothic Neo",
                 "Malgun Gothic", "맑은 고딕", Roboto, sans-serif;
    color: var(--text); background: var(--bg-soft); line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; height: auto; display: block; }
ul, ol { list-style: none; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select { font: inherit; color: inherit; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

.site-header {
    background: rgba(255,255,255,0.9);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 50;
    backdrop-filter: blur(8px);
}
.site-header .container { max-width: 1400px;
    display: flex; align-items: center; justify-content: space-between; height: 64px;
}
.logo { font-size: 1.15rem; font-weight: 800; color: var(--text); letter-spacing: -0.02em; }
.nav { display: flex; gap: 30px; }
.nav a {
    color: var(--text-light); font-weight: 500; font-size: 0.95rem;
    padding: 8px 0; position: relative;
}
.nav a:hover { color: var(--text); }
.nav a.active { color: var(--primary); }
.nav a.active::after {
    content: ''; position: absolute; bottom: -1px; left: 0; right: 0;
    height: 2px; background: var(--primary);
}

.hero {
    background: linear-gradient(135deg, var(--primary) 0%, #4f46e5 100%);
    color: #fff; padding: 48px 0 56px; text-align: center;
}
.hero h1 { font-size: 2.25rem; font-weight: 800; margin-bottom: 12px; letter-spacing: -0.02em; }
.hero-desc { font-size: 1rem; opacity: 0.95; }

.main { padding: 60px 0 64px; }

.card {
    background: var(--bg); border-radius: var(--radius);
    padding: 28px; box-shadow: var(--shadow);
}
.card h2 {
    font-size: 1.25rem; font-weight: 700; margin-bottom: 20px;
    padding-bottom: 12px; border-bottom: 1px solid var(--border);
}

.calc-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 24px;
    position: relative; z-index: 10;
}

.form-group { margin-bottom: 20px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group label {
    display: block; font-size: 0.875rem; font-weight: 600;
    color: var(--text); margin-bottom: 8px;
}

.input-with-unit { position: relative; }
.input-with-unit input {
    width: 100%; padding: 12px 60px 12px 14px;
    font-size: 1.05rem; font-weight: 600;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--bg); transition: border-color 0.2s, box-shadow 0.2s;
}
.input-with-unit input:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.input-with-unit .unit {
    position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
    color: var(--text-light); font-size: 0.9rem; font-weight: 500;
}

.form-group select {
    width: 100%; padding: 12px 14px; font-size: 0.95rem;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--bg); cursor: pointer;
}
.form-group select:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.hint { display: block; margin-top: 6px; font-size: 0.8rem; color: var(--text-lighter); }

.salary-quick { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.salary-quick button {
    padding: 6px 12px; font-size: 0.85rem; font-weight: 500;
    background: var(--bg-soft); border: 1px solid var(--border);
    border-radius: 20px; color: var(--text-light); transition: all 0.15s;
}
.salary-quick button:hover {
    background: var(--primary-light); border-color: var(--primary); color: var(--primary);
}

.btn-primary {
    width: 100%; padding: 14px; background: var(--primary); color: #fff;
    border-radius: var(--radius-sm); font-size: 1rem; font-weight: 700;
    transition: background 0.2s, transform 0.05s;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:active { transform: scale(0.98); }

.result-amount {
    text-align: center; padding: 20px 0; background: var(--bg-sky);
    border-radius: var(--radius-sm); margin-bottom: 16px;
}
.result-amount span:first-child {
    font-size: 2.25rem; font-weight: 800; color: var(--primary); letter-spacing: -0.03em;
}
.unit-big { font-size: 1.25rem; color: var(--primary); font-weight: 600; margin-left: 4px; }

.result-sub { text-align: center; color: var(--text-light); font-size: 0.9rem; margin-bottom: 24px; }
.result-sub strong { color: var(--text); font-weight: 700; }

.chart-wrap { height: 240px; margin: 20px 0; position: relative; }

.deduction-table { width: 100%; border-collapse: collapse; margin-top: 20px; font-size: 0.9rem; }
.deduction-table th, .deduction-table td {
    padding: 10px 8px; text-align: right; border-bottom: 1px solid var(--border);
}
.deduction-table th:first-child, .deduction-table td:first-child { text-align: left; }
.deduction-table thead th {
    font-weight: 600; color: var(--text-light); font-size: 0.8rem;
    text-transform: uppercase; letter-spacing: 0.05em;
}
.deduction-row td:not(:first-child) { color: var(--danger); }
.deduction-row td:not(:first-child)::before { content: '-'; margin-right: 2px; }
.total-row { background: var(--bg-soft); font-weight: 600; }
.total-row td { padding: 12px 8px; }
.total-row td:not(:first-child) { color: var(--danger); }
.net-row td {
    padding: 14px 8px; font-weight: 700; font-size: 1rem;
    border-bottom: none; color: var(--primary);
}

.ad-slot {
    margin: 32px 0; padding: 20px; background: var(--bg);
    border: 1px dashed var(--border); border-radius: var(--radius-sm);
    text-align: center; min-height: 100px;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-lighter); font-size: 0.85rem;
}
.ad-slot:empty::before { content: "광고 영역"; }
.ad-top { margin-top: 16px; }

.info-section { margin-top: 32px; }
.info-section h2:not(:first-of-type) {
    margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--border);
}
.info-section h3 {
    font-size: 1.05rem; font-weight: 700; margin: 20px 0 8px; color: var(--text);
}
.info-section p {
    color: var(--text-light); margin-bottom: 12px;
    font-size: 0.95rem; line-height: 1.75; word-break: keep-all;
}
.info-section ul { margin: 12px 0 12px 4px; }
.info-section li {
    position: relative; padding-left: 20px; margin-bottom: 8px;
    color: var(--text-light); line-height: 1.7; word-break: keep-all;
}
.info-section li::before {
    content: '\2713'; position: absolute; left: 0; color: var(--success); font-weight: 700;
}
.info-section strong { color: var(--text); font-weight: 700; }

.site-footer {
    background: var(--text); color: #fff; padding: 32px 0; text-align: center;
}
.site-footer p { color: rgba(255,255,255,0.7); font-size: 0.85rem; margin-bottom: 8px; }
.footer-meta a { color: rgba(255,255,255,0.9); margin: 0 8px; }
.footer-meta a:hover { color: #fff; }
.copyright { margin-top: 12px; font-size: 0.8rem; opacity: 0.5; }

.date-input {
    width: 100%; padding: 12px 14px; font-size: 0.95rem;
    border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg);
}
.date-input:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.compare-grid {
    display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px;
    align-items: center; margin-bottom: 20px;
}
.compare-col { padding: 16px; background: var(--bg-soft); border-radius: var(--radius-sm); }
.compare-col-b { background: var(--bg-sky); }
.compare-label {
    font-size: 0.85rem; font-weight: 600; color: var(--text-light);
    margin-bottom: 12px; text-align: center;
}
.compare-vs { font-size: 1.1rem; font-weight: 800; color: var(--text-lighter); padding: 0 8px; }
.compare-shared { padding-top: 12px; border-top: 1px solid var(--border); }

.diff-amount {
    background: var(--bg-soft); padding: 24px; border-radius: var(--radius);
    text-align: center; border: 2px solid var(--border); transition: all 0.2s;
}
.diff-amount.diff-positive { background: #ecfdf5; border-color: var(--success); }
.diff-amount.diff-negative { background: #fef2f2; border-color: var(--danger); }
.diff-label { display: block; font-size: 0.875rem; color: var(--text-light); margin-bottom: 8px; }
.diff-value {
    display: block; font-size: 2rem; font-weight: 800; color: var(--text);
    letter-spacing: -0.02em; margin-bottom: 6px;
}
.diff-positive .diff-value { color: var(--success); }
.diff-negative .diff-value { color: var(--danger); }
.diff-sub { display: block; font-size: 0.875rem; color: var(--text-light); }
.diff-sub strong { color: var(--text); }

.cumulative-section { margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--border); }
.cumulative-section h3 { font-size: 1rem; font-weight: 700; margin-bottom: 16px; }
.cumulative-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.cum-item { padding: 16px 12px; background: var(--bg-soft); border-radius: var(--radius-sm); text-align: center; }
.cum-label { display: block; font-size: 0.8rem; color: var(--text-light); margin-bottom: 4px; }
.cum-value { display: block; font-size: 1rem; font-weight: 700; color: var(--primary); }
.cumulative-hint { margin-top: 12px; font-size: 0.8rem; color: var(--text-lighter); }

.contact-box {
    background: var(--bg-sky); border-radius: var(--radius);
    padding: 24px; text-align: center; margin: 20px 0 32px;
    display: flex; align-items: center; justify-content: center;
    gap: 12px; flex-wrap: wrap;
}
.contact-icon { font-size: 1.5rem; }
.contact-email {
    font-size: 1.2rem; font-weight: 700; color: var(--primary);
}
.contact-email:hover { text-decoration: underline; }

@media (max-width: 860px) {
    .hero h1 { font-size: 1.75rem; }
    .hero { padding: 36px 0 48px; }
    .calc-grid { grid-template-columns: 1fr; gap: 16px; }
    .card { padding: 20px; }
    .form-row { grid-template-columns: 1fr; gap: 0; }
    .nav { gap: 16px; }
    .nav a { font-size: 0.875rem; }
    .result-amount span:first-child { font-size: 1.85rem; }
    .deduction-table { font-size: 0.85rem; }
    .deduction-table th, .deduction-table td { padding: 8px 4px; }
}

@media (max-width: 640px) {
    .container { padding: 0 16px; }
    .logo { font-size: 1rem; }
    .nav { gap: 12px; }
    .nav a { font-size: 0.8rem; }
    .hero h1 { font-size: 1.5rem; }
    .hero-desc { font-size: 0.9rem; }
    .compare-grid { grid-template-columns: 1fr; }
    .compare-vs { padding: 4px 0; }
    .diff-value { font-size: 1.5rem; }
    .cumulative-grid { grid-template-columns: repeat(2, 1fr); }
}

/* 로고: ₩ paycalc 색상 분리 */
.logo {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 1.2rem;
    font-weight: 800;
    color: #1f2937;
    letter-spacing: -0.02em;
}
.logo .logo-w {
    color: #2563eb;
    font-weight: 900;
    font-size: 1.3rem;
    line-height: 1;
}
.logo:hover .logo-w {
    color: #1d4ed8;
}
/* 로고 이미지 (헤더) */
.logo img {
    height: 32px;
    width: auto;
    display: block;
}
@media (max-width: 640px) {
    .logo img { height: 26px; }
}
/* 7개 메뉴 항목 대응 (양도세 추가) — nav-7items */
.nav { flex-wrap: wrap; gap: 30px; }
@media (max-width: 1024px) {
    .site-header .container { max-width: 1400px; height: auto; padding: 12px 20px; flex-wrap: wrap; }
    .nav { gap: 18px; font-size: 0.875rem; justify-content: flex-end; }
    .nav a { padding: 4px 0; }
}
@media (max-width: 640px) {
    .nav { gap: 14px; font-size: 0.8rem; width: 100%; overflow-x: auto; }
    .nav a { white-space: nowrap; padding: 4px 0; }
}
/* 광고 영역 숨김 (필요 시 이 블록 삭제하면 다시 표시됨) */
.ad-slot { display: none !important; }
/* 모바일 햄버거 메뉴 */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: #1f2937;
    margin-left: auto;
}
.nav-toggle svg { width: 28px; height: 28px; display: block; }

@media (max-width: 768px) {
    .site-header { position: sticky; top: 0; z-index: 100; }
    .site-header .container { max-width: 1400px; position: relative; }
    .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
    .nav {
        display: none !important;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column !important;
        background: #fff;
        padding: 16px 20px;
        box-shadow: 0 8px 24px rgba(0,0,0,0.12);
        border-top: 1px solid #e5e7eb;
        gap: 0 !important;
        max-height: calc(100vh - 64px);
        overflow-y: auto;
    }
    .nav.open { display: flex !important; }
    .nav a {
        padding: 14px 8px !important;
        border-bottom: 1px solid #f3f4f6;
        font-size: 1rem !important;
        white-space: normal !important;
    }
    .nav a:last-child { border-bottom: none; }
    .nav a.active { color: #2563eb; font-weight: 700; }
    .nav a.active::after { display: none; }
}
/* 퀵메뉴 */
.quick-menu { position: fixed; right: 20px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 90; }
.quick-menu .qm-item { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 60px; height: 60px; background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; text-decoration: none; color: #1f2937; transition: all .15s; cursor: pointer; font-family: inherit; padding: 0; box-shadow: 0 2px 6px rgba(0,0,0,.04); }
.quick-menu .qm-item:hover { border-color: #2563eb; color: #2563eb; transform: scale(1.05); box-shadow: 0 4px 12px rgba(37,99,235,.15); }
.quick-menu .qm-tistory .qm-icon { width: 24px; height: 24px; background: #ff5733; color: #fff; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: .9rem; font-weight: 800; line-height: 1; }
.quick-menu .qm-tistory:hover .qm-icon { background: #ff7043; }
.quick-menu .qm-icon { font-size: 1.2rem; line-height: 1; }
.quick-menu .qm-label { font-size: .7rem; margin-top: 4px; font-weight: 500; }
.quick-menu .qm-top { opacity: 0; pointer-events: none; transition: opacity .2s; }
.quick-menu .qm-top.visible { opacity: 1; pointer-events: auto; }
@media (max-width: 768px) {
    .quick-menu { right: 12px; top: auto; bottom: 16px; transform: none; gap: 6px; }
    .quick-menu .qm-item { width: 48px; height: 48px; }
    .quick-menu .qm-icon { font-size: 1rem; }
    .quick-menu .qm-tistory .qm-icon { width: 20px; height: 20px; font-size: .75rem; }
    .quick-menu .qm-label { font-size: .6rem; margin-top: 2px; }
}
/* 정보 섹션 데이터 표 (SEO 콘텐츠용 모던 디자인) */
.info-section table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 24px 0;
    font-size: 0.92rem;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.info-section thead {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
}
.info-section thead th {
    padding: 14px 16px;
    font-weight: 700;
    color: #1e40af;
    font-size: 0.88rem;
    text-align: left;
    letter-spacing: -0.01em;
    border-bottom: 2px solid #bfdbfe;
    white-space: nowrap;
}
.info-section tbody tr {
    transition: background 0.15s;
}
.info-section tbody tr:nth-child(odd) {
    background: #fff;
}
.info-section tbody tr:nth-child(even) {
    background: #fafbfc;
}
.info-section tbody tr:hover {
    background: #eff6ff;
}
.info-section tbody td {
    padding: 12px 16px;
    color: #374151;
    border: none;
    border-bottom: 1px solid #f3f4f6;
    line-height: 1.5;
    word-break: keep-all;
}
.info-section tbody tr:last-child td {
    border-bottom: none;
}
.info-section tbody td:first-child {
    font-weight: 600;
    color: #1f2937;
}
.info-section tbody td strong {
    color: #2563eb;
    font-weight: 700;
}

/* 정보 섹션 외 일반 table (.card 직접) 정리 */
.card > table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 16px 0;
    font-size: 0.92rem;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
}
.card > table thead {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
}
.card > table thead th {
    padding: 14px 16px;
    font-weight: 700;
    color: #1e40af;
    text-align: left;
    border-bottom: 2px solid #bfdbfe;
}
.card > table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid #f3f4f6;
}
.card > table tbody tr:nth-child(even) {
    background: #fafbfc;
}
.card > table tbody tr:hover {
    background: #eff6ff;
}

/* 모바일: 가로 스크롤 + 자연 줄바꿈 */
@media (max-width: 640px) {
    .info-section table,
    .card > table {
        display: block;
        max-width: 100%;
        overflow-x: auto;
        font-size: 0.82rem;
        -webkit-overflow-scrolling: touch;
        word-break: keep-all;
    }
    .info-section table thead,
    .info-section table tbody,
    .card > table thead,
    .card > table tbody {
        display: table;
        width: 100%;
        table-layout: fixed;
    }
    .info-section thead th,
    .info-section tbody td,
    .card > table thead th,
    .card > table tbody td {
        padding: 8px 6px;
        white-space: normal;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
}
/* info-section 좌측 TOC */
.info-section-wrap {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    margin-top: 32px;
}
.info-section-wrap .info-section {
    flex: 1;
    min-width: 0;
    margin-top: 0;
}
.info-toc {
    width: 220px;
    flex-shrink: 0;
    position: sticky;
    top: 88px;
    padding: 20px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    max-height: calc(100vh - 110px);
    overflow-y: auto;
}
.info-toc h3 {
    font-size: .8rem;
    font-weight: 700;
    color: #6b7280;
    margin: 0 0 12px;
    text-transform: uppercase;
    letter-spacing: .05em;
    border: none;
    padding: 0;
}
.info-toc ul { list-style: none; margin: 0; padding: 0; }
.info-toc li { list-style: none; margin-bottom: 4px; padding: 0; }
.info-toc a {
    display: block;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: .85rem;
    color: #4b5563;
    text-decoration: none;
    transition: all .15s;
    border-left: 3px solid transparent;
    line-height: 1.4;
    word-break: keep-all;
}
.info-toc a:hover {
    background: #fff;
    color: #2563eb;
    border-left-color: #2563eb;
}
.info-toc a.active {
    background: #dbeafe;
    color: #2563eb;
    font-weight: 600;
    border-left-color: #2563eb;
}
.info-section h2 { scroll-margin-top: 88px; }

@media (max-width: 1024px) {
    .info-section-wrap { flex-direction: column; }
    .info-toc { display: none; }
}

/* === MOBILE OVERFLOW FIX (v1) === */
html, body {
    overflow-x: hidden;
    max-width: 100%;
}
img, video, iframe, embed, object, svg {
    max-width: 100%;
    height: auto;
}
pre, code {
    max-width: 100%;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}
.container, .main, .hero, .blog-article, .info-section, .card, .community-wrap {
    max-width: 100%;
    box-sizing: border-box;
}
@media (max-width: 768px) {
    /* 표는 자체적으로 가로 스크롤 (페이지가 아니라 표 안에서만) */
    .info-section table,
    .blog-article table,
    .deduction-table,
    table {
        display: block;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    /* 긴 단어/URL 줄바꿈 */
    .info-section p,
    .info-section li,
    .blog-article p,
    .blog-article li,
    .post-title,
    .post-meta,
    h1, h2, h3, h4 {
        overflow-wrap: break-word;
        word-break: keep-all;
    }
    /* iframe/embed (광고, 동영상 등) */
    iframe, embed, object {
        max-width: 100% !important;
        width: 100% !important;
    }
    /* 광고 슬롯 */
    .ad-slot, .ad-slot ins {
        max-width: 100% !important;
        overflow: hidden;
    }
    /* 영문 단어/URL */
    a {
        overflow-wrap: anywhere;
    }
}

/* === MAIN CONTAINER WIDTH 1400 === */
.main .container,
.hero .container {
    max-width: 1400px;
}

/* === A11Y CONTRAST FIX === */
/* hint: #9ca3af → #6b7280 (white 배경 4.83:1) */
.hint {
    color: #6b7280;
}
/* 공제 행 빨강: #ef4444 → #b91c1c (white 4.83:1, soft 4.78:1) */
.deduction-row td:not(:first-child),
.total-row td:not(:first-child) {
    color: #b91c1c;
}
/* 푸터 텍스트 가독성 강화 */
.site-footer p {
    color: rgba(255,255,255,0.88);
}
.copyright {
    opacity: 0.75;
}
.footer-meta a {
    color: rgba(255,255,255,0.95);
}

/* === PRETENDARD GLOBAL === */
:root, body, button, input, select, textarea {
    font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", "맑은 고딕", Roboto, sans-serif !important;
}