/* 루마닉 오피스 화면. 웜 페이퍼 바탕, 네이비 레일, 코발트 주 행동, 8px 평평한 표면, 1px 선.
   간격은 4·8·12·16·20·24·32·48 만 쓴다. 숫자·시각은 tabular 로 맞춘다. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--lm-font-ui); font-size: 16px; line-height: 1.6; word-break: keep-all; overflow-wrap: break-word; color: var(--lm-text); background: var(--lm-bg-page); }
h1, h2, h3, h4 { color: var(--lm-text-strong); line-height: 1.35; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 650; }
p { margin: 0; }
a { color: var(--lm-primary); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: var(--lm-focus-ring); outline-offset: 3px; }
[hidden] { display: none !important; }
.num, time, .mono { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--lm-font-mono); font-size: 13px; }
.muted { color: var(--lm-text-muted); }
.small { font-size: 14px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── 셸 ── */
.shell { display: grid; grid-template-columns: var(--lm-rail-width) minmax(0, 1fr); min-height: 100vh; }
.rail { background: var(--lm-rail-bg); color: var(--lm-rail-ink); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: var(--lm-space-20) var(--lm-space-12); }
.rail-brand { display: flex; align-items: center; gap: var(--lm-space-12); padding: var(--lm-space-4) var(--lm-space-12) var(--lm-space-24); color: var(--lm-rail-ink-strong); text-decoration: none; }
.rail-brand img { width: 24px; height: 24px; }
.rail-brand strong { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.rail nav { display: flex; flex-direction: column; gap: var(--lm-space-4); }
.rail-link { display: flex; align-items: center; gap: var(--lm-space-12); min-height: 44px; padding: 0 var(--lm-space-12); border-radius: var(--lm-radius-inner); color: var(--lm-rail-ink); text-decoration: none; font-size: 15px; position: relative; transition: background var(--lm-duration-fast) var(--lm-ease-out); }
.rail-link svg { width: 20px; height: 20px; flex: none; opacity: 0.85; }
.rail-link:hover { background: var(--lm-rail-hover); color: var(--lm-rail-ink-strong); }
.rail-link[aria-current="page"] { background: var(--lm-rail-selected); color: var(--lm-rail-ink-strong); font-weight: 600; }
.rail-link[aria-current="page"]::before { content: ""; position: absolute; left: -12px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--lm-rail-accent); }
.rail-foot { margin-top: auto; border-top: 1px solid var(--lm-rail-line); padding: var(--lm-space-16) var(--lm-space-12) 0; display: grid; gap: var(--lm-space-8); }
.rail-user { font-size: 14px; color: var(--lm-rail-ink-strong); line-height: 1.4; }
.rail-user span { display: block; color: var(--lm-rail-muted); font-size: 13px; }
.rail-logout { justify-self: start; background: none; border: 1px solid var(--lm-rail-line); color: var(--lm-rail-ink); border-radius: var(--lm-radius-inner); padding: 6px 12px; font-size: 14px; cursor: pointer; }
.rail-logout:hover { background: var(--lm-rail-hover); color: var(--lm-rail-ink-strong); }
.topbar { display: none; }
.main { min-width: 0; padding: var(--lm-space-32) var(--lm-space-32) var(--lm-space-48); }
.page { max-width: 1240px; margin: 0 auto; display: grid; gap: var(--lm-space-24); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--lm-space-16); flex-wrap: wrap; }
.page-head p { color: var(--lm-text-muted); margin-top: var(--lm-space-4); }
.page-head .actions { display: flex; gap: var(--lm-space-8); flex-wrap: wrap; }
.crumb { font-size: 14px; color: var(--lm-text-muted); text-decoration: none; display: inline-flex; gap: 4px; align-items: center; margin-bottom: var(--lm-space-8); white-space: nowrap; }
.crumb svg { width: 18px; height: 18px; }
.crumb:hover { color: var(--lm-text-strong); }

/* ── 표면 ── */
.panel { background: var(--lm-bg-surface); border: 1px solid var(--lm-hairline); border-radius: var(--lm-radius); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: var(--lm-space-12); padding: var(--lm-space-16) var(--lm-space-20); border-bottom: 1px solid var(--lm-hairline); flex-wrap: wrap; }
.panel-head p { font-size: 14px; color: var(--lm-text-muted); }
.panel-body { padding: var(--lm-space-20); }
.panel-body > * + * { margin-top: var(--lm-space-16); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--lm-space-16); }
.stack { display: grid; gap: var(--lm-space-16); }
.row { display: flex; gap: var(--lm-space-8); align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ── 버튼 ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--lm-space-8); min-height: 40px; padding: 0 var(--lm-space-16); border-radius: var(--lm-radius-inner); border: 1px solid var(--lm-border-strong); background: var(--lm-bg-surface); color: var(--lm-text-strong); font-size: 15px; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; transition: background var(--lm-duration-fast) var(--lm-ease-out), border-color var(--lm-duration-fast) var(--lm-ease-out); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn:hover { background: var(--lm-bg-soft); }
.btn:active { background: var(--lm-bg-subtle); }
.btn-primary { background: var(--lm-primary); border-color: var(--lm-primary); color: var(--lm-on-primary); }
.btn-primary:hover { background: var(--lm-primary-hover); border-color: var(--lm-primary-hover); }
.btn-primary:active { background: var(--lm-primary-pressed); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--lm-text); }
.btn-ghost:hover { background: var(--lm-bg-soft); }
.btn-danger { color: var(--lm-danger); border-color: var(--lm-danger); }
.btn-danger:hover { background: var(--lm-danger-surface); }
.btn-small { min-height: 32px; padding: 0 var(--lm-space-12); font-size: 14px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.btn.is-busy { cursor: progress; opacity: 0.7; }
.link-btn { background: none; border: 0; padding: 0; color: var(--lm-primary); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; font-size: inherit; }

/* ── 입력 ── */
.field { display: grid; gap: 6px; }
.field > label, .field > .label { font-size: 14px; font-weight: 600; color: var(--lm-text-strong); display: flex; gap: var(--lm-space-8); align-items: baseline; }
.field .req { font-size: 12px; font-weight: 600; color: var(--lm-warning-text); background: var(--lm-warning-surface); border-radius: var(--lm-radius-pill); padding: 0 8px; }
.field .hint { font-size: 13px; color: var(--lm-text-muted); }
.input, .select, .textarea { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--lm-border); border-radius: var(--lm-radius-inner); background: var(--lm-bg-surface); color: var(--lm-text-strong); transition: border-color var(--lm-duration-fast) var(--lm-ease-out); }
.textarea { min-height: 96px; resize: vertical; line-height: 1.6; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--lm-border-strong); }
.input:focus, .select:focus, .textarea:focus { outline: var(--lm-focus-ring); outline-offset: 1px; border-color: var(--lm-primary); }
.input:disabled, .select:disabled, .textarea:disabled { background: var(--lm-bg-soft); color: var(--lm-text-muted); }
.input[aria-invalid="true"] { border-color: var(--lm-danger); }
.choices { display: flex; flex-wrap: wrap; gap: var(--lm-space-8); }
.choice { display: inline-flex; align-items: center; gap: var(--lm-space-8); min-height: 40px; padding: 0 var(--lm-space-12); border: 1px solid var(--lm-border); border-radius: var(--lm-radius-inner); background: var(--lm-bg-surface); cursor: pointer; font-size: 15px; }
.choice:has(input:checked) { border-color: var(--lm-primary); background: var(--lm-bg-selected); color: var(--lm-text-strong); }
.choice input { accent-color: var(--lm-primary); width: 16px; height: 16px; margin: 0; }
fieldset.group { border: 0; padding: 0; margin: 0; display: grid; gap: var(--lm-space-16); }
fieldset.group > legend { font-size: 13px; font-weight: 700; color: var(--lm-text-muted); letter-spacing: 0.02em; padding: 0 0 var(--lm-space-8); border-bottom: 1px solid var(--lm-hairline); width: 100%; margin-bottom: var(--lm-space-4); }
.rows-input { display: grid; gap: var(--lm-space-8); }
.rows-input .row-line { display: grid; grid-template-columns: 28px repeat(var(--cols, 2), minmax(0, 1fr)) 36px; gap: var(--lm-space-8); align-items: center; }
.rows-input .row-no { font-size: 13px; color: var(--lm-text-muted); text-align: center; font-variant-numeric: tabular-nums; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: var(--lm-radius-inner); border: 1px solid transparent; background: transparent; color: var(--lm-text-muted); cursor: pointer; }
.icon-btn:hover { background: var(--lm-bg-soft); color: var(--lm-text-strong); }
.icon-btn svg { width: 18px; height: 18px; }

/* ── 상태 표시 ── */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: var(--lm-radius-pill); font-size: 13px; font-weight: 600; white-space: nowrap; background: var(--lm-bg-subtle); color: var(--lm-text); }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: 0.85; }
.badge[data-tone="draft"] { background: var(--lm-bg-subtle); color: var(--lm-text); }
.badge[data-tone="work"] { background: var(--lm-trust-soft); color: var(--lm-trust); }
.badge[data-tone="turn"] { background: var(--lm-warning-surface); color: var(--lm-warning-text); }
.badge[data-tone="done"] { background: var(--lm-success-surface); color: var(--lm-success-text); }
.badge[data-tone="stop"] { background: var(--lm-danger-surface); color: var(--lm-danger); }
.notice { display: flex; gap: var(--lm-space-12); align-items: flex-start; padding: var(--lm-space-12) var(--lm-space-16); border-radius: var(--lm-radius-inner); border: 1px solid var(--lm-hairline); background: var(--lm-bg-soft); font-size: 15px; }
.notice svg { width: 20px; height: 20px; flex: none; margin-top: 2px; }
.notice[data-tone="warn"] { background: var(--lm-warning-surface); border-color: var(--lm-warning-accent); color: var(--lm-warning-text); }
.notice[data-tone="error"] { background: var(--lm-danger-surface); border-color: var(--lm-danger); color: var(--lm-danger); }
.notice[data-tone="ok"] { background: var(--lm-success-surface); border-color: var(--lm-success-text); color: var(--lm-success-text); }
.notice[data-tone="info"] { background: var(--lm-trust-soft); border-color: var(--lm-trust); color: var(--lm-trust); }
.empty { text-align: center; padding: var(--lm-space-48) var(--lm-space-24); color: var(--lm-text-muted); display: grid; gap: var(--lm-space-12); justify-items: center; }
.empty strong { color: var(--lm-text-strong); font-size: 17px; }
.skeleton { background: var(--lm-skeleton); border-radius: var(--lm-radius-inner); height: 16px; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.5; } }

/* ── 표 ── */
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th { text-align: left; font-size: 13px; font-weight: 600; color: var(--lm-text-muted); padding: 10px var(--lm-space-16); border-bottom: 1px solid var(--lm-hairline); white-space: nowrap; background: var(--lm-bg-soft); }
.table td { padding: 12px var(--lm-space-16); border-bottom: 1px solid var(--lm-hairline); vertical-align: middle; }
.table td.num { white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr.clickable { cursor: pointer; transition: background var(--lm-duration-fast) var(--lm-ease-out); }
.table tbody tr.clickable:hover { background: var(--lm-bg-soft); }
.table a.row-link { color: var(--lm-text-strong); font-weight: 600; text-decoration: none; }
.table a.row-link:hover { text-decoration: underline; }
.table .sub { display: block; font-size: 13px; color: var(--lm-text-muted); }
.table-wrap { overflow-x: auto; }

/* ── 탭 ── */
.tabs { display: flex; gap: var(--lm-space-4); border-bottom: 1px solid var(--lm-hairline); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tab { border: 0; background: none; padding: 12px var(--lm-space-16); font-size: 15px; font-weight: 600; color: var(--lm-text-muted); cursor: pointer; white-space: nowrap; min-height: 48px; }
.tab[aria-selected="true"] { color: var(--lm-text-strong); box-shadow: inset 0 -2px 0 var(--lm-primary); }
.tab:hover { color: var(--lm-text-strong); }
.segmented { display: inline-flex; border: 1px solid var(--lm-border); border-radius: var(--lm-radius-inner); overflow: hidden; background: var(--lm-bg-surface); flex-wrap: wrap; }
.segmented button { border: 0; background: none; padding: 8px 14px; font-size: 14px; font-weight: 600; color: var(--lm-text-muted); cursor: pointer; border-right: 1px solid var(--lm-hairline); }
.segmented button:last-child { border-right: 0; }
.segmented button[aria-pressed="true"] { background: var(--lm-bg-selected); color: var(--lm-text-strong); }

/* ── 대화상자·알림 ── */
dialog.modal { border: 1px solid var(--lm-hairline); border-radius: var(--lm-radius); padding: 0; width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 48px); background: var(--lm-bg-surface); color: var(--lm-text); box-shadow: var(--lm-shadow-overlay); }
dialog.modal.wide { width: min(880px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: var(--lm-scrim); }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: var(--lm-space-12); padding: var(--lm-space-16) var(--lm-space-20); border-bottom: 1px solid var(--lm-hairline); position: sticky; top: 0; background: var(--lm-bg-surface); z-index: 1; }
.modal-body { padding: var(--lm-space-20); display: grid; gap: var(--lm-space-16); }
.modal-foot { display: flex; justify-content: flex-end; gap: var(--lm-space-8); padding: var(--lm-space-16) var(--lm-space-20); border-top: 1px solid var(--lm-hairline); background: var(--lm-bg-soft); position: sticky; bottom: 0; flex-wrap: wrap; }
.toast-area { position: fixed; right: var(--lm-space-24); bottom: var(--lm-space-24); display: grid; gap: var(--lm-space-8); z-index: 60; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--lm-trust); color: var(--lm-rail-ink-strong); padding: var(--lm-space-12) var(--lm-space-16); border-radius: var(--lm-radius-inner); box-shadow: var(--lm-shadow-overlay); font-size: 15px; animation: toast-in var(--lm-duration) var(--lm-ease-out); }
.toast[data-tone="error"] { background: var(--lm-danger); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

/* ── 링크 목록(한 번만 보여 주는 서명 링크) ── */
.link-list { display: grid; gap: var(--lm-space-12); }
.link-item { border: 1px solid var(--lm-hairline); border-radius: var(--lm-radius-inner); padding: var(--lm-space-12) var(--lm-space-16); display: grid; gap: var(--lm-space-8); }
.link-item .who { font-weight: 650; color: var(--lm-text-strong); }
.link-item .url { font-family: var(--lm-font-mono); font-size: 13px; background: var(--lm-bg-soft); border-radius: var(--lm-radius-inner); padding: 8px 10px; overflow-wrap: anywhere; color: var(--lm-text); }
.link-item .btn { min-height: 48px; }

/* ── 계약 작성 ── */
.editor-grid { display: grid; grid-template-columns: minmax(360px, 440px) minmax(0, 1fr); gap: var(--lm-space-24); align-items: start; }
.editor-side { display: grid; gap: var(--lm-space-16); }
.editor-side .panel-body { display: grid; gap: var(--lm-space-20); }
.save-bar { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; gap: var(--lm-space-12); padding: var(--lm-space-12) var(--lm-space-16); background: var(--lm-bg-surface); border: 1px solid var(--lm-hairline); border-radius: var(--lm-radius); box-shadow: 0 -6px 18px rgba(23, 33, 29, 0.08); flex-wrap: wrap; }
.save-bar .state { font-size: 14px; color: var(--lm-text-muted); }
.save-bar .state[data-dirty="true"] { color: var(--lm-warning-text); font-weight: 600; }
.preview-col { position: sticky; top: var(--lm-space-16); display: grid; gap: var(--lm-space-12); }
.preview-tools { display: flex; gap: var(--lm-space-8); flex-wrap: wrap; align-items: center; }
.paper-scroll { max-height: calc(100vh - 140px); overflow: auto; border-radius: var(--lm-radius); border: 1px solid var(--lm-hairline); background: var(--lm-bg-subtle); padding: var(--lm-space-24); }
.paper { background: var(--lm-bg-surface); color: var(--lm-paper-ink); font-family: var(--lm-font-doc); font-size: 15px; line-height: 1.75; max-width: 760px; margin: 0 auto; padding: 56px 60px 64px; box-shadow: 0 1px 2px rgba(23, 33, 29, 0.12); border-radius: 2px; }
.paper .letterhead { font-family: var(--lm-font-ui); font-size: 12px; color: var(--lm-text-muted); border-bottom: 1px solid var(--lm-hairline); padding-bottom: 6px; margin-bottom: 28px; }
.paper .b-title { text-align: center; font-size: 22px; font-weight: 700; margin: 4px 0 24px; letter-spacing: 0.02em; }
.paper .b-note { text-align: right; font-size: 13px; font-family: var(--lm-font-ui); color: var(--lm-text-muted); }
.paper .b-heading { font-weight: 700; margin-top: 14px; }
.paper .b-p { white-space: pre-wrap; margin: 2px 0; }
.paper .b-center { text-align: center; margin: 16px 0; }
.paper .b-sign { white-space: pre-wrap; }
.paper table { width: 100%; border-collapse: collapse; margin: 10px 0 14px; font-size: 14px; }
.paper th, .paper td { border: 1px solid var(--lm-border); padding: 6px 8px; text-align: left; vertical-align: top; }
.paper th { background: var(--lm-bg-soft); font-weight: 700; text-align: center; }
.paper .sign2 td { border: 0; padding: 2px 0; width: 50%; }
.paper .blank { background: var(--lm-warning-surface); color: var(--lm-warning-text); border-bottom: 1px dashed var(--lm-warning-accent); white-space: pre; }
.paper .blank-empty { font-family: var(--lm-font-ui); font-size: 12px; padding: 0 4px; white-space: nowrap; }
.paper .filled { background: var(--lm-bg-selected); border-radius: 2px; }
.paper.plain .filled, .paper.plain .blank { background: none; border: 0; color: inherit; }
.paper .edited { box-shadow: inset 3px 0 0 var(--lm-primary); padding-left: 10px; margin-left: -13px; }
.paper .removed-mark { font-family: var(--lm-font-ui); font-size: 12px; color: var(--lm-danger); }
.missing-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--lm-warning-text); background: var(--lm-warning-surface); border-radius: var(--lm-radius-pill); padding: 2px 10px; }
.clause-list { display: grid; gap: var(--lm-space-8); }
.clause { border: 1px solid var(--lm-hairline); border-radius: var(--lm-radius-inner); padding: var(--lm-space-12); display: grid; gap: var(--lm-space-8); background: var(--lm-bg-surface); }
.clause[data-state="edited"] { border-color: var(--lm-primary); }
.clause[data-state="removed"] { background: var(--lm-bg-soft); }
.clause[data-state="removed"] .clause-text { text-decoration: line-through; color: var(--lm-text-muted); }
.clause-label { font-size: 13px; font-weight: 700; color: var(--lm-text-muted); display: flex; gap: var(--lm-space-8); align-items: center; justify-content: space-between; }
.clause-text { font-size: 14px; white-space: pre-wrap; max-height: 4.8em; overflow: hidden; }
.clause-actions { display: flex; gap: var(--lm-space-4); flex-wrap: wrap; }

.party-row { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) minmax(0, 1.2fr) minmax(0, 1.5fr) 40px; gap: var(--lm-space-12); align-items: end; padding-bottom: var(--lm-space-12); border-bottom: 1px solid var(--lm-hairline); }
.party-row .icon-btn { margin-bottom: 4px; }
.party-slot { display: flex; align-items: center; min-height: 40px; font-size: 14px; color: var(--lm-text-strong); }
.party-slot.muted { color: var(--lm-text-muted); font-size: 13px; line-height: 1.4; }
/* 손서명 칸(회사 측 서명 창과 서명하는 사람 화면이 함께 쓴다) */
.pad-wrap { display: grid; gap: var(--lm-space-8); }
.pad { width: 100%; height: 200px; border: 1px solid var(--lm-border-strong); border-radius: var(--lm-radius-inner); background: var(--lm-bg-surface); touch-action: none; display: block; cursor: crosshair; }
.pad-wrap .pad-line { display: flex; justify-content: space-between; align-items: center; font-size: 15px; color: var(--lm-text-muted); }
.company-sign .pdf-box { max-height: 48vh; overflow: auto; border: 1px solid var(--lm-hairline); border-radius: var(--lm-radius-inner); background: var(--lm-bg-soft); }
.company-sign .pad { height: 160px; }
.btn-entry { min-height: 56px; font-size: 18px; }
.open-band { margin: calc(-1 * var(--lm-space-32)) calc(-1 * var(--lm-space-32)) var(--lm-space-24); padding: var(--lm-space-8) var(--lm-space-32); background: var(--lm-warning-surface); color: var(--lm-warning-text); border-bottom: 1px solid var(--lm-warning-accent); font-size: 14px; font-weight: 600; }
@media (max-width: 900px) { .open-band { margin: calc(-1 * var(--lm-space-20)) calc(-1 * var(--lm-space-16)) var(--lm-space-16); padding: var(--lm-space-8) var(--lm-space-16); } }
.signer-row { display: grid; grid-template-columns: 20px minmax(0, 1fr) 120px 40px; gap: var(--lm-space-8); align-items: center; }

/* ── 진행 단계 ── */
.steps { display: grid; grid-template-columns: repeat(var(--n, 5), minmax(0, 1fr)); gap: var(--lm-space-8); list-style: none; margin: 0; padding: 0; }
.steps li { border-top: 3px solid var(--lm-hairline); padding-top: var(--lm-space-8); font-size: 14px; color: var(--lm-text-muted); }
.steps li[data-state="done"] { border-color: var(--lm-success-text); color: var(--lm-text); }
.steps li[data-state="now"] { border-color: var(--lm-primary); color: var(--lm-text-strong); font-weight: 650; }
.people { display: grid; gap: var(--lm-space-8); }
.person { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--lm-space-12); align-items: center; padding: var(--lm-space-12) var(--lm-space-16); border: 1px solid var(--lm-hairline); border-radius: var(--lm-radius-inner); }
.person .who { font-weight: 650; color: var(--lm-text-strong); }
.person .meta { font-size: 13px; color: var(--lm-text-muted); }
.proposal { border: 1px solid var(--lm-hairline); border-radius: var(--lm-radius-inner); padding: var(--lm-space-16); display: grid; gap: var(--lm-space-12); }
.diff { font-size: 14px; white-space: pre-wrap; background: var(--lm-bg-soft); padding: var(--lm-space-12); border-radius: var(--lm-radius-inner); line-height: 1.7; }
.diff del { background: var(--lm-danger-surface); color: var(--lm-danger); }
.diff ins { background: var(--lm-success-surface); color: var(--lm-success-text); text-decoration: none; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px var(--lm-space-16); font-size: 15px; margin: 0; }
.kv dt { color: var(--lm-text-muted); }
.kv dd { margin: 0; color: var(--lm-text-strong); overflow-wrap: anywhere; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--lm-space-12); }
.card-choice { text-align: left; border: 1px solid var(--lm-hairline); border-radius: var(--lm-radius); padding: var(--lm-space-16); background: var(--lm-bg-surface); cursor: pointer; display: grid; gap: 6px; transition: border-color var(--lm-duration-fast) var(--lm-ease-out); }
.card-choice:hover { border-color: var(--lm-border-strong); }
.card-choice[aria-pressed="true"] { border-color: var(--lm-primary); background: var(--lm-bg-selected); }
.card-choice strong { color: var(--lm-text-strong); font-size: 16px; }
.card-choice span { font-size: 14px; color: var(--lm-text-muted); }
.stat-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--lm-space-12); }
.stat { padding: var(--lm-space-16) var(--lm-space-20); display: grid; gap: 2px; text-decoration: none; color: inherit; }
.stat b { font-size: 28px; color: var(--lm-text-strong); font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat span { font-size: 14px; color: var(--lm-text-muted); }
a.stat:hover { border-color: var(--lm-border-strong); }

/* ── 로그인·초대 ── */
.gate { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.gate-brand { background: var(--lm-rail-bg); color: var(--lm-rail-ink); padding: var(--lm-space-48); display: flex; flex-direction: column; justify-content: space-between; }
.gate-brand .mark { display: flex; align-items: center; gap: var(--lm-space-12); color: var(--lm-rail-ink-strong); font-size: 20px; font-weight: 700; }
.gate-brand .mark img { width: 28px; height: 28px; }
.gate-brand p { max-width: 420px; color: var(--lm-rail-ink); font-size: 17px; line-height: 1.7; }
.gate-brand small { color: var(--lm-rail-muted); font-size: 13px; }
.gate-main { display: grid; place-items: center; padding: var(--lm-space-32) var(--lm-space-16); }
.gate-card { width: min(440px, 100%); display: grid; gap: var(--lm-space-20); }
.gate-card .btn { min-height: 48px; width: 100%; }
.dev-box { border: 1px dashed var(--lm-border); border-radius: var(--lm-radius); padding: var(--lm-space-16); display: grid; gap: var(--lm-space-12); background: var(--lm-bg-soft); }

/* ── 좁은 화면 ── */
@media (max-width: 1100px) {
  .editor-grid { grid-template-columns: minmax(0, 1fr); }
  .preview-col { position: static; }
  .paper-scroll { max-height: none; padding: var(--lm-space-12); }
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); z-index: 40; transform: translateX(-100%); transition: transform var(--lm-duration) var(--lm-ease-out); }
  .rail[data-open="true"] { transform: none; box-shadow: var(--lm-shadow-drawer); }
  .rail-scrim { position: fixed; inset: 0; background: var(--lm-scrim); z-index: 39; }
  .topbar { display: flex; align-items: center; gap: var(--lm-space-12); position: sticky; top: 0; z-index: 30; background: var(--lm-rail-bg); color: var(--lm-rail-ink-strong); padding: 0 var(--lm-space-16); height: 56px; }
  .topbar button { background: none; border: 0; color: inherit; width: 44px; height: 44px; display: inline-grid; place-items: center; margin-left: -10px; cursor: pointer; }
  .topbar button svg { width: 24px; height: 24px; }
  .topbar strong { font-size: 16px; }
  .main { padding: var(--lm-space-20) var(--lm-space-16) var(--lm-space-48); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .party-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .segmented { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
  .segmented button { white-space: nowrap; }
  .party-row .icon-btn { justify-self: end; }
  .gate { grid-template-columns: minmax(0, 1fr); }
  .gate-brand { padding: var(--lm-space-24) var(--lm-space-16); gap: var(--lm-space-16); }
  .paper { padding: 28px 18px 36px; font-size: 14px; }
  .steps { grid-template-columns: repeat(var(--n, 5), minmax(48px, 1fr)); font-size: 13px; }
  .table.responsive thead { display: none; }
  .table.responsive tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px var(--lm-space-12); padding: var(--lm-space-12) var(--lm-space-16); border-bottom: 1px solid var(--lm-hairline); }
  .table.responsive td { border: 0; padding: 0; }
  .table.responsive td.wide { grid-column: 1 / -1; }
  .table.responsive td.hide-sm { display: none; }
  .toast-area { right: var(--lm-space-16); left: var(--lm-space-16); bottom: var(--lm-space-16); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

.panel-head .input[type="search"] { width: min(360px, 100%); }

/* ── 원본 문서 쪽 그림(pdf.js) ── */
.pdf-pages { display: grid; gap: var(--lm-space-16); }
.pdf-figure { margin: 0; display: grid; gap: var(--lm-space-4); justify-items: center; }
.pdf-page { width: 100%; height: auto; background: var(--lm-bg-surface); box-shadow: 0 1px 3px rgba(23, 33, 29, 0.18); border-radius: 2px; }
.preview-switch { display: flex; gap: var(--lm-space-4); }
.quick-note { font-size: 13px; color: var(--lm-text-muted); }
.map-paragraphs { display: grid; gap: 2px; max-height: 70vh; overflow: auto; border: 1px solid var(--lm-hairline); border-radius: var(--lm-radius-inner); padding: var(--lm-space-8); background: var(--lm-bg-surface); }
.map-paragraph { margin: 0; padding: 4px 8px; border-radius: 4px; white-space: pre-wrap; font-size: 14px; line-height: 1.7; cursor: text; }
.map-paragraph:hover { background: var(--lm-bg-soft); }
.map-paragraph mark { background: var(--lm-warning-surface); color: var(--lm-warning-text); border-bottom: 1px dashed var(--lm-warning-accent); }
.map-paragraph mark.insert { padding: 0 2px; }
.blank-list { display: grid; gap: var(--lm-space-8); }
.blank-item { display: flex; justify-content: space-between; gap: var(--lm-space-12); align-items: center; border: 1px solid var(--lm-hairline); border-radius: var(--lm-radius-inner); padding: var(--lm-space-8) var(--lm-space-12); font-size: 14px; }
