/* 생활 계산기 공용 스타일 (salary.php · percent.php · date_calc.php · unit.php 에서 불러옴)
 * 전용 색 토큰: 라이트 값이 기본, 다크 값은 html[data-theme="dark"] (화면 출력에만) — 대출계산기(loan.css)와 같은 색 체계
 */
.tc-app {
    --tc-text: #223;          --tc-btn-text: #334;
    --tc-muted: #667;         --tc-muted-2: #556;
    --tc-accent: #2e6aad;     --tc-accent-hover: #245a96;   --tc-accent-text: #2e6aad;
    --tc-th-bg: #f3f6fa;      --tc-soft-bg: #f7f9fc;        --tc-track: #e8edf3;
    --tc-line: #e3e8ef;       --tc-line-soft: #eef1f5;      --tc-input-line: #cdd5df;
    --tc-rule: #1f2d3a;
    --tc-row-hover: #f7fafd;  --tc-row-on: #eaf2fb;
    --tc-up: #d64545;         --tc-down: #2e6aad;
    --tc-ins: #3aa57a;        --tc-tax: #f5a623;
    --tc-hero-a: #2e6aad;     --tc-hero-b: #4f8fd1;
    --tc-reset-line: #f0c4c0; --tc-reset-hover: #fdecea;
    --tc-focus: rgba(46,106,173,.15);
}
@media screen {
    :root[data-theme="dark"] .tc-app {
        --tc-text: #e6e9ed;       --tc-btn-text: #d6dbe1;
        --tc-muted: #a8b0b9;      --tc-muted-2: #b0b8c1;
        --tc-accent: #3578c4;     --tc-accent-hover: #2d68ad;   --tc-accent-text: #6cb2f0;
        --tc-th-bg: #232a33;      --tc-soft-bg: #20262e;        --tc-track: #2a323c;
        --tc-line: #333b45;       --tc-line-soft: #2a313a;      --tc-input-line: #46505b;
        --tc-rule: #55606e;
        --tc-row-hover: #1f2a36;  --tc-row-on: #1b3047;
        --tc-up: #ff7a76;         --tc-down: #6cb2f0;
        --tc-ins: #4cbf8f;        --tc-tax: #f0b143;
        --tc-hero-a: #1d4f82;     --tc-hero-b: #2b6aa8;
        --tc-reset-line: #6b3a3d; --tc-reset-hover: #3a1d20;
        --tc-focus: rgba(108,178,240,.3);
    }
}
.tc-app { color: var(--tc-text); }
.tc-app *, .tc-app *::before, .tc-app *::after { box-sizing: border-box; }
.tc-app button, .tc-app input, .tc-app select { font-family: inherit; }
.tc-app [hidden] { display: none !important; }

.tc-card { background: var(--surface); border-radius: 12px; padding: 24px 26px; box-shadow: 0 2px 8px rgba(0,0,0,.06); min-width: 0; }
.tc-h { margin: 0 0 4px; font-size: 19px; }
.tc-lead { margin: 0 0 18px; color: var(--tc-muted); font-size: 14px; line-height: 1.6; }
.tc-sub { margin: 24px 0 10px; padding-left: 10px; border-left: 3px solid var(--tc-accent); font-size: 15px; line-height: 1.3; }
.tc-sub:first-child { margin-top: 0; }
.tc-notes { margin: 14px 0 0; padding-left: 18px; font-size: 12.5px; line-height: 1.75; color: var(--tc-muted); }

/* 2열 / 카드 격자 */
.tc-split { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
.tc-split > .tc-side { position: sticky; top: 20px; }
.tc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.tc-stack { display: flex; flex-direction: column; gap: 20px; }
@media (max-width: 1100px) {
    .tc-split { grid-template-columns: 1fr; }
    .tc-split > .tc-side { position: static; }
}
@media (max-width: 820px) { .tc-grid { grid-template-columns: 1fr; } }

/* 입력 줄 */
.tc-form { border-top: 2px solid var(--tc-rule); }
.tc-row { display: grid; grid-template-columns: 112px minmax(0, 1fr); border-bottom: 1px solid var(--tc-line); }
.tc-row > .tc-label { background: var(--tc-th-bg); padding: 15px 12px; font-size: 14px; font-weight: bold; }
.tc-row > .tc-field { padding: 10px 14px; font-size: 14px; min-width: 0; }
.tc-line { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.tc-app .tc-input, .tc-app .tc-select {
    height: 40px; padding: 0 12px; border: 1px solid var(--tc-input-line); border-radius: 6px;
    font-size: 16px; background: var(--input-bg); color: var(--tc-text); min-width: 0;
}
.tc-app .tc-input { width: 200px; text-align: right; font-variant-numeric: tabular-nums; }
.tc-app .tc-input.wide { width: 100%; }
.tc-app .tc-input.date { width: 170px; text-align: left; }
.tc-app .tc-select { padding-right: 8px; }
.tc-app .tc-input:focus, .tc-app .tc-select:focus { outline: 0; border-color: var(--tc-accent); box-shadow: 0 0 0 3px var(--tc-focus); }
.tc-unit { font-size: 14px; color: var(--tc-muted-2); white-space: nowrap; }
.tc-hint { font-size: 13px; color: var(--tc-accent-text); font-weight: bold; white-space: nowrap; }
.tc-hint:empty { display: none; }
.tc-desc { margin: 6px 0 0; font-size: 12.5px; color: var(--tc-muted); line-height: 1.55; }
.tc-radios { display: flex; flex-wrap: wrap; gap: 6px 20px; }
.tc-radios label, .tc-check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 15px; }
.tc-radios input, .tc-check input { width: 16px; height: 16px; accent-color: var(--tc-accent); margin: 0; }

.tc-quick { display: flex; flex-wrap: wrap; gap: 5px; }
.tc-quick button, .tc-chip {
    height: 30px; padding: 0 10px; border: 1px solid var(--tc-input-line); border-radius: 5px;
    background: var(--surface); color: var(--tc-btn-text); font-size: 13px; cursor: pointer; white-space: nowrap;
}
.tc-quick button:hover, .tc-chip:hover { background: var(--hover-bg-2); border-color: var(--tc-accent); }
.tc-quick button.reset { color: var(--err-text); border-color: var(--tc-reset-line); }
.tc-quick button.reset:hover { background: var(--tc-reset-hover); border-color: var(--err-text); }
.tc-chip.on { background: var(--tc-accent); border-color: var(--tc-accent); color: #fff; }

.tc-error { margin: 14px 0 0; padding: 11px 14px; background: var(--err-bg); border: 1px solid var(--err-line); border-radius: 6px; color: var(--err-text); font-size: 14px; }

/* 큰 결과 상자 */
.tc-hero {
    border-radius: 12px; padding: 20px 22px; color: #fff;
    background: linear-gradient(135deg, var(--tc-hero-a), var(--tc-hero-b));
}
.tc-hero .k { font-size: 14px; opacity: .9; }
.tc-hero .v { margin-top: 4px; font-size: 32px; font-weight: bold; letter-spacing: -.5px; font-variant-numeric: tabular-nums; word-break: break-all; }
.tc-hero .v small { font-size: 16px; font-weight: normal; margin-left: 4px; }
.tc-hero .s { margin-top: 6px; font-size: 13.5px; opacity: .92; }
.is-empty .tc-hero .v, .is-empty .tc-list b { visibility: hidden; }

/* 결과 목록 (키 - 값) */
.tc-list { list-style: none; margin: 14px 0 0; padding: 0; border-top: 2px solid var(--tc-rule); }
.tc-list li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 11px 4px; border-bottom: 1px solid var(--tc-line); font-size: 14px; }
.tc-list li span { color: var(--tc-muted-2); }
.tc-list li b { font-size: 15.5px; font-variant-numeric: tabular-nums; text-align: right; }
.tc-list li.sum { background: var(--tc-th-bg); }
.tc-list li.sum b { color: var(--link); font-size: 17px; }
.tc-list li.sub span { padding-left: 12px; font-size: 13px; }
.tc-list li.sub b { font-weight: normal; font-size: 14px; }
.tc-list i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: 0; }

/* 비율 막대 */
.tc-bar { display: flex; height: 16px; border-radius: 8px; overflow: hidden; background: var(--tc-track); margin-top: 16px; }
.tc-bar span { width: 0; transition: width .3s; }
.tc-bar .net { background: var(--tc-accent); } .tc-bar .ins { background: var(--tc-ins); } .tc-bar .tax { background: var(--tc-tax); }
i.net { background: var(--tc-accent); } i.ins { background: var(--tc-ins); } i.tax { background: var(--tc-tax); }

/* 표 (사이트 공통 모바일 규칙이 1·4번째 열을 숨기므로 되돌림) */
.tc-scroll { overflow-x: auto; max-height: 520px; overflow-y: auto; border-bottom: 1px solid var(--tc-line); }
.tc-app .tc-table { width: 100%; min-width: 440px; border-collapse: collapse; border-top: 2px solid var(--tc-rule); }
.tc-app .tc-table th { position: sticky; top: 0; background: var(--tc-th-bg); padding: 10px 8px; font-size: 13px; text-align: center; border-bottom: 1px solid var(--tc-line); white-space: nowrap; }
.tc-app .tc-table td { padding: 9px 10px; font-size: 13.5px; text-align: right; border-bottom: 1px solid var(--tc-line-soft); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tc-app .tc-table td.c { text-align: center; color: var(--tc-muted); }
.tc-app .tc-table td.l { text-align: left; }
.tc-app .tc-table td.b { font-weight: bold; color: var(--link); }
.tc-table tbody tr[data-a] { cursor: pointer; }
.tc-table tbody tr:hover td { background: var(--tc-row-hover); }
.tc-table tbody tr.on td { background: var(--tc-row-on); font-weight: bold; }
@media (max-width: 768px) {
    .tc-app table th:nth-child(1), .tc-app table td:nth-child(1),
    .tc-app table th:nth-child(4), .tc-app table td:nth-child(4) { display: table-cell; }
}

/* 작은 계산 카드 (퍼센트 · 날짜) */
.tc-q { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 15px; line-height: 1.5; }
.tc-q .tc-input { width: 150px; }
.tc-answer {
    margin-top: 16px; padding: 14px 16px; border-radius: 10px; background: var(--tc-soft-bg);
    display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; min-height: 58px;
}
.tc-answer .eq { color: var(--tc-muted); font-size: 14px; }
.tc-answer b { font-size: 24px; color: var(--link); font-variant-numeric: tabular-nums; word-break: break-all; }
.tc-answer b.up { color: var(--tc-up); } .tc-answer b.down { color: var(--tc-down); }
.tc-answer .more { flex-basis: 100%; font-size: 13px; color: var(--tc-muted-2); }
.tc-answer.is-empty b { color: var(--tc-muted); font-size: 16px; font-weight: normal; }
.tc-copy { margin-left: auto; height: 28px; padding: 0 10px; border: 1px solid var(--tc-input-line); border-radius: 5px; background: var(--surface); color: var(--tc-btn-text); font-size: 12.5px; cursor: pointer; }
.tc-copy:hover { border-color: var(--tc-accent); }
.tc-answer.is-empty .tc-copy { display: none; }

/* 단위 변환 결과 */
.tc-cats { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.tc-cats .tc-chip { height: 34px; padding: 0 14px; font-size: 14px; border-radius: 17px; }
.tc-conv { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 10px; align-items: end; }
.tc-conv label { display: block; font-size: 13px; color: var(--tc-muted-2); margin-bottom: 6px; }
.tc-conv .tc-input, .tc-conv .tc-select { width: 100%; }
.tc-conv .pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 150px); gap: 6px; }
.tc-swap { height: 40px; width: 44px; border: 1px solid var(--tc-input-line); border-radius: 6px; background: var(--surface); color: var(--tc-btn-text); font-size: 18px; cursor: pointer; }
.tc-swap:hover { border-color: var(--tc-accent); background: var(--hover-bg-2); }
.tc-units { list-style: none; margin: 18px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.tc-units li { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 11px 14px; border: 1px solid var(--tc-line); border-radius: 8px; cursor: pointer; background: var(--surface); }
.tc-units li:hover { border-color: var(--tc-accent); background: var(--tc-row-hover); }
.tc-units li.on { border-color: var(--tc-accent); background: var(--tc-row-on); }
.tc-units li span { color: var(--tc-muted-2); font-size: 13px; white-space: nowrap; }
.tc-units li b { font-size: 15px; font-variant-numeric: tabular-nums; word-break: break-all; text-align: right; }

@media (max-width: 700px) {
    .tc-card { padding: 18px 14px; }
    .tc-row { grid-template-columns: 1fr; }
    .tc-row > .tc-label { padding: 10px 12px 4px; background: none; }
    .tc-row > .tc-field { padding: 4px 12px 12px; }
    .tc-app .tc-input { flex: 1 1 140px; width: auto; }
    .tc-app .tc-input.date { flex: 1 1 150px; }
    .tc-q .tc-input { flex: 1 1 110px; width: auto; }
    .tc-hero .v { font-size: 27px; }
    .tc-conv { grid-template-columns: 1fr; }
    .tc-conv .tc-swap { justify-self: center; transform: rotate(90deg); }
}

/* 기념일 목록 */
.tc-anniv { list-style: none; margin: 16px 0 0; padding: 0; border-top: 2px solid var(--tc-rule); }
.tc-anniv li { display: grid; grid-template-columns: 70px minmax(0, 1fr) auto; gap: 10px; align-items: baseline; padding: 10px 4px; border-bottom: 1px solid var(--tc-line); font-size: 14px; }
.tc-anniv li span { font-weight: bold; color: var(--tc-accent-text); }
.tc-anniv li b { font-weight: normal; }
.tc-anniv li i { font-style: normal; font-size: 13px; color: var(--tc-muted-2); white-space: nowrap; }
.tc-anniv li i em { font-style: normal; color: #fff; background: var(--tc-up); padding: 2px 8px; border-radius: 10px; }
.tc-anniv li.past { opacity: .55; }

/* 날짜 더하기: 년·개월·주·일 칸 */
.tc-period { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr) minmax(0, 1fr) minmax(0, 1.35fr); gap: 8px; }
.tc-period label { display: flex; align-items: center; gap: 5px; min-width: 0; }
.tc-app .tc-period .tc-input { width: 100%; min-width: 58px; flex: 1 1 auto; padding: 0 6px; text-align: right; -moz-appearance: textfield; }
.tc-period .tc-input::-webkit-inner-spin-button, .tc-period .tc-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
@media (max-width: 1100px) and (min-width: 821px), (max-width: 420px) { .tc-period { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
