/* =========================================================
   BK TAX - 공통 스타일
   원칙: 장식을 걷어내고 위계와 여백으로 정리한다.
   그라데이션·그림자·알약형 토글·화살표 남발 없음. 세리프 제목 +
   본문 산세리프, 단일 포인트 컬러(딥그린), 헤어라인 구분선.
   ========================================================= */

:root {
    --bg: #faf9f6;
    --panel: #ffffff;
    --panel-2: #f4f2ee;
    --border: #e4e1d9;
    --text: #1c1c1a;
    --muted: #6e6c64;
    --accent: #17493c;
    --accent-soft: #eaf1ee;
    --good: #2c6e49;
    --danger: #a8371f;
    --radius: 3px;

    font-family: -apple-system, BlinkMacSystemFont, "Pretendard", "Malgun Gothic", sans-serif;
}
* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

.wrap { max-width: 720px; margin: 0 auto; padding: 48px 24px 80px; }

header.page { margin-bottom: 8px; }
header.page h1 {
    font-family: Georgia, "Noto Serif KR", serif;
    font-size: 28px;
    font-weight: 600;
    margin: 0 0 10px;
    letter-spacing: -0.2px;
}
header.page p { color: var(--muted); margin: 0; font-size: 15px; max-width: 52ch; }

/* ---- 계산기 간 이동 링크 ---- */
.cross-link {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
    margin: 20px 0 32px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}
.cross-link a {
    color: var(--muted);
    text-decoration: none;
}
.cross-link a:hover { color: var(--accent); text-decoration: underline; }
.cross-link a:first-child {
    color: var(--text);
    font-weight: 600;
    padding-right: 16px;
    border-right: 1px solid var(--border);
}

/* ---- 폼 카드: 테두리만, 그림자 없음 ---- */
.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    margin-bottom: 24px;
}

/* ---- 간편/상세 모드 전환: 알약 버튼 대신 밑줄 탭 ---- */
.mode-toggle {
    display: flex;
    gap: 24px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 28px;
}
.mode-toggle button {
    border: none;
    background: transparent;
    color: var(--muted);
    padding: 0 0 10px;
    margin-bottom: -1px;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}
.mode-toggle button.active {
    color: var(--text);
    border-bottom-color: var(--accent);
}

/* ---- 입력 구획 ---- */
fieldset {
    border: none;
    padding: 0;
    margin: 0 0 28px;
}
fieldset + fieldset { padding-top: 28px; border-top: 1px solid var(--border); }

legend {
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 16px;
    padding: 0;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 18px 20px;
}

.field { margin-bottom: 4px; }

label {
    display: block;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 6px;
}

.input-money { position: relative; }

input[type="text"], input[type="number"], input[type="date"], select {
    width: 100%;
    background: var(--panel);
    border: none;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    padding: 8px 32px 8px 2px;
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
}
.input-money::after {
    content: "원";
    position: absolute;
    right: 2px;
    bottom: 9px;
    color: var(--muted);
    font-size: 13px;
    pointer-events: none;
}
input:focus, select:focus {
    outline: none;
    border-bottom-color: var(--accent);
}

/* ---- 선택형 입력: 라디오 목록, 배경 없음 ---- */
.radio-row { display: flex; flex-wrap: wrap; gap: 4px 20px; padding-top: 2px; }
.radio-row label {
    display: flex; align-items: center; gap: 6px;
    color: var(--text);
    font-size: 14px;
    margin-bottom: 0;
    cursor: pointer;
}
.radio-row input {
    width: auto;
    accent-color: var(--accent);
}

#detailedFields { display: none; }
#spouseDetail, #giftListWrap, #generationDetail, #marriageDetail { display: none; margin-top: 14px; }

.gift-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto;
    gap: 10px;
    margin-bottom: 10px;
    align-items: end;
}
.gift-row button.remove {
    background: none;
    border: none;
    color: var(--muted);
    padding: 8px;
    cursor: pointer;
    font-size: 15px;
    height: 34px;
}
.gift-row button.remove:hover { color: var(--danger); }

#addGiftBtn {
    background: none;
    border: none;
    color: var(--accent);
    padding: 0;
    cursor: pointer;
    font-size: 13px;
    text-decoration: underline;
}

/* ---- 제출 버튼: 단색, 그라데이션 없음 ---- */
.calc-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: var(--radius);
    background: var(--accent);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 4px;
}
.calc-btn:hover { background: #123a30; }
.calc-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---- 결과 ---- */
#resultSection { display: none; }
.result-hero {
    padding: 4px 0 24px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
}
.result-hero .label { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.result-hero .amount {
    font-family: Georgia, "Noto Serif KR", serif;
    font-size: 32px;
    font-weight: 600;
    letter-spacing: -0.3px;
}

table.breakdown { width: 100%; border-collapse: collapse; font-size: 14px; }
table.breakdown td { padding: 9px 2px; border-bottom: 1px solid var(--border); }
table.breakdown td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
table.breakdown tr.subtotal td { font-weight: 600; }
table.breakdown tr.minus td:last-child { color: var(--muted); }
table.breakdown tr.final td {
    font-weight: 700;
    font-size: 15px;
    border-top: 1px solid var(--text);
    border-bottom: none;
    padding-top: 12px;
}

.disclaimer {
    font-size: 12.5px;
    color: var(--muted);
    padding: 16px 0 0;
    margin-top: 20px;
    border-top: 1px solid var(--border);
}

.error-box {
    display: none;
    background: #faf0ed;
    border-left: 3px solid var(--danger);
    color: var(--danger);
    padding: 10px 14px;
    border-radius: 0;
    margin-bottom: 20px;
    font-size: 14px;
}

/* =========================================================
   메인 허브 페이지 (계산기 목록)
   ========================================================= */
.hub-wrap { max-width: 880px; }

.hub-intro {
    color: var(--muted);
    font-size: 14px;
    max-width: 60ch;
    margin: 16px 0 40px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.hub-section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    margin: 40px 0 14px;
}
.hub-section-title:first-of-type { margin-top: 0; }

.calc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
}

.calc-card {
    display: block;
    background: var(--panel);
    padding: 22px 20px;
    text-decoration: none;
    color: var(--text);
}
.calc-card:hover { background: var(--accent-soft); }
.calc-card h3 {
    font-family: Georgia, "Noto Serif KR", serif;
    font-size: 17px;
    font-weight: 600;
    margin: 0 0 8px;
    letter-spacing: -0.2px;
}
.calc-card p {
    font-size: 13px;
    color: var(--muted);
    margin: 0 0 12px;
    line-height: 1.5;
}
.calc-card .tag {
    font-size: 12px;
    color: var(--muted);
}

.hub-footer-note {
    color: var(--muted);
    font-size: 12.5px;
    margin-top: 48px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}
