/* 문서 교정 AI · styles.css
   공통 틀(청람 표준)은 계약서 검토 AI → 판결문 검토 AI 의 것을 그대로 가져왔다.
   이 앱 부품은 맨 끝 «문서 교정 AI 전용» 구획에 tm- 이름으로만 둔다(공통 틀의 .go·.empty 와 겹치지 않게 · 헌법 §7). */

:root {
    --ground: #f2f5f8;
    --card: #ffffff;
    --line: #d9e2ea;
    --line-strong: #c3d0dc;
    --ink: #10203a;
    --ink-soft: #44546a;
    --ink-light: #7b8899;
    --accent: #0b4a76;
    --accent-2: #2d7fc0;
    --accent-soft: #e3eef7;
    --accent-soft-2: #d3e4f3;
    --seal: #c8432f;
    --seal-soft: #fbe9e6;
    --amber: #9a6a0c;
    --amber-soft: #fdf3dc;
    --ok: #1f6f4a;
    --ok-soft: #e4f3ea;
    --r: 18px;
    --shadow: 0 1px 2px rgba(16, 32, 58, .04), 0 8px 24px rgba(16, 32, 58, .06);
    --font: 'Pretendard Variable', 'Pretendard', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Malgun Gothic', 'Noto Sans KR', sans-serif;
    --serif: 'Noto Serif KR', 'Nanum Myeongjo', serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--font);
    color: var(--ink);
    background: var(--ground);
    background-image: radial-gradient(1200px 420px at 50% -120px, #dfeaf5 0%, rgba(223, 234, 245, 0) 70%);
    background-repeat: no-repeat;
    line-height: 1.6;
    word-break: keep-all;
    overflow-wrap: anywhere;
}
a { color: inherit; }
button, input, select, output { font: inherit; color: inherit; }
svg { display: block; }
[hidden] { display: none !important; }

/* ── 머리 ─────────────────────────────── */
.top {
    position: sticky; top: 0; z-index: 30;
    background: rgba(255, 255, 255, .86);
    -webkit-backdrop-filter: saturate(1.4) blur(10px);
    backdrop-filter: saturate(1.4) blur(10px);
    border-bottom: 1px solid var(--line);
}
.top-in {
    max-width: 1120px; margin: 0 auto; padding: 10px 20px;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-seal {
    width: 36px; height: 36px; border-radius: 9px; flex: none;
    display: grid; place-items: center;
    background: var(--ink); color: #fff;
    font-family: var(--serif); font-weight: 900; font-size: 20px; line-height: 1;
}
.brand-txt { display: flex; flex-direction: column; line-height: 1.2; }
.brand-txt b { font-size: 15px; font-weight: 800; letter-spacing: -.01em; }
.brand-txt small { font-size: 12px; color: var(--ink-light); }
.head-tools { display: flex; gap: 8px; }
.tool-btn {
    width: 38px; height: 38px; border-radius: 50%;
    display: grid; place-items: center; cursor: pointer;
    background: #fff; border: 1px solid var(--line-strong); color: var(--ink-soft);
    transition: border-color .15s, color .15s, transform .15s;
}
.tool-btn:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.tool-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ── 본문 틀 · 히어로(법정기간·양육비 계산기와 같은 틀) ── */
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px 40px; }

.hero {
    padding: 30px 0 18px;
    display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px;
    grid-template-areas: "txt char" "facts facts" "note note";
}
.hero-txt { grid-area: txt; min-width: 0; }
.hero .facts { grid-area: facts; }
.hero .notice-line { grid-area: note; }
.hero-char { grid-area: char; align-self: end; position: relative; width: 104px; }
.hero-char img { display: block; width: 100%; height: auto; animation: charIn .6s ease both .1s; }
.hero-bubble { display: none; }
@keyframes charIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (min-width: 760px) {
    .hero { grid-template-areas: "txt char" "facts char" "note char"; padding-bottom: 0; }
    .hero-char { width: 206px; margin: -8px 24px -36px 0; }   /* 허리 아래가 카드 뒤로 숨는다 */
    .hero-bubble {
        position: absolute; right: calc(100% + 4px); top: 30px; width: 208px; margin: 0;
        background: #fff; border: 1px solid var(--line-strong); border-radius: 16px; padding: 11px 13px;
        font-size: 13px; line-height: 1.55; color: var(--ink-soft); box-shadow: var(--shadow);
        animation: charIn .6s ease both .35s;
    }
    .hero-bubble b { color: var(--accent); }
    .hero-bubble::after {
        content: ''; position: absolute; right: -8px; top: 26px; width: 14px; height: 14px; background: #fff;
        border-right: 1px solid var(--line-strong); border-top: 1px solid var(--line-strong); transform: rotate(45deg);
    }
    .board { position: relative; z-index: 1; }
}
/* 말풍선은 본문이 최대 폭(1120px)일 때만. 폴드 안쪽·태블릿 폭에서는 제목·설명을 가린다(법정기간 계산기 2026-09-19 조변 실기기) */
@media (min-width: 1120px) { .hero-bubble { display: block; } }
.eyebrow { margin: 0 0 8px; font-size: 13px; font-weight: 700; letter-spacing: .08em; color: var(--accent); }
.hero h1 {
    margin: 0; font-family: var(--serif); font-weight: 900;
    font-size: clamp(30px, 6.4vw, 46px); line-height: 1.18; letter-spacing: -.02em;
}
.hero h1 span { color: var(--accent); }
.lead { margin: 12px 0 0; font-size: clamp(15px, 2.4vw, 17px); color: var(--ink-soft); max-width: 640px; }
.facts { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.facts li {
    font-size: 13px; color: var(--ink-soft); background: #fff;
    border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px;
}
.facts b { color: var(--accent); font-weight: 800; }
.notice-line {
    display: flex; align-items: flex-start; gap: 8px;
    margin: 14px 0 0; padding: 9px 12px; font-size: 13px; color: var(--ink-soft);
    background: rgba(0, 0, 0, .035); border: 1px solid rgba(0, 0, 0, .09); border-radius: 10px;
    max-width: 640px;
}
.notice-line svg { width: 15px; height: 15px; flex: none; margin-top: 3px; fill: none; stroke: currentColor; stroke-width: 2; opacity: .5; }

/* ── 보드: 폰은 한 줄, 넓으면 입력 | 결과 ── */
.board { display: grid; gap: 16px; margin-top: 8px; }
.inputs { display: grid; gap: 16px; min-width: 0; align-content: start; }
@media (min-width: 980px) {
    .board { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; gap: 22px; }
    .inputs.stick { position: sticky; top: 76px; }   /* 화면에 다 들어올 때만(script.js fitSticky) */
}

.card {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
    box-shadow: var(--shadow); padding: 20px; min-width: 0;
    scroll-margin-top: 72px;
}
.step h2 {
    display: flex; align-items: center; gap: 10px;
    margin: 0 0 12px; font-size: 18px; font-weight: 800; letter-spacing: -.01em;
}
.no {
    width: 26px; height: 26px; border-radius: 50%; flex: none;
    display: grid; place-items: center; font-size: 14px; font-weight: 800;
    background: var(--accent); color: #fff;
}
.step-lead { margin: -4px 0 12px 36px; font-size: 13.5px; color: var(--ink-light); line-height: 1.55; }


/* ── 결과 ─────────────────────────── */
.result { padding: 22px; }
.empty { margin: 0 0 16px; font-size: 14px; color: var(--ink-light); line-height: 1.55; }
.empty b { color: var(--ink-soft); font-size: 15px; }
.linklike { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 700; text-decoration: underline; cursor: pointer; font-size: inherit; }

.out { animation: rise .35s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.out-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.kicker { margin: 0; font-size: 14px; font-weight: 700; color: var(--ink-soft); }
.badge { font-size: 12px; font-weight: 800; color: var(--accent); border: 1.5px solid var(--accent); border-radius: 6px; padding: 1px 7px; white-space: nowrap; }
.badge.paper { color: var(--ink-soft); border-color: var(--ink-light); }

.note {
    margin: 12px 0 0; padding: 10px 12px; border-radius: 12px; font-size: 13.5px; line-height: 1.6;
    background: #f6f9fc; border: 1px solid var(--line); color: var(--ink-soft);
}
.note b { color: var(--ink); }
.note.warn { background: var(--amber-soft); border-color: #f0dca8; color: #6b4a07; }
.note.warn b { color: #4d3505; }
.note.law { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; background: none; border: 0; padding: 0; margin-top: 14px; }
.law-chip { font-size: 12.5px; font-weight: 700; color: var(--accent); background: var(--accent-soft); border-radius: 6px; padding: 2px 8px; }

.acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.act {
    display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
    border: 1px solid var(--line-strong); background: #fff; color: var(--ink);
    font-size: 14px; font-weight: 700; padding: 9px 13px; border-radius: 11px;
    transition: border-color .15s, color .15s;
}
.act:hover { border-color: var(--accent); color: var(--accent); }
.act svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* 조변 버튼 — 결과 화면에 하나만(헌법 §5) */
.cta {
    display: flex; align-items: center; gap: 12px; margin-top: 18px; text-decoration: none;
    background: linear-gradient(135deg, #10203a 0%, #163257 100%); color: #fff;
    border-radius: 16px; padding: 12px 14px; transition: transform .15s, box-shadow .15s;
}
.cta:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(16, 32, 58, .22); }
.cta img { width: 56px; height: 56px; border-radius: 50%; flex: none; background: #dce8f4; object-fit: cover; border: 2px solid rgba(255, 255, 255, .7); }
.cta-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.45; }
.cta-txt b { font-size: 15px; font-weight: 800; }
.cta-txt span { font-size: 13px; color: #c9d6e6; }
.cta-go {
    flex: none; font-size: 13px; font-weight: 800; color: var(--ink); background: #fff;
    border-radius: 999px; padding: 7px 12px; white-space: nowrap;
}
@media (max-width: 440px) {
    .cta { flex-wrap: wrap; }
    .cta-go { margin-left: 68px; width: calc(100% - 68px); text-align: center; }
}

/* ── 참고 표(= 계산 데이터) · 법정기간 계산기와 같은 행 모양 ── */
.ref, .rules, .faq { margin-top: 40px; }
.ref h2, .rules h2, .faq h2 { margin: 0 0 6px; font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.ref-lead { margin: 0 0 10px; color: var(--ink-soft); font-size: 14.5px; }
.ref-lead b { color: var(--ink); }
.ref h3 { margin: 24px 0 8px; font-size: 16px; font-weight: 800; color: var(--accent); }
.ref h3 em { font-style: normal; font-size: 12.5px; font-weight: 600; color: var(--ink-light); margin-left: 4px; }
.table { background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.tr {
    display: grid; grid-template-columns: 1.2fr .7fr 1.6fr 1.2fr; gap: 10px; align-items: center;
    width: 100%; text-align: left; border: 0; background: none; padding: 11px 14px; font-size: 14px;
    border-top: 1px solid var(--line); color: var(--ink-soft);
}
.tr.t3 { grid-template-columns: 1.3fr 1.4fr 1.2fr; }
.tr:first-child { border-top: 0; }
button.tr { cursor: pointer; transition: background .12s; }
button.tr:hover { background: #f6f9fc; }
.tr span:first-child { color: var(--ink); font-weight: 700; }
.tr span:nth-child(2) { color: var(--accent); font-weight: 800; }
.tr em { font-style: normal; font-weight: 600; font-size: 12px; color: var(--ink-light); margin-left: 2px; }
.tr span:nth-child(4), .tr.t3 span:nth-child(3) { font-size: 12.5px; color: var(--ink-light); }
.tr.th { background: #f6f9fc; font-size: 12px; font-weight: 800; color: var(--ink-light); padding-top: 8px; padding-bottom: 8px; }
.tr.th span { color: var(--ink-light) !important; font-weight: 800 !important; font-size: 12px !important; }
.tr.on { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
@media (max-width: 720px) {
    .tr { grid-template-columns: 1fr auto; gap: 2px 10px; }
    .tr span:nth-child(3), .tr span:nth-child(4) { grid-column: 1 / -1; }
    .tr span:nth-child(3) { font-size: 13px; }
    .tr.t3 { grid-template-columns: 1fr auto; }
    .tr.th { display: none; }
    .table > .tr:nth-child(2) { border-top: 0; }
}
.ref-note { margin: 8px 2px 0; font-size: 13px; color: var(--ink-light); line-height: 1.6; }
.ref-note b { color: var(--ink-soft); }

.rules ol { margin: 10px 0 0; padding: 0; list-style: none; counter-reset: r; display: grid; gap: 8px; }
.rules li {
    counter-increment: r; position: relative; padding: 12px 14px 12px 48px; font-size: 14.5px; color: var(--ink-soft);
    background: #fff; border: 1px solid var(--line); border-radius: 14px;
}
.rules li::before {
    content: counter(r); position: absolute; left: 14px; top: 12px; width: 24px; height: 24px; border-radius: 50%;
    display: grid; place-items: center; font-size: 13px; font-weight: 800; background: var(--ink); color: #fff;
}
.rules li b { color: var(--ink); }
.rules-foot { margin: 8px 2px 0; font-size: 13px; color: var(--ink-light); }

.faq details { background: #fff; border: 1px solid var(--line); border-radius: 14px; margin-top: 8px; }
.faq summary { cursor: pointer; padding: 13px 16px; font-weight: 700; font-size: 15px; list-style: none; display: flex; justify-content: space-between; gap: 10px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; color: var(--accent); font-weight: 800; }
.faq details[open] summary::after { content: '−'; }
.faq details p { margin: 0; padding: 0 16px 14px; font-size: 14.5px; color: var(--ink-soft); }

/* ── 바닥 ─────────────────────────── */
.foot { margin-top: 48px; background: var(--ink); color: #c9d6e6; }
.foot-in { max-width: 1120px; margin: 0 auto; padding: 26px 20px 30px; }
.foot-links { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.foot-links a { color: #fff; font-weight: 700; font-size: 14px; text-decoration: none; }
.foot-links a:hover { text-decoration: underline; }
.foot-note { margin: 14px 0 0; font-size: 13px; line-height: 1.7; max-width: 760px; }
.foot-note a { color: #fff; }
.foot-copy { margin: 10px 0 0; font-size: 12px; color: #8fa1b8; }
.foot-copy span { font-family: var(--serif); font-weight: 900; }

.toast {
    position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(10px);
    max-width: min(88vw, 420px); text-align: center; background: rgba(16, 32, 58, .95); color: #fff;
    font-size: 14px; font-weight: 600; padding: 10px 18px; border-radius: 999px; z-index: 100;
    opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translateX(-50%); }

/* ── 위험 색(신호등 4단계 · 색만으로 구분하지 않게 글자 표시를 함께 둔다) ── */
:root {
    --r-high: #c8432f; --r-high-soft: #fbe9e6;
    --r-medium: #d97a1e; --r-medium-soft: #fdeedd;
    --r-low: #c9a227; --r-low-ink: #7d6308; --r-low-soft: #fbf5dc;
    --r-none: #3f8f63; --r-none-soft: #e4f3ea;
    --r-pending: #dfe6ee;
}

/* ① 계약 종류 */
.kinds { display: flex; flex-wrap: wrap; gap: 7px; }
.kinds button {
    cursor: pointer; border: 1px solid var(--line-strong); background: #fff; color: var(--ink-soft);
    font-size: 14px; font-weight: 700; padding: 7px 13px; border-radius: 999px; transition: all .15s;
}
.kinds button:hover { border-color: var(--accent); color: var(--accent); }
.kinds button[aria-checked="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ② 입장 */
.sides { display: grid; gap: 8px; }
@media (min-width: 440px) { .sides { grid-template-columns: 1fr 1fr; } }
.side {
    text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 2px; min-width: 0;
    background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
    transition: border-color .15s, background .15s, transform .15s;
}
.side:hover { border-color: var(--accent-2); transform: translateY(-1px); }
.side b { font-size: 15px; font-weight: 800; line-height: 1.3; }
.side small { font-size: 12.5px; color: var(--ink-light); }
.side[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.party { margin-top: 14px; }
.party label { display: block; font-size: 13.5px; font-weight: 700; margin-bottom: 6px; }
.party input {
    width: 100%; font-size: 16px; font-weight: 700; min-height: 44px; padding: 9px 12px;
    border: 1px solid var(--line-strong); border-radius: 11px; background: #fff;
}
.party input:focus, .ask-row textarea:focus, #pasteText:focus { outline: 0; border-color: var(--accent-2); box-shadow: 0 0 0 3px rgba(45, 127, 192, .15); }
.role-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.role-chips button {
    cursor: pointer; border: 1px solid var(--line-strong); background: #fff; color: var(--ink-soft);
    font-size: 13px; font-weight: 700; padding: 4px 11px; border-radius: 999px;
}
.role-chips button:hover { border-color: var(--accent); color: var(--accent); }

/* ③ 계약서 */
.tabs { display: inline-flex; gap: 4px; padding: 4px; background: #eef2f6; border-radius: 12px; margin-bottom: 12px; }
.tab { cursor: pointer; border: 0; background: none; font-size: 14px; font-weight: 700; color: var(--ink-soft); padding: 6px 14px; border-radius: 9px; }
.tab[aria-selected="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(16, 32, 58, .12); }
.drop {
    display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; cursor: pointer;
    border: 2px dashed var(--line-strong); border-radius: 14px; padding: 22px 16px; background: #fbfcfd;
    transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over { border-color: var(--accent-2); background: var(--accent-soft); }
.drop svg { width: 34px; height: 34px; fill: none; stroke: var(--accent); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.drop b { font-size: 15px; }
.drop span { font-size: 12.5px; color: var(--ink-light); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.drop.has { padding: 12px 16px; flex-direction: row; justify-content: center; }
.drop.has span, .drop.has svg { display: none; }
.drop.has b { font-size: 13.5px; color: var(--accent); }
.drop.has b::before { content: '다른 파일로 바꾸기 · '; }
.doc-chip {
    display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 10px 12px;
    background: var(--ok-soft); border: 1px solid #cbe7d6; border-radius: 12px;
}
.doc-chip > svg { width: 22px; height: 22px; flex: none; fill: none; stroke: var(--ok); stroke-width: 1.8; }
.doc-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.4; }
.doc-txt b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-txt small { font-size: 12.5px; color: var(--ink-soft); }
.doc-x {
    width: 32px; height: 32px; flex: none; border-radius: 9px; border: 1px solid var(--line-strong); background: #fff;
    display: grid; place-items: center; cursor: pointer; color: var(--ink-light);
}
.doc-x:hover { border-color: var(--seal); color: var(--seal); }
.doc-x svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.hint { margin: 10px 2px 0; font-size: 12.5px; color: var(--ink-light); line-height: 1.55; }
#pasteText {
    width: 100%; font-size: 15px; line-height: 1.6; padding: 11px 12px; resize: vertical; min-height: 180px;
    border: 1px solid var(--line-strong); border-radius: 12px; background: #fff;
}
.count { margin: 4px 2px 0; text-align: right; font-size: 12.5px; color: var(--ink-light); font-variant-numeric: tabular-nums; }
.count.over { color: var(--seal); font-weight: 700; }
.peek { margin-top: 10px; }
.peek summary { cursor: pointer; font-size: 13px; font-weight: 700; color: var(--accent); }
.peek pre {
    margin: 8px 0 0; max-height: 220px; overflow: auto; white-space: pre-wrap; word-break: break-all;
    font: 12.5px/1.6 var(--font); color: var(--ink-soft); background: #f6f9fc; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
.go {
    margin-top: 16px; width: 100%; min-height: 54px; cursor: pointer; border: 0; border-radius: 14px;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    background: linear-gradient(135deg, #0b4a76 0%, #10203a 100%); color: #fff; font-size: 17px; font-weight: 800;
    box-shadow: 0 8px 20px rgba(11, 74, 118, .25); transition: transform .15s, box-shadow .15s, opacity .15s;
}
.go:hover { transform: translateY(-1px); box-shadow: 0 12px 26px rgba(11, 74, 118, .3); }
.go:disabled { opacity: .55; cursor: wait; transform: none; }
.go svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.limit-inline {
    display: flex; align-items: flex-start; gap: 8px; margin: 10px 0 0; padding: 9px 12px; font-size: 13px; line-height: 1.6;
    background: rgba(128, 128, 128, .12); border: 1px solid rgba(128, 128, 128, .32); border-radius: 10px; color: var(--ink-soft);
}
.limit-inline svg { width: 14px; height: 14px; flex: none; margin-top: 3px; fill: none; stroke: currentColor; stroke-width: 1.8; opacity: .55; }
.limit-inline b { color: var(--ink); }
.limit-inline.low b { color: var(--seal); }
.limit-inline .dots { display: inline-flex; gap: 3px; vertical-align: 1px; margin: 0 4px; }
.limit-inline .dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.limit-inline .dots i.used { background: #c9d3de; }
.err {
    margin: 12px 0 0; padding: 10px 12px; border-radius: 12px; font-size: 14px; line-height: 1.55;
    background: var(--r-high-soft); border: 1px solid #f1c7bf; color: #8c2b1c; font-weight: 600;
}

/* ── 결과 요약 ── */
.dim { color: var(--ink-light); font-size: 13px; }
.loading { text-align: center; padding: 18px 0 8px; }
.scan {
    position: relative; width: 92px; height: 116px; margin: 0 auto 14px; padding: 16px 14px;
    background: #fff; border: 1.5px solid var(--line-strong); border-radius: 8px; overflow: hidden;
    display: flex; flex-direction: column; gap: 9px; box-shadow: var(--shadow);
}
.scan i { display: block; height: 5px; border-radius: 3px; background: #dfe6ee; }
.scan i:nth-child(2) { width: 80%; } .scan i:nth-child(4) { width: 64%; }
.scan b { position: absolute; left: 0; right: 0; top: 0; height: 26px; background: linear-gradient(180deg, rgba(45, 127, 192, 0) 0%, rgba(45, 127, 192, .28) 100%); border-bottom: 2px solid var(--accent-2); animation: scan 1.8s ease-in-out infinite; }
@keyframes scan { 0% { transform: translateY(-26px); } 100% { transform: translateY(116px); } }
.load-msg { margin: 0; font-size: 16px; font-weight: 800; }
.load-sub { margin: 4px 0 0; font-size: 13px; color: var(--ink-light); font-variant-numeric: tabular-nums; }
.demo-flag { margin: 8px 0 0; font-size: 13px; color: var(--r-low-ink); background: var(--r-low-soft); border: 1px solid #efe1a4; border-radius: 10px; padding: 6px 10px; }

.verdict { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 16px; margin-top: 12px; }
.v-lamp { width: 54px; height: 54px; border-radius: 50%; flex: none; background: var(--vc); box-shadow: 0 0 0 6px var(--vs), 0 6px 18px var(--vs); }
.v-main { display: flex; flex-direction: column; line-height: 1.1; }
.v-main small { font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.v-main b { font-size: 38px; font-weight: 900; letter-spacing: -.02em; color: var(--vc); }
.v-high { --vc: var(--r-high); --vs: var(--r-high-soft); }
.v-medium { --vc: var(--r-medium); --vs: var(--r-medium-soft); }
.v-low { --vc: var(--r-low); --vs: var(--r-low-soft); }
.v-counts { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.v-counts li { font-size: 13px; color: var(--ink-soft); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; background: #fff; }
.v-counts b { color: var(--ink); font-variant-numeric: tabular-nums; }
.v-counts .c-high b { color: var(--r-high); } .v-counts .c-medium b { color: var(--r-medium); } .v-counts .c-low b { color: var(--r-low-ink); }
.verdict-why { margin: 10px 0 0; font-size: 14.5px; color: var(--ink); font-weight: 600; }
.terms { margin-top: 12px; }
.doc-title { margin: 0; font-family: var(--serif); font-weight: 900; font-size: 17px; }
.doc-sum { margin: 4px 0 0; font-size: 14px; color: var(--ink-soft); }
.term-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.term { display: inline-flex; flex-direction: column; font-size: 13.5px; font-weight: 700; background: #f6f9fc; border: 1px solid var(--line); border-radius: 10px; padding: 5px 10px; line-height: 1.35; min-width: 0; }
.term small { font-size: 11.5px; font-weight: 700; color: var(--ink-light); }

/* 조항 신호등 — 계약서를 넣기 전에도 빈 틀이 보인다 */
.sigbox { margin-top: 18px; }
.result > .sigbox:first-of-type { margin-top: 4px; }
.sig-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.sig-title { margin: 0; font-size: 15px; font-weight: 800; }
.sig-lg { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 12px; font-weight: 600; color: var(--ink-light); }
.sig-lg i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
.s-high { --sc: var(--r-high); } .s-medium { --sc: var(--r-medium); } .s-low { --sc: var(--r-low); } .s-none { --sc: var(--r-none); } .s-pending { --sc: var(--r-pending); }
.sig-lg i { background: var(--sc); }
.sigs { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; }
.sig {
    display: flex; flex-direction: column; align-items: flex-start; gap: 1px; min-width: 0; text-align: left;
    padding: 6px 8px 7px; border-radius: 9px; border: 0; cursor: pointer; font: inherit;
    background: var(--sc, var(--r-pending)); color: #fff; transition: transform .12s, box-shadow .12s;
}
.sig b { font-size: 13px; font-weight: 800; line-height: 1.2; }
.sig span { font-size: 11px; font-weight: 600; line-height: 1.3; opacity: .92; max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sig:hover { transform: translateY(-1px); box-shadow: 0 4px 10px rgba(16, 32, 58, .18); }
.sig.s-low { color: #3d3000; }
.sig.s-pending { color: var(--ink-soft); cursor: default; }
.sig.s-pending:hover { transform: none; box-shadow: none; }
.sig.ghost { height: 40px; background: repeating-linear-gradient(90deg, #eef2f6 0 10px, #e4eaf0 10px 12px); cursor: default; }
.sig-hint { margin: 8px 0 0; font-size: 12.5px; color: var(--ink-light); }
.must-title { margin: 18px 0 8px; font-size: 15px; font-weight: 800; color: var(--r-high); }
.must { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.must label { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-size: 14px; background: var(--r-high-soft); border: 1px solid #f1c7bf; border-radius: 11px; padding: 9px 11px; }
.must input { width: 18px; height: 18px; margin: 2px 0 0; flex: none; accent-color: var(--r-high); }
.must input:checked + span { text-decoration: line-through; color: var(--ink-light); }

/* ── 조항별 검토 ── */
.report { margin-top: 26px; }
.report-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.report h2 { margin: 0; font-size: 22px; font-weight: 800; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.filters button { cursor: pointer; border: 1px solid var(--line-strong); background: #fff; color: var(--ink-soft); font-size: 13.5px; font-weight: 700; padding: 5px 12px; border-radius: 999px; }
.filters button[aria-selected="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.filters button:disabled { opacity: .45; cursor: default; }
.issues { display: grid; gap: 12px; margin-top: 12px; }
@media (min-width: 1000px) { .issues { grid-template-columns: 1fr 1fr; align-items: start; } }
.issue {
    background: #fff; border: 1px solid var(--line); border-left: 5px solid var(--ic); border-radius: 16px;
    padding: 16px 18px; box-shadow: var(--shadow); min-width: 0; scroll-margin-top: 80px;
}
.issue.r-high { --ic: var(--r-high); --is: var(--r-high-soft); }
.issue.r-medium { --ic: var(--r-medium); --is: var(--r-medium-soft); }
.issue.r-low { --ic: var(--r-low); --is: var(--r-low-soft); }
.issue.r-miss { --ic: var(--accent-2); --is: var(--accent-soft); }
.issue.flash { animation: flash 1.2s ease; }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 4px var(--is), var(--shadow); } 100% { box-shadow: var(--shadow); } }
.issue header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rk { font-size: 12px; font-weight: 800; color: #fff; background: var(--ic); border-radius: 6px; padding: 2px 8px; }
.issue.r-low .rk { color: #3d3000; }
.art { font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.issue h4 { margin: 8px 0 0; font-size: 16.5px; font-weight: 800; line-height: 1.45; }
.quote {
    margin: 10px 0 0; padding: 10px 12px; background: #f6f9fc; border-left: 3px solid var(--line-strong); border-radius: 0 10px 10px 0;
    font-size: 13.5px; line-height: 1.65; color: var(--ink-soft);
}
.qok, .qno { display: inline-block; margin-left: 6px; font-size: 11.5px; font-weight: 800; border-radius: 5px; padding: 0 6px; vertical-align: 1px; white-space: nowrap; }
.qok { color: var(--ok); background: var(--ok-soft); }
.qno { color: #8c2b1c; background: var(--r-high-soft); }
.lbl { margin: 12px 0 2px; font-size: 12.5px; font-weight: 800; color: var(--ink-light); letter-spacing: .02em; }
.issue p:not(.lbl):not(.fix-txt) { margin: 0; font-size: 14.5px; color: var(--ink); }
.issue p + p:not(.lbl) { margin-top: 6px; }
.fix { margin-top: 12px; padding: 10px 12px 12px; border-radius: 12px; background: var(--is); border: 1px solid rgba(16, 32, 58, .06); }
.fix .lbl { margin-top: 0; color: var(--ink-soft); }
.fix-txt { margin: 2px 0 0; font-family: var(--serif); font-weight: 700; font-size: 15px; line-height: 1.75; color: var(--ink); }
.act.small { margin-top: 8px; padding: 6px 10px; font-size: 12.5px; }
.act.small svg { width: 15px; height: 15px; }
.laws { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
a.law-chip { text-decoration: none; font-size: 12.5px; font-weight: 700; color: var(--accent); background: var(--accent-soft); border-radius: 6px; padding: 2px 8px; }
a.law-chip:hover { text-decoration: underline; }
.none-msg { margin: 0; padding: 16px; background: var(--r-none-soft); border: 1px solid #cbe7d6; border-radius: 14px; color: var(--ok); font-weight: 600; }
.block { margin-top: 26px; }
.block h3 { margin: 0; font-size: 18px; font-weight: 800; }
.favs { display: grid; gap: 8px; margin-top: 10px; }
.fav { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.fav b { display: block; font-size: 14.5px; }
.fav p { margin: 4px 0 0; font-size: 14px; color: var(--ink-soft); }
.nego { margin: 10px 0 0; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.nego p { margin: 0; font-size: 15px; line-height: 1.75; }
.nego p + p { margin-top: 8px; }
.ask { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; box-shadow: var(--shadow); }
.ask-lead { margin: 4px 0 0; font-size: 13.5px; color: var(--ink-light); }
.ask.off { opacity: .7; }
.thread { display: grid; gap: 10px; margin-top: 10px; }
.qa .q { margin: 0 0 6px auto; max-width: 88%; width: max-content; background: var(--ink); color: #fff; border-radius: 14px 14px 4px 14px; padding: 8px 12px; font-size: 14px; }
.qa .a { background: #f6f9fc; border: 1px solid var(--line); border-radius: 14px 14px 14px 4px; padding: 10px 12px; font-size: 14.5px; }
.qa .a p { margin: 0; } .qa .a p + p { margin-top: 6px; }
.qa .a.pending { color: var(--ink-light); }
.qa .a.fail { color: #8c2b1c; background: var(--r-high-soft); border-color: #f1c7bf; }
.ask-row { display: flex; gap: 8px; margin-top: 10px; align-items: stretch; }
.ask-row textarea { flex: 1; min-width: 0; font-size: 15px; line-height: 1.5; padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: 11px; resize: vertical; min-height: 48px; }
.act.primary { background: var(--accent); border-color: var(--accent); color: #fff; justify-content: center; white-space: nowrap; }
.act.primary:hover { background: #093d62; color: #fff; }
.act:disabled { opacity: .5; cursor: default; }
@media (max-width: 480px) { .ask-row { flex-direction: column; } }
.notes { margin-top: 16px; }

.sheet { width: min(640px, calc(100vw - 32px)); max-height: 80vh; border: 1px solid var(--line); border-radius: 16px; padding: 0; box-shadow: 0 20px 60px rgba(16, 32, 58, .3); }
.sheet::backdrop { background: rgba(16, 32, 58, .45); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; }
.sheet pre { margin: 0; padding: 14px 16px; white-space: pre-wrap; font: 14px/1.7 var(--font); color: var(--ink); }

/* 조문 표 행 = 링크(법제처 조문으로) */
a.tr { text-decoration: none; transition: background .12s; }
a.tr:hover { background: #f6f9fc; }
.tr.law { grid-template-columns: 1.15fr 1fr 2fr; }
.tr.law span:nth-child(2) { color: var(--ink-soft); font-weight: 700; }
@media (max-width: 720px) { .tr.law { grid-template-columns: 1fr; } .tr.law span:nth-child(2) { font-size: 13px; } }

@media (max-width: 480px) {
    .wrap { padding: 0 16px 32px; }
    .top-in { padding: 9px 16px; }
    .card { padding: 16px; }
    .result { padding: 18px 16px; }
    .hero { padding-top: 22px; }
    .step-lead { margin-left: 0; }
    .act { padding: 9px 11px; font-size: 13.5px; }
    .issue { padding: 14px 14px; }
    .v-main b { font-size: 32px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media print {
    /* 바닥글: 남색 띠·링크 줄은 빼고 참고용 안내와 사무소 표기만 작게(2026-09-19 인쇄 점검 · 이자 계산기는 끝줄 하나로 빈 2쪽이 생겼다) */
    .foot { margin-top: 14px; background: none !important; color: #555 !important; break-inside: avoid; }
    .foot-in { max-width: none; padding: 8px 20px 0; border-top: 1px solid #ccc; }
    .foot-links { display: none !important; }
    .foot-note { margin: 0; max-width: none; font-size: 8.5pt; line-height: 1.5; }
    .foot-note a { color: inherit; }
    .foot-copy { margin: 3px 0 0; font-size: 8pt; color: #777 !important; }
    .top, .hero, .inputs, .ref, .rules, .faq, .acts, .cta, .toast, .filters, .ask, .copy-fix, .sig-hint, .demo-flag .linklike, .foot-links { display: none !important; }
    body { background: #fff; }
    .board { display: block; }
    .card, .issue { box-shadow: none; }
    .issue { break-inside: avoid; }
    .issues { grid-template-columns: 1fr !important; }
    .issue[hidden] { display: block !important; }
    .sig, .rk, .v-lamp, .fix, .must label { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}


/* ══════════════ 문서 교정 AI 전용 (tm-) ══════════════
   공통 틀에 없던 부품만 여기 둔다. 이름은 모두 tm- 로 시작한다(공통의 .go·.act 와 겹치지 않게 · 헌법 §7). */

/* 입력 */
textarea {
    width: 100%; box-sizing: border-box; font-family: var(--font); font-size: 15px; line-height: 1.75;
    color: var(--ink); background: #fcfdfe; border: 1px solid var(--line); border-radius: 12px;
    padding: 14px 15px; resize: vertical; min-height: 180px;
}
textarea:focus { outline: 0; border-color: var(--accent-2); box-shadow: 0 0 0 3px var(--accent-soft); background: #fff; }
textarea::placeholder { color: var(--ink-light); }

.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg button {
    flex: 1 1 130px; padding: 11px 14px; font: 600 14.5px var(--font); color: var(--ink-soft);
    background: #fff; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; transition: .15s;
}
.seg button:hover { border-color: var(--accent-2); color: var(--accent); }
.seg button[aria-checked="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }

.left-note { margin: 10px 0 0; font-size: 13px; color: var(--ink-light); }
.left-note b { color: var(--accent); }
.act-note { margin: 9px 0 0; font-size: 12.5px; line-height: 1.6; color: var(--ink-light); }

.tm-srcbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.tm-srcbar > span { font-size: 13px; color: var(--ink-light); font-variant-numeric: tabular-nums; }
.tm-srcbtns { display: flex; gap: 8px; }

/* 점검 요약 */
.tm-sum-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tm-sum-head h2 { margin: 0; font-size: 19px; font-weight: 800; }
.tm-counts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.tm-count {
    background: var(--accent-soft); border: 1px solid var(--accent-soft-2); border-radius: 14px;
    padding: 12px 8px; text-align: center;
}
.tm-count b { display: block; font-size: 24px; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.tm-count span { font-size: 12.5px; color: var(--ink-soft); }
.tm-empty { margin: 14px 0 0; font-size: 14.5px; color: var(--ink-soft); line-height: 1.7; }

/* 제안 목록 */
.tm-list { display: flex; flex-direction: column; gap: 12px; }
.tm-item { border: 1px solid var(--line); border-radius: 14px; padding: 13px 14px 12px; background: #fff; }
.tm-top { display: flex; align-items: center; gap: 7px; margin-bottom: 8px; }
.tm-chip {
    font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px;
    background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent-soft-2);
}
.tm-chip.tm-emotion, .tm-chip.tm-figure { background: var(--seal-soft); color: var(--seal); border-color: #f3d3cd; }
.tm-chip.tm-colloquial, .tm-chip.tm-prefer { background: var(--amber-soft); color: var(--amber); border-color: #f0dcae; }
.tm-chip.tm-long, .tm-chip.tm-freq { background: #eef1f5; color: var(--ink-soft); border-color: var(--line); }
.tm-chip.tm-spell, .tm-chip.tm-grammar, .tm-chip.tm-flow { background: var(--ok-soft); color: var(--ok); border-color: #c9e6d5; }
.tm-by { margin-left: auto; font-size: 11.5px; font-weight: 700; color: var(--ink-light); }
.tm-by.tm-ai { color: var(--accent-2); }
.tm-quote { margin: 0 0 7px; font-size: 14.5px; line-height: 1.75; color: var(--ink); word-break: break-all; }
.tm-ctx { color: var(--ink-light); }
.tm-quote mark { background: #fdf0cd; color: var(--ink); padding: 1px 2px; border-radius: 3px; font-weight: 600; }
.tm-fix { margin: 0 0 6px; font-size: 14.5px; color: var(--accent); font-weight: 600; }
.tm-fix span { font-size: 12px; font-weight: 700; color: var(--ink-light); margin-right: 4px; }
.tm-why { margin: 0; font-size: 13px; line-height: 1.65; color: var(--ink-soft); }
.tm-btns { display: flex; gap: 8px; margin-top: 10px; }
.tm-b {
    padding: 7px 13px; font: 600 13.5px var(--font); border-radius: 10px; cursor: pointer; transition: .15s;
    border: 1px solid var(--line); background: #fff; color: var(--ink-soft);
}
.tm-b:hover { border-color: var(--accent-2); color: var(--accent); }
.tm-b.tm-apply { background: var(--accent); border-color: var(--accent); color: #fff; }
.tm-b.tm-apply:hover { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }

/* 고친 글 */
.tm-h { margin: 0 0 4px; font-size: 19px; font-weight: 800; }
.tm-out {
    margin-top: 10px; padding: 14px 15px; border: 1px solid var(--line); border-radius: 12px;
    background: #fcfdfe; font-size: 14.5px; line-height: 1.85; color: var(--ink); max-height: 460px; overflow: auto;
}
.tm-out mark { background: var(--ok-soft); color: var(--ok); font-weight: 600; padding: 1px 3px; border-radius: 3px; }

/* 기준 표 */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 6px; }
.tm-tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 540px; }
.tm-tbl th, .tm-tbl td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.tm-tbl thead th { background: var(--accent-soft); color: var(--accent); font-weight: 700; white-space: nowrap; }
.tm-tbl tbody tr:last-child td { border-bottom: 0; }
.tm-tbl code { font-family: var(--font); font-size: 13.5px; color: var(--ink); background: #f3f6f9; padding: 1px 6px; border-radius: 6px; }
.tm-tbl .tm-g { white-space: nowrap; color: var(--ink-soft); font-weight: 600; }
.tm-tbl .tm-why { font-size: 12.5px; color: var(--ink-light); line-height: 1.6; }
.tm-protect { min-width: 0; }
.tm-lenrow, .tm-guide { margin: 10px 0 0; font-size: 13.5px; color: var(--ink-soft); }
.tm-lenrow b { color: var(--accent); }

/* 폰 */
@media (max-width: 720px) {
    .tm-counts { gap: 8px; }
    .tm-count b { font-size: 21px; }
    .tm-tbl { font-size: 13px; }
    .tm-btns { flex-wrap: wrap; }
    .tm-b { flex: 1 1 auto; }
}
.tm-tbl .tm-ap { white-space: nowrap; font-size: 12.5px; font-weight: 600; color: var(--ink-light); }
.tm-group + .tm-group { margin-top: 18px; }
.tm-ghead { margin: 0 0 10px; font-size: 15px; font-weight: 800; color: var(--ink); display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; }
.tm-ghead b { color: var(--accent); font-size: 15px; }
.tm-ghead span { font-size: 12.5px; font-weight: 500; color: var(--ink-light); }
.tm-none { margin: 0; padding: 12px 14px; font-size: 13.5px; color: var(--ink-light); background: #f7f9fb; border: 1px solid var(--line); border-radius: 12px; }
