/* HOUSBE Deal Room — compact chat (2026-11-11)
   Rows rendered by js/hb-compact-chat.js. Spec: HOUSBE_Compact_Chat_Developer_Specification
   ("selected design 1"). New class names (hbc-*) so none of the old glass-card
   rules in assets/css/deal-room-shell.css (.msg-row / .bubble / .sender-line)
   reach these rows. Where a row reuses an old hook class for its handler
   (.msg-viewer-summary, .editMsgVisibility, .askConcierge) the old styling is
   overridden here with a more specific selector. */

#deal-chat-view {
    --hbc-text: #eef2fb;
    --hbc-meta: #9aa7bd;
    --hbc-line: rgba(255, 255, 255, 0.07);
    --hbc-gold: #e5c158;
    --hbc-gold-2: #f1c453;
    --hbc-surface: rgba(255, 255, 255, 0.04);
}

/* ── list ─────────────────────────────────────────────────────────────── */
#deal-chat-view .chat-messages-area.hbc-list {
    gap: 0 !important;
    padding: 4px 0 12px !important;
    scroll-padding-bottom: 12px;
    overscroll-behavior: contain;
}

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

/* ── row ──────────────────────────────────────────────────────────────── */
#deal-chat-view .hbc-row {
    position: relative;
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr) 44px;
    column-gap: 10px;
    align-items: start;
    padding: 9px 4px 9px 16px;
    margin: 0;
    color: var(--hbc-text);
    border-top: 1px solid var(--hbc-line);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    flex: 0 0 auto;
}
#deal-chat-view .hbc-list > .hbc-row:first-child,
#deal-chat-view .hbc-day + .hbc-row,
#deal-chat-view .hbc-start + .hbc-row,
#deal-chat-view .hbc-older + .hbc-row {
    border-top-color: transparent;
}
/* subtle sender accent: a thin rail on the left edge */
#deal-chat-view .hbc-row::before {
    content: "";
    position: absolute;
    left: 0; top: 8px; bottom: 8px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--hbc-ac, #3b82f6);
    opacity: .85;
}
@media (hover: hover) {
    #deal-chat-view .hbc-row:not(.is-open):hover { background: rgba(255, 255, 255, 0.025); }
}
/* only the expanded row is highlighted */
#deal-chat-view .hbc-row.is-open {
    background: color-mix(in srgb, var(--hbc-gold) 6%, transparent);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--hbc-gold) 45%, transparent);
    border-radius: 12px;
    border-top-color: transparent;
    margin: 2px 6px;
    padding-left: 12px;
}
#deal-chat-view .hbc-row.is-open + .hbc-row { border-top-color: transparent; }
#deal-chat-view .hbc-row.is-open::before { left: 0; top: 10px; bottom: 10px; }

/* avatar */
#deal-chat-view .hbc-av {
    grid-column: 1;
    position: relative;
    width: 32px; height: 32px;
    border-radius: 50%;
    overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    margin-top: 1px;
    flex-shrink: 0;
}
#deal-chat-view .hbc-av b {
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: .2px;
    line-height: 1;
}
#deal-chat-view .hbc-av img {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    object-fit: cover;
}
#deal-chat-view .hbc-av.is-locked {
    background: #1e293b;
    color: #8a94a6;
    font-size: 13px;
}
#deal-chat-view .hbc-row.is-self .hbc-av { color: #1a1205; }

/* main column */
#deal-chat-view .hbc-main {
    grid-column: 2;
    min-width: 0;
}
#deal-chat-view .hbc-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: 7px;
    row-gap: 2px;
    min-width: 0;
    font-size: 12.5px;
    line-height: 1.35;
    color: var(--hbc-meta);
}
#deal-chat-view .hbc-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--hbc-ac, #7cb4ff);
    min-width: 0;
    overflow-wrap: anywhere;
}
#deal-chat-view .hbc-row.is-self .hbc-name { color: var(--hbc-gold-2); }
#deal-chat-view .hbc-row.is-restricted .hbc-name { color: #8a94a6; font-weight: 600; }
#deal-chat-view .hbc-you { font-weight: 600; opacity: .9; }
#deal-chat-view .hbc-time { white-space: nowrap; font-weight: 500; }
#deal-chat-view .hbc-time::before { content: "\2022"; margin-right: 6px; opacity: .6; }
#deal-chat-view .hbc-edited { font-style: italic; white-space: nowrap; }
#deal-chat-view .hbc-flags {
    margin-left: auto;
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 2px 8px;
    max-width: 100%;
    white-space: nowrap;
}
#deal-chat-view .hbc-aud,
#deal-chat-view .hbc-lock,
#deal-chat-view .hbc-sent {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--hbc-meta);
}
#deal-chat-view .hbc-aud i,
#deal-chat-view .hbc-lock i,
#deal-chat-view .hbc-sent i { font-size: 11.5px; }
#deal-chat-view .hbc-lock { color: var(--hbc-gold); }
#deal-chat-view .hbc-sent { color: var(--hbc-gold); }
#deal-chat-view .hbc-dtag {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .3px;
    text-transform: uppercase;
    color: var(--hbc-gold);
    border: 1px solid color-mix(in srgb, var(--hbc-gold) 45%, transparent);
    border-radius: 999px;
    padding: 0 6px;
    line-height: 16px;
}

/* body: text as text, line breaks kept, selectable */
#deal-chat-view .hbc-body {
    margin: 2px 0 0;
    font-size: 15.5px;
    font-weight: 400;
    line-height: 1.4;
    color: var(--hbc-text);
    text-shadow: none;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: normal;
    -webkit-user-select: text;
    user-select: text;
    cursor: text;
}
#deal-chat-view .hbc-body.is-clamped {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    overflow: hidden;
}
#deal-chat-view .hbc-body.is-muted {
    color: #8a94a6;
    font-style: italic;
    cursor: inherit;
}
#deal-chat-view .hbc-more,
#deal-chat-view .hbc-linkbtn {
    background: none;
    border: 0;
    padding: 4px 0;
    margin: 0;
    min-height: 32px;
    color: var(--hbc-gold) !important;
    font-size: 14px !important;
    font-weight: 700;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
}
#deal-chat-view .hbc-more[hidden] { display: none; }

/* attachment */
#deal-chat-view .hbc-file {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
    padding: 6px 6px 6px 8px;
    border-radius: 10px;
    background: var(--hbc-surface);
    border: 1px solid rgba(255, 255, 255, 0.08);
    cursor: auto;
    max-width: 520px;
}
#deal-chat-view .hbc-file-ic {
    width: 32px; height: 32px;
    border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    background: color-mix(in srgb, var(--hbc-ac, #3b82f6) 18%, transparent);
    color: var(--hbc-ac, #7cb4ff);
    flex-shrink: 0;
}
#deal-chat-view .hbc-file-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1 1 96px;
}
#deal-chat-view .hbc-file-name {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--hbc-text);
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
}
#deal-chat-view .hbc-file-kind { font-size: 12.5px; color: var(--hbc-meta); }
#deal-chat-view .hbc-file-acts { display: flex; gap: 4px; flex-shrink: 0; margin-left: auto; }
#deal-chat-view .hbc-file-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.05);
    color: #e2e8f0 !important;
    font-size: 13.5px !important;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}
#deal-chat-view .hbc-file-btn:hover { border-color: color-mix(in srgb, var(--hbc-gold) 50%, transparent); }
#deal-chat-view .hbc-main .hb-tl-chip { margin-top: 6px; }

/* chevron — 44 × 44 target, small artwork */
#deal-chat-view .hbc-tog {
    grid-column: 3;
    grid-row: 1;
    align-self: start;
    width: 44px; height: 44px;
    margin: -6px 0 -6px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #b7c2d6;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer;
}
#deal-chat-view .hbc-tog i { font-size: 14px; transition: transform .18s ease; }
#deal-chat-view .hbc-tog:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
#deal-chat-view .hbc-row.is-open .hbc-tog { color: var(--hbc-gold); }

/* ── details area ─────────────────────────────────────────────────────── */
#deal-chat-view .hbc-details {
    grid-column: 1 / -1;
    margin: 8px 8px 2px 0;
    cursor: auto;
    animation: hbcReveal .18s ease-out both;
}
#deal-chat-view .hbc-details[hidden] { display: none; }
@keyframes hbcReveal {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: none; }
}
#deal-chat-view .hbc-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 6px 16px;
    margin: 0 0 8px;
    padding: 0 0 0 42px;
    font-size: 13px;
    line-height: 1.35;
}
#deal-chat-view .hbc-facts > div { min-width: 0; }
#deal-chat-view .hbc-facts dt {
    color: var(--hbc-meta);
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .4px;
    text-transform: uppercase;
    margin: 0;
}
#deal-chat-view .hbc-facts dd {
    margin: 1px 0 0;
    color: #dfe6f3;
    overflow-wrap: anywhere;
}
#deal-chat-view .hbc-facts dd i { font-size: 11px; color: var(--hbc-gold); margin-right: 2px; }

#deal-chat-view .hbc-xinfo {
    margin: 0 0 8px 42px;
    padding: 8px 10px;
    border-radius: 10px;
    background: var(--hbc-surface);
    border: 1px solid rgba(255, 255, 255, 0.08);
}
#deal-chat-view .hbc-xinfo-h {
    display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px;
    font-size: 12.5px; font-weight: 700; color: var(--hbc-gold);
}
#deal-chat-view .hbc-xinfo-h span { font-weight: 500; color: var(--hbc-meta); }
#deal-chat-view .hbc-xinfo-b {
    margin: 4px 0 0;
    font-size: 14.5px;
    line-height: 1.4;
    color: var(--hbc-text);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    -webkit-user-select: text; user-select: text;
}

/* actions: one toolbar on wide screens, wrapping onto rows on phones */
#deal-chat-view .hbc-acts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-left: 42px;
}
#deal-chat-view .hbc-acts .hbc-act,
#deal-chat-view .hbc-acts .hbc-act.msg-viewer-summary,
#deal-chat-view .hbc-acts .hbc-act.editMsgVisibility,
#deal-chat-view .hbc-acts .hbc-act.askConcierge {
    position: static !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 40px;
    margin: 0 !important;
    padding: 0 14px !important;
    border-radius: 10px !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    background: rgba(255, 255, 255, 0.05) !important;
    box-shadow: none !important;
    color: #e6ecf6 !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    line-height: 1.2 !important;
    white-space: normal !important;
    text-align: left;
    cursor: pointer;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    flex: 0 1 auto !important;
}
#deal-chat-view .hbc-acts .hbc-act i { font-size: 13px; color: inherit !important; }
#deal-chat-view .hbc-acts .hbc-act:hover {
    border-color: color-mix(in srgb, var(--hbc-gold) 55%, transparent) !important;
    background: rgba(255, 255, 255, 0.08) !important;
}
#deal-chat-view .hbc-acts .hbc-act.askConcierge,
#deal-chat-view .hbc-acts .hbc-act.editMsgVisibility { color: var(--hbc-gold) !important; }
#deal-chat-view .hbc-acts .hbc-act.hbc-act-edit { color: #f3e2b3 !important; }

/* editors */
#deal-chat-view .hbc-editor {
    margin: 6px 0 8px;
    cursor: auto;
}
#deal-chat-view .hbc-details .hbc-editor { margin-left: 42px; }
#deal-chat-view .hbc-ed-label {
    display: block;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--hbc-meta);
    margin: 0 0 4px;
}
#deal-chat-view .hbc-ta {
    display: block;
    width: 100%;
    box-sizing: border-box;
    min-height: 64px;
    padding: 9px 11px;
    border-radius: 10px;
    border: 1px solid color-mix(in srgb, var(--hbc-gold) 45%, transparent);
    background: #0b1420;
    color: #fff;
    font: inherit;
    font-size: 16px !important;     /* 16px: iOS does not zoom the page on focus */
    line-height: 1.4 !important;
    resize: vertical;
}
#deal-chat-view .hbc-ta:focus { outline: 2px solid var(--hbc-gold); outline-offset: 1px; }
#deal-chat-view .hbc-ed-hint { font-size: 12.5px; color: var(--hbc-meta); margin-top: 4px; }
#deal-chat-view .hbc-ed-msg { min-height: 0; font-size: 13px; color: var(--hbc-meta); margin-top: 4px; }
#deal-chat-view .hbc-ed-msg:empty { display: none; }
#deal-chat-view .hbc-ed-msg.is-err { color: #fca5a5; }
#deal-chat-view .hbc-ed-btns {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
}
#deal-chat-view .hbc-btn {
    min-height: 40px;
    padding: 0 16px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: #1e293b;
    color: #e2e8f0 !important;
    font-size: 14px !important;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
#deal-chat-view .hbc-btn-gold {
    background: linear-gradient(135deg, #f3e2b3 0%, #e5c158 55%, #caa63f 100%);
    border-color: transparent;
    color: #1a1205 !important;
}
#deal-chat-view .hbc-btn-gold i { color: #1a1205 !important; }
#deal-chat-view .hbc-btn[disabled] { opacity: .55; cursor: not-allowed; }
#deal-chat-view .hbc-btn-danger { border-color: rgba(248, 113, 113, 0.5); color: #fecaca !important; }
#deal-chat-view .hbc-ed-conflict {
    margin-top: 8px;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid rgba(251, 191, 36, 0.45);
    background: rgba(251, 191, 36, 0.08);
    font-size: 13.5px;
    color: #fde68a;
}
#deal-chat-view .hbc-ed-conflict[hidden] { display: none; }
#deal-chat-view .hbc-ed-conflict p { margin: 0 0 6px; }
#deal-chat-view .hbc-ed-conflict blockquote {
    margin: 0;
    padding: 6px 8px;
    border-left: 3px solid rgba(251, 191, 36, 0.6);
    color: var(--hbc-text);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    max-height: 140px;
    overflow: auto;
}
#deal-chat-view .hbc-guard {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 12px;
    margin: 8px 0 0 42px;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid rgba(248, 113, 113, 0.4);
    background: rgba(248, 113, 113, 0.08);
    font-size: 13.5px;
    color: #fecaca;
}
#deal-chat-view .hbc-guard-btns { display: flex; flex-wrap: wrap; gap: 8px; }

/* ── list furniture ───────────────────────────────────────────────────── */
#deal-chat-view .hbc-day {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px 4px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .4px;
    text-transform: uppercase;
    color: var(--hbc-meta);
    flex: 0 0 auto;
}
#deal-chat-view .hbc-day::before,
#deal-chat-view .hbc-day::after {
    content: "";
    flex: 1 1 auto;
    height: 1px;
    background: var(--hbc-line);
}
#deal-chat-view .hbc-start,
#deal-chat-view .hbc-older {
    text-align: center;
    font-size: 12.5px;
    color: var(--hbc-meta);
    padding: 10px 16px 2px;
    flex: 0 0 auto;
}
#deal-chat-view .hbc-newpill {
    position: absolute;
    left: 50%;
    bottom: 12px;
    transform: translateX(-50%);
    z-index: 5;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 16px;
    border-radius: 999px;
    border: 0;
    background: linear-gradient(135deg, #f3e2b3 0%, #e5c158 55%, #caa63f 100%);
    color: #1a1205 !important;
    font-size: 14px !important;
    font-weight: 700;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
    cursor: pointer;
}
#deal-chat-view .hbc-newpill i { color: #1a1205 !important; }
#deal-chat-view .hbc-newpill[hidden] { display: none; }

/* focus that can be seen */
#deal-chat-view .hbc-row button:focus-visible,
#deal-chat-view .hbc-row a:focus-visible,
#deal-chat-view .hbc-newpill:focus-visible {
    outline: 2px solid var(--hbc-gold) !important;
    outline-offset: 2px;
}

/* ── phones ───────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    #deal-chat-view .hbc-row { padding: 9px 2px 9px 12px; column-gap: 8px; }
    #deal-chat-view .hbc-row.is-open { margin: 2px 4px; padding-left: 10px; }
    #deal-chat-view .hbc-facts,
    #deal-chat-view .hbc-acts,
    #deal-chat-view .hbc-xinfo,
    #deal-chat-view .hbc-guard,
    #deal-chat-view .hbc-details .hbc-editor { margin-left: 0; padding-left: 0; }
    #deal-chat-view .hbc-xinfo { padding-left: 10px; }
    #deal-chat-view .hbc-guard { padding-left: 10px; }
    #deal-chat-view .hbc-details { margin-right: 6px; }
    #deal-chat-view .hbc-facts { grid-template-columns: 1fr 1fr; }
    /* two readable columns of actions — never one squeezed toolbar */
    #deal-chat-view .hbc-acts {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
    #deal-chat-view .hbc-acts .hbc-act,
    #deal-chat-view .hbc-acts .hbc-act.msg-viewer-summary,
    #deal-chat-view .hbc-acts .hbc-act.editMsgVisibility,
    #deal-chat-view .hbc-acts .hbc-act.askConcierge {
        min-height: 44px;
        padding: 0 10px !important;
        justify-content: flex-start;
        font-size: 14px !important;
    }
    #deal-chat-view .hbc-btn { min-height: 44px; }
}
@media (max-width: 359px) {
    #deal-chat-view .hbc-facts { grid-template-columns: 1fr; }
    #deal-chat-view .hbc-acts { grid-template-columns: 1fr; }
}
@media (pointer: coarse) {
    #deal-chat-view .hbc-acts .hbc-act,
    #deal-chat-view .hbc-acts .hbc-act.msg-viewer-summary,
    #deal-chat-view .hbc-acts .hbc-act.editMsgVisibility,
    #deal-chat-view .hbc-acts .hbc-act.askConcierge,
    #deal-chat-view .hbc-btn { min-height: 44px; }
    #deal-chat-view .hbc-file-btn { width: 44px; height: 44px; }
    #deal-chat-view .hbc-more { min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
    #deal-chat-view .hbc-details { animation: none; }
    #deal-chat-view .hbc-tog i { transition: none; }
}

/* ── surrounding controls: compact spacing on phones ─────────────────── */
@media (max-width: 600px) {
    /* Participants strip: "Invite Participants" becomes "Invite" */
    #tempChatPartsBar .tcp-inv-more { display: none; }
    #tempChatPartsBar .add-temp-participant {
        min-height: 40px;
        padding: 0 16px !important;
    }
    /* privacy prompt: the switch itself shows the state; the ON / OFF
       legend is dropped so the composer keeps room for the text field */
    #deal-chat-view .msg-visibility-toggle .msg-visibility-lbl { display: none !important; }
    /* the short label leaves room for the icon again on the smallest phones */
    #tempChatPartsBar > div > .add-temp-participant > i { display: inline-block !important; }
}
/* composer: 44 x 44 touch targets for the paperclip and Send on phones and
   touch screens (the artwork stays small) */
@media (max-width: 600px), (pointer: coarse) {
    #deal-chat-view .chat-input-box .chat-action-btn {
        width: 44px !important;
        height: 44px !important;
    }
    #deal-chat-view .chat-input-box .btn-send {
        height: 44px !important;
        min-width: 44px;
    }
    #deal-chat-view .chat-input-box {
        padding-top: 4px !important;
        padding-bottom: 4px !important;
    }
}
