/* 서식 라이브러리(/forms) · 서식 작성기(/forms/<slug>) — ui.css 토큰 위에 얹는다 */
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 20px; }
.serif { font-family: 'Noto Serif KR', 'Nanum Myeongjo', serif; }

/* 상단 바 */
.fb-nav { position: sticky; top: 0; z-index: 50; background: rgba(251, 250, 247, 0.92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.fb-nav .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 12px; }
.fb-nav nav { display: flex; align-items: center; gap: 6px; }
.fb-nav .nl { font-size: 14.5px; font-weight: 600; color: var(--ink-2); text-decoration: none; padding: 0 10px; }
.fb-nav .nl:hover { color: var(--accent); }
.fb-nav .btn { border-radius: 999px; }
@media (max-width: 560px) { .fb-nav .nl.hide-sm { display: none; } .logo small { display: none; } }

/* ───────── 서식 라이브러리 ───────── */
.lib-hero { padding: 64px 0 36px; position: relative; overflow: hidden; }
.lib-hero::after { content: ''; position: absolute; right: -120px; top: -140px; width: 460px; height: 460px; border-radius: 50%; background: radial-gradient(closest-side, rgba(228, 87, 46, 0.1), transparent); pointer-events: none; }
.kicker { display: inline-flex; align-items: center; gap: 10px; color: var(--accent); font-weight: 700; font-size: 13px; letter-spacing: 0.12em; }
.kicker::before { content: ''; width: 24px; height: 1px; background: currentColor; }
.lib-hero h1 { font-family: 'Noto Serif KR', 'Nanum Myeongjo', serif; font-size: clamp(30px, 4.6vw, 50px); line-height: 1.22; letter-spacing: -0.03em; margin-top: 16px; font-weight: 700; }
.lib-hero .lead { margin-top: 18px; font-size: clamp(15.5px, 1.5vw, 18px); color: var(--muted); max-width: 640px; line-height: 1.75; }
.points { display: flex; flex-wrap: wrap; gap: 10px 22px; margin-top: 22px; font-size: 14px; color: var(--ink-2); font-weight: 600; }
.points span::before { content: '✓'; color: var(--accent); font-weight: 800; margin-right: 7px; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 22px; }
.chip { height: 38px; padding: 0 16px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--card); font-weight: 700; font-size: 14px; color: var(--ink-2); cursor: pointer; transition: border-color 0.15s, background 0.15s, color 0.15s; }
.chip:hover { border-color: var(--ink-2); }
.chip[aria-pressed='true'] { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip .n { opacity: 0.6; font-weight: 600; margin-left: 4px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }
.fcard { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 24px 22px 20px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); text-decoration: none; color: inherit; transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s; min-height: 220px; }
.fcard:hover { transform: translateY(-3px); box-shadow: 0 18px 36px -18px rgba(20, 33, 61, 0.25); border-color: #d6dae3; }
.fcard .ic { width: 48px; height: 48px; object-fit: contain; }
.fcard .cat { font-size: 12px; font-weight: 700; color: var(--accent); letter-spacing: 0.04em; margin-top: 6px; }
.fcard h3 { font-size: 17.5px; letter-spacing: -0.02em; line-height: 1.4; }
.fcard p { font-size: 14px; color: var(--muted); line-height: 1.65; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.fcard .go { margin-top: auto; font-size: 14px; font-weight: 700; color: var(--ink); display: inline-flex; align-items: center; gap: 6px; }
.fcard:hover .go { color: var(--accent); }

.lib-sec { padding: 72px 0; }
.lib-sec h2 { font-size: clamp(24px, 3vw, 34px); letter-spacing: -0.03em; line-height: 1.3; }
.lib-sec .sub { color: var(--muted); margin-top: 10px; font-size: 16px; max-width: 640px; }
.steps3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 32px; counter-reset: s; }
.steps3 > div { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 26px; }
.steps3 > div::before { counter-increment: s; content: '0' counter(s); display: block; font-family: 'Noto Serif KR', serif; font-size: 26px; color: var(--accent); margin-bottom: 10px; }
.steps3 .ic { width: 44px; height: 44px; object-fit: contain; margin-bottom: 12px; }
.steps3 h3 { font-size: 17px; }
.steps3 p { color: var(--muted); font-size: 14.5px; margin-top: 6px; }
.prose { max-width: 760px; }
.prose p { color: var(--ink-2); font-size: 15.5px; line-height: 1.85; margin-top: 14px; }
.prose ul { margin: 14px 0 0 18px; color: var(--ink-2); font-size: 15px; line-height: 1.9; }
.faq { margin-top: 26px; max-width: 820px; border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { list-style: none; cursor: pointer; padding: 20px 36px 20px 0; font-weight: 700; font-size: 16px; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; position: absolute; right: 4px; top: 16px; font-size: 22px; font-weight: 400; color: var(--muted); transition: transform 0.2s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { padding: 0 0 20px; color: var(--muted); font-size: 15px; line-height: 1.8; }
.cta-band { background: #0f1626; color: #fff; border-radius: 24px; padding: 48px 40px; display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.cta-band h2 { color: #fff; }
.cta-band p { color: #aab3c7; margin-top: 8px; }
.cta-band .btn { border-radius: 999px; background: #fff; color: var(--ink); height: 50px; padding: 0 26px; font-size: 16px; }
@media (max-width: 760px) {
  .steps3 { grid-template-columns: 1fr; }
  .lib-hero { padding-top: 40px; }
  .cta-band { padding: 34px 24px; }
  .lib-sec { padding: 52px 0; }
}

/* ───────── 서식 작성기 ───────── */
.fb-head { padding-top: 26px; padding-bottom: 18px; }
.crumb { font-size: 13px; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.crumb a { text-decoration: none; font-weight: 600; }
.crumb a:hover { color: var(--accent); }
.fb-head h1 { font-size: clamp(23px, 2.8vw, 32px); letter-spacing: -0.03em; line-height: 1.3; margin-top: 8px; }
.fb-desc { color: var(--muted); font-size: 15px; margin-top: 8px; max-width: 820px; line-height: 1.7; }
.fb-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.fb-tags span { font-size: 12.5px; font-weight: 700; color: var(--ink-2); background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px; }

.fb-grid { display: grid; grid-template-columns: minmax(0, 460px) minmax(0, 1fr); gap: 26px; align-items: start; padding-bottom: 64px; }
.fb-left { display: grid; gap: 14px; min-width: 0; }

.fb-guide { background: #fff8f4; border: 1px solid #f6d9cd; border-radius: var(--radius); padding: 0; }
.fb-guide summary { cursor: pointer; list-style: none; padding: 15px 18px; font-weight: 700; font-size: 14.5px; display: flex; align-items: center; gap: 8px; color: #9a3412; }
.fb-guide summary::-webkit-details-marker { display: none; }
.fb-guide summary::after { content: '▾'; margin-left: auto; transition: transform 0.2s; }
.fb-guide:not([open]) summary::after { transform: rotate(-90deg); }
.fb-guide ul { margin: 0; padding: 0 18px 16px 34px; display: grid; gap: 7px; font-size: 13.5px; color: #5b3a2a; line-height: 1.65; }

.fb-sec { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 18px 20px; }
.fb-sec h2 { font-size: 15px; letter-spacing: -0.01em; display: flex; align-items: center; gap: 9px; margin-bottom: 14px; }
.fb-sec h2 .no { width: 22px; height: 22px; border-radius: 7px; background: var(--ink); color: #fff; font-size: 12px; display: grid; place-items: center; flex: none; }
.fb-sec .sec-hint { font-size: 12.5px; color: var(--muted); margin: -8px 0 12px; }
.fb-fields { display: grid; gap: 13px; }
.fb-fields.cols-2 { grid-template-columns: 1fr 1fr; }
.fb-fields.cols-2 .full { grid-column: 1 / -1; }
.fb-f { display: grid; gap: 5px; min-width: 0; }
.fb-f > label, .fb-f > .lb { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.fb-f .req { color: var(--accent); margin-left: 2px; }
.fb-f .hint { font-size: 12px; color: var(--muted); }
.fb-f .input, .fb-f .select { height: 42px; font-size: 14.5px; padding: 0 12px; }
.fb-f .textarea { min-height: 72px; font-size: 14.5px; padding: 10px 12px; }
.fb-f.bad .input, .fb-f.bad .select, .fb-f.bad .textarea { border-color: var(--bad); box-shadow: 0 0 0 3px rgba(197, 48, 48, 0.1); }
.affix { position: relative; }
.affix .input { padding-right: 40px; text-align: right; font-variant-numeric: tabular-nums; }
.affix .sfx { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 13.5px; color: var(--muted); pointer-events: none; }
.input[type='date'], .input[type='time'] { font-variant-numeric: tabular-nums; }

/* 스위치 */
.sw { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--ink-2); min-height: 32px; user-select: none; }
.sw input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.sw i { width: 38px; height: 22px; border-radius: 999px; background: #d5d9e1; position: relative; flex: none; transition: background 0.15s; }
.sw i::after { content: ''; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); transition: transform 0.15s; }
.sw input:checked + i { background: var(--ink); }
.sw input:checked + i::after { transform: translateX(16px); }
.sw input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 요일표 */
.fb-table { width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 0 6px; font-size: 13px; }
.fb-table col.c0 { width: 50px; }
.fb-table col.cb { width: 22%; }
.fb-table th { font-weight: 600; color: var(--muted); text-align: left; padding: 0 4px; font-size: 12.5px; }
.fb-table td { padding: 0 3px; }
.fb-table td:first-child { font-weight: 700; color: var(--ink-2); padding-left: 0; white-space: nowrap; }
.fb-table .input { width: 100%; min-width: 0; height: 38px; font-size: 13.5px; padding: 0 6px; border-radius: 8px; }
@media (max-width: 480px) { .fb-table .input { font-size: 12.5px; padding: 0 3px; } .fb-table input[type='time']::-webkit-calendar-picker-indicator { display: none; } }

.fb-tools { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); padding: 0 4px; }

/* 미리보기 */
.fb-right { position: sticky; top: 80px; min-width: 0; }
.fb-pv { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow); }
.fb-pv-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.fb-pv-head .t { font-weight: 800; font-size: 14.5px; display: flex; align-items: center; gap: 8px; }
.fb-pv-head .t .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px var(--good-soft); }
.fb-pv-head .t .dot.busy { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.fb-acts { display: flex; gap: 6px; flex-wrap: wrap; }
.fb-acts .btn { height: 38px; padding: 0 14px; font-size: 14px; border-radius: 9px; }
#viewer { height: calc(100vh - 80px - 64px - 24px); min-height: 520px; background: #eef0f3; }
.fb-pv-foot { padding: 10px 14px; font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--line); display: flex; gap: 6px; align-items: center; }
.fb-pv-foot::before { content: ''; flex: none; width: 16px; height: 16px; background: url('/img/icons/lock-64.png') center / contain no-repeat; }
.fb-loading { display: grid; place-items: center; height: 100%; color: var(--muted); font-size: 14px; gap: 10px; }

/* 하단 고정 바 (모바일) */
.fb-bar { display: none; }

/* 서명받기 모달 */
.fb-role { border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.fb-role + .fb-role { margin-top: 10px; }
.fb-role-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.fb-role-top b { font-size: 14.5px; }
.fb-role-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: 8px; }
.fb-role-grid .input { height: 40px; font-size: 14.5px; }
.fb-role .sw { font-size: 13px; min-height: 26px; }
.fb-role.me .input { background: var(--line-2); color: var(--muted); }
.fb-modal-note { font-size: 13px; color: var(--muted); margin-bottom: 14px; line-height: 1.6; }
.fb-order { margin-top: 14px; }

@media (max-width: 980px) {
  .fb-grid { grid-template-columns: 1fr; }
  .fb-right { position: static; }
  #viewer { height: 78vh; min-height: 460px; }
  .fb-bar { display: flex; gap: 8px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); background: rgba(255, 255, 255, 0.96); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-top: 1px solid var(--line); }
  .fb-bar .btn { flex: 1; height: 46px; }
  body.has-bar { padding-bottom: 72px; }
  .fb-acts .hide-m { display: none; }
}
@media (max-width: 480px) {
  .fb-fields.cols-2 { grid-template-columns: 1fr; }
  .fb-role-grid { grid-template-columns: 1fr; }
  .fb-sec { padding: 16px 14px 18px; }
  .wrap { padding: 0 16px; }
}

/* 잘린 글자·페이지 넘침 경고 (FreeReport 0.10 TextItem.overflow) */
.fb-warn { margin: 0; padding: 10px 14px; font-size: 13px; line-height: 1.55; background: var(--warn-soft); color: #8a5a10; border-bottom: 1px solid #f1dfb8; }
.fb-warn b { font-weight: 700; }
