/* static/css/messenger.css */
/* 메신저 — 완전 독립 스타일 */

/* ──────────────── 팝업 안내 다이얼로그 ──────────────── */
.messenger-info-dialog-dim {
    position: fixed;
    inset: 0;
    bottom: var(--app-dialog-safe-bottom, 0px);
    background: rgba(0,0,0,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: messengerFadeIn 0.15s ease-out;
    padding: 20px;
}
.messenger-info-dialog {
    background: #fff;
    border-radius: 14px;
    width: 460px;
    max-width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    color: #1e293b;
    overflow: hidden;
}
.messenger-info-head {
    display: flex;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid #e5e7eb;
    background: #f8fafc;
    font-weight: 700;
    font-size: 1rem;
}
.messenger-info-head > span { flex: 1; }
.messenger-info-head-warn {
    background: #fef3c7;
    color: #92400e;
    border-bottom-color: #fcd34d;
}
.messenger-info-close {
    background: none; border: none; font-size: 1.1rem; cursor: pointer;
    padding: 2px 6px; color: #6b7280;
}
.messenger-info-close:hover { color: #1e293b; }
.messenger-info-body {
    padding: 16px 18px;
    overflow-y: auto;
    font-size: 0.88rem;
    line-height: 1.6;
    color: #374151;
}
.messenger-info-body p { margin: 6px 0; }
.messenger-info-note {
    margin: 12px 0;
    padding: 10px 12px;
    background: #eff6ff;
    border-left: 3px solid #2563eb;
    border-radius: 6px;
    font-size: 0.85rem;
    color: #1e40af;
}
.messenger-info-details {
    margin-top: 10px;
    padding: 8px 12px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}
.messenger-info-details > summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    color: #1e293b;
    list-style: disclosure-closed;
    outline: none;
}
.messenger-info-details[open] > summary { list-style: disclosure-open; }
.messenger-info-details ol, .messenger-info-details ul { font-size: 0.85rem; color: #374151; }
.messenger-info-skip {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 14px;
    font-size: 0.82rem;
    color: #6b7280;
    cursor: pointer;
    user-select: none;
}
.messenger-info-skip input { margin: 0; }
.messenger-info-foot {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 18px;
    border-top: 1px solid #e5e7eb;
    background: #f8fafc;
}
.messenger-info-btn {
    padding: 8px 16px;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
}
.messenger-info-btn-primary {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}
.messenger-info-btn-primary:hover { background: #1d4ed8; border-color: #1d4ed8; }

/* 좁은 화면: 다이얼로그 세로 확장 */
@media (max-width: 767px) {
    .messenger-info-dialog { width: 100%; max-height: 90vh; border-radius: 12px; }
}

/* ──────────────── 드래그앤드롭 파일 업로드 오버레이 ──────────────── */
.msg-drop-overlay {
    position: absolute;
    inset: 0;
    z-index: 1000;
    background: rgba(37, 99, 235, 0.08);
    border: 3px dashed #2563eb;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;   /* 리스너는 view 에 이미 붙음; 오버레이는 hit-target X */
    opacity: 0;
    transition: opacity 0.12s ease-out;
}
.msg-drop-overlay.active {
    opacity: 1;
}
.msg-drop-inner {
    background: #fff;
    padding: 24px 32px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(37, 99, 235, 0.2);
    text-align: center;
    color: #1e40af;
}
.msg-drop-icon {
    font-size: 2.4rem;
    margin-bottom: 8px;
}
.msg-drop-text {
    font-size: 1rem;
    font-weight: 700;
    color: #1e40af;
}
.msg-drop-sub {
    font-size: 0.78rem;
    color: #6b7280;
    margin-top: 4px;
}

/* 스탠들언 모드 (/messenger 페이지) — 팝업 창 전체를 채움.
   position:fixed 대신 flex 컬럼으로 뷰포트 가득. body가 이미 height:100vh. */
.messenger-standalone-root {
    display: flex;
    flex-direction: column;
    width: 100vw;
    height: 100%;
    min-height: 0;
    background: #fff;
    overflow: hidden;
}
.messenger-standalone-root .messenger-body {
    flex: 1;
    min-height: 0;
}
/* 모바일: 광고 슬롯을 포함한 앱 가용 화면 전체를 덮는다. */
.messenger-overlay {
    position: fixed;
    top: var(--app-shell-top, 0px);
    left: 0;
    right: 0;
    bottom: var(--app-dialog-safe-bottom, 0px);
    background: #fff;
    display: flex;
    flex-direction: column;
    animation: messengerSlideUp 0.25s ease-out;
}

/* Hosted messenger surfaces belong to the main frame's service region. The
   fixed fallback remains for standalone/private entry pages without a frame. */
#appServiceRegion > .messenger-overlay {
    position: absolute;
    top: var(--app-service-header-offset, 0px);
    bottom: 0;
}
#appServiceRegion > .messenger-dim {
    position: absolute;
    top: var(--app-service-header-offset, 0px);
    bottom: 0;
}
/* 데스크탑: 우측 사이드 패널 (페이지 분할 — 메인 콘텐츠 옆에 배치) */
@media (min-width: 768px) {
    .messenger-overlay {
        position: fixed;
        top: var(--app-shell-top, 0px);
        right: 0;
        bottom: var(--app-dialog-safe-bottom, 0px);
        left: auto;
        width: 420px;
        max-width: 40vw;
        box-shadow: -4px 0 24px rgba(0,0,0,0.1);
        border-left: 1px solid #e5e7eb;
        animation: messengerSlideIn 0.25s ease-out;
    }
    /* 메인 콘텐츠 영역을 줄여서 메신저와 공존 */
    body.messenger-open:not(:has(.messenger-web-panel)) > #appMainFrame > #appViewportRegion {
        padding-right: calc(24px + min(420px, 40vw));
        transition: padding-right 0.25s ease-out;
    }
}
@keyframes messengerSlideUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
@keyframes messengerSlideIn {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

/* 배경 딤 — 모바일만 (데스크탑은 페이지 분할) */
.messenger-dim {
    display: none;
}
@media (max-width: 767px) {
    .messenger-dim {
        display: block;
        position: fixed;
        top: var(--app-shell-top, 0px);
        left: 0;
        right: 0;
        bottom: var(--app-dialog-safe-bottom, 0px);
        background: rgba(0,0,0,0.3);
    }

    body.mobile-shell-open .messenger-overlay .messenger-header {
        display: flex;
    }
}

/* 헤더 */
.messenger-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #e5e7eb;
    background: #f8fafc;
    flex-shrink: 0;
}
.messenger-header-title {
    font-size: 1.1rem; font-weight: 700; color: #1e293b; flex: 1;
}
.messenger-header-browser {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    margin-right: 4px;
    padding: 6px 10px;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 0.78rem;
    font-weight: 750;
    text-decoration: none;
    cursor: pointer;
}
.messenger-header-browser:hover {
    border-color: #93c5fd;
    background: #dbeafe;
}
.messenger-header-browser:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.25);
    outline-offset: 2px;
}
.messenger-header-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    margin-left: 4px;
    padding: 0;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #64748b;
    font-size: 1.2rem;
    cursor: pointer;
}
.messenger-header-close:hover {
    background: #e2e8f0;
    color: #1e293b;
}
.messenger-header-close:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.25);
    outline-offset: 2px;
}

/* 탭 */
.messenger-tabs {
    display: flex;
    border-bottom: 2px solid #e5e7eb;
    background: #fff;
    flex-shrink: 0;
}
.messenger-tabs > .messenger-panel-close {
    align-self: center;
    margin-right: 4px;
}
.messenger-tab {
    flex: 1;
    padding: 12px 0;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 600;
    color: #6b7280;
    background: none;
    border: none;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
}
.messenger-tab:hover { color: #374151; }
.messenger-tab.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
}
.messenger-tab .tab-badge {
    display: inline-block;
    background: #ef4444;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 10px;
    padding: 1px 5px;
    margin-left: 4px;
    vertical-align: top;
}

/* 탭 콘텐츠 */
.messenger-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    background: #f9fafb;
    /* 2026-04-28: 부모 페이지로 스크롤 bubble 차단 (iOS PWA에서 더블 스크롤 충돌 제거) */
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

/* 2026-04-28: 채팅 메시지 리스트 — iOS 모멘텀/오버스크롤 최소 안정화.
   기존 시도(scroll-behavior:smooth + will-change + transform translateZ)는
   초기 로드 시 페이지 점프가 애니메이션화되어 오히려 "blink/슬라이드" 현상 유발.
   smooth/will-change/transform 모두 제거 — 점프는 즉시(instant) 가 가장 자연스럽다. */
.msg-scroll-area {
    overflow-y: auto;
    overscroll-behavior: contain;        /* 끝에서 부모로 스크롤 bubble 안 됨 */
    -webkit-overflow-scrolling: touch;   /* iOS 모멘텀 활성 */
    /* scroll-behavior 미지정 = auto(즉시) — 프로그램적 scrollTop 변경 시 점프 */
}
.messenger-tab-content {
    display: none;
    padding: 0;
    height: 100%;
}
.messenger-tab-content.active {
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.msg-read-receipt {
    color: #64748b;
    font-size: 0.65rem;
    line-height: 1;
    white-space: nowrap;
}

/* 지정 답장: 선택한 원문과 작성 중인 내 답장을 한 문맥으로 보여준다. */
.msg-message-composer {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.msg-composer-row {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    min-width: 0;
}
.msg-composer-context {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px;
    align-items: center;
    gap: 8px;
    min-height: 54px;
    padding: 6px 6px 6px 11px;
    border: 1px solid #bfdbfe;
    border-left: 4px solid #2563eb;
    border-radius: 10px;
    background: #eff6ff;
    color: #1e3a8a;
}
.msg-composer-context[data-context-mode="edit"] {
    border-left-color: #7c3aed;
    background: #f5f3ff;
    color: #5b21b6;
}
.msg-composer-context[hidden] { display: none !important; }
.msg-composer-context-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.msg-composer-context-title,
.msg-composer-context-preview {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.msg-composer-context-title {
    font-size: 0.78rem;
    font-weight: 800;
}
.msg-composer-context-preview {
    color: #475569;
    font-size: 0.75rem;
    line-height: 1.35;
}
.msg-composer-context-close {
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #475569;
    cursor: pointer;
    font: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.msg-composer-context-close:hover,
.msg-composer-context-close:focus-visible {
    background: rgba(255, 255, 255, 0.78);
    outline: 3px solid rgba(37, 99, 235, 0.28);
    outline-offset: -3px;
}
@media (max-width: 340px) {
    .msg-composer-row {
        display: grid;
        grid-template-columns: 44px 44px 44px minmax(0, 1fr) 60px;
        grid-template-rows: 44px minmax(44px, auto);
    }
    .msg-composer-row .msg-voice-join-btn { grid-column: 1; grid-row: 1; }
    .msg-composer-row .msg-file-attach-btn { grid-column: 2; grid-row: 1; }
    .msg-composer-row .msg-mention-btn { grid-column: 3; grid-row: 1; }
    .msg-composer-row .msg-message-input {
        grid-column: 1 / 5;
        grid-row: 2;
        width: 100%;
        box-sizing: border-box;
    }
    .msg-composer-row .msg-send-btn {
        grid-column: 5;
        grid-row: 2;
        width: 60px;
        padding-inline: 8px !important;
    }
}

/* 내일거리 목록과 동일한 원칙의 좌우 슬라이드 빠른 작업.
   세로 스크롤을 우선하고, 충분한 수평 이동 뒤에만 작업을 노출한다. */
.msg-swipe-row {
    position: relative;
    overflow: hidden;
    touch-action: pan-y;
    isolation: isolate;
}
.msg-swipe-surface {
    position: relative;
    z-index: 2;
    width: 100%;
    box-sizing: border-box;
    transition: transform 160ms ease;
    will-change: transform;
}
.msg-swipe-row.is-swipe-dragging .msg-swipe-surface {
    transition: none;
}
.msg-swipe-actions {
    position: absolute;
    inset-block: 0;
    z-index: 1;
    display: flex;
    align-items: stretch;
    visibility: hidden;
    pointer-events: none;
}
.msg-swipe-actions-start { inset-inline-start: 0; }
.msg-swipe-actions-end { inset-inline-end: 0; }
.msg-swipe-row.is-swipe-start-open .msg-swipe-actions-start,
.msg-swipe-row.is-swipe-end-open .msg-swipe-actions-end,
.msg-swipe-row.is-swipe-dragging .msg-swipe-actions {
    visibility: visible;
    pointer-events: auto;
}
.msg-swipe-row.is-swipe-start-open .msg-swipe-surface {
    transform: translateX(var(--msg-swipe-start-width, 76px));
}
.msg-swipe-row.is-swipe-end-open .msg-swipe-surface {
    transform: translateX(calc(-1 * var(--msg-swipe-end-width, 144px)));
}
.msg-swipe-action {
    min-width: 64px;
    min-height: 44px;
    padding: 8px 11px;
    border: 0;
    border-radius: 0;
    background: #2563eb;
    color: #fff;
    font: inherit;
    font-size: 0.76rem;
    font-weight: 800;
    cursor: pointer;
}
.msg-swipe-action.is-secondary { background: #475569; }
.msg-swipe-action.is-danger { background: #dc2626; }
.msg-swipe-action:focus-visible {
    outline: 3px solid #facc15;
    outline-offset: -4px;
}
.msg-message-swipe-row {
    margin-bottom: 6px;
    border-radius: 10px;
}
.msg-message-swipe-row .msg-message-swipe-surface {
    min-height: 44px;
    margin-bottom: 0 !important;
    padding-block: 1px;
    background: #f9fafb;
}
.msg-friend-swipe-row { --msg-swipe-start-width: 76px; --msg-swipe-end-width: 144px; }
.msg-friend-swipe-row .msg-friend-card { background: #fff; }
.msg-friend-swipe-row .msg-swipe-actions-end .msg-swipe-action { width: 72px; }
.msg-room-swipe-row {
    --msg-swipe-start-width: 88px;
    --msg-swipe-end-width: 88px;
    touch-action: pan-y pinch-zoom;
}
.msg-room-list-surface {
    display: flex;
    align-items: stretch;
    background: var(--color-surface, #fff);
    color: var(--color-text, #1e293b);
    will-change: auto;
}
.msg-room-list-surface > :is(.msg-room-entry, .msg-private-bid-room) {
    flex: 1;
    width: auto;
    min-width: 0;
}
.msg-room-quick-toggle {
    flex: 0 0 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    border: 0;
    border-bottom: 1px solid var(--color-border, #f0f0f0);
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 1.25rem;
    cursor: pointer;
}
.msg-room-quick-toggle:focus-visible {
    outline: 3px solid #60a5fa;
    outline-offset: -3px;
}
.msg-room-swipe-row .msg-swipe-action { width: 88px; }
.msg-room-swipe-row .msg-swipe-action:disabled { opacity: .65; cursor: wait; }
.msg-room-swipe-row.is-room-actions-open {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.msg-room-swipe-row.is-room-actions-open > .msg-room-list-surface {
    grid-row: 1;
    grid-column: 1 / -1;
    transform: none;
}
.msg-room-swipe-row.is-room-actions-open > .msg-swipe-actions {
    position: static;
    grid-row: 2;
    visibility: visible;
    pointer-events: auto;
}
.msg-room-swipe-row.is-room-actions-open .msg-swipe-action { width: 100%; }
.msg-room-pin-badge { margin-inline-end: 5px; font-size: .78rem; }
.msg-room-pinned-context {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-top: 3px;
    font-size: .72rem;
    color: var(--color-text-secondary, #475569);
}
.msg-pinned-rooms { border-bottom: 2px solid var(--color-border, #cbd5e1); }
.msg-room-action-status {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}
@media (prefers-reduced-motion: reduce) {
    .msg-room-swipe-row > .msg-swipe-surface { transition: none; }
}
.msg-message-swipe-row { --msg-swipe-start-width: 76px; --msg-swipe-end-width: 76px; }
.msg-message-swipe-row .msg-swipe-action { width: 76px; }

/* 친구 탭 */
.msg-friend-header {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    gap: 6px;
    flex-wrap: wrap;  /* 2026-04-29 (#372): 좁은 폰에서 자동 줄바꿈 */
}
.msg-friend-search-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1 1 100%;
    min-width: 0;
}
.msg-friend-header .msg-friend-search { min-width: 0; min-height: 44px; }
.msg-friend-search-clear {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    color: #64748b;
    font-size: 1rem;
    cursor: pointer;
}
.msg-friend-search-clear[hidden] { display: none; }
.msg-friend-toolbar-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    width: 100%;
}
.msg-friend-toolbar-actions .msg-friend-add-btn { min-height: 44px; }
.msg-friend-filter-status {
    min-height: 20px;
    padding: 0 14px 7px;
    color: #64748b;
    font-size: 0.74rem;
}
@media (max-width: 380px) {
    .msg-friend-header .msg-friend-add-btn {
        padding: 8px 10px;
        font-size: 0.78rem;
    }
}
.msg-friend-search {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.85rem;
    outline: none;
}
.msg-friend-search:focus { border-color: #2563eb; }
.msg-friend-search-btn {
    padding: 8px 14px;
    background: #e2e8f0;
    color: #374151;
    border: none;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.msg-friend-search-btn:hover { background: #cbd5e1; }
.msg-friend-header-divider {
    width: 1px;
    height: 28px;
    background: #d1d5db;
    flex-shrink: 0;
    margin: 0 4px;
}
.msg-friend-add-btn {
    padding: 8px 14px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.msg-friend-add-btn:hover { background: #1d4ed8; }

/* 섹션 제목 */
.msg-section-title {
    padding: 8px 16px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: #f1f5f9;
    border-bottom: 1px solid #e5e7eb;
}

/* 친구/요청 카드 */
.msg-friend-card {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.1s;
}
.msg-friend-card:hover { background: #f0f7ff; }
.msg-friend-card[data-friend-id] {
    padding: 0 6px 0 0;
    cursor: default;
}
.msg-friend-open {
    flex: 1;
    min-width: 0;
    min-height: 64px;
    padding: 12px 10px 12px 16px;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
}
.msg-friend-open .msg-friend-name,
.msg-friend-open .msg-friend-meta { display: block; }
.msg-friend-open:focus-visible {
    outline: 3px solid #2563eb;
    outline-offset: -3px;
    border-radius: 8px;
}
.msg-friend-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: #e0e7ff;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
    margin-right: 12px;
}
.msg-friend-info {
    flex: 1;
    min-width: 0;
}
.msg-friend-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: #1e293b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.msg-friend-meta {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 2px;
}
.msg-friend-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}
.msg-btn-accept {
    padding: 5px 12px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
}
.msg-btn-reject {
    padding: 5px 12px;
    background: #f3f4f6;
    color: #6b7280;
    border: none;
    border-radius: 6px;
    font-size: 0.78rem;
    cursor: pointer;
}
.msg-btn-accept:hover { background: #1d4ed8; }
.msg-btn-reject:hover { background: #e5e7eb; }

/* 친구 추가 다이얼로그 */
.msg-add-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: var(--app-dialog-safe-bottom, 0px);
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: messengerFadeIn 0.15s ease-out;
}
@keyframes messengerFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.msg-add-dialog {
    background: #fff;
    border-radius: 16px;
    width: 400px;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 40px rgba(0,0,0,0.2);
}
.msg-add-dialog-header {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
}
.msg-add-dialog-title {
    font-size: 1rem;
    font-weight: 700;
    color: #1e293b;
    flex: 1;
}
.msg-add-dialog-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #6b7280;
    padding: 4px 8px;
}
.msg-add-dialog-body {
    padding: 20px;
}
.msg-add-mobile-tip {
    margin-top: 16px;
    padding: 10px 14px;
    background: #f0f7ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    font-size: 0.8rem;
    color: #1e40af;
    line-height: 1.4;
}
.msg-add-input-row {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}
.msg-add-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.9rem;
}
.msg-add-search-btn {
    padding: 10px 18px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}
.msg-search-result {
    padding: 16px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
}
.msg-search-result .msg-btn-request {
    padding: 8px 16px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
}
.msg-search-result .msg-btn-sms {
    padding: 8px 16px;
    background: #10b981;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
}
.msg-empty {
    text-align: center;
    padding: 40px 16px;
    color: #9ca3af;
    font-size: 0.9rem;
}

.msg-friend-menu-item {
    width: 100%;
    border: 0;
    background: transparent;
    font: inherit;
    text-align: left;
}

/* 인증 메신저 모바일 터치 계약.
   로그인 전 화면뿐 아니라 실제 친구/채팅 화면의 동적 제어도 44px을 유지한다. */
@media (max-width: 767px) {
    .messenger-standalone-root .messenger-header {
        padding-top: max(12px, env(safe-area-inset-top));
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
    }

    .messenger-header-browser,
    .messenger-header-close,
    .msg-friend-search,
    .msg-friend-search-btn,
    .msg-friend-add-btn,
    .msg-friend-open,
    .msg-friend-kebab,
    .msg-btn-accept,
    .msg-btn-reject,
    .msg-add-dialog-close,
    .msg-add-input,
    .msg-add-search-btn,
    .msg-search-result .msg-btn-request,
    .msg-search-result .msg-btn-sms,
    .msg-friend-menu-item,
    .desktop-app-banner a {
        box-sizing: border-box;
        min-height: 44px;
    }

    .messenger-header-close,
    .msg-friend-kebab,
    .msg-add-dialog-close {
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .desktop-app-banner a {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding-inline: 8px;
    }
}

/* 채팅 탭 (Phase 3 준비) */
.msg-chat-list { }
.msg-chat-card {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
}
.msg-chat-card:hover { background: #f0f7ff; }
.msg-chat-preview {
    flex: 1;
    min-width: 0;
}
.msg-chat-name {
    font-weight: 600;
    font-size: 0.88rem;
    color: #1e293b;
}
.msg-chat-last-msg {
    font-size: 0.78rem;
    color: #6b7280;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.msg-chat-time {
    font-size: 0.7rem;
    color: #9ca3af;
    flex-shrink: 0;
    margin-left: 8px;
}
.msg-chat-unread {
    background: #ef4444;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 10px;
    padding: 2px 6px;
    margin-left: 6px;
    flex-shrink: 0;
}

.msg-voice-join-btn {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: #059669;
    color: #fff;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.msg-voice-join-btn:hover,
.msg-voice-join-btn:focus-visible {
    background: #047857;
    outline: none;
}

/* 일반 텍스트·음성인식 메시지는 저장된 줄바꿈을 그대로 표시한다. */
.msg-bubble {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.msg-message-content {
    min-width: 0;
}
.msg-direct-replyable {
    cursor: pointer;
    transition: box-shadow 120ms ease, background-color 120ms ease;
}
.msg-direct-replyable:hover {
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.24);
}
.msg-direct-replyable:active {
    background: #e2e8f0 !important;
}
.msg-message-reply-target > .msg-message-shell .msg-bubble-other {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.34);
}
.msg-reply-preview {
    width: 100%;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 1px 7px;
    margin: 0 0 7px;
    padding: 7px 8px;
    border: 0;
    border-left: 3px solid #3b82f6;
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.78);
    color: #475569;
    font: inherit;
    font-size: 0.73rem;
    line-height: 1.35;
    text-align: left;
    cursor: pointer;
    white-space: normal;
}
.msg-reply-preview:hover,
.msg-reply-preview:focus-visible {
    background: #fff;
    outline: 2px solid rgba(37, 99, 235, 0.3);
    outline-offset: 1px;
}
.msg-reply-preview-kicker {
    grid-row: 1 / span 2;
    align-self: center;
    color: #2563eb;
    font-size: 0.68rem;
    font-weight: 800;
    white-space: nowrap;
}
.msg-reply-preview-sender,
.msg-reply-preview-content {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.msg-reply-preview-sender {
    color: #1d4ed8;
    font-weight: 800;
}
.msg-reply-preview-content { color: #475569; }

/* 첨부 카드는 내부 레이아웃 공백을 줄바꿈으로 해석하지 않는다. */
.msg-bubble .msg-attachment-card {
    width: min(252px, 70vw);
    max-width: 100%;
    display: grid;
    gap: 8px;
    white-space: normal;
}
.msg-attachment-media {
    display: block;
    position: relative;
    width: 100%;
    padding: 0;
    border: 0;
    border-radius: 10px;
    overflow: hidden;
    background: #0f172a;
    aspect-ratio: 4 / 3;
    cursor: pointer;
}
.msg-attachment-media-image img,
.msg-attachment-media-video video {
    display: block;
    width: 100%;
    height: 100%;
}
.msg-attachment-media-image img {
    object-fit: cover;
    transition: transform 0.16s ease;
}
.msg-attachment-media-image:hover img,
.msg-attachment-media-image:focus-visible img {
    transform: scale(1.015);
}
.msg-attachment-media-image.is-opening img {
    opacity: 0.72;
}
.msg-attachment-media-image.is-opening::after {
    content: "여는 중";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    padding: 6px 9px;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.82);
    color: #fff;
    font-size: 0.74rem;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
}
.msg-attachment-media-video {
    aspect-ratio: 16 / 9;
    cursor: default;
    position: relative;
}
.msg-attachment-media-video video {
    object-fit: contain;
    background: #000;
}
.msg-video-open {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.42);
    background: rgba(15,23,42,0.76);
    color: #fff;
    font-size: 17px;
    font-weight: 800;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0,0,0,0.32);
}
.msg-video-open:hover,
.msg-video-open:focus-visible {
    background: rgba(30,41,59,0.94);
    outline: none;
}
.msg-video-open.is-opening {
    cursor: progress;
    opacity: 0.76;
}
.msg-attachment-audio audio {
    display: block;
    width: 100%;
    max-width: 100%;
}
.msg-attachment-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.msg-attachment-info {
    flex: 1;
    min-width: 0;
    display: grid;
    gap: 2px;
}
.msg-attachment-title {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    font-weight: 700;
    line-height: 1.2;
}
.msg-attachment-icon {
    flex: 0 0 auto;
    font-size: 0.9rem;
    line-height: 1;
}
.msg-attachment-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.msg-attachment-meta,
.msg-attachment-status {
    font-size: 0.72rem;
    line-height: 1.3;
    opacity: 0.78;
}
.msg-attachment-download {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 42px;
    min-height: 30px;
    padding: 6px 9px;
    border-radius: 8px;
    border: 1px solid rgba(37, 99, 235, 0.18);
    background: #2563eb;
    color: #fff;
    font-size: 0.76rem;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    text-decoration: none;
}
.msg-attachment-download:hover,
.msg-attachment-download:focus-visible {
    background: #1d4ed8;
    outline: none;
}
.msg-attachment-download.is-loading {
    cursor: progress;
    opacity: 0.78;
}
.msg-attachment-spinner {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    border: 2px solid rgba(255,255,255,0.46);
    border-top-color: #fff;
    animation: msgAttachmentSpin 0.72s linear infinite;
}
.msg-bubble-mine .msg-attachment-download {
    background: #fff;
    color: #1d4ed8;
    border-color: rgba(255,255,255,0.65);
}
.msg-bubble-mine .msg-attachment-download:hover,
.msg-bubble-mine .msg-attachment-download:focus-visible {
    background: #eff6ff;
}
.msg-bubble-mine .msg-attachment-spinner {
    border-color: rgba(37, 99, 235, 0.25);
    border-top-color: #1d4ed8;
}
@keyframes msgAttachmentSpin {
    to { transform: rotate(360deg); }
}
@media (max-width: 420px) {
    .msg-bubble .msg-attachment-card {
        width: min(236px, 68vw);
    }
    .msg-attachment-download {
        padding-inline: 8px;
    }
}

/* UIFIX-9: retain attachment actions, enlarge only their mobile hit targets. */
@media (max-width: 767px) {
    .msg-video-open {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
        box-sizing: border-box;
    }

    .msg-attachment-download {
        min-width: 44px;
        min-height: 44px;
        box-sizing: border-box;
    }
}


/* D2-16: 데스크탑 독립 메신저(/messenger) — 다른 화면과 같은 최대 폭 변수,
   나가는 출구는 하나(닫기 버튼이 있으면 "서비스로 돌아가기" 링크는 숨김). 모바일은 그대로. */
@media (min-width: 768px) {
    .messenger-standalone-root > .messenger-header,
    .messenger-standalone-root > .messenger-tabs,
    .messenger-standalone-root > .messenger-body {
        box-sizing: border-box;
        width: min(var(--app-desktop-page-max-width, 1440px), 100%);
        max-width: var(--app-desktop-page-max-width, 1440px);
        margin-right: auto;
        margin-left: auto;
    }

    .messenger-standalone-root .messenger-header-return:has(~ .messenger-header-close) {
        display: none;
    }
}

/* #450-101: the existing list, chat and context each have one mounted owner. */
.messenger-overlay,.messenger-standalone-root { --msg-surface:#fff; --msg-subtle:#f6f7f9; --msg-text:#12151a; --msg-muted:#4b5361; --msg-border:#e3e6eb; }
html[data-theme="dark"] :is(.messenger-overlay,.messenger-standalone-root) { --msg-surface:#14171b; --msg-subtle:#0c0e11; --msg-text:#eceef2; --msg-muted:#a7aeba; --msg-border:#353b44; }
:is(.messenger-overlay,.messenger-standalone-root) :is(.messenger-body,.messenger-tabs,#msgChatView,.msg-room-pane,.msg-room-header,.msg-message-composer) { background:var(--msg-surface) !important; color:var(--msg-text) !important; border-color:var(--msg-border) !important; }
#msgChatView.msg-room-layout { display:grid !important; grid-template-rows:minmax(0,1fr) max-content max-content; min-height:0; padding:8px; box-sizing:border-box; overflow:hidden; }
#msgRoomSidebar,.msg-room-pane,#msgRoomContext { grid-row:1; min-width:0; min-height:0; border:1px solid var(--msg-border); border-radius:8px; overflow:hidden; background:var(--msg-surface); }
#msgRoomSidebar { grid-column:rooms; grid-row:1 / -1; display:flex; flex-direction:column; }
.msg-room-pane { grid-column:chat; display:flex; flex-direction:column; border-bottom:0; border-radius:8px 8px 0 0; }
#msgRoomContext { grid-column:context; grid-row:1 / -1; overflow-y:auto; padding:10px; color:var(--msg-text); }
#msgRoomContext h3 { display:flex; align-items:center; min-height:var(--section-header-height,28px); margin:0 0 8px; font-size:14px; }
#msgRoomContext p { margin:0 0 10px; font-size:13px; line-height:1.5; overflow-wrap:anywhere; }
#msgRoomContext a { border:1px solid var(--msg-border); border-radius:6px; min-height:32px; color:#2563eb; }
#msgRoomSidebar .msg-chat-list { min-height:0; overscroll-behavior:contain; }
#msgRoomSidebar :is(.msg-chat-list-toolbar,.msg-room-entry,.msg-private-bid-room,.msg-private-bid-folder-head) { background:var(--msg-surface) !important; color:var(--msg-text) !important; border-color:var(--msg-border) !important; }
.msg-room-layout :is(.msg-chat-last-msg,.msg-chat-time,.msg-chat-meta,.msg-empty) { color:var(--msg-muted); }
.msg-room-layout .msg-room-header { padding:6px 8px !important; flex:0 0 auto; }
.msg-room-header #msgRoomBackBtn { flex:0 0 44px; }
.msg-room-header #msgRoomBackBtn svg { display:block; width:16px; height:16px; flex:none; }
.msg-room-layout #msgRoomTitle { white-space:normal !important; overflow-wrap:anywhere; }
.msg-room-layout .msg-room-history { flex:1 1 auto; min-height:0; }
.msg-room-layout .msg-message-composer { grid-column:chat; grid-row:3; flex:0 0 auto; padding:8px !important; min-width:0; border:1px solid var(--msg-border); border-radius:0 0 8px 8px; }
.msg-room-layout .msg-message-input { min-width:0; background:var(--msg-subtle); color:var(--msg-text); border-color:var(--msg-border) !important; }
.msg-room-layout .msg-send-btn { padding:8px 12px !important; background:#4a90d9 !important; }
.msg-room-layout .msg-bubble-other { background:var(--msg-subtle) !important; color:var(--msg-text) !important; }
.msg-room-layout > .voice-floating-bar { grid-column:chat; grid-row:2; flex:0 0 auto; min-height:0; max-height:none; overflow-y:auto; }
@media (min-width:768px) {
    #msgChatView.msg-room-layout {
        --msg-room-list-max: 480px;
        grid-template-columns: [rooms] clamp(240px, var(--msg-room-list-width, 320px), var(--msg-room-list-max))
            [separator] 14px [chat] minmax(0, 1fr) [context-gap] 8px [context] clamp(160px, 17%, 220px);
    }
    .msg-room-split {
        grid-column: separator;
        grid-row: 1 / -1;
        display: grid;
        place-items: center;
        cursor: col-resize;
        touch-action: none;
        user-select: none;
    }
    .msg-room-split::before {
        content: "";
        width: 4px;
        height: 36px;
        border-radius: 4px;
        background: var(--msg-muted);
    }
    .msg-room-split:is(:hover, :focus-visible, .is-dragging)::before { background: #2563eb; }
    .msg-room-split:focus-visible { outline: 2px solid #2563eb; outline-offset: -2px; }
    .msg-room-layout:has(.msg-room-split.is-dragging) { cursor: col-resize; user-select: none; }
    #msgRoomSidebar :is(.msg-chat-card-body, .msg-private-bid-room) {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        column-gap: 8px;
        row-gap: 0;
    }
    #msgRoomSidebar :is(.msg-room-entry, .msg-private-bid-room) { padding: 8px; }
    #msgRoomSidebar .msg-friend-avatar { grid-row: span 2; margin: 0; }
    #msgRoomSidebar .msg-chat-meta { display: flex; align-items: center; min-width: 0; }
    #msgRoomSidebar .msg-chat-time { margin-left: 0; }
}
@media (min-width:768px) and (max-width:959px) {
    #msgChatView.msg-room-layout { --msg-room-list-max: 320px; }
}
@media(max-width:767px) {
 #msgChatView.msg-room-layout { display:flex !important; flex-direction:column; gap:0; padding:0; }
 #msgRoomSidebar,.msg-room-split { display:none; }
 .msg-room-pane { flex:1 1 auto; border:0; border-radius:0; }
 #msgRoomContext { flex:0 0 auto; display:flex; align-items:center; gap:8px; padding:4px 8px; max-height:76px; overflow-y:auto; border-width:1px 0 0; border-radius:0; }
 #msgRoomContext h3 { flex:0 0 auto; margin:0; font-size:11px; }
 #msgRoomContext p { flex:1; min-width:0; margin:0; font-size:11px; }
 #msgRoomContext a { flex:0 0 auto; min-width:44px; padding:0 6px; }
 .msg-room-layout .msg-composer-row { flex-wrap:wrap; gap:4px; }
 .msg-room-layout .msg-message-input { flex:1 1 140px !important; padding:8px !important; }
}

.messenger-panel-split { display: none; }
.msg-message-content { -webkit-user-select: text; user-select: text; }
@media (pointer: coarse) {
    .msg-message-content { -webkit-touch-callout: none; }
}
@media(min-width:768px) {
    .messenger-overlay:not(.messenger-web-panel)[data-room-view="conversation"] { left:0; width:100%; max-width:none; }
    .messenger-overlay.messenger-web-panel {
        left: auto;
        max-width: none;
        width: clamp(480px, var(--messenger-panel-width, 600px), min(900px, calc(100vw - 240px)));
        container-type: inline-size;
    }
    #appServiceRegion > .messenger-web-panel {
        position: fixed;
        top: var(--app-shell-top, 0px);
        bottom: var(--app-dialog-safe-bottom, 0px);
    }
    .messenger-web-panel > .messenger-panel-split {
        position: absolute;
        inset: 0 auto 0 0;
        width: 12px;
        display: grid;
        pointer-events: auto;
        z-index: 5;
    }
    .messenger-web-panel:has(.messenger-panel-split.is-dragging) { user-select: none; }
}
@container (max-width: 699px) {
    .messenger-web-panel #msgChatView.msg-room-layout { display:flex !important; flex-direction:column; gap:0; padding:0; }
    .messenger-web-panel :is(#msgRoomSidebar,.msg-room-layout > .msg-room-split) { display:none; }
    .messenger-web-panel .msg-room-pane { flex:1 1 auto; border:0; border-radius:0; }
    .messenger-web-panel #msgRoomContext { flex:0 0 auto; display:flex; align-items:center; gap:8px; padding:4px 8px; max-height:76px; overflow:auto; }
    .messenger-web-panel #msgRoomContext h3 { flex:0 0 auto; margin:0; font-size:11px; }
    .messenger-web-panel #msgRoomContext p { flex:1; min-width:0; margin:0; font-size:11px; }
}

/* static/chat_overlay.css */
/* 음성회의 상태 모니터 + 공통 다크 UI 스타일 (2026-03-14) */

.co-overlay {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 380px;
  max-height: 520px;
  background: #1a1a2e;
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.45);
  z-index: 10010;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: #e0e0e0;
  transition: width 0.25s ease, max-height 0.25s ease;
}

.co-overlay.co-minimized {
  max-height: 44px;
  overflow: hidden;
}
.co-overlay.co-minimized .co-tabs,
.co-overlay.co-minimized .co-body,
.co-overlay.co-minimized .co-input-bar,
.co-overlay.co-minimized .co-upload-preview {
  display: none;
}

.co-overlay.co-with-sidebar {
  width: 680px;
}

/* 모니터 모드 (채팅 입력 바 없음, 더 컴팩트) */
.co-overlay.co-monitor {
  width: 340px;
  max-height: 480px;
  z-index: 10020;
}

.co-overlay.co-embedded {
  position: relative;
  left: auto;
  right: auto;
  top: auto;
  bottom: auto;
  width: 100%;
  max-height: 320px;
  margin: 8px 0;
  border-radius: 10px;
  z-index: 11;
}

.co-overlay.co-embedded .co-header {
  cursor: default;
}

/* ── 헤더 (드래그 핸들) ─────────────────────────────── */
.co-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #16213e;
  cursor: move;
  user-select: none;
  flex-shrink: 0;
  border-bottom: 1px solid #0f3460;
}

.co-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
}

.co-header-left .co-status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 6px #22c55e;
}
.co-header-left .co-status-dot.co-offline {
  background: #6b7280;
  box-shadow: none;
}
.co-header-left .co-live-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 6px #ef4444;
  animation: co-pulse 1.5s infinite;
  display: none;
}
.co-header-left .co-live-dot.co-live-active {
  display: inline-block;
}
@keyframes co-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.co-header-actions {
  display: flex;
  gap: 4px;
}

.co-header-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  width: 28px; height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
}
.co-header-btn:hover {
  background: #334155;
  color: #fff;
}

/* 참여자 수 뱃지 */
.co-member-badge {
  font-size: 11px;
  color: #94a3b8;
  background: #0f172a;
  padding: 2px 7px;
  border-radius: 10px;
}

/* ── 탭 바 ──────────────────────────────────────────── */
.co-tabs {
  display: flex;
  background: #111827;
  flex-shrink: 0;
}

.co-tab {
  flex: 1;
  padding: 7px 0;
  text-align: center;
  font-size: 11px;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
  border: none;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  background: none;
}
.co-tab:hover { color: #94a3b8; }
.co-tab.co-tab-active {
  color: #60a5fa;
  border-bottom-color: #3b82f6;
}

/* ── 본문 (탭 패널 래퍼) ────────────────────────────── */
.co-body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.co-main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ── 탭 패널 공통 ───────────────────────────────────── */
.co-pane {
  flex: 1;
  overflow-y: auto;
  display: none;
}
.co-pane.co-pane-active {
  display: flex;
  flex-direction: column;
}

/* ── 채팅 패널 ──────────────────────────────────────── */
.co-messages {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.co-msg {
  max-width: 85%;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.co-msg-other { align-self: flex-start; }
.co-msg-mine  { align-self: flex-end; }

.co-msg-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #64748b;
}
.co-msg-mine .co-msg-header {
  justify-content: flex-end;
}

.co-msg-type-icon {
  font-size: 12px;
}

.co-msg-bubble {
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
}

.co-msg-other .co-msg-bubble {
  background: #0f172a;
  border-top-left-radius: 4px;
}
.co-msg-mine .co-msg-bubble {
  background: #1e3a5f;
  border-top-right-radius: 4px;
}

/* 음성 메시지 스타일 */
.co-msg-voice .co-msg-bubble {
  border-left: 2px solid #22c55e;
}

/* interim (실시간 인식중) */
.co-msg-interim {
  align-self: flex-start;
  max-width: 85%;
}
.co-msg-interim .co-msg-bubble {
  background: rgba(59, 130, 246, 0.08);
  border-left: 2px solid #3b82f6;
  opacity: 0.7;
  font-style: italic;
  color: #94a3b8;
}

/* 시스템 메시지 */
.co-msg-system {
  align-self: center;
  max-width: 90%;
  text-align: center;
  font-size: 11px;
  color: #64748b;
  padding: 4px 10px;
  background: #0f172a;
  border-radius: 8px;
}

/* 새 메시지 알림 바 */
.co-new-msg-bar {
  text-align: center;
  padding: 4px;
  background: #172554;
  color: #60a5fa;
  font-size: 11px;
  cursor: pointer;
  display: none;
  flex-shrink: 0;
}
.co-new-msg-bar:hover { background: #1e3a5f; }

/* ── 이미지/파일 메시지 ────────────────────────────── */
.co-msg-img {
  max-width: 220px;
  max-height: 180px;
  border-radius: 8px;
  cursor: pointer;
  display: block;
  margin-bottom: 4px;
}
.co-msg-file-link {
  display: inline-block;
  padding: 6px 10px;
  background: rgba(59,130,246,0.12);
  border-radius: 6px;
  color: #60a5fa;
  font-size: 12px;
  text-decoration: none;
  margin-bottom: 4px;
  word-break: break-all;
}
.co-msg-file-link:hover { background: rgba(59,130,246,0.22); }

/* ── 업로드 프리뷰 ────────────────────────────────── */
.co-upload-preview {
  padding: 6px 12px;
  background: #0f172a;
  border-top: 1px solid #0f3460;
  flex-shrink: 0;
}
.co-preview-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.co-preview-name {
  font-size: 12px;
  color: #94a3b8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.co-preview-cancel {
  background: transparent;
  border: none;
  color: #ef4444;
  cursor: pointer;
  font-size: 14px;
  flex-shrink: 0;
}
.co-upload-progress {
  margin-top: 4px;
  height: 3px;
  background: #1e293b;
  border-radius: 2px;
  overflow: hidden;
}
.co-progress-bar {
  height: 100%;
  background: #3b82f6;
  transition: width 0.2s;
}

/* ── 입력 바 ────────────────────────────────────────── */
.co-input-bar {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  background: #16213e;
  border-top: 1px solid #0f3460;
  flex-shrink: 0;
}

.co-attach-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}
.co-attach-btn:hover { color: #fff; background: #334155; }

.co-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #334155;
  border-radius: 20px;
  background: #0f172a;
  color: #e0e0e0;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}
.co-input:focus { border-color: #3b82f6; }
.co-input::placeholder { color: #64748b; }

.co-send-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: none;
  background: #3b82f6;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  transition: background 0.15s;
}
.co-send-btn:hover { background: #2563eb; }
.co-send-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── 오디오 레벨 패널 ──────────────────────────────── */
.co-levels {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
}

.co-level-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.co-level-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
  position: relative;
}

.co-level-avatar.co-speaking {
  box-shadow: 0 0 0 2px #22c55e, 0 0 10px rgba(34,197,94,0.4);
}

.co-level-avatar.co-muted::after {
  content: '';
  position: absolute;
  width: 3px; height: 18px;
  background: #ef4444;
  border-radius: 2px;
  transform: rotate(45deg);
}

.co-level-info {
  flex: 1;
  min-width: 0;
}

.co-level-name {
  font-size: 12px;
  font-weight: 500;
  color: #e0e0e0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.co-level-name .co-me-tag {
  font-size: 9px;
  color: #3b82f6;
  margin-left: 4px;
}

.co-level-bar-bg {
  height: 4px;
  background: #1e293b;
  border-radius: 2px;
  margin-top: 3px;
  overflow: hidden;
}

.co-level-bar {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, #22c55e, #84cc16);
  width: 0%;
  transition: width 0.08s linear;
}

.co-level-bar.co-bar-high {
  background: linear-gradient(90deg, #f59e0b, #ef4444);
}

.co-level-db {
  font-size: 10px;
  color: #64748b;
  width: 32px;
  text-align: right;
  flex-shrink: 0;
}

.co-levels-empty,
.co-stt-empty {
  text-align: center;
  color: #64748b;
  font-size: 12px;
  padding: 30px 0;
}

/* ── STT 자막 패널 ─────────────────────────────────── */
.co-stt-lines {
  padding: 10px 12px;
}

.co-stt-line {
  display: flex;
  gap: 6px;
  padding: 4px 0;
  font-size: 12px;
  line-height: 1.5;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.co-stt-nick {
  font-weight: 600;
  flex-shrink: 0;
  white-space: nowrap;
}

.co-stt-text {
  flex: 1;
  word-break: break-word;
}

.co-stt-time {
  font-size: 10px;
  color: #475569;
  flex-shrink: 0;
  align-self: flex-end;
}

.co-stt-interim {
  opacity: 0.55;
  font-style: italic;
}

.co-stt-indicator {
  font-size: 10px;
  color: #3b82f6;
  margin-left: 4px;
}

/* ── 합의 사이드바 ──────────────────────────────────── */
.co-sidebar {
  width: 300px;
  border-left: 1px solid #0f3460;
  display: none;
  flex-direction: column;
  background: #111827;
}
.co-overlay.co-with-sidebar .co-sidebar {
  display: flex;
}

.co-sidebar-header {
  padding: 10px 14px;
  background: #16213e;
  border-bottom: 1px solid #0f3460;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.co-sidebar-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}

.co-sidebar-empty {
  text-align: center;
  padding: 30px 10px;
  color: #64748b;
  font-size: 12px;
}

.co-agreement-item {
  padding: 8px 10px;
  margin-bottom: 4px;
  background: #0f172a;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s;
}
.co-agreement-item:hover { background: #1e293b; }
.co-agreement-item-title {
  font-weight: 500;
  color: #e0e0e0;
  margin-bottom: 2px;
}
.co-agreement-item-status {
  font-size: 10px;
  color: #64748b;
}

/* ── 반응형 ─────────────────────────────────────────── */
@media (max-width: 767px) {
  .co-overlay {
    width: calc(100vw - 16px);
    right: 8px;
    bottom: 8px;
    max-height: 70vh;
    border-radius: 12px;
  }
  .co-overlay.co-with-sidebar {
    width: calc(100vw - 16px);
  }
  .co-sidebar { width: 50%; }
}

/* static/css/theme_common.css */
/* User-selectable application theme. Geometry and component ownership stay in their source CSS. */
.app-theme-control {
    display: grid;
    gap: 8px;
    padding: 10px 14px;
    border-block: 1px solid var(--color-border, #e2e8f0);
    background: var(--color-surface, #ffffff);
}

.app-theme-control--auth {
    margin: 0 0 14px;
    border: 1px solid var(--color-border, #e2e8f0);
    border-radius: 10px;
}

.app-theme-control__label {
    color: var(--color-text, #1e293b);
    font-size: 0.86rem;
    font-weight: 750;
}

.app-theme-control__options {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    min-width: 0;
}

.app-theme-control__option {
    min-width: 0;
    min-height: 44px;
    padding: 8px 6px;
    border: 1px solid var(--color-border, #cbd5e1);
    border-radius: 8px;
    background: var(--color-surface, #ffffff);
    color: #173f5b;
    font: inherit;
    font-size: 0.84rem;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
}

.app-theme-control__option:hover {
    border-color: color-mix(in srgb, var(--color-primary, #4a90d9) 68%, var(--color-border, #cbd5e1));
    background: color-mix(in srgb, var(--color-primary, #4a90d9) 8%, var(--color-surface, #ffffff));
}

.app-theme-control__option[aria-pressed="true"] {
    border-color: #4a90d9;
    background: #e7f1ff;
    color: #123d6b;
    box-shadow: inset 0 0 0 1px color-mix(in srgb, #4a90d9 26%, transparent);
}

.app-theme-control__status {
    grid-column: 1 / -1;
    color: var(--color-text-secondary, #64748b);
    font-size: 0.7rem;
    line-height: 1.45;
}

.app-theme-control__option:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--color-primary, #4a90d9) 55%, transparent);
    outline-offset: 2px;
}

/* Keep the short theme fade above the page without swallowing input. */
::view-transition {
    pointer-events: none;
}

::view-transition-old(root) {
    animation: app-theme-fade-out 240ms ease-out both;
}

::view-transition-new(root) {
    animation: app-theme-fade-in 240ms ease-out both;
}

@keyframes app-theme-fade-out {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes app-theme-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (max-width: 767px) {
    .app-theme-control__options {
        gap: 5px;
    }
}

@media (prefers-reduced-motion: reduce) {
    ::view-transition-old(root),
    ::view-transition-new(root) {
        animation: none !important;
    }

    html[data-theme] *,
    html[data-theme] *::before,
    html[data-theme] *::after {
        transition-duration: 0.01ms !important;
    }
}

