/* 도구 화면 새 틀(DESIGN.md 5절 도구 화면·명세표·입력·버튼) — "ui": "auto" 도구 공용.
   색은 토큰만, 둥글기는 조작 4px·면 0, 선은 2px --ink(제목)·3px double --ink(명세표)·1px --line(행) 세 종류. */

/* 틀 */
.lt-tool-page { max-width: var(--w-max); margin: 0 auto; padding: 24px 24px 0; }
.lt-crumb { margin: 0 0 16px; font-size: 14px; color: var(--ink3); }
.lt-crumb ol { display: flex; flex-wrap: wrap; gap: 0 8px; margin: 0; padding: 0; list-style: none; }
.lt-crumb li + li::before { content: '›'; margin-right: 8px; color: var(--ink3); }
.lt-crumb a { display: inline-flex; align-items: center; min-height: 32px; color: var(--ink2); text-decoration: none; }
.lt-crumb a:hover { color: var(--brand); text-decoration: underline; }
.lt-tool-page h1 { margin: 0 0 8px; font-size: 30px; line-height: 1.25; font-weight: 700; color: var(--ink); }
.lt-tool-page .lt-lede { max-width: var(--w-read); margin: 0 0 32px; font-size: 16px; color: var(--ink2); }

/* 입력 | 명세표 */
.lt-work { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, var(--w-ledger)); gap: 48px; align-items: start; }
.lt-form { display: grid; gap: 20px; min-width: 0; }
.lt-fields { display: grid; gap: 20px; }
.lt-out { min-width: 0; }
/* 시각 의존 도구(크론 등): 빌드 때 자리만 잡아 둔 명세표 — 화면 JS 가 진짜 값으로 바꿀 때까지 보이지 않게(높이는 유지해 밀리지 않음, 허브 spec 11) */
.lt-result[data-stale] > * { visibility: hidden; }
.lt-copy { margin-top: 12px; }

/* 입력 */
.lt-field { display: grid; gap: 8px; min-width: 0; }
.lt-field[hidden] { display: none; }
.lt-label { margin: 0; font-size: 15px; font-weight: 700; line-height: 1.4; color: var(--ink); }
.lt-label__opt { font-weight: 400; color: var(--ink3); }
.lt-help { margin: 0; font-size: 13px; line-height: 1.5; color: var(--ink3); }
.lt-field input:not([type=checkbox]):not([type=radio]), .lt-field select, .lt-field textarea {
  box-sizing: border-box; width: 100%; min-height: 44px; padding: 0 12px; font: inherit; font-size: 16px; /* 16px 미만이면 iOS 가 확대한다 */
  color: var(--ink); background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--radius-control);
}
.lt-field textarea { padding: 12px; min-height: 120px; }
.lt-field input:focus-visible, .lt-field select:focus-visible, .lt-field textarea:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.lt-field--money input, .lt-field--number input, .lt-field--percent input { text-align: right; font-variant-numeric: tabular-nums; }
.lt-input-unit { position: relative; }
.lt-input-unit input:not([type=checkbox]) { padding-right: 40px; }
.lt-unit { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 15px; color: var(--ink3); pointer-events: none; }
.lt-check { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: 15px; color: var(--ink); cursor: pointer; }
.lt-check input { width: 24px; height: 24px; flex: none; margin: 0; accent-color: var(--brand); }
.lt-field .lt-seg-group { display: flex; width: 100%; }
.lt-field .lt-seg-group { margin-left: 0; }
.lt-field .lt-seg-group label { flex: 1 1 0; min-width: 0; }
.lt-field .lt-seg-group span { flex: 1 1 auto; width: 100%; min-width: 0; font-size: 15px; }
.lt-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.lt-field-err { margin: 0; font-size: 14px; color: var(--danger); }

/* 명세표 — 서류처럼: 위아래 3px double --ink, 바탕·둥글기 없음 */
.lt-ledger { border-top: 3px double var(--ink); border-bottom: 3px double var(--ink); padding: 0 0 16px; }
.lt-ledger__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.lt-ledger__title { margin: 0; font-size: 15px; font-weight: 700; color: var(--ink); }
.lt-ledger__sub { margin: 0; font-size: 14px; color: var(--ink3); }
.lt-ledger__rows { margin: 8px 0 0; }
.lt-ledger__row { display: flex; align-items: baseline; gap: 8px; padding: 6px 0; font-size: 15px; }
.lt-ledger__row dt { flex: 0 1 auto; min-width: 0; color: var(--ink2); }
.lt-ledger__dots { flex: 1 1 16px; min-width: 16px; border-bottom: 1px dotted var(--line-strong); transform: translateY(-4px); }
.lt-ledger__row dd { flex: 0 1 auto; margin: 0; text-align: right; color: var(--ink); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.lt-ledger__row--step { font-size: 14px; }
.lt-ledger__row--step dt, .lt-ledger__row--step dd { color: var(--ink3); }
.lt-ledger--box .lt-ledger__row { justify-content: space-between; border-bottom: 1px solid var(--line); }
.lt-ledger__total { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 16px; margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--ink); }
.lt-ledger__total-k { font-size: 15px; font-weight: 700; color: var(--ink); }
.lt-ledger__total-v { font-size: 30px; line-height: 1.2; font-weight: 700; color: var(--brand); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; text-align: right; }
.lt-ledger__warn, .lt-ledger__err { margin: 12px 0 0; font-size: 15px; color: var(--danger); }
.lt-ledger--err { padding-top: 4px; }
.lt-ledger__steps { margin-top: 12px; }
.lt-ledger__steps summary { display: inline-flex; align-items: center; gap: 4px; min-height: 32px; font-size: 14px; color: var(--brand); text-decoration: underline; cursor: pointer; list-style: none; }
.lt-ledger__steps summary::-webkit-details-marker { display: none; }
.lt-ledger__steps summary::after { content: ''; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg) translateY(-2px); transition: transform 150ms; }
.lt-ledger__steps[open] summary::after { transform: rotate(-135deg) translateY(-2px); }
.lt-ledger__steps ol { margin: 8px 0 0; padding-left: 20px; }
.lt-ledger__steps li { display: grid; gap: 2px; margin: 8px 0; font-size: 15px; }
.lt-ledger__step-k { font-size: 14px; color: var(--ink3); }
.lt-ledger__eq { color: var(--ink); overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.lt-ledger__code { margin: 12px 0 0; padding: 12px 0; font-family: var(--font-mono); font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink); }
.lt-ledger__note { margin: 12px 0 0; font-size: 13px; color: var(--ink3); }
.lt-ledger--empty { padding: 24px 0; }
.lt-ledger__placeholder { margin: 0; font-size: 15px; color: var(--ink3); }
.lt-ledger__table { margin-top: 16px; }
.lt-ledger__table summary { display: inline-flex; align-items: center; min-height: 44px; font-size: 14px; color: var(--brand); text-decoration: underline; cursor: pointer; }
.lt-table-scroll { max-height: 360px; overflow: auto; }
.lt-table-scroll table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.lt-table-scroll th, .lt-table-scroll td { padding: 6px 8px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
.lt-table-scroll th { position: sticky; top: 0; background: var(--bg); color: var(--ink2); font-weight: 700; }
.lt-table-scroll th:first-child, .lt-table-scroll td:first-child { text-align: left; }

/* 결과 아래 글: 어떻게 계산하나 · 자주 묻는 것 · 같이 쓰는 도구 (읽기 폭 680) */
.lt-prose { max-width: var(--w-read); }
.lt-prose h2 { margin: 48px 0 12px; padding-bottom: 8px; font-size: 20px; line-height: 1.3; font-weight: 700; color: var(--ink); border-bottom: 2px solid var(--ink); }
.lt-prose h3 { margin: 24px 0 8px; font-size: 17px; font-weight: 700; color: var(--ink); }
.lt-prose p, .lt-prose li { font-size: 16px; line-height: 1.7; color: var(--ink); }
.lt-prose p { margin: 0 0 16px; }
.lt-prose ul, .lt-prose ol { margin: 0 0 16px; padding-left: 20px; }
.lt-prose table { width: 100%; border-collapse: collapse; margin: 0 0 16px; font-size: 15px; font-variant-numeric: tabular-nums; }
.lt-prose th, .lt-prose td { padding: 8px; text-align: left; border-bottom: 1px solid var(--line); }
.lt-prose th { font-weight: 700; color: var(--ink2); }
/* 근거 줄은 13px 이라 읽기 폭(--w-read)을 그대로 쓰면 한 줄이 52자 — 45자로 묶는다(R-3 회신 12-05, U8) */
.lt-prose .lt-source { max-width: 45em; font-size: 13px; color: var(--ink3); }
.lt-faq details { border-bottom: 1px solid var(--line); }
.lt-faq summary { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 48px; padding: 8px 0; font-size: 16px; font-weight: 700; color: var(--ink); cursor: pointer; list-style: none; }
.lt-faq summary::-webkit-details-marker { display: none; }
.lt-faq summary::after { content: ''; flex: 0 0 auto; width: 8px; height: 8px; border-right: 1.5px solid var(--ink3); border-bottom: 1.5px solid var(--ink3); transform: rotate(45deg); transition: transform 150ms; }
.lt-faq details[open] summary::after { transform: rotate(-135deg); }
.lt-faq details > div { padding: 0 0 16px; }
.lt-faq details > div p:last-child { margin-bottom: 0; }
.lt-related ul { display: flex; flex-wrap: wrap; gap: 0 20px; margin: 0; padding: 0; list-style: none; }
.lt-related a { display: inline-flex; align-items: center; min-height: 44px; font-size: 16px; }

/* 위젯 틀(ui: 'widget'): 도구가 자기 화면을 그린다. 안의 기본 입력·버튼은 새 틀 입력과 같은 모양 — 도구별 widget.css 는 배치만 */
/* 공용 규칙은 :where 로 우선순위를 .lt-widget 하나(0,1,0)로 묶는다 — 도구 widget.css 의 클래스 규칙이 항상 이긴다 */
.lt-widget { margin: 0 0 32px; min-width: 0; }
.lt-widget :where(input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):not([type=file]), select, textarea) {
  box-sizing: border-box; max-width: 100%; min-height: 44px; padding: 0 12px; font: inherit; font-size: 16px;
  color: var(--ink); background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--radius-control);
}
.lt-widget :where(textarea) { padding: 10px 12px; line-height: 1.6; }
.lt-widget :where(input, select, textarea):focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.lt-widget :where(input, select, textarea, button):disabled { opacity: .5; cursor: not-allowed; }
.lt-widget :where(input[type=checkbox], input[type=radio]) { width: 24px; height: 24px; margin: 0; accent-color: var(--brand); }
.lt-widget :where(button) { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 16px; font: inherit; font-size: 15px; font-weight: 700;
  color: var(--ink); background: transparent; border: 1px solid var(--line-strong); border-radius: var(--radius-control); cursor: pointer; }
.lt-widget :where(button:hover:not(:disabled)) { border-color: var(--ink); }
.lt-widget :where(label) { color: var(--ink2); font-size: 15px; }
.lt-widget :where(h2) { margin: 0 0 12px; font-size: 18px; font-weight: 700; color: var(--ink); }
.lt-widget :where(h3) { margin: 0 0 8px; font-size: 15px; font-weight: 700; color: var(--ink); }
.lt-widget :where(p) { color: var(--ink2); }
/* 옛 스크립트가 띄우는 알림(common.js Utils.showNotification): body 끝에 붙고 .show 로 나타났다가 3초 뒤 사라진다 */
.notification { position: fixed; top: 16px; right: 16px; z-index: 1000; max-width: min(360px, calc(100vw - 32px)); padding: 12px 16px;
  font-size: 15px; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-control); opacity: 0; transition: opacity .3s ease; pointer-events: none; }
.notification.show { opacity: 1; }
.notification-success, .notification-info { color: var(--on-brand); background: var(--brand); border-color: var(--brand); }
.notification-error { color: var(--on-brand); background: var(--danger); border-color: var(--danger); }
@media (prefers-reduced-motion: reduce) { .notification { transition: none; } }

@media (max-width: 719px) {
  .lt-tool-page { padding: 16px 16px 0; }
  .lt-tool-page h1 { font-size: 24px; }
  .lt-tool-page .lt-lede { margin-bottom: 24px; }
  .lt-work { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .lt-ledger__total-v { font-size: 26px; }
}
