/* ════════════════════════════════════════════════════════════
   공통 베이스 — 이 파일의 소비자는 /app 뿐(랜딩·로그인은 자립형 인라인,
   doc-20/22 이후). 구판 네이비 로그인 규칙은 L8-A(grep 0 확인)로 정리됨.
   ════════════════════════════════════════════════════════════ */
* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

[hidden] { display: none !important; }

/* ════════════════════════════════════════════════════════════
   MemoDeck 작업 화면 (doc-21) — body.app 스코프
   토큰: 잉크 #12351f · 주색 #127a3c(진한 #0e5f2f) · 액센트 #16a34a
        배경 #f3f9f4 · 보더 #e6ece7/#d7ded9 · 보조 #5a6b60/#677069/#686f6a
   ════════════════════════════════════════════════════════════ */
body.app {
  margin: 0;
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Malgun Gothic', 'Noto Sans KR', sans-serif;
  color: #48544c;
  background: #f3f9f4;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
body.app a { color: inherit; text-decoration: none; }
body.app button { font-family: inherit; }
body.app ::selection { background: #c9ecd3; color: #0e3f26; }
body.app textarea::placeholder { color: #707872; }
body.app :focus-visible { outline: 3px solid #6fbf8d; outline-offset: 2px; border-radius: 6px; }

@keyframes mdPulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
@keyframes mdSkel { 0%, 100% { opacity: .85; } 50% { opacity: .4; } }

/* 공용 아이콘/버튼/칩 */
.ic-stroke { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ic-stroke.thick { stroke-width: 2.4; }
.ic-stroke.thin { stroke-width: 1.5; }
.ic-stroke.green { stroke: #127a3c; }
.ic-stroke.accent { stroke: #16a34a; }
.ic-stroke.white { stroke: #ffffff; }
.ic-stroke.faint { stroke: #a9bcae; }

.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  background: #127a3c; color: #ffffff; border: none; border-radius: 10px;
  padding: 10px 14px; font-size: 13.5px; font-weight: 700; cursor: pointer;
}
.btn-primary:hover { background: #0e5f2f; }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary.sm { border-radius: 9px; padding: 9px 15px; font-size: 12.5px; white-space: nowrap; }

.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: #ffffff; border: 1px solid #d7ded9; color: #48544c;
  border-radius: 8px; padding: 7px 14px; font-size: 12.5px; font-weight: 700; cursor: pointer;
}
.btn-ghost:hover { border-color: #12351f; color: #12351f; }
.btn-ghost:disabled { opacity: .55; cursor: not-allowed; }
.btn-ghost.sm { border-radius: 9px; padding: 9px 15px; white-space: nowrap; }
.btn-ghost.green { color: #127a3c; }
.btn-ghost.green:hover { border-color: #127a3c; background: #f4faf6; color: #127a3c; }

.icon-btn {
  width: 32px; height: 32px; border-radius: 9px; border: 1px solid #d7ded9;
  background: #ffffff; color: #48544c; display: inline-flex; align-items: center;
  justify-content: center; cursor: pointer; flex: none; padding: 0;
}
.icon-btn:hover { border-color: #127a3c; color: #127a3c; }
.icon-btn:disabled { opacity: .5; cursor: not-allowed; }

.chip { font-size: 11px; font-weight: 700; color: #0e5a2e; background: #e9f6ed; border-radius: 6px; padding: 3px 7px; white-space: nowrap; }
.avatar {
  width: 26px; height: 26px; border-radius: 50%; background: #e9f6ed; border: 1px solid #cde6d5;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #127a3c; flex: none;
}
.pulse-dot { width: 7px; height: 7px; border-radius: 50%; background: #16a34a; display: inline-block; flex: none; animation: mdPulse 1.4s ease-in-out infinite; }
.dot-ok { width: 7px; height: 7px; border-radius: 50%; background: #16a34a; display: inline-block; flex: none; }
.skel-anim { animation: mdSkel 1.6s ease-in-out infinite; }
.inline-err {
  margin: 6px 0 0; background: #fbf6ea; border: 1px solid #ecdfc0; color: #7c611f;
  border-radius: 9px; padding: 8px 11px; font-size: 12.5px; line-height: 1.5;
}

/* 헤더 */
.hdr {
  background: rgba(255, 255, 255, 0.86); backdrop-filter: blur(10px);
  border-bottom: 1px solid #e6ece7; position: sticky; top: 0; z-index: 40;
}
.hdr-in {
  width: min(1160px, 100% - 40px); margin-inline: auto; height: 66px;
  display: flex; align-items: center; gap: 14px;
}
.menu-btn { display: none; width: 30px; height: 30px; border-radius: 8px; }
.hbrand { display: inline-flex; align-items: center; gap: 11px; }
.hbrand-word { font-size: 18px; font-weight: 800; letter-spacing: -0.02em; }
.hbrand-memo { color: #12351f; }
.hbrand-deck { color: #127a3c; }
.hbrand-badge { font-size: 11px; font-weight: 700; color: #127a3c; background: #e9f6ed; border-radius: 6px; padding: 3px 7px; }
.hdr-right { margin-left: auto; display: flex; align-items: center; gap: 14px; min-width: 0; }
.hdr-admin { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 600; color: #48544c; padding: 8px 2px; white-space: nowrap; }
.hdr-admin:hover { color: #127a3c; }
.hdr-user { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: #5a6b60; min-width: 0; }
.hdr-email { max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hdr-logout { color: #5f6c64; font-size: 13.5px; font-weight: 600; padding: 8px 2px; flex: none; }
.hdr-logout:hover { color: #12351f; }

/* 레이아웃 */
.wrap-app {
  width: min(1160px, 100% - 40px); margin-inline: auto;
  padding: clamp(22px, 3.5vw, 34px) 0 60px;
  display: flex; flex-direction: column; gap: 18px; flex: 1; min-width: 0;
}
.page-head { display: flex; flex-direction: column; gap: 5px; }
.page-head h1 { margin: 0; font-size: clamp(20px, 2.4vw, 24px); font-weight: 800; color: #12351f; letter-spacing: -0.02em; }
.page-head p { margin: 0; font-size: 14px; color: #5a6b60; }
.panes { display: flex; flex-wrap: wrap; gap: 18px; align-items: stretch; }

/* 사이드바 */
.side {
  flex: 0 1 232px; min-width: min(100%, 200px);
  background: #ffffff; border: 1px solid #e6ece7; border-radius: 16px;
  padding: 14px; display: flex; flex-direction: column; gap: 12px;
}
.side.collapsed { display: none; }
.side-new { width: 100%; }
.side-label {
  display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 700;
  color: #5f6c64; letter-spacing: 0.02em; padding: 0 2px;
}
.side-label .ic-stroke { stroke: #5f6c64; }
.side-collapse { margin-left: auto; width: 26px; height: 26px; border-radius: 7px; border-color: transparent; background: none; color: #5f6c64; }
.side-collapse:hover { border-color: #d7ded9; color: #12351f; }
.convo-list { display: flex; flex-direction: column; gap: 4px; }
.convo-item { display: flex; align-items: flex-start; gap: 2px; }
.convo-pick {
  display: flex; flex-direction: column; gap: 2px; padding: 9px 11px; border-radius: 10px;
  flex: 1; min-width: 0; text-align: left; cursor: pointer;
  background: transparent; border: 1px solid transparent;
}
.convo-pick:hover { border-color: #cde6d5; }
.convo-pick:disabled { cursor: default; opacity: .6; }
.convo-item.active .convo-pick { background: #e9f6ed; border-color: #cde6d5; cursor: default; opacity: 1; }
.convo-title { font-size: 13px; font-weight: 700; color: #12351f; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.convo-meta { font-size: 11.5px; color: #677069; }
.convo-del { width: 24px; height: 24px; border-radius: 7px; border-color: transparent; background: none; color: #686f6a; margin-top: 7px; }
.convo-del:hover { border-color: #d7ded9; color: #12351f; }
.side-empty { margin: 0; font-size: 12.5px; line-height: 1.55; color: #686f6a; padding: 2px; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.side-hint { margin: 0; font-size: 11.5px; line-height: 1.5; color: #686f6a; padding: 2px; }
.side-clear {
  align-self: flex-start; background: none; border: none; cursor: pointer;
  font-size: 11.5px; font-weight: 600; color: #677069; padding: 2px; text-decoration: underline;
}
.side-clear:hover { color: #12351f; }
.side-clear:disabled { opacity: .5; cursor: not-allowed; }
.side-account { display: none; align-items: center; gap: 8px; border-top: 1px solid #f0f4f1; padding-top: 10px; flex-wrap: wrap; }
.side-email { font-size: 12.5px; color: #5a6b60; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.side-admin, .side-logout { font-size: 12.5px; font-weight: 600; color: #5f6c64; }
.side-admin:hover, .side-logout:hover { color: #12351f; }
.side-backdrop { display: none; }

/* 사이드바 접힘 레일 (데스크톱) */
.side-rail {
  flex: 0 0 auto; background: #ffffff; border: 1px solid #e6ece7; border-radius: 16px;
  padding: 12px 9px; display: flex; flex-direction: column; align-items: center; gap: 10px;
  align-self: flex-start;
}
.rail-new { background: #127a3c; border-color: #127a3c; color: #ffffff; }
.rail-new:hover { background: #0e5f2f; border-color: #0e5f2f; color: #ffffff; }
.rail-count {
  min-width: 22px; height: 22px; border-radius: 11px; background: #e9f6ed; color: #0e5a2e;
  font-size: 11px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; padding: 0 6px;
}

/* 대화 패널 */
.chat {
  flex: 1 1 340px; min-width: min(100%, 310px);
  background: #ffffff; border: 1px solid #e6ece7; border-radius: 16px;
  display: flex; flex-direction: column;
}
.chat-head {
  padding: 10px 18px; border-bottom: 1px solid #f0f4f1; display: flex; align-items: center;
  gap: 7px; min-height: 47px; font-size: 12.5px; font-weight: 700; color: #5f6c64; letter-spacing: 0.02em; white-space: nowrap;
}
.chat-scroll {
  flex: 1; min-height: 300px; max-height: 520px; overflow-y: auto;
  padding: 16px 18px; display: flex; flex-direction: column; gap: 11px;
}
.msgs { display: flex; flex-direction: column; gap: 11px; }
.msg.user {
  align-self: flex-end; max-width: 84%; background: #127a3c; color: #ffffff;
  font-size: 13.5px; line-height: 1.5; padding: 10px 13px; border-radius: 13px 13px 3px 13px;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.msg.ai {
  align-self: flex-start; max-width: 88%; display: flex; flex-direction: column; gap: 7px;
  background: #f4f8f5; color: #3d4a41; font-size: 13.5px; line-height: 1.5;
  padding: 10px 13px; border: 1px solid #e6ece7; border-radius: 13px 13px 13px 3px;
}
.msg.ai:focus-visible { outline: 3px solid #6fbf8d; outline-offset: 2px; }
.msg-badge {
  display: inline-flex; align-items: center; gap: 6px; align-self: flex-start;
  background: #e9f6ed; color: #0e5a2e; font-size: 11px; font-weight: 700; border-radius: 6px; padding: 3px 8px;
}
.msg-badge svg { fill: none; stroke: #0e5a2e; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.msg-meta { font-size: 11.5px; color: #677069; }

/* 진행 카드(4단계 스텝퍼) */
.gen-card {
  align-self: stretch; display: flex; flex-direction: column; gap: 11px;
  background: #f4f8f5; border: 1px solid #e6ece7; border-radius: 13px 13px 13px 3px; padding: 13px 14px;
}
.gen-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.gen-title { font-size: 13.5px; font-weight: 800; color: #12351f; }
.gen-elapsed { margin-left: auto; font-size: 11.5px; font-weight: 700; color: #0e5a2e; background: #e9f6ed; border-radius: 6px; padding: 4px 8px; }
.gen-steps { display: flex; flex-direction: column; }
.step { display: flex; align-items: flex-start; gap: 10px; padding: 6px 0; }
.step-ic {
  width: 24px; height: 24px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: #ffffff; border: 1.6px solid #d7ded9;
}
.step-check { display: none; fill: none; stroke: #ffffff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.step-now-dot { display: none; width: 8px; height: 8px; border-radius: 50%; background: #16a34a; animation: mdPulse 1.4s ease-in-out infinite; }
.step.done .step-ic { background: #127a3c; border: none; }
.step.done .step-check { display: block; }
.step.now .step-ic { border: 2px solid #16a34a; }
.step.now .step-now-dot { display: block; }
.step-tx { display: flex; flex-direction: column; gap: 1px; padding-top: 2px; }
.step-label { font-size: 13.5px; font-weight: 600; color: #686f6a; }
.step.done .step-label { color: #48544c; }
.step.now .step-label { font-weight: 800; color: #12351f; }
.step-sub { display: none; font-size: 12px; color: #677069; }
.step.now .step-sub { display: block; }
.gen-foot { display: flex; align-items: center; gap: 8px; border-top: 1px solid #e6ece7; padding-top: 11px; }
.gen-foot span { font-size: 12px; color: #677069; }
.gen-foot .btn-ghost { margin-left: auto; }

/* 오류 말풍선 */
.err-bubble {
  align-self: flex-start; max-width: 88%; display: flex; flex-direction: column; gap: 8px;
  background: #fdf4ee; border: 1px solid #f0d9c9; border-radius: 13px 13px 13px 3px; padding: 12px 14px;
}
.err-title { font-size: 13.5px; font-weight: 700; color: #8a4a2b; line-height: 1.5; }
.err-sub { font-size: 12px; color: #8f6851; line-height: 1.5; }
.err-retry {
  align-self: flex-start; background: #ffffff; border: 1px solid #e4c9b6; color: #8a4a2b;
  border-radius: 8px; padding: 7px 13px; font-size: 12.5px; font-weight: 700; cursor: pointer;
}
.err-retry:hover { border-color: #8a4a2b; }

/* 입력(composer) */
.composer { border-top: 1px solid #f0f4f1; padding: 13px 18px 16px; display: flex; flex-direction: column; gap: 9px; }
.rev-hint { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: #677069; line-height: 1.4; }
.warn {
  margin: 0; background: #fbf6ea; border: 1px solid #ecdfc0; color: #7c611f;
  border-radius: 10px; padding: 9px 12px; font-size: 12.5px; line-height: 1.5;
}
.composer textarea {
  width: 100%; min-height: 76px; resize: vertical; border: 1px solid #d7ded9; border-radius: 11px;
  padding: 11px 13px; font-size: 14px; line-height: 1.55; color: #12351f; background: #ffffff;
  outline: none; font-family: inherit;
}
.composer textarea:focus { border-color: #127a3c; box-shadow: 0 0 0 3px rgba(18, 122, 60, 0.12); }
.composer textarea:disabled { background: #f7faf8; color: #677069; }
.composer-row { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.lang-label { font-size: 12.5px; color: #677069; }
.composer-row select {
  font: inherit; font-size: 13px; color: #12351f; padding: 7px 9px;
  border: 1px solid #d7ded9; border-radius: 8px; background: #ffffff;
}
.composer-row select:focus { border-color: #127a3c; }
.char-count { margin-left: auto; font-size: 12px; color: #686f6a; }
.send { padding: 10px 20px; }

/* 결과 패널 */
.result { flex: 1.5 1 380px; min-width: min(100%, 320px); display: flex; flex-direction: column; gap: 16px; }
.card { background: #ffffff; border: 1px solid #e6ece7; border-radius: 16px; }
.res-fill { padding: 20px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.res-head { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: #677069; }
.res-placeholder {
  background: #f7faf8; border: 1px dashed #d7e0d9; border-radius: 12px; flex: 1; min-height: 380px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 32px; text-align: center;
}
.ph-title { margin: 0; font-size: 15.5px; font-weight: 700; color: #48544c; }
.ph-title.small { font-size: 14px; color: #677069; }
.ph-sub { margin: 0; font-size: 13.5px; line-height: 1.55; color: #677069; max-width: 34ch; }

/* W2: 라이브 진행 내레이션 뷰 (진행 화면 ≠ 편집 화면 — 리스크6) */
.gen-head-live { color: #127a3c; }
.gen-view-hint { margin-left: auto; font-size: 12px; font-weight: 600; color: #9aa39c; }
.gen-narration { margin: 0; font-size: 15px; font-weight: 700; color: #48544c; line-height: 1.5; }
.gen-counter { font-size: 13px; color: #677069; }
.gen-counter strong { color: #127a3c; font-weight: 800; }
.gen-final-hint { margin: 4px 0 0; font-size: 12.5px; color: #9aa39c; text-align: center; }
/* W2b: 완성 슬라이드 썸네일 캔버스 (진행 중) */
.gen-thumb-strip { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0; }
.gen-thumb { width: 56px; height: 31.5px; object-fit: cover; border-radius: 4px; border: 1px solid #e6ece7; flex: none; background: #f7faf8; }
.gen-big-card { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.gen-big-img { width: 100%; aspect-ratio: 16/9; object-fit: contain; background: #f7faf8; border: 1px solid #e6ece7; border-radius: 10px; }
.gen-big-cap { font-size: 12.5px; color: #677069; text-align: center; }
.pv-thumb { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }

.files-card { padding: 16px 18px; display: flex; flex-direction: column; gap: 2px; }
.files-head { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: #127a3c; padding-bottom: 8px; flex-wrap: wrap; }
.files-head-sub { font-weight: 600; color: #677069; }
.file-row { display: flex; align-items: center; gap: 11px; padding: 10px 0; border-top: 1px solid #f0f4f1; flex-wrap: wrap; }
.file-badge {
  width: 40px; height: 40px; border-radius: 10px; background: #e9f6ed;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 9.5px; font-weight: 800; color: #0e5a2e; flex: none; letter-spacing: 0.03em;
}
.file-badge.pdf { background: #eef2ef; color: #48544c; }
.file-tx { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.file-name { font-size: 13.5px; font-weight: 700; color: #12351f; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-sub { font-size: 11.5px; color: #677069; }

.done-wrap { display: flex; flex-direction: column; gap: 16px; }

/* 미리보기 카드 */
.pv-card { overflow: hidden; display: flex; flex-direction: column; }
.pv-head {
  display: flex; align-items: center; gap: 9px; padding: 11px 16px;
  border-bottom: 1px solid #eef3ef; background: #fafcfb; flex-wrap: wrap;
}
.pv-title { font-size: 12.5px; font-weight: 700; color: #48544c; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 38ch; }
.pv-actions { margin-left: auto; display: inline-flex; align-items: center; gap: 7px; }
.ver-toggle {
  display: inline-flex; align-items: center; gap: 5px; cursor: pointer; white-space: nowrap;
  background: #ffffff; border: 1px solid #d7ded9; color: #48544c;
  border-radius: 8px; padding: 6px 10px; font-size: 12px; font-weight: 700;
}
.ver-toggle[aria-expanded="true"] { background: #e9f6ed; border-color: #cde6d5; color: #0e5a2e; }
.chev { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s ease; }
.chev.up { transform: rotate(180deg); }
.pv-min.collapsed .chev.up { transform: rotate(0deg); }
.vr { width: 1px; height: 18px; background: #e6ece7; }
.pv-min {
  display: inline-flex; align-items: center; gap: 5px; background: none; border: none;
  color: #5f6c64; font-size: 12px; font-weight: 700; cursor: pointer; padding: 6px 4px; white-space: nowrap;
}
.pv-min:hover { color: #12351f; }

/* 버전 목록(선택형) */
.ver-panel { border-bottom: 1px solid #eef3ef; background: #fafcfb; padding: 4px 16px 12px; display: flex; flex-direction: column; }
.ver-note { font-size: 11.5px; font-weight: 700; color: #677069; padding: 8px 2px 5px; }
.ver-list { display: flex; flex-direction: column; }
.ver-row { border-top: 1px solid #f0f4f1; padding: 10px 2px; display: flex; flex-direction: column; gap: 9px; }
.ver-select {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap; width: 100%;
  background: none; border: none; padding: 0; cursor: pointer; text-align: left;
}
.ver-dot { width: 16px; height: 16px; border-radius: 50%; flex: none; box-sizing: border-box; border: 1.6px solid #c8d2cb; background: #ffffff; }
.ver-row.selected .ver-dot { border: 5px solid #127a3c; }
.ver-name { font-size: 14px; font-weight: 700; color: #12351f; }
.ver-time { margin-left: auto; font-size: 12px; color: #686f6a; }
.ver-actions { display: flex; flex-direction: column; gap: 8px; padding-left: 25px; padding-bottom: 3px; }
.ver-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.ver-btns .btn-primary, .ver-btns .btn-ghost { flex: 1; min-width: 118px; font-size: 13px; padding: 9px 14px; }

/* 미리보기 본문 */
.pv-well { background: #eef2ef; padding: 18px; display: flex; flex-direction: column; align-items: center; gap: 10px; border-radius: 12px; }
.pv-well.framed { border-radius: 0; }
.pv-page-skel {
  width: 100%; max-width: 620px; aspect-ratio: 16/9; background: #ffffff;
  border: 1px solid #dce6df; border-radius: 8px; padding: 22px;
  display: flex; flex-direction: column; gap: 10px;
}
.sk { display: block; border-radius: 4px; background: #eef3ef; height: 8px; }
.sk-title { height: 14px; width: 46%; background: #e4ebe6; }
.sk-line.w70 { width: 70%; margin-top: 6px; }
.sk-line.w58 { width: 58%; }
.sk-gap { flex: 1; }
.sk-block { height: 34%; border-radius: 6px; }
.pv-fail {
  width: 100%; max-width: 620px; aspect-ratio: 16/9; background: #f7faf8;
  border: 1px dashed #d7e0d9; border-radius: 8px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px; padding: 32px; text-align: center;
}
.pv-fail p { margin: 0; font-size: 13.5px; font-weight: 700; color: #48544c; line-height: 1.55; max-width: 30ch; }
.pv-frame { width: 100%; }
.pv-iframe { width: 100%; height: 480px; border: 1px solid #dce6df; border-radius: 8px; display: block; background: #ffffff; }
.pv-note { font-size: 12px; color: #677069; }

/* ── C1 라이브 캔버스: slide_px 고정비 박스 + scale (모바일 .pv-iframe 380px 강제와 분리된 신규 클래스) ── */
.cv-wrap { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.cv-stage { position: relative; width: 100%; background: #ffffff; border: 1px solid #dce6df; border-radius: 8px; overflow: hidden; }
.cv-frame-box { position: absolute; top: 0; left: 0; transform-origin: 0 0; }
.cv-iframe { border: 0; display: block; background: #ffffff; }
.cv-badges { position: absolute; top: 8px; left: 8px; z-index: 5; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cv-badge { font-size: 11px; background: #fff7e6; border: 1px solid #e8d9a8; color: #7a5b12; padding: 2px 8px; border-radius: 999px; }
.cv-badge-btn { font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid #cdd9d0; background: #ffffff; color: #2c4635; cursor: pointer; }
.cv-page-fail { position: absolute; inset: 0; z-index: 6; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; background: #f6f8f6; }
.cv-page-fail p { margin: 0; font-size: 13px; color: #5f6c64; }
.cv-nav { display: flex; align-items: center; justify-content: center; gap: 10px; }
.cv-page-label { font-size: 13px; color: #2c4635; min-width: 56px; text-align: center; font-variant-numeric: tabular-nums; }
.cv-jump-label { font-size: 12px; color: #677069; display: inline-flex; align-items: center; gap: 6px; }
.cv-jump { width: 58px; padding: 4px 6px; border: 1px solid #dce6df; border-radius: 6px; font-size: 13px; }

/* ══════════════════════════════════════════════════════════════
   I1 — 작성 상태(설정 패널 + 취향 패널 + 컴포저) · 정직한 진행 · 완성 마커
   ══════════════════════════════════════════════════════════════ */
.compose-view { flex: 1 1 340px; min-width: min(100%, 320px); display: flex; flex-direction: column; gap: 16px; }
.compose-top { display: flex; gap: 16px; align-items: stretch; flex-wrap: wrap; }
.compose-composer-mount { display: flex; }
.compose-composer-mount .composer { flex: 1; border-top: none; padding: 0; }

/* 설정 패널 */
.settings-panel { flex: 1.32 1 320px; min-width: min(100%, 280px); padding: 16px 18px; display: flex; flex-direction: column; gap: 16px; }
.taste-panel { flex: 1 1 250px; min-width: min(100%, 240px); padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.sp-head, .tp-head { display: flex; flex-direction: column; gap: 3px; }
.sp-title, .tp-title { font-size: 14.5px; font-weight: 800; color: #12351f; letter-spacing: -0.01em; }
.sp-sub, .tp-sub { font-size: 12px; color: #677069; }
.sp-group { display: flex; flex-direction: column; gap: 9px; }
.sp-label { font-size: 12.5px; font-weight: 700; color: #48544c; display: flex; align-items: baseline; gap: 7px; }
.sp-hint { font-size: 11.5px; font-weight: 600; color: #8a938c; }
.sp-skel { display: flex; flex-direction: column; gap: 7px; }
.sp-inline-err, .tp-inline-err {
  margin: 0; background: #fbf6ea; border: 1px solid #ecdfc0; color: #7c611f;
  border-radius: 9px; padding: 8px 11px; font-size: 12.5px; line-height: 1.5;
}
.sp-retry, .tp-retry {
  background: #ffffff; border: 1px solid #e4d3a8; color: #7c611f; border-radius: 7px;
  padding: 3px 9px; font-size: 12px; font-weight: 700; cursor: pointer; margin-left: 4px;
}
.sp-retry:hover, .tp-retry:hover { border-color: #7c611f; }

/* 서식 카드 목록(텍스트 카드 — 썸네일 없음) */
.tpl-cards { display: flex; flex-direction: column; gap: 8px; }
.tpl-card {
  display: flex; flex-direction: column; gap: 4px; text-align: left; cursor: pointer;
  background: #ffffff; border: 1.5px solid #e0e7e2; border-radius: 12px; padding: 11px 13px;
}
.tpl-card:hover { border-color: #bcdcc7; }
.tpl-card.selected { border-color: #127a3c; background: #f4faf6; box-shadow: 0 0 0 3px rgba(18, 122, 60, 0.1); }
.tpl-card-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tpl-card-name { font-size: 13.5px; font-weight: 700; color: #12351f; }
.tpl-badge { flex: none; }
.tpl-card-meta { font-size: 11.5px; font-weight: 600; color: #5f6c64; }
.tpl-card-desc { font-size: 12px; line-height: 1.5; color: #677069; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* 장수 스텝퍼 */
.stepper { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.step-btn {
  width: 32px; height: 32px; border-radius: 9px; border: 1px solid #d7ded9; background: #ffffff;
  color: #48544c; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: none;
}
.step-btn:hover { border-color: #127a3c; color: #127a3c; }
.stepper-val { font-size: 14px; font-weight: 800; color: #12351f; min-width: 44px; text-align: center; }
.stepper-val span { font-variant-numeric: tabular-nums; }

/* 화면비율 라디오 칩(16:9 / 4:3 — "세로" 없음) */
.aspect-chips { display: flex; gap: 8px; }
.aspect-chip {
  border: 1.5px solid #d7ded9; background: #ffffff; color: #48544c; border-radius: 9px;
  padding: 8px 16px; font-size: 13px; font-weight: 700; cursor: pointer;
}
.aspect-chip:hover { border-color: #bcdcc7; }
.aspect-chip.selected { border-color: #127a3c; background: #e9f6ed; color: #0e5a2e; }

/* 취향 읽기 패널 */
.taste-rows { display: flex; flex-direction: column; gap: 7px; }
.taste-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: #f7faf8; border: 1px solid #eaf1ec; border-radius: 10px; padding: 9px 11px;
}
.taste-dim { font-size: 11.5px; font-weight: 800; color: #0e5a2e; background: #e9f6ed; border-radius: 6px; padding: 2px 8px; flex: none; }
.taste-label { font-size: 12.5px; color: #3d4a41; line-height: 1.45; flex: 1; min-width: 0; }
.taste-badge { font-size: 10.5px; font-weight: 700; color: #5f6c64; background: #eef2ef; border-radius: 5px; padding: 2px 7px; flex: none; }
.taste-empty { display: flex; flex-direction: column; gap: 8px; padding: 4px 0; }
.taste-empty-tx { margin: 0; font-size: 12.5px; line-height: 1.5; color: #686f6a; }
.taste-ph { height: 30px; border-radius: 10px; background: #f0f4f1; display: block; }
.tp-note { margin: 4px 0 0; font-size: 11.5px; line-height: 1.5; color: #8a938c; border-top: 1px solid #f0f4f1; padding-top: 10px; }

/* 정직한 진행 — 불확정 스피너(가짜 4단계 시계 제거) */
.gen-body { display: flex; align-items: flex-start; gap: 11px; }
.gen-body-tx { display: flex; flex-direction: column; gap: 3px; }
.gen-line { font-size: 13px; font-weight: 700; color: #12351f; }
.gen-honest { font-size: 11.5px; line-height: 1.5; color: #677069; }
.spinner {
  width: 20px; height: 20px; border-radius: 50%; flex: none; margin-top: 1px;
  border: 2.5px solid #d7e6dc; border-top-color: #127a3c; animation: mdSpin 0.8s linear infinite;
}
@keyframes mdSpin { to { transform: rotate(360deg); } }

/* 생성 중 에코 칩(설정 적용됨 · …) */
.gen-echo {
  align-self: flex-start; max-width: 88%; font-size: 12px; font-weight: 700; color: #0e5a2e;
  background: #e9f6ed; border: 1px solid #cde6d5; border-radius: 8px; padding: 6px 10px; line-height: 1.45;
}

/* 컴포저 작성-상태 라벨/주석 */
.composer-label { margin: 0; font-size: 12.5px; font-weight: 700; color: #48544c; line-height: 1.45; }
.composer-note { margin: 0; font-size: 11.5px; color: #8a938c; line-height: 1.45; }

/* 완성 마커(이번에 반영된 설정·취향) */
.markers { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid #f0f4f1; padding: 11px 0 4px; }
.markers-title { font-size: 12px; font-weight: 700; color: #5f6c64; }
.marker-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.mk-chip { font-size: 11.5px; font-weight: 700; border-radius: 7px; padding: 4px 9px; line-height: 1.4; }
.mk-chip.set { background: #eef5f0; border: 1px solid #d3e7db; color: #0e5a2e; }   /* 설정 = 보더 있는 옅은 초록 */
.mk-chip.taste { background: #e9f6ed; border: 1px solid #e9f6ed; color: #0e5a2e; } /* 취향 = 채운 초록 */
.marker-legend { display: flex; align-items: center; gap: 6px; font-size: 11px; color: #677069; }
.mk-lg { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.mk-lg.set { background: #eef5f0; border: 1px solid #d3e7db; }
.mk-lg.taste { background: #e9f6ed; margin-left: 8px; }

/* 푸터 */
.foot-app { background: #ffffff; border-top: 1px solid #e6ece7; }
body.app .foot-app { padding: 20px calc((100% - min(1160px, 100% - 40px)) / 2); font-size: 13px; color: #5f6c64; }
.foot-app strong { color: #12351f; font-weight: 700; }

/* ── 모바일(<960px): 사이드바 오버레이 + 세로 스택 (§3.2) ── */
@media (max-width: 959px) {
  .menu-btn { display: inline-flex; }
  .hdr-admin, .hdr-email, .hdr-logout { display: none; }
  .panes { flex-direction: column; }
  .side-rail { display: none !important; }
  .side-collapse { display: none; }
  .side {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 60;
    width: min(320px, 84vw); border-radius: 0 16px 16px 0;
    transform: translateX(-102%); visibility: hidden; /* 닫힘 = 접근성 트리에서도 숨김(탭·SR 차단) */
    transition: transform .18s ease, visibility 0s linear .18s; /* 닫을 때만 슬라이드 종료 후 숨김 */
    display: flex !important; overflow-y: auto;
  }
  body.side-open .side {
    transform: translateX(0); visibility: visible;
    transition: transform .18s ease, visibility 0s; /* 열 때는 즉시 보임 → 포커스 진입 가능 */
  }
  .side-backdrop {
    display: block; position: fixed; inset: 0; z-index: 50;
    background: rgba(14, 63, 38, 0.32);
  }
  .side-account { display: flex; } /* 계정 블록: 모바일에선 사이드바 하단(§3.2) */
  .compose-view { min-width: 100%; }
  .compose-top { flex-direction: column; } /* 설정·취향 패널 세로 스택(§E) */
  .chat { min-width: 100%; }
  .result { min-width: 100%; }
  .chat-scroll { max-height: 420px; }
  .res-placeholder { min-height: 280px; }
  .pv-iframe { height: 380px; }
}
