/* ============================================================================
   Breeze Fluid Messenger — Desktop theme layer
   Loaded AFTER style.css, so equal-specificity rules here win the cascade.
   `!important` appears only where an inline style (written by script.js) or a
   legacy high-specificity rule must be beaten.

   Design language: organic minimalism × translucent glassmorphism.
   No hard 1px grey dividers as separation — separation comes from negative
   space, layered frosted plates and a whisper of ambient sage.
   ========================================================================== */

/* ============================================================================
   01 · SHELL — full-bleed grid: topbar / (rail · list · chat · drawer) / footbar
   ========================================================================== */

body {
    background-color: var(--bz-background);
    background-image:
        radial-gradient(circle at 12% 0%, rgba(215, 233, 222, 0.60) 0%, rgba(244, 247, 244, 0) 46%),
        radial-gradient(circle at 88% 8%, rgba(224, 233, 242, 0.50) 0%, rgba(244, 247, 244, 0) 44%),
        radial-gradient(circle at 78% 100%, rgba(243, 239, 239, 0.60) 0%, rgba(244, 247, 244, 0) 48%),
        radial-gradient(circle at 0% 92%, rgba(226, 238, 229, 0.45) 0%, rgba(244, 247, 244, 0) 42%);
    background-attachment: fixed;
    font-family: var(--bz-font-body);
    color: var(--bz-on-surface);
}

/* JS writes style="display:flex" inline on login (script.js:1148); !important
   converts it into a grid without touching the auth gate. */
#app-container[style*="flex"] {
    display: grid !important;
    grid-template-columns: var(--bz-rail-w) var(--bz-list-w) minmax(0, 1fr) auto;
    grid-template-rows: var(--bz-topbar-h) minmax(0, 1fr) var(--bz-footbar-h);
    width: 100vw;
    height: 100vh;
    min-width: 0;
    max-width: none;
    max-height: none;
    border-radius: 0;
    overflow: hidden;
    background: transparent;
    box-shadow: none;
    position: relative;
    transition: grid-template-columns var(--bz-dur) var(--bz-ease);
}

/* Rail owns the full left column (mock has the logo at the very top of the
   spine, flush with the viewport); the topbar starts to the right of it. */
#app-container > .bz-topbar { grid-area: 1 / 2 / 2 / -1; }
#app-container > .wechat-rail { grid-area: 1 / 1 / 3 / 2; }
#app-container > .sidebar { grid-area: 2 / 2 / 3 / 3; }
#app-container > .chat-area { grid-area: 2 / 3 / 3 / 4; }
#app-container > .detail-panel { grid-area: 2 / 4 / 3 / 5; }
#app-container > .bz-footbar { grid-area: 3 / 1 / 4 / -1; }

/* ============================================================================
   02 · TOPBAR — the quiet identity band
   ========================================================================== */

.bz-topbar {
    display: flex;
    align-items: center;
    gap: var(--bz-space-md);
    padding: 0 var(--bz-space-lg) 0 var(--bz-space-md);
    background: rgba(252, 253, 252, 0.66);
    backdrop-filter: var(--bz-blur-panel);
    -webkit-backdrop-filter: var(--bz-blur-panel);
    border-bottom: 1px solid var(--bz-hairline-soft);
    position: relative;
    z-index: 30;
}

.bz-brand {
    display: flex;
    align-items: center;
    gap: 9px;
}

.bz-brand-mark {
    width: 32px;
    height: 32px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    background: linear-gradient(150deg, var(--bz-primary-container), var(--bz-primary));
    box-shadow: var(--bz-shadow-sage), inset 0 1px 0 rgba(255, 255, 255, 0.35);
    color: var(--bz-on-primary);
    flex-shrink: 0;
}

.bz-brand-mark svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.bz-brand-name {
    display: block;
    font-family: var(--bz-font-display);
    font-size: 1.0625rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    color: var(--bz-on-surface);
    line-height: 1.1;
}

/* "Flow OS 3.0" rides beside the wordmark as a soft uppercase chip */
.bz-brand-ver {
    display: inline-flex;
    align-items: center;
    height: 19px;
    padding: 0 8px;
    border-radius: var(--bz-r-pill);
    background: var(--bz-surface-container);
    font-family: var(--bz-font-body);
    font-size: 0.5625rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--bz-on-surface-variant);
    white-space: nowrap;
}

.bz-topbar-sep {
    width: 1px;
    height: 14px;
    flex: none;
    background: var(--bz-outline-variant);
    opacity: 0.55;
}

.bz-topbar-context {
    font-size: var(--bz-text-xs);
    color: var(--bz-on-surface-variant);
    letter-spacing: 0.02em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.bz-topbar-context::before { content: none; }

.bz-topbar-spacer { flex: 1; }

.bz-sync-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 30px;
    padding: 0 13px;
    border-radius: var(--bz-r-pill);
    background: rgba(255, 255, 255, 0.62);
    border: 1px solid var(--bz-hairline-soft);
    font-size: var(--bz-text-micro);
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--bz-on-surface-variant);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* the live latency: "· 延迟 12ms" — number gets tabular figures so the pill
   does not twitch every time it re-samples */
.bz-sync-lat {
    color: var(--bz-outline);
    transition: opacity var(--bz-dur) var(--bz-ease);
}

.bz-sync-lat b {
    font-weight: 700;
    font-size: 0.6875rem;
    color: var(--bz-on-surface-variant);
    font-variant-numeric: tabular-nums;
    min-width: 2ch;
    display: inline-block;
    text-align: right;
}

.bz-sync-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #58a173;
    box-shadow: 0 0 0 3px rgba(88, 161, 115, 0.16);
    animation: bz-breathe 3.4s var(--bz-ease-soft) infinite;
    transition: background var(--bz-dur) var(--bz-ease),
                box-shadow var(--bz-dur) var(--bz-ease);
}

@keyframes bz-breathe {
    0%, 100% { box-shadow: 0 0 0 3px rgba(88, 161, 115, 0.16); }
    50% { box-shadow: 0 0 0 5px rgba(88, 161, 115, 0.07); }
}

/* ---- signal states, written by breeze-sync.js --------------------------- */
.bz-sync-pill[data-state="slow"] .bz-sync-dot {
    background: var(--bz-warning);
    box-shadow: 0 0 0 3px rgba(181, 117, 31, 0.16);
    animation-name: bz-breathe-amber;
}

.bz-sync-pill[data-state="slow"] .bz-sync-lat b { color: var(--bz-warning); }

@keyframes bz-breathe-amber {
    0%, 100% { box-shadow: 0 0 0 3px rgba(181, 117, 31, 0.18); }
    50% { box-shadow: 0 0 0 5px rgba(181, 117, 31, 0.07); }
}

.bz-sync-pill[data-state="heavy"],
.bz-sync-pill[data-state="stalled"] {
    background: rgba(255, 218, 214, 0.55);
    border-color: rgba(186, 26, 26, 0.22);
    color: var(--bz-error);
}

.bz-sync-pill[data-state="heavy"] .bz-sync-dot,
.bz-sync-pill[data-state="stalled"] .bz-sync-dot {
    background: var(--bz-error);
    box-shadow: 0 0 0 3px rgba(186, 26, 26, 0.16);
    animation: none;
}

.bz-sync-pill[data-state="heavy"] .bz-sync-lat,
.bz-sync-pill[data-state="heavy"] .bz-sync-lat b,
.bz-sync-pill[data-state="stalled"] .bz-sync-lat,
.bz-sync-pill[data-state="stalled"] .bz-sync-lat b {
    color: var(--bz-error);
}

/* footer mirrors the same state */
.bz-footbar-dot[data-state="slow"] { background: var(--bz-warning); }
.bz-footbar-dot[data-state="heavy"],
.bz-footbar-dot[data-state="stalled"] { background: var(--bz-error); }
.bz-footbar b {
    font-weight: 600;
    color: var(--bz-on-surface-variant);
    font-variant-numeric: tabular-nums;
}

.bz-topbar-btn {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: var(--bz-r-sm);
    background: transparent;
    color: var(--bz-on-surface-variant);
    display: inline-grid;
    place-items: center;
    cursor: pointer;
    transition: background var(--bz-dur-fast) var(--bz-ease),
                color var(--bz-dur-fast) var(--bz-ease);
}

.bz-topbar-btn:hover {
    background: rgba(56, 82, 68, 0.07);
    color: var(--bz-primary);
}

.bz-topbar-btn svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ============================================================================
   03 · FOOTBAR — the whisper at the foot
   ========================================================================== */

.bz-footbar {
    display: flex;
    align-items: center;
    gap: var(--bz-space-md);
    padding: 0 var(--bz-space-lg);
    background: rgba(252, 253, 252, 0.5);
    backdrop-filter: var(--bz-blur-panel);
    -webkit-backdrop-filter: var(--bz-blur-panel);
    border-top: 1px solid var(--bz-hairline-soft);
    font-size: var(--bz-text-micro);
    letter-spacing: 0.03em;
    color: var(--bz-outline);
}

.bz-footbar-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.bz-footbar-sep {
    width: 1px;
    height: 10px;
    background: var(--bz-outline-variant);
    opacity: 0.6;
}

.bz-footbar-spacer { flex: 1; }

.bz-footbar-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #58a173;
}

/* ============================================================================
   04 · RAIL — the 72px spine
   ========================================================================== */

.wechat-rail {
    width: var(--bz-rail-w);
    min-width: var(--bz-rail-w);
    padding: 14px 0 16px;
    gap: 10px;
    background: rgba(250, 252, 250, 0.60);
    backdrop-filter: var(--bz-blur-panel);
    -webkit-backdrop-filter: var(--bz-blur-panel);
    border-right: 1px solid var(--bz-hairline-soft);
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 20;
}

/* the mock keeps the leaf tile at the very top of the spine */
.wechat-rail .bz-brand-mark {
    order: -1;
    width: 40px;
    height: 40px;
    border-radius: 13px;
    margin: 0 0 4px;
}

.wechat-rail .bz-brand-mark svg {
    width: 21px;
    height: 21px;
}

.rail-avatar {
    width: 44px;
    height: 44px;
    margin: 14px 0 0;
    border-radius: 15px;
    position: relative;
    order: 8;
    transition: transform var(--bz-dur) var(--bz-ease);
}

.rail-avatar:hover { transform: translateY(-1px) scale(1.03); }

.rail-avatar img {
    width: 44px;
    height: 44px;
    border-radius: 15px;
    object-fit: cover;
    /* a broken/absent image must not spill its alt text into the 44px tile */
    color: transparent;
    font-size: 0;
    box-shadow: 0 4px 12px -4px rgba(56, 82, 68, 0.28),
                inset 0 0 0 1px rgba(255, 255, 255, 0.6);
}

/* rail avatar doubles as .my-avatar-wrapper — kill the legacy absolute badge */
.rail-avatar .status-badge {
    top: auto;
    right: -3px;
    bottom: -3px;
    border: 2px solid rgba(250, 252, 250, 0.95);
}

.rail-btn {
    width: 44px;
    height: 44px;
    border-radius: 15px;
    color: var(--bz-outline);
    background: transparent;
    transition: color var(--bz-dur-fast) var(--bz-ease),
                background var(--bz-dur-fast) var(--bz-ease),
                box-shadow var(--bz-dur) var(--bz-ease),
                transform var(--bz-dur-fast) var(--bz-ease);
}

.rail-btn svg {
    width: 20px;
    height: 20px;
    stroke-width: 1.7;
}

.rail-btn:hover {
    background: rgba(56, 82, 68, 0.06);
    color: var(--bz-primary);
    transform: translateY(-1px);
}

.rail-btn.active {
    background: linear-gradient(150deg, var(--bz-primary-container), var(--bz-primary));
    color: var(--bz-on-primary);
    box-shadow: var(--bz-shadow-sage), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.rail-btn.active:hover { transform: none; }

.rail-bottom { margin-top: auto; order: 9; }

/* tooltips from the legacy sheet, re-dressed */
.rail-btn::after,
.icon-btn::after,
.header-icon::after,
.tool-btn::after {
    background: rgba(25, 31, 26, 0.88);
    backdrop-filter: blur(8px);
    color: #fff;
    font-size: 0.6875rem;
    letter-spacing: 0.02em;
    border-radius: var(--bz-r-sm);
    padding: 6px 9px;
    box-shadow: 0 6px 18px -6px rgba(0, 0, 0, 0.35);
}

#notice-dot {
    top: 9px;
    right: 9px;
    border-color: transparent;
    background: var(--bz-tertiary-soft);
    box-shadow: 0 0 0 2px rgba(250, 252, 250, 0.9);
}

/* ============================================================================
   05 · SIDEBAR / CONVERSATION LIST
   ========================================================================== */

.sidebar {
    width: var(--bz-list-w);
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: rgba(252, 253, 252, 0.52);
    backdrop-filter: var(--bz-blur-panel);
    -webkit-backdrop-filter: var(--bz-blur-panel);
    border-right: 1px solid var(--bz-hairline-soft);
    min-height: 0;
    overflow: hidden;
    position: relative;
}

/* mock order: title (+ its icon buttons) → search → chips → rows.
   The icon buttons live inside .list-header in the markup; they are lifted
   next to the title instead of rearranging the DOM. */
.list-title {
    order: 1;
    padding: 14px var(--bz-space-md) 10px;
}

.list-header {
    order: 2;
    height: auto;
    padding: 0 var(--bz-space-md) 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.header-actions {
    position: absolute;
    top: 12px;
    right: 10px;
    display: flex;
    gap: 2px;
    flex-shrink: 0;
    z-index: 2;
}

.bz-list-chips {
    order: 3;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 var(--bz-space-md) 12px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.bz-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 27px;
    padding: 0 11px;
    border: 1px solid var(--bz-hairline);
    border-radius: var(--bz-r-pill);
    background: rgba(255, 255, 255, 0.55);
    color: var(--bz-on-surface-variant);
    font-family: var(--bz-font-body);
    font-size: var(--bz-text-xs);
    font-weight: 500;
    letter-spacing: 0.01em;
    cursor: pointer;
    white-space: nowrap;
    transition: background var(--bz-dur-fast) var(--bz-ease),
                color var(--bz-dur-fast) var(--bz-ease),
                box-shadow var(--bz-dur) var(--bz-ease),
                border-color var(--bz-dur-fast) var(--bz-ease);
}

.bz-chip:hover {
    background: rgba(255, 255, 255, 0.9);
    color: var(--bz-primary);
    border-color: rgba(56, 82, 68, 0.24);
}

.bz-chip[aria-pressed="true"] {
    background: linear-gradient(150deg, var(--bz-primary-container), var(--bz-primary));
    border-color: transparent;
    color: var(--bz-on-primary);
    box-shadow: var(--bz-shadow-sage), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.bz-chip-count {
    font-variant-numeric: tabular-nums;
    opacity: 0.78;
    font-weight: 600;
}

.bz-chip[aria-pressed="true"] .bz-chip-count { opacity: 0.9; }

/* ---- the chips actually filter, via CSS on the list container ----------- */
#conversation-list[data-bz-filter="unread"] .user-item:not(:has(.badge)) { display: none; }
#conversation-list[data-bz-filter="pinned"] .user-item:not(:has(.pin-mark)) { display: none; }

/* search field: the keyboard hint from the mock */
.bz-search-kbd {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    height: 20px;
    padding: 0 6px;
    border-radius: 6px;
    border: 1px solid var(--bz-hairline);
    background: rgba(255, 255, 255, 0.7);
    color: var(--bz-outline);
    font-family: var(--bz-font-body);
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    pointer-events: none;
    z-index: 1;
}

.search-wrap input { padding-right: 44px; }
.search-wrap input:focus ~ .bz-search-kbd { opacity: 0; }

.search-wrap {
    flex: 1;
    margin-right: 0;
    position: relative;
    display: flex;
    align-items: center;
}

.search-wrap input {
    width: 100%;
    height: 40px;
    border: 1px solid transparent;
    border-radius: var(--bz-r-pill);
    background: rgba(255, 255, 255, 0.86);
    box-shadow: inset 0 1px 2px rgba(56, 82, 68, 0.05),
                0 1px 0 rgba(255, 255, 255, 0.9);
    padding: 0 16px 0 38px;
    color: var(--bz-on-surface);
    font-family: var(--bz-font-body);
    font-size: var(--bz-text-sm);
    letter-spacing: 0.01em;
    transition: box-shadow var(--bz-dur) var(--bz-ease),
                background var(--bz-dur-fast) var(--bz-ease);
}

/* magnifier, drawn in CSS so no markup change is needed */
.search-wrap::before {
    content: '';
    position: absolute;
    left: 14px;
    width: 11px;
    height: 11px;
    border: 1.6px solid var(--bz-outline);
    border-radius: 50%;
    opacity: 0.55;
    pointer-events: none;
    z-index: 1;
}

.search-wrap::after {
    content: '';
    position: absolute;
    left: 24px;
    top: 24px;
    width: 5px;
    height: 1.6px;
    background: var(--bz-outline);
    opacity: 0.55;
    transform: rotate(45deg);
    transform-origin: left center;
    pointer-events: none;
    z-index: 1;
}

.search-wrap input::placeholder {
    color: var(--bz-outline);
    opacity: 0.85;
}

.search-wrap input:focus {
    background: #fff;
    box-shadow: 0 0 0 1px rgba(56, 82, 68, 0.22),
                0 8px 22px -12px rgba(56, 82, 68, 0.32);
}

.search-wrap input::-webkit-search-cancel-button { -webkit-appearance: none; }

.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: transparent;
    color: var(--bz-on-surface-variant);
    transition: background var(--bz-dur-fast) var(--bz-ease),
                color var(--bz-dur-fast) var(--bz-ease);
}

.icon-btn:hover {
    background: rgba(56, 82, 68, 0.08);
    color: var(--bz-primary);
}

.icon-btn svg { stroke-width: 1.7; }

.user-list {
    order: 4;
    flex: 1;
    overflow-y: auto;
    padding: 0 10px 14px;
    min-height: 0;
    scroll-behavior: smooth;
}

/* ---- conversation row ---------------------------------------------------- */
.user-item {
    height: auto;
    min-height: 66px;
    padding: 10px 12px;
    border-bottom: 0;
    border-radius: 16px;
    margin-bottom: 3px;
    gap: 0;
    transition: background var(--bz-dur-fast) var(--bz-ease),
                box-shadow var(--bz-dur) var(--bz-ease),
                transform var(--bz-dur-fast) var(--bz-ease);
}

.user-item:hover {
    background: rgba(255, 255, 255, 0.66);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset;
}

/* the active conversation is a lifted white card, as in the mock */
.user-item.active {
    background: var(--bz-surface-lowest);
    box-shadow: 0 14px 30px -24px rgba(45, 55, 48, 0.65),
                0 0 0 1px var(--bz-hairline),
                inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.avatar-wrapper {
    width: 44px;
    height: 44px;
    margin-right: 12px;
    border-radius: 14px;
    flex-shrink: 0;
}

.avatar-wrapper img {
    border-radius: 14px;
    box-shadow: inset 0 0 0 1px rgba(203, 212, 205, 0.4);
}

.badge {
    top: -4px;
    right: -5px;
    height: 18px;
    min-width: 18px;
    padding: 0 5px;
    border-radius: var(--bz-r-pill);
    background: var(--bz-tertiary-soft);
    color: #fff;
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    border: 2px solid rgba(252, 253, 252, 0.95);
    box-shadow: 0 2px 6px -2px rgba(150, 98, 76, 0.5);
}

.user-item.is-muted .badge {
    background: var(--bz-outline-variant);
    color: var(--bz-on-surface-variant);
    box-shadow: none;
}

.user-info { min-width: 0; overflow: hidden; }

.info-top { margin-bottom: 3px; gap: 8px; min-width: 0; }

.info-bottom { min-width: 0; overflow: hidden; }

.user-name {
    font-size: var(--bz-text-body);
    font-weight: 600;
    color: var(--bz-on-surface);
    letter-spacing: -0.005em;
    max-width: none;
    flex: 1;
    min-width: 0;
}

.user-item.active .user-name { color: var(--bz-on-surface); }

/* legacy paints every text node white on the active row — re-tune the greys */
.user-item.active .preview-text { color: var(--bz-on-surface-variant); }
.user-item.active .msg-time-list { color: var(--bz-outline); }
.user-item.active .pin-mark,
.user-item.active .mute-mark {
    color: var(--bz-primary);
    background: rgba(56, 82, 68, 0.10);
}

.msg-time-list {
    font-size: var(--bz-text-micro);
    color: var(--bz-outline);
    flex-shrink: 0;
    letter-spacing: 0.01em;
}

.preview-text {
    font-size: var(--bz-text-sm);
    color: var(--bz-outline);
    max-width: none;
    width: 100%;
    line-height: 1.4;
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pin-mark,
.mute-mark {
    font-size: 0.625rem;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 5px;
    letter-spacing: 0.02em;
}

.pin-mark {
    background: var(--bz-primary-fixed);
    color: var(--bz-primary);
}

.mute-mark {
    background: var(--bz-surface-container);
    color: var(--bz-outline);
}

/* ---- friend requests / notices panel ------------------------------------- */
.request-panel { padding: 0 10px 14px; }

.request-panel-empty,
.request-list-empty {
    color: var(--bz-outline);
    font-size: var(--bz-text-sm);
    text-align: center;
    padding: 48px 16px;
    line-height: 1.7;
}

.request-item {
    height: auto;
    min-height: 72px;
    padding: 12px;
    gap: 12px;
    border-radius: var(--bz-r-lg);
    border-bottom: 0;
    transition: background var(--bz-dur-fast) var(--bz-ease);
}

.request-item:hover { background: rgba(255, 255, 255, 0.7); }

.request-item > img {
    width: 44px;
    height: 44px;
    border-radius: 14px;
}

.request-name {
    font-size: var(--bz-text-body);
    font-weight: 600;
    color: var(--bz-on-surface);
}

.request-desc {
    font-size: var(--bz-text-xs);
    color: var(--bz-outline);
    margin-top: 3px;
}

.req-actions { display: flex; gap: 6px; }

.btn-accept,
.btn-reject,
.btn-mini {
    height: 30px;
    padding: 0 14px;
    border-radius: var(--bz-r-pill);
    border: 1px solid transparent;
    font-family: var(--bz-font-body);
    font-size: var(--bz-text-xs);
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    background: rgba(56, 82, 68, 0.08);
    color: var(--bz-primary);
    transition: background var(--bz-dur-fast) var(--bz-ease),
                color var(--bz-dur-fast) var(--bz-ease);
}

.btn-accept {
    background: linear-gradient(150deg, var(--bz-primary-container), var(--bz-primary));
    color: var(--bz-on-primary);
}

.btn-accept:hover { filter: brightness(1.06); }
.btn-reject:hover { background: rgba(186, 26, 26, 0.08); color: var(--bz-error); }
.btn-mini:hover { background: rgba(56, 82, 68, 0.14); }

/* right-hand unread summary card used by the requests panel */
.right-request-list-card {
    border-radius: var(--bz-r-lg);
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid var(--bz-hairline-soft);
    box-shadow: var(--bz-shadow-card);
}

.right-request-list-content,
.right-request-view { color: var(--bz-on-surface-variant); }

.right-request-search-box input {
    height: 36px;
    border-radius: var(--bz-r-pill);
    border: 1px solid var(--bz-hairline-soft);
    background: rgba(255, 255, 255, 0.9);
    padding: 0 14px;
    font-family: var(--bz-font-body);
    font-size: var(--bz-text-sm);
    color: var(--bz-on-surface);
}

/* ============================================================================
   06 · CHAT AREA — header, window, empty state
   ========================================================================== */

.chat-area {
    background: transparent;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.chat-header {
    height: 72px;
    padding: 0 var(--bz-space-lg);
    background: rgba(252, 253, 252, 0.60);
    backdrop-filter: var(--bz-blur-panel);
    -webkit-backdrop-filter: var(--bz-blur-panel);
    border-bottom: 1px solid var(--bz-hairline-soft);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: var(--bz-space-md);
    flex-shrink: 0;
    z-index: 10;
}

/* the peer avatar the mock puts in front of the title (filled by breeze-polish.js) */
.bz-header-avatar {
    position: relative;
    width: 42px;
    height: 42px;
    flex: none;
    border-radius: 14px;
    overflow: visible;
    background: var(--bz-surface-container);
    box-shadow: 0 6px 16px -12px rgba(56, 82, 68, 0.55),
                inset 0 0 0 1px rgba(255, 255, 255, 0.7);
}

.bz-header-avatar img {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    object-fit: cover;
    display: block;
    color: transparent;
    font-size: 0;
}

.bz-online-dot {
    position: absolute;
    right: -2px;
    bottom: -2px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--bz-success);
    border: 2px solid var(--bz-surface-bright);
    box-shadow: 0 0 0 3px rgba(63, 125, 90, 0.12);
}

.bz-header-avatar + .chat-title-block { min-width: 0; }

.chat-title-block { gap: 3px; }

.chat-title-row { gap: 10px; }

#chat-title {
    font-family: var(--bz-font-display);
    font-size: 1.1875rem;
    font-weight: 500;
    letter-spacing: -0.01em;
    color: var(--bz-on-surface);
    line-height: 1.25;
}

#chat-subtitle {
    font-size: var(--bz-text-xs);
    color: var(--bz-outline);
    letter-spacing: 0.015em;
}

/* green “online” dot in front of the subtitle (added by breeze-polish.js) */
.bz-sub-dot {
    display: inline-block;
    width: 5px;
    height: 5px;
    margin-right: 6px;
    border-radius: 50%;
    background: var(--bz-success);
    vertical-align: 1px;
    box-shadow: 0 0 0 3px rgba(63, 125, 90, 0.13);
}

.chat-header-actions { gap: 6px; margin-left: auto; }

/* the mock's labelled pills: icon + its own title, read from the attribute so
   the label can never drift from what the button actually does */
.header-icon {
    width: auto;
    min-width: 38px;
    height: 34px;
    padding: 0 12px 0 9px;
    gap: 6px;
    border-radius: var(--bz-r-pill);
    color: var(--bz-on-surface-variant);
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid var(--bz-hairline-soft);
    font-family: var(--bz-font-body);
    font-size: var(--bz-text-xs);
    font-weight: 500;
    letter-spacing: 0.01em;
    white-space: nowrap;
    transition: background var(--bz-dur-fast) var(--bz-ease),
                color var(--bz-dur-fast) var(--bz-ease),
                box-shadow var(--bz-dur) var(--bz-ease);
}

.header-icon::before {
    content: attr(title);
    order: 2;
}

.header-icon > svg { order: 1; width: 16px; height: 16px; }

/* the label replaces the hover tooltip */
.header-icon::after { content: none; }

.header-icon:hover,
#btn-chat-more:hover,
#btn-video-call:hover {
    background: linear-gradient(150deg, var(--bz-primary-container), var(--bz-primary));
    border-color: transparent;
    color: var(--bz-on-primary);
    box-shadow: var(--bz-shadow-sage);
}

.header-icon.active {
    background: var(--bz-primary-fixed);
    color: var(--bz-primary);
    border-color: transparent;
}

/* typing indicator, re-tuned to sage */
.typing-indicator {
    background: rgba(56, 82, 68, 0.07);
    border: 1px solid rgba(56, 82, 68, 0.14);
    color: var(--bz-primary);
    border-radius: var(--bz-r-pill);
    padding: 4px 11px;
    font-size: var(--bz-text-micro);
    font-weight: 500;
    letter-spacing: 0.02em;
    box-shadow: none;
}

.typing-dots span { background-color: var(--bz-primary); }

.chat-window {
    flex: 1;
    min-height: 0;
    padding: var(--bz-space-lg) var(--bz-space-xl) var(--bz-space-md);
    overflow-y: auto;
    overscroll-behavior: contain;
    background: transparent;
    display: flex;
    flex-direction: column;
    gap: 2px;
    scroll-behavior: smooth;
}

.empty-tip {
    margin: auto;
    padding: 18px 26px;
    text-align: center;
    color: var(--bz-outline);
    font-family: var(--bz-font-display);
    font-size: var(--bz-text-body);
    letter-spacing: 0.01em;
    background: rgba(255, 255, 255, 0.55);
    border-radius: var(--bz-r-xl);
    border: 1px solid var(--bz-hairline-soft);
}

.loading-history {
    align-self: center;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    border-radius: var(--bz-r-pill);
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid var(--bz-hairline-soft);
    font-size: var(--bz-text-micro);
    color: var(--bz-outline);
    letter-spacing: 0.02em;
}

.loading-history .spinner { display: inline-block; animation: bz-spin 1.1s linear infinite; }

@keyframes bz-spin { to { transform: rotate(360deg); } }

/* ============================================================================
   07 · MESSAGES — bubbles, quotes, media, status
   ========================================================================== */

.message {
    max-width: min(76%, var(--bz-reading-w));
    margin-bottom: 22px;
    align-items: flex-start;
    animation: bz-rise var(--bz-dur-slow) var(--bz-ease) both;
}

@keyframes bz-rise {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

.message > img,
.message img.avatar {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    margin: 0 10px;
    box-shadow: inset 0 0 0 1px rgba(203, 212, 205, 0.35);
    transition: transform var(--bz-dur-fast) var(--bz-ease);
}

.message > img:hover,
.message img.avatar:hover { transform: translateY(-1px); }

.sender-name {
    font-family: var(--bz-font-body);
    font-size: var(--bz-text-micro);
    font-weight: 600;
    letter-spacing: 0.03em;
    color: var(--bz-outline);
    margin: 0 0 5px 4px;
    text-transform: none;
}

.message .bubble {
    padding: 11px 15px;
    border-radius: 18px;
    font-size: var(--bz-text-body);
    line-height: var(--bz-leading-body);
    letter-spacing: 0.002em;
    box-shadow: none;
    border: 0;
    position: relative;
    /* legacy sheet makes the bubble a flex column; a plain block keeps the
       quote / body / timestamp flow predictable and left-aligned */
    display: block;
    text-align: left;
    min-width: 0;
}

.message.received .bubble {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--bz-hairline-soft);
    color: var(--bz-on-surface);
    border-top-left-radius: var(--bz-r-xs);
    box-shadow: 0 10px 26px -20px rgba(45, 55, 48, 0.5),
                inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.message.sent .bubble {
    background: linear-gradient(155deg, var(--bz-primary-container) 0%, var(--bz-primary) 62%);
    color: #f3faf5;
    border-top-right-radius: var(--bz-r-xs);
    box-shadow: 0 14px 30px -20px rgba(56, 82, 68, 0.85),
                inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.message.sent .bubble a,
.message.sent .bubble .quote-name { color: #fff; }

/* file / text link chips inside bubbles */
.message .bubble a {
    color: var(--bz-primary);
    text-decoration-color: rgba(56, 82, 68, 0.35);
    text-underline-offset: 2px;
}

/* timestamps: own line, quiet, right-aligned inside the plate */
.message .bubble .msg-time {
    display: block;
    font-size: var(--bz-text-micro);
    letter-spacing: 0.02em;
    margin: 6px 0 0;
    text-align: right;
    opacity: 0.72;
}

/* …except in one-to-one threads, where the mock lifts the meta line out of the
   plate and floats it above the bubble: "林夕 10:18" / "10:22 我".
   Group threads already carry a .sender-name, so they keep the in-bubble stamp. */
.message .bubble-container:not(:has(.sender-name)) .bubble:not(.is-image) .msg-time {
    position: absolute;
    top: -1.4rem;
    margin: 0;
    padding: 0;
    line-height: 1;
    opacity: 1;
    white-space: nowrap;
}

.message.received .bubble-container:not(:has(.sender-name)) .bubble:not(.is-image) .msg-time {
    left: 4px;
    right: auto;
    text-align: left;
    color: var(--bz-outline);
}

.message.sent .bubble-container:not(:has(.sender-name)) .bubble:not(.is-image) .msg-time {
    right: 4px;
    left: auto;
    text-align: right;
    color: rgba(56, 82, 68, 0.62);
}

/* the peer's name — mirrored from #chat-title into a custom property by
   breeze-polish.js, shown once per consecutive run of received messages */
.message.received .bubble-container:not(:has(.sender-name)) .bubble:not(.is-image) .msg-time::before {
    content: var(--bz-peer-name, "");
    font-weight: 600;
    color: var(--bz-on-surface-variant);
    margin-right: 7px;
}

.message.received + .message.received .bubble .msg-time::before { content: none; }

.message.sent .bubble-container:not(:has(.sender-name)) .bubble:not(.is-image) .msg-time::after {
    content: "我";
    font-weight: 600;
    margin-left: 7px;
}

.message.sent + .message.sent .bubble .msg-time::after { content: none; }

.message.received .bubble .msg-time { color: var(--bz-outline); opacity: 1; }

.message.sent .bubble .msg-time { color: rgba(243, 250, 245, 0.78); }

/* keep the legacy absolutely-positioned stamp on images, just re-skin it */
.message .bubble.is-image .msg-time {
    display: block;
    position: absolute;
    right: 8px;
    bottom: 8px;
    margin: 0;
    padding: 2px 8px;
    border-radius: var(--bz-r-pill);
    background: rgba(25, 31, 26, 0.46);
    backdrop-filter: blur(8px);
    color: #f4f7f4 !important;
    text-align: center;
    line-height: 1.4;
}

.message.sent .bubble.is-image .msg-time,
.message.received .bubble.is-image .msg-time {
    color: #f4f7f4 !important;
    align-self: auto;
}

.message .status-wrapper .msg-status {
    margin: 0;
    font-size: var(--bz-text-micro);
    letter-spacing: 0.02em;
    color: var(--bz-outline);
}

.message .status-wrapper .msg-status.unread { color: var(--bz-tertiary); }
.message .status-wrapper .msg-status.read { color: var(--bz-outline-variant); }

/* the mock's read receipt reads 已读 ✓ */
.message .status-wrapper .msg-status.read::after {
    content: '✓';
    margin-left: 3px;
    font-size: 0.92em;
    opacity: 0.85;
}

/* system / recall notices read as a quiet centered capsule */
.recalled-tip {
    align-self: center !important;
    max-width: 100% !important;
    margin: 10px 0;
    padding: 6px 16px;
    border-radius: var(--bz-r-pill);
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid var(--bz-hairline-soft);
    text-align: center;
    font-size: var(--bz-text-xs);
    color: var(--bz-outline);
    letter-spacing: 0.02em;
}

/* ---- quote (reply) ------------------------------------------------------- */
.quote-box {
    border-radius: var(--bz-r-md);
    background: rgba(56, 82, 68, 0.06);
    border-left: 2px solid var(--bz-primary-fixed-dim);
    padding: 7px 11px;
    margin-bottom: 7px;
    font-size: var(--bz-text-xs);
    line-height: 1.5;
}

.message.sent .quote-box {
    background: rgba(255, 255, 255, 0.14);
    border-left-color: rgba(255, 255, 255, 0.55);
}

.quote-name {
    font-weight: 600;
    color: var(--bz-primary);
    letter-spacing: 0.01em;
}

.quote-content {
    color: var(--bz-outline);
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.message.sent .quote-content { color: rgba(243, 250, 245, 0.82); }

/* ---- status / read ring -------------------------------------------------- */
.status-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 9px;
    align-self: flex-end;
    flex-shrink: 0;
}

.message.sent .status-wrapper { flex-direction: row; margin-right: 9px; }

.read-ring {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border: 1px solid var(--bz-hairline);
    border-radius: var(--bz-r-pill);
    background: rgba(255, 255, 255, 0.8);
    color: var(--bz-outline);
    font-size: 0.625rem;
    font-weight: 600;
    cursor: pointer;
    transition: color var(--bz-dur-fast) var(--bz-ease),
                border-color var(--bz-dur-fast) var(--bz-ease);
}

.read-ring:hover { color: var(--bz-primary); border-color: var(--bz-primary-fixed-dim); }

.msg-status {
    font-size: var(--bz-text-micro);
    letter-spacing: 0.02em;
    color: var(--bz-outline);
}

/* ---- images -------------------------------------------------------------- */
.message .bubble.is-image {
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    border-radius: var(--bz-r-xl);
    overflow: hidden;
}

.image-msg-wrapper {
    border-radius: var(--bz-r-xl);
    overflow: hidden;
    background: rgba(255, 255, 255, 0.7);
    box-shadow: 0 18px 40px -26px rgba(45, 55, 48, 0.65);
    border: 1px solid var(--bz-hairline-soft);
}

.message .bubble.is-image img,
.chat-image {
    border-radius: var(--bz-r-md);
    display: block;
    max-width: 100%;
}

.image-loading-placeholder,
.image-upload-wrapper,
.image-upload-progress-box,
.video-upload-wrapper,
.video-upload-progress-box {
    border-radius: var(--bz-r-lg);
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid var(--bz-hairline-soft);
}

.image-upload-progress-bar,
.video-upload-progress-bar {
    background: rgba(56, 82, 68, 0.12);
    border-radius: var(--bz-r-pill);
    overflow: hidden;
}

.image-upload-progress-fill,
.video-upload-progress-fill {
    background: linear-gradient(90deg, var(--bz-primary-fixed-dim), var(--bz-primary));
    border-radius: var(--bz-r-pill);
}

.image-upload-progress-text,
.video-upload-progress-text,
.image-fail-text,
.image-upload-error-tip {
    font-size: var(--bz-text-micro);
    color: var(--bz-outline);
}

.image-spinner {
    border-color: rgba(56, 82, 68, 0.2);
    border-top-color: var(--bz-primary);
}

/* ---- video cards --------------------------------------------------------- */
.chat-video-card {
    border-radius: var(--bz-r-xl);
    overflow: hidden;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--bz-hairline-soft);
    box-shadow: 0 18px 40px -26px rgba(45, 55, 48, 0.6);
}

.chat-video-poster,
.chat-video-preview,
.loading-poster {
    border-radius: var(--bz-r-xl);
    background: var(--bz-surface-container);
}

.chat-video-cover-overlay {
    background: linear-gradient(180deg, rgba(25, 31, 26, 0) 40%, rgba(25, 31, 26, 0.42));
    border-radius: var(--bz-r-xl);
}

.chat-video-play-btn {
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 26px -10px rgba(25, 31, 26, 0.5);
    color: var(--bz-primary);
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.chat-video-meta-badge,
.chat-video-duration-text {
    border-radius: var(--bz-r-pill);
    background: rgba(25, 31, 26, 0.56);
    backdrop-filter: blur(8px);
    color: #fff;
    font-size: var(--bz-text-micro);
    letter-spacing: 0.02em;
}

/* ---- video player (univ-*) ----------------------------------------------- */
.univ-player-container,
.univ-player-overlay {
    background: rgba(18, 22, 19, 0.82);
    backdrop-filter: blur(16px);
}

.univ-player-screen { border-radius: var(--bz-r-lg); }

.univ-timeline-container { border-radius: var(--bz-r-pill); background: rgba(255, 255, 255, 0.22); }

.univ-timeline-played {
    background: linear-gradient(90deg, var(--bz-primary-fixed-dim), var(--bz-primary-fixed));
    border-radius: var(--bz-r-pill);
}

.univ-timeline-buffered { background: rgba(255, 255, 255, 0.36); border-radius: var(--bz-r-pill); }

.univ-timeline-handle {
    background: #fff;
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.22);
}

.univ-ctrl-btn,
.univ-ctrl-text-btn,
.univ-top-btn,
.univ-speed-item {
    border-radius: var(--bz-r-sm);
    color: rgba(255, 255, 255, 0.9);
}

.univ-ctrl-btn:hover,
.univ-top-btn:hover,
.univ-speed-item:hover { background: rgba(255, 255, 255, 0.14); }

.univ-speed-menu {
    border-radius: var(--bz-r-md);
    background: rgba(28, 34, 30, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(18px);
}

.univ-speed-item.active { background: rgba(255, 255, 255, 0.18); }

.univ-time-display,
.univ-player-title { color: rgba(255, 255, 255, 0.86); font-size: var(--bz-text-micro); letter-spacing: 0.03em; }

/* ============================================================================
   08 · COMPOSER — floating glass island
   ========================================================================== */

.input-area {
    flex-shrink: 0;
    margin: 0 var(--bz-space-lg) var(--bz-space-md);
    padding: 12px 14px 10px;
    min-height: 0;
    max-height: 300px;
    background: var(--bz-glass-composer);
    backdrop-filter: var(--bz-blur-card);
    -webkit-backdrop-filter: var(--bz-blur-card);
    border: 1px solid var(--bz-hairline-soft);
    border-radius: var(--bz-r-xl);
    box-shadow: 0 22px 48px -30px rgba(45, 55, 48, 0.55),
                inset 0 1px 0 rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    position: relative;
    transition: box-shadow var(--bz-dur) var(--bz-ease),
                border-color var(--bz-dur) var(--bz-ease);
}

.input-area:focus-within {
    border-color: rgba(56, 82, 68, 0.24);
    box-shadow: 0 26px 54px -30px rgba(45, 55, 48, 0.6),
                0 0 0 3px rgba(211, 235, 217, 0.45),
                inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.input-area .chat-toolbar {
    gap: 2px;
    min-height: 30px;
    order: -1;
}

/* the legacy sheet pins the composer tool row with !important */
.input-area .tool-btn {
    width: 32px !important;
    height: 32px !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: var(--bz-r-sm) !important;
    background: transparent !important;
    color: var(--bz-outline) !important;
    box-shadow: none !important;
    transition: background var(--bz-dur-fast) var(--bz-ease),
                color var(--bz-dur-fast) var(--bz-ease) !important;
}

.input-area .tool-btn:hover {
    background: rgba(56, 82, 68, 0.08) !important;
    color: var(--bz-primary) !important;
    transform: none !important;
}

.tool-btn svg { stroke-width: 1.6; }

/* "● 通道加密同步中" rides at the right end of the composer tool row */
.bz-composer-status {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding-right: 2px;
    font-size: var(--bz-text-micro);
    letter-spacing: 0.02em;
    color: var(--bz-outline);
    white-space: nowrap;
    user-select: none;
}

.bz-composer-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #58a173;
    box-shadow: 0 0 0 3px rgba(88, 161, 115, 0.14);
}

.input-area textarea {
    font-family: var(--bz-font-body);
    font-size: var(--bz-text-body);
    line-height: var(--bz-leading-body);
    color: var(--bz-on-surface);
    background: transparent;
    border: 0;
    padding: 4px 2px;
    flex: 0 0 auto;
    height: 58px;
    min-height: 58px;
    max-height: 168px;
    resize: none;
    overflow-y: auto;
    margin-bottom: 0;
}

.input-area textarea::placeholder {
    color: var(--bz-outline);
    opacity: 0.85;
    letter-spacing: 0.01em;
}

.input-area div.send-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    color: var(--bz-outline);
    font-size: var(--bz-text-micro);
    letter-spacing: 0.02em;
}

.send-btn,
.input-area .send-row .send-btn {
    width: auto;
    min-width: 0;
    height: 36px;
    padding: 0 20px;
    border: 1px solid transparent;
    border-radius: var(--bz-r-pill);
    background: linear-gradient(150deg, var(--bz-primary-container), var(--bz-primary));
    color: var(--bz-on-primary);
    font-family: var(--bz-font-body);
    font-size: var(--bz-text-sm);
    font-weight: 600;
    letter-spacing: 0.04em;
    cursor: pointer;
    box-shadow: var(--bz-shadow-sage);
    transition: transform var(--bz-dur-fast) var(--bz-ease),
                box-shadow var(--bz-dur) var(--bz-ease),
                filter var(--bz-dur-fast) var(--bz-ease);
}

.send-btn:hover,
.input-area .send-row .send-btn:hover {
    filter: brightness(1.07);
    background: linear-gradient(150deg, var(--bz-primary-container), var(--bz-primary));
    color: #fff;
    border-color: transparent;
    transform: translateY(-1px);
    box-shadow: 0 10px 22px -6px rgba(56, 82, 68, 0.4);
}

.send-btn:active,
.input-area .send-row .send-btn:active { transform: translateY(0) scale(0.985); }

/* the paper-plane the mock puts after the label */
.send-btn::after,
.input-area .send-row .send-btn::after {
    content: '➤';
    margin-left: 8px;
    font-size: 0.72em;
    line-height: 1;
    display: inline-block;
    transform: translateY(-0.5px);
    opacity: 0.9;
}

/* reply preview bar */
.reply-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
    padding: 8px 12px;
    border-radius: var(--bz-r-md);
    background: rgba(56, 82, 68, 0.06);
    border-left: 2px solid var(--bz-primary-fixed-dim);
}

.reply-content {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    font-size: var(--bz-text-xs);
    color: var(--bz-on-surface-variant);
}

.reply-icon { color: var(--bz-primary); font-size: 13px; }

#reply-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.reply-close {
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: var(--bz-outline);
    cursor: pointer;
    transition: background var(--bz-dur-fast) var(--bz-ease);
}

.reply-close:hover { background: rgba(56, 82, 68, 0.1); color: var(--bz-primary); }

/* emoji picker */
.emoji-picker {
    border-radius: var(--bz-r-lg);
    background: var(--bz-glass-popover);
    backdrop-filter: var(--bz-blur-popover);
    -webkit-backdrop-filter: var(--bz-blur-popover);
    border: 1px solid var(--bz-hairline-soft);
    box-shadow: var(--bz-shadow-popover);
    padding: 10px;
}

.emoji-picker span,
.emoji-item {
    border-radius: var(--bz-r-sm);
    transition: background var(--bz-dur-fast) var(--bz-ease),
                transform var(--bz-dur-fast) var(--bz-ease);
}

.emoji-picker span:hover,
.emoji-item:hover {
    background: rgba(56, 82, 68, 0.08);
    transform: scale(1.14);
}

/* scroll-to-bottom orb */
.scroll-bottom-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    border: 1px solid var(--bz-hairline-soft);
    color: var(--bz-primary);
    box-shadow: var(--bz-shadow-float);
    display: grid;
    place-items: center;
    transition: transform var(--bz-dur-fast) var(--bz-ease),
                box-shadow var(--bz-dur) var(--bz-ease);
}

.scroll-bottom-btn:hover { transform: translateY(-2px); box-shadow: 0 14px 30px -12px rgba(45, 55, 48, 0.4); }
.scroll-bottom-btn svg { width: 16px; height: 16px; stroke-width: 1.9; }

/* ============================================================================
   09 · DETAIL PANEL — the resonance drawer
   ========================================================================== */

.detail-panel {
    background: rgba(252, 253, 252, 0.78);
    backdrop-filter: var(--bz-blur-panel);
    -webkit-backdrop-filter: var(--bz-blur-panel);
    border-left: 0 solid transparent;
    width: 0;
    min-width: 0;
    padding: 18px 0 20px;
    align-items: flex-start;
    justify-content: flex-start;
    overflow-x: hidden;
    overflow-y: auto;
}

.detail-panel.is-open {
    width: var(--bz-drawer-w);
    min-width: var(--bz-drawer-w);
    padding: 18px 16px 20px;
    border-left: 1px solid var(--bz-hairline-soft);
}

.detail-card { width: 100%; }

/* the mock's drawer is headed by a title row */
.detail-card::before {
    content: '联系人详情';
    display: flex;
    align-items: center;
    height: 30px;
    margin: -2px 0 12px;
    padding: 0 2px 10px;
    border-bottom: 1px solid var(--bz-hairline-soft);
    font-family: var(--bz-font-body);
    font-size: var(--bz-text-xs);
    font-weight: 600;
    letter-spacing: 0.06em;
    color: var(--bz-on-surface-variant);
}

/* legacy pins min-width: 216px, which would fight the 0-width collapse */
.detail-panel .detail-card,
.detail-panel .detail-empty { min-width: 0; }

.detail-empty {
    color: var(--bz-outline);
    font-size: var(--bz-text-sm);
    text-align: center;
    line-height: 1.7;
    padding: 40px 12px;
}

.detail-empty-icon {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 1px solid var(--bz-hairline);
    background: rgba(255, 255, 255, 0.6);
    color: var(--bz-outline);
    font-family: var(--bz-font-display);
    font-style: italic;
    margin: 0 auto 14px;
}

.detail-profile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 18px 8px 20px;
    border-radius: var(--bz-r-xl);
    background: linear-gradient(170deg, rgba(255, 255, 255, 0.85), rgba(240, 245, 241, 0.6));
    border: 1px solid var(--bz-hairline-soft);
    box-shadow: var(--bz-shadow-card);
    margin-bottom: 14px;
}

.detail-avatar {
    width: 84px;
    height: 84px;
    border-radius: 26px;
    object-fit: cover;
    box-shadow: 0 16px 32px -16px rgba(56, 82, 68, 0.45),
                inset 0 0 0 1px rgba(255, 255, 255, 0.7);
    margin-bottom: 4px;
}

.detail-name {
    font-family: var(--bz-font-display);
    font-size: var(--bz-text-h2);
    font-weight: 500;
    letter-spacing: -0.01em;
    color: var(--bz-on-surface);
    text-align: center;
}

.detail-type {
    font-size: var(--bz-text-micro);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--bz-outline);
    text-align: center;
}

/* group member strip */
#group-members-container {
    border-bottom: 1px solid var(--bz-hairline-soft) !important;
    padding: 14px 2px !important;
}

#group-members-container > div > div {
    font-size: var(--bz-text-micro) !important;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--bz-outline) !important;
}

#group-member-list { gap: 8px !important; }

#group-member-list img {
    border-radius: 12px;
    box-shadow: inset 0 0 0 1px rgba(203, 212, 205, 0.4);
}

#group-members-expand-btn { border-radius: 8px !important; }

/* settings rows */
.settings-list {
    border-top: 1px solid var(--bz-hairline-soft);
    margin-top: 4px;
    padding-top: 6px;
}

.setting-row {
    height: 50px;
    padding: 0 10px;
    border: 0;
    border-bottom: 1px solid var(--bz-hairline-soft);
    border-radius: 0;
    background: transparent;
    color: var(--bz-on-surface);
    font-family: var(--bz-font-body);
    font-size: var(--bz-text-body);
    letter-spacing: 0.005em;
    transition: background var(--bz-dur-fast) var(--bz-ease),
                padding var(--bz-dur-fast) var(--bz-ease);
}

.setting-row:last-child { border-bottom: 0; }

.setting-row:hover {
    background: rgba(56, 82, 68, 0.05);
    border-radius: var(--bz-r-md);
    padding: 0 12px;
}

.setting-row.arrow::after {
    content: '›';
    color: var(--bz-outline-variant);
    font-size: 18px;
    line-height: 1;
}

.setting-row.danger { color: var(--bz-error); }

.setting-row.danger:hover { background: rgba(186, 26, 26, 0.06); }

.switch-visual {
    width: 40px;
    height: 22px;
    border-radius: var(--bz-r-pill);
    background: var(--bz-surface-highest);
    transition: background var(--bz-dur) var(--bz-ease);
}

.switch-visual::after {
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(45, 55, 48, 0.25);
    transition: left var(--bz-dur) var(--bz-ease);
}

.setting-row.is-on .switch-visual {
    background: linear-gradient(150deg, var(--bz-primary-container), var(--bz-primary));
}

.setting-row.is-on .switch-visual::after { left: 21px; }

/* legacy demo toggle that is not a button */
.switch {
    width: 40px;
    height: 22px;
    border-radius: var(--bz-r-pill);
    background: var(--bz-surface-highest);
}

.switch.active { background: var(--bz-primary); }

/* ============================================================================
   10 · AUTH — the calm doorway
   ========================================================================== */

#auth-wrapper { padding: 24px; }

.auth-card {
    width: 380px;
    padding: 40px 36px 34px;
    border-radius: var(--bz-r-2xl);
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: var(--bz-blur-card);
    -webkit-backdrop-filter: var(--bz-blur-card);
    border: 1px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 40px 80px -40px rgba(45, 55, 48, 0.35),
                0 0 0 1px rgba(203, 212, 205, 0.35),
                inset 0 1px 0 rgba(255, 255, 255, 0.9);
    text-align: center;
}

.auth-card h2 {
    font-family: var(--bz-font-display);
    font-size: var(--bz-text-h1);
    font-weight: 400;
    letter-spacing: -0.015em;
    color: var(--bz-on-surface);
    margin-bottom: 6px;
}

.auth-card .subtitle {
    font-size: var(--bz-text-sm);
    color: var(--bz-outline);
    letter-spacing: 0.01em;
    margin-bottom: 22px;
}

.avatar-container img {
    width: 76px;
    height: 76px;
    border-radius: 24px;
    border: 1px solid var(--bz-hairline-soft);
    background: linear-gradient(160deg, rgba(211, 235, 217, 0.7), rgba(255, 255, 255, 0.9));
    padding: 12px;
    margin-bottom: 18px;
    box-shadow: 0 12px 26px -14px rgba(56, 82, 68, 0.3);
    /* the bundled login/reg SVGs are coral; pull them into the sage family */
    filter: grayscale(1) sepia(0.9) hue-rotate(84deg) saturate(0.55) brightness(0.92);
    animation: bz-breathe 7s var(--bz-ease-soft) infinite;
}

@keyframes bz-breathe {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-3px) scale(1.015); }
}

/* pill inputs with a floating label */
.input-group { margin-bottom: 14px; }

.input-group input {
    height: 50px;
    padding: 0 18px;
    border: 1px solid var(--bz-hairline-soft);
    border-radius: var(--bz-r-pill);
    background: rgba(248, 250, 248, 0.9);
    font-family: var(--bz-font-body);
    font-size: var(--bz-text-body);
    color: var(--bz-on-surface);
    transition: border-color var(--bz-dur-fast) var(--bz-ease),
                box-shadow var(--bz-dur) var(--bz-ease),
                background var(--bz-dur-fast) var(--bz-ease);
}

.input-group input:focus {
    background: #fff;
    border-color: rgba(56, 82, 68, 0.3);
    box-shadow: 0 0 0 3px rgba(211, 235, 217, 0.55);
}

.input-group label {
    left: 18px;
    color: var(--bz-outline);
    font-size: var(--bz-text-body);
    letter-spacing: 0.01em;
}

.input-group input:focus + label,
.input-group input:not(:placeholder-shown) + label {
    top: -7px;
    left: 14px;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: var(--bz-primary);
    background: rgba(255, 255, 255, 0.96);
    border-radius: var(--bz-r-pill);
    padding: 0 8px;
}

.btn-primary {
    height: 48px;
    margin-top: 8px;
    border: 0;
    border-radius: var(--bz-r-pill);
    background: linear-gradient(150deg, var(--bz-primary-container), var(--bz-primary));
    color: var(--bz-on-primary);
    font-family: var(--bz-font-body);
    font-size: var(--bz-text-body);
    font-weight: 600;
    letter-spacing: 0.05em;
    cursor: pointer;
    box-shadow: var(--bz-shadow-sage);
    transition: transform var(--bz-dur-fast) var(--bz-ease),
                box-shadow var(--bz-dur) var(--bz-ease),
                filter var(--bz-dur-fast) var(--bz-ease);
}

.btn-primary:hover {
    filter: brightness(1.07);
    background: linear-gradient(150deg, var(--bz-primary-container), var(--bz-primary));
    transform: translateY(-1px);
    box-shadow: 0 12px 26px -8px rgba(56, 82, 68, 0.42);
}

.btn-primary:active { transform: translateY(0) scale(0.99); }

/* the SSO button carries an inline green; retint it */
#ssoLoginBtn {
    background: rgba(255, 255, 255, 0.86) !important;
    color: var(--bz-primary) !important;
    border: 1px solid var(--bz-hairline);
    box-shadow: none;
}

#ssoLoginBtn:hover {
    background: rgba(211, 235, 217, 0.5) !important;
    border-color: var(--bz-primary-fixed-dim);
}

.switch-link {
    margin-top: 18px;
    font-size: var(--bz-text-sm);
    color: var(--bz-outline);
    letter-spacing: 0.01em;
}

.switch-link span {
    color: var(--bz-primary);
    font-weight: 600;
    margin-left: 5px;
    text-decoration: underline;
    text-decoration-color: rgba(56, 82, 68, 0.28);
    text-underline-offset: 3px;
}

.captcha-group { margin-bottom: 14px; gap: 10px; }

.captcha-img-box {
    height: 50px;
    border-radius: var(--bz-r-pill);
    background: rgba(240, 245, 241, 0.9);
    border: 1px solid var(--bz-hairline-soft);
}

/* ============================================================================
   11 · MODALS, MENUS, TOASTS, POPOVER
   ========================================================================== */

.modal-overlay {
    background: rgba(38, 46, 41, 0.28);
    backdrop-filter: blur(10px) saturate(120%);
    -webkit-backdrop-filter: blur(10px) saturate(120%);
}

.modal-box {
    border-radius: var(--bz-r-2xl);
    background: rgba(253, 254, 253, 0.94);
    backdrop-filter: var(--bz-blur-popover);
    -webkit-backdrop-filter: var(--bz-blur-popover);
    border: 1px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 40px 90px -40px rgba(25, 31, 26, 0.45),
                0 0 0 1px rgba(203, 212, 205, 0.35);
    padding: 28px 28px 22px;
    animation: bz-modal-in var(--bz-dur) var(--bz-ease) both;
}

@keyframes bz-modal-in {
    from { opacity: 0; transform: translateY(10px) scale(0.985); }
    to { opacity: 1; transform: none; }
}

.modal-box h3 {
    font-family: var(--bz-font-display);
    font-size: var(--bz-text-h2);
    font-weight: 500;
    letter-spacing: -0.01em;
    color: var(--bz-on-surface);
    margin-bottom: 6px;
}

.modal-desc {
    font-size: var(--bz-text-sm);
    color: var(--bz-outline);
    line-height: 1.6;
    letter-spacing: 0.01em;
}

.modal-buttons { gap: 10px; margin-top: 22px; }

.modal-buttons button {
    height: 40px;
    padding: 0 22px;
    border: 0;
    border-radius: var(--bz-r-pill);
    font-family: var(--bz-font-body);
    font-size: var(--bz-text-sm);
    font-weight: 600;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: background var(--bz-dur-fast) var(--bz-ease),
                color var(--bz-dur-fast) var(--bz-ease),
                filter var(--bz-dur-fast) var(--bz-ease);
}

.btn-cancel {
    background: rgba(56, 82, 68, 0.07);
    color: var(--bz-on-surface-variant);
}

.btn-cancel:hover { background: rgba(56, 82, 68, 0.12); }

.btn-confirm {
    background: linear-gradient(150deg, var(--bz-primary-container), var(--bz-primary));
    color: var(--bz-on-primary);
    box-shadow: var(--bz-shadow-sage);
}

.btn-confirm:hover { filter: brightness(1.07); }

.btn-confirm-delete {
    background: rgba(186, 26, 26, 0.1);
    color: var(--bz-error);
}

.btn-confirm-delete:hover { background: var(--bz-error); color: #fff; }

.btn-outline-primary {
    border: 1px solid var(--bz-primary-fixed-dim);
    color: var(--bz-primary);
    background: transparent;
    border-radius: var(--bz-r-pill);
}

.btn-outline-danger {
    border: 1px solid rgba(186, 26, 26, 0.35);
    color: var(--bz-error);
    background: transparent;
    border-radius: var(--bz-r-pill);
}

/* friend / member select list inside the group modals */
.friend-select-list { display: flex; flex-direction: column; gap: 2px; }

.friend-select-list .select-item,
.select-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--bz-r-md);
    cursor: pointer;
    font-size: var(--bz-text-body);
    color: var(--bz-on-surface);
    transition: background var(--bz-dur-fast) var(--bz-ease);
}

.friend-select-list .select-item:hover,
.select-item:hover { background: rgba(56, 82, 68, 0.05); }

/* script.js paints these inline (#e6f7ff / #ffe6e6) — override hard */
.select-item.selected,
.friend-select-list .select-item.selected {
    background-color: rgba(211, 235, 217, 0.75) !important;
    color: var(--bz-primary) !important;
    box-shadow: inset 0 0 0 1px rgba(181, 212, 191, 0.8);
}

.select-item img {
    width: 34px;
    height: 34px;
    border-radius: 11px;
    object-fit: cover;
}

.search-friend-results {
    border-radius: var(--bz-r-lg);
    background: rgba(248, 250, 248, 0.7);
    border: 1px solid var(--bz-hairline-soft);
    padding: 6px !important;
}

.search-friend-info,
.search-status-text {
    font-size: var(--bz-text-sm);
    color: var(--bz-on-surface-variant);
}

.btn-add-search-result {
    height: 30px;
    padding: 0 14px;
    border-radius: var(--bz-r-pill);
    border: 0;
    background: rgba(56, 82, 68, 0.08);
    color: var(--bz-primary);
    font-size: var(--bz-text-xs);
    font-weight: 600;
    cursor: pointer;
}

/* read-receipt list */
.read-user-item {
    padding: 8px 10px;
    border-radius: var(--bz-r-md);
    gap: 10px;
    font-size: var(--bz-text-sm);
    color: var(--bz-on-surface);
    transition: background var(--bz-dur-fast) var(--bz-ease);
}

.read-user-item:hover { background: rgba(56, 82, 68, 0.05); }

.read-user-item img { width: 32px; height: 32px; border-radius: 10px; }

/* context menu */
.context-menu {
    border-radius: var(--bz-r-lg);
    background: var(--bz-glass-popover);
    backdrop-filter: var(--bz-blur-popover);
    -webkit-backdrop-filter: var(--bz-blur-popover);
    border: 1px solid var(--bz-hairline-soft);
    box-shadow: var(--bz-shadow-popover);
    padding: 6px;
    min-width: 150px;
    animation: bz-modal-in var(--bz-dur-fast) var(--bz-ease) both;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 12px;
    border-radius: var(--bz-r-sm);
    font-size: var(--bz-text-sm);
    color: var(--bz-on-surface-variant);
    cursor: pointer;
    transition: background var(--bz-dur-fast) var(--bz-ease),
                color var(--bz-dur-fast) var(--bz-ease);
}

.menu-item:hover {
    background: rgba(56, 82, 68, 0.07);
    color: var(--bz-primary);
}

.conversation-menu {
    border-radius: var(--bz-r-lg);
    background: var(--bz-glass-popover);
    backdrop-filter: var(--bz-blur-popover);
    border: 1px solid var(--bz-hairline-soft);
    box-shadow: var(--bz-shadow-popover);
    padding: 6px;
}

/* toasts */
#toast-container { gap: 8px; top: 20px; }

.toast {
    border-radius: var(--bz-r-pill);
    background: rgba(253, 254, 253, 0.94);
    backdrop-filter: var(--bz-blur-popover);
    -webkit-backdrop-filter: var(--bz-blur-popover);
    border: 1px solid var(--bz-hairline-soft);
    box-shadow: 0 20px 44px -24px rgba(25, 31, 26, 0.4);
    padding: 11px 22px;
    font-family: var(--bz-font-body);
    font-size: var(--bz-text-sm);
    font-weight: 500;
    letter-spacing: 0.01em;
    color: var(--bz-on-surface);
    display: inline-flex;
    align-items: center;
    gap: 9px;
    animation: bz-toast-in var(--bz-dur) var(--bz-ease) both;
}

@keyframes bz-toast-in {
    from { opacity: 0; transform: translateY(-10px) scale(0.97); }
    to { opacity: 1; transform: none; }
}

.toast::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--bz-outline);
}

.toast.success { border-left: 1px solid var(--bz-hairline-soft); color: var(--bz-on-surface); }
.toast.error { border-left: 1px solid var(--bz-hairline-soft); color: var(--bz-on-surface); }
.toast.info { border-left: 1px solid var(--bz-hairline-soft); color: var(--bz-on-surface); }

.toast.success::before { background: #58a173; box-shadow: 0 0 0 3px rgba(88, 161, 115, 0.16); }
.toast.error::before { background: var(--bz-error); box-shadow: 0 0 0 3px rgba(186, 26, 26, 0.14); }
.toast.info::before { background: var(--bz-secondary); box-shadow: 0 0 0 3px rgba(96, 90, 122, 0.14); }

/* user profile popover */
.bz-popover,
.user-profile-popover {
    border-radius: var(--bz-r-xl);
    background: var(--bz-glass-popover);
    backdrop-filter: var(--bz-blur-popover);
    border: 1px solid var(--bz-hairline-soft);
    box-shadow: var(--bz-shadow-popover);
}

/* settings modal (avatar / profile) */
.settings-modal-box {
    border-radius: var(--bz-r-2xl);
    background: rgba(253, 254, 253, 0.95);
    backdrop-filter: var(--bz-blur-popover);
    border: 1px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 40px 90px -40px rgba(25, 31, 26, 0.45);
    overflow: hidden;
}

.settings-header {
    padding: 20px 24px 14px;
    border-bottom: 1px solid var(--bz-hairline-soft);
}

.settings-header h3,
.settings-section-title {
    font-family: var(--bz-font-display);
    font-weight: 500;
    letter-spacing: -0.01em;
    color: var(--bz-on-surface);
}

.settings-section-title {
    font-size: var(--bz-text-xs);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--bz-outline);
    padding: 14px 4px 6px;
}

.settings-content { padding: 18px 24px 24px; }

.settings-profile-card {
    border-radius: var(--bz-r-xl);
    background: linear-gradient(170deg, rgba(255, 255, 255, 0.9), rgba(240, 245, 241, 0.65));
    border: 1px solid var(--bz-hairline-soft);
    box-shadow: var(--bz-shadow-card);
    padding: 16px;
}

.settings-avatar-preview {
    border-radius: 20px;
    overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(203, 212, 205, 0.4);
}

.settings-item {
    border-radius: var(--bz-r-md);
    padding: 10px 12px;
    font-size: var(--bz-text-body);
    color: var(--bz-on-surface);
    transition: background var(--bz-dur-fast) var(--bz-ease);
}

.settings-item:hover { background: rgba(56, 82, 68, 0.05); }

.settings-close-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    color: var(--bz-outline);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: background var(--bz-dur-fast) var(--bz-ease);
}

.settings-close-btn:hover { background: rgba(56, 82, 68, 0.08); color: var(--bz-primary); }

/* image viewer */
.image-viewer,
.viewer-overlay {
    background: rgba(14, 18, 15, 0.8);
    backdrop-filter: blur(14px);
}

.viewer-content,
.image-viewer img { border-radius: var(--bz-r-lg); }

.viewer-close,
.viewer-controls {
    border-radius: var(--bz-r-pill);
    background: rgba(255, 255, 255, 0.14);
    backdrop-filter: blur(12px);
    color: #fff;
}

.crop-tool-btn,
.btn-select-image,
.btn-register {
    border-radius: var(--bz-r-pill);
}

/* avatar panel: legacy pins it to the old centred 1320px shell — re-anchor
   it to the full-bleed left edge instead */
#change-avatar-modal .modal-box {
    left: 0;
    height: 100vh;
    width: 380px;
    max-width: 92vw;
    margin: 0;
    border-radius: 0 var(--bz-r-2xl) var(--bz-r-2xl) 0;
    background: rgba(253, 254, 253, 0.96);
    backdrop-filter: var(--bz-blur-popover);
    border: 1px solid rgba(255, 255, 255, 0.9);
    box-shadow: 28px 0 70px -40px rgba(25, 31, 26, 0.45);
}

#change-avatar-modal { backdrop-filter: blur(6px) !important; }

#change-avatar-modal .avatar-crop-container {
    margin: 20px 0;
    height: 300px;
    background: rgba(240, 245, 241, 0.8);
    border: 1px solid var(--bz-hairline-soft);
    border-radius: var(--bz-r-lg);
    overflow: hidden;
    position: relative;
}

/* crop modal */
#change-avatar-modal .modal-box,
.avatar-crop-container,
.screenshot-crop-container {
    border-radius: var(--bz-r-2xl);
}

/* ============================================================================
   12 · VIDEO CALL
   ========================================================================== */

.video-call-window {
    border-radius: var(--bz-r-xl);
    background: rgba(28, 34, 30, 0.86);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 40px 90px -40px rgba(0, 0, 0, 0.7);
    overflow: hidden;
}

.video-call-drag {
    background: rgba(255, 255, 255, 0.06);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.video-call-peer { font-family: var(--bz-font-display); color: #fff; font-size: 1rem; }
.video-call-status { color: rgba(255, 255, 255, 0.7); font-size: var(--bz-text-micro); letter-spacing: 0.03em; }

.video-call-stage { background: #0f1310; border-radius: var(--bz-r-lg); overflow: hidden; }

/* an empty <video> paints opaque black; let the stage supply the colour so the
   plate keeps its rounded corners and the fallback avatar can show through */
.remote-video,
.local-video { background: transparent; }

.local-preview {
    border-radius: var(--bz-r-md);
    overflow: hidden;
    box-shadow: 0 12px 30px -12px rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.call-btn {
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    backdrop-filter: blur(10px);
    color: #fff;
    transition: transform var(--bz-dur-fast) var(--bz-ease),
                filter var(--bz-dur-fast) var(--bz-ease);
}

.call-btn:hover { transform: translateY(-1px); filter: brightness(1.1); }
.call-btn.accept { background: linear-gradient(150deg, #5fae7f, #3f7d5a); }
.call-btn.hangup { background: linear-gradient(150deg, #e06060, #c73c3c); }
.call-btn.secondary { background: rgba(255, 255, 255, 0.16); }
.call-btn.off { background: rgba(224, 96, 96, 0.9); }

.video-call-close {
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.call-avatar-fallback {
    background: radial-gradient(circle at 50% 30%, rgba(56, 82, 68, 0.85), rgba(20, 26, 22, 0.95));
}

.call-avatar-fallback img { border-radius: 24px; }

.call-avatar-fallback span { color: rgba(255, 255, 255, 0.8); letter-spacing: 0.02em; }

/* ============================================================================
   12b · NATIVE CONTROLS, TOGGLES & TRANSIENT STATE
   The legacy sheet still paints the settings switches, outline buttons and a
   handful of upload/typing states in WeChat green or flat grey.
   ========================================================================== */

/* settings switches — legacy .switch + .slider */
.switch { width: 42px; height: 24px; }

.slider {
    border-radius: var(--bz-r-pill);
    background-color: var(--bz-surface-highest);
    box-shadow: inset 0 0 0 1px rgba(203, 212, 205, 0.65);
    transition: background-color var(--bz-dur) var(--bz-ease),
                box-shadow var(--bz-dur) var(--bz-ease);
}

.slider:before { box-shadow: 0 1px 3px rgba(25, 31, 26, 0.3); }

input:checked + .slider {
    background-color: var(--bz-primary);
    box-shadow: inset 0 0 0 1px rgba(56, 82, 68, 0.4);
}

input[type="checkbox"],
input[type="radio"] { accent-color: var(--bz-primary); }

.btn-outline-primary {
    border: 1px solid var(--bz-primary);
    color: var(--bz-primary);
    background: transparent;
    border-radius: var(--bz-r-pill);
    padding: 6px 14px;
    font-family: var(--bz-font-body);
}

.btn-outline-primary:hover {
    background: var(--bz-primary);
    color: var(--bz-on-primary);
}

.btn-outline-danger {
    border: 1px solid rgba(186, 26, 26, 0.4);
    color: var(--bz-error);
    background: transparent;
    border-radius: var(--bz-r-pill);
    padding: 6px 14px;
    font-family: var(--bz-font-body);
}

.btn-outline-danger:hover {
    background: var(--bz-error);
    color: #fff;
}

/* upload / reconnecting veils */
.msg-loading,
.image-upload-overlay,
.video-upload-overlay {
    background: rgba(25, 31, 26, 0.38) !important;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.msg-loading::after { border-color: rgba(255, 255, 255, 0.85); border-top-color: transparent; }

.uploading-preview { filter: saturate(0.92) brightness(0.96); }

.image-fail-icon { color: var(--bz-outline); }

.status-badge.offline {
    background-color: var(--bz-error);
    box-shadow: 0 0 5px rgba(186, 26, 26, 0.45);
}

.notice-btn { color: var(--bz-tertiary); font-weight: 600; }

.typing-text,
.bz-typing-text {
    color: var(--bz-primary);
    font-size: var(--bz-text-xs);
    letter-spacing: 0.02em;
}

.push-notif-avatar { border-radius: var(--bz-r-sm); }

/* the "new friends" request rail */
.request-list { padding: 8px 6px; }

.request-main { min-width: 0; }

.right-request-item:hover { background: rgba(56, 82, 68, 0.06); border-radius: var(--bz-r-md); }

.req-info { font-size: var(--bz-text-sm); color: var(--bz-on-surface-variant); }

.settings-section { margin-bottom: 22px; }

.settings-cropper-area {
    background: rgba(240, 245, 241, 0.86);
    border: 1px solid var(--bz-hairline-soft);
    border-radius: var(--bz-r-lg);
    padding: 14px;
}

.settings-profile-actions { gap: 10px; }

/* ============================================================================
   13 · RESPONSIVE — collapse gracefully, never overflow
   ========================================================================== */

@media (max-width: 1440px) {
    :root {
        --bz-list-w: 312px;
        --bz-drawer-w: 300px;
    }
}

@media (max-width: 1280px) {
    :root {
        --bz-list-w: 288px;
    }

    .chat-window { padding: var(--bz-space-md) var(--bz-space-lg) var(--bz-space-sm); }
    .input-area { margin: 0 var(--bz-space-md) var(--bz-space-sm); }
    .detail-avatar { width: 72px; height: 72px; border-radius: 22px; }
}

/* the drawer becomes an overlay plate instead of stealing a column */
@media (max-width: 1120px) {
    #app-container[style*="flex"] {
        grid-template-columns: var(--bz-rail-w) var(--bz-list-w) minmax(0, 1fr) 0;
    }

    /* an abspos grid child is positioned against its own grid area, so the
       inset has to be 0 — the row already excludes the topbar and footbar */
    #app-container > .detail-panel {
        display: flex;
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        width: 320px;
        max-width: 88vw;
        z-index: 80;
        background: var(--bz-surface-bright);
        background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.6), rgba(240, 245, 241, 0.4));
        border-left: 1px solid var(--bz-hairline-soft);
        box-shadow: -28px 0 60px -40px rgba(25, 31, 26, 0.45);
        border-radius: var(--bz-r-xl) 0 0 var(--bz-r-xl);
    }
}

@media (max-width: 980px) {
    :root {
        --bz-rail-w: 64px;
        --bz-list-w: 260px;
    }

    .rail-btn { width: 40px; height: 40px; border-radius: 13px; }
    .rail-avatar, .rail-avatar img { width: 40px; height: 40px; border-radius: 13px; }
    .bz-topbar-context, .bz-sync-pill { display: none; }
    #chat-title { font-size: 1.0625rem; }
}

@media (max-width: 860px) {
    :root {
        --bz-list-w: 240px;
    }

    .bz-brand-ver, .bz-brand-name { display: none; }
    .bz-brand { padding-right: 10px; }
    .list-title { font-size: var(--bz-text-h2); }
}

/* below this the desktop client is not the intended surface, but stay usable */
@media (max-width: 760px) {
    #app-container[style*="flex"] {
        grid-template-columns: var(--bz-rail-w) minmax(0, 1fr);
    }

    #app-container > .sidebar { display: none; }
    #app-container > .chat-area { grid-area: 2 / 2 / 3 / 3; }
    #app-container > .detail-panel { bottom: 0; }
    .bz-footbar { display: none; }
    #app-container[style*="flex"] { grid-template-rows: var(--bz-topbar-h) minmax(0, 1fr); }
}

/* Very tall or very wide shells keep the reading line comfortable */
@media (min-width: 1800px) {
    :root {
        --bz-list-w: 360px;
        --bz-drawer-w: 340px;
    }
}
