/* 위젯 패널(iframe 안) · 단독 채팅 페이지 (docs/08 § 2.7, § 3.2, § 4) — 템플릿: public/ui/widget.js
 * tokens.css · base.css · /ui/ui.css 다음에 링크한다. 테마색은 theme.js applyThemeColor(document.documentElement, hex).
 * iframe 의 크기(390×최대 700)·둥근 모서리·그림자는 로더가 준다(public/ui/launcher.js LAUNCHER_CSS .tc-frame).
 * iframe 밖에서 연 창(단독 페이지 body.w-standalone, 직접 연 /w/ 는 app.js 가 body.w-solo)은 아래 "단독 창" 규칙으로
 * 넓은 화면에서 가운데 카드형 채팅창, 좁은 화면(< 768)·낮은 화면은 지금처럼 꽉 채운다(docs/08 § 2.7 단독 채팅 페이지).
 */
html, body { height: 100%; }
body.w-body { margin: 0; background: var(--bg-surface); overflow: hidden; }
body.w-body.is-page { background: var(--bg-app); overflow: auto; }

/* ── 단독 창: 넓은 화면에서는 가운데 카드(420×최대 760, 큰 화면 460×820) ── */
@media (min-width: 768px) and (min-height: 600px) {
  body.w-body:is(.w-standalone, .w-solo) {
    display: grid; place-items: center; padding: var(--s-6); overflow: auto;
    background:
      radial-gradient(60rem 40rem at 10% 0%, color-mix(in oklab, var(--brand-fill) 12%, transparent), transparent 70%),
      radial-gradient(50rem 36rem at 100% 100%, color-mix(in oklab, var(--brand-fill) 9%, transparent), transparent 70%),
      var(--bg-app);
  }
  body.w-body:is(.w-standalone, .w-solo) > #app {
    width: 420px; height: min(760px, calc(100dvh - 2 * var(--s-6)));
    border-radius: var(--r-2xl); overflow: hidden; background: var(--bg-surface);
    box-shadow: var(--sh-lg), var(--sh-edge);
    contain: layout;   /* 안쪽 fixed 요소(토스트 등)가 화면이 아니라 카드 기준으로 붙게 */
  }
}
@media (min-width: 1280px) and (min-height: 900px) {
  body.w-body:is(.w-standalone, .w-solo) > #app { width: 460px; height: min(820px, calc(100dvh - 2 * var(--s-6))); }
}

/* ── 패널 틀 ──────────────────────────────────────────────────────── */
.wpanel { position: relative; display: flex; flex-direction: column; height: 100%; min-height: 0; background: var(--bg-surface); color: var(--text); overflow: hidden; }
.wpanel.is-page { max-width: var(--page-max-w); height: 100dvh; margin: 0 auto; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
.wpanel-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.wpanel-body.is-chat { padding: var(--s-4) var(--s-4) var(--s-2); display: flex; flex-direction: column; }
.wpanel-body.is-chat > .chat { margin-top: auto; }          /* 메시지가 적으면 아래에 붙인다 */
.wpanel-foot { flex: none; padding: var(--s-2) var(--s-3) var(--s-3); background: var(--bg-surface); }
.wpanel > .bnav { flex: none; }
@media (prefers-reduced-motion: no-preference) {
  .wpanel.is-opening { animation: tc-rise var(--dur-3) var(--ease); }
}
@keyframes tc-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ── 헤더(대화 탭) ────────────────────────────────────────────────── */
.whead { flex: none; display: flex; align-items: center; gap: var(--s-2); min-height: 56px; padding: var(--s-2) var(--s-2); border-bottom: 1px solid var(--line); background: var(--bg-surface); }
.whead-who { display: flex; align-items: center; gap: var(--s-2); flex: 1; min-width: 0; }
.whead-text { display: grid; min-width: 0; }
.whead-name { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: var(--t-md); line-height: var(--lh-md); font-weight: 700; }
.whead-name > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.whead-sub { font-size: var(--t-xs); line-height: var(--lh-xs); color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.whead-title { flex: 1; margin: 0 var(--s-2); font-size: var(--t-lg); line-height: var(--lh-lg); font-weight: 700; }

/* ── 홈 탭: 커버(테마색 그라데이션 + 곡선) · 인사 카드 ─────────────── */
.whome { position: relative; padding-bottom: var(--s-5); }
.wcover {
  position: relative; display: grid; align-content: start; gap: 4px; min-height: 196px; padding: var(--s-6) var(--s-5) 72px;
  background: linear-gradient(165deg, var(--brand-fill) 0%, color-mix(in oklab, var(--brand-fill) 80%, #fff) 100%);
  color: var(--on-brand); overflow: hidden;
}
.wcover.has-image { background-size: cover; background-position: center; }
.wcover-art { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; color: var(--on-brand); opacity: .14; }
.wcover-close { position: absolute; top: var(--s-2); right: var(--s-2); color: inherit; }
.wcover-close.btn.is-ghost:hover { background: color-mix(in srgb, currentColor 14%, transparent); }
.wcover-title { position: relative; margin: 0; font-size: var(--t-2xl); line-height: var(--lh-2xl); font-weight: 700; }
.wcover-link { position: relative; justify-self: start; display: inline-flex; align-items: center; gap: 2px; padding: 0; font-size: var(--t-sm); line-height: var(--lh-sm); font-weight: 500; color: inherit; opacity: .92; }
.wcover-link:hover { opacity: 1; text-decoration: underline; text-underline-offset: 2px; }
.wcover-link .icon { width: 16px; height: 16px; }

.whome-cards { position: relative; display: grid; gap: var(--s-3); margin: -56px var(--s-4) 0; }
.wcard { display: grid; gap: var(--s-3); padding: var(--s-5); border-radius: var(--r-xl); background: var(--bg-raised); box-shadow: var(--sh-md), var(--sh-edge); }
.wcard-who { display: flex; align-items: center; gap: var(--s-2); font-size: var(--t-sm); font-weight: 600; }
.wcard-logo { width: 32px; height: 32px; border-radius: var(--r-md); object-fit: cover; flex: none; }
.wcard-text { margin: 0; font-size: var(--t-lg); line-height: var(--lh-lg); color: var(--text); white-space: pre-wrap; }
.wcard .btn.is-lg { height: 48px; border-radius: var(--r-lg); }
.wstatus { display: flex; align-items: center; gap: 6px; font-size: var(--t-xs); line-height: var(--lh-xs); color: var(--text-2); }
.wstatus::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.wstatus.is-away::before { background: var(--warn); }
.wstatus.is-off::before { background: var(--text-3); }
.whome-account { display: flex; justify-content: center; padding: 0 var(--s-4); }

/* ── 목록(대화 탭·설정 탭) ────────────────────────────────────────── */
.wlist { margin: 0; padding: var(--s-2) 0; list-style: none; }
.wlist-title { margin: 0; padding: var(--s-4) var(--s-4) var(--s-1); font-size: var(--t-xs); line-height: var(--lh-xs); font-weight: 600; color: var(--text-3); }
.wrow {
  display: flex; align-items: center; gap: var(--s-3); width: 100%; min-height: 56px; padding: var(--s-3) var(--s-4);
  text-align: left; color: var(--text); transition: background-color var(--dur-1) var(--ease);
}
button.wrow:hover, a.wrow:hover { background: var(--bg-hover); }
.wrow > .icon { width: 20px; height: 20px; color: var(--text-2); flex: none; }
.wrow-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.wrow-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.wrow-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--t-md); line-height: var(--lh-md); font-weight: 600; }
.wrow-time { margin-left: auto; flex: none; font-size: var(--t-2xs); color: var(--text-3); font-variant-numeric: tabular-nums; }
.wrow-sub { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: var(--t-sm); line-height: var(--lh-sm); color: var(--text-2); }
.wrow-sub > span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wrow.is-unread .wrow-sub { color: var(--text); font-weight: 500; }
.wrow-value { flex: none; font-size: var(--t-sm); color: var(--text-2); }
.wrow-end { flex: none; color: var(--text-3); }
.wrow-end .icon { width: 16px; height: 16px; }
.wlist-empty { padding: var(--s-10) var(--s-4); }
.wnew { display: flex; justify-content: center; padding: var(--s-3) var(--s-4) var(--s-4); }

/* 화면 아래 "새 문의하기"(종료 7일 지남) */
.wfoot-cta { display: grid; gap: var(--s-2); }

/* ── 모바일·좁은 높이 ─────────────────────────────────────────────── */
@media (pointer: coarse) {
  .composer-input { font-size: 16px; }   /* iOS 확대 방지 */
}
@media (max-height: 560px) {
  .wcover { min-height: 140px; padding-top: var(--s-4); }
}

/* ── 위젯 앱 조립(public/w/views.js·room.js) ─────────────────────── */
body.w-body > #app { height: 100%; }
.w-home-new { display: flex; justify-content: center; margin-top: calc(var(--s-1) * -1); }
.w-home-recent { gap: 0; padding: var(--s-3) 0 var(--s-1); }
.w-home-recent-title { margin: 0; padding: 0 var(--s-4); font-size: var(--t-xs); line-height: var(--lh-xs); font-weight: 600; color: var(--text-3); }
.w-home-recent .wlist { padding: 0; }
.w-confirm { padding: var(--s-2) var(--s-4) 0; }
.whome-cards > .w-confirm { padding: 0; }
.w-settings-email { padding: var(--s-2) var(--s-4) var(--s-4); }
.w-email-row { display: flex; gap: var(--s-2); }
.w-email-row > .input { flex: 1; min-width: 0; }
.w-expired { margin: 0; text-align: center; text-wrap: balance; font-size: var(--t-sm); line-height: var(--lh-sm); color: var(--text-2); }

/* ── 홈 내용(public/w/home.js — W-02): 인사말 링크·공지·팀원·안내사항 ── */
.w-home-links .quick { justify-content: flex-start; }
.w-home-note { display: flex; align-items: flex-start; gap: var(--s-2); margin: 0; padding: var(--s-3) var(--s-4); border-radius: var(--r-lg);
  background: var(--bg-subtle); font-size: var(--t-sm); line-height: var(--lh-sm); color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.w-home-note > .icon { flex: none; margin-top: 2px; color: var(--text-3); }
.w-home-note.is-alert { background: color-mix(in oklab, var(--warn) 12%, var(--bg-surface)); color: var(--text); }
.w-home-note.is-alert > .icon { color: var(--warn); }
.w-home-note a { color: var(--link, var(--brand)); text-decoration: underline; text-underline-offset: 2px; }
.w-home-team { display: flex; align-items: center; gap: var(--s-2); margin: 0; padding: 0 var(--s-1); font-size: var(--t-xs); line-height: var(--lh-xs); color: var(--text-2); }
.wh-greet a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

/* ── 운영시간 보기(깊이 1) ── */
.w-hours { display: grid; gap: var(--s-2); padding-bottom: var(--s-6); }
.w-hours-now { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; padding: var(--s-4) var(--s-4) 0; font-size: var(--t-md); line-height: var(--lh-md); font-weight: 600; }
.w-hours-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.w-hours-now.is-off .w-hours-dot { background: var(--text-3); }
.w-hours-next { flex-basis: 100%; padding-left: 14px; font-size: var(--t-sm); line-height: var(--lh-sm); font-weight: 400; color: var(--text-2); }
.w-hours-week, .w-hours-list { margin: 0; padding: 0 var(--s-4); list-style: none; }
.w-hours-week > li { display: flex; gap: var(--s-4); padding: var(--s-2) 0; border-bottom: 1px solid var(--line); font-size: var(--t-sm); line-height: var(--lh-sm); }
.w-hours-week > li:last-child { border-bottom: 0; }
.w-hours-week > li.is-today { font-weight: 700; }
.w-hours-day { flex: none; width: 3em; color: var(--text-2); }
.w-hours-week > li.is-today .w-hours-day { color: var(--brand); }
.w-hours-time { display: grid; gap: 2px; font-variant-numeric: tabular-nums; }
.w-hours-time small { font-size: var(--t-xs); line-height: var(--lh-xs); font-weight: 400; color: var(--text-3); }
.w-hours-tz { margin: 0; padding: var(--s-1) var(--s-4) 0; font-size: var(--t-xs); line-height: var(--lh-xs); color: var(--text-3); }
.w-hours-list > li { padding: var(--s-2) 0; font-size: var(--t-sm); line-height: var(--lh-sm); color: var(--text); border-bottom: 1px solid var(--line); }
.w-hours-list > li:last-child { border-bottom: 0; }

/* 만족도 카드(11단계, 세션 E) — public/w/csat.js <tc-csat>. 카드·별은 /ui conversation.css(.ccard·.csat-star) */
.w-csat-host { display: grid; align-self: stretch; margin: var(--s-2) 0; }
.w-csat { display: grid; gap: var(--s-2); }
.w-csat .ccard-title { text-align: center; }
.w-csat:not(.has-score) .textarea { display: none; } /* 의견 칸은 별을 고른 뒤에 */
.w-csat .textarea { resize: vertical; }
.w-csat-done { display: grid; justify-items: center; gap: var(--s-1); padding: var(--s-3) var(--s-4); border-radius: var(--r-xl); background: var(--bg-subtle); }
.w-csat-thanks { display: flex; align-items: center; gap: 6px; margin: 0; font-size: var(--t-sm); line-height: var(--lh-sm); color: var(--text-2); }
.w-csat-thanks > .icon { width: 16px; height: 16px; color: var(--ok); }
.w-csat-score { display: inline-flex; align-items: center; gap: 2px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.w-csat-score .icon { width: 16px; height: 16px; color: var(--star); fill: currentColor; }
.w-csat-comment { margin: 0; max-width: 100%; font-size: var(--t-xs); line-height: var(--lh-xs); color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; text-align: center; }

/* 개인정보 삭제 요청 카드(11.5단계 W-14) — public/w/privacy.js <tc-privacy>. 카드 모양은 /ui conversation.css(.ccard.is-danger) */
.w-privacy-host { display: grid; align-self: stretch; margin: var(--s-2) 0; }
.w-privacy-host .ccard-desc { display: grid; gap: var(--s-2); }
.w-privacy-host .ccard-desc > p { margin: 0; }
.w-privacy-host .check-group { margin: 0; }
.w-privacy-scope { color: var(--text-2); }
.w-privacy-done, .w-privacy-closed { padding: var(--s-2) var(--s-4); border-radius: var(--r-xl); background: var(--bg-subtle); text-align: center; }
.w-privacy-done.is-warn .icon { color: var(--danger-ink); }
