/* FPEI AI 고소장 — 디자인 시스템 */
:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8f9fd;
  --surface-3: #eef1f7;
  --line: #e3e7f0;
  --line-strong: #cdd5e4;
  --ink: #0e1628;
  --ink-2: #2f3b52;
  --muted: #5f6b83;
  --faint: #929db3;
  --brand: #0b1226;
  --primary: #2c57e6;
  --primary-600: #2146c4;
  --primary-50: #eef3ff;
  --primary-100: #dbe5ff;
  --primary-ink: #1c3fae;
  --success: #0c8a5f;
  --success-50: #e6f6ef;
  --warn: #a8690c;
  --warn-50: #fdf3e1;
  --danger: #c93636;
  --danger-50: #fdeded;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 6px 18px rgba(15, 23, 42, .06);
  --shadow-lg: 0 2px 6px rgba(15, 23, 42, .05), 0 24px 48px rgba(15, 23, 42, .12);
  --header-h: 60px;
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Segoe UI", sans-serif;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0a0f1d;
  --surface: #111a2d;
  --surface-2: #141e34;
  --surface-3: #1a2540;
  --line: #22304f;
  --line-strong: #31416a;
  --ink: #e9eef8;
  --ink-2: #c6cfe2;
  --muted: #909cb9;
  --faint: #66728f;
  --primary: #6b8cff;
  --primary-600: #86a1ff;
  --primary-50: rgba(107, 140, 255, .11);
  --primary-100: rgba(107, 140, 255, .22);
  --primary-ink: #a9bcff;
  --success: #3ccf95;
  --success-50: rgba(60, 207, 149, .12);
  --warn: #f0b95b;
  --warn-50: rgba(240, 185, 91, .12);
  --danger: #ff7b7b;
  --danger-50: rgba(255, 123, 123, .12);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 22px rgba(0, 0, 0, .28);
  --shadow-lg: 0 2px 6px rgba(0, 0, 0, .35), 0 24px 56px rgba(0, 0, 0, .45);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
button, a, [role="button"] { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
svg.i { width: 1em; height: 1em; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.125em; }
[hidden] { display: none !important; }
::selection { background: var(--primary-100); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ── 헤더 ─────────────────────────────────────────────────────────────── */
.app-header {
  position: sticky; top: 0; z-index: 50;
  height: calc(var(--header-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) max(20px, env(safe-area-inset-right)) 0 max(20px, env(safe-area-inset-left));
  background: linear-gradient(110deg, #0b1226 0%, #1e2f58 58%, #36599f 100%);
  color: #fff;
  box-shadow: 0 2px 14px rgba(11, 18, 38, .28);
}
.app-header-inner { height: var(--header-h); display: flex; align-items: center; gap: 14px; }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; min-width: 0; }
.brand:hover { text-decoration: none; }
.brand img { height: 30px; width: auto; display: block; }
.brand .brand-mark { display: none; height: 32px; width: 32px; border-radius: 9px; }
.brand-divider { width: 1px; height: 22px; background: rgba(255, 255, 255, .28); }
.brand-product { font-weight: 700; font-size: 15px; letter-spacing: -0.02em; white-space: nowrap; }
.brand-product small { font-weight: 600; opacity: .7; margin-left: 6px; font-size: 12px; }
.header-spacer { flex: 1; }
.header-btn {
  display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, .22); border-radius: 10px; background: rgba(255, 255, 255, .08);
  color: #fff; font-size: 13.5px; font-weight: 600; white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.header-btn:hover { background: rgba(255, 255, 255, .16); text-decoration: none; }
.header-btn.icon-only { width: 36px; padding: 0; justify-content: center; font-size: 17px; }

/* ── 공통 레이아웃 ────────────────────────────────────────────────────── */
.container { max-width: 1120px; margin: 0 auto; padding-inline: max(20px, env(safe-area-inset-left)) max(20px, env(safe-area-inset-right)); }
.narrow { max-width: 760px; }
main { min-height: calc(100dvh - var(--header-h)); }
.view { animation: view-in .28s ease-out; }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.page { padding-block: 36px 64px; }
.page-head { margin-bottom: 24px; }
.eyebrow { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--primary-ink); background: var(--primary-50); border: 1px solid var(--primary-100); padding: 5px 11px; border-radius: 999px; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -0.03em; line-height: 1.3; color: var(--ink); }
.page-title { font-size: clamp(22px, 3vw, 28px); font-weight: 800; }
.page-sub { color: var(--muted); margin: 8px 0 0; }
.section-title { font-size: 19px; font-weight: 800; margin-bottom: 14px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }
.grow { flex: 1; min-width: 0; }

/* ── 버튼 ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 16px; border-radius: 11px; border: 1px solid transparent;
  font-size: 14.5px; font-weight: 700; white-space: nowrap; user-select: none;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .1s;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 4px 14px rgba(44, 87, 230, .28); }
.btn-primary:hover:not(:disabled) { background: var(--primary-600); }
[data-theme="dark"] .btn-primary { color: #081030; box-shadow: none; }
.btn-dark { background: var(--brand); color: #fff; }
[data-theme="dark"] .btn-dark { background: #e9eef8; color: #0b1226; }
.btn-outline { background: var(--surface); border-color: var(--line-strong); color: var(--ink-2); }
.btn-outline:hover:not(:disabled) { border-color: var(--faint); color: var(--ink); }
.btn-soft { background: var(--primary-50); color: var(--primary-ink); }
.btn-soft:hover:not(:disabled) { background: var(--primary-100); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-3); color: var(--ink); }
.btn-danger-ghost { background: transparent; color: var(--danger); }
.btn-danger-ghost:hover { background: var(--danger-50); }
.btn-lg { height: 52px; padding: 0 22px; font-size: 16px; border-radius: 13px; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn-block { width: 100%; }
.btn-icon { width: 38px; padding: 0; }

/* ── 카드 ─────────────────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-pad { padding: 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-head h3 { font-size: 15.5px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.card-body { padding: 20px; }

/* ── 배지·칩 ──────────────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; background: var(--surface-3); color: var(--ink-2); }
.badge-primary { background: var(--primary-50); color: var(--primary-ink); }
.badge-success { background: var(--success-50); color: var(--success); }
.badge-warn { background: var(--warn-50); color: var(--warn); }
.badge-danger { background: var(--danger-50); color: var(--danger); }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line-strong); color: var(--ink-2); font-size: 13.5px; font-weight: 600; text-align: left; transition: border-color .15s, background .15s, color .15s; }
.chip:hover { border-color: var(--primary); color: var(--primary-ink); background: var(--primary-50); }

/* ── 폼 ───────────────────────────────────────────────────────────────── */
.field { display: block; }
.field + .field { margin-top: 18px; }
.field-label { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 700; color: var(--ink); margin-bottom: 7px; }
.req { color: var(--danger); font-weight: 800; }
.field-hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.input, .textarea, .select {
  width: 100%; min-height: 46px; padding: 11px 14px; border-radius: 11px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font-size: 15px; outline: none; transition: border-color .15s, box-shadow .15s, background .15s;
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.6; }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:focus, .textarea:focus, .select:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-100); }
.input[aria-invalid="true"], .textarea[aria-invalid="true"], .select[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 4px var(--danger-50); }
.select { appearance: none; padding-right: 38px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23929db3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }
.input-group { display: flex; gap: 8px; }
.input-group > .input { flex: 1; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.grid-2 .field + .field { margin-top: 0; }
.span-2 { grid-column: 1 / -1; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.seg button { height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); font-weight: 600; font-size: 14px; transition: all .15s; }
.seg button:hover { border-color: var(--primary); }
.seg button[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }
[data-theme="dark"] .seg button[aria-pressed="true"] { color: #081030; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--ink-2); cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--primary); flex: none; }

/* ── 홈 ───────────────────────────────────────────────────────────────── */
.hero { position: relative; overflow: hidden; padding: 64px 0 40px; }
.hero::before {
  content: ""; position: absolute; inset: -40% -10% auto -10%; height: 620px; z-index: -1;
  background:
    radial-gradient(40% 50% at 20% 40%, rgba(44, 87, 230, .14), transparent 70%),
    radial-gradient(35% 45% at 80% 20%, rgba(120, 90, 255, .10), transparent 70%);
}
[data-theme="dark"] .hero::before { background: radial-gradient(40% 50% at 20% 40%, rgba(80, 120, 255, .22), transparent 70%), radial-gradient(35% 45% at 80% 20%, rgba(140, 100, 255, .16), transparent 70%); }
.hero h1 { font-size: clamp(30px, 5.2vw, 50px); font-weight: 850; letter-spacing: -0.045em; line-height: 1.2; margin: 18px 0 16px; }
.hero h1 em { font-style: normal; background: linear-gradient(100deg, var(--primary), #7a5cff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { font-size: clamp(15.5px, 1.8vw, 18px); color: var(--muted); max-width: 640px; margin: 0; }
.mode-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 34px; max-width: 880px; }
.mode-card {
  position: relative; display: flex; flex-direction: column; gap: 10px; text-align: left;
  padding: 24px; border-radius: var(--radius-lg); border: 1px solid var(--line); background: var(--surface);
  box-shadow: var(--shadow); transition: transform .18s, box-shadow .18s, border-color .18s;
}
.mode-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--primary-100); }
.mode-card.featured { border-color: var(--primary-100); background: linear-gradient(180deg, var(--primary-50), var(--surface) 70%); }
.mode-icon { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; font-size: 22px; background: var(--primary-50); color: var(--primary); }
.mode-card.featured .mode-icon { background: var(--primary); color: #fff; }
.mode-card h3 { font-size: 19px; font-weight: 800; }
.mode-card p { margin: 0; color: var(--muted); font-size: 14.5px; }
.mode-card .go { margin-top: auto; padding-top: 8px; display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--primary-ink); font-size: 14px; }
.mode-card .badge { position: absolute; top: 20px; right: 20px; }
.resume-banner { display: flex; align-items: center; gap: 14px; margin-top: 22px; max-width: 880px; padding: 14px 16px; border-radius: var(--radius); background: var(--surface); border: 1px dashed var(--line-strong); }
.resume-banner .i { font-size: 20px; color: var(--primary); }
.steps4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; counter-reset: s; }
.step4 { padding: 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.step4 .num { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-weight: 800; font-size: 14px; background: var(--surface-3); color: var(--ink-2); margin-bottom: 12px; }
.step4 h4 { font-size: 15.5px; font-weight: 800; margin-bottom: 4px; }
.step4 p { margin: 0; font-size: 13.5px; color: var(--muted); }
.home-section { padding: 36px 0; }
.type-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.type-card { text-align: left; padding: 16px 18px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); transition: border-color .15s, box-shadow .15s, transform .15s; }
.type-card:hover { border-color: var(--primary); box-shadow: var(--shadow); transform: translateY(-1px); }
.type-card strong { display: block; font-size: 15px; font-weight: 800; margin-bottom: 3px; }
.type-card span { font-size: 13px; color: var(--muted); }
.type-card[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-50); box-shadow: 0 0 0 3px var(--primary-100); }
.trust { display: grid; grid-template-columns: 1.1fr 1fr; gap: 16px; }
.trust-item { display: flex; gap: 14px; padding: 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.trust-item .ic { width: 40px; height: 40px; flex: none; border-radius: 11px; display: grid; place-items: center; font-size: 19px; background: var(--success-50); color: var(--success); }
.trust-item.warn .ic { background: var(--warn-50); color: var(--warn); }
.trust-item h4 { font-size: 15px; font-weight: 800; margin-bottom: 4px; }
.trust-item p { margin: 0; font-size: 13.5px; color: var(--muted); }
.kb-stats { display: flex; gap: 20px; margin-top: 10px; flex-wrap: wrap; }
.kb-stats b { font-size: 20px; font-weight: 800; color: var(--ink); margin-right: 3px; }
.app-footer { border-top: 1px solid var(--line); padding: 28px 0 calc(28px + env(safe-area-inset-bottom)); color: var(--muted); font-size: 13px; }
.app-footer .container { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* ── 채팅 ─────────────────────────────────────────────────────────────── */
.chat-layout { display: grid; grid-template-columns: minmax(0, 1fr) 390px; height: calc(100dvh - var(--header-h) - env(safe-area-inset-top)); }
.chat-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.chat-bar { display: flex; align-items: center; gap: 10px; padding: 10px 18px; border-bottom: 1px solid var(--line); background: var(--surface); }
.chat-bar h2 { font-size: 15.5px; font-weight: 800; }
.progress-pill { display: none; }
.chat-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 26px 18px 12px; scroll-behavior: smooth; }
.chat-inner { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.msg { display: flex; gap: 11px; max-width: 100%; }
.msg .avatar { width: 32px; height: 32px; flex: none; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(135deg, #1e3a8a, #2c57e6); color: #fff; font-size: 16px; margin-top: 2px; }
.msg .bubble { padding: 12px 16px; border-radius: 16px; line-height: 1.7; font-size: 15px; white-space: pre-wrap; max-width: min(620px, 100%); }
.msg.ai .bubble { background: var(--surface); border: 1px solid var(--line); border-top-left-radius: 6px; color: var(--ink); box-shadow: var(--shadow-sm); }
.msg.user { justify-content: flex-end; }
.msg.user .bubble { background: var(--primary); color: #fff; border-top-right-radius: 6px; }
[data-theme="dark"] .msg.user .bubble { background: #2a4ad0; }
.msg .bubble strong { font-weight: 800; }
.msg.error .bubble { background: var(--danger-50); border-color: transparent; color: var(--danger); }
.cursor::after { content: ""; display: inline-block; width: 7px; height: 16px; margin-left: 2px; vertical-align: -2px; border-radius: 2px; background: var(--primary); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.thinking { display: inline-flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--primary); opacity: .35; animation: dot 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 80%, 100% { opacity: .25; transform: none; } 40% { opacity: 1; transform: translateY(-3px); } }
.fact-toast { align-self: flex-start; margin-left: 43px; display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--success); background: var(--success-50); padding: 5px 11px; border-radius: 999px; font-weight: 600; }
.composer-wrap { padding: 10px 18px calc(14px + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--bg) 70%, transparent); }
.composer-inner { max-width: 760px; margin: 0 auto; }
.suggestions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.composer { display: flex; align-items: flex-end; gap: 8px; padding: 8px 8px 8px 16px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line-strong); box-shadow: var(--shadow); transition: border-color .15s, box-shadow .15s; }
.composer:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-100), var(--shadow); }
.composer textarea { flex: 1; min-width: 0; border: 0; outline: 0; resize: none; background: transparent; padding: 8px 0; max-height: 200px; line-height: 1.55; font-size: 15.5px; }
.composer .send { width: 42px; height: 42px; border-radius: 13px; border: 0; background: var(--primary); color: #fff; display: grid; place-items: center; font-size: 18px; flex: none; transition: background .15s, opacity .15s; }
.composer .send:disabled { opacity: .35; cursor: not-allowed; }
.composer-note { text-align: center; font-size: 12px; color: var(--faint); margin-top: 8px; }

/* 사건 정리 패널 */
.case-panel { border-left: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; min-height: 0; }
.case-panel-head { padding: 18px 20px 14px; border-bottom: 1px solid var(--line); }
.case-panel-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 6px 20px 20px; }
.case-panel-foot { padding: 14px 20px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface); }
.progress { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), #7a5cff); transition: width .5s cubic-bezier(.2, .8, .2, 1); }
.panel-section { padding: 16px 0 6px; }
.panel-section + .panel-section { border-top: 1px solid var(--line); }
.panel-section h4 { font-size: 12.5px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .02em; margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.fact-row { width: 100%; display: flex; gap: 10px; align-items: flex-start; padding: 9px 10px; margin: 0 -10px; border-radius: 10px; border: 0; background: transparent; text-align: left; transition: background .15s; }
.fact-row:hover { background: var(--surface-2); }
.fact-row .st { width: 18px; height: 18px; flex: none; margin-top: 2px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; border: 1.5px solid var(--line-strong); color: transparent; }
.fact-row.done .st { background: var(--success); border-color: var(--success); color: #fff; }
.fact-row.need .st { border-color: var(--warn); border-style: dashed; }
.fact-row .lbl { font-size: 13.5px; font-weight: 700; color: var(--ink); display: flex; gap: 6px; align-items: center; }
.fact-row .val { font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.fact-row.flash { animation: flash 1.4s ease-out; }
@keyframes flash { 0% { background: var(--success-50); } 100% { background: transparent; } }
.law-card { border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); margin-bottom: 8px; overflow: hidden; }
.law-card summary { list-style: none; cursor: pointer; padding: 11px 13px; display: flex; gap: 8px; align-items: flex-start; }
.law-card summary::-webkit-details-marker { display: none; }
.law-card summary .t { flex: 1; min-width: 0; }
.law-card summary b { display: block; font-size: 13.5px; font-weight: 800; color: var(--ink); }
.law-card summary span { font-size: 12.5px; color: var(--muted); }
.law-card summary .chev { transition: transform .2s; color: var(--faint); margin-top: 3px; }
.law-card[open] summary .chev { transform: rotate(180deg); }
.law-card .law-text { padding: 0 13px 12px; font-size: 13px; line-height: 1.7; color: var(--ink-2); white-space: pre-wrap; }
.law-card .law-meta { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; font-size: 12px; color: var(--faint); }

/* ── 스텝퍼 ───────────────────────────────────────────────────────────── */
.stepper { display: flex; align-items: center; gap: 8px; margin-bottom: 26px; flex-wrap: wrap; }
.stepper .s { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 700; color: var(--faint); }
.stepper .s .n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12.5px; background: var(--surface-3); color: var(--muted); }
.stepper .s.on { color: var(--ink); }
.stepper .s.on .n { background: var(--primary); color: #fff; }
.stepper .s.done { color: var(--muted); }
.stepper .s.done .n { background: var(--success-50); color: var(--success); }
.stepper .bar { width: 28px; height: 2px; border-radius: 2px; background: var(--line-strong); }
.form-section { margin-bottom: 18px; }
.form-section > .card-head { background: var(--surface-2); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.form-actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 24px; }
.sticky-actions { position: sticky; bottom: 0; z-index: 5; padding: 14px 0 calc(14px + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--bg) 75%, transparent); }

/* ── 생성 진행 ────────────────────────────────────────────────────────── */
.gen-wrap { max-width: 560px; margin: 0 auto; padding: 56px 0; }
.gen-card { padding: 30px 28px; }
.gen-orb { width: 64px; height: 64px; border-radius: 20px; margin: 0 auto 18px; display: grid; place-items: center; font-size: 28px; color: #fff; background: linear-gradient(135deg, #1e3a8a, #2c57e6 60%, #7a5cff); box-shadow: 0 10px 30px rgba(44, 87, 230, .35); animation: orb 2.4s ease-in-out infinite; }
@keyframes orb { 50% { transform: translateY(-4px) scale(1.03); } }
.gen-steps { list-style: none; padding: 0; margin: 24px 0 0; }
.gen-steps li { display: flex; gap: 12px; padding: 12px 0; align-items: flex-start; }
.gen-steps li + li { border-top: 1px solid var(--line); }
.gen-steps .ic { width: 26px; height: 26px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 13px; background: var(--surface-3); color: var(--faint); }
.gen-steps li.run .ic { background: var(--primary-50); color: var(--primary); }
.gen-steps li.ok .ic { background: var(--success); color: #fff; }
.gen-steps li.fail .ic { background: var(--danger); color: #fff; }
.gen-steps b { display: block; font-size: 14.5px; font-weight: 700; }
.gen-steps li.wait b { color: var(--faint); }
.gen-steps small { color: var(--muted); font-size: 12.5px; }
.spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── 결과 ─────────────────────────────────────────────────────────────── */
.result-hero { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 22px 24px; margin-bottom: 18px; }
.result-hero .ok { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 24px; background: var(--success-50); color: var(--success); flex: none; }
.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 13px; background: var(--surface-3); margin-bottom: 18px; width: fit-content; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { height: 38px; padding: 0 16px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-weight: 700; font-size: 14px; white-space: nowrap; display: inline-flex; align-items: center; gap: 7px; }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.result-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 520px); gap: 18px; align-items: start; }
.doc-section { padding: 18px 20px; }
.doc-section + .doc-section { border-top: 1px solid var(--line); }
.doc-section h4 { font-size: 14.5px; font-weight: 800; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; }
.doc-text { white-space: pre-wrap; font-size: 14.5px; line-height: 1.8; color: var(--ink-2); }
.doc-text.empty { color: var(--faint); font-style: italic; }
.preview-frame { position: sticky; top: calc(var(--header-h) + 18px); height: calc(100dvh - var(--header-h) - 60px); min-height: 520px; overflow: hidden; }
.preview-frame iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.issue { display: flex; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--warn-50); color: var(--ink-2); font-size: 13.5px; }
.issue + .issue { margin-top: 8px; }
.issue .i { color: var(--warn); font-size: 16px; margin-top: 2px; }
.issue.error { background: var(--danger-50); }
.issue.error .i { color: var(--danger); }
.el-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.el-table th, .el-table td { padding: 12px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.el-table th { font-size: 12.5px; color: var(--muted); font-weight: 700; }
.el-table td:first-child { font-weight: 800; white-space: nowrap; }
.callout { display: flex; gap: 12px; padding: 16px; border-radius: 14px; background: var(--primary-50); color: var(--ink-2); font-size: 14px; }
.callout .i { font-size: 18px; color: var(--primary); margin-top: 2px; }
.callout.warn { background: var(--warn-50); }
.callout.warn .i { color: var(--warn); }
.list-clean { margin: 0; padding-left: 18px; }
.list-clean li + li { margin-top: 6px; }
.guide-steps { counter-reset: g; list-style: none; padding: 0; margin: 0; }
.guide-steps li { position: relative; padding: 4px 0 18px 46px; }
.guide-steps li::before { counter-increment: g; content: counter(g); position: absolute; left: 0; top: 2px; width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: 14px; background: var(--primary-50); color: var(--primary-ink); }
.guide-steps > li > b { display: block; font-size: 15px; margin-bottom: 2px; }
.guide-steps p { margin: 0; color: var(--muted); font-size: 14px; }

/* ── 시트(모달) · 토스트 ─────────────────────────────────────────────── */
.sheet-overlay { position: fixed; inset: 0; z-index: 400; background: rgba(8, 12, 24, .5); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; padding: 20px; animation: fade .18s ease-out; }
@keyframes fade { from { opacity: 0; } }
.sheet { width: 100%; max-width: 480px; max-height: calc(100dvh - 40px); overflow-y: auto; overscroll-behavior: contain; background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-lg); padding: 24px; animation: pop .22s cubic-bezier(.2, .9, .3, 1.1); }
.sheet.wide { max-width: 640px; }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.sheet-grip { display: none; }
.sheet h3 { font-size: 18px; font-weight: 800; margin-bottom: 6px; }
.sheet .sheet-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }
.toast-host { position: fixed; left: 50%; transform: translateX(-50%); top: calc(var(--header-h) + env(safe-area-inset-top) + 12px); z-index: 600; display: grid; gap: 8px; width: min(92vw, 400px); pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-radius: 14px; background: #121a2e; color: #fff; font-size: 14px; box-shadow: var(--shadow-lg); animation: pop .2s ease-out; }
.toast.error { background: #a32828; }
.toast.ok { background: #0b6b4a; }

/* ── 반응형 ───────────────────────────────────────────────────────────── */
@media (max-width: 1080px) {
  .result-grid { grid-template-columns: minmax(0, 1fr); }
  .preview-frame { position: static; height: 70dvh; min-height: 420px; }
}
@media (max-width: 960px) {
  .chat-layout { grid-template-columns: minmax(0, 1fr); }
  .case-panel { position: fixed; inset: auto 0 0 0; z-index: 300; max-height: 86dvh; border: 0; border-radius: 22px 22px 0 0; box-shadow: var(--shadow-lg); transform: translateY(105%); transition: transform .3s cubic-bezier(.2, .8, .2, 1); visibility: hidden; }
  .case-panel.open { transform: none; visibility: visible; }
  .panel-scrim { position: fixed; inset: 0; z-index: 290; background: rgba(8, 12, 24, .45); animation: fade .2s; }
  .case-panel .sheet-grip { display: block; width: 40px; height: 4px; border-radius: 99px; background: var(--line-strong); margin: 8px auto 0; }
  .progress-pill { display: inline-flex; }
  .steps4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .type-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .trust { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  :root { --header-h: 56px; }
  .brand img { display: none; }
  .brand .brand-mark { display: block; }
  .brand-divider { display: none; }
  .brand-product small { display: none; }
  .header-btn .lbl { display: none; }
  .header-btn { width: 36px; padding: 0; justify-content: center; font-size: 17px; }
  .hero { padding: 36px 0 24px; }
  .mode-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; margin-top: 26px; }
  .mode-card { padding: 20px; }
  .steps4, .type-grid { grid-template-columns: minmax(0, 1fr); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .page { padding-block: 22px 40px; }
  .card-pad, .card-body { padding: 18px; }
  .chat-scroll { padding: 18px 12px 8px; }
  .composer-wrap { padding: 8px 10px calc(10px + env(safe-area-inset-bottom)); }
  .msg .avatar { display: none; }
  .fact-toast { margin-left: 0; }
  .sheet-overlay { align-items: flex-end; padding: 0; }
  .sheet { max-width: none; border-radius: 22px 22px 0 0; padding: 18px 20px calc(20px + env(safe-area-inset-bottom)); max-height: 92dvh; animation: up .28s cubic-bezier(.2, .8, .2, 1); }
  .sheet-grip { display: block; width: 40px; height: 4px; border-radius: 99px; background: var(--line-strong); margin: -6px auto 14px; }
  @keyframes up { from { transform: translateY(100%); } }
  .sheet .sheet-actions { flex-direction: column-reverse; }
  .sheet .sheet-actions .btn { width: 100%; height: 48px; }
  .form-actions { flex-direction: column-reverse; }
  .form-actions .btn { width: 100%; }
  .sticky-actions .form-actions { flex-direction: row; }
  .sticky-actions .form-actions .btn { width: auto; }
  .sticky-actions .form-actions .btn:last-child { flex: 1; }
  .sticky-actions .form-actions .btn:first-child:not(:last-child) { flex: none; padding: 0 14px; }
  .el-table thead { display: none; }
  .el-table tr { display: block; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .el-table td { display: block; border: 0; padding: 3px 0; }
  .tabs { width: 100%; }
  .tabs button { flex: 1; padding: 0 10px; }
}
@media (pointer: coarse), (max-width: 767.98px) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), textarea, select { font-size: 16px !important; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
@media print {
  .app-header, .app-footer, .tabs, .btn { display: none !important; }
}

/* 보정 */
.only-mobile { display: none !important; }
@media (max-width: 960px) { .only-mobile { display: inline-flex !important; } }
.mode-card.featured .badge { background: var(--primary); color: #fff; }
[data-theme="dark"] .mode-card.featured .badge { color: #081030; }
.law-card .chev { display: inline-block; }

/* 유형 분류 탭 · 검색 */
.cat-tabs { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 4px; margin-bottom: 14px; }
.cat-tabs::-webkit-scrollbar { display: none; }
.cat-tabs button { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); font-weight: 700; font-size: 14px; white-space: nowrap; transition: all .15s; }
.cat-tabs button span { font-size: 12px; font-weight: 700; color: var(--faint); }
.cat-tabs button:hover { border-color: var(--primary); }
.cat-tabs button[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }
.cat-tabs button[aria-pressed="true"] span { color: rgba(255, 255, 255, .6); }
[data-theme="dark"] .cat-tabs button[aria-pressed="true"] { background: #e9eef8; border-color: #e9eef8; color: #0b1226; }
[data-theme="dark"] .cat-tabs button[aria-pressed="true"] span { color: rgba(11, 18, 38, .55); }
.search-box { position: relative; margin-bottom: 20px; }
.search-box > .i { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--faint); font-size: 17px; }
.search-box .input { padding-left: 42px; }
.type-group-title { font-size: 14px; font-weight: 800; color: var(--muted); margin: 22px 0 10px; }
.type-group-title:first-child { margin-top: 0; }
.callout > div > div + div { margin-top: 4px; }
