/* ===== ПОДКЛЮЧЕНИЕ ШРИФТА =====
   Inter (SIL OFL 1.1, assets/fonts/inter/OFL.txt) is served from our own origin:
   the same variable files Google Fonts delivered, without the render-blocking
   third-party @import that made text appear in the fallback face and then swap
   subset by subset. index.html preloads the Cyrillic and Latin files.
   font-weight is a range, so 425/435/465 or 615/645 render at that exact weight
   instead of snapping to the static 500/700 instances; 300 and 700 stay the
   ends, exactly as with the previous five static faces. */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 300 700; font-display: swap; src: url('assets/fonts/inter/inter-cyrillic.var.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 300 700; font-display: swap; src: url('assets/fonts/inter/inter-latin.var.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 300 700; font-display: swap; src: url('assets/fonts/inter/inter-latin-ext.var.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 300 700; font-display: swap; src: url('assets/fonts/inter/inter-cyrillic-ext.var.woff2') format('woff2'); unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 300 700; font-display: swap; src: url('assets/fonts/inter/inter-greek.var.woff2') format('woff2'); unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 300 700; font-display: swap; src: url('assets/fonts/inter/inter-greek-ext.var.woff2') format('woff2'); unicode-range: U+1F00-1FFF; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 300 700; font-display: swap; src: url('assets/fonts/inter/inter-vietnamese.var.woff2') format('woff2'); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }

/* ===== ПЕРЕМЕННЫЕ ТЁМНОЙ ТЕМЫ ===== */
:root {
    --bg: #0a0e1a;
    --bg-secondary: #111726;
    --bg-tertiary: #161d2f;
    --bg-card: #1c2334;
    --surface: var(--bg-card);
    --bg-modal: #0f1422;
    --bg-hover: rgba(255, 255, 255, 0.05);
    
    --text: #ffffff;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    
    --border: rgba(255, 255, 255, 0.10);
    --border-light: rgba(255, 255, 255, 0.06);
    --border-dark: rgba(255, 255, 255, 0.12);
    
    --primary: #6366f1;
    --primary-light: rgba(99, 102, 241, 0.15);
    --primary-text: #c4b5fd;
    --primary-dark: #4f46e5;
    --primary-grad: linear-gradient(135deg, #6d5dfc 0%, #8b5cf6 100%);
    
    --success: #10b981;
    --success-light: rgba(16, 185, 129, 0.15);
    --warning: #f59e0b;
    --warning-light: rgba(245, 158, 11, 0.15);
    --danger: #ef4444;
    --danger-light: rgba(239, 68, 68, 0.15);
    --info: #3b82f6;
    --info-light: rgba(59, 130, 246, 0.15);
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.18);
    --shadow: 0 4px 10px -2px rgba(0, 0, 0, 0.24);
    --shadow-md: 0 10px 22px -6px rgba(0, 0, 0, 0.26);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.28);
    --shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.40);

    --radius-sm: 6px;
    --radius: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    
    --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'SF Mono', Monaco, 'Cascadia Mono', monospace;
    
    --transition-fast: 150ms ease;
    --transition: 250ms ease;
    --transition-slow: 350ms ease;
}

/* ===== СТЕКЛЯННАЯ ТЕМА ===== */
body.theme-glass {
    --bg: rgba(10, 14, 26, 0.85);
    --bg-secondary: rgba(17, 23, 38, 0.92);
    --bg-tertiary: rgba(23, 30, 48, 0.9);
    --bg-card: rgba(30, 37, 54, 0.82);
    --surface: var(--bg-card);
    --bg-modal: rgba(10, 14, 26, 0.95);
    --bg-hover: rgba(255, 255, 255, 0.08);
    
    --text: #ffffff;
    --text-secondary: #e2e8f0;
    --text-muted: #cbd5e1;
    
    --border: rgba(255, 255, 255, 0.15);
    --border-light: rgba(255, 255, 255, 0.1);
    --border-dark: rgba(255, 255, 255, 0.25);
    
    --primary: #a78bfa;
    --primary-light: rgba(167, 139, 250, 0.2);
    --primary-text: #c4b5fd;
    --primary-dark: #8b5cf6;
    --primary-grad: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
}

/* ===== СВЕТЛАЯ ТЕМА ===== */
body.theme-light {
    --bg: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --bg-card: #ffffff;
    --surface: var(--bg-card);
    --bg-modal: #ffffff;
    --bg-hover: rgba(0, 0, 0, 0.03);
    
    --text: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    
    --border: rgba(15, 23, 42, 0.09);
    --border-light: rgba(15, 23, 42, 0.05);
    --border-dark: rgba(15, 23, 42, 0.14);
    
    --primary: #4f46e5;
    --primary-light: rgba(79, 70, 229, 0.08);
    --primary-text: #4338ca;
    --primary-dark: #4338ca;
    --primary-grad: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    
    --success: #059669;
    --success-light: rgba(5, 150, 105, 0.1);
    --warning: #d97706;
    --warning-light: rgba(217, 119, 6, 0.1);
    --danger: #dc2626;
    --danger-light: rgba(220, 38, 38, 0.1);
    --info: #2563eb;
    --info-light: rgba(37, 99, 235, 0.1);
    
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow: 0 4px 12px -3px rgba(15, 23, 42, 0.10);
    --shadow-md: 0 10px 24px -8px rgba(15, 23, 42, 0.14);
    --shadow-lg: 0 20px 40px -14px rgba(15, 23, 42, 0.18);
    --shadow-xl: 0 30px 60px -16px rgba(15, 23, 42, 0.22);
}

/* ===== ТЕМА «СИСТЕМА» (графит) =====
   The existing dark engine owns geometry. Graphite surfaces, a restrained teal
   interaction accent and pearl deal actions add hierarchy without tinting
   user media or replacing the established Glass/light palettes. */
html[data-ui-theme="system"] body {
    --bg: #1b2026;
    --bg-secondary: #232a31;
    --bg-tertiary: #303a43;
    --bg-card: #2c343d;
    --bg-modal: #29323b;
    --bg-primary: var(--bg);
    --surface: var(--bg-card);
    --surface-elevated: var(--bg-card);
    --accent: var(--primary);
    --bg-hover: rgba(222, 235, 240, 0.075);
    --system-panel: linear-gradient(150deg, rgba(255, 255, 255, 0.035), transparent 55%), rgba(40, 48, 56, 0.98);
    --system-bottom-nav: rgba(35, 44, 52, 0.96);
    --system-raised: linear-gradient(145deg, rgba(255, 255, 255, 0.045), transparent 65%), rgba(48, 59, 68, 0.98);
    --system-selected: linear-gradient(135deg, rgba(139, 201, 197, 0.08), transparent), rgba(44, 65, 70, 0.98);
    --system-edge: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 8px 20px rgba(0, 0, 0, 0.12);
    --system-pearl: linear-gradient(135deg, #eef1f3 0%, #dce3e7 100%);
    --system-pearl-hover: linear-gradient(135deg, #ffffff 0%, #e8eef0 100%);
    --system-pearl-ink: #1b252d;
    --system-pearl-edge: inset 0 1px 0 rgba(255, 255, 255, 0.70), 0 4px 10px rgba(0, 0, 0, 0.14);
    --system-pearl-color: #e4e9ed;
    --system-pearl-soft: rgba(228, 233, 237, 0.10);
    --system-social-fill: linear-gradient(135deg, #b2ddd6 0%, #8bc9c5 100%);
    --system-social-hover: linear-gradient(135deg, #c4e7e0 0%, #a4d6d1 100%);
    --system-social-ink: #173333;
    --system-heart: #f09baa;
    --chart-volume: var(--system-pearl-color);

    --text: #f2f5f7;
    --text-secondary: #d0dbe2;
    --text-muted: #b5c3cd;

    --border: rgba(214, 229, 236, 0.13);
    --border-light: rgba(214, 229, 236, 0.07);
    --border-dark: rgba(214, 229, 236, 0.23);

    --primary: #8bc9c5;
    --primary-rgb: 139, 201, 197;
    --primary-light: rgba(139, 201, 197, 0.12);
    --primary-text: #b2ddd6;
    --primary-dark: #355c61;
    --primary-grad: linear-gradient(135deg, #3c6568 0%, #2e5059 100%);

    --success: #30d158;
    --success-light: rgba(48, 209, 88, 0.16);
    --warning: #ff9f0a;
    --warning-light: rgba(255, 159, 10, 0.16);
    --danger: #ff453a;
    --danger-light: rgba(255, 69, 58, 0.16);
    --info: #8bc9c5;
    --info-light: rgba(139, 201, 197, 0.12);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.20);
    --shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.24);
    --shadow-md: 0 10px 24px -6px rgba(0, 0, 0, 0.28);
    --shadow-lg: 0 20px 30px -8px rgba(0, 0, 0, 0.34);
    --shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.45);
}

/* Night is a saved choice using System's component geometry, not a new stack
   of component overrides. Other themes retain their palettes unchanged. */
html[data-ui-theme="system"] body.theme-night {
    --bg: #000000;
    --bg-secondary: #111112;
    --bg-tertiary: #2c2c2e;
    --bg-card: #1c1c1e;
    --bg-modal: #1c1c1e;
    --bg-hover: rgba(255, 255, 255, .07);
    --system-panel: #1c1c1e;
    --system-bottom-nav: rgba(28, 28, 30, .96);
    --system-raised: #2c2c2e;
    --system-selected: #323235;
    --system-edge: inset 0 1px 0 rgba(255, 255, 255, .04);
    --system-pearl: #eeeeef;
    --system-pearl-hover: #ffffff;
    --system-pearl-ink: #161617;
    --system-pearl-edge: none;
    --system-social-fill: #8acbff;
    --system-social-hover: #aedbff;
    --system-social-ink: #08273d;
    --text: #f5f5f7;
    --text-secondary: #ccccd1;
    --text-muted: #a1a1aa;
    --border: rgba(255, 255, 255, .12);
    --border-light: rgba(255, 255, 255, .07);
    --border-dark: rgba(255, 255, 255, .20);
    --primary: #69b7ff;
    --primary-rgb: 105, 183, 255;
    --primary-light: rgba(105, 183, 255, .12);
    --primary-text: #91ccff;
    --primary-dark: #174b76;
    --primary-grad: linear-gradient(135deg, #225e8e, #16466f);
    --info: #69b7ff;
    --info-light: rgba(105, 183, 255, .12);
}

/* Pearl is the primary action; communication uses the existing teal variant.
   White bubble text stays on deep teal. */
html[data-ui-theme="system"] body.theme-system .btn.primary,
html[data-ui-theme="system"] body.theme-system .fab,
html[data-ui-theme="system"] body.theme-system .wallet-onramp-actions .btn.primary,
html[data-ui-theme="system"] body.theme-system .onramp-actions-row .btn.primary,
html[data-ui-theme="system"] body.theme-system #create-new-deal-btn,
html[data-ui-theme="system"] body.theme-system .listings-page #listing-create-btn,
html[data-ui-theme="system"] body.theme-system .listings-page button[data-listing-create].btn.primary,
html[data-ui-theme="system"] body.theme-system .listing-detail-action-stack .btn.primary:not([data-listing-favorite]),
html[data-ui-theme="system"] body.theme-system .listing-details-actions .btn.primary:not([data-listing-favorite]) {
    color: var(--system-pearl-ink) !important;
    background: var(--system-pearl) !important;
    border-color: rgba(255, 255, 255, 0.72) !important;
    box-shadow: var(--system-pearl-edge) !important;
}

html[data-ui-theme="system"] body.theme-system .btn.primary:hover:not(:disabled),
html[data-ui-theme="system"] body.theme-system .fab:hover,
html[data-ui-theme="system"] body.theme-system #create-new-deal-btn:hover,
html[data-ui-theme="system"] body.theme-system .listings-page #listing-create-btn:hover,
html[data-ui-theme="system"] body.theme-system .listings-page button[data-listing-create].btn.primary:hover {
    background: var(--system-pearl-hover) !important;
    box-shadow: inset 0 1px 0 #fff, 0 12px 26px rgba(0, 0, 0, .30) !important;
}

html[data-ui-theme="system"] body.theme-system .btn.secondary:not(:disabled) {
    color: var(--text);
    background: var(--system-raised);
    border-color: var(--border-dark);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16);
}

html[data-ui-theme="system"] body.theme-system .btn.secondary:hover:not(:disabled),
html[data-ui-theme="system"] body.theme-system .btn.secondary:focus-visible:not(:disabled) {
    background: var(--system-selected);
    border-color: rgba(255, 255, 255, .34);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .21), 0 7px 18px rgba(0, 0, 0, .18);
}

html[data-ui-theme="system"] body.theme-system .btn.ghost:hover:not(:disabled),
html[data-ui-theme="system"] body.theme-system .btn.ghost:focus-visible:not(:disabled) {
    color: var(--text);
    background: var(--system-raised);
}

html[data-ui-theme="system"] body.theme-system .dashboard-row-icon.tone-primary {
    color: var(--system-pearl-ink);
    background: var(--system-pearl);
    box-shadow: var(--system-pearl-edge);
}

html[data-ui-theme="system"] body.theme-system .profile-settings-summary-icon {
    color: var(--text);
    background: var(--system-raised);
    box-shadow: var(--system-edge);
}

/* Cover placeholders use a neutral surface; actual photo backgrounds remain intact. */
html[data-ui-theme="system"] body.theme-system .listing-card-cover:not(.has-image-bg) {
    background: var(--system-raised) !important;
}

/* Viewer form rules later in the file use four classes and !important;
   match the viewer owner here so System focus paint wins at desktop as well. */
html[data-ui-theme="system"] body.theme-system :is(.profile-photo-viewer, .feed-post-media-viewer) .profile-photo-comment-form.feed-viewer-comment-form input[name="body"]:focus-visible {
    outline-color: var(--primary) !important;
}

html[data-ui-theme="system"] body.theme-system .wallet-disclosure > summary:is(:hover, :focus-visible) {
    color: var(--text);
    background: var(--system-selected);
}

html[data-ui-theme="system"] body.theme-system .stories-rail__add {
    color: var(--system-pearl-ink);
    background: var(--system-pearl);
    border-color: var(--bg-secondary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .24);
}
html[data-ui-theme="system"] body.theme-system .stories-rail__add:is(:hover, :focus-visible) {
    background: var(--system-pearl-hover);
    outline-color: var(--primary);
}

html[data-ui-theme="system"] body.theme-system .feed-toolbar .feed-my-wall-btn {
    color: var(--text) !important;
    background: var(--system-raised) !important;
    border-color: var(--border-dark) !important;
    box-shadow: var(--system-edge) !important;
}

html[data-ui-theme="system"] body.theme-system button.feed-share-recipient:is(:hover, :focus-visible) {
    background: var(--system-selected);
    border-color: var(--border-dark);
}

html[data-ui-theme="system"] body.theme-system .feed-comment-parent {
    background: var(--system-panel);
    border-color: var(--border-dark);
}

html[data-ui-theme="system"] body.theme-system .feed-comment-focus {
    background: var(--system-selected) !important;
}

html[data-ui-theme="system"] body.theme-system .social-reaction-chip[aria-pressed="true"] {
    color: var(--primary-text);
    background: var(--system-selected);
    border-color: var(--primary);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08);
}

html[data-ui-theme="system"] body.theme-system .social-reaction-add:is(:hover, :focus-visible),
html[data-ui-theme="system"] body.theme-system .forum-chat-emoji-toggle:is(:hover, :focus-visible, [aria-expanded="true"]),
html[data-ui-theme="system"] body.theme-system .forum-chat-attach:is(:hover, :focus-visible) {
    color: var(--text);
    background: var(--system-selected);
    border-color: var(--border-dark);
}

html[data-ui-theme="system"] body.theme-system .social-reaction-picker,
html[data-ui-theme="system"] body.theme-system .forum-chat-emoji-popover {
    background: var(--system-panel);
    border-color: var(--border-dark);
    box-shadow: var(--system-edge);
}

html[data-ui-theme="system"] body.theme-system .forum-topic-unread {
    color: var(--system-pearl-ink);
    background: var(--system-pearl);
}



html[data-ui-theme="system"] body.theme-system .listings-mode-tab.active {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 8px 20px rgba(0, 0, 0, .24);
}

html[data-ui-theme="system"] body.theme-system .dashboard-v2 .dashboard-chart-wrap {
    background: linear-gradient(180deg, rgba(139, 201, 197, .065), transparent 68%), rgba(18, 26, 31, .22);
    border-color: rgba(139, 201, 197, .16);
}

html[data-ui-theme="system"] body.theme-system .dashboard-action-card:hover {
    border-color: rgba(188, 188, 196, 0.32);
}

/* Text accents are light on graphite, but white labels need the darker action
   fill. These controls use --primary directly as a background in the base UI. */
html[data-ui-theme="system"] body.theme-system .chat-item-badge,
html[data-ui-theme="system"] body.theme-system .search-box .btn.icon,
html[data-ui-theme="system"] body.theme-system .avatar-edit-btn,
html[data-ui-theme="system"] body.theme-system .avatar.large::after,
html[data-ui-theme="system"] body.theme-system .admin-tab.active,
html[data-ui-theme="system"] body.theme-system .profile-tab.active,
html[data-ui-theme="system"] body.theme-system .security-tab.active,
html[data-ui-theme="system"] body.theme-system .auth-tab.active,
html[data-ui-theme="system"] body.theme-system .filter-tab.active,
html[data-ui-theme="system"] body.theme-system .voice-rec-btn.primary,
html[data-ui-theme="system"] body.theme-system .chat-forward-avatar,
html[data-ui-theme="system"] body.theme-system .chat-forward-inline-btn.primary,
html[data-ui-theme="system"] body.theme-system .chat-forward-send,
html[data-ui-theme="system"] body.theme-system .chat-forward-inline-icon,
html[data-ui-theme="system"] body.theme-system .chat-input-area.forward-mode #send-message-btn:not(:disabled),
html[data-ui-theme="system"] body.theme-system .message-group-invite-accept,
html[data-ui-theme="system"] body.theme-system .chats-page .group-mode-actions [data-group-save]:not(:disabled),
html[data-ui-theme="system"] body.theme-system .message-actions-menu .btn.icon:hover:not(.message-delete-btn),
html[data-ui-theme="system"] body.theme-system .chat-archive-stack i,
html[data-ui-theme="system"] body.theme-system .forum-page-button:hover:not(:disabled),
html[data-ui-theme="system"] body.theme-system .forum-page-button.active {
    color: #fff !important;
    background: var(--primary-grad) !important;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

/* Graphite theme: the deals surface and progress accents follow the theme palette. */
html[data-ui-theme="system"] body.theme-system .page-content:has(.deals-page) {
    background: var(--bg) !important;
}

html[data-ui-theme="system"] body.theme-system .deals-page .deals-sidebar,
html[data-ui-theme="system"] body.theme-system .deals-page .deal-details-card,
html[data-ui-theme="system"] body.theme-system .deals-page .deal-info-section,
html[data-ui-theme="system"] body.theme-system .deals-page .deal-actions-section,
html[data-ui-theme="system"] body.theme-system .deals-page .deal-history-section,
html[data-ui-theme="system"] body.theme-system .deals-page .deal-delivery-section,
html[data-ui-theme="system"] body.theme-system .deals-page .deal-dispute-section {
    background: var(--system-panel) !important;
    border-color: var(--border) !important;
    box-shadow: var(--system-edge) !important;
}

html[data-ui-theme="system"] body.theme-system .deals-page .deals-sidebar::before,
html[data-ui-theme="system"] body.theme-system .deals-page .deal-details-card::before {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), transparent) !important;
}

html[data-ui-theme="system"] body.theme-system .deals-page .deal-list-item::before,
html[data-ui-theme="system"] body.theme-system .deals-page .deals-sidebar-header h2::before {
    background: var(--primary-grad) !important;
    box-shadow: none !important;
}

html[data-ui-theme="system"] body.theme-system .deals-page .deal-list-item.active {
    background: var(--system-selected) !important;
    border-color: rgba(255, 255, 255, 0.20) !important;
}

html[data-ui-theme="system"] body.theme-system .deals-page .deal-header-right,
html[data-ui-theme="system"] body.theme-system .deals-page .deal-timeline,
html[data-ui-theme="system"] body.theme-system .deals-page .deal-contract-panel {
    background: var(--system-raised) !important;
    border-color: var(--border-dark) !important;
    box-shadow: var(--system-edge) !important;
}

html[data-ui-theme="system"] body.theme-system .deals-page .deal-amount,
html[data-ui-theme="system"] body.theme-system .deals-page .deal-item-amount {
    color: var(--text) !important;
    text-shadow: none !important;
}

html[data-ui-theme="system"] body.theme-system .deals-page .deal-subtitle .deal-id,
html[data-ui-theme="system"] body.theme-system .deals-page .deals-group-count,
html[data-ui-theme="system"] body.theme-system .deals-page #deals-filter-toggle,
html[data-ui-theme="system"] body.theme-system .deals-page .deal-open-btn {
    color: var(--text) !important;
    background: var(--system-selected) !important;
    border-color: var(--border-dark) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16) !important;
}

html[data-ui-theme="system"] body.theme-system .deals-page .deal-timeline .status-step::before {
    background: #65656b !important;
}

html[data-ui-theme="system"] body.theme-system .deals-page .deal-timeline .status-step.active .status-dot {
    background: #e5e5ea !important;
    border-color: #8e8e93 !important;
    box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.12) !important;
}

html[data-ui-theme="system"] body.theme-system .deals-page .deal-timeline .status-step.upcoming .status-dot {
    background: #444447 !important;
    border-color: #77777d !important;
}

html[data-ui-theme="system"] body.theme-system .deals-page .deal-timeline .status-step.completed::before,
html[data-ui-theme="system"] body.theme-system .deals-page .deal-timeline .status-step.completed .status-dot {
    background: #30d158 !important;
}

html[data-ui-theme="system"] body.theme-system .deals-page .deal-timeline .status-label {
    color: var(--text-muted) !important;
}

html[data-ui-theme="system"] body.theme-system .deals-page .deal-timeline .status-step.active .status-label,
html[data-ui-theme="system"] body.theme-system .deals-page .deal-timeline .status-step.completed .status-label {
    color: var(--text) !important;
}

html[data-ui-theme="system"] body.theme-system #deal-details-content .deal-details-card > .deal-crypto-panel {
    background: var(--system-raised) !important;
    border-color: var(--border-dark) !important;
    box-shadow: var(--system-edge) !important;
}

html[data-ui-theme="system"] body.theme-system #deal-details-content .deal-details-card > .deal-crypto-panel::before {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent) !important;
}

html[data-ui-theme="system"] body.theme-system .deals-page .deal-crypto-panel > .deal-timeline {
    background: none !important;
    border-color: rgba(255, 255, 255, 0.14) !important;
}

html[data-ui-theme="system"] body.theme-system .deals-page .deal-section-title-icon {
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--border);
}

html[data-ui-theme="system"] body.theme-system .deals-page .deal-section-title-participants .deal-section-title-icon {
    color: var(--success);
}

html[data-ui-theme="system"] body.theme-system .deals-page .deal-section-title-dispute .deal-section-title-icon {
    color: var(--danger);
}

html[data-ui-theme="system"] body.theme-system .deals-page .deal-status.accepted,
html[data-ui-theme="system"] body.theme-system .deals-page .deal-status.funded,
html[data-ui-theme="system"] body.theme-system .deals-page .deal-status.delivered,
html[data-ui-theme="system"] body.theme-system .deals-page .deal-item-status.accepted,
html[data-ui-theme="system"] body.theme-system .deals-page .deal-item-status.funded,
html[data-ui-theme="system"] body.theme-system .deals-page .deal-item-status.delivered {
    background: #55555a !important;
    border-color: #77777d !important;
    color: var(--text) !important;
}

html[data-ui-theme="system"] body.theme-system .deals-page .deal-actions .btn.primary {
    background: var(--system-pearl) !important;
    border-color: rgba(255, 255, 255, 0.72) !important;
    color: var(--system-pearl-ink) !important;
    box-shadow: var(--system-pearl-edge) !important;
}

/* System colour audit: several legacy components bypass the theme tokens.
   Keep these scoped overrides beside the palette. !important mirrors the
   component declarations (including inline swipe styles); no geometry or
   media pixels are changed. */
html[data-ui-theme="system"] body.theme-system :is(h1, .forum-community-brand > div b) {
    color: var(--text);
    background: none;
    -webkit-text-fill-color: currentColor;
}

html[data-ui-theme="system"] body.theme-system .chats-page {
    --chat-surface-soft: rgba(40, 48, 56, .90);
    --chat-surface-pill: rgba(48, 59, 68, .96);
    --chat-hover-soft: rgba(255, 255, 255, .10);
    --chat-active-soft: var(--primary-light);
}

html[data-ui-theme="system"] body.theme-system :is(
    .profile-theme-choice button.active,
    .profile-toggle-row input[type="checkbox"]:checked,
    .alert-preferences input[type="checkbox"]:checked,
    .profile-unblock-btn,
    .message-select-toggle.selected,
    .profile-story-reply-send,
    .profile-story-save-settings,
    .profile-photo-user-follow,
    .profile-followers-tab.active,
    .profile-photo-comment-page-btn.active,
    .chat-toggle.active,
    .chat-attachment-compose-check:not([aria-pressed="false"]),
    .chat-attachment-compose-file-icon,
    .chat-attachment-compose-send,
    .chat-scroll-down-count,
    .message-feed-post-actions.single-action button.primary,
    .listings-page-btn.active,
    .listings-mine-tab.active,
    .listings-quick-chip.active,
    .listings-layout-btn.active,
    .forum-community-nav-item.active
) {
    color: #fff !important;
    background: var(--primary-grad) !important;
    border-color: var(--border-dark) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), var(--shadow-sm) !important;
}

html[data-ui-theme="system"] body.theme-system #app .btn.primary {
    color: var(--system-pearl-ink) !important;
    background: var(--system-pearl) !important;
    border-color: rgba(255, 255, 255, .72) !important;
    box-shadow: var(--system-pearl-edge) !important;
}

html[data-ui-theme="system"] body.theme-system #chat-media-forward.chat-media-action,
html[data-ui-theme="system"] body.theme-system #chat-messages .message-swipe-reply-icon,
html[data-ui-theme="system"] body.theme-system #new-messages-btn {
    color: #fff !important;
    background: var(--primary-grad) !important;
    border-color: var(--border-dark) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), var(--shadow-sm) !important;
}

html[data-ui-theme="system"] body.theme-system #app .btn.primary:hover:not(:disabled) {
    background: var(--system-pearl-hover) !important;
    box-shadow: inset 0 1px 0 #fff, 0 12px 26px rgba(0, 0, 0, .30) !important;
}

html[data-ui-theme="system"] body.theme-system .btn.guarant:not(.disabled):not(:disabled),
html[data-ui-theme="system"] body.theme-system .listing-detail-action-stack .btn[data-listing-buy-prepare]:not(:disabled),
html[data-ui-theme="system"] body.theme-system .listing-details-actions .btn[data-listing-buy-prepare]:not(:disabled),
html[data-ui-theme="system"] body.theme-system .wallet-btn-primary:not(:disabled),
html[data-ui-theme="system"] body.theme-system :is(.profile-photo-viewer, .feed-post-media-viewer) .profile-photo-comment-form .profile-photo-comment-send,
html[data-ui-theme="system"] body.theme-system .p2p-primary-action:is(.buy, .sell):not(:disabled),
html[data-ui-theme="system"] body.theme-system #chat-active #send-message-btn:not(:disabled),
html[data-ui-theme="system"] body.theme-system .forum-chat-send {
    color: var(--system-pearl-ink) !important;
    background: var(--system-pearl) !important;
    border-color: rgba(255, 255, 255, .72) !important;
    box-shadow: var(--system-pearl-edge) !important;
}

html[data-ui-theme="system"] body.theme-system :is(.profile-photo-viewer, .feed-post-media-viewer) .profile-photo-comment-form .profile-photo-comment-send:disabled {
    color: var(--text-muted) !important;
    background: var(--system-raised) !important;
    border-color: var(--border) !important;
    box-shadow: none !important;
}

html[data-ui-theme="system"] body.theme-system .btn.guarant:not(.disabled):not(:disabled):hover,
html[data-ui-theme="system"] body.theme-system .listing-detail-action-stack .btn[data-listing-buy-prepare]:not(:disabled):hover,
html[data-ui-theme="system"] body.theme-system .listing-details-actions .btn[data-listing-buy-prepare]:not(:disabled):hover,
html[data-ui-theme="system"] body.theme-system .wallet-btn-primary:not(:disabled):hover,
html[data-ui-theme="system"] body.theme-system :is(.profile-photo-viewer, .feed-post-media-viewer) .profile-photo-comment-form .profile-photo-comment-send:not(:disabled):hover,
html[data-ui-theme="system"] body.theme-system .p2p-primary-action:is(.buy, .sell):not(:disabled):hover,
html[data-ui-theme="system"] body.theme-system #chat-active #send-message-btn:not(:disabled):hover,
html[data-ui-theme="system"] body.theme-system .forum-chat-send:not(:disabled):hover {
    background: var(--system-pearl-hover) !important;
    box-shadow: inset 0 1px 0 #fff, 0 12px 26px rgba(0, 0, 0, .30) !important;
}

html[data-ui-theme="system"] body.theme-system #chat-media-forward.chat-media-action:hover {
    background: var(--primary-dark) !important;
    box-shadow: var(--shadow) !important;
}

html[data-ui-theme="system"] body.theme-system :is(
    .profile-quick-card:hover,
    .profile-follower-row:hover,
    .profile-followers-more,
    .profile-photo-comment-page-btn,
    .profile-theme-choice button:not(.active),
    .tool-btn:hover,
    .vk-feed-card .feed-action:hover:not(.active),
    .feed-my-wall-btn,
    .chat-sheet-action.is-active,
    .chat-dialog-pin-badge,
    .chat-reaction-quick.active,
    .message-reactions .reaction-btn.active,
    .message-feed-post-actions button:not(.primary),
    .listings-quick-chip:not(.active),
    .listings-active-filter-chip,
    .listings-active-filter-chip b,
    .listings-active-filter-reset,
    .dashboard-v2 .dashboard-panel-head-actions .dashboard-link,
    .dashboard-v2 .dashboard-panel-head > .dashboard-link,
    .badge.primary,
    .badge.info,
    .listing-mini-tags span,
    .listing-info-badge,
    .listing-card-stats span:not(:first-child),
    .listing-detail-action-stack .btn[data-seller-profile],
    .listing-details-actions .btn[data-seller-profile],
    .listing-detail-action-stack .btn.secondary:not([data-listing-favorite]):not([data-seller-profile]),
    .listing-details-actions .btn.secondary:not([data-seller-profile]),
    .forum-new-topic-badge
) {
    color: var(--primary-text) !important;
    background: var(--primary-light) !important;
    border-color: var(--border-dark) !important;
    box-shadow: none !important;
}

html[data-ui-theme="system"] body.theme-system :is(
    .profile-photo-comment-author,
    .profile-photo-comment .profile-safe-link,
    .feed-post-media-viewer .profile-photo-comments-list .feed-comment-author,
    .feed-post-media-viewer .profile-photo-comments-list [data-feed-profile-link],
    .message-feed-post-author-line .message-feed-share-author,
    .message-feed-post-author-line .message-feed-share-author-static,
    .listing-deal-amount-card small
) {
    color: var(--primary-text) !important;
}

html[data-ui-theme="system"] body.theme-system :is(
    .profile-followers-panel,
    .profile-photo-modal-card,
    .dashboard-clear-modal,
    .p2p-modal-card,
    .listing-deal-panel,
    .forum-create-modal
) {
    color: var(--text);
    background: var(--bg-modal) !important;
    border-color: var(--border-dark) !important;
    box-shadow: var(--shadow-xl) !important;
}

html[data-ui-theme="system"][data-theme="dark"] body.theme-system .deal-action-modal-overlay .deal-action-modal {
    background: var(--bg-modal) !important;
    box-shadow: var(--shadow-xl) !important;
}

html[data-ui-theme="system"][data-theme="dark"] body.theme-system .deal-action-modal-overlay .deal-action-modal::before {
    background: none;
}

html[data-ui-theme="system"] body.theme-system :is(
    .profile-followers-head,
    .profile-photo-modal-input,
    .listing-deal-summary,
    .listing-deal-amount-card,
    .listing-rules-notice,
    .listing-policy-box,
    .feed-policy-box,
    .forum-community-sidebar,
    .forum-live-banner,
    .p2p-modal-hint
) {
    color: var(--text-secondary);
    background: var(--system-raised) !important;
    border-color: var(--border-dark) !important;
    box-shadow: var(--system-edge);
}

html[data-ui-theme="system"] body.theme-system :is(
    .profile-photo-modal-input:focus,
    .p2p-modal-card input:focus,
    .p2p-modal-card select:focus,
    .p2p-modal-card textarea:focus
) {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px var(--primary-light) !important;
}

html[data-ui-theme="system"][data-theme="dark"] body.theme-system .deal-action-modal-overlay :is(.input, .select, .textarea, .delivery-view-payload) {
    background: var(--bg-tertiary) !important;
    border-color: var(--border-dark) !important;
}

html[data-ui-theme="system"][data-theme="dark"] body.theme-system .deal-action-modal-overlay :is(.input, .select, .textarea):focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px var(--primary-light) !important;
}

html[data-ui-theme="system"] body.theme-system #chat-active :is(.voice-recording-panel, .chat-typing-indicator),
html[data-ui-theme="system"] body.theme-system .chat-scroll-down-btn {
    background: var(--system-raised) !important;
    border-color: var(--border-dark) !important;
    box-shadow: var(--system-edge) !important;
}

html[data-ui-theme="system"] body.theme-system #chats-list .chat-item.pinned-dialog {
    background: var(--primary-light) !important;
    border-color: var(--border-dark) !important;
    box-shadow: inset 3px 0 0 var(--primary), var(--shadow-sm) !important;
}

html[data-ui-theme="system"] body.theme-system #chats-list .chat-item.pinned-dialog:hover {
    background: var(--bg-hover) !important;
}

html[data-ui-theme="system"] body.theme-system #listings-reset-filters {
    color: var(--primary-text);
    background: var(--primary-light);
    border-color: var(--border-dark);
    box-shadow: none;
}

html[data-ui-theme="system"] body.theme-system #listings-reset-filters:is(:hover, :focus-visible) {
    color: #fff;
    background: var(--primary-grad);
    border-color: var(--border-dark);
    box-shadow: var(--shadow-sm);
}

html[data-ui-theme="system"] body.theme-system .dashboard-v2 .dashboard-clear-icon-btn {
    background: var(--danger-light);
}

html[data-ui-theme="system"] body.theme-system .dashboard-v2 .dashboard-clear-icon-btn:is(:hover, :focus-visible):not(:disabled) {
    background: color-mix(in srgb, var(--danger) 24%, transparent);
}

html[data-ui-theme="system"] body.theme-system #chat-messages .message.sent :is(.chat-media-album-caption, .chat-attachment-caption-text) {
    background: var(--primary-grad);
}

/* Call surfaces have their own legacy !important skins; System owns colour only. */
html[data-ui-theme="system"] body.theme-system #call-modal.call-fullscreen.call-reference-ui:not(.incoming-call) {
    background: rgba(22, 28, 33, .95) !important;
}
html[data-ui-theme="system"] body.theme-system #call-modal:not(.incoming-call) .call-backdrop {
    background: linear-gradient(145deg, rgba(43, 54, 62, .86), rgba(22, 28, 33, .96)) !important;
}
html[data-ui-theme="system"] body.theme-system #call-modal.incoming-call .call-backdrop {
    background: rgba(22, 28, 33, .18) !important;
}
html[data-ui-theme="system"] body.theme-system #call-modal .call-wrapper {
    background: var(--system-panel) !important;
    border-color: var(--border-dark) !important;
}
html[data-ui-theme="system"] body.theme-system #call-modal .call-wrapper::before {
    background: radial-gradient(circle, rgba(139, 201, 197, .08), transparent 70%) !important;
}
html[data-ui-theme="system"] body.theme-system #call-modal :is(.call-avatar-ring, .call-video-avatar-ring) {
    background: linear-gradient(145deg, var(--system-pearl-color), var(--primary)) !important;
    box-shadow: 0 0 32px rgba(139, 201, 197, .14), var(--shadow-lg) !important;
}
html[data-ui-theme="system"] body.theme-system #call-modal :is(.call-avatar-img, .call-video-avatar-img) {
    background: var(--system-selected) !important;
    color: var(--text) !important;
}
html[data-ui-theme="system"] body.theme-system #call-modal :is(.call-name, .call-status, .call-peer-state) {
    color: var(--text) !important;
}
html[data-ui-theme="system"] body.theme-system #call-modal .call-action-btn:not(.call-end-circle):not(.call-decline-circle):not(.call-accept-circle):not(.active-off) {
    background: var(--system-raised) !important;
    border-color: var(--border-dark) !important;
    color: var(--text) !important;
}

html[data-ui-theme="system"] body.theme-system .forum-community-reply.is-own {
    --forum-bubble-bg: var(--primary-grad);
}

html[data-ui-theme="system"] body.theme-system .forum-community-reply.is-own .forum-reply-bubble,
html[data-ui-theme="system"] body.theme-system .forum-community-reply.is-own:hover .forum-reply-bubble {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), var(--shadow-sm);
}

html[data-ui-theme="system"] body.theme-system .forum-community-reply.is-own .forum-parent-quote {
    background: rgba(0, 0, 0, .18);
}

html[data-ui-theme="system"] body.theme-system .forum-community-reply.is-own header :is(span, time) {
    color: var(--text);
}

html[data-ui-theme="system"] body.theme-system .forum-community-reply.is-own .forum-parent-quote span {
    color: var(--text-secondary);
}

html[data-ui-theme="system"] body.theme-system .forum-chat-composer {
    border-color: rgba(255, 255, 255, .07);
    background: linear-gradient(150deg, rgba(255, 255, 255, .035), transparent 55%), rgba(40, 48, 56, .98);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07), 0 8px 20px rgba(0, 0, 0, .12);
}

html[data-ui-theme="system"] body.theme-system :is(
    .forum-community-back:hover,
    .forum-community-mobile-nav .forum-mobile-create .forum-mobile-nav-icon,
    .listing-policy-icon,
    .listing-deal-icon,
    .p2p-modal-icon
) {
    background: var(--primary-grad);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), var(--shadow-sm);
}

html[data-ui-theme="system"] body.theme-system :is(
    .sidebar .sidebar-item:focus-visible,
    .feed-post-media-viewer .profile-photo-comment-form.feed-viewer-comment-form input[name="body"]:focus-visible,
    .p2p-order-actions button[data-p2p-order-action]:focus-visible
) {
    outline-color: var(--primary) !important;
}

/* Native graphite details on components with their own legacy blue/violet paint. */
html[data-ui-theme="system"] body.theme-system :is(
    .profile-photo-mini-btn,
    .profile-photo-album-card,
    .profile-photo-move-list button,
    .dispute-card-v2,
    .dispute-details-card,
    .dispute-details-empty,
    .feed-dialog,
    .help-center-page .help-quick-card,
    .help-center-page .help-news-card:not(.is-critical),
    .help-center-page .help-article:not(.is-critical)
) {
    background: var(--system-panel);
    border-color: var(--border);
    box-shadow: var(--system-edge);
}

html[data-ui-theme="system"] body.theme-system :is(
    .profile-photo-album-card:hover,
    .profile-photo-album-card.active,
    .profile-photo-move-list button:hover,
    .dispute-card-v2:hover,
    .dispute-card-v2.selected,
    .help-center-page .help-quick-card:hover,
    .help-center-page .help-back-link:hover
) {
    background: var(--system-selected);
    border-color: var(--border-dark);
    box-shadow: var(--system-edge);
}

html[data-ui-theme="system"] body.theme-system .help-center-page .help-article.is-critical {
    background: var(--system-panel);
    box-shadow: var(--system-edge);
}

html[data-ui-theme="system"] body.theme-system :is(
    .profile-photo-album-cover,
    .dispute-details-empty > span,
    .disputes-empty-state > span,
    .help-center-page .help-quick-card.is-updates span
) {
    background: var(--system-raised);
    border-color: var(--border-dark);
    box-shadow: var(--system-edge);
}

html[data-ui-theme="system"] body.theme-system :is(
    .listing-favorite-btn,
    .listing-favorite-btn:hover,
    .listing-favorite-btn.active,
    .feed-page .feed-carousel-nav:hover,
    .feed-page .feed-carousel-nav:focus-visible
) {
    border-color: var(--border-dark);
}

html[data-ui-theme="system"] body.theme-system .feed-page .feed-carousel-nav:is(:hover, :focus-visible) {
    background: var(--primary-dark);
}

html[data-ui-theme="system"] body.theme-system .feed-post-media-viewer .profile-photo-nav:focus-visible {
    outline-color: var(--primary);
}

html[data-ui-theme="system"] body.theme-system .feed-safe-link {
    color: var(--primary-text);
    border-color: var(--border-dark);
}

html[data-ui-theme="system"] body.theme-system .feed-safe-link:is(:hover, :focus-visible) {
    color: var(--text);
    border-color: var(--text-secondary);
}

html[data-ui-theme="system"] body.theme-system .feed-external-link-dialog::before {
    background: linear-gradient(90deg, var(--primary-dark), var(--primary), var(--primary-dark));
}

html[data-ui-theme="system"] body.theme-system :is(.listings-leaflet-map, .listing-form-map) {
    background: var(--system-panel);
    border-color: var(--border-dark);
}

html[data-ui-theme="system"] body.theme-system :is(.listing-form-map-wrap, .listings-map-list-empty) {
    background: var(--system-panel);
    border-color: var(--border-dark);
    box-shadow: var(--system-edge);
}

html[data-ui-theme="system"] body.theme-system .listings-map-view.is-loading .listings-leaflet-map::after {
    background: linear-gradient(135deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .025));
}

html[data-ui-theme="system"] body.theme-system .listings-map-search-area {
    --listings-map-area-shadow-start: rgba(0, 0, 0, .24);
    --listings-map-area-shadow-end: rgba(0, 0, 0, .34);
    box-shadow: 0 14px 34px var(--listings-map-area-shadow-start);
}

html[data-ui-theme="system"] body.theme-system :is(
    .forum-category-card.blue > span,
    .forum-category-card.violet > span,
    .forum-category-card.cyan > span
) {
    color: var(--primary-text);
    background: var(--system-raised);
    box-shadow: var(--system-edge);
}

html[data-ui-theme="system"] body.theme-system .forum-live-orb::after {
    border-color: rgba(255, 255, 255, .42);
}

html[data-ui-theme="system"] body.theme-system .forum-live-banner button {
    color: var(--bg);
    background: #f5f5f7;
    box-shadow: inset 0 1px 0 #fff, 0 6px 16px rgba(0, 0, 0, .16);
}

html[data-ui-theme="system"] body.theme-system .security-center-v3 .security-setting-icon.tone-primary {
    color: var(--primary-text);
    background: var(--system-raised);
    border-color: var(--border-dark);
    box-shadow: var(--system-edge);
}

html[data-ui-theme="system"] body.theme-system .security-center-v3 .security-form input:focus {
    border-color: var(--primary);
    background: var(--system-selected);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* Profile/feed comment controls and security switches use hard-coded violet in
   their source rules. Keep their geometry and status semantics unchanged. */
html[data-ui-theme="system"] body.theme-system .feed-comment-send.chat-send-style {
    color: var(--system-pearl-ink);
    background: var(--system-pearl);
    box-shadow: var(--system-pearl-edge);
}

html[data-ui-theme="system"] body.theme-system .feed-comment-send.chat-send-style:is(:hover, :focus-visible) {
    background: var(--system-pearl-hover);
    box-shadow: inset 0 1px 0 #fff, 0 12px 26px rgba(0, 0, 0, .30);
}

html[data-ui-theme="system"] body.theme-system .profile-page.profile-redesign .profile-viewers-eye-btn,
html[data-ui-theme="system"] body.theme-system .feed-post-head-actions .feed-icon-btn[data-feed-report] {
    color: var(--primary-text);
    background: var(--system-raised);
    border-color: var(--border-dark);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12);
}

html[data-ui-theme="system"] body.theme-system .profile-page.profile-redesign .profile-viewers-eye-btn:is(:hover, :focus-visible) {
    background: var(--system-selected);
    border-color: var(--border-dark);
}

html[data-ui-theme="system"] body.theme-system .feed-post-head-actions .feed-icon-btn[data-feed-report]:is(:hover, :focus-visible) {
    color: #fff;
    background: var(--primary-grad);
    border-color: var(--border-dark);
}

html[data-ui-theme="system"] body.theme-system .profile-page.profile-redesign .info-card h3 .profile-section-title-icon {
    color: var(--primary-text) !important;
}

html[data-ui-theme="system"] body.theme-system .security-center-v3 .security-switch input:checked + span {
    background: var(--primary-grad);
    border-color: var(--border-dark);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .20);
}

html[data-ui-theme="system"] body.theme-system .security-center-v3 .security-switch input:focus-visible + span {
    box-shadow: 0 0 0 3px var(--primary-light);
}

html[data-ui-theme="system"] body.theme-system .security-center-v3 .security-link-btn {
    color: var(--primary-text);
}

html[data-ui-theme="system"] body.theme-system .help-center-page {
    --border-color: var(--border);
    --text-primary: var(--text);
}

html[data-ui-theme="system"] body.theme-system .help-center-page :is(
    .help-hero-icon,
    .help-section-icon:not(.tone-warning),
    .help-quick-card span,
    .help-news-card:not(.is-critical) .help-news-dot
) {
    color: var(--primary-text);
    background: var(--system-raised);
    box-shadow: var(--system-edge);
}

html[data-ui-theme="system"] body.theme-system .profile-page.profile-redesign :is(
    .profile-hero,
    .profile-local-navigation,
    .profile-photo-strip,
    .profile-status-card,
    .feed-composer,
    .feed-post,
    .feed-empty
) {
    background: var(--system-panel);
    border-color: var(--border);
    box-shadow: var(--system-edge);
}

html[data-ui-theme="system"] body.theme-system .profile-page.profile-redesign .feed-composer-bubble,
html[data-ui-theme="system"] body.theme-system .feed-create-panel .feed-composer-bubble {
    background: var(--system-raised) !important;
    border-color: var(--border-dark);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12);
}

html[data-ui-theme="system"] body.theme-system .feed-create-panel .feed-composer-bubble:focus-within {
    background: var(--system-raised) !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px var(--primary-light) !important;
}

/* Existing surfaces have explicit roles instead of one shared grey emphasis.
   Specificity here matches the legacy component paint below; dimensions and
   interaction handlers remain owned by their original components. */
html[data-ui-theme="system"] body.theme-system .sidebar .sidebar-item.active {
    color: var(--text);
    background: var(--system-selected);
    border-color: rgba(var(--primary-rgb), .30);
    box-shadow: inset 3px 0 0 var(--primary);
}

html[data-ui-theme="system"] body.theme-system .sidebar .sidebar-item.active .sidebar-nav-icon {
    color: var(--primary-text);
    background: var(--primary-light);
    border-color: rgba(var(--primary-rgb), .24);
}

html[data-ui-theme="system"] body.theme-system .sidebar .sidebar-nav-icon {
    background: rgba(222, 235, 240, .025);
    border-color: var(--border-light);
}

html[data-ui-theme="system"] body.theme-system #app #new-deal-btn,
html[data-ui-theme="system"] body.theme-system #app #create-new-deal-btn,
html[data-ui-theme="system"] body.theme-system .btn.guarant:not(.disabled):not(:disabled),
html[data-ui-theme="system"] body.theme-system :is(.listing-detail-action-stack, .listing-details-actions) .btn[data-listing-buy-prepare]:not(:disabled),
html[data-ui-theme="system"] body.theme-system .wallet-btn-primary:not(:disabled) {
    color: var(--system-pearl-ink) !important;
    background: var(--system-pearl) !important;
    border-color: rgba(228, 233, 237, .52) !important;
    box-shadow: var(--system-pearl-edge) !important;
}

html[data-ui-theme="system"] body.theme-system #app #new-deal-btn:hover:not(:disabled),
html[data-ui-theme="system"] body.theme-system #app #create-new-deal-btn:hover:not(:disabled),
html[data-ui-theme="system"] body.theme-system .btn.guarant:not(.disabled):not(:disabled):hover,
html[data-ui-theme="system"] body.theme-system :is(.listing-detail-action-stack, .listing-details-actions) .btn[data-listing-buy-prepare]:not(:disabled):hover,
html[data-ui-theme="system"] body.theme-system .wallet-btn-primary:not(:disabled):hover {
    background: var(--system-pearl-hover) !important;
}

html[data-ui-theme="system"] body.theme-system #chat-active #send-message-btn:not(:disabled),
html[data-ui-theme="system"] body.theme-system .forum-chat-send,
html[data-ui-theme="system"] body.theme-system .feed-comment-send.chat-send-style:not(:disabled),
html[data-ui-theme="system"] body.theme-system :is(.profile-photo-viewer, .feed-post-media-viewer) .profile-photo-comment-form .profile-photo-comment-send:not(:disabled) {
    color: var(--system-social-ink) !important;
    background: var(--system-social-fill) !important;
    border-color: rgba(var(--primary-rgb), .55) !important;
    box-shadow: var(--system-pearl-edge) !important;
}

html[data-ui-theme="system"] body.theme-system #chat-active #send-message-btn:not(:disabled):hover,
html[data-ui-theme="system"] body.theme-system .forum-chat-send:not(:disabled):hover,
html[data-ui-theme="system"] body.theme-system .feed-comment-send.chat-send-style:not(:disabled):hover,
html[data-ui-theme="system"] body.theme-system :is(.profile-photo-viewer, .feed-post-media-viewer) .profile-photo-comment-form .profile-photo-comment-send:not(:disabled):hover {
    background: var(--system-social-hover) !important;
}

/* Deletion remains recognisable, without outranking the post's main actions. */
html[data-ui-theme="system"] body.theme-system .feed-post-head-actions .feed-icon-btn.danger {
    color: #ffb4ac !important;
    background: var(--danger-light) !important;
    border-color: rgba(255, 69, 58, .22) !important;
    box-shadow: none !important;
}

html[data-ui-theme="system"] body.theme-system .feed-post-head-actions .feed-icon-btn.danger:is(:hover, :focus-visible) {
    color: #ffd4ce !important;
    background: rgba(255, 69, 58, .22) !important;
    border-color: rgba(255, 69, 58, .40) !important;
}

html[data-ui-theme="system"] body.theme-system .feed-action[data-feed-like].active {
    color: var(--system-heart) !important;
    background: rgba(240, 155, 170, .09) !important;
    border-color: rgba(240, 155, 170, .22) !important;
    box-shadow: none !important;
}

html[data-ui-theme="system"] body.theme-system .feed-comment-parent,
html[data-ui-theme="system"] body.theme-system .forum-parent-quote {
    border-color: rgba(var(--primary-rgb), .35);
    background: rgba(var(--primary-rgb), .07);
}

html[data-ui-theme="system"] body.theme-system .mobile-bottom-nav::before {
    background: var(--system-selected);
    border-color: rgba(var(--primary-rgb), .28);
    box-shadow: inset 0 1px 0 rgba(var(--primary-rgb), .12);
}

html[data-ui-theme="system"] body.theme-system .mobile-bottom-item.active,
html[data-ui-theme="system"] body.theme-system .mobile-bottom-item.active .mobile-bottom-icon {
    color: var(--primary-text);
}

html[data-ui-theme="system"] body.theme-system :is(.btn, .feed-action, .feed-comment-send, .social-reaction-add, .social-reaction-chip, .forum-chat-send, .forum-jump-btn, .feed-comment-jump, .dashboard-action-card):focus-visible:not(:disabled) {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
}

/* ===== БАЗОВЫЕ СТИЛИ ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    height: 100%;
    /* Paint the iOS viewport canvas itself. The glass body background is
       translucent, so leaving the root canvas transparent exposed Safari's
       black backing strip above/below the app. */
    background-color: #0a0e1a;
    scroll-behavior: smooth;
}

/* Account/device text size (Settings → «Размер текста»). Every rem font size
   follows the root; layout is in px, so only the text grows or shrinks. The
   marker is set by services/device-preferences.js only for an explicit choice,
   so the default stays exactly 16px. Message bubbles keep their own px size
   from the same choice (see --dealix-chat-font-size). */
html[data-dealix-chat-text-size="small"] { font-size: 14px; }
html[data-dealix-chat-text-size="large"] { font-size: 18px; }
html[data-dealix-chat-text-size="xlarge"] { font-size: 20px; }

html[data-theme="light"] {
    background-color: #f8fafc;
}

html[data-ui-theme="system"] {
    background-color: #1b2026;
}
html[data-ui-theme="system"]:has(body.theme-night) {
    background-color: #000000;
}

/* «Система»: поверхности, которые правила тёмной базы красят жёстко заданными
   сине-фиолетовыми цветами. Селекторы старше исходных (id / data-ui-theme);
   !important — только там, где его несёт исходное правило. Фото, аватары,
   эмодзи, QR и медиа не трогаются. */
html[data-ui-theme="system"] #app #main-content,
html[data-ui-theme="system"] #app #page-content,
html[data-ui-theme="system"] #app .chats-page .chat-main,
html[data-ui-theme="system"] #app .forum-community-page[data-forum-topic-view="true"] .forum-discussion-card,
html[data-ui-theme="system"] #app .deals-page .deals-container,
html[data-ui-theme="system"] #app .deals-page .deals-sidebar,
html[data-ui-theme="system"] #app .deals-page .deal-details,
html[data-ui-theme="system"] #app .deals-page .deal-placeholder {
    background-color: var(--bg) !important;
    background-image: none !important;
}

html[data-ui-theme="system"] body .group-info-cover:not(.is-avatar-expanded) {
    background: linear-gradient(180deg, rgba(139,201,197,.07), transparent 85%), var(--bg-secondary);
}
html[data-ui-theme="system"] body .group-info-avatar,
html[data-ui-theme="system"] body .chat-info-sidebar .avatar.large {
    box-shadow: 0 12px 32px rgba(0,0,0,.18), inset 0 0 0 1px var(--system-edge) !important;
}
html[data-ui-theme="system"] body .group-info-action:hover:not(:disabled) { background: var(--bg-hover); }
html[data-ui-theme="system"] body .group-member-you-badge {
    color: var(--primary-text) !important;
    background: var(--primary-light) !important;
}
html[data-ui-theme="system"] body .chat-info-tab.active {
    background: var(--primary-light) !important;
    border-color: var(--system-edge) !important;
    color: var(--primary-text) !important;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.06) !important;
}
html[data-ui-theme="system"] body .chat-dialog-preview-body {
    background-color: var(--bg);
    background-image: none;
}

html[data-ui-theme="system"] body .auth-page {
    background:
        radial-gradient(circle at 16% 14%, rgba(188, 188, 196, 0.12), transparent 38%),
        linear-gradient(135deg, #161618 0%, #1c1c1e 55%, #202022 100%) !important;
}

html[data-ui-theme="system"] body .auth-page::after {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.04), rgba(188, 188, 196, 0.06));
}

html[data-ui-theme="system"] body .auth-container {
    border-color: var(--border-dark) !important;
    background: var(--system-panel) !important;
    box-shadow: var(--system-edge) !important;
}

html[data-ui-theme="system"] body .auth-header {
    background:
        radial-gradient(circle at 22% 20%, rgba(255, 255, 255, 0.16), transparent 38%),
        linear-gradient(145deg, #414147 0%, #313136 58%, #28282d 100%) !important;
}

html[data-ui-theme="system"] body .auth-form .btn.primary.fullwidth {
    background: var(--primary-grad) !important;
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.35) !important;
}

html[data-ui-theme="system"] body .auth-form .btn.primary.fullwidth:hover:not(:disabled) {
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.42) !important;
}

html[data-ui-theme="system"] body #header-search-input {
    background: var(--bg-tertiary) !important;
    background-color: var(--bg-tertiary) !important;
}

/* Canonical header rules use important paint; this theme variant only changes colours. */
html[data-ui-theme="system"] body #header-search-input:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px var(--primary-light) !important;
}
html[data-ui-theme="system"] body.theme-system .header .search-results-dropdown {
    background: var(--bg-modal) !important;
    border-color: var(--border-dark) !important;
    box-shadow: var(--system-edge) !important;
}
html[data-ui-theme="system"] body.theme-system .global-search-avatar {
    color: var(--primary-text);
    background: var(--primary-light);
    border-color: var(--border);
}
html[data-ui-theme="system"] body.theme-system .global-search-result-badge {
    color: var(--primary-text);
    background: var(--primary-light);
}


html[data-ui-theme="system"] body.theme-system .header-right #user-menu-btn {
    background: var(--system-raised) !important;
    border-color: var(--border-dark) !important;
    box-shadow: var(--system-edge) !important;
}

html[data-ui-theme="system"] body.theme-system .header-right #user-menu-btn:hover {
    background: var(--system-selected) !important;
    border-color: rgba(255, 255, 255, .32) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .23), 0 16px 32px rgba(0, 0, 0, .24) !important;
}

html[data-ui-theme="system"] body.theme-system .header-right #user-menu-btn #user-avatar {
    border-color: rgba(255, 255, 255, .52) !important;
    box-shadow: 0 8px 18px rgba(0, 0, 0, .20), 0 0 0 1px rgba(255, 255, 255, .20) !important;
}

/* «Система», страницы после входа (визуальный проход): панели .glass, списки
   сделок и P2P, лента, уведомления, кошелёк, форум — графит вместо тёмно-синего;
   выбранная строка — мягкий нейтральный акцент. */
html[data-ui-theme="system"] body.theme-system .glass {
    background: var(--system-panel);
    border-color: var(--border);
    box-shadow: var(--system-edge);
}

html[data-ui-theme="system"] body.theme-system #chat-placeholder .placeholder-content,
html[data-ui-theme="system"] body.theme-system .deals-page .deal-placeholder .placeholder-content {
    background: var(--system-panel) !important;
}

html[data-ui-theme="system"] body.theme-system .deals-page .deal-list-item {
    background: var(--system-panel) !important;
}

html[data-ui-theme="system"] body.theme-system .deals-page .deal-list-item:hover {
    background: var(--system-raised) !important;
}

html[data-ui-theme="system"] body.theme-system .deals-page .deal-list-item.active {
    background: var(--system-selected) !important;
}


html[data-ui-theme="system"] body.theme-system .deals-page .deals-group-header.toggle,
html[data-ui-theme="system"] body.theme-system .deals-page .deals-group-header.toggle:hover,
html[data-ui-theme="system"] body.theme-system .deals-page .deals-group-header.toggle:focus-visible {
    background: var(--system-panel) !important;
}

html[data-ui-theme="system"] body.theme-system .feed-page.vk-feed-page {
    --feed-surface: var(--system-panel);
    --feed-border: var(--border);
    --feed-soft: rgba(255, 255, 255, 0.10);
    --feed-accent: var(--primary-text);
}

html[data-ui-theme="system"] body.theme-system .feed-page .feed-carousel-dot.active,
html[data-ui-theme="system"] body.theme-system .feed-page .forum-create-topic-plus,
html[data-ui-theme="system"] body.theme-system .chat-archive-icon,
html[data-ui-theme="system"] body.theme-system .chat-archive-count,
html[data-ui-theme="system"] body.theme-system .chat-archive-preview-open {
    background: var(--primary-grad) !important;
    color: #fff;
}

html[data-ui-theme="system"] body.theme-system .feed-page .forum-create-topic-btn::before,
html[data-ui-theme="system"] body.theme-system .feed-page .forum-create-topic-btn:hover,
html[data-ui-theme="system"] body.theme-system .feed-page .forum-create-topic-btn:focus-visible {
    background: var(--system-raised) !important;
    border-color: var(--border-dark) !important;
}

html[data-ui-theme="system"] body.theme-system .feed-stories-wrap {
    background: var(--system-panel);
    box-shadow: var(--system-edge);
}

html[data-ui-theme="system"] body.theme-system .forum-topic-page .vk-feed-card {
    background: var(--system-panel) !important;
    box-shadow: var(--system-edge);
}

html[data-ui-theme="system"][data-theme="dark"] body.theme-system #notification-dropdown.notification-dropdown {
    background: var(--bg-modal) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

html[data-ui-theme="system"][data-theme="dark"] body.theme-system #notification-dropdown.notification-dropdown .notification-dropdown-item {
    background: rgba(255, 255, 255, 0.04) !important;
}

html[data-ui-theme="system"][data-theme="dark"] body.theme-system #notification-dropdown.notification-dropdown .notification-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.07) !important;
}

html[data-ui-theme="system"][data-theme="dark"] body.theme-system #notification-dropdown.notification-dropdown .notification-dropdown-item.unread {
    background: var(--primary-light) !important;
}

html[data-ui-theme="system"] body.theme-system #notification-dropdown.notification-dropdown .notification-dropdown-footer .btn,
html[data-ui-theme="system"] body.theme-system #notification-dropdown.notification-dropdown .notification-dropdown-footer a {
    background: var(--primary-grad) !important;
    border-color: rgba(255, 255, 255, 0.16) !important;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22) !important;
}

/* «Система»: всплывающее уведомление — тёмная база красит его тем же slate,
   что и список уведомлений выше; здесь графит, без фиолетового свечения. */
html[data-ui-theme="system"][data-theme="dark"] body.theme-system .toast.toast-new {
    background: linear-gradient(135deg, rgba(44, 44, 46, 0.94), rgba(35, 35, 37, 0.88)) !important;
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.36), 0 10px 30px rgba(0, 0, 0, 0.22) !important;
}

html[data-ui-theme="system"] body.theme-system .p2p-profile-entry,
html[data-ui-theme="system"] body.theme-system .p2p-order-archive-toggle,
html[data-ui-theme="system"] body.theme-system .p2p-small-select,
html[data-ui-theme="system"] body.theme-system .linked-wallet-item {
    background: rgba(255, 255, 255, 0.05);
}

html[data-ui-theme="system"] body.theme-system .p2p-page .p2p-order-summary {
    background: var(--system-panel) !important;
    border-color: var(--border);
    box-shadow: var(--system-edge);
}

html[data-ui-theme="system"] body.theme-system .p2p-page .p2p-order-summary.is-archive {
    background: var(--bg-secondary) !important;
}

html[data-ui-theme="system"] body.theme-system .p2p-page .p2p-order-summary:hover,
html[data-ui-theme="system"] body.theme-system .p2p-page .p2p-order-summary.active {
    background: var(--system-selected) !important;
}

/* P2P detail has its own legacy !important paint, separate from list cards.
   Keep geometry in the P2P owner; System changes only surface/status roles. */
html[data-ui-theme="system"] body.theme-system .p2p-page .p2p-order-card {
    background: var(--system-panel) !important;
    border-color: var(--border) !important;
    box-shadow: var(--system-edge) !important;
}

html[data-ui-theme="system"] body.theme-system .p2p-order-detail-pane :is(
    .p2p-payment-box, .p2p-order-timeline, .p2p-dispute-box,
    .p2p-resolution-box, .p2p-receipts, .p2p-feedback-box
) {
    background: var(--bg-secondary) !important;
    border-color: var(--border) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04) !important;
}

html[data-ui-theme="system"] body.theme-system .p2p-order-detail-pane .p2p-safety-box {
    background: var(--system-raised) !important;
    border-color: var(--border-dark) !important;
    box-shadow: var(--system-edge) !important;
}

html[data-ui-theme="system"] body.theme-system .p2p-order-detail-pane :is(.p2p-safety-box.is-expired, .p2p-dispute-box) {
    border-color: color-mix(in srgb, var(--danger) 36%, var(--border)) !important;
}

html[data-ui-theme="system"] body.theme-system .p2p-page :is(
    .p2p-order-title, .p2p-mini-title, .p2p-payment-box b, .p2p-payment-box pre,
    .p2p-safety-grid b, .p2p-timeline-body b
) {
    color: var(--text) !important;
}

html[data-ui-theme="system"] body.theme-system .p2p-page :is(
    .p2p-order-meta, .p2p-order-route, .p2p-order-role, .p2p-payment-box span,
    .p2p-safety-grid span, .p2p-safety-box small, .p2p-timeline-body small
) {
    color: var(--text-secondary) !important;
}

html[data-ui-theme="system"] body.theme-system .p2p-page :is(.p2p-order-status-pill, .p2p-tx-pill, .p2p-timeline-dot) {
    color: var(--primary-text) !important;
    background: var(--primary-light) !important;
    border-color: rgba(var(--primary-rgb), .24) !important;
    box-shadow: none !important;
}

html[data-ui-theme="system"] body.theme-system .p2p-page :is(
    .p2p-order-status-payment_expired, .p2p-order-status-dispute
) .p2p-order-status-pill,
html[data-ui-theme="system"] body.theme-system .p2p-page :is(
    .p2p-event-dispute_opened, .p2p-event-cancelled_before_escrow
) .p2p-timeline-dot {
    color: #ffaaa4 !important;
    background: var(--danger-light) !important;
    border-color: color-mix(in srgb, var(--danger) 28%, transparent) !important;
}

html[data-ui-theme="system"] body.theme-system .p2p-page .p2p-order-status-payment_marked .p2p-order-status-pill {
    color: #ffd39a !important;
    background: var(--warning-light) !important;
    border-color: color-mix(in srgb, var(--warning) 28%, transparent) !important;
}

html[data-ui-theme="system"] body.theme-system .p2p-page .p2p-order-status-released .p2p-order-status-pill,
html[data-ui-theme="system"] body.theme-system .p2p-page .p2p-event-released .p2p-timeline-dot {
    color: #a1e8b3 !important;
    background: var(--success-light) !important;
    border-color: color-mix(in srgb, var(--success) 28%, transparent) !important;
}

html[data-ui-theme="system"] body.theme-system .p2p-page .p2p-trust-badge {
    color: var(--text-secondary);
    background: var(--system-pearl-soft);
    border-color: var(--border-dark);
    box-shadow: none;
}

html[data-ui-theme="system"] body.theme-system .p2p-page .p2p-trust-badge.verified {
    color: var(--primary-text);
    background: var(--primary-light);
}

html[data-ui-theme="system"] body.theme-system .p2p-page .p2p-trust-badge.trusted {
    color: #a1e8b3;
    background: var(--success-light);
}

html[data-ui-theme="system"] body.theme-system .p2p-page .p2p-trust-badge.risk {
    color: #ffaaa4;
    background: var(--danger-light);
}

html[data-ui-theme="system"] body.theme-system .p2p-market-segment button.active,
html[data-ui-theme="system"] body.theme-system .p2p-create-side-segment button.active,
html[data-ui-theme="system"] body.theme-system .p2p-profile-entry-icon {
    color: #fff;
    background: var(--primary-grad);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 8px 20px rgba(0, 0, 0, 0.22);
}

html[data-ui-theme="system"] body.theme-system .p2p-home-tabs button.active {
    color: var(--primary-text);
    border-bottom-color: var(--primary-text);
}

html[data-ui-theme="system"] body.theme-system .p2p-market-cta,
html[data-ui-theme="system"] body.theme-system .p2p-order-actions button[data-p2p-order-action="open_chat"] {
    color: var(--system-pearl-ink) !important;
    background: var(--system-pearl) !important;
    border-color: rgba(255, 255, 255, .72) !important;
    box-shadow: var(--system-pearl-edge) !important;
}

html[data-ui-theme="system"] body.theme-system .p2p-market-cta:hover:not(:disabled),
html[data-ui-theme="system"] body.theme-system .p2p-order-actions button[data-p2p-order-action="open_chat"]:hover:not(:disabled) {
    background: var(--system-pearl-hover) !important;
}

html[data-ui-theme="system"] body.theme-system .p2p-order-actions button[data-p2p-order-action="contact_arbiter"] {
    background: linear-gradient(135deg, #a5403a, #7d302b) !important;
    border-color: rgba(255, 69, 58, 0.35) !important;
}

html[data-ui-theme="system"] body.theme-system .p2p-filter-reset {
    color: var(--primary-text);
}

html[data-ui-theme="system"] body.theme-system #new-group-top-btn {
    background: var(--system-raised) !important;
    border-color: var(--border-dark) !important;
    box-shadow: var(--system-edge) !important;
}

html[data-ui-theme="system"] body.theme-system #new-group-top-btn:hover {
    background: var(--system-selected) !important;
    border-color: rgba(255, 255, 255, .34) !important;
}

/* «Система», чат: пузыри своих сообщений (и все пузыри «Избранного») — тёмный
   графит вместо яркого фиолетового градиента. Селекторы повторяют исходные
   правила (исключения для фото, альбомов, кружков, голосовых сохраняются), #app
   поднимает специфичность; поле ввода и карточка пересланного поста — графит. */
html[data-ui-theme="system"] #app #chat-active[data-chat-type="saved"] .message.sent:not(:has(.story-share-card[data-story-kind="share"])),
html[data-ui-theme="system"] #app #chat-active[data-chat-type="saved"] .message.received:not(:has(.story-share-card[data-story-kind="share"])),
html[data-ui-theme="system"] #app #chat-active.saved-notes-chat-active .message.sent:not(:has(.story-share-card[data-story-kind="share"])),
html[data-ui-theme="system"] #app #chat-active.saved-notes-chat-active .message.received:not(:has(.story-share-card[data-story-kind="share"])),
html[data-ui-theme="system"] #app #chat-active:not([data-chat-type="saved"]):not(.saved-notes-chat-active):not([data-chat-type="support"]) #chat-messages .message.sent:not(:has(.chat-media-thumb)):not(:has(.chat-media-album)):not(:has(.video-circle-message)):not(:has(.voice-message)):not(:has(.chat-file-card)):not(.group-post-message):not(:has(.story-share-card[data-story-kind="share"])):not(.single-emoji-message),
html[data-ui-theme="system"] #app #chat-active:not([data-chat-type="support"]) #chat-messages .message.sent:has(.chat-file-card),
html[data-ui-theme="system"] #chat-dialog-preview-body .message.sent:not(:has(.chat-media-thumb)):not(:has(.chat-media-album)):not(:has(.video-circle-message)):not(:has(.voice-message)):not(.group-post-message):not(:has(.story-share-card[data-story-kind="share"])):not(.single-emoji-message),
html[data-ui-theme="system"] #app #chat-active:not([data-chat-type="support"]) #chat-messages .message.sent:has(.chat-audio-attachment) {
    background: var(--primary-grad) !important;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28) !important;
}

/* Incoming text and file/audio bubbles use the raised neutral surface. */
html[data-ui-theme="system"] #app #chat-active:not([data-chat-type="saved"]):not(.saved-notes-chat-active):not([data-chat-type="support"]) #chat-messages .message.received:not(:has(.chat-media-thumb)):not(:has(.chat-media-album)):not(:has(.video-circle-message)):not(:has(.voice-message)):not(:has(.chat-file-card)):not(.group-post-message):not(:has(.story-share-card[data-story-kind="share"])):not(.single-emoji-message),
html[data-ui-theme="system"] #app #chat-active:not([data-chat-type="support"]) #chat-messages .message.received:has(.chat-file-card),
html[data-ui-theme="system"] #chat-dialog-preview-body .message.received:not(:has(.chat-media-thumb)):not(:has(.chat-media-album)):not(:has(.video-circle-message)):not(:has(.voice-message)):not(.group-post-message):not(:has(.story-share-card[data-story-kind="share"])):not(.single-emoji-message),
html[data-ui-theme="system"] #app #chat-active:not([data-chat-type="support"]) #chat-messages .message.received:has(.chat-audio-attachment) {
    color: var(--text) !important;
    background: var(--system-raised) !important;
    border-color: var(--border) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), 0 10px 24px rgba(0, 0, 0, .20) !important;
}

/* The outer composer stays transparent in every theme. Only its existing
   capsule is painted; an opaque outer area creates a second rectangular form. */
html[data-ui-theme="system"] body.theme-system #chat-active .chat-input-area:not(.voice-recording-active):not(.video-circle-recording-active) {
    background: transparent !important;
    box-shadow: none !important;
}

html[data-ui-theme="system"] body.theme-system #chat-active #send-message-btn:disabled {
    color: var(--text-muted) !important;
    background: var(--system-raised) !important;
    box-shadow: none !important;
}

html[data-ui-theme="system"] body.theme-system .chats-page .chat-active .chat-input-wrapper {
    background: var(--system-panel) !important;
    box-shadow: var(--system-edge) !important;
}

html[data-ui-theme="system"] body.theme-system .message-wrap .message-feed-share-card.message-feed-post-card {
    background: var(--system-panel) !important;
}

/* «Система», телефон: сплошной тёмно-синий фон экрана чатов и нижняя навигация. */
@media (max-width: 1024px) {
    html[data-ui-theme="system"] body.theme-system[data-page="chats"] .app,
    html[data-ui-theme="system"] body.theme-system[data-page="chats"] .chats-page,
    html[data-ui-theme="system"] body.theme-system[data-page="chats"] .chats-container {
        background: var(--bg) !important;
    }
}

@media (max-width: 768px) {
html[data-ui-theme="system"] body.theme-system .mobile-bottom-nav {
        background: var(--system-bottom-nav) !important;
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18) !important;
    }
}

html[data-ui-theme="system"] body.theme-system :is(.wallet-current-icon.default, .wallet-safety-icon) {
    color: var(--system-social-ink);
    background: var(--system-social-fill);
    box-shadow: var(--system-edge);
}

html[data-ui-theme="system"] body.theme-system :is(.wallet-current-meta, .linked-wallet-address) code {
    color: var(--text);
    background: var(--system-pearl-soft);
    border-color: var(--border-dark);
}

html[data-ui-theme="system"] body.theme-system .wallet-page-polished {
    --wallet-line: var(--border);
}

html[data-ui-theme="system"] body.theme-system .wallet-card-face {
    background:
        radial-gradient(ellipse at 0 0, var(--system-pearl-soft), transparent 58%),
        linear-gradient(145deg, #38434b 0%, #2c353d 62%, #242d34 100%);
    box-shadow: var(--system-edge);
}

html[data-ui-theme="system"] body.theme-system .profile-page.profile-redesign .cover-upload-btn {
    background: rgba(28, 28, 30, 0.86);
}

/* «Система», админка (волна 5): поддержка, модерация ленты и объявлений красят
   фоны жёстким slate (rgba(15,23,42…) и т.п., в поддержке с !important) — здесь
   графит. Свои ответы, выбранное обращение и кнопки действий получают нейтральный
   акцент; !important — только там, где он у исходного правила. */
html[data-ui-theme="system"] body.theme-system .admin-support-sidebar,
html[data-ui-theme="system"] body.theme-system .admin-support-chat {
    background: var(--system-panel) !important;
    box-shadow: var(--system-edge) !important;
}

html[data-ui-theme="system"] body.theme-system .admin-support-chat-header {
    background: var(--system-raised) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16) !important;
}

html[data-ui-theme="system"] body.theme-system .admin-support-sidebar-head {
    background: var(--system-raised) !important;
}

html[data-ui-theme="system"] body.theme-system .admin-support-messages {
    background:
        radial-gradient(circle at 18% 0%, rgba(188, 188, 196, 0.08), transparent 32%),
        rgba(0, 0, 0, 0.16) !important;
}

html[data-ui-theme="system"] body.theme-system .admin-support-input {
    background: var(--system-raised) !important;
}

html[data-ui-theme="system"] body.theme-system .admin-support-input textarea {
    background: var(--bg-tertiary) !important;
}

html[data-ui-theme="system"] body.theme-system .admin-support-context-actions .btn,
html[data-ui-theme="system"] body.theme-system .admin-support-input .btn,
html[data-ui-theme="system"] body.theme-system .admin-support-role-btn,
html[data-ui-theme="system"] body.theme-system .admin-support-role-buyer,
html[data-ui-theme="system"] body.theme-system .admin-support-role-seller {
    background: var(--primary-grad) !important;
    border-color: var(--border-dark) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 8px 20px rgba(0, 0, 0, 0.22) !important;
}

html[data-ui-theme="system"] body.theme-system .admin-support-tool-btn {
    background: var(--bg-tertiary) !important;
    border-color: var(--border-dark) !important;
    box-shadow: none !important;
}

html[data-ui-theme="system"] body.theme-system .admin-focus-row {
    outline-color: rgba(188, 188, 196, 0.52);
    box-shadow: 0 0 0 4px rgba(188, 188, 196, 0.12);
}

html[data-ui-theme="system"] body.theme-system .admin-support-dispute-meta span {
    background: rgba(255, 255, 255, 0.06);
}

html[data-ui-theme="system"] body.theme-system .admin-support-message.sent .message-content {
    background: var(--primary-grad) !important;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}

html[data-ui-theme="system"] body.theme-system .admin-support-p2p-ticket,
html[data-ui-theme="system"] body.theme-system .admin-support-p2p-chat-ticket {
    background: linear-gradient(135deg, rgba(255, 69, 58, 0.10), rgba(188, 188, 196, 0.08)) !important;
}

html[data-ui-theme="system"] body.theme-system .admin-support-ticket:hover {
    background: var(--system-raised) !important;
    border-color: rgba(255, 255, 255, 0.16) !important;
}

html[data-ui-theme="system"] body.theme-system .admin-support-ticket.active {
    background: var(--system-selected) !important;
    border-color: var(--border-dark) !important;
}

html[data-ui-theme="system"] body.theme-system .admin-support-context {
    background: var(--system-raised) !important;
}

html[data-ui-theme="system"] body.theme-system .admin-support-ticket-context {
    background: rgba(188, 188, 196, 0.14);
}

html[data-ui-theme="system"] body.theme-system .admin-feed-topic-card {
    background: rgba(255, 255, 255, 0.04);
}

html[data-ui-theme="system"] body.theme-system .admin-feed-media-preview img,
html[data-ui-theme="system"] body.theme-system .admin-feed-media-preview video {
    background: rgba(0, 0, 0, 0.24);
}

html[data-ui-theme="system"] body.theme-system .admin-listing-action-backdrop {
    background: rgba(0, 0, 0, 0.62);
}

html[data-ui-theme="system"] body.theme-system .admin-listing-preview-backdrop {
    background: rgba(0, 0, 0, 0.66);
}

html[data-ui-theme="system"] body.theme-system .admin-listing-action-panel {
    background: rgba(35, 35, 37, 0.96);
}

html[data-ui-theme="system"] body.theme-system .admin-listing-preview-panel {
    background: rgba(35, 35, 37, 0.97);
}

/* «Система»: общий крестик модальных окон (все модалки админки и сайта). */
html[data-ui-theme="system"] body.theme-system .dealix-modal-screen .dealix-modal-close-control {
    background: rgba(58, 58, 60, 0.55) !important;
}

html[data-ui-theme="system"] body.theme-system .dealix-modal-screen .dealix-modal-close-control:hover,
html[data-ui-theme="system"] body.theme-system .dealix-modal-screen .dealix-modal-close-control:focus-visible {
    background: rgba(72, 72, 74, 0.7) !important;
    border-color: rgba(255, 255, 255, 0.24) !important;
}

/* «Система»: унификация оставшихся поверхностей без фиолетовых акцентов */
html[data-ui-theme="system"][data-theme="dark"] body.theme-system #notification-dropdown.notification-dropdown .notification-dropdown-header,
html[data-ui-theme="system"][data-theme="dark"] body.theme-system #notification-dropdown.notification-dropdown .notification-dropdown-footer,
html[data-ui-theme="system"][data-theme="dark"] body.theme-system .notification-dropdown .notification-dropdown-header,
html[data-ui-theme="system"][data-theme="dark"] body.theme-system .notification-dropdown .notification-dropdown-footer {
    background: var(--system-raised) !important;
    border-color: var(--border) !important;
}

html[data-ui-theme="system"][data-theme="dark"] body.theme-system #notification-dropdown.notification-dropdown .notification-center-filter.active,
html[data-ui-theme="system"][data-theme="dark"] body.theme-system .notification-dropdown .notification-center-filter.active {
    background: var(--system-selected) !important;
    border-color: var(--border-dark) !important;
    color: var(--primary-text) !important;
}

html[data-ui-theme="system"][data-theme="dark"] body.theme-system #notification-dropdown.notification-dropdown .notification-dropdown-item,
html[data-ui-theme="system"][data-theme="dark"] body.theme-system .notification-dropdown .notification-dropdown-item {
    background: var(--system-panel) !important;
    border-color: var(--border) !important;
}

html[data-ui-theme="system"][data-theme="dark"] body.theme-system #notification-dropdown.notification-dropdown .notification-dropdown-item.unread,
html[data-ui-theme="system"][data-theme="dark"] body.theme-system #notification-dropdown.notification-dropdown .notification-dropdown-item:hover,
html[data-ui-theme="system"][data-theme="dark"] body.theme-system .notification-dropdown .notification-dropdown-item.unread,
html[data-ui-theme="system"][data-theme="dark"] body.theme-system .notification-dropdown .notification-dropdown-item:hover {
    background: var(--system-raised) !important;
    border-color: var(--border-dark) !important;
}

html[data-ui-theme="system"][data-theme="dark"] body.theme-system #notification-dropdown.notification-dropdown .notification-dropdown-dot,
html[data-ui-theme="system"][data-theme="dark"] body.theme-system .notification-dropdown .notification-dropdown-dot {
    background: var(--primary) !important;
    box-shadow: 0 0 0 4px var(--primary-light) !important;
}

html[data-ui-theme="system"][data-theme="dark"] body.theme-system #notification-dropdown.notification-dropdown .notification-dropdown-meta,
html[data-ui-theme="system"][data-theme="dark"] body.theme-system #notification-dropdown.notification-dropdown .notification-dropdown-time,
html[data-ui-theme="system"][data-theme="dark"] body.theme-system .notification-dropdown .notification-dropdown-meta,
html[data-ui-theme="system"][data-theme="dark"] body.theme-system .notification-dropdown .notification-dropdown-time {
    color: var(--text-secondary) !important;
}

html[data-ui-theme="system"][data-theme="dark"] body.theme-system #notification-dropdown.notification-dropdown .notification-dropdown-close,
html[data-ui-theme="system"][data-theme="dark"] body.theme-system .notification-dropdown .notification-dropdown-close {
    background: var(--system-raised) !important;
    border-color: var(--border) !important;
    color: var(--text-secondary) !important;
}

html[data-ui-theme="system"][data-theme="dark"] body.theme-system #notification-dropdown.notification-dropdown .notification-dropdown-footer .btn,
html[data-ui-theme="system"][data-theme="dark"] body.theme-system #notification-dropdown.notification-dropdown .notification-dropdown-footer a,
html[data-ui-theme="system"][data-theme="dark"] body.theme-system #notification-dropdown.notification-dropdown #mark-all-read-dropdown,
html[data-ui-theme="system"][data-theme="dark"] body.theme-system #notification-dropdown.notification-dropdown #notification-load-more {
    background: var(--system-raised) !important;
    border-color: var(--border-dark) !important;
    color: var(--text) !important;
    box-shadow: var(--system-edge) !important;
}

html[data-ui-theme="system"][data-theme="dark"] body.theme-system #notification-dropdown.notification-dropdown .notification-dropdown-footer .btn:hover,
html[data-ui-theme="system"][data-theme="dark"] body.theme-system #notification-dropdown.notification-dropdown .notification-dropdown-footer a:hover,
html[data-ui-theme="system"][data-theme="dark"] body.theme-system #notification-dropdown.notification-dropdown #mark-all-read-dropdown:hover,
html[data-ui-theme="system"][data-theme="dark"] body.theme-system #notification-dropdown.notification-dropdown #notification-load-more:hover {
    background: var(--system-selected) !important;
    border-color: rgba(255, 255, 255, 0.22) !important;
}

html[data-ui-theme="system"] body.theme-system .disputes-page .dispute-details-deal {
    background: var(--system-raised) !important;
    border-color: var(--border-dark) !important;
}

html[data-ui-theme="system"] body.theme-system .disputes-page .dispute-details-empty > span,
html[data-ui-theme="system"] body.theme-system .disputes-page .disputes-empty-state > span {
    background: var(--system-raised) !important;
    color: var(--primary-text) !important;
    border: 1px solid var(--border-dark) !important;
}

html[data-ui-theme="system"] body.theme-system .disputes-page .dispute-timeline-item.active i {
    background: var(--primary) !important;
    box-shadow: 0 0 0 4px var(--primary-light) !important;
}

html[data-ui-theme="system"] body.theme-system .disputes-v2 .dispute-card-actions .btn[data-open-deal],
html[data-ui-theme="system"] body.theme-system .disputes-page .dispute-card-actions .btn.primary,
html[data-ui-theme="system"] body.theme-system .disputes-page .dispute-details-actions .btn.primary {
    color: var(--system-pearl-ink) !important;
    background: var(--system-pearl) !important;
    border-color: rgba(255, 255, 255, 0.72) !important;
    box-shadow: var(--system-pearl-edge) !important;
}

html[data-ui-theme="system"] body.theme-system .disputes-v2 .dispute-card-actions .btn[data-open-deal]:hover:not(:disabled),
html[data-ui-theme="system"] body.theme-system .disputes-page .dispute-card-actions .btn.primary:hover:not(:disabled),
html[data-ui-theme="system"] body.theme-system .disputes-page .dispute-details-actions .btn.primary:hover:not(:disabled) {
    color: var(--system-pearl-ink) !important;
    background: var(--system-pearl-hover) !important;
    border-color: rgba(255, 255, 255, 0.86) !important;
}

html[data-ui-theme="system"] body.theme-system .deals-page .deals-group-header.toggle,
html[data-ui-theme="system"] body.theme-system .deals-page .deals-group-header.toggle:hover,
html[data-ui-theme="system"] body.theme-system .deals-page .deals-group-header.toggle:focus-visible {
    border-color: var(--border-dark) !important;
    box-shadow: var(--system-edge) !important;
}

html[data-ui-theme="system"] body.theme-system .deals-page .deals-group-header.toggle .deals-group-count {
    background: var(--system-raised) !important;
    color: var(--text) !important;
    border-color: var(--border-dark) !important;
    box-shadow: none !important;
}

html[data-ui-theme="system"] body.theme-system .deals-page .deals-group-header.toggle .deals-group-chev,
html[data-ui-theme="system"] body.theme-system .deals-page .deals-group-chevron {
    color: var(--text-secondary) !important;
    background: var(--system-raised) !important;
    border-color: var(--border) !important;
}

html[data-ui-theme="system"] body.theme-system .p2p-home-logo,
html[data-ui-theme="system"] body.theme-system .p2p-page .p2p-hero-icon {
    background: var(--system-raised) !important;
    color: var(--primary-text) !important;
    border: 1px solid var(--border-dark) !important;
    box-shadow: var(--system-edge) !important;
}

html[data-ui-theme="system"] body.theme-system .p2p-limit-summary span {
    background: var(--system-raised) !important;
    border-color: var(--border-dark) !important;
    color: var(--text-secondary) !important;
}

html[data-ui-theme="system"] body.theme-system .p2p-primary-action.buy {
    background: var(--system-pearl) !important;
    color: var(--system-pearl-ink) !important;
    border: 1px solid rgba(255, 255, 255, 0.72) !important;
    box-shadow: var(--system-pearl-edge) !important;
}

html[data-ui-theme="system"] body.theme-system .p2p-primary-action.buy .p2p-primary-action-sub {
    color: rgba(20, 20, 22, 0.74) !important;
}

html[data-ui-theme="system"] body.theme-system .p2p-primary-action.sell {
    background: var(--system-raised) !important;
    color: var(--text) !important;
    border: 1px solid var(--border-dark) !important;
    box-shadow: var(--system-edge) !important;
}

html[data-ui-theme="system"] body.theme-system .p2p-primary-action.sell .p2p-primary-action-sub {
    color: var(--text-secondary) !important;
}

html[data-ui-theme="system"] body.theme-system .auth-tab.active {
    box-shadow: var(--system-edge) !important;
}

html[data-ui-theme="system"] body.theme-system .auth-remember-checkbox,
html[data-ui-theme="system"] body.theme-system .auth-form .checkbox input[type="checkbox"] {
    accent-color: var(--primary) !important;
}

html[data-ui-theme="system"] body.theme-system .auth-recent-item:hover,
html[data-ui-theme="system"] body.theme-system .auth-recent-item:focus-visible {
    border-color: var(--border-dark) !important;
    background: var(--system-raised) !important;
}

html[data-ui-theme="system"] body.theme-system .toast.toast-new .toast-close {
    background: var(--system-raised) !important;
    border-color: var(--border) !important;
    color: var(--text-secondary) !important;
}

html[data-ui-theme="system"] body.theme-system .toast.toast-new .toast-close:hover {
    background: var(--system-selected) !important;
    color: var(--text) !important;
}

body {
    font-family: var(--font-sans);
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.2s ease, color 0.2s ease;
}

/* ===== TYPOGRAPHY ===== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: var(--space-md);
}
h1 { font-size: 2rem; background: var(--primary-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
p { margin-bottom: var(--space-md); color: var(--text-secondary); }
small { font-size: 0.75rem; color: var(--text-muted); }

/* ===== LAYOUT ===== */
.app {
    --app-menu-bar-h: 0px;
    display: grid;
    grid-template-areas: "header" "menu" "main";
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto var(--app-menu-bar-h) minmax(0, 1fr);
    min-height: 100vh;
}

.header {
    grid-area: header;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px var(--space-lg);
    background: var(--bg-secondary);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-left, .header-right { display: flex; align-items: center; gap: var(--space-md); }
.header-center { flex: 1; display: flex; justify-content: center; }
.header-title { font-size: 1rem; font-weight: 500; color: var(--text-secondary); }

.logo { display: flex; align-items: center; gap: 10px; }
.logo-icon {
    width: 34px; height: 34px;
    background: var(--primary-grad);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.25rem;
    color: white;
}
.logo-text {
    font-weight: 800;
    font-size: 1.25rem;
    background: var(--primary-grad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.user-mini {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    background: var(--bg-hover);
    border-radius: var(--radius);
    margin-bottom: var(--space-lg);
}
.user-mini-name { font-weight: 600; font-size: 0.875rem; }
.user-mini-balance { font-size: 0.75rem; color: var(--primary); }

.main-content {
    grid-area: main;
    min-width: 0;
    overflow-y: auto;
    background: var(--bg);
}
.page-content { padding: var(--space-xl); max-width: 1400px; margin: 0 auto; width: 100%; }

/* ===== COMPONENTS ===== */
.avatar {
    width: 40px; height: 40px;
    border-radius: var(--radius-full);
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
    color: var(--primary);
}
.avatar.small { width: 32px; height: 32px; font-size: 0.875rem; }
.avatar.large { width: 100px; height: 100px; font-size: 2.5rem; background: var(--primary-grad); color: white; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.875rem;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
    cursor: pointer;
    white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn svg, .dropdown-item svg, .mobile-bottom-item svg { pointer-events: none; flex-shrink: 0; }
.btn.primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn.primary:hover:not(:disabled) { background: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn.secondary { background: rgba(255,255,255,0.06); color: var(--text); border-color: var(--border); }
.btn.secondary:hover:not(:disabled) { background: rgba(255,255,255,0.1); transform: translateY(-1px); }
.btn.ghost { background: transparent; color: var(--text-secondary); }
.btn.ghost:hover:not(:disabled) { background: var(--bg-hover); color: var(--text); }
.btn.danger { background: var(--danger); color: white; }
.btn.danger:hover:not(:disabled) { background: #dc2626; transform: translateY(-1px); }
.btn.success { background: var(--success); color: white; }
.btn.success:hover:not(:disabled) { background: #059669; transform: translateY(-1px); }
.btn.icon { width: 40px; height: 40px; padding: 0; border-radius: var(--radius-full); background: transparent; }
.btn.icon:hover:not(:disabled) { background: var(--bg-hover); border-color: var(--border); transform: scale(1.04); }
.btn.fullwidth { width: 100%; }
.btn.small { padding: 6px 12px; font-size: 0.75rem; }

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    transition: all var(--transition-fast);
}
.card:hover { border-color: var(--border-dark); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-lg); flex-wrap: wrap; gap: var(--space-sm); }
.card-title { font-size: 1.125rem; font-weight: 700; }

.input, .textarea, .select {
    width: 100%;
    padding: 12px 14px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.875rem;
    transition: all var(--transition-fast);
}
.input:focus, .textarea:focus, .select:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255,255,255,0.06);
    box-shadow: 0 0 0 2px var(--primary-light);
}
.input::placeholder, .textarea::placeholder { color: var(--text-muted); }
.textarea { min-height: 100px; resize: vertical; }

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 600;
}
.badge.primary { background: var(--primary-light); color: var(--primary); }
.badge.success { background: var(--success-light); color: var(--success); }
.badge.warning { background: var(--warning-light); color: var(--warning); }
.badge.danger { background: var(--danger-light); color: var(--danger); }
.badge.info { background: var(--info-light); color: var(--info); }

.deal-amount,
.deal-list-amount,
.listing-card-price,
.p2p-market-price strong,
.p2p-trade-party-price strong,
.badge,
.notification-count,
.mobile-bottom-badge,
.dashboard-stat-value,
.profile-metric strong,
.deals-group-count {
    font-variant-numeric: tabular-nums;
}

/* Toast */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 380px;
}
.toast {
    padding: 14px 16px;
    border-radius: var(--radius);
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: slideInRight 0.3s ease;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.warning { border-left: 3px solid var(--warning); }
.toast.info { border-left: 3px solid var(--info); }
.toast-content { flex: 1; }
.toast-title { font-weight: 600; margin-bottom: 4px; }
.toast-message { font-size: 0.8rem; color: var(--text-secondary); }
.toast-close { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 8px; background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 0; flex-shrink: 0; }
@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Dropdown */
.dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    z-index: 1000;
    overflow: hidden;
}
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    color: var(--text);
    transition: background var(--transition-fast);
    cursor: pointer;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
}
.dropdown-item:hover { background: var(--bg-hover); }
.dropdown-item svg { width: 18px; height: 18px; }
.dropdown-item svg.dropdown-item-chevron { width: 14px; height: 14px; }
.dropdown-item svg.dropdown-item-check { width: 16px; height: 16px; }
.dropdown-divider { height: 1px; background: var(--border); margin: 6px 0; }

/* Пункт «Тема» с выбором внутри меню аккаунта. Подменю раскрывается вниз, а не
   вбок: у .dropdown стоит overflow:hidden, и вылетающая панель была бы обрезана. */
.dropdown-item-value {
    margin-left: auto;
    color: var(--primary);
    font-size: .86rem;
    white-space: nowrap;
}

.dropdown-item-chevron {
    flex: 0 0 auto;
    color: var(--text-secondary);
    transition: transform var(--transition-fast);
}

.dropdown-item-expandable[aria-expanded="true"] .dropdown-item-chevron {
    transform: rotate(90deg);
}

.dropdown-submenu {
    display: grid;
    background: rgba(0, 0, 0, .14);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.dropdown-submenu.hidden { display: none; }

.dropdown-submenu-item {
    padding-left: 42px;
    font-size: .92rem;
}

.dropdown-item-check {
    margin-left: auto;
    flex: 0 0 auto;
    color: var(--primary);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

/* THEME-D1: outranks .dropdown-item svg (opacity .6), so only the current theme is checked. */
.dropdown-submenu-item .dropdown-item-check { opacity: 0; }
.dropdown-submenu-item.is-active .dropdown-item-check { opacity: 1; }
.dropdown-submenu-item.is-active { color: var(--primary); }

/* Мультиаккаунт: список привязанных аккаунтов и кнопка добавления. */
.account-switcher-list:empty { display: none; }

.account-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding-right: 8px;
}

.account-item-main {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1 1 auto;
    min-width: 0;
    padding: 9px 8px 9px 16px;
    background: none;
    border: none;
    color: var(--text);
    text-align: left;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.account-item-main:hover:not(:disabled) { background: var(--bg-hover); }
.account-item-main:disabled { opacity: .55; cursor: not-allowed; }

.account-item-avatar {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    background-color: rgba(148, 163, 184, .2);
    display: grid;
    place-items: center;
    font-size: .8rem;
    font-weight: 600;
}

.account-item-text {
    display: grid;
    gap: 1px;
    min-width: 0;
}

.account-item-text b {
    font-size: .9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-item-text span {
    font-size: .76rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-item-remove {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    opacity: 0;
    transition: opacity var(--transition-fast), background var(--transition-fast);
}

.account-item:hover .account-item-remove,
.account-item-remove:focus-visible { opacity: 1; }
.account-item-remove:hover { background: rgba(239, 68, 68, .16); color: var(--danger); }

/* Активный аккаунт: только отметка, без действий. */
.account-item-main.is-static {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1 1 auto;
    min-width: 0;
    padding: 9px 8px 9px 16px;
    cursor: default;
}

.account-item.is-active { background: rgba(99, 102, 241, .08); }
.account-item.is-active .account-item-text b { color: var(--primary); }
.account-item-check { flex: 0 0 auto; color: var(--primary); }

/* Иконка того же размера, что у остальных пунктов меню: с крупным кружком
   текст кнопки уезжал на 14px правее «Профиля» и «Настроек». */
.account-add-btn svg {
    flex: 0 0 auto;
    color: var(--primary);
}

.account-add-qr {
    padding: 0 16px 16px;
}

.account-add-btn.hidden { display: none; }

/* Модалка добавления аккаунта */
.account-add-overlay {
    position: fixed;
    inset: 0;
    z-index: 1500;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    place-items: center;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    background: rgba(0, 0, 0, .72);
}

.account-add-modal {
    width: min(100%, 420px);
    max-width: 420px;
    height: auto;
    min-height: 0;
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    border: 1px solid var(--border);
    border-radius: 28px;
    background: var(--bg-card);
    overflow-x: hidden;
    overflow-y: auto;
    box-shadow: 0 24px 72px rgba(0, 0, 0, .32), inset 0 1px 0 rgba(255, 255, 255, .04);
}

.account-add-brand-mark {
    display: grid;
    width: 72px;
    height: 72px;
    place-items: center;
    margin: 26px auto 10px;
    overflow: hidden;
    border-radius: 50%;
    background: #0d0b16;
    box-shadow: 0 12px 30px color-mix(in srgb, var(--primary) 30%, transparent), 0 0 0 1px color-mix(in srgb, var(--primary) 30%, transparent);
}

.account-add-brand-mark > img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scale(1.1);
    user-select: none;
    -webkit-user-drag: none;
}

.account-add-head {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 6px 52px 12px;
}

.account-add-head h3 { font-size: 1.12rem; text-align: center; }

.account-add-head .profile-modal-close {
    position: absolute;
    inset-inline-end: 14px;
    top: 0;
}

.account-add-body {
    display: grid;
    gap: 12px;
    padding: 8px 24px 16px;
}

.account-add-hint {
    color: var(--text-secondary);
    font-size: .84rem;
    line-height: 1.45;
    text-align: center;
}

.account-add-error {
    color: var(--danger);
    font-size: .85rem;
    min-height: 18px;
}

.account-add-body.hidden,
.account-add-qr.hidden,
.account-add-body .form-group.hidden { display: none; }

.account-add-methods { padding: 12px 0 0; }

/* Fields and actions follow the sign-in screen: label inside the outlined box,
   one accent button, text-style secondary action. */
.account-add-body .form-group {
    position: relative;
    margin: 0;
}

.account-add-body .form-group > .form-label {
    position: absolute;
    inset-block-start: 8px;
    inset-inline-start: 17px;
    z-index: 1;
    margin: 0;
    color: var(--text-muted);
    font-size: .74rem;
    font-weight: 600;
    line-height: 1.1;
    pointer-events: none;
}

.account-add-body .form-group:focus-within > .form-label { color: var(--primary-text); }

.account-add-body .form-group > .input {
    height: 58px;
    padding: 24px 16px 8px;
    border: 1px solid color-mix(in srgb, var(--text) 16%, transparent);
    border-radius: 14px;
    background: transparent;
    box-shadow: none;
}

.account-add-body .form-group > .input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: inset 0 0 0 1px var(--primary);
}

.account-add-body .account-add-error:empty { min-height: 0; }

.account-add-body .btn.primary.fullwidth {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 52px;
    border: 0;
    border-radius: 14px;
    background: var(--primary-grad);
    color: #fff;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.account-add-body .btn.ghost.fullwidth {
    min-height: 44px;
    border: 0;
    background: transparent;
    color: var(--primary-text);
    font-size: .88rem;
    font-weight: 600;
    letter-spacing: .035em;
    text-transform: uppercase;
}

.account-add-body .btn.ghost.fullwidth:hover:not(:disabled) {
    background: color-mix(in srgb, var(--primary) 12%, transparent);
}

.account-add-qr .qr-signin-code { border-radius: 22px; }

/* Unlink confirmation (ui/accounts.js confirmAccountUnbind). */
.account-confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 1600;
    display: grid;
    place-items: center;
    padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    background: rgba(0, 0, 0, .6);
}

.account-confirm-modal {
    width: min(100%, 360px);
    padding: 22px 22px 14px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--bg-secondary);
    box-shadow: 0 24px 64px rgba(0, 0, 0, .36);
    backdrop-filter: blur(24px) saturate(130%);
    -webkit-backdrop-filter: blur(24px) saturate(130%);
}

.account-confirm-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.account-confirm-head .account-item-avatar {
    width: 40px;
    height: 40px;
}

.account-confirm-head h3 {
    margin: 0;
    color: var(--text);
    font-size: 1.08rem;
    font-weight: 700;
}

.account-confirm-modal p {
    margin: 0 0 14px;
    color: var(--text-secondary);
    font-size: .92rem;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.account-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 4px;
}

.account-confirm-btn {
    min-height: 40px;
    padding: 8px 14px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--primary-text);
    font: inherit;
    font-size: .88rem;
    font-weight: 700;
    letter-spacing: .035em;
    text-transform: uppercase;
    cursor: pointer;
}

.account-confirm-btn:hover { background: color-mix(in srgb, var(--primary) 12%, transparent); }
.account-confirm-btn.is-danger { color: var(--danger); }
.account-confirm-btn.is-danger:hover { background: color-mix(in srgb, var(--danger) 12%, transparent); }
.account-confirm-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Touch screens have no hover: keep the unlink control discoverable. */
@media (hover: none) {
    .account-item-remove { opacity: .7; }
}

.account-add-qr { padding: 0 24px 22px; }

@media (max-width: 480px) {
    .account-add-overlay {
        padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    }

    .account-add-modal {
        max-height: calc(100vh - 24px);
        max-height: calc(100dvh - 24px);
        border-radius: 24px;
    }

    .account-add-brand-mark { width: 60px; height: 60px; margin-top: 18px; }
    .account-add-body { padding-inline: 18px; }
    .account-add-qr { padding-inline: 18px; }
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: var(--space-md);
}
.modal {
    background: var(--bg-modal);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    max-width: 550px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
}
.modal-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-title { font-size: 1.25rem; font-weight: 700; }
.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: var(--space-lg); }
/* Legacy wallet notices (deposit/withdrawal modals): former inline styles (style-src). */
.modal-body .legacy-wallet-notice { padding: 16px; }
.legacy-wallet-notice .legacy-wallet-notice-title { margin-top: 0; }
.modal-footer {
    padding: var(--space-lg);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-md);
    flex-wrap: wrap;
}

/* ===== STATS GRID ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space-md);
}
.stat-card:hover { transform: translateY(-4px); border-color: var(--primary-light); box-shadow: var(--shadow-lg); }
.stat-icon {
    width: 56px; height: 56px;
    border-radius: var(--radius);
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
}
.stat-value { font-size: 28px; font-weight: 700; }
.stat-label { font-size: 0.75rem; color: var(--text-secondary); margin-top: 4px; }

/* ===== ЧАТ – ПОЛНОЭКРАННЫЙ МЕССЕНДЖЕР ===== */
.chats-page {
    height: calc(100vh - 60px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg);
    margin: 0;
    width: 100%;
}

.chats-container {
    flex: 1;
    display: flex;
    min-height: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
}

/* -- боковая панель (список диалогов) -- */
.chats-sidebar {
    width: 360px;
    min-width: 280px;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2;
}

.chats-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md);
    border-bottom: 1px solid var(--border);
}
.chats-sidebar-header h2 { margin-bottom: 0; font-size: 1.125rem; }
/* Search row: username search plus the group-create button on its right
   (owner, 2026-10-08); results drop below on their own line. */
.chats-search {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    column-gap: 10px;
    padding: var(--space-md);
    border-bottom: 1px solid var(--border);
}
.chats-search > #user-search-input { flex: 1 1 0; min-width: 0; }
.chats-search > #new-group-top-btn { flex: 0 0 auto; }
.chats-search > #user-search-results { flex: 1 1 100%; min-width: 0; }
.chats-search > #user-search-results:not(:empty) { margin-top: 10px; }
.chats-list { flex: 1; overflow-y: auto; }

.chat-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: all var(--transition-fast);
}
.chat-item:hover { background: var(--bg-hover); transform: translateX(4px); }
.chat-item.active { background: var(--primary-light); }
.chat-item-left { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.chat-item-name { font-weight: 600; margin-bottom: 2px; }
.chat-item-preview {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}
.chat-item-right { text-align: right; flex-shrink: 0; }
.chat-item-time { font-size: 0.7rem; color: var(--text-muted); }
.chat-item-badge {
    background: var(--primary);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    margin-top: 4px;
    display: inline-block;
}

/* -- основная область (сообщения) -- */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--bg);
}

.chat-placeholder {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-secondary);
    flex-direction: column;
}
.chat-placeholder .placeholder-content { max-width: 300px; }
.chat-placeholder svg { margin-bottom: 16px; opacity: 0.5; }
.chat-placeholder h3 { font-size: 1.25rem; margin-bottom: 8px; }
.chat-placeholder p { margin-bottom: 20px; }

.chat-active {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    /* Containing block for message navigation overlays at every viewport. */
    position: relative;
}

/* Шапка активного чата */
.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.chat-peer-info { display: flex; align-items: center; gap: 12px; }
.chat-peer-info[role="button"] { cursor: pointer; }
.chat-peer-info[role="button"]:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--primary) 72%, white);
    outline-offset: 2px;
}
.chat-peer-name { font-weight: 600; font-size: 1rem; }
.chat-peer-status { font-size: 0.7rem; color: var(--text-muted); }
.chat-header-actions { display: flex; gap: 8px; }

.chat-header-actions .btn.icon {
    background: var(--bg-tertiary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}
.chat-header-actions .btn.icon:hover {
    background: var(--primary-light);
    transform: scale(1.05);
}
.chat-header-actions .btn.icon svg {
    stroke: var(--text);
    stroke-width: 1.8;
}

/* Optional in-memory source return; the chat owns its visibility and context. */
.chat-active > .chat-entry-return {
    display: flex;
    align-items: center;
    gap: 9px;
    flex: 0 0 auto;
    min-width: 0;
    min-height: 44px;
    width: 100%;
    padding: 9px 16px;
    border: 0;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    color: var(--primary-text, var(--primary));
    background: var(--bg-secondary);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    text-align: start;
    cursor: pointer;
}

.chat-active > .chat-entry-return.hidden,
.chat-active > .chat-entry-return[hidden] {
    display: none;
}

.chat-entry-return span {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-entry-return svg {
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
}

.chat-active > .chat-entry-return:hover {
    background: var(--bg-hover);
}

.chat-active > .chat-entry-return:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -3px;
}

.chat-active > .chat-entry-return:active {
    background: var(--primary-light);
}

.chat-active > .chat-entry-return:disabled {
    opacity: .5;
    cursor: default;
}

/* A source row shares the header stack rather than overlapping the legacy
   floating header. Natural flow also handles search, pins and font scaling;
   ordinary conversations retain their original floating layout. */
html body .app[data-page="chats"] #chat-active:not(.hidden).has-entry-return {
    display: flex !important;
    flex-direction: column;
}

html body .app[data-page="chats"] #chat-active.has-entry-return > .chat-header {
    position: relative !important;
    inset: auto !important;
    flex: 0 0 auto;
    width: auto !important;
    margin: 8px 10px 6px !important;
}

html body .app[data-page="chats"] #chat-active.has-entry-return > :is(#chat-search-bar, .chat-pinned-bar) {
    position: relative !important;
    inset: auto !important;
    flex: 0 0 auto;
    width: auto !important;
    margin: 6px 10px !important;
}

html body .app[data-page="chats"] #chat-active.has-entry-return > #chat-messages {
    min-height: 0;
    padding-top: 12px !important;
}

/* -- сообщения -- */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.message {
    max-width: 75%;
    padding: 8px 12px;
    border-radius: 18px;
    position: relative;
    word-break: break-word;
    animation: messageIn 0.2s ease;
}
@keyframes messageIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.message.sent {
    align-self: flex-end;
    background: var(--primary-grad);
    color: white;
    border-bottom-right-radius: 4px;
}
.message.received {
    align-self: flex-start;
    background: var(--bg-tertiary);
    border-bottom-left-radius: 4px;
}
.message-content { font-size: 0.95rem; line-height: 1.4; }
/* Account/device override only for message text, not headers, calls or composer.
   The default has no marker, so legacy typography remains exactly unchanged. */
html[data-dealix-chat-text-size] .chats-page #chat-messages .message-content,
html[data-dealix-chat-text-size] .chats-page #chat-messages .chat-attachment-caption-text {
    font-size: var(--dealix-chat-font-size);
}

.message-time {
    font-size: 0.65rem;
    margin-top: 4px;
    text-align: right;
    opacity: 0.7;
}
.message-date-divider {
    text-align: center;
    margin: 16px 0;
}
.message-date-divider span {
    background: var(--bg-tertiary);
    padding: 4px 14px;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    color: var(--text-muted);
}
.chat-attach-image { max-width: 250px; max-height: 250px; border-radius: var(--radius); cursor: pointer; }
.chat-attach-link { color: var(--primary); text-decoration: underline; word-break: break-all; }

/* -- индикатор печати -- */
.chat-typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border-radius: 20px;
    width: fit-content;
    margin: 8px 16px;
}
.typing-dots { display: flex; gap: 4px; }
.typing-dots .dot {
    width: 6px; height: 6px;
    background: var(--text-secondary);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}
.typing-dots .dot:nth-child(1) { animation-delay: 0s; }
.typing-dots .dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dots .dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-4px); opacity: 1; }
}

/* -- поле ввода -- */
.chat-input-area {
    flex-shrink: 0;
    display: flex;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    align-items: flex-end;
}

.chat-input-actions {
    display: flex;
    gap: 4px;
    align-items: center;
    margin-bottom: 2px;
}
.chat-input-actions .btn.icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: transparent;
    transition: background 0.2s, transform 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.chat-input-actions .btn.icon svg {
    stroke: var(--text-muted);
    stroke-width: 1.8;
    transition: stroke 0.2s;
}
.chat-input-actions .btn.icon:hover {
    background: var(--bg-hover);
    transform: scale(1.05);
}
.chat-input-actions .btn.icon:hover svg {
    stroke: var(--text);
}

.chat-input-wrapper {
    flex: 1;
    position: relative;
    background: var(--bg-tertiary);
    border-radius: 24px;
    transition: background 0.2s, box-shadow 0.2s;
    border: 1px solid transparent;
}
/* Group-scoped controls: no global checkbox, shell, keyboard or media overrides. */
.chats-page .group-mention-popup {
    position: absolute;
    inset-inline: 0;
    bottom: calc(100% + 8px);
    z-index: 45;
    max-height: min(280px, 36dvh);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--bg-secondary);
    color: var(--text);
    box-shadow: 0 8px 24px rgba(0,0,0,.18);
    text-align: start;
}
.chats-page .group-mention-popup[hidden] { display: none; }
.chats-page .group-mention-popup [role="option"] {
    display: block;
    width: 100%;
    min-height: 44px;
    margin: 0;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: 9px;
    color: var(--text);
    background: transparent;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    text-align: start;
    overflow-wrap: anywhere;
    cursor: pointer;
}
.chats-page .group-mention-popup [aria-selected="true"] { background: var(--bg-hover); border-color: var(--primary); }
.chats-page .group-mention-status { padding: 7px 10px; font-size: 12px; line-height: 1.45; color: var(--text-muted); }
.chats-page .group-notification-preferences {
    display: grid;
    gap: 8px;
    margin: 12px 0;
    padding: 14px;
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    background: var(--bg-secondary);
}
.chats-page .group-notification-preferences:empty { display: none; }
.chats-page .group-notification-preferences label { font-weight: 600; font-size: 14px; }
.chats-page .group-notification-preferences select {
    width: 100%; min-width: 0; min-height: 44px; box-sizing: border-box;
    padding: 8px; border: 1px solid var(--border); border-radius: 9px;
    background: var(--bg); color: var(--text); font: inherit; font-size: 14px;
}
.chats-page .group-notification-preferences p { margin: 0; line-height: 1.5; font-size: 12px; color: var(--text-muted); overflow-wrap: anywhere; }
.chats-page .group-mode-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.chats-page .group-mode-actions button {
    min-height: 44px; padding: 8px 10px; max-width: 100%; white-space: normal;
    background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 9px; font: inherit; font-size: 13px; cursor: pointer;
}
.chats-page .group-mode-actions button:disabled,
.chats-page .group-notification-preferences select:disabled { opacity: .55; cursor: default; }
.chats-page .group-mode-actions [data-group-save]:not(:disabled) { background: var(--primary); color: #fff; }
.chats-page .group-mention-popup button:focus-visible,
.chats-page .group-mode-actions button:focus-visible,
.chats-page .group-notification-preferences select:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.chat-input-wrapper:focus-within {
    background: var(--bg-card);
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light);
}
.chat-input-wrapper textarea {
    width: 100%;
    min-height: 44px;
    max-height: 120px;
    resize: none;
    padding: 12px 16px;
    padding-right: 36px;
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 0.95rem;
    line-height: 1.4;
    outline: none;
    overflow-y: auto;
}
.chat-input-wrapper textarea::placeholder {
    color: var(--text-muted);
}
.chat-input-hint {
    position: absolute;
    right: 10px;
    bottom: 6px;
    font-size: 0.65rem;
    color: var(--text-muted);
    pointer-events: none;
    user-select: none;
}

/* Кнопка отправки */
#send-message-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary-grad);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
    margin-bottom: 2px;
}
#send-message-btn svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
    stroke: none;
}
#send-message-btn:disabled {
    background: var(--text-muted);
    opacity: 0.5;
    cursor: not-allowed;
}
#send-message-btn:not(:disabled):hover {
    transform: scale(1.08);
    box-shadow: 0 0 14px rgba(99, 102, 241, 0.5);
}

/* Кнопка назад */
.chat-back-btn {
    display: none;
}

/* -- информационная панель (правая) -- */
.chat-info-sidebar {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 320px;
    max-height: calc(100% - 24px);
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 200;
}
.chat-info-sidebar.hidden { display: none !important; }
.chat-info-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md);
    border-bottom: 1px solid var(--border);
}
.chat-info-content { flex: 1; overflow-y: auto; padding: var(--space-md); }

/* Telegram-like scroll-down индикатор: круглая кнопка справа над composer. */
.new-messages-wrap {
    position: absolute;
    right: 14px;
    /* Package G/P: the offset above the composer is measured at runtime from real
       rects (updateScrollDownButtonOffset). Falls back to a fixed value before JS
       measures, so the button never regresses in states that already worked. */
    bottom: var(--chat-scroll-down-offset, 80px);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: flex-end;
    gap: 12px;
    padding-right: 0;
    z-index: 5;
    pointer-events: none;
}
/* P: on mobile the button is a real OVERLAY inside the positioned .chat-active,
   not a flow/sticky element in the messages column (that lived in a different
   coordinate space and slid under Send). Its bottom is computed from real rects:
   surfaceRect.bottom - min(composerTop, nowPlayingTop) + gap. */
@media (max-width: 768px) {
    .new-messages-wrap {
        position: absolute;
        left: auto;
        right: 14px;
        /* offset already measures to the composer top (its safe-area padding is
           inside that distance), so env() is NOT added again here. */
        bottom: var(--chat-scroll-down-offset, 84px);
        padding-right: 0;
        z-index: 6;
    }
}
#new-messages-btn, #chat-addressed-btn { pointer-events: auto; }
.chat-scroll-down-btn {
    position: relative;
    width: 44px;
    height: 44px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: color-mix(in srgb, var(--bg-secondary) 90%, transparent);
    color: #fff;
    cursor: pointer;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 5px 18px rgba(0, 0, 0, .16);
    touch-action: manipulation;
}
.chat-scroll-down-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.chat-scroll-down-btn.hidden { display: none; }
.chat-scroll-down-count {
    position: absolute;
    top: -6px;
    right: -4px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--primary-grad);
    color: #fff;
    font-size: .72rem;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
}
.chat-scroll-down-count.hidden { display: none; }
body.theme-light .chat-scroll-down-btn,
html[data-theme="light"] body .chat-scroll-down-btn,
[data-theme="light"] .chat-scroll-down-btn {
    background: rgba(255, 255, 255, .92);
    color: #1f2937;
    border-color: rgba(15, 23, 42, .12);
}

/* П2: компактная now-playing панель голосового (persistent controller).
   #3: два размещения — docked (над composer в чате) и inline (в потоке под
   header списка диалогов, над первым диалогом). */
.voice-now-playing {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, .12);
    background: rgba(17, 24, 39, .9);
    color: #fff;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.voice-now-playing.hidden { display: none; }
/* Docked: плавающая полоса над нижней навигацией/composer. */
.voice-now-playing.voice-np-docked {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(env(safe-area-inset-bottom, 0px) + 82px);
    z-index: 70;
    width: min(440px, calc(100vw - 24px));
}
/* Inline: часть layout сайдбара диалогов; список сдвигается вниз, при
   закрытии (hidden) зазора не остаётся. */
.voice-now-playing.voice-np-inline {
    position: relative;
    z-index: 3;
    margin: 8px 12px 4px;
    width: auto;
}
.voice-np-toggle,
.voice-np-close {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    border: 0;
    background: rgba(255, 255, 255, .10);
    color: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.voice-np-close { font-size: 1.1rem; line-height: 1; }
.voice-np-main { flex: 1; min-width: 0; }
.voice-np-main b {
    display: block;
    font-size: .82rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.voice-np-bar {
    margin-top: 5px;
    height: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .14);
    overflow: hidden;
}
.voice-np-bar i {
    display: block;
    height: 100%;
    width: 0;
    background: var(--primary, #6d5dfc);
}
body.theme-light .voice-now-playing {
    background: rgba(255, 255, 255, .94);
    color: #111827;
    border-color: rgba(15, 23, 42, .12);
}
body.theme-light .voice-np-toggle,
body.theme-light .voice-np-close { background: rgba(15, 23, 42, .06); }

/* -- адаптивность -- */
@media (max-width: 1024px) {
    .chats-sidebar {
        position: absolute;
        top: 0;
        left: 0;
        bottom: 0;
        width: 100%;
        z-index: 10;
        transform: translateX(0);
        background: var(--bg);
    }

    .chats-container.mobile-chat-open .chats-sidebar {
        transform: translateX(-100%);
    }

    .chat-back-btn {
        display: inline-flex !important;
        background: var(--primary-light);
        border-radius: 50%;
        width: 40px;
        height: 40px;
        align-items: center;
        justify-content: center;
        margin-right: 8px;
    }

    .chat-header-actions .btn.icon:not(.chat-back-btn):not(#call-voice-btn):not(#call-video-btn):not(#chat-search-msg-btn) {
        display: none;
    }
}

@media (min-width: 1025px) {
    .chat-back-btn {
        display: none !important;
    }
}

/* Узкие экраны */
@media (max-width: 480px) {
    .chat-input-actions .btn.icon {
        width: 36px;
        height: 36px;
    }
    #send-message-btn {
        width: 44px;
        height: 44px;
    }
    #send-message-btn svg {
        width: 22px;
        height: 22px;
    }
    .chat-input-wrapper {
        border-radius: 20px;
    }
    .chat-input-wrapper textarea {
        font-size: 0.9rem;
        padding: 10px 12px;
        padding-right: 32px;
    }
}

/* Chats: former inline styles (style-src), scoped to the chats page. */
.chats-page .chat-empty-icon { margin-bottom: 12px; opacity: 0.5; }
.chats-page .chat-empty-icon-lg { margin-bottom: 16px; opacity: 0.5; }
.chats-page .chat-support-badge { color: var(--primary); font-size: 0.7rem; }

/* ===== DEALS ===== */
.deals-page { min-width: 0; }
.deals-container {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: var(--space-md);
    height: calc(100vh - 140px);
}
.deals-sidebar {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.deals-list { flex: 1; overflow-y: auto; padding: var(--space-sm); }
.deal-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
    margin-bottom: 6px;
}
.deal-list-item:hover { background: var(--bg-hover); border-color: var(--border); transform: translateX(4px); }
.deal-list-item.active { background: var(--primary-light); border-color: var(--primary); }
.deal-item-title { font-weight: 600; margin-bottom: 4px; }
.deal-item-amount { font-weight: 700; color: var(--primary); }
.deal-open-btn {
    margin-top: 8px;
    padding: 6px 12px;
    border-radius: var(--radius);
    background: rgba(99, 102, 241, 0.1);
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: 0.75rem;
    width: 100%;
}
.deal-details { overflow-y: auto; }
/* Deal details: former inline styles (style-src), scoped to the page. */
.deals-page .deal-skeleton-title { width: 60%; height: 32px; }
.deals-page .deal-skeleton-block { width: 100%; height: 120px; margin-top: 20px; }
.deals-page .deal-skeleton-block-lg { width: 100%; height: 200px; margin-top: 20px; }
.deals-page .deal-contract-panel { margin-top: 12px; padding: 10px; background: rgba(99,102,241,0.08); border-radius: 8px; border: 1px solid rgba(99,102,241,0.2); }
.deals-page .deal-contract-panel-title { font-weight: 600; font-size: 0.8rem; margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.deals-page .deal-contract-panel-address { font-size: 0.75rem; color: var(--text-secondary); word-break: break-all; margin-bottom: 8px; }
.deals-page .deal-contract-panel-link { font-size: 0.7rem; color: var(--primary); text-decoration: underline; }
.deals-page .deal-crypto-panel { margin-top: 12px; padding: 12px; background: rgba(16,185,129,0.08); border-radius: 10px; border: 1px solid rgba(16,185,129,0.22); }
.deals-page .deal-crypto-panel-title { font-weight: 700; font-size: 0.9rem; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.deals-page .deal-crypto-panel-grid { display: grid; grid-template-columns: 160px 1fr; gap: 6px; font-size: 0.82rem; color: var(--text-secondary); }
.deals-page .deal-crypto-panel-grid .deal-crypto-tx-link { color: var(--primary); text-decoration: underline; }
.deals-page .deal-crypto-panel-warning { margin-top: 8px; color: #f59e0b; font-size: 0.78rem; }

/* ===== WALLET ===== */
.balance-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}
.balance-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space-md);
}
.balance-value { font-size: 28px; font-weight: 700; }
.balance-label { font-size: 0.75rem; color: var(--text-secondary); }

/* ===== AUTH ===== */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
}

/* Экран подтверждения входа по QR-коду (#qr). Живёт рядом со страницей входа:
   визуально это часть того же сценария авторизации. */
.qr-login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
    min-height: 60vh;
}

.qr-login-card {
    width: 100%;
    max-width: 440px;
    padding: var(--space-xl);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    text-align: center;
}

.qr-login-icon {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    margin: 0 auto var(--space-md);
    border-radius: 20px;
    background: rgba(99, 102, 241, .14);
    border: 1px solid rgba(99, 102, 241, .24);
    color: var(--primary);
}

.qr-login-card h1 {
    font-size: 1.35rem;
    margin-bottom: 8px;
}

.qr-login-lead {
    color: var(--text-secondary);
    margin-bottom: var(--space-lg);
}

.qr-login-details {
    display: grid;
    gap: 2px;
    text-align: left;
    margin-bottom: var(--space-md);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.qr-login-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 11px 14px;
    background: rgba(255, 255, 255, .04);
}

.qr-login-row span { color: var(--text-secondary); font-size: .86rem; }
.qr-login-row b { text-align: right; word-break: break-word; }

/* Предупреждение о QR-jacking. Намеренно заметное: это единственная защита от
   сценария, когда пользователю подсовывают чужой код. */
.qr-login-warning {
    display: flex;
    gap: 10px;
    text-align: left;
    padding: 12px 14px;
    margin-bottom: var(--space-lg);
    border-radius: var(--radius);
    background: rgba(245, 158, 11, .12);
    border: 1px solid rgba(245, 158, 11, .32);
    color: var(--text);
    font-size: .86rem;
    line-height: 1.45;
}

.qr-login-warning svg { flex: 0 0 auto; color: #f59e0b; margin-top: 2px; }

.qr-login-actions { display: grid; gap: 10px; }

/* Блок «Войти по QR-коду» на странице входа. */
.qr-signin { margin-top: var(--space-lg); }

.qr-signin-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: var(--space-md) 0;
    color: var(--text-secondary);
    font-size: .84rem;
}

.qr-signin-divider::before,
.qr-signin-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.qr-signin-panel {
    display: grid;
    gap: 10px;
    justify-items: center;
    margin-top: var(--space-md);
}

.qr-signin-panel.hidden { display: none; }

/* Белая подложка обязательна: в тёмной теме сканеры плохо читают
   инвертированный код. */
.qr-signin-code {
    display: grid;
    place-items: center;
    width: 208px;
    height: 208px;
    padding: 8px;
    background: #fff;
    border-radius: var(--radius);
}

.qr-signin-code svg { width: 100%; height: 100%; display: block; }
.qr-signin-code:empty { display: none; }

.qr-signin-hint {
    color: var(--text-secondary);
    font-size: .85rem;
    text-align: center;
    line-height: 1.45;
}

.qr-signin-status {
    min-height: 20px;
    font-size: .86rem;
    text-align: center;
    color: var(--text-secondary);
}

.qr-signin-status.is-error { color: var(--danger); }
.qr-signin-status.is-warn { color: #f59e0b; }
.qr-signin-status.is-ok { color: var(--success); }

/* Встроенный сканер QR (пункт меню «Вход по QR-коду»). */
.qr-scanner-overlay {
    position: fixed;
    inset: 0;
    z-index: 1500;
    display: grid;
    place-items: center;
    padding: var(--space-md);
    background: rgba(0, 0, 0, .72);
}

.qr-scanner-modal {
    width: 100%;
    max-width: 420px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    overflow: hidden;
}

.qr-scanner-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

.qr-scanner-head h3 { font-size: 1.05rem; }

.qr-scanner-body {
    display: grid;
    gap: 12px;
    padding: 16px;
}

/* До включения камеры область остаётся плейсхолдером: чёрный прямоугольник
   без картинки выглядел бы как сломанный элемент. */
.qr-scanner-stage {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: var(--radius);
    overflow: hidden;
    background: rgba(148, 163, 184, .12);
    border: 1px dashed var(--border);
}

.qr-scanner-stage video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

.qr-scanner-stage.is-live { border-style: solid; background: #000; }
.qr-scanner-stage.is-live video { display: block; }

.qr-scanner-frame {
    position: absolute;
    inset: 18%;
    border: 2px solid rgba(255, 255, 255, .85);
    border-radius: 14px;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, .18);
    pointer-events: none;
    opacity: 0;
}

.qr-scanner-stage.is-live .qr-scanner-frame { opacity: 1; }

.qr-scanner-hint {
    color: var(--text-secondary);
    font-size: .87rem;
    text-align: center;
    line-height: 1.45;
}

.qr-scanner-hint.is-warn { color: #f59e0b; }
.qr-scanner-hint.is-error { color: var(--danger); }

.qr-scanner-actions { display: grid; gap: 10px; }
.qr-scanner-actions .hidden { display: none; }
.auth-container {
    max-width: 420px;
    width: 100%;
    padding: var(--space-xl);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(10px);
}
.auth-header { text-align: center; margin-bottom: var(--space-xl); }
.auth-title { font-size: 1.5rem; margin-bottom: 8px; }
.auth-subtitle { color: var(--text-secondary); }
.auth-tabs {
    display: flex;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
    border-bottom: 1px solid var(--border);
}
.auth-tab {
    flex: 1;
    padding: 10px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-weight: 600;
    cursor: pointer;
}
.auth-tab.active { color: var(--primary); border-bottom: 2px solid var(--primary); }
.auth-form { margin-top: var(--space-lg); }

/* ===== TABLES ===== */
.table {
    width: 100%;
    border-collapse: collapse;
}
.table th {
    text-align: left;
    padding: 12px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
}
.table td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
}
.table tr:hover { background: var(--bg-hover); }

/* ===== SKELETON ===== */
.skeleton {
    background: linear-gradient(90deg, var(--bg-hover) 25%, rgba(255,255,255,0.08) 50%, var(--bg-hover) 75%);
    background-size: 200% 100%;
    animation: skeletonLoading 1.5s infinite;
    border-radius: var(--radius);
}
@keyframes skeletonLoading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ===== STATUS TIMELINE ===== */
.status-timeline {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: var(--space-lg) 0;
    flex-wrap: wrap;
}
.status-step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    position: relative;
    min-width: 80px;
}
.status-step::before {
    content: '';
    position: absolute;
    top: 12px;
    left: -50%;
    right: 50%;
    height: 2px;
    background: var(--border);
}
.status-step:first-child::before { display: none; }
.status-dot {
    width: 24px; height: 24px;
    border-radius: 50%;
    background: var(--border);
    border: 2px solid var(--bg-primary);
    z-index: 2;
}
.status-step.active .status-dot { background: var(--primary); box-shadow: 0 0 0 4px var(--primary-light); }
.status-step.completed .status-dot { background: var(--success); }
.status-step.completed::before { background: var(--success); }
.status-label { font-size: 0.7rem; text-align: center; color: var(--text-secondary); }
.status-step.active .status-label { color: var(--text); font-weight: 600; }

/* ===== PROFILE – УЛУЧШЕННЫЙ ===== */
.profile-header {
    display: flex;
    align-items: center;
    gap: var(--space-2xl);
    margin-bottom: var(--space-xl);
    flex-wrap: wrap;
    background: var(--bg-card);
    padding: var(--space-xl);
    border-radius: var(--radius-lg);
}
.profile-avatar {
    position: relative;
    flex-shrink: 0;
}
.profile-info { flex: 1; }
.profile-name { font-size: 1.75rem; margin-bottom: var(--space-xs); }
.profile-stats {
    display: flex;
    gap: var(--space-xl);
    margin-top: var(--space-lg);
    flex-wrap: wrap;
}
.profile-tab {
    padding: 10px 20px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}
.profile-tab.active { color: var(--primary); border-bottom: 2px solid var(--primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }
.avatar-edit-btn {
    position: absolute;
    bottom: 0;
    right: 0;
    background: var(--primary);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 2px solid var(--bg-card);
}

/* ===== SECURITY ===== */
.security-tabs {
    display: flex;
    gap: var(--space-sm);
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--space-lg);
    flex-wrap: wrap;
}
.security-tab {
    padding: 10px 20px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-weight: 600;
    cursor: pointer;
}
.security-tab.active { color: var(--primary); border-bottom: 2px solid var(--primary); }

/* ===== DISPUTES (СПОРЫ) ===== */
.disputes-page { width: 100%; min-width: 0; margin: 0 auto; }
.dispute-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-md);
    transition: all var(--transition-fast);
}
.dispute-card:hover { transform: translateY(-2px); border-color: var(--primary-light); box-shadow: var(--shadow-md); }
.dispute-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
    flex-wrap: wrap;
}
.dispute-title h3 { margin-bottom: 0; }
.dispute-status {
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
}
.dispute-status.open { background: var(--danger-light); color: var(--danger); }
.dispute-status.resolved { background: var(--success-light); color: var(--success); }
.dispute-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

/* ===== АДМИН-ПАНЕЛЬ ===== */
.admin-panel { width: 100%; }
.admin-header { margin-bottom: var(--space-xl); }
.admin-tabs {
    display: flex;
    gap: var(--space-sm);
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--space-lg);
    flex-wrap: wrap;
}
.admin-tab {
    padding: 10px 20px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}
.admin-tab:hover { color: var(--text); background: var(--bg-hover); border-radius: var(--radius); }
.admin-tab.active { color: var(--primary); border-bottom: 2px solid var(--primary); }
.admin-search {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
    flex-wrap: wrap;
}
.admin-search .input { flex: 1; min-width: 200px; }
.table-container { overflow-x: auto; }
.pagination {
    display: flex;
    justify-content: center;
    margin-top: var(--space-lg);
}
.pagination-buttons {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}
.page-info {
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
}

/* #admin/withdrawals (legacy archive page): former inline styles, scoped to the
   page root so they keep winning over the generic .card/.page-header rules. */
.admin-withdrawals-page .admin-wd-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.admin-withdrawals-page .admin-wd-title { margin: 0; }
.admin-withdrawals-page .admin-wd-subtitle { margin-top: 4px; }
.admin-withdrawals-page .admin-wd-actions { display: flex; gap: 8px; align-items: center; }
.admin-withdrawals-page .admin-wd-card { padding: 16px; margin-top: 12px; }
.admin-withdrawals-page .admin-wd-card-title { margin-top: 0; }
.admin-withdrawals-page .admin-wd-links { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

/* Admin panel: former inline styles (style-src), scoped to their containers so
   they keep winning over the generic .card/.modal/.table rules. */
.admin-header .admin-header-actions { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
/* First render shows only the active tab; tab clicks then set display inline (CSSOM). */
.admin-content > .tab-pane { display: none; }
.admin-content > .tab-pane.is-active { display: block; }
.admin-panel .admin-sessions-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.admin-panel .admin-sessions-hint { margin: 4px 0 0; }
.admin-content .table-container td.admin-sessions-ua { max-width: 360px; white-space: normal; word-break: break-word; }
.admin-panel .admin-broadcast-card { margin-bottom: 24px; }
.admin-panel .admin-broadcast-empty { text-align: center; padding: 20px; }
.admin-panel .admin-list-toolbar { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.modal.admin-deal-modal-dialog { max-width: 860px; }
.modal.admin-dispute-modal-dialog { max-width: 900px; }
.admin-dispute-modal-dialog .admin-dispute-escrow { padding: 12px; margin: 12px 0; background: rgba(59,130,246,.08); border: 1px solid var(--border); }
.admin-dispute-modal-dialog .admin-dispute-escrow-title { margin: 0 0 8px 0; }
.admin-dispute-modal-dialog .admin-dispute-escrow-note { margin-top: 8px; color: var(--text-secondary); }
.admin-dispute-modal-dialog .admin-dispute-split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.admin-dispute-modal-dialog .admin-dispute-resync { margin-top: 12px; }
.admin-dispute-modal-dialog .admin-dispute-resync-row { display: flex; gap: 8px; align-items: center; }

/* ===== КНОПКА ПЕРЕКЛЮЧЕНИЯ ТЕМ ===== */
#theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-hover);
    transition: all 0.2s ease;
}
#theme-toggle:hover {
    background: var(--primary-light);
    transform: scale(1.05);
}
#theme-toggle svg {
    transition: transform 0.2s ease;
}
#theme-toggle:hover svg {
    transform: rotate(15deg);
}

/* ===== АДАПТИВ ===== */
@media (max-width: 1024px) {
    .app {
        grid-template-columns: 1fr;
        grid-template-areas: "header" "menu" "main";
    }
    .header-title { display: none; }
    .page-content { padding: var(--space-md); }
    .deals-container {
        grid-template-columns: 1fr;
        height: auto;
    }
    .deals-container.mobile-deal-open .deals-sidebar { display: none; }
    .stats-grid { grid-template-columns: 1fr; }
    .balance-cards { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .profile-header {
        flex-direction: column;
        text-align: center;
    }
    .profile-stats {
        justify-content: center;
    }
    body {
        padding: 0;
        margin: 0;
        overflow-x: hidden;
    }
    .container,
    .content,
    .main-content {
        padding: 8px;
        width: 100%;
        box-sizing: border-box;
    }
    .header,
    .navbar {
        flex-wrap: wrap;
        padding: 8px 12px;
    }
    .header h1,
    .navbar-brand {
        font-size: 18px;
    }
    .nav-menu {
        display: none;
    }
    .nav-menu.mobile-open {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;
        background: var(--bg-primary, #fff);
        box-shadow: 0 4px 6px rgba(0,0,0,0.1);
        padding: 12px;
        z-index: 1000;
    }
    .mobile-menu-toggle {
        display: block;
    }
    .dashboard-grid {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .stat-card {
        padding: 12px 8px;
    }
    .quick-actions .actions-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .deals-container {
        flex-direction: column;
        height: auto;
    }
    .deals-sidebar {
        width: 100%;
        max-height: none;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    .deal-details {
        width: 100%;
        padding: 12px;
    }
    .deals-container.mobile-deal-open .deals-sidebar {
        display: none;
    }
    .deals-container.mobile-deal-open .deal-details {
        display: block;
    }
    #deal-back-btn {
        display: inline-flex;
        margin-right: 8px;
    }
    .deals-filters {
        position: static;
        width: 100%;
        padding: 12px;
    }
    .profile-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    .profile-avatar {
        align-self: center;
    }
    .profile-tab {
        display: inline-block;
        padding: 8px 12px;
    }
    .wallet-overview {
        flex-direction: column;
        gap: 12px;
    }
    .balance-cards {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .balance-card {
        padding: 12px;
    }
    .wallet-actions {
        display: flex;
        gap: 8px;
        justify-content: space-between;
    }
    .wallet-actions .btn {
        flex: 1;
    }
    .ledger-table .table-container {
        overflow-x: auto;
    }
    .ledger-table table {
        min-width: 600px;
    }
    
    
    
    .filter-tabs {
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    .disputes-filters {
        flex-direction: column;
        gap: 12px;
    }
    .filter-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
    }
    .search-box {
        width: 100%;
    }
    .security-tabs {
        overflow-x: auto;
        white-space: nowrap;
    }
    .security-tab {
        display: inline-block;
        padding: 8px 12px;
    }
    .sessions-list .session-card {
        flex-direction: column;
        align-items: flex-start;
    }
    .session-actions {
        margin-top: 12px;
        width: 100%;
    }
    .session-actions .btn {
        width: 100%;
    }
    .admin-panel .admin-tabs {
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 4px;
    }
    .admin-tab {
        display: inline-block;
    }
    .admin-content .table-container {
        overflow-x: auto;
    }
    .admin-content table {
        min-width: 700px;
    }
    .admin-search {
        flex-direction: column;
        gap: 8px;
    }
    .admin-search input,
    .admin-search select,
    .admin-search .btn {
        width: 100%;
    }
    .modal {
        width: 95%;
        max-width: 500px;
        margin: 20px auto;
        max-height: 90vh;
        overflow-y: auto;
    }
    .modal-body {
        padding: 12px;
    }
    .modal-footer {
        flex-direction: column;
        gap: 8px;
    }
    .modal-footer .btn {
        width: 100%;
        margin: 0;
    }
    .form-group {
        margin-bottom: 12px;
    }
    .input,
    .select,
    .textarea {
        font-size: 16px;
    }
    .btn {
        padding: 10px 16px;
        font-size: 14px;
    }
    .empty-state {
        padding: 24px 16px;
    }
    .skeleton-card,
    .skeleton-list {
        width: 100%;
    }
}

@media (max-width: 480px) {
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }
    .btn { padding: 8px 12px; font-size: 0.75rem; }
    .balance-value { font-size: 22px; }
    .stat-value { font-size: 22px; }
    .logo-text { display: none; }
    .status-step { width: calc(50% - var(--space-md)); }
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .quick-actions .actions-grid {
        grid-template-columns: 1fr;
    }
    .balance-cards {
        grid-template-columns: 1fr;
    }
    .deal-item-right {
        flex-direction: column;
        align-items: flex-end;
        gap: 4px;
    }
    .message {
        max-width: 90%;
    }
}

/* ===== UTILITIES ===== */
.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-hover); border-radius: 3px; }
::-webkit-scrollbar-thumb { background: var(--border-dark); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Payment method cards */
.payment-methods-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin: 12px 0;
}
.payment-method-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 8px;
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}
.payment-method-card.active {
    border-color: var(--primary);
    background: rgba(var(--primary-rgb), 0.05);
}
.payment-icon {
    font-size: 32px;
    margin-bottom: 8px;
}
.payment-title {
    font-weight: 600;
    margin-bottom: 4px;
}
.payment-desc {
    font-size: 12px;
    color: var(--text-muted);
}

/* Исправление фильтров уведомлений */


.filter-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-bottom: 4px;
    min-width: max-content;
}
.filter-tab {
    padding: 8px 16px;
    background: var(--bg-secondary, #f1f5f9);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary, #475569);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}
.filter-tab:hover {
    background: var(--bg-hover);
    border-color: var(--primary, #4f46e5);
    color: var(--primary, #4f46e5);
}
.filter-tab.active {
    background: var(--primary, #4f46e5);
    border-color: var(--primary, #4f46e5);
    color: white;
}
body.theme-dark .filter-tab {
    background: var(--bg-secondary, #1e293b);
    border-color: var(--border, #334155);
    color: var(--text-secondary, #cbd5e1);
}
body.theme-dark .filter-tab:hover {
    background: var(--bg-primary, #0f172a);
    border-color: var(--primary, #818cf8);
    color: var(--primary, #818cf8);
}
body.theme-dark .filter-tab.active {
    background: var(--primary, #818cf8);
    border-color: var(--primary, #818cf8);
    color: #0f172a;
}
.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 30px;
    padding: 4px 4px 4px 16px;
    transition: border 0.2s, box-shadow 0.2s;
    width: 100%;
    max-width: 360px;
}
.search-box:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light);
}
.search-box .input {
    flex: 1;
    background: transparent !important;
    border: none !important;
    padding: 8px 0 !important;
    font-size: 14px;
    color: var(--text);
    outline: none;
    min-width: 0;
    box-shadow: none !important;
}
.search-box .input::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}
.search-box .btn.icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s, transform 0.2s;
    border: none;
}
.search-box .btn.icon:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}
.search-box .btn.icon svg {
    width: 18px;
    height: 18px;
    stroke: white;
    stroke-width: 2;
}

/* ===== ПРЕДОТВРАЩЕНИЕ ВЫЛЕЗАНИЯ ТЕКСТА ===== */
* {
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.modal,
.card,
.chat-item,
.deal-list-item,
.filter-tab,
.btn {
    word-break: break-word;
}
.chat-item-preview,
.deal-item-title,
.modal-title{
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}
@media (max-width: 768px) {
    .chat-item-preview,
    .deal-item-title {
        white-space: normal;
        word-break: break-word;
    }
}
.filter-tab {
    max-width: 180px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}
@media (max-width: 480px) {
    .filter-tab {
        max-width: 120px;
        padding: 6px 10px;
        font-size: 12px;
    }
}

/* ===== УЛУЧШЕННЫЙ АВАТАР В ПРОФИЛЕ (КАК В ВК) ===== */
.avatar.large {
    width: 180px;
    height: 180px;
    font-size: 4rem;
    border: 3px solid var(--primary);
    box-shadow: var(--shadow-lg);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}
.avatar.large:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-xl);
}
.avatar-view-modal {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background: transparent;
}
.avatar-view-modal img {
    max-width: 90vw;
    max-height: 80vh;
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    object-fit: contain;
    border: 2px solid var(--border-dark);
}
.modal-body .avatar-view-modal img {
    border-radius: 16px !important;
    width: auto !important;
    height: auto !important;
}
.fullscreen-image-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(8px);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}
.fullscreen-image {
    max-width: 95vw;
    max-height: 95vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    cursor: zoom-out;
    transition: transform 0.2s;
}
.fullscreen-image-close {
    position: absolute;
    top: 20px;
    right: 30px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 100001;
    padding: 0;
    line-height: 1;
}
.fullscreen-image-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.fullscreen-image-overlay img {
    border-radius: 8px !important;
    width: auto !important;
    height: auto !important;
    max-width: 95vw !important;
    max-height: 95vh !important;
}

/* ===== ФИРМЕННЫЙ АВАТАР С ЗАГЛУШКОЙ ===== */
.avatar.large {
    width: 180px;
    height: 180px;
    font-size: 4rem;
    font-weight: 600;
    border: 3px solid var(--primary);
    box-shadow: var(--shadow-lg);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    position: relative;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    background: var(--primary-grad);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}
.avatar.large:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-xl);
}
.avatar.large::after {
    content: "📷";
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: var(--primary);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    border: 3px solid var(--bg-card);
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
    box-shadow: var(--shadow-md);
}
.avatar.large:hover::after {
    opacity: 1;
}

/* ===== СТЕНА (ПОСТЫ) В ПРОФИЛЕ ===== */
.posts-tab {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}
.post-form {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
}
.post-form .textarea {
    min-height: 100px;
    margin-bottom: var(--space-md);
    resize: vertical;
}
.post-form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
}
.post-form-actions .btn {
    gap: 6px;
}
.post-image-preview {
    position: relative;
    margin-top: var(--space-md);
    border-radius: var(--radius);
    overflow: hidden;
    max-width: 300px;
}
.post-image-preview img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
.post-image-preview .btn.icon {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    color: white;
    border-radius: 50%;
}
.posts-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}
.post-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    transition: all var(--transition-fast);
}
.post-card:hover {
    border-color: var(--border-dark);
    box-shadow: var(--shadow-md);
}
.post-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}
.post-author {
    font-weight: 600;
    color: var(--text);
}
.post-time {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--text-muted);
}
.post-content {
    margin-bottom: var(--space-md);
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.6;
    color: var(--text);
}
.post-image {
    max-width: 100%;
    max-height: 500px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: opacity 0.2s;
}
.post-image:hover {
    opacity: 0.9;
}
.delete-post-btn {
    margin-left: auto;
    color: var(--danger) !important;
}
.delete-post-btn:hover {
    background: var(--danger-light) !important;
}
#load-more-posts {
    margin-top: var(--space-md);
}
.empty-state {
    text-align: center;
    padding: var(--space-xl);
    color: var(--text-muted);
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px dashed var(--border);
}

/* ===== СОВРЕМЕННЫЙ ПРОФИЛЬ И СТЕНА (чистый, без эмодзи) ===== */
/* ===== PROFILE CONTENT: one responsive structure, existing application shell ===== */
.profile-page.profile-redesign,
.profile-publication-composer {
    --profile-surface: var(--bg-secondary);
    --profile-card: var(--bg-card);
    --profile-canvas: var(--bg);
    --profile-field: var(--bg-tertiary);
    --profile-accent: var(--primary);
    --profile-action: var(--primary-grad);
    --profile-accent-soft: var(--primary-light);
    --profile-line: var(--border);
    --profile-radius: 14px;
}
.profile-page.profile-redesign {
    width: 100%;
    max-width: none;
    min-width: 0;
    margin: 0;
    padding: 0 0 32px;
    color: var(--text);
}
/* The reference palette belongs to the dark profile, not the application.
   System/night/glass/light continue to resolve their existing theme tokens. */
body.theme-dark:not(.theme-system) :is(.profile-page.profile-redesign, .profile-publication-composer) {
    --profile-surface: #141418;
    --profile-card: #1c1c22;
    --profile-canvas: #0b0b0e;
    --profile-field: #141418;
    --profile-line: #34343c;
    --profile-accent: var(--primary);
    --profile-action: var(--primary-grad);
    --profile-accent-soft: var(--primary-light);
}
/* Profile publication reuses the chat attachment surface, not chat transport.
   Only profile-specific controls and the local palette are adapted here. */
.chat-attachment-compose-overlay.profile-publication-composer {
    /* Keep the shared media-only viewer (14020) above its profile composer. */
    z-index: 14010;
}
.profile-publication-composer .profile-publication-composer-panel {
    box-sizing: border-box;
    width: min(620px, 100%);
    max-height: calc(100dvh - 24px);
    min-width: 0;
    padding: 0;
    color: var(--text);
    background: var(--profile-card);
    border: 1px solid var(--profile-line);
}
/* Profile edit titles are longer than chat's file-count title; keep them readable on mobile. */
.profile-publication-composer-head.chat-attachment-compose-head :is(h2,h3) { margin: 0; font-size: 18px; line-height: 1.35; text-align: start; white-space: normal; overflow-wrap: anywhere; }
.profile-publication-composer-body { overflow: auto; overscroll-behavior: contain; min-height: 0; }
.profile-publication-composer .profile-publication-composer-files { margin: 0; list-style: none; scrollbar-width: thin; }
.profile-publication-composer .profile-publication-composer-files::-webkit-scrollbar { display: block; height: 4px; }
.profile-publication-composer .chat-attachment-compose-thumb.focused .chat-attachment-compose-thumb-main { border-color: var(--profile-accent); }
.profile-publication-composer-selection { display: flex; align-items: center; gap: 4px; padding: 0 16px 8px; min-width: 0; }
.profile-publication-composer-selection > :is(span,div,strong) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--text-secondary); }
.profile-publication-composer-selection button { display: grid; place-items: center; flex: 0 0 44px; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--text); cursor: pointer; }
.profile-publication-composer-selection svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.profile-publication-composer .profile-publication-composer-stage {
    grid-template: minmax(0, 1fr) / minmax(0, 1fr);
    min-height: 180px;
    height: clamp(180px, 38dvh, 380px);
    max-height: none;
    background: var(--profile-canvas);
}
.profile-publication-composer .profile-publication-composer-stage :is(img,video) { width: 100%; height: 100%; min-width: 0; min-height: 0; max-height: 100%; object-fit: contain; }
.profile-publication-composer-empty { max-width: calc(100% - 40px); min-height: 48px; padding: 12px 18px; border: 1px solid var(--profile-line); border-radius: 14px; background: var(--profile-field); color: var(--text); font: 600 14px/1.4 var(--font-sans); cursor: pointer; }
.profile-publication-composer-help { margin: 6px 16px 0; color: var(--text-secondary); font-size: 12px; line-height: 1.45; }
.profile-publication-composer-options { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; padding: 10px 16px 0; font-size: 13px; }
.profile-publication-composer-options > label { flex: 1 1 160px; color: var(--text-secondary); }
.profile-publication-composer-visibility { min-height: 40px; max-width: 100%; padding: 6px 10px; font: inherit; color: var(--text); background: var(--profile-field); border: 1px solid var(--profile-line); border-radius: 12px; }
.profile-publication-composer-options :is(details,.profile-publication-composer-album) { flex-basis: 100%; margin: 0; color: var(--text-secondary); }
.profile-publication-composer-options summary { cursor: pointer; padding-block: 6px; }
.profile-publication-composer .profile-publication-composer-actions { background: var(--profile-field); margin-top: 10px; }
.profile-publication-composer .profile-publication-composer-caption { box-sizing: border-box; min-height: 40px; resize: none; }
.profile-publication-composer-caption-count { display: block; text-align: end; color: var(--text-secondary); font-size: 11px; }
.profile-publication-composer .chat-attachment-compose-send { background: var(--profile-action); box-shadow: none; }
.profile-publication-composer-feedback { flex: 0 1 auto; overflow: auto; padding: 6px 16px max(12px, env(safe-area-inset-bottom)); font-size: 13px; }
.profile-publication-composer .btn { min-height: 44px; cursor: pointer; }
.profile-publication-composer [hidden] { display: none; }
.profile-publication-composer .btn.primary { background: var(--profile-action); color: #fff; }
.profile-publication-composer button:disabled { opacity: .4; cursor: not-allowed; }
.profile-publication-composer :is(button,textarea,select):focus-visible { outline: 2px solid var(--profile-accent); outline-offset: 3px; }
.profile-publication-composer-errors { color: var(--danger); padding-inline-start: 20px; font-size: 13px; }
.profile-publication-composer-status { margin: 4px 0; line-height: 1.5; overflow-wrap: anywhere; }
.profile-publication-composer-status:empty { display: none; }
.profile-publication-composer-progress { width: 100%; height: 8px; accent-color: var(--profile-accent); }
.profile-publication-composer-key { display: block; overflow-wrap: anywhere; font-size: 11px; color: var(--text-secondary); }
.profile-publication-composer-confirm { padding: 16px 18px; border-top: 1px solid var(--profile-line); background: var(--profile-surface); }
.profile-publication-composer-confirm .btn { margin: 6px 6px 0 0; }
@media (max-width: 600px) {
    .profile-publication-composer .profile-publication-composer-panel { max-height: calc(100dvh - 16px - env(safe-area-inset-top)); }
    .profile-publication-composer .profile-publication-composer-stage { height: clamp(180px, 34dvh, 320px); }
}
.profile-page.profile-redesign .profile-hero,
.profile-page.profile-redesign .profile-local-navigation,
.profile-page.profile-redesign .profile-photo-strip,
.profile-page.profile-redesign .profile-status-card {
    background: linear-gradient(145deg, var(--profile-surface), var(--profile-canvas));
    border: 1px solid var(--profile-line);
    border-radius: var(--profile-radius);
    box-shadow: none;
}
.profile-page.profile-redesign .profile-hero { position: relative; }
.profile-page.profile-redesign .profile-cover {
    position: relative;
    height: clamp(150px, 15vw, 200px);
    min-height: 0;
    margin: 0;
    border-radius: 13px 13px 10px 10px;
    background-color: var(--bg-tertiary);
    background-position: center;
    background-size: cover;
    overflow: visible;
}
.profile-page.profile-redesign .profile-cover::before,
.profile-page.profile-redesign .profile-cover::after { content: none; }
/* The unscoped .profile-avatar-wrapper is shared with the feed story rail and
   has important dimensions in the legacy sheet. Override only this instance. */
.profile-page.profile-redesign .profile-cover > .profile-avatar-wrapper {
    position: absolute !important;
    display: block !important;
    width: 148px !important;
    height: 148px !important;
    inset-inline-start: 24px;
    inset-inline-end: auto;
    top: auto;
    bottom: -82px;
    margin: 0;
    z-index: 2;
}
.profile-page.profile-redesign #profile-avatar-large {
    display: grid;
    place-items: center;
    width: 148px;
    height: 148px;
    min-width: 0;
    max-width: none;
    margin: 0;
    padding: 0;
    border: 4px solid var(--profile-accent);
    border-radius: 50%;
    background-color: var(--bg-tertiary);
    background-size: cover;
    background-position: center;
    color: var(--text);
    font-size: 44px;
    font-weight: 700;
    line-height: 1;
    box-shadow: 0 0 0 4px var(--profile-surface);
    cursor: pointer;
}
.profile-page.profile-redesign .cover-upload-btn {
    position: absolute;
    inset-inline-end: 14px;
    bottom: 12px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 8px 12px;
    border: 1px solid rgba(255,255,255,.22);
    border-radius: 10px;
    background: rgba(10,14,26,.86);
    color: #fff;
    font: 500 12px/1.3 var(--font-sans);
    cursor: pointer;
}
/* Avatar actions (owner 2026-10-18: the add-story «+» looked crooked): one size,
   each centred on the avatar circle at 45° — 14.64% of the square wrapper from
   its two nearest edges; «+» at the start, the pencil at the end. */
.profile-page.profile-redesign .profile-avatar-wrapper { --profile-avatar-badge: 36px; }
.profile-page.profile-redesign #change-avatar-btn {
    position: absolute;
    inset-inline-end: calc(14.64% - var(--profile-avatar-badge) / 2);
    inset-inline-start: auto;
    bottom: calc(14.64% - var(--profile-avatar-badge) / 2);
    width: var(--profile-avatar-badge);
    min-width: 0;
    height: var(--profile-avatar-badge);
    min-height: 0;
    max-height: none;
    margin: 0;
    padding: 0;
    display: grid;
    place-items: center;
    background: var(--bg-tertiary);
    color: var(--text);
    border: 2px solid var(--profile-surface);
    border-radius: 50%;
    z-index: 6;
    cursor: pointer;
}
.profile-page.profile-redesign #change-avatar-btn svg { width: 18px; height: 18px; }
.profile-page.profile-redesign .profile-info-new {
    position: relative;
    margin: 0;
    margin-inline-start: 194px;
    padding: 16px 22px 8px 0;
    padding-inline-start: 0;
    padding-inline-end: 22px;
    min-height: 140px;
    text-align: start;
}
.profile-page.profile-redesign .profile-topline-new {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin: 0;
}
.profile-page.profile-redesign .profile-identity-block { flex: 1 1 220px; min-width: 0; }
.profile-page.profile-redesign .profile-name-presence-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.profile-page.profile-redesign .profile-name-new { color: var(--text); background: none; -webkit-text-fill-color: currentColor; margin: 0; font-size: clamp(23px, 2vw, 28px); font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.profile-page.profile-redesign .profile-handle-new { margin: 3px 0 0; font-size: 14px; line-height: 1.4; color: var(--profile-accent); overflow-wrap: anywhere; }
.profile-page.profile-redesign .profile-presence-new {
    display: inline-flex;
    flex: 0 1 auto;
    align-items: center;
    gap: 6px;
    min-height: 24px;
    margin: 0;
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 11px;
    line-height: 1.25;
    color: var(--text-muted);
    background: var(--bg-hover);
}
.profile-page.profile-redesign .profile-presence-new.online { color: var(--success); background: transparent; padding: 0; min-height: 12px; min-width: 12px; }
.profile-page.profile-redesign .profile-presence-new.online > .profile-presence-dot { width: 9px; height: 9px; flex-basis: 9px; animation: profile-presence-breathe 2.4s ease-in-out infinite; }
@keyframes profile-presence-breathe { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .profile-page.profile-redesign .profile-presence-new.online > .profile-presence-dot { animation: none; } }
.profile-page.profile-redesign .profile-presence-new > span { width: 7px; height: 7px; flex: 0 0 7px; background: currentColor; border-radius: 50%; }
.profile-page.profile-redesign .profile-bio-brief { margin: 12px 0 0; font-size: 14px; line-height: 1.5; color: var(--text-secondary); overflow-wrap: anywhere; }
.profile-page.profile-redesign .profile-location { display: flex; align-items: center; gap: 6px; margin-top: 8px; color: var(--text-secondary); font-size: 13px; overflow-wrap: anywhere; }
.profile-page.profile-redesign .profile-location svg { flex-shrink: 0; }
/* Owner 2026-10-19: the «О себе» card is gone. The site sits under the status
   line (an empty row stays hidden by the [data-profile-website-row][hidden]
   rule). The card's «Email/Телефон подтверждён» badges never rendered: the
   profile payload has no such fields, so they are not moved. */
.profile-page.profile-redesign .profile-website { display: flex; align-items: center; gap: 6px; margin-top: 8px; min-width: 0; color: var(--text-secondary); font-size: 13px; overflow-wrap: anywhere; }
.profile-page.profile-redesign .profile-website svg { flex-shrink: 0; color: var(--profile-accent); }
/* The «who viewed» eye is a square button of the same height next to «Редактировать профиль». */
.profile-page.profile-redesign .profile-owner-actions > .profile-viewers-eye-btn { width: 44px; height: 44px; margin: 0; border-radius: 11px; border: 1px solid color-mix(in srgb, var(--profile-accent) 45%, var(--border)); background: var(--profile-accent-soft); }
.profile-page.profile-redesign .profile-owner-actions > .btn.profile-edit-icon { display: grid; place-items: center; flex: 0 0 44px; width: 44px; height: 44px; min-width: 44px; padding: 0; border-radius: 12px; }
.profile-page.profile-redesign .profile-owner-actions > .btn.profile-edit-icon svg { width: 21px; height: 21px; }

.profile-page.profile-redesign .profile-actions-new,
.profile-page.profile-redesign .profile-owner-actions { display: flex; flex: 0 1 auto; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin: 2px 0 0; width: auto; min-width: 0; }
.profile-page.profile-redesign .profile-actions-new > .btn,
.profile-page.profile-redesign .profile-owner-actions > .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 1 auto;
    gap: 7px;
    min-height: 44px;
    min-width: 44px;
    max-width: 100%;
    padding: 9px 14px;
    margin: 0;
    width: auto;
    border: 1px solid color-mix(in srgb, var(--profile-accent) 45%, var(--border));
    border-radius: 11px;
    color: var(--text);
    background: var(--profile-accent-soft);
    box-shadow: none;
    font: 600 13px/1.35 var(--font-sans);
    white-space: normal;
    text-align: center;
}
.profile-page.profile-redesign #message-user-btn { background: var(--profile-action); color: #fff; }
.profile-page.profile-redesign .profile-actions-new .profile-more-btn { padding: 9px; flex: 0 0 44px; }
.profile-page.profile-redesign .profile-more-btn svg { transform: rotate(90deg); }
.profile-page.profile-redesign .profile-metrics { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0; padding: 12px 18px 14px; }
.profile-page.profile-redesign .profile-metric { display: flex; flex-direction: column; align-items: center; text-align: center; justify-content: center; gap: 3px; min-width: 0; min-height: 50px; padding: 4px 6px; margin: 0; border: 0; background: transparent; color: var(--text); font-family: var(--font-sans); }
.profile-page.profile-redesign button.profile-metric { cursor: pointer; border-radius: 6px; }
.profile-page.profile-redesign .profile-metric + .profile-metric { border-inline-start: 1px solid var(--border); }
.profile-page.profile-redesign .profile-metric strong { font-size: 16px; line-height: 1.3; font-weight: 650; overflow-wrap: anywhere; }
.profile-page.profile-redesign .profile-metric span { color: var(--text-secondary); font-size: 12px; line-height: 1.3; text-align: center; overflow-wrap: anywhere; }
/* One native horizontal row; follower actions retain their page semantics. */
.profile-page.profile-redesign .profile-local-navigation {
    display: flex; align-items: center; gap: 4px; position: relative; min-width: 0;
    padding: 4px; margin-block: 6px 14px; border-radius: 16px; border: 1px solid var(--profile-native-line, var(--border));
    background: var(--profile-native-card, var(--bg-card)); overflow: visible;
}
.profile-page.profile-redesign .profile-navigation-scroll {
    display: flex; flex: 1 1 auto; align-items: center; gap: 4px; min-width: 0;
    overflow-x: auto; overscroll-behavior-inline: contain; scrollbar-width: none; padding: 3px;
}
.profile-page.profile-redesign .profile-navigation-scroll::-webkit-scrollbar { display: none; }
.profile-page.profile-redesign .profile-local-navigation :is(.profile-tabs, .profile-social-actions) {
    display: flex; flex: 0 0 auto; align-items: center; width: auto; min-width: 0; gap: 4px;
    position: static; padding: 0; margin: 0; border: 0; background: none; box-shadow: none; overflow: visible;
}
.profile-page.profile-redesign .profile-local-navigation :is(.profile-tab-new, .profile-social-action) {
    position: relative; display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; gap: 7px;
    min-width: 0; min-height: 46px; padding: 10px 13px; border: 0; border-radius: 11px;
    background: transparent; color: var(--text-secondary); font: 600 13px/1.3 var(--font-sans);
    white-space: nowrap; text-overflow: clip; text-decoration: none; overflow: visible; cursor: pointer;
    transition: color .16s ease, background .16s ease;
}
.profile-page.profile-redesign .profile-local-navigation :is(.profile-tab-new, .profile-social-action) svg { width: 18px; height: 18px; flex: 0 0 18px; }
.profile-page.profile-redesign .profile-local-navigation .profile-social-action strong { font-size: 12px; color: var(--text); font-variant-numeric: tabular-nums; }
.profile-page.profile-redesign .profile-local-navigation :is(.profile-tab-new, .profile-social-action):hover { color: var(--text); background: var(--bg-hover); }
.profile-page.profile-redesign .profile-local-navigation .profile-tab-new.active {
    box-shadow: none; color: var(--text); background: color-mix(in srgb, var(--profile-accent) 13%, var(--profile-card));
}
.profile-page.profile-redesign .profile-local-navigation .profile-tab-new.active::after {
    content: ""; position: absolute; inset-inline: 14px; bottom: 2px; height: 0;
    border-bottom: 3px solid var(--profile-accent); border-radius: 999px;
}
.profile-page.profile-redesign .profile-local-navigation :is(.profile-tab-new, .profile-social-action):focus-visible { outline: 2px solid var(--profile-accent); outline-offset: -2px; }
.profile-page.profile-redesign .profile-content { width: 100%; max-width: none; min-width: 0; margin: 0; padding: 0; }
.profile-page.profile-redesign .profile-content > .tab-content { margin: 0; padding: 0; }
.profile-page.profile-redesign .profile-content > .tab-content[hidden] { display: none; }
.profile-page.profile-redesign .profile-overview-stack { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: 'main'; align-items: start; gap: 14px 16px; margin: 0; }
.profile-page.profile-redesign .profile-main-column { grid-area: main; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.profile-page.profile-redesign .profile-photo-strip { grid-area: photos; min-width: 0; padding: 14px; }
.profile-page.profile-redesign .profile-photo-strip[hidden] { display: none; }
.profile-page.profile-redesign .profile-strip-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.profile-page.profile-redesign .profile-strip-heading h2 { margin: 0; font-size: 16px; line-height: 1.35; font-weight: 650; }
.profile-page.profile-redesign .profile-strip-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.profile-page.profile-redesign .profile-strip-add-action { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-tertiary); color: var(--text); cursor: pointer; }
.profile-page.profile-redesign .profile-all-photos { font-size: 12px !important; display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 4px; border: 0; background: transparent; color: var(--text-secondary); font: 500 12px/1.3 var(--font-sans); cursor: pointer; }
.profile-page.profile-redesign .profile-all-photos svg { color: var(--primary); }
.profile-page.profile-redesign .profile-strip-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; min-width: 0; }
.profile-page.profile-redesign .profile-strip-tile,
.profile-page.profile-redesign .profile-strip-add { position: relative; width: 100%; min-width: 0; aspect-ratio: 1; min-height: 0; padding: 0; margin: 0; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; background: var(--bg-tertiary); cursor: pointer; }
.profile-page.profile-redesign .profile-strip-tile img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.profile-page.profile-redesign .profile-strip-add { font-size: 12px !important; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 7px; padding: 8px; font: 500 12px/1.35 var(--font-sans); color: var(--text-secondary); }
.profile-page.profile-redesign .profile-strip-add > svg { color: var(--primary); flex-shrink: 0; }
.profile-page.profile-redesign .profile-strip-tiles.is-empty { display: block; }
.profile-page.profile-redesign .profile-strip-tiles.is-empty .profile-strip-add { flex-direction: row; aspect-ratio: auto; min-height: 58px; width: 100%; }
.profile-page.profile-redesign .profile-strip-error { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; color: var(--text-secondary); font-size: 14px; }
.profile-page.profile-redesign .profile-inline-wall-host { grid-area: wall; min-width: 0; width: 100%; max-width: none; margin: 0; }
.profile-page.profile-redesign .profile-wall-block { display: grid; gap: 14px; padding: 0; margin: 0; border: 0; background: none; box-shadow: none; min-width: 0; max-width: 100%; width: 100%; }
.profile-page.profile-redesign .profile-wall-list { display: grid; gap: 14px; min-width: 0; }
.profile-page.profile-redesign .profile-wall-head { display: none; }
.profile-page.profile-redesign .feed-composer,
.profile-page.profile-redesign .feed-post,
.profile-page.profile-redesign .feed-empty { margin: 0; padding: 14px; border: 1px solid var(--border); border-radius: var(--profile-radius); background: linear-gradient(145deg, var(--profile-surface), var(--bg)); box-shadow: none; min-width: 0; }
.profile-page.profile-redesign .feed-composer-row { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 10px; align-items: start; }
.profile-page.profile-redesign .feed-composer-avatar .feed-avatar { width: 36px; height: 36px; }
/* The shared bubble colour is important in legacy feed CSS; isolate this override. */
.profile-page.profile-redesign .feed-composer-bubble { width: auto; min-height: 0; padding: 10px 12px; border-radius: 11px; border: 1px solid var(--border-light); background: var(--bg-tertiary) !important; box-shadow: none; }
.profile-page.profile-redesign .feed-composer-bubble::before,
.profile-page.profile-redesign .feed-composer-bubble::after { content: none; }
.profile-page.profile-redesign .feed-composer-title { display: none; }
.profile-page.profile-redesign .feed-composer-input { display: block; width: 100%; min-width: 0; min-height: 44px; height: 44px; max-height: 240px; padding: 4px 0; margin: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; resize: none; color: var(--text); font: 400 16px/1.5 var(--font-sans); }
.profile-page.profile-redesign .feed-composer-actions { display: flex; flex-wrap: nowrap; justify-content: space-between; align-items: center; gap: 8px; margin: 3px 0 0; padding: 0; }
.profile-page.profile-redesign .feed-composer-tools { display: flex; align-items: center; flex: 0 0 auto; gap: 0; min-width: 0; }
.profile-page.profile-redesign .feed-composer-tools .feed-attach-btn { display: grid; place-items: center; width: 44px; min-width: 44px; height: 44px; padding: 0; border: 0; border-radius: 10px; background: transparent; color: var(--text-secondary); box-shadow: none; }
.profile-page.profile-redesign .feed-composer-tools .feed-attach-btn span { display: none; }
.profile-page.profile-redesign .feed-composer-tools .feed-attach-btn svg { width: 21px; height: 21px; }
.profile-page.profile-redesign .feed-composer-tools .feed-attach-btn:hover { color: var(--profile-accent); background: var(--bg-hover); }
.profile-page.profile-redesign .feed-composer-bubble:focus-within { border-color: var(--profile-accent); }
.profile-page.profile-redesign #feed-attach-btn { min-height: 44px; padding: 7px 10px; border: 0; background: transparent; color: var(--text-secondary); font-size: 13px; box-shadow: none; }
.profile-page.profile-redesign #feed-publish-btn { flex: 0 1 auto; min-width: 0; min-height: 44px; padding: 9px 13px; border-radius: 11px; background: var(--primary-grad); color: #fff; border: 1px solid var(--primary); font-size: 13px; white-space: normal; overflow-wrap: anywhere; box-shadow: none; }
.profile-page.profile-redesign .feed-post-head { margin-bottom: 10px; gap: 8px; }
.profile-page.profile-redesign .feed-post-head .feed-avatar { width: 40px; height: 40px; }
.profile-page.profile-redesign .feed-author { min-width: 0; }
.profile-page.profile-redesign .feed-author b { font-size: 13px; overflow-wrap: anywhere; }
.profile-page.profile-redesign .feed-author small { color: var(--text-muted); font-size: 11px; }
.profile-page.profile-redesign .feed-post-text { font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.profile-page.profile-redesign .feed-media-grid { margin-top: 12px; border-radius: 10px; overflow: hidden; }
.profile-page.profile-redesign .feed-media-grid.count-1 .feed-media-item { width: 100%; border: 0; border-radius: 10px; }
.profile-page.profile-redesign .feed-media-grid.count-1 img { display: block; width: 100%; max-height: 460px; object-fit: cover; }
.profile-page.profile-redesign .feed-actions { display: flex; align-items: center; gap: 12px; margin-top: 8px; padding: 0; }
.profile-page.profile-redesign .feed-action { border: 0; background: transparent; color: var(--text-secondary); min-height: 44px; min-width: 44px; padding: 6px 8px; }
.profile-page.profile-redesign .feed-action.active { color: var(--danger); }
.profile-page.profile-redesign .profile-loading-note,
.profile-page.profile-redesign .profile-status-card { padding: 22px; color: var(--text-secondary); font-size: 14px; }
.profile-page.profile-redesign .profile-status-card { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 120px; }
.profile-page.profile-redesign button:focus-visible,
.profile-page.profile-redesign a:focus-visible,
.profile-page.profile-redesign summary:focus-visible { outline: 2px solid var(--profile-accent); outline-offset: 3px; }
.profile-page.profile-redesign button:hover:not(:disabled) { filter: brightness(1.08); }
.profile-page.profile-redesign .profile-photos-grid { min-width: 0; }
.profile-page.profile-redesign .profile-photo-album-cover img { width: 100%; height: 100%; object-fit: cover; }
.profile-page.profile-redesign .profile-photo-tile.profile-media-missing::after { content: '—'; color: var(--text-muted); display: grid; position: absolute; inset: 0; place-items: center; }
/* Profile publications keep one parent card and one active slide. */
.profile-page.profile-redesign .profile-publication-carousel { position: relative; min-width: 0; width: 100%; background: var(--profile-canvas); touch-action: pan-y pinch-zoom; }
.profile-page.profile-redesign .profile-publication-stage { display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); place-items: center; width: 100%; aspect-ratio: 4 / 5; max-height: min(78dvh, 760px); min-width: 0; min-height: 0; overflow: hidden; }
.profile-page.profile-redesign .profile-publication-stage > button { display: block; box-sizing: border-box; width: 100%; height: 100%; min-height: 0; padding: 0; border: 0; border-radius: 0; background: transparent; cursor: pointer; }
.profile-page.profile-redesign .profile-publication-stage :is(img,video) { display: block; width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.profile-page.profile-redesign :is(.profile-publication-nav,.profile-publication-expand) { position: absolute; z-index: 2; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 1px solid rgba(255,255,255,.32); border-radius: 50%; color: #fff; background: rgba(11,11,14,.72); cursor: pointer; }
.profile-page.profile-redesign .profile-publication-nav { top: calc(50% - 20px); transform: translateY(-50%); }
.profile-page.profile-redesign .profile-publication-nav.is-prev { left: 10px; }
.profile-page.profile-redesign .profile-publication-nav.is-next { right: 10px; }
.profile-page.profile-redesign .profile-publication-nav:disabled { opacity: .35; cursor: default; }
.profile-page.profile-redesign .profile-publication-expand { right: 10px; bottom: 88px; }
.profile-page.profile-redesign .profile-publication-counter { position: absolute; top: 12px; right: 12px; padding: 5px 9px; border-radius: 999px; background: rgba(11,11,14,.78); color: #fff; font: 600 12px/1.3 var(--font-sans); font-variant-numeric: tabular-nums; }
.profile-page.profile-redesign .profile-publication-tile-counter { position: absolute; top: 7px; inset-inline-end: 7px; padding: 3px 7px; border-radius: 999px; background: rgba(11,11,14,.78); color: #fff; font-size: 11px; font-weight: 600; line-height: 1.4; font-variant-numeric: tabular-nums; pointer-events: none; }
.profile-page.profile-redesign .profile-publication-dots { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; min-height: 32px; padding: 4px 8px; background: var(--profile-card); }
.profile-page.profile-redesign .profile-publication-dots button { display: grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 50%; background: transparent; cursor: pointer; }
.profile-page.profile-redesign .profile-publication-dots button::after { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--text-muted); }
.profile-page.profile-redesign .profile-publication-dots button[aria-current="true"]::after { background: var(--profile-accent); }
.profile-page.profile-redesign :is(.profile-photo-feed-more,.profile-photo-feed-share) { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-width: 44px; min-height: 44px; padding: 6px 8px; border: 0; border-radius: 50%; background: transparent; color: var(--text); cursor: pointer; }
.profile-page.profile-redesign .profile-photo-feed-more { margin-inline-start: auto; flex: 0 0 44px; }
.profile-page.profile-redesign :is(.profile-publication-nav,.profile-publication-expand,.profile-photo-feed-more,.profile-photo-feed-share) svg { width: 22px; height: 22px; }
@media (min-width: 960px) {
    .profile-page.profile-redesign .profile-strip-tile { aspect-ratio: 1; max-height: 300px; }
}
@media (max-width: 1100px) and (min-width: 960px) {
    .profile-page.profile-redesign .profile-info-new { margin-inline-start: 180px; }
    .profile-page.profile-redesign .profile-topline-new { flex-wrap: wrap; }
    .profile-page.profile-redesign .profile-actions-new,
    .profile-page.profile-redesign .profile-owner-actions { justify-content: flex-start; }
}
@media (max-width: 959px) {
    .profile-page.profile-redesign .profile-overview-stack { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; grid-template-areas: 'photos' 'wall'; gap: 10px; }
    .profile-page.profile-redesign .profile-main-column { display: contents; }
    .profile-page.profile-redesign .profile-overview-stack:has(.profile-photo-strip[hidden]) { grid-template-areas: 'wall'; }
    .profile-page.profile-redesign .profile-topline-new { flex-wrap: wrap; }
}
@media (max-width: 600px) {
    .profile-page.profile-redesign { padding: 0 0 max(104px, calc(env(safe-area-inset-bottom) + 86px)); }
    .profile-page.profile-redesign .profile-cover { height: clamp(106px, 31vw, 140px); }
    .profile-page.profile-redesign .profile-cover > .profile-avatar-wrapper { width: 90px !important; height: 90px !important; inset-inline-start: 14px; bottom: -44px; }
    .profile-page.profile-redesign #profile-avatar-large { width: 90px; height: 90px; border-width: 3px; font-size: 28px; box-shadow: 0 0 0 3px var(--profile-surface); }
    .profile-page.profile-redesign .profile-avatar-wrapper { --profile-avatar-badge: 30px; }
    .profile-page.profile-redesign #change-avatar-btn::after { content: ''; position: absolute; inset: -7px; border-radius: 50%; }
    .profile-page.profile-redesign .cover-upload-btn { font-size: 11px !important; bottom: 8px; inset-inline-end: 8px; padding: 8px; min-height: 38px; font-size: 11px; gap: 5px; }
    .profile-page.profile-redesign .cover-upload-btn svg { width: 16px; height: 16px; }
    .profile-page.profile-redesign .profile-info-new { margin: 0; padding: 12px 12px 4px; min-height: 0; }
    .profile-page.profile-redesign .profile-topline-new { display: flex; flex-direction: column; align-items: stretch; gap: 10px; }
    .profile-page.profile-redesign .profile-identity-block { flex: none; }
    .profile-page.profile-redesign .profile-actions-new,
    .profile-page.profile-redesign .profile-owner-actions { order: -1; align-self: stretch; margin: 0; margin-inline-start: 98px; min-height: 44px; justify-content: flex-end; gap: 6px; }
    .profile-page.profile-redesign .profile-actions-new > .btn,
    .profile-page.profile-redesign .profile-owner-actions > .btn { font-size: 11px !important; padding: 8px 9px; gap: 5px; min-height: 44px; min-width: 44px; font-size: 11px; border-radius: 9px; }
    .profile-page.profile-redesign .profile-actions-new > .btn svg,
    .profile-page.profile-redesign .profile-owner-actions > .btn svg { width: 17px; height: 17px; flex-shrink: 0; }
    .profile-page.profile-redesign .profile-actions-new .profile-more-btn { flex-basis: 38px; min-width: 38px; padding: 8px; }
    .profile-page.profile-redesign .profile-name-new { font-size: 22px; }
    .profile-page.profile-redesign .profile-name-presence-row { gap: 8px; }
    .profile-page.profile-redesign .profile-presence-new { font-size: 10px; }
    .profile-page.profile-redesign .profile-handle-new { font-size: 13px; }
    .profile-page.profile-redesign .profile-bio-brief { margin-top: 8px; font-size: 12px; line-height: 1.5; }
    .profile-page.profile-redesign .profile-location { margin-top: 7px; font-size: 12px; }
    .profile-page.profile-redesign .profile-website { margin-top: 7px; font-size: 12px; }
    .profile-page.profile-redesign .profile-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 10px 6px 12px; }
    .profile-page.profile-redesign .profile-metric:nth-child(3n + 1) { border-inline-start: 0; }
    .profile-page.profile-redesign .profile-metric { min-height: 46px; padding: 3px 0; }
    .profile-page.profile-redesign .profile-metric strong { font-size: 15px; }
    .profile-page.profile-redesign .profile-metric span { font-size: 10px; }
    .profile-page.profile-redesign .profile-photo-strip { padding: 10px; }
    .profile-page.profile-redesign .profile-strip-heading { margin-bottom: 6px; }
    .profile-page.profile-redesign .profile-strip-heading h2 { font-size: 14px; }
    .profile-page.profile-redesign .profile-all-photos { font-size: 11px; min-height: 44px; }
    .profile-page.profile-redesign .profile-strip-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
    .profile-page.profile-redesign .profile-strip-tile:nth-child(4) { display: none; }
    .profile-page.profile-redesign .profile-strip-add { gap: 5px; padding: 5px; font-size: 10px; }
    .profile-page.profile-redesign .feed-composer,
    .profile-page.profile-redesign .feed-post { padding: 10px; }
    .profile-page.profile-redesign .feed-composer-input { min-height: 44px; height: 44px; font-size: 16px; }
    .profile-page.profile-redesign .feed-composer-row { grid-template-columns: 30px minmax(0, 1fr); gap: 8px; }
    .profile-page.profile-redesign .feed-composer-avatar .feed-avatar { width: 30px; height: 30px; }
    .profile-page.profile-redesign .feed-composer-bubble { padding: 8px 10px; }
    .profile-page.profile-redesign .feed-composer-actions { margin-top: 6px; }
    .profile-page.profile-redesign #feed-attach-btn { padding: 7px 2px; font-size: 12px; }
    .profile-page.profile-redesign #feed-publish-btn { padding: 8px 12px; font-size: 12px; }
    .profile-page.profile-redesign .feed-post-text { font-size: 13px; }
    .profile-page.profile-redesign .feed-post-head .feed-avatar { width: 34px; height: 34px; }
    .profile-page.profile-redesign .feed-author b { font-size: 12px; }
    .profile-page.profile-redesign .feed-post-head-actions { gap: 2px; }
    .profile-page.profile-redesign .feed-icon-btn { width: 32px; min-width: 32px; height: 36px; }
    .profile-page.profile-redesign .feed-actions { gap: 8px; }
}
@media (prefers-reduced-motion: reduce) {
    .profile-page.profile-redesign *, .profile-page.profile-redesign *::before, .profile-page.profile-redesign *::after { animation: none; transition: none; scroll-behavior: auto; }
}
/* Cover-anchored placement only. The wrapper itself is reused outside the
   cover (feed story rail), where absolute offsets must not apply. The final
   cover values live in the Stage 19Q block below. */
.avatar.huge {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    box-shadow: 0 12px 28px -6px rgba(0, 0, 0, 0.3);
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.2rem;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.avatar.huge:hover {
    transform: scale(1.02);
    box-shadow: 0 18px 32px -8px rgba(0, 0, 0, 0.4);
}
.profile-bio {
    color: var(--text-secondary);
    margin-bottom: 18px;
    font-size: 15px;
    line-height: 1.5;
}
.stat-new {
    display: flex;
    flex-direction: column;
}
.stat-value-new {
    font-size: 22px;
    font-weight: 700;
    color: white;
}
.stat-label-new {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.modern-tabs {
    display: flex;
    gap: 28px;
    padding: 0 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 24px;
}
.glass {
    background: rgba(20, 28, 45, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 24px;
    box-shadow: 0 18px 40px -16px rgba(0, 0, 0, 0.34);
    transition: box-shadow 0.2s;
}
.glass:hover {
    box-shadow: 0 26px 52px -16px rgba(0, 0, 0, 0.44);
}
.posts-feed {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.post-composer {
    padding: 20px;
}
.composer-textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 18px;
    padding: 16px;
    color: white;
    font-size: 16px;
    resize: vertical;
    min-height: 100px;
    margin-bottom: 14px;
    transition: border 0.2s;
}
.composer-textarea:focus {
    outline: none;
    border-color: var(--primary);
}
.composer-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.tool-btn {
    background: rgba(255, 255, 255, 0.04);
    border: none;
    font-size: 22px;
    cursor: pointer;
    padding: 8px 14px;
    border-radius: 40px;
    transition: background 0.2s;
    color: white;
    display: flex;
    align-items: center;
    gap: 6px;
}
.tool-btn:hover {
    background: rgba(99, 102, 241, 0.2);
}
.image-preview {
    margin-top: 14px;
    position: relative;
    display: inline-block;
}
.image-preview img {
    max-width: 200px;
    max-height: 200px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}
.remove-preview {
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.post-card-modern {
    padding: 20px;
}
.post-header-modern {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}
.post-author-info {
    display: flex;
    align-items: center;
    gap: 12px;
}
.post-author-name {
    font-weight: 700;
    color: white;
    font-size: 15px;
}
.post-time {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}
.post-content-modern {
    margin-bottom: 16px;
    line-height: 1.55;
    white-space: pre-wrap;
    font-size: 15px;
}
.post-media img {
    max-width: 100%;
    border-radius: 20px;
    margin-top: 10px;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: opacity 0.2s;
}
.post-media img:hover {
    opacity: 0.85;
}
.post-actions {
    display: flex;
    gap: 24px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}
.action-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 30px;
    transition: background 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}
.action-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}
.icon-btn {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
    color: white;
}
.icon-btn:hover {
    opacity: 1;
}
.load-more {
    margin-top: 16px;
    width: 100%;
    padding: 12px;
    border-radius: 60px;
    font-weight: 500;
}
.empty-feed {
    text-align: center;
    padding: 50px 20px;
    color: var(--text-muted);
    font-size: 16px;
    background: rgba(20, 28, 45, 0.4);
    border-radius: 32px;
    backdrop-filter: blur(8px);
}
.overview-grid.modern-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.info-card {
    padding: 20px;
}
.info-card h3 {
    margin-bottom: 14px;
    font-size: 18px;
    font-weight: 600;
}
.badge-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.badge-new {
    background: rgba(99, 102, 241, 0.12);
    padding: 6px 16px;
    border-radius: 40px;
    font-weight: 500;
    border: 1px solid rgba(99, 102, 241, 0.2);
    font-size: 14px;
}
.reviews-section.modern .rating-summary {
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
}
.review-card {
    padding: 20px;
    margin-bottom: 14px;
}
.modern-settings {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
@media (max-width: 640px) {
    .avatar.huge {
        width: 100px;
        height: 100px;
        font-size: 2.5rem;
    }
    .overview-grid.modern-grid {
        grid-template-columns: 1fr;
    }
    .modern-tabs {
        gap: 20px;
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 4px;
    }
}

/* === Stage 181: attachment composer, media albums and gallery navigation === */
#chat-selection-forward svg {
    display: block;
    transform: translate(-1px, -0.5px);
}

body.chat-attachment-composer-open {
    overflow: hidden !important;
}

.chat-attachment-compose-overlay {
    position: fixed;
    inset: 0;
    z-index: 130500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
    background: rgba(2, 6, 23, .72);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.chat-attachment-compose-modal {
    width: min(620px, calc(100vw - 32px));
    max-height: min(820px, calc(100dvh - 32px));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    color: #f8fafc;
    border: 1px solid rgba(148, 163, 184, .20);
    border-radius: 28px;
    background: rgba(24, 27, 34, .98);
    box-shadow: 0 34px 100px rgba(0, 0, 0, .52), inset 0 1px 0 rgba(255, 255, 255, .065);
}

body.theme-light .chat-attachment-compose-modal,
html[data-theme="light"] body .chat-attachment-compose-modal {
    color: #111827;
    border-color: rgba(15, 23, 42, .13);
    background: rgba(248, 250, 252, .98);
    box-shadow: 0 34px 100px rgba(15, 23, 42, .25), inset 0 1px 0 rgba(255, 255, 255, .72);
}

.chat-attachment-compose-head {
    flex: 0 0 auto;
    min-height: 68px;
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) 48px;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
}

.chat-attachment-compose-head h3 {
    margin: 0;
    overflow: hidden;
    font-size: 1.2rem;
    font-weight: 850;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-attachment-compose-close,
.chat-attachment-compose-add {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: inherit;
    background: transparent;
    cursor: pointer;
}

.chat-attachment-compose-close:hover,
.chat-attachment-compose-add:hover {
    background: rgba(148, 163, 184, .13);
}

.chat-attachment-compose-close svg,
.chat-attachment-compose-add svg {
    width: 25px;
    height: 25px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.chat-attachment-compose-strip {
    flex: 0 0 auto;
    min-height: 96px;
    display: flex;
    gap: 9px;
    padding: 8px 16px 12px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
}

.chat-attachment-compose-strip::-webkit-scrollbar {
    display: none;
}

.chat-attachment-compose-thumb {
    position: relative;
    width: 78px;
    height: 78px;
    min-width: 78px;
    overflow: visible;
    border-radius: 16px;
    transition: opacity .15s ease, transform .15s ease;
}

.chat-attachment-compose-thumb-main {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    gap: 3px;
    padding: 0;
    overflow: hidden;
    border: 2px solid transparent;
    border-radius: 16px;
    color: inherit;
    background: rgba(255, 255, 255, .07);
    cursor: pointer;
}

.chat-attachment-compose-thumb.focused .chat-attachment-compose-thumb-main {
    border-color: color-mix(in srgb, var(--primary) 82%, #fff 18%);
}

.chat-attachment-compose-thumb.excluded {
    opacity: .42;
}

.chat-attachment-compose-thumb img,
.chat-attachment-compose-thumb video {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.chat-attachment-compose-play {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 18px;
    text-shadow: 0 2px 10px rgba(0,0,0,.7);
    pointer-events: none;
}

.chat-attachment-compose-check {
    position: absolute;
    z-index: 3;
    top: -6px;
    right: -6px;
    width: 27px;
    height: 27px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 2px solid rgba(255,255,255,.88);
    border-radius: 50%;
    color: #fff;
    background: linear-gradient(135deg, #9b7bff, #6d5dfc);
    box-shadow: 0 4px 12px rgba(0,0,0,.32);
    cursor: pointer;
}

.chat-attachment-compose-remove {
    position: absolute;
    z-index: 4;
    top: -6px;
    left: -6px;
    width: 27px;
    height: 27px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 2px solid rgba(255,255,255,.88);
    border-radius: 50%;
    color: #fff;
    background: rgba(15,23,42,.86);
    box-shadow: 0 4px 12px rgba(0,0,0,.32);
    cursor: pointer;
    transition: background .15s ease, transform .15s ease;
}

.chat-attachment-compose-remove:hover,
.chat-attachment-compose-remove:focus-visible {
    background: #ef4444;
    outline: 2px solid rgba(248,113,113,.34);
    outline-offset: 2px;
}

.chat-attachment-compose-remove:active {
    transform: scale(.94);
}

.chat-attachment-compose-remove svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.chat-attachment-compose-check svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.chat-attachment-compose-check[aria-pressed="false"] {
    color: transparent;
    background: rgba(15, 23, 42, .38);
}

.chat-attachment-compose-stage {
    flex: 1 1 auto;
    min-height: 260px;
    max-height: 54dvh;
    margin: 0 16px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 22px;
    color: rgba(226,232,240,.88);
    background: rgba(0, 0, 0, .28);
}

.chat-attachment-compose-stage.excluded {
    opacity: .45;
}

.chat-attachment-compose-stage img,
.chat-attachment-compose-stage video {
    display: block;
    width: 100%;
    height: 100%;
    max-height: 54dvh;
    object-fit: contain;
    background: #080a10;
}

.chat-attachment-compose-stage.is-file {
    min-height: 250px;
    align-content: center;
    gap: 14px;
    padding: 28px;
    box-sizing: border-box;
}

.chat-attachment-compose-file-icon {
    display: grid;
    place-items: center;
    width: 76px;
    height: 76px;
    color: #fff;
    border-radius: 24px;
    background: linear-gradient(135deg, #9b7bff, #6d5dfc);
}

.chat-attachment-compose-file-icon svg {
    width: 42px;
    height: 42px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.chat-attachment-compose-thumb .chat-attachment-compose-file-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
}

.chat-attachment-compose-thumb .chat-attachment-compose-file-icon svg {
    width: 23px;
    height: 23px;
}

.chat-attachment-compose-file-name {
    max-width: 100%;
    overflow: hidden;
    font-size: .88rem;
    font-weight: 760;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-attachment-compose-thumb .chat-attachment-compose-file-name {
    width: 66px;
    padding: 0 3px;
    box-sizing: border-box;
    font-size: .62rem;
}

.chat-attachment-compose-footer {
    flex: 0 0 auto;
    min-height: 68px;
    margin: 14px 16px 0;
    padding: 6px 7px 6px 17px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 52px;
    align-items: center;
    gap: 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .065);
}

body.theme-light .chat-attachment-compose-footer,
html[data-theme="light"] body .chat-attachment-compose-footer {
    background: rgba(15, 23, 42, .065);
}

.chat-attachment-compose-footer textarea {
    width: 100%;
    min-width: 0;
    min-height: 40px;
    max-height: 104px;
    padding: 9px 0;
    resize: none;
    overflow-y: auto;
    border: 0;
    outline: 0;
    color: inherit;
    background: transparent;
    font: inherit;
    font-size: 1rem;
    line-height: 1.35;
}

.chat-attachment-compose-footer textarea::placeholder {
    color: var(--text-secondary);
}

.chat-attachment-compose-send {
    width: 50px;
    height: 50px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: #fff;
    background: linear-gradient(135deg, #9b7bff, #6d5dfc);
    box-shadow: 0 10px 24px rgba(109, 93, 252, .30);
    cursor: pointer;
}

.chat-attachment-compose-send:disabled {
    opacity: .38;
    cursor: not-allowed;
}

.chat-attachment-compose-send svg {
    width: 27px;
    height: 27px;
    fill: currentColor;
    stroke: none;
}

.chat-attachment-compose-progress {
    min-height: 26px;
    padding: 4px 18px max(8px, env(safe-area-inset-bottom, 0px));
    color: var(--text-secondary);
    font-size: .76rem;
    font-weight: 700;
    text-align: center;
}

.chat-attachment-compose-overlay[aria-busy="true"] .chat-attachment-compose-close,
.chat-attachment-compose-overlay[aria-busy="true"] .chat-attachment-compose-add,
.chat-attachment-compose-overlay[aria-busy="true"] .chat-attachment-compose-remove,
.chat-attachment-compose-overlay[aria-busy="true"] .chat-attachment-compose-thumb {
    pointer-events: none;
    opacity: .55;
}

/* GIF placeholders reuse the original media button and protected viewer. */
.dealix-motion-frame { display: block; width: 100%; height: 100%; min-width: 0; }
.dealix-motion-frame > img { display: block; width: 100%; height: 100%; object-fit: cover; }
.dealix-motion-placeholder { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px; min-width: 88px; min-height: 120px; width: 100%; height: 100%; padding: 16px; box-sizing: border-box; background: var(--bg-secondary); color: var(--text-secondary); font-size: 13px; }
.dealix-motion-placeholder svg { flex: 0 0 28px; }

/* Adjacent image/video uploads with one validated album id become one bubble. */
#chat-messages .message-wrap.media-album-wrap {
    max-width: min(440px, 78vw) !important;
}

#chat-messages .message.media-album-message,
#chat-messages .message.sent.media-album-message,
#chat-messages .message.received.media-album-message {
    position: relative !important;
    width: min(420px, 76vw) !important;
    max-width: min(420px, 76vw) !important;
    padding: 0 !important;
    overflow: visible !important;
    border-radius: 22px !important;
    border: 0 !important;
    box-sizing: border-box !important;
}

#chat-messages .message.sent.media-album-message {
    color: #fff !important;
    background: transparent !important;
    border-bottom-right-radius: 8px !important;
    box-shadow: none !important;
}

#chat-messages .message.received.media-album-message {
    color: #f8fafc !important;
    background: transparent !important;
    border-bottom-left-radius: 8px !important;
    box-shadow: none !important;
}

body.theme-light #chat-messages .message.received.media-album-message,
html[data-theme="light"] body #chat-messages .message.received.media-album-message {
    color: #111827 !important;
    background: transparent !important;
    border-color: transparent !important;
}

#chat-messages .message.media-album-message > .message-content {
    width: 100% !important;
    padding: 0 !important;
    overflow: visible !important;
    color: inherit !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
}

.chat-media-album {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 3px;
    width: 100%;
    overflow: hidden;
    border-radius: 19px;
    background: rgba(0,0,0,.28);
}

.chat-media-album[data-count="1"] {
    grid-template-columns: minmax(0, 1fr);
}

.chat-media-album[data-count="3"] .chat-media-album-item:first-child {
    grid-column: 1 / -1;
    aspect-ratio: 2 / 1;
}

.chat-media-album[data-count="5"],
.chat-media-album[data-count="6"],
.chat-media-album[data-count="7"],
.chat-media-album[data-count="8"],
.chat-media-album[data-count="9"],
.chat-media-album[data-count="10"] {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.chat-media-album-item {
    position: relative;
    min-width: 0;
    aspect-ratio: 1 / 1;
    display: block;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    background: #080a10;
    cursor: zoom-in;
}

.chat-media-album-item img,
.chat-media-album-item video {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    pointer-events: none;
}

.chat-media-album-play {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: #fff;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,.75));
    pointer-events: none;
}

.chat-media-album-play svg {
    width: 30px;
    height: 30px;
}

#chat-active.message-selection-mode #chat-messages .album-selection-row {
    margin-left: 0;
}

#chat-active.message-selection-mode #chat-messages .album-selection-row .chat-media-album-item {
    pointer-events: auto !important;
}

.album-message-select-toggle {
    position: absolute;
    z-index: 6;
    top: 8px;
    left: 8px;
    width: 29px;
    height: 29px;
    display: grid;
    place-items: center;
    border: 2px solid rgba(255,255,255,.88);
    border-radius: 50%;
    color: transparent;
    background: rgba(15,23,42,.44);
    box-shadow: 0 5px 14px rgba(0,0,0,.24);
    pointer-events: none;
}

.album-message-select-toggle.selected {
    color: #fff;
    background: linear-gradient(135deg, #9b7bff, #6d5dfc);
}

.album-message-select-toggle svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.chat-media-album-caption,
.chat-attachment-caption-text {
    min-height: 36px;
    padding: 9px 70px 9px 11px;
    color: inherit;
    font-size: .92rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
    box-sizing: border-box;
}

.chat-attachment-caption-text {
    margin-top: 0;
    padding-right: 70px;
    padding-bottom: 9px;
}

#chat-messages .message.sent .chat-media-album-caption,
#chat-messages .message.sent .chat-attachment-caption-text {
    color: #fff;
    background: linear-gradient(135deg, #8b5cf6, #6d5dfc 62%, #a879ff);
    border-radius: 0 0 18px 18px;
}

#chat-messages .message.received .chat-media-album-caption,
#chat-messages .message.received .chat-attachment-caption-text {
    color: var(--text);
    background: color-mix(in srgb, var(--surface-elevated, #202634) 94%, transparent);
    border-radius: 0 0 18px 18px;
}

#chat-messages .message:has(.chat-media-album-caption) .chat-media-album,
#chat-messages .message:has(.chat-attachment-caption-text) .chat-media-thumb {
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}

body.theme-light #chat-messages .message.received .chat-media-album-caption,
body.theme-light #chat-messages .message.received .chat-attachment-caption-text,
html[data-theme="light"] body #chat-messages .message.received .chat-media-album-caption,
html[data-theme="light"] body #chat-messages .message.received .chat-attachment-caption-text {
    color: #111827;
    background: rgba(255,255,255,.96);
}

#chat-messages .message:has(.chat-media-album-caption) > .message-time,
#chat-messages .message:has(.chat-attachment-caption-text) > .message-time {
    position: absolute !important;
    z-index: 5 !important;
    right: 9px !important;
    bottom: 8px !important;
    margin: 0 !important;
    padding: 2px 5px !important;
    border-radius: 999px !important;
    color: rgba(255,255,255,.90) !important;
    background: transparent !important;
    text-shadow: 0 1px 3px rgba(0,0,0,.48) !important;
}

#chat-messages .message.media-album-message > .message-time {
    position: absolute !important;
    z-index: 4 !important;
    right: 9px !important;
    bottom: 8px !important;
    margin: 0 !important;
    padding: 3px 6px !important;
    border-radius: 999px !important;
    color: rgba(255,255,255,.90) !important;
    background: rgba(5, 8, 15, .46) !important;
    backdrop-filter: blur(6px) !important;
    -webkit-backdrop-filter: blur(6px) !important;
}

.chat-media-viewer-nav,
.chat-media-viewer-counter {
    position: fixed !important;
    z-index: 6 !important;
    color: #fff !important;
    border: 1px solid rgba(255,255,255,.16) !important;
    background: rgba(15,23,42,.30) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
}

.chat-media-viewer-nav {
    top: 50% !important;
    width: 54px !important;
    height: 54px !important;
    display: grid !important;
    place-items: center !important;
    padding: 0 !important;
    transform: translateY(-50%) !important;
    border-radius: 50% !important;
    cursor: pointer !important;
}

.chat-media-viewer-nav.prev { left: max(20px, env(safe-area-inset-left)) !important; }
.chat-media-viewer-nav.next { right: max(20px, env(safe-area-inset-right)) !important; }
.chat-media-viewer-nav.hidden { display: none !important; }
.chat-media-viewer-nav:disabled { opacity: .24 !important; cursor: default !important; }

.chat-media-viewer-nav svg {
    width: 30px;
    height: 30px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.chat-media-viewer-counter {
    top: max(14px, env(safe-area-inset-top)) !important;
    left: 50% !important;
    min-width: 62px !important;
    padding: 7px 12px !important;
    transform: translateX(-50%) !important;
    border-radius: 999px !important;
    font-size: .82rem !important;
    font-weight: 800 !important;
    text-align: center !important;
}

.chat-media-viewer-counter.hidden { display: none !important; }
.chat-media-viewer-stage { touch-action: pan-y pinch-zoom; }

@media (max-width: 700px) {
    .chat-attachment-compose-overlay {
        align-items: flex-end;
        padding: 8px 8px max(8px, env(safe-area-inset-bottom, 0px));
    }

    .chat-attachment-compose-modal {
        width: 100%;
        max-height: min(92dvh, 820px);
        border-radius: 26px;
    }

    .chat-attachment-compose-stage {
        min-height: 230px;
        max-height: 50dvh;
        margin: 0 10px;
        border-radius: 20px;
    }

    .chat-attachment-compose-stage img,
    .chat-attachment-compose-stage video {
        max-height: 50dvh;
    }

    .chat-attachment-compose-strip {
        padding-left: 12px;
        padding-right: 12px;
    }

    .chat-attachment-compose-footer {
        margin-left: 10px;
        margin-right: 10px;
    }

    #chat-messages .message-wrap.media-album-wrap {
        max-width: min(348px, 88vw) !important;
    }

    #chat-messages .message.media-album-message,
    #chat-messages .message.sent.media-album-message,
    #chat-messages .message.received.media-album-message {
        width: min(330px, 84vw) !important;
        max-width: min(330px, 84vw) !important;
        border-radius: 20px !important;
    }

    .chat-media-album { border-radius: 17px; }
    .chat-media-viewer-nav { display: none !important; }
}
.composer-input-row { display: flex; gap: 12px; align-items: flex-start; }
.composer-textarea { flex: 1; min-height: 44px; max-height: 120px; }
.composer-tools { display: flex; gap: 4px; align-items: center; }
.media-preview { margin-top: 12px; position: relative; display: inline-block; }
.media-preview img, .media-preview video { max-width: 250px; max-height: 250px; border-radius: 16px; }
.reactions-bar { display: flex; gap: 12px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.reaction-btn {
    background: none; border: none; color: var(--text-secondary);
    font-size: 14px; cursor: pointer; padding: 6px 10px;
    border-radius: 20px; display: flex; align-items: center; gap: 4px;
    transition: all 0.2s;
}
.reaction-btn:hover { background: var(--bg-hover); }
.reaction-btn.active { color: var(--primary); background: var(--primary-light); }
/* #4: reaction chips под пузырём — компактные, отдельные emoji/count,
   читаемый count, аккуратный перенос. */
.message-reactions:empty { display: none; }
.message-reactions .reactions-container {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 5px;
    max-width: 100%;
}
.message-reactions .reaction-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 30px;
    padding: 0 9px;
    background: rgba(255, 255, 255, .08);
    border-radius: 999px;
    line-height: 1;
    max-width: 100%;
}
/* #2: одиночная реакция (count === 1) — только emoji, без gap/padding под число. */
.message-reactions .reaction-btn.single { gap: 0; padding: 0 7px; }
.message-reactions .reaction-btn .message-reaction-emoji { display: inline-grid; place-items: center; width: 22px; height: 22px; font-size: 22px; line-height: 1; }
.chat-reaction-emoji { display: inline-grid; place-items: center; width: 28px; height: 28px; font-size: 28px; line-height: 1; vertical-align: middle; }
.message-reactions .reaction-btn .message-reaction-count {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
}
.message-reactions .reaction-btn.active {
    background: rgba(109, 93, 252, .22);
}
.message-reactions .reaction-btn.active .message-reaction-count { color: var(--primary, #6d5dfc); }
body.theme-light .message-reactions .reaction-btn { background: rgba(15, 23, 42, .06); }
.poll-container { margin-top: 16px; }
.poll-option { margin-bottom: 12px; }
.poll-option-label { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.poll-bar { height: 6px; background: var(--primary); border-radius: 3px; margin: 4px 0; }
.poll-percent { font-size: 12px; color: var(--text-muted); }

/* Обложка на всю ширину */
.modern-tabs {
    max-width: 680px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 16px;
    padding-right: 16px;
}
.tab-content.active {
    display: block !important;
}
.stat-icon { display: flex; align-items: center; margin-right: 8px; }
.stat-new { display: flex; align-items: center; gap: 10px; }
.badge-new { display: inline-flex; align-items: center; gap: 6px; }
.empty-state { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 40px; text-align: center; }

/* ===== ПОИСК В ШАПКЕ (ФИНАЛЬНЫЙ) ===== */
.header-search {
    flex: 1;
    max-width: 320px;
    margin: 0 var(--space-md);
    position: relative;
}

.search-container {
    position: relative;
    width: 100%;
}

#header-search-input {
    width: 100%;
    padding: 10px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 24px;
    color: var(--text);
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s ease;
    box-sizing: border-box;
    height: 42px;
}

#header-search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
    background: var(--bg-card);
}

#header-search-input::placeholder {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.search-results-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    max-height: 350px;
    overflow-y: auto;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.15s ease;
    border-bottom: 1px solid var(--border-light);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: var(--bg-hover);
}

.search-result-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--primary-grad);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 18px;
    color: #fff;
    flex-shrink: 0;
}

.search-result-info {
    flex: 1;
    min-width: 0;
}

.search-result-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.search-result-empty {
    padding: 20px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

@media (max-width: 768px) {
    .header-search {
        max-width: none;
        margin: 0 var(--space-sm);
        flex: 2;
    }
    
    #header-search-input {
        padding: 8px 14px;
        font-size: 0.8rem;
        height: 38px;
        border-radius: 20px;
    }
    
    .search-results-dropdown {
        max-height: 280px;
        border-radius: var(--radius);
    }
    
    .search-result-item {
        padding: 10px 14px;
        gap: 10px;
    }
    
    .search-result-avatar {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    .search-result-name {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    #header-search-input {
        padding: 6px 12px;
        font-size: 0.75rem;
        height: 34px;
    }
    
    .search-result-item {
        padding: 8px 12px;
    }
    
    .search-result-avatar {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
}
/* ===== МОБИЛЬНЫЙ ПОИСК (ЛУПА) ===== */


@media (max-width: 768px) {
    
    
    .header-search {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        max-width: none;
        margin: 0;
        padding: 8px 12px;
        background: var(--bg-secondary);
        border-bottom: 1px solid var(--border);
        z-index: 99;
        display: none;
    }
    
    
    
    #header-search-input {
        width: 100%;
    }
    
    .search-results-dropdown {
        left: 12px;
        right: 12px;
        max-width: calc(100vw - 24px);
    }

 }

/* ===== ТОСТЫ В СТИЛЕ TELEGRAM (ПРАВЫЙ НИЖНИЙ УГОЛ) ===== */
.toast-container {
    position: fixed;
    bottom: 20px !important;
    right: 20px !important;
    top: auto !important;
    z-index: 9999;
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
    max-width: 380px;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    animation: toastSlideIn 0.3s ease;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(12px);
    min-width: 300px;
    max-width: 380px;
}

.toast::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    border-radius: 3px 0 0 3px;
}

.toast.success::before { background: var(--success); }
.toast.error::before { background: var(--danger); }
.toast.warning::before { background: var(--warning); }
.toast.info::before { background: var(--primary); }

.toast-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    font-weight: 700;
}

.toast.success .toast-icon { background: var(--success-light); color: var(--success); }
.toast.error .toast-icon { background: var(--danger-light); color: var(--danger); }
.toast.warning .toast-icon { background: var(--warning-light); color: var(--warning); }
.toast.info .toast-icon { background: var(--primary-light); color: var(--primary); }

.toast-content {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text);
    margin-bottom: 2px;
}

.toast-message {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
    word-break: break-word;
}

.toast-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    line-height: 1;
}

.toast-close:hover {
    background: var(--bg-hover);
    color: var(--text);
}

@keyframes toastSlideIn {
    from {
        transform: translateX(120%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@media (max-width: 480px) {
    .toast-container {
        left: 12px;
        right: 12px;
        max-width: none;
        bottom: 12px !important;
    }
    
    .toast {
        min-width: auto;
        max-width: none;
    }
}
/* ===== ВЫПАДАЮЩЕЕ МЕНЮ КОЛОКОЛЬЧИКА ===== */
.notification-bell {
    position: relative;
}

.notification-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--danger);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    line-height: 1.2;
}

.notification-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: -20px;
    width: 360px;
    max-height: 480px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    z-index: 1001;
    overflow: hidden;
    display: none;
}

.notification-dropdown.visible {
    display: block;
}

.notification-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

.notification-dropdown-title {
    font-weight: 700;
    font-size: 0.95rem;
}

.notification-dropdown-list {
    max-height: 360px;
    overflow-y: auto;
}

.notification-dropdown-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid var(--border-light);
}

.notification-dropdown-item:hover {
    background: var(--bg-hover);
}

.notification-dropdown-item.unread {
    background: rgba(99, 102, 241, 0.05);
}



.notification-dropdown-content {
    flex: 1;
    min-width: 0;
}

.notification-dropdown-text {
    font-size: 0.85rem;
    color: var(--text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}



.notification-dropdown-dot {
    width: 7px;
    height: 7px;
    background: var(--primary);
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 6px;
}

.notification-dropdown-empty {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-muted);
}

.notification-dropdown-footer {
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    text-align: center;
}

@media (max-width: 480px) {
    .notification-dropdown {
        width: calc(100vw - 32px);
        right: -60px;
    }
    
    .toast-container {
        left: 12px;
        right: 12px;
        max-width: none;
        bottom: 12px !important;
    }
}
/* ===== ЗВОНОК (ULTRA MODERN 2026) ===== */
.call-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at center, rgba(20, 16, 50, 0.95) 0%, rgba(8, 8, 20, 0.98) 100%);
    backdrop-filter: blur(60px);
    -webkit-backdrop-filter: blur(60px);
}
.call-fullscreen.hidden { display: none; }
.call-backdrop { display: none; }

.call-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
    padding: 20px;
    width: 100%;
    max-width: 380px;
    position: relative;
}

/* Анимированные частицы фона */
.call-wrapper::before {
    content: '';
    position: absolute;
    width: 300px; height: 300px;
    background: radial-gradient(circle, rgba(99,102,241,0.15) 0%, transparent 70%);
    border-radius: 50%;
    top: -40px;
    animation: floatGlow 4s ease-in-out infinite;
}
@keyframes floatGlow {
    0%, 100% { transform: translateY(0) scale(1); opacity: 0.5; }
    50% { transform: translateY(-20px) scale(1.1); opacity: 0.8; }
}

.call-header-info {
    text-align: center;
    position: relative;
    z-index: 2;
}

.call-avatar-ring {
    width: 112px; height: 112px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(99,102,241,0.2), rgba(139,92,246,0.2));
    padding: 4px;
    margin: 0 auto 20px;
    box-shadow: 0 0 80px rgba(99,102,241,0.2);
}

.call-avatar-img {
    width: 104px; height: 104px;
    border-radius: 50%;
    background: linear-gradient(145deg, #6366f1 0%, #8b5cf6 100%);
    display: flex; align-items: center; justify-content: center;
    font-size: 40px; font-weight: 600;
    color: white;
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.1);
}

.call-name {
    font-size: 24px; font-weight: 600;
    color: white; 
    margin-bottom: 6px;
    letter-spacing: -0.2px;
}

.call-status {
    font-size: 13px; 
    color: rgba(255, 255, 255, 0.45);
    font-weight: 400;
    letter-spacing: 0.5px;
}

.call-video-area {
    width: 100%;
    border-radius: 28px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 30px 80px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.05);
    background: #0a0a14;
}

#call-remote-video {
    width: 100%; 
    aspect-ratio: 3/4;
    object-fit: cover;
    display: block;
}

#call-local-video {
    position: absolute;
    top: 14px; right: 14px;
    width: 84px; height: 112px;
    object-fit: cover;
    border-radius: 18px;
    border: 2px solid rgba(255,255,255,0.25);
    box-shadow: 0 12px 32px rgba(0,0,0,0.5);
    transition: transform 0.3s ease;
}
#call-local-video:hover {
    transform: scale(1.05);
}

.call-actions-row {
    display: flex;
    gap: 16px;
    align-items: center;
    position: relative;
    z-index: 2;
}

.call-action-btn {
    width: 48px; height: 48px;
    border-radius: 50%;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1.2);
    position: relative;
    backdrop-filter: blur(10px);
}

.call-action-btn span {
    position: absolute;
    bottom: -22px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    font-size: 10px;
    color: rgba(255,255,255,0.4);
    font-weight: 500;
    letter-spacing: 0.3px;
}

.call-action-btn:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.15);
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.call-action-btn:active {
    transform: scale(0.92);
    transition: transform 0.1s ease;
}

.call-end-circle {
    width: 60px !important;
    height: 60px !important;
    background: linear-gradient(135deg, #ef4444, #dc2626) !important;
    border: none !important;
    margin: 0 8px;
    box-shadow: 0 8px 32px rgba(239,68,68,0.4);
}

.call-end-circle:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c) !important;
    box-shadow: 0 12px 40px rgba(239,68,68,0.6) !important;
}

.call-end-circle svg {
    transform: rotate(135deg);
}

@media (max-width: 480px) {
    .call-wrapper { gap: 28px; padding: 16px; }
    .call-avatar-ring { width: 96px; height: 96px; }
    .call-avatar-img { width: 88px; height: 88px; font-size: 34px; }
    .call-name { font-size: 20px; }
    .call-actions-row { gap: 10px; }
    .call-action-btn { width: 42px; height: 42px; }
    .call-end-circle { width: 54px !important; height: 54px !important; }
}
/* ===== TELEGRAM-STYLE: ЕДИНЫЕ КАРТОЧКИ ===== */
.card {
    background: rgba(255, 255, 255, 0.045);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--space-lg);
    transition: all 0.2s ease;
    box-shadow: 0 12px 34px -12px rgba(0, 0, 0, 0.28);
}
.card:hover {
    border-color: var(--border-dark);
    box-shadow: 0 18px 44px -14px rgba(0, 0, 0, 0.36);
    transform: translateY(-2px);
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-md);
    flex-wrap: wrap;
    gap: var(--space-sm);
}
.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}
.card-body {
    color: var(--text-secondary);
}

/* Единые отступы для всех страниц */
.page-content {
    padding: 24px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Статистика — карточки без blur, но в едином стиле */
.stat-card {
    background: rgba(255, 255, 255, 0.045);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 20px;
}
.stat-card:hover {
    border-color: var(--border-dark);
    transform: translateY(-2px);
    box-shadow: 0 18px 44px -14px rgba(0, 0, 0, 0.36);
}

/* Баланс — тоже единый стиль */
.balance-card {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-xl);
    padding: 20px;
}
.balance-card:hover {
    border-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}
/* ===== TELEGRAM-STYLE: ЕДИНЫЕ ТАБЫ ===== */
.admin-tabs,
.security-tabs,
.auth-tabs{
    display: flex;
    gap: 4px;
    padding: 4px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-lg);
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    border-bottom: none;
}
.admin-tabs::-webkit-scrollbar,
.security-tabs::-webkit-scrollbar {
    display: none;
}

.admin-tab,
.profile-tab,
.security-tab,
.auth-tab,
.filter-tab {
    padding: 8px 16px;
    background: transparent;
    border: none;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
    position: relative;
}
.admin-tab:hover,
.profile-tab:hover,
.security-tab:hover,
.auth-tab:hover,
.filter-tab:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
}
.admin-tab.active,
.profile-tab.active,
.security-tab.active,
.auth-tab.active,
.filter-tab.active {
    background: var(--primary);
    color: white;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}
/* Убираем старые border-bottom у активных табов */
.admin-tab.active,
.profile-tab.active,
.security-tab.active,
.auth-tab.active {
    border-bottom: none;
}

/* Фильтры уведомлений — теперь как табы */
.filter-tabs {
    display: flex;
    gap: 4px;
    flex-wrap: nowrap;
}
.filter-tab {
    border: none;
    border-radius: var(--radius);
}
.filter-tab.active {
    background: var(--primary);
    color: white;
}
body.theme-dark .filter-tab {
    background: transparent;
    border: none;
}
body.theme-dark .filter-tab:hover {
    background: rgba(255, 255, 255, 0.05);
}
body.theme-dark .filter-tab.active {
    background: var(--primary);
    color: white;
}
/* ===== TELEGRAM-STYLE: МОДАЛЬНЫЕ ОКНА ===== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: var(--space-md);
    animation: fadeIn 0.2s ease;
}

.modal {
    background: var(--bg-card);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-xl);
    max-width: 520px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 30px 70px -10px rgba(0, 0, 0, 0.55);
    animation: slideUp 0.3s ease;
}
@keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    padding: 20px 24px 12px;
    border-bottom: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-title {
    font-size: 1.1rem;
    font-weight: 700;
}
.modal-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text);
}

.modal-body {
    padding: 8px 24px 20px;
}
.modal-footer {
    padding: 16px 24px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

/* ===== TELEGRAM-STYLE: ПОЛЯ ВВОДА ===== */
.input, .textarea, .select {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.9rem;
    transition: all 0.2s ease;
    outline: none;
}
.input:focus, .textarea:focus, .select:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
.input::placeholder, .textarea::placeholder {
    color: rgba(255, 255, 255, 0.25);
}

html[data-ui-theme="system"] body.theme-system input::placeholder,
html[data-ui-theme="system"] body.theme-system textarea::placeholder {
    color: var(--text-muted);
    opacity: 1;
}

/* ===== TELEGRAM-STYLE: КНОПКИ ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    letter-spacing: 0.01em;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn.primary {
    background: var(--primary-grad);
    color: white;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}
.btn.primary:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.45);
}

.btn.secondary {
    background: var(--bg-hover);
    color: var(--text);
    border: 1px solid var(--border);
}
.btn.secondary:hover:not(:disabled) {
    background: rgba(148, 163, 184, 0.16);
}

.btn.ghost {
    background: transparent;
    color: var(--text-secondary);
}
.btn.ghost:hover:not(:disabled) {
    background: var(--bg-hover);
    color: var(--text);
}

.btn.danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}
.btn.danger:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.25);
}

.btn.success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}
.btn.success:hover:not(:disabled) {
    background: rgba(16, 185, 129, 0.25);
}

.btn.icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    background: transparent;
}
.btn.icon:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.08);
}
.btn.fullwidth { width: 100%; }
.btn.small { padding: 6px 14px; font-size: 0.8rem; }

/* Плавающая кнопка (как в Telegram) */
.fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 50;
}
.fab:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 32px rgba(99, 102, 241, 0.5);
}
/* ===== TELEGRAM-STYLE: ТАБЛИЦЫ ===== */
.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}
.table th {
    text-align: left;
    padding: 10px 12px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    font-size: 0.875rem;
}
.table tr:last-child td {
    border-bottom: none;
}
.table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid var(--border-light);
}

/* ===== TELEGRAM-STYLE: АВАТАРКИ ===== */
.avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary-grad);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.1rem;
    flex-shrink: 0;
    color: white;
    transition: transform 0.2s ease;
}
.avatar.small { width: 36px; height: 36px; font-size: 0.9rem; }
.avatar.large { 
    width: 120px; 
    height: 120px; 
    font-size: 3rem; 
    background: var(--primary-grad);
    border: 3px solid var(--border-dark);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
    cursor: pointer;
}
.avatar.large:hover {
    transform: scale(1.03);
    border-color: var(--primary);
    box-shadow: 0 16px 40px rgba(99, 102, 241, 0.3);
}

/* ===== TELEGRAM-STYLE: ПУСТЫЕ СОСТОЯНИЯ ===== */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.015);
    border-radius: var(--radius-xl);
    border: 1px dashed var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}
.empty-state svg {
    opacity: 0.3;
    margin-bottom: 8px;
}
.empty-state h3 {
    color: rgba(255, 255, 255, 0.5);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 4px;
}
.empty-state p {
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.85rem;
    max-width: 300px;
}

.empty-state-small {
    text-align: center;
    padding: 24px;
    color: rgba(255, 255, 255, 0.3);
}
.empty-state-small svg {
    opacity: 0.3;
    margin-bottom: 12px;
}
.empty-text {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
}
.empty-subtext {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}
/* Light theme (2026-10-11): the white-alpha colours above were invisible on
   the white deals sidebar and chat list ("Сделок не найдено", list errors). */
body.theme-light .empty-state-small,
body.theme-light .empty-subtext {
    color: var(--text-muted);
}
body.theme-light .empty-text {
    color: var(--text-secondary);
}

/* ===== TELEGRAM-STYLE: СКЕЛЕТОНЫ ===== */
.skeleton {
    background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.06) 50%, rgba(255,255,255,0.03) 75%);
    background-size: 200% 100%;
    animation: skeletonLoading 1.5s infinite;
    border-radius: var(--radius);
}
.skeleton-text {
    height: 14px;
    margin-bottom: 8px;
}
.skeleton-card {
    height: 120px;
    margin-bottom: 16px;
}
.skeleton-list {
    height: 60px;
    margin-bottom: 8px;
}
@keyframes skeletonLoading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ===== TELEGRAM-STYLE: БЕЙДЖИ ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.badge.primary { background: rgba(99, 102, 241, 0.2); color: var(--primary); }
.badge.success { background: rgba(16, 185, 129, 0.2); color: var(--success); }
.badge.warning { background: rgba(245, 158, 11, 0.2); color: var(--warning); }
.badge.danger { background: rgba(239, 68, 68, 0.2); color: var(--danger); }
.badge.info { background: rgba(59, 130, 246, 0.2); color: var(--info); }

/* ===== TELEGRAM-STYLE: ПРОГРЕСС-БАР ===== */
.progress-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 2px;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    background: var(--primary-grad);
    border-radius: 2px;
    transition: width 0.3s ease;
}
/* ===== TELEGRAM-STYLE: СКРОЛЛБАР ===== */
::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* The System theme uses a visible graphite thumb on long menus and lists. */
html[data-ui-theme="system"],
html[data-ui-theme="system"] body.theme-system {
    scrollbar-color: rgba(255, 255, 255, .24) transparent;
    scrollbar-width: thin;
}
html[data-ui-theme="system"] ::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
html[data-ui-theme="system"] ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, .24);
    border-radius: 3px;
}
html[data-ui-theme="system"] ::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, .38);
}

/* ===== TELEGRAM-STYLE: ДРОПДАУНЫ ===== */
.dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-card);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 22px 56px -12px rgba(0, 0, 0, 0.5);
    min-width: 200px;
    z-index: 1000;
    overflow: hidden;
    animation: fadeIn 0.15s ease;
}
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--text);
    font-size: 0.875rem;
    transition: background 0.15s ease;
    cursor: pointer;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
}
.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.05);
}
.dropdown-item svg {
    width: 18px;
    height: 18px;
    opacity: 0.6;
}
.dropdown-item.danger {
    color: var(--danger);
}
.dropdown-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.06);
    margin: 6px 0;
}

/* ===== TELEGRAM-STYLE: СТАТУС-ТАЙМЛАЙН ===== */
.status-timeline {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: var(--space-lg) 0;
    flex-wrap: wrap;
}
.status-step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    position: relative;
    min-width: 70px;
}
.status-step::before {
    content: '';
    position: absolute;
    top: 12px;
    left: -50%;
    right: 50%;
    height: 2px;
    background: rgba(255, 255, 255, 0.08);
}
.status-step:first-child::before { display: none; }
.status-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    z-index: 2;
    transition: all 0.3s ease;
}
.status-step.active .status-dot {
    background: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
}
.status-step.completed .status-dot {
    background: var(--success);
}
.status-step.completed::before {
    background: var(--success);
}
.status-label {
    font-size: 0.65rem;
    text-align: center;
    color: rgba(255, 255, 255, 0.35);
}
.status-step.active .status-label {
    color: var(--text);
    font-weight: 600;
}
.status-step.completed .status-label {
    color: var(--success);
}

/* ===== TELEGRAM-STYLE: МОБИЛЬНАЯ ВЕРСИЯ ===== */
@media (max-width: 768px) {
    .page-content {
        padding: 12px;
    }
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .stat-card {
        padding: 14px;
    }
    .stat-value {
        font-size: 22px;
    }
    .balance-cards {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .balance-card {
        padding: 14px;
    }
    .balance-value {
        font-size: 22px;
    }
    .modal {
        margin: 12px;
        max-height: 80vh;
        border-radius: var(--radius-lg);
    }
    .modal-header {
        padding: 16px 16px 8px;
    }
    .modal-body {
        padding: 8px 16px 16px;
    }
    .modal-footer {
        padding: 12px 16px 16px;
    }
    .btn {
        padding: 8px 14px;
        font-size: 0.8rem;
    }
    .table th,
    .table td {
        padding: 8px 10px;
        font-size: 0.75rem;
    }
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }
    h3 { font-size: 1.1rem; }
}

/* ===== TELEGRAM-STYLE: АНИМАЦИИ ===== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.fade-in {
    animation: fadeIn 0.3s ease;
}
.fade-in-up {
    animation: fadeInUp 0.3s ease;
}

/* ===== TELEGRAM-STYLE: РАЗДЕЛИТЕЛИ ===== */
.divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.06);
    margin: var(--space-md) 0;
}
/* ===== ФИНАЛЬНЫЕ ПРАВКИ ЧАТА И ШАПКИ ===== */

/* Шапка чата — скрываем лишние кнопки на мобилке */
@media (max-width: 768px) {
    .chat-header-actions .btn.icon:not(.chat-back-btn):not(#call-voice-btn):not(#call-video-btn):not(#chat-search-msg-btn):not(#chat-mobile-create-deal-btn):not(#chat-header-menu-btn) {
        display: none !important;
    }
    
    /* Показываем кнопку назад */
    .chat-back-btn {
        display: inline-flex !important;
        background: rgba(255, 255, 255, 0.08);
        border-radius: 50%;
        width: 36px;
        height: 36px;
        align-items: center;
        justify-content: center;
        margin-right: 8px;
        flex-shrink: 0;
    }
    
    /* Аватар и имя в шапке чата */
    .chat-peer-info {
        min-width: 0;
        flex: 1;
    }
    .chat-peer-name {
        font-size: 0.9rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .chat-peer-status {
        font-size: 0.65rem;
    }
    
    /* Инпут сообщения на мобилке */
    .chat-input-area {
        padding: 6px 8px;
        gap: 4px;
    }
    .chat-input-wrapper textarea {
        font-size: 0.85rem;
        padding: 10px 12px;
        padding-right: 30px;
        min-height: 38px;
        max-height: 100px;
    }
    .chat-input-actions .btn.icon {
        width: 34px;
        height: 34px;
    }
    #send-message-btn {
        width: 40px;
        height: 40px;
    }
    #send-message-btn svg {
        width: 18px;
        height: 18px;
    }
}

/* На ПК — кнопка назад скрыта */
@media (min-width: 769px) {
    .chat-back-btn {
        display: none !important;
    }
}

/* Исправление перекрытия кнопок в шапке чата */
.chat-header {
    padding: 10px 14px;
    gap: 8px;
}
.chat-header-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}
.chat-header-actions .btn.icon {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 50%;
    transition: all 0.2s;
}
.chat-header-actions .btn.icon:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Адаптация чата для очень маленьких экранов */
@media (max-width: 380px) {
    .chat-header {
        padding: 8px 10px;
    }
    .chat-header-actions .btn.icon {
        width: 32px;
        height: 32px;
    }
    .chat-header-actions .btn.icon svg {
        width: 16px;
        height: 16px;
    }
    .chat-input-actions .btn.icon {
        width: 30px;
        height: 30px;
    }
    #send-message-btn {
        width: 36px;
        height: 36px;
    }
}

/* Фикс для выпадающего меню колокольчика на мобилке */
@media (max-width: 480px) {
    .notification-dropdown {
        width: calc(100vw - 32px);
        right: -80px;
        max-height: 60vh;
    }
}

/* Фикс для поиска в шапке */
.header-search {
    flex: 1;
    max-width: 320px;
}
@media (max-width: 768px) {
    .header-search {
        max-width: none;
        flex: 2;
    }
}

/* Сообщения — увеличиваем читаемость */
@media (max-width: 480px) {
    .message {
        max-width: 85%;
    }
    .message-content {
        font-size: 0.9rem;
    }
}
/* ===== ИСПРАВЛЕНИЯ ДЛЯ БЕЛОЙ ТЕМЫ ===== */
body.theme-light .stat-value-new {
    color: var(--text) !important;
}
body.theme-light .post-author-name {
    color: var(--text) !important;
}
body.theme-light .profile-bio {
    color: var(--text-secondary) !important;
}
body.theme-light .avatar.huge {
    color: white !important;
}

/* Статистика и баланс в белой теме */
body.theme-light .stat-value,
body.theme-light .balance-value {
    color: var(--text) !important;
}
body.theme-light .stat-label,
body.theme-light .balance-label {
    color: var(--text-secondary) !important;
}

/* Карточки в белой теме */
body.theme-light .card,
body.theme-light .stat-card,
body.theme-light .balance-card {
    background: rgba(0, 0, 0, 0.02) !important;
    border-color: rgba(0, 0, 0, 0.06) !important;
}
body.theme-light .card:hover,
body.theme-light .stat-card:hover,
body.theme-light .balance-card:hover {
    background: rgba(0, 0, 0, 0.03) !important;
    border-color: rgba(0, 0, 0, 0.1) !important;
}

/* Таблицы в белой теме */
body.theme-light .table th {
    color: rgba(0, 0, 0, 0.5) !important;
    border-bottom-color: rgba(0, 0, 0, 0.08) !important;
}
body.theme-light .table td {
    border-bottom-color: rgba(0, 0, 0, 0.04) !important;
    color: var(--text) !important;
}
body.theme-light .table tr:hover td {
    background: rgba(0, 0, 0, 0.02) !important;
}
body.theme-light .table-container {
    background: rgba(0, 0, 0, 0.01) !important;
    border-color: rgba(0, 0, 0, 0.06) !important;
}

/* Табы в белой теме */
body.theme-light .admin-tabs,
body.theme-light .security-tabs,
body.theme-light .auth-tabs {
    background: rgba(0, 0, 0, 0.03) !important;
}
body.theme-light .admin-tab,
body.theme-light .profile-tab,
body.theme-light .security-tab,
body.theme-light .auth-tab,
body.theme-light .filter-tab {
    color: var(--text-secondary) !important;
}
body.theme-light .admin-tab:hover,
body.theme-light .profile-tab:hover,
body.theme-light .security-tab:hover,
body.theme-light .auth-tab:hover,
body.theme-light .filter-tab:hover {
    background: rgba(0, 0, 0, 0.05) !important;
    color: var(--text) !important;
}
body.theme-light .admin-tab.active,
body.theme-light .profile-tab.active,
body.theme-light .security-tab.active,
body.theme-light .auth-tab.active,
body.theme-light .filter-tab.active {
    background: var(--primary) !important;
    color: white !important;
}

/* Инпуты в белой теме */
body.theme-light .input,
body.theme-light .textarea,
body.theme-light .select {
    background: rgba(0, 0, 0, 0.02) !important;
    border-color: rgba(0, 0, 0, 0.1) !important;
    color: var(--text) !important;
}
body.theme-light .input:focus,
body.theme-light .textarea:focus,
body.theme-light .select:focus {
    background: rgba(0, 0, 0, 0.03) !important;
    border-color: var(--primary) !important;
}
body.theme-light .input::placeholder,
body.theme-light .textarea::placeholder {
    color: rgba(0, 0, 0, 0.3) !important;
}

/* Модалки в белой теме */
body.theme-light .modal {
    background: white !important;
    border-color: rgba(0, 0, 0, 0.08) !important;
}
body.theme-light .modal-overlay {
    background: rgba(0, 0, 0, 0.5) !important;
}
body.theme-light .modal-header {
    border-bottom-color: rgba(0, 0, 0, 0.06) !important;
}
body.theme-light .modal-footer {
    border-top-color: rgba(0, 0, 0, 0.06) !important;
}
body.theme-light .modal-close {
    background: rgba(0, 0, 0, 0.04) !important;
}
body.theme-light .modal-close:hover {
    background: rgba(0, 0, 0, 0.08) !important;
}

/* Дропдауны в белой теме */
body.theme-light .dropdown {
    background: white !important;
    border-color: rgba(0, 0, 0, 0.08) !important;
}
body.theme-light .dropdown-item {
    color: var(--text) !important;
}
body.theme-light .dropdown-item:hover {
    background: rgba(0, 0, 0, 0.04) !important;
}

/* Пустые состояния в белой теме */
body.theme-light .empty-state {
    background: rgba(0, 0, 0, 0.01) !important;
    border-color: rgba(0, 0, 0, 0.06) !important;
    color: rgba(0, 0, 0, 0.3) !important;
}
body.theme-light .empty-state h3 {
    color: rgba(0, 0, 0, 0.5) !important;
}
body.theme-light .empty-state p {
    color: rgba(0, 0, 0, 0.3) !important;
}

/* Скроллбар в белой теме */
body.theme-light ::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15) !important;
}
body.theme-light ::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25) !important;
}

/* Скелетоны в белой теме */
body.theme-light .skeleton {
    background: linear-gradient(90deg, rgba(0,0,0,0.03) 25%, rgba(0,0,0,0.06) 50%, rgba(0,0,0,0.03) 75%) !important;
}

/* ===== БЕЗОПАСНОСТЬ: ИКОНКИ ВМЕСТО СМАЙЛИКОВ ===== */
.security-tab svg,
.session-icon svg,
.history-icon svg {
    width: 18px;
    height: 18px;
    margin-right: 8px;
}
/* ===== МЕНЮ СООБЩЕНИЯ (РЕДАКТИРОВАТЬ/УДАЛИТЬ) ===== */
.message-actions-menu {
    position: absolute;
    top: -12px;
    right: 8px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 10;
}
.message:hover .message-actions-menu,
.message-actions-menu:hover {
    opacity: 1 !important;
}
.message-actions-menu .btn.icon {
    width: 28px;
    height: 28px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 50%;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.message-actions-menu .btn.icon:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: scale(1.1);
}
.message-actions-menu .btn.icon.message-delete-btn:hover {
    background: var(--danger);
    border-color: var(--danger);
}
.crypto-select-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}
.crypto-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 6px;
    background: var(--bg-tertiary);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}
.crypto-option.active {
    border-color: var(--primary);
    background: var(--primary-light);
}
.crypto-icon { font-size: 26px; margin-bottom: 4px; }
.crypto-name { font-weight: 600; font-size: 0.8rem; }
.crypto-net { font-size: 0.65rem; color: var(--text-muted); }

.deposit-address-box {
    margin-top: 16px;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    text-align: center;
}
.deposit-address-label { font-weight: 600; margin-bottom: 10px; }
.deposit-address-row { display: flex; gap: 8px; margin-bottom: 12px; }
.deposit-qr { display: inline-block; padding: 10px; background: white; border-radius: 10px; }
.deposit-loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 20px; color: var(--text-secondary); }
.deposit-loading .spinner { width: 24px; height: 24px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; }

.balance-info-card {
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    margin-bottom: 16px;
}
.balance-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.balance-row.held { color: var(--warning); }
.balance-label { font-size: 0.8rem; color: var(--text-secondary); }
.balance-value { font-weight: 700; }

.summary-card {
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    margin-top: 12px;
}
.summary-row { display: flex; justify-content: space-between; margin-bottom: 6px; }

@media (max-width: 480px) {
    .crypto-select-grid { grid-template-columns: repeat(2, 1fr); }
}
/* ===== СТРОКА ПОИСКА В ЧАТЕ (как в Telegram) ===== */
#chat-search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

#chat-search-bar input {
    flex: 1;
    height: 38px;
    font-size: 0.9rem;
    min-width: 0;
    border-radius: 20px;
    padding: 0 14px;
}

#chat-search-bar .btn.icon {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    font-size: 18px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    color: var(--text);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

#chat-search-bar .btn.icon:hover {
    background: var(--primary-light);
}

#search-result-count {
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: nowrap;
    min-width: 40px;
    text-align: center;
}
/* Search bar: former inline styles (style-src); id-scoped so they keep winning
   over the #chat-search-bar rules the way the inline styles did. */
#chat-search-bar .chat-search-input { flex: 1; height: 40px; font-size: 0.9rem; min-width: 0; }
#chat-search-bar .chat-search-count { font-size: 0.85rem; color: var(--text-muted); white-space: nowrap; }
#chat-search-bar .btn.icon.chat-search-nav { width: 40px; height: 40px; font-size: 18px; flex-shrink: 0; }
#chat-search-bar .btn.icon.chat-search-close { width: 40px; height: 40px; font-size: 22px; flex-shrink: 0; font-weight: bold; }

/* Подсветка найденного сообщения */
.search-highlight {
    background: rgba(99, 102, 241, 0.15) !important;
    border-radius: 8px !important;
}

/* Кнопка поиска всегда видна на мобильных */
@media (max-width: 768px) {
    #chat-search-msg-btn {
        display: inline-flex !important;
    }
    
    #chat-search-bar input {
        height: 36px;
        font-size: 0.85rem;
    }
    
    #chat-search-bar .btn.icon {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
}

/* ===== STAGE 9C: deals mobile timeline/actions/light theme fixes ===== */
.deal-icon-svg,
.deal-btn-icon {
    width: 18px;
    height: 18px;
    display: block;
    flex: 0 0 auto;
}
.deal-item-type,
.history-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
}
.history-icon .deal-icon-svg {
    width: 20px;
    height: 20px;
}

.deal-timeline {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}
.deal-timeline .status-timeline {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    flex-wrap: nowrap;
    overflow: visible;
}
.deal-timeline .status-step {
    min-width: 0;
    flex: 1 1 0;
}

.deal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: stretch;
}
.deal-actions .btn {
    min-width: 0;
    flex: 1 1 160px;
    min-height: 44px;
    white-space: normal;
    text-align: center;
}
.deal-actions .deal-action-chat {
    flex: 0 1 130px;
}
.deal-chat-link .btn {
    min-height: 48px;
    white-space: normal;
    line-height: 1.25;
}

body.theme-light .deal-chat-link .btn.secondary,
body.theme-light .deal-actions .btn.secondary,
body.theme-light .deal-actions .deal-action-chat {
    background: #ffffff !important;
    color: #1f2937 !important;
    border-color: rgba(15, 23, 42, 0.12) !important;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06) !important;
}
body.theme-light .deal-chat-link .btn.secondary:hover,
body.theme-light .deal-actions .btn.secondary:hover,
body.theme-light .deal-actions .deal-action-chat:hover {
    background: #f8fafc !important;
    border-color: rgba(79, 70, 229, 0.28) !important;
}
body.theme-light .deal-timeline .status-step::before {
    background: rgba(15, 23, 42, 0.12) !important;
}
body.theme-light .deal-timeline .status-step.completed::before {
    background: var(--success) !important;
}
body.theme-light .deal-timeline .status-dot {
    background: #ffffff !important;
    border: 3px solid rgba(15, 23, 42, 0.85) !important;
}
body.theme-light .deal-timeline .status-step.active .status-dot {
    background: var(--primary) !important;
    border-color: rgba(99, 102, 241, 0.18) !important;
}
body.theme-light .deal-timeline .status-step.completed .status-dot {
    background: var(--success) !important;
    border-color: rgba(16, 185, 129, 0.18) !important;
}
body.theme-light .deal-timeline .status-label {
    color: rgba(15, 23, 42, 0.55) !important;
}
body.theme-light .deal-timeline .status-step.active .status-label,
body.theme-light .deal-timeline .status-step.completed .status-label {
    color: var(--text) !important;
}

@media (max-width: 900px) {
    .deals-container,
    .deals-container.mobile-deal-open {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }
    .deal-details,
    .deal-details-card,
    .deal-details-content,
    #deal-details-content {
        max-width: 100%;
        min-width: 0;
        overflow-x: hidden;
    }
    .deal-actions {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .deal-actions .btn,
    .deal-actions .deal-action-chat,
    .deal-chat-link .btn {
        width: 100%;
        flex: none;
        justify-content: center;
        padding-left: 12px;
        padding-right: 12px;
    }
}

@media (max-width: 560px) {
    .deal-timeline {
        margin-left: -2px;
        margin-right: -2px;
        padding: 0 2px;
    }
    .deal-timeline .status-timeline {
        gap: 0;
        margin: 16px 0;
        padding: 0;
    }
    .deal-timeline .status-step {
        gap: 5px;
        min-width: 0;
    }
    .deal-timeline .status-step::before {
        top: 9px;
        left: -50%;
        right: 50%;
    }
    .deal-timeline .status-dot {
        width: 18px;
        height: 18px;
    }
    .deal-timeline .status-step.active .status-dot {
        box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
    }
    .deal-timeline .status-label {
        font-size: 0.54rem;
        line-height: 1.05;
        max-width: 54px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

@media (max-width: 380px) {
    .deal-timeline .status-label {
        font-size: 0.5rem;
        max-width: 46px;
    }
    .deal-timeline .status-dot {
        width: 16px;
        height: 16px;
    }
    .deal-timeline .status-step::before {
        top: 8px;
    }
}

/* ===== STAGE 9D: deals viewport bottom-gap + tighter mobile timeline/actions ===== */
/* Keep the deals screen inside the available viewport and scroll only the list/details columns. */
.page-content:has(.deals-page) {
    max-width: none;
    height: calc(100vh - 72px);
    min-height: 0;
    overflow: hidden;
    padding: 18px 22px 14px;
}
.deals-page {
    height: 100%;
    min-height: 0;
    overflow: hidden;
}
.deals-container {
    height: 100% !important;
    min-height: 0;
    overflow: hidden;
    align-items: stretch;
}
.deals-sidebar,
.deal-details {
    min-height: 0;
    height: 100%;
}
.deals-sidebar {
    overflow: hidden;
}
.deals-list,
.deal-details {
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
}
.deal-details-card,
#deal-details-content,
.deal-details-content {
    min-height: auto;
    padding-bottom: 0;
}
.deal-chat-link,
.deal-info-section,
.deal-events-section,
.deal-history-section {
    margin-bottom: 0;
}

/* Make action buttons equal and readable in both dark and light themes. */
.deal-actions .btn,
.deal-actions .deal-action-chat,
.deal-chat-link .btn {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}
.deal-actions .deal-action-chat {
    flex: 1 1 150px;
}

body.theme-light .deal-actions .btn.secondary,
body.theme-light .deal-actions .deal-action-chat,
body.theme-light .deal-chat-link .btn.secondary {
    background: #ffffff !important;
    color: #111827 !important;
    border-color: rgba(15, 23, 42, 0.18) !important;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08) !important;
}
body.theme-light .deal-actions .btn.secondary svg,
body.theme-light .deal-actions .deal-action-chat svg,
body.theme-light .deal-chat-link .btn.secondary svg {
    color: #111827 !important;
    stroke: currentColor !important;
}

/* Prevent detail grids/cards from pushing mobile width outside the viewport. */
.deal-info-grid,
.deal-info-content,
.terms-list,
.participants-list,
.crypto-escrow-card,
.deal-crypto-card {
    min-width: 0;
    max-width: 100%;
}

/* Compact timeline for phones: no horizontal overflow, smaller dots/labels. */
@media (max-width: 700px) {
    .page-content:has(.deals-page) {
        height: calc(100vh - 64px);
        padding: 10px;
    }
    .deals-container,
    .deals-container.mobile-deal-open {
        height: 100% !important;
        max-height: 100%;
    }
    .deal-timeline {
        width: 100%;
        overflow: hidden;
        padding: 0;
        margin: 12px 0 16px;
    }
    .deal-timeline .status-timeline {
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        width: 100%;
        max-width: 100%;
        gap: 0;
        margin: 10px 0 4px;
        padding: 0 2px;
        overflow: hidden;
    }
    .deal-timeline .status-step {
        min-width: 0 !important;
        width: auto;
        gap: 4px;
    }
    .deal-timeline .status-step::before {
        top: 8px;
        left: -50%;
        right: 50%;
    }
    .deal-timeline .status-dot {
        width: 16px !important;
        height: 16px !important;
        border-width: 2px !important;
    }
    .deal-timeline .status-step.active .status-dot {
        box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.16) !important;
    }
    .deal-timeline .status-label {
        display: block;
        width: 100%;
        max-width: 100%;
        padding: 0 1px;
        font-size: 0.48rem !important;
        line-height: 1.05;
        letter-spacing: -0.02em;
        white-space: normal;
        overflow-wrap: anywhere;
        text-align: center;
    }
    .deal-actions {
        display: grid !important;
        grid-template-columns: 1fr !important;
        width: 100%;
        gap: 8px;
    }
    .deal-actions .btn,
    .deal-actions .deal-action-chat,
    .deal-chat-link .btn {
        width: 100% !important;
        min-height: 44px;
        justify-content: center;
        white-space: normal;
        line-height: 1.2;
    }
}

@media (max-width: 390px) {
    .deal-timeline .status-label {
        font-size: 0.43rem !important;
    }
    .deal-timeline .status-dot {
        width: 14px !important;
        height: 14px !important;
    }
    .deal-list-item {
        padding: 12px 10px;
    }
    .deal-item-amount {
        font-size: 0.95rem;
    }
}


/* ===== STAGE 9E: deals final placeholder/filter/participants/bottom-gap polish ===== */
/* Empty selected-deal state: professional card, no emoji fallback. */
.deal-placeholder {
    min-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(20px, 4vw, 48px);
}

.deal-placeholder .placeholder-content {
    width: min(520px, 100%);
    padding: clamp(22px, 4vw, 36px);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    background: var(--bg-card);
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.deal-placeholder .placeholder-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    border-radius: 22px;
    background: var(--primary-light);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0 !important;
}
.deal-placeholder .placeholder-icon .deal-icon-svg {
    width: 30px;
    height: 30px;
    stroke-width: 1.9;
}
.deal-placeholder h3,
.deal-placeholder p {
    margin-left: auto;
    margin-right: auto;
}

/* Shared identity presentation uses the same fallback beneath loaded avatars. */
.person-avatar {
    position: relative;
    display: inline-grid;
    place-items: center;
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: 50%;
    overflow: hidden;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 18px;
    font-weight: 750;
}
.person-avatar-fallback {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
}
.person-avatar-fallback svg { width: 52%; height: 52%; }
.person-avatar img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.deal-person-avatar { width: 100%; height: 100%; border-radius: inherit; }

/* Deal participants retain their existing profile links and roles. */
.deal-participants .participant-avatar,
.participant .participant-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 52px;
}
.deal-participants .participant-avatar .deal-icon-svg,
.participant .participant-avatar .deal-icon-svg {
    width: 22px;
    height: 22px;
    stroke-width: 2;
}
.deal-participants .participant.me .participant-avatar,
.participant.me .participant-avatar {
    background: var(--success-light);
    color: var(--success);
}

/* Filters: keep dropdown panel inside deals sidebar on every width/theme. */
.deals-sidebar {
    position: relative;
    min-width: 0;
}
.deals-filters {
    width: calc(100% - 24px) !important;
    max-width: calc(100% - 24px) !important;
    margin: 0 12px 12px !important;
    box-sizing: border-box;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-tertiary);
    padding: 14px;
}
.deals-filters .form-group,
.deals-filters .input,
.deals-filters .select,
.deals-filters .textarea,
.deals-filters .btn {
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}
body.theme-light .deals-filters {
    background: #ffffff;
    border-color: rgba(15, 23, 42, 0.08);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
}

/* Scroll containers: remove the remaining artificial bottom gap when the deals list is scrolled to the end. */
.deals-page,
.deals-container,
.deals-sidebar,
.deal-details {
    min-height: 0;
}
.deals-container {
    overflow: hidden !important;
}
.deals-sidebar {
    display: flex;
    flex-direction: column;
}
.deals-list {
    flex: 1 1 auto;
    min-height: 0;
    padding-bottom: 8px !important;
    margin-bottom: 0 !important;
    overscroll-behavior: contain;
}
.deals-pagination:empty {
    display: none !important;
}
.deals-group:last-child,
.deals-group-list:last-child,
.deal-list-item:last-child {
    margin-bottom: 0 !important;
}
.deals-group-list {
    padding-bottom: 0 !important;
}
#archive-list.hidden {
    display: none !important;
}

/* Light theme final pass for deals cards/details. */
body.theme-light .deals-sidebar,
body.theme-light .deal-details-card,
body.theme-light .deal-info-section,
body.theme-light .deal-events-section,
body.theme-light .deal-chat-link,
body.theme-light .deal-placeholder .placeholder-content {
    background: #ffffff;
    color: var(--text);
    border-color: rgba(15, 23, 42, 0.08);
}
body.theme-light .deal-list-item {
    background: #ffffff;
    border-color: rgba(15, 23, 42, 0.08);
}
body.theme-light .deal-list-item.active {
    background: rgba(99, 102, 241, 0.08);
    border-color: rgba(99, 102, 241, 0.35);
}
body.theme-light .deal-placeholder .placeholder-icon,
body.theme-light .deal-participants .participant-avatar,
body.theme-light .participant .participant-avatar {
    background: rgba(99, 102, 241, 0.10);
}

@media (max-width: 900px) {
    .deal-placeholder {
        min-height: calc(100vh - 92px);
        padding: 14px;
    }
    .deal-placeholder .placeholder-content {
        padding: 22px 16px;
        border-radius: 20px;
    }
    .deals-filters {
        width: calc(100% - 16px) !important;
        max-width: calc(100% - 16px) !important;
        margin: 0 8px 10px !important;
        padding: 12px;
    }
    .deals-list {
        padding-left: 8px !important;
        padding-right: 8px !important;
        padding-bottom: 6px !important;
    }
    .deal-list-item {
        max-width: 100%;
        overflow: hidden;
    }
    .deal-item-right,
    .deal-item-main,
    .deal-item-left {
        min-width: 0;
    }
    .deal-item-amount,
    .deal-item-title,
    .deal-item-meta {
        overflow-wrap: anywhere;
    }
}

/* ===== STAGE 9F: filter overlay + no-scroll placeholder + final list bottom gap ===== */
/* The deals screen must have only two real scroll areas: the deals list and deal details. */
.page-content:has(.deals-page) {
    height: calc(100vh - 72px) !important;
    min-height: 0 !important;
    overflow: hidden !important;
    padding-bottom: 10px !important;
}
.deals-page,
.deals-container {
    height: 100% !important;
    min-height: 0 !important;
    overflow: hidden !important;
}
.deals-sidebar {
    height: 100% !important;
    min-height: 0 !important;
    overflow: hidden !important;
    position: relative !important;
    padding-bottom: 0 !important;
}
.deals-sidebar-header {
    flex: 0 0 auto;
    position: relative;
    z-index: 5;
}
.deals-newbar {
    flex: 0 0 auto;
}
.deals-list {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: auto !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
    scroll-padding-bottom: 0 !important;
}
.deals-list::after {
    content: none !important;
    display: none !important;
}
.deals-group {
    margin-bottom: 12px !important;
}
.deals-group:last-child {
    margin-bottom: 0 !important;
}
.deals-group-list {
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
}
.deal-list-item:last-child {
    margin-bottom: 0 !important;
}

/* Filters should open as a contained overlay, not push/clip the list. */
.deals-filters {
    position: absolute !important;
    top: 72px !important;
    left: 12px !important;
    right: 12px !important;
    width: auto !important;
    max-width: none !important;
    max-height: min(620px, calc(100% - 88px)) !important;
    margin: 0 !important;
    padding: 16px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    z-index: 30 !important;
    box-shadow: 0 22px 55px rgba(0, 0, 0, 0.28) !important;
    backdrop-filter: blur(14px);
}
.deals-filters.hidden {
    display: none !important;
}
body.theme-light .deals-filters {
    background: rgba(255, 255, 255, 0.98) !important;
    box-shadow: 0 22px 55px rgba(15, 23, 42, 0.16) !important;
}
.deals-filters .form-group {
    margin-bottom: 12px;
}
.deals-filters .form-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 14px;
}
.deals-filters .form-buttons .btn {
    width: 100%;
}

/* Placeholder should look like a centered card and not create its own full-page scroll on phones. */
.deal-placeholder {
    height: 100% !important;
    min-height: 0 !important;
    overflow: hidden !important;
    align-content: center;
}
.deal-placeholder .placeholder-content {
    max-height: 100%;
    overflow: hidden;
}
.deal-details:has(.deal-placeholder),
#deal-placeholder {
    overflow: hidden !important;
}

/* Details scroll stops exactly at content end. */
.deal-details {
    padding-bottom: 0 !important;
    scroll-padding-bottom: 0 !important;
}
#deal-details-content,
.deal-details-card {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}
.deal-chat-link:last-child,
.deal-events-section:last-child,
.deal-info-section:last-child {
    margin-bottom: 0 !important;
}

@media (max-width: 900px) {
    .page-content:has(.deals-page) {
        height: calc(100vh - 60px) !important;
        padding: 8px !important;
    }
    .deals-container {
        height: 100% !important;
    }
    .deals-sidebar {
        height: 100% !important;
        max-height: 100% !important;
    }
    .deals-filters {
        top: 64px !important;
        left: 8px !important;
        right: 8px !important;
        max-height: calc(100% - 76px) !important;
        padding: 14px !important;
        border-radius: 18px !important;
    }
    .deals-filters .form-buttons {
        grid-template-columns: 1fr;
    }
    .deals-container:not(.mobile-deal-open) .deal-details {
        display: none !important;
    }
    .deals-container.mobile-deal-open .deal-details {
        height: 100% !important;
        overflow-y: auto !important;
        padding-bottom: 0 !important;
    }
    .deal-placeholder {
        height: 100% !important;
        min-height: 0 !important;
        padding: 12px !important;
    }
    .deal-placeholder .placeholder-content {
        max-height: calc(100vh - 110px);
    }
}

@media (max-width: 480px) {
    .deals-filters {
        top: 60px !important;
        left: 6px !important;
        right: 6px !important;
        max-height: calc(100% - 68px) !important;
        padding: 12px !important;
    }
    .deals-list {
        padding-bottom: 0 !important;
    }
    .deal-placeholder .placeholder-icon {
        width: 54px;
        height: 54px;
        border-radius: 18px;
        margin-bottom: 12px;
    }
    .deal-placeholder h3 {
        font-size: 1.05rem;
        margin-bottom: 6px;
    }
    .deal-placeholder p {
        font-size: 0.86rem;
        margin-bottom: 14px;
    }
}

/* ===== STAGE 9G: filter close + mobile placeholder restore + final scroll trim ===== */
.deals-filters-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.deals-filters-title {
    font-size: 0.98rem;
    line-height: 1.2;
    font-weight: 800;
    color: var(--text);
}
.deals-filters-subtitle {
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 0.76rem;
    line-height: 1.25;
}
.deals-filter-close {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255,255,255,0.05);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform var(--transition-fast), background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}
.deals-filter-close:hover {
    transform: translateY(-1px);
    background: var(--danger-light);
    border-color: rgba(239,68,68,0.35);
    color: var(--danger);
}
body.theme-light .deals-filter-close {
    background: #f8fafc;
    color: #334155;
    border-color: rgba(15,23,42,0.1);
}
body.theme-light .deals-filter-close:hover {
    background: #fee2e2;
    color: #dc2626;
    border-color: #fecaca;
}

/* Avoid extra fake bottom space when the list is scrolled to the end. */
.deals-pagination:empty,
.deals-list > .deals-pagination:empty {
    display: none !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}
.deals-list {
    padding-bottom: 8px !important;
}
.deals-list .deals-group:last-child {
    padding-bottom: 0 !important;
}
.deals-list .deals-group:last-child .deals-group-list {
    padding-bottom: 0 !important;
}
.deals-list .deals-group:last-child .deal-list-item:last-child,
.deals-list .deals-group:last-child .empty-state-small:last-child {
    margin-bottom: 0 !important;
}

@media (max-width: 900px) {
    /* On phones, when no deal is opened, keep the polished placeholder visible below the list instead of hiding it entirely. */
    .deals-container:not(.mobile-deal-open) {
        display: flex !important;
        flex-direction: column !important;
        height: calc(100vh - 72px) !important;
        overflow: hidden !important;
    }
    .deals-container:not(.mobile-deal-open) .deals-sidebar {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        height: auto !important;
        max-height: none !important;
    }
    .deals-container:not(.mobile-deal-open) .deal-details {
        display: block !important;
        flex: 0 0 auto !important;
        height: auto !important;
        max-height: 220px !important;
        overflow: hidden !important;
        padding: 10px 0 0 !important;
    }
    .deals-container:not(.mobile-deal-open) .deal-placeholder {
        display: flex !important;
        height: auto !important;
        min-height: 0 !important;
        padding: 0 !important;
        overflow: hidden !important;
    }
    .deals-container:not(.mobile-deal-open) .deal-placeholder .placeholder-content {
        width: 100% !important;
        max-height: none !important;
        padding: 16px !important;
        border-radius: 18px !important;
    }
    .deals-container:not(.mobile-deal-open) .deal-placeholder .placeholder-icon {
        width: 44px !important;
        height: 44px !important;
        border-radius: 15px !important;
        margin-bottom: 8px !important;
    }
    .deals-container:not(.mobile-deal-open) .deal-placeholder h3 {
        font-size: 1rem !important;
        margin-bottom: 4px !important;
    }
    .deals-container:not(.mobile-deal-open) .deal-placeholder p {
        font-size: 0.82rem !important;
        margin-bottom: 10px !important;
    }
    .deals-container:not(.mobile-deal-open) .deal-placeholder .btn {
        min-height: 40px !important;
        padding: 8px 12px !important;
    }

    .deals-filters {
        z-index: 80 !important;
    }
    .deals-filters-head {
        position: sticky;
        top: 0;
        z-index: 2;
        background: inherit;
        margin-left: -2px;
        margin-right: -2px;
        padding-top: 2px;
    }
}

@media (max-width: 480px) {
    .deals-container:not(.mobile-deal-open) .deal-details {
        max-height: 190px !important;
    }
    .deals-filters-title {
        font-size: 0.92rem;
    }
    .deals-filters-subtitle {
        display: none;
    }
    .deals-filter-close {
        width: 34px;
        height: 34px;
        flex-basis: 34px;
    }
}


/* ===== STAGE 9H: final deal details micro-polish ===== */
/* Mobile/tablet: show the empty selected-deal hint above the deals list, not below it. */
@media (max-width: 900px) {
    .deals-container:not(.mobile-deal-open) .deal-details {
        order: -1 !important;
        flex: 0 0 auto !important;
        max-height: none !important;
        height: auto !important;
        padding: 0 0 10px !important;
        overflow: visible !important;
    }
    .deals-container:not(.mobile-deal-open) .deals-sidebar {
        order: 1 !important;
        flex: 1 1 auto !important;
    }
    .deals-container:not(.mobile-deal-open) .deal-placeholder {
        align-items: stretch !important;
        justify-content: flex-start !important;
        padding: 0 !important;
        overflow: visible !important;
    }
    .deals-container:not(.mobile-deal-open) .deal-placeholder .placeholder-content {
        display: grid !important;
        grid-template-columns: 42px 1fr;
        column-gap: 12px;
        align-items: center;
        text-align: left !important;
        padding: 14px !important;
        border-radius: 18px !important;
    }
    .deals-container:not(.mobile-deal-open) .deal-placeholder .placeholder-icon {
        grid-row: 1 / span 3;
        width: 42px !important;
        height: 42px !important;
        margin: 0 !important;
        border-radius: 14px !important;
    }
    .deals-container:not(.mobile-deal-open) .deal-placeholder h3 {
        margin: 0 0 2px !important;
        font-size: 0.98rem !important;
        line-height: 1.2;
    }
    .deals-container:not(.mobile-deal-open) .deal-placeholder p {
        margin: 0 !important;
        font-size: 0.78rem !important;
        line-height: 1.25;
    }
    .deals-container:not(.mobile-deal-open) .deal-placeholder .btn {
        grid-column: 2;
        justify-self: start;
        margin-top: 8px;
        min-height: 34px !important;
        padding: 7px 11px !important;
        font-size: 0.78rem;
    }
}

/* Participants: one compact horizontal line: “111 (Вы)  Покупатель”. */
.deal-participants .participant {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.deal-participants .participant-profile-card:not([aria-disabled="true"]) {
    cursor: pointer;
    transition: box-shadow 0.16s ease, transform 0.16s ease;
}
@media (hover: hover) {
    .deal-participants .participant-profile-card:not([aria-disabled="true"]):hover {
        box-shadow: var(--shadow-sm);
    }
}
.deal-participants .participant-profile-card:not([aria-disabled="true"]):focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
.deal-participants .participant-profile-card:not([aria-disabled="true"]):active {
    transform: scale(0.995);
}
.deal-participants .participant-info {
    min-width: 0;
    flex: 1 1 auto;
}
.participant-line {
    display: flex;
    align-items: baseline;
    gap: 10px;
    min-width: 0;
    flex-wrap: wrap;
}
.participant-line .participant-name {
    font-weight: 800;
    color: var(--text);
    min-width: 0;
    overflow-wrap: anywhere;
}
.participant-line .participant-role {
    color: var(--text-muted);
    font-size: 0.86rem;
    font-weight: 700;
    line-height: 1.2;
}
.deal-participants .participant.me .participant-role {
    color: var(--success);
}

/* History: icon + title + date + note in one compact row where space allows. */
.history-item {
    align-items: center !important;
}
.history-content {
    min-width: 0;
    flex: 1 1 auto;
}
.history-line {
    display: flex;
    align-items: baseline;
    gap: 10px;
    min-width: 0;
    flex-wrap: wrap;
}
.history-line .history-title {
    font-weight: 800;
    color: var(--text);
    white-space: nowrap;
}
.history-line .history-time,
.history-line .history-note {
    color: var(--text-secondary);
    overflow-wrap: anywhere;
}
.history-line .history-note {
    color: var(--text-muted);
}

@media (max-width: 560px) {
    .history-line {
        gap: 4px 8px;
    }
    .history-line .history-title {
        width: 100%;
        white-space: normal;
    }
    .participant-line {
        gap: 6px 8px;
    }
}


/* ===== STAGE 9I: remove duplicate meta + single chat entry ===== */
/* The primary dates are now shown in event history; keep only delivery deadline as compact note. */
.deal-dates {
    display: none !important;
}
.deal-deadline-note {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 14px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-hover);
    color: var(--text-secondary);
    font-size: 0.86rem;
}
.deal-deadline-note b {
    color: var(--text);
    font-weight: 800;
    text-align: right;
}
.deal-deadline-note.overdue {
    border-color: rgba(239, 68, 68, 0.35);
    background: var(--danger-light);
}
.deal-deadline-note.overdue b {
    color: var(--danger);
}
/* Chat is available in the action row only; remove the duplicate bottom chat CTA if old markup is cached. */
.deal-chat-link {
    display: none !important;
}
/* History rows should stay compact and read as: icon + title + date + note. */
.history-line {
    align-items: center !important;
}
.history-line .history-title {
    margin-right: 2px;
}
.history-line .history-time {
    white-space: nowrap;
}
.history-line .history-note {
    flex: 1 1 240px;
    min-width: 0;
}
@media (max-width: 720px) {
    .deal-deadline-note {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }
    .deal-deadline-note b {
        text-align: left;
    }
    .history-line .history-title {
        width: auto !important;
        white-space: nowrap;
    }
    .history-line .history-time {
        white-space: normal;
    }
}
@media (max-width: 430px) {
    .history-line .history-title {
        width: 100% !important;
        white-space: normal;
    }
}


/* ===== STAGE 9K: align history text beside icons ===== */
.deal-history .history-item {
    display: grid !important;
    grid-template-columns: 38px minmax(0, 1fr) !important;
    align-items: center !important;
    column-gap: 12px !important;
    width: 100%;
}
.deal-history .history-icon {
    width: 38px !important;
    height: 38px !important;
    border-radius: 14px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    align-self: center !important;
    flex: 0 0 38px !important;
}
.deal-history .history-icon .deal-icon-svg,
.deal-history .history-icon svg {
    width: 18px !important;
    height: 18px !important;
}
.deal-history .history-content {
    min-width: 0 !important;
    width: 100% !important;
}
.deal-history .history-line {
    display: flex !important;
    align-items: center !important;
    gap: 8px 12px !important;
    flex-wrap: wrap !important;
    min-width: 0 !important;
}
.deal-history .history-line .history-title {
    width: auto !important;
    min-width: 0 !important;
    margin: 0 !important;
    white-space: nowrap !important;
    line-height: 1.25 !important;
}
.deal-history .history-line .history-time {
    width: auto !important;
    min-width: 0 !important;
    white-space: nowrap !important;
    line-height: 1.25 !important;
    color: var(--text-secondary) !important;
}
@media (max-width: 430px) {
    .deal-history .history-item {
        grid-template-columns: 34px minmax(0, 1fr) !important;
        column-gap: 10px !important;
    }
    .deal-history .history-icon {
        width: 34px !important;
        height: 34px !important;
        border-radius: 12px !important;
    }
    .deal-history .history-line {
        gap: 3px 8px !important;
    }
    .deal-history .history-line .history-title,
    .deal-history .history-line .history-time {
        width: auto !important;
        max-width: 100% !important;
        white-space: normal !important;
    }
}

/* ===== STAGE 10A: fintech notifications dropdown/page cleanup ===== */
.notification-bell {
    position: relative;
}

.notification-count {
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-secondary);
    box-shadow: 0 6px 14px rgba(0,0,0,.18);
}

.notification-dropdown {
    width: min(420px, calc(100vw - 24px));
    max-height: min(620px, calc(100vh - 86px));
    right: 0;
    top: calc(100% + 12px);
    border-radius: 22px;
    background: color-mix(in srgb, var(--bg-card) 96%, transparent);
    border: 1px solid var(--border);
    box-shadow: 0 24px 70px rgba(0,0,0,.34);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    overflow: hidden;
}

body.theme-light .notification-dropdown {
    background: #ffffff;
    border-color: rgba(15,23,42,.08);
    box-shadow: 0 24px 70px rgba(15,23,42,.16);
}

.notification-dropdown.visible {
    display: flex;
    flex-direction: column;
}

.notification-dropdown-header {
    padding: 16px;
    gap: 10px;
    background: linear-gradient(180deg, rgba(99,102,241,.08), transparent);
}

.notification-dropdown-title {
    flex: 1;
    font-size: 1rem;
    letter-spacing: -.01em;
}

.notification-dropdown-close {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg-hover);
    color: var(--text);
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.notification-dropdown-close:hover { background: var(--primary-light); color: var(--primary); }

.notification-dropdown-list {
    max-height: none;
    overflow-y: auto;
    padding: 8px;
}

.notification-dropdown-item {
    width: 100%;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text);
    text-align: left;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 10px;
    align-items: start;
    gap: 10px;
    padding: 12px;
    border-radius: 16px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: background .16s ease, border-color .16s ease, transform .16s ease;
}
.notification-dropdown-item:hover {
    background: var(--bg-hover);
    border-color: var(--border);
    transform: translateY(-1px);
}
.notification-dropdown-item.unread {
    background: rgba(99,102,241,.09);
    border-color: rgba(99,102,241,.20);
}
body.theme-light .notification-dropdown-item.unread { background: rgba(79,70,229,.07); }


.notification-empty-icon svg{
    width: 20px;
    height: 20px;
    display: block;
}






.notification-dropdown-content {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.notification-dropdown-meta {
    color: var(--text-muted);
    font-size: .72rem;
    font-weight: 600;
}
.notification-dropdown-text {
    color: var(--text);
    font-size: .88rem;
    font-weight: 700;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.notification-dropdown-message {
    color: var(--text-secondary);
    font-size: .78rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notification-dropdown-dot {
    width: 8px;
    height: 8px;
    margin-top: 16px;
    background: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
}
.notification-dropdown-empty {
    min-height: 170px;
    padding: 30px 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.notification-dropdown-empty b { color: var(--text); }
.notification-dropdown-empty span { max-width: 260px; font-size: .84rem; }
.notification-empty-icon {
    width: 54px;
    height: 54px;
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    color: var(--primary);
    margin-bottom: 4px;
}
.notification-dropdown-footer {
    padding: 12px;
    border-top: 1px solid var(--border);
    background: rgba(255,255,255,.02);
}

/* Notifications full page */
































@media (max-width: 640px) {
    .notification-dropdown {
        position: fixed;
        left: 10px;
        right: 10px;
        top: 72px;
        width: auto;
        max-height: calc(100vh - 92px);
        border-radius: 22px;
    }
    .notification-dropdown-item {
        grid-template-columns: 40px minmax(0, 1fr) 10px;
        padding: 11px;
    }
    
    
    
    
}

/* ===== STAGE 10B: notification settings modal + premium toasts + richer cards ===== */

















/* Premium floating toasts */
.toast-container {
    left: 22px !important;
    right: auto !important;
    top: auto !important;
    bottom: 22px !important;
    width: min(420px, calc(100vw - 28px));
    max-width: min(420px, calc(100vw - 28px));
    gap: 12px;
}
.toast {
    width: 100%;
    border-radius: 20px !important;
    border: 1px solid var(--border) !important;
    background: color-mix(in srgb, var(--bg-card) 96%, transparent) !important;
    color: var(--text) !important;
    box-shadow: 0 20px 60px rgba(0,0,0,.34) !important;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    padding: 14px 16px !important;
    align-items: flex-start;
}
body.theme-light .toast {
    background: #fff !important;
    border-color: rgba(15,23,42,.10) !important;
    box-shadow: 0 20px 60px rgba(15,23,42,.16) !important;
}
.toast-title { font-size: .92rem; font-weight: 800; margin-bottom: 3px; }
.toast-message { font-size: .82rem; line-height: 1.35; color: var(--text-secondary); }
.toast.info { border-left: 4px solid var(--info) !important; }
.toast.success { border-left: 4px solid var(--success) !important; }
.toast.warning { border-left: 4px solid var(--warning) !important; }
.toast.error { border-left: 4px solid var(--danger) !important; }
.toast-close {
    border-radius: 10px;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.toast-close:hover { background: var(--bg-hover); color: var(--text); }

.notification-dropdown-text{
    letter-spacing: -.01em;
}
.notification-dropdown-message{
    word-break: break-word;
    overflow-wrap: anywhere;
}



@media (max-width: 640px) {
    
    
    
    
    
    
    .toast-container {
        left: 14px !important;
        right: 14px !important;
        bottom: 14px !important;
        width: auto;
        max-width: none;
    }
}


/* ===== STAGE 10D: notification settings reliability + toast right side ===== */
@media (min-width: 641px) {
    .toast-container {
        left: auto !important;
        right: 22px !important;
        top: auto !important;
        bottom: 22px !important;
        width: min(420px, calc(100vw - 44px)) !important;
        max-width: min(420px, calc(100vw - 44px)) !important;
        align-items: flex-end;
    }
}

@media (max-width: 640px) {
    .toast-container {
        left: 14px !important;
        right: 14px !important;
        bottom: 14px !important;
        width: auto !important;
        max-width: none !important;
    }
}




/* ===== STAGE 10F: notification retention + swipe/delete polish ===== */


















@media (hover: hover) and (pointer: fine) {
    

    
}

@media (pointer: coarse) {
    

    
}

@media (max-width: 640px) {
    

    

    

    

    
}


/* ===== STAGE 10G: mobile swipe delete hitbox + compact notification mobile UI ===== */










@media (hover: hover) and (pointer: fine) {
    

    

    

    
}

@media (pointer: coarse) {
    

    

    
}

@media (max-width: 640px) {
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
}


/* ===== STAGE 10H: mobile notification filter tabs horizontal scroll fix ===== */


@media (max-width: 640px), (pointer: coarse) {
    

    

    

    

    
}


/* ===== STAGE 11A: chat viewport + media messenger polish ===== */
body[data-page="chats"] .page-content {
    padding: 0 !important;
    max-width: none !important;
    height: calc(100vh - 65px);
    overflow: hidden;
}

.chats-page {
    height: calc(100vh - 65px) !important;
    min-height: 0 !important;
    overflow: hidden !important;
    padding: 0 !important;
    margin: 0 !important;
}

.chats-container {
    height: 100% !important;
    min-height: 0 !important;
    border-radius: 0 !important;
    border: 0 !important;
    display: grid !important;
    grid-template-columns: minmax(340px, 420px) minmax(0, 1fr) !important;
    background: var(--bg) !important;
    overflow: hidden !important;
}

.chats-sidebar,
.chat-main,
.chat-active {
    min-height: 0 !important;
    height: 100% !important;
}

.chats-sidebar {
    width: auto !important;
    min-width: 0 !important;
    border-right: 1px solid var(--border) !important;
    border-radius: 0 !important;
    background: var(--bg-secondary) !important;
}

.chats-list {
    min-height: 0 !important;
    overflow-y: auto !important;
    padding-bottom: 10px !important;
}

.chat-main {
    min-width: 0 !important;
    overflow: hidden !important;
    background: var(--bg-tertiary) !important;
}

.chat-active {
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
}

.chat-active.hidden { display: none !important; }

.chat-header {
    flex: 0 0 auto !important;
    min-height: 64px;
    padding: 10px 18px !important;
    background: var(--bg-secondary) !important;
}

.chat-messages {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    padding: 18px 20px 22px !important;
    background:
        radial-gradient(circle at 20% 0%, rgba(99,102,241,.05), transparent 28%),
        var(--bg-tertiary) !important;
}

.chat-input-area {
    flex: 0 0 auto !important;
    position: sticky !important;
    bottom: 0 !important;
    z-index: 20 !important;
    padding: 12px 16px !important;
    background: color-mix(in srgb, var(--bg-secondary) 96%, transparent) !important;
    border-top: 1px solid var(--border) !important;
    box-shadow: 0 -10px 26px rgba(0,0,0,.12);
}

.message {
    max-width: min(72%, 620px) !important;
    padding: 9px 12px !important;
    border-radius: 20px !important;
    box-shadow: 0 8px 22px rgba(0,0,0,.08);
}
.message.sent { border-bottom-right-radius: 8px !important; }
.message.received { border-bottom-left-radius: 8px !important; }
.message-edited { margin-left: 8px; color: var(--text-muted); }

.message-actions-menu {
    position: absolute !important;
    top: -12px !important;
    right: 8px !important;
    display: flex !important;
    gap: 4px !important;
    padding: 4px !important;
    border-radius: 999px !important;
    background: var(--bg-card) !important;
    border: 1px solid var(--border) !important;
    box-shadow: var(--shadow-md) !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity .15s ease, transform .15s ease !important;
    transform: translateY(4px);
}
.message:hover .message-actions-menu,
.message-actions-menu:hover {
    opacity: 1 !important;
    pointer-events: auto !important;
    transform: translateY(0);
}

.chat-media-thumb {
    display: block;
    padding: 0;
    margin: 0;
    border: 0;
    background: transparent;
    cursor: zoom-in;
    max-width: min(360px, 64vw);
    overflow: hidden;
    border-radius: 16px;
}

.chat-attach-image {
    display: block;
    width: 100%;
    max-width: min(360px, 64vw) !important;
    max-height: 380px !important;
    object-fit: cover;
    border-radius: 16px !important;
}

.chat-attach-caption {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 7px;
    font-size: .78rem;
    color: rgba(255,255,255,.78);
}
.message.received .chat-attach-caption { color: var(--text-muted); }
.chat-attach-caption a { color: currentColor; font-weight: 700; text-decoration: underline; }

.chat-file-card {
    min-width: 240px;
    max-width: 360px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 16px;
    background: rgba(255,255,255,.10);
    border: 1px solid rgba(255,255,255,.12);
    color: inherit;
    text-decoration: none;
}
.message.received .chat-file-card {
    background: var(--bg-card);
    border-color: var(--border);
}
.chat-file-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    color: var(--primary);
    flex: 0 0 42px;
}
.chat-file-info { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.chat-file-info b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.chat-file-info small { color: var(--text-muted); }

.voice-message {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 240px;
}
.voice-message-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,.14);
}
.voice-message audio { width: 220px; max-width: 52vw; }

.chat-media-viewer.hidden { display: none !important; }
.chat-media-viewer {
    position: fixed;
    inset: 0;
    z-index: 20000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 22px;
}
.chat-media-viewer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(3,7,18,.86);
    backdrop-filter: blur(12px);
}
.chat-media-viewer-panel {
    position: relative;
    z-index: 1;
    width: min(1100px, 96vw);
    max-height: 94vh;
    display: flex;
    flex-direction: column;
    border-radius: 24px;
    overflow: hidden;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-xl);
}
.chat-media-viewer-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 4;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 50%;
    background: rgba(0,0,0,.45);
    color: white;
    font-size: 28px;
    cursor: pointer;
}
.chat-media-viewer-stage {
    min-height: 240px;
    max-height: calc(94vh - 82px);
    display: flex;
    align-items: center;
    justify-content: center;
    background: #020617;
}
.chat-media-viewer-media {
    max-width: 100%;
    max-height: calc(94vh - 82px);
    object-fit: contain;
}
.chat-media-viewer-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 16px;
}
.chat-media-viewer-title { font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-media-viewer-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

body.theme-light .chat-main { background: #f8fafc !important; }
body.theme-light .chat-messages { background: #f8fafc !important; }
body.theme-light .chat-input-area { background: rgba(255,255,255,.96) !important; }
body.theme-light .message.received { background: #ffffff !important; border: 1px solid rgba(15,23,42,.08); }
body.theme-light .message.sent { box-shadow: 0 12px 26px rgba(79,70,229,.18); }

@media (max-width: 1024px) {
    body[data-page="chats"] .page-content,
    .chats-page {
        height: calc(100dvh - 72px) !important;
        overflow: hidden !important;
    }
    .chats-container {
        display: block !important;
        position: relative !important;
        height: 100% !important;
        overflow: hidden !important;
    }
    .chats-sidebar {
        position: absolute !important;
        inset: 0 !important;
        width: 100% !important;
        transform: translateX(0) !important;
        transition: transform .24s ease !important;
    }
    .chats-container.mobile-chat-open .chats-sidebar { transform: translateX(-100%) !important; }
    .chat-main {
        position: absolute !important;
        inset: 0 !important;
        height: 100% !important;
        transform: translateX(100%) !important;
        transition: transform .24s ease !important;
        background: var(--bg) !important;
    }
    .chats-container.mobile-chat-open .chat-main { transform: translateX(0) !important; }
    .chat-active {
        height: 100% !important;
    }
    .chat-header {
        min-height: 56px !important;
        padding: 8px 10px !important;
    }
    .chat-peer-info { min-width: 0; }
    .chat-peer-name { max-width: 128px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .chat-header-actions { gap: 3px !important; }
    .chat-header-actions .btn.icon {
        width: 36px !important;
        height: 36px !important;
        display: inline-flex !important;
    }
    .chat-messages {
        padding: 14px 10px 16px !important;
    }
    .message { max-width: 84% !important; }
    .chat-input-area {
        padding: 8px 10px calc(8px + env(safe-area-inset-bottom)) !important;
    }
    .chat-input-actions .btn.icon { width: 38px !important; height: 38px !important; }
    #send-message-btn { width: 44px !important; height: 44px !important; flex: 0 0 44px; }
    .chat-input-wrapper textarea { min-height: 42px !important; padding-top: 10px !important; padding-bottom: 10px !important; }
    .chat-media-thumb,
    .chat-attach-image { max-width: 70vw !important; }
    .chat-file-card { min-width: 0; width: min(280px, 70vw); }
    .voice-message { min-width: 0; }
}

@media (max-width: 520px) {
    .chat-media-viewer { padding: 0; }
    .chat-media-viewer-panel { width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; }
    .chat-media-viewer-stage { flex: 1; max-height: none; }
    .chat-media-viewer-media { max-height: calc(100dvh - 88px); }
    .chat-media-viewer-footer { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
    .chat-media-viewer-actions .btn { padding: 8px 12px; }
}


/* ===== STAGE 11B: chat viewport hardening + real media preview fix ===== */
body[data-page="chats"] .app {
    height: 100vh !important;
    overflow: hidden !important;
}

body[data-page="chats"] .main-content {
    height: calc(100vh - 65px) !important;
    overflow: hidden !important;
    min-height: 0 !important;
}

body[data-page="chats"] .page-content {
    height: 100% !important;
    min-height: 0 !important;
    overflow: hidden !important;
}

.chats-page,
.chats-container,
.chat-main,
.chat-active {
    min-height: 0 !important;
}

.chats-container {
    height: 100% !important;
    max-height: 100% !important;
}

.chat-messages {
    overscroll-behavior: contain !important;
}

.chat-input-area {
    flex-shrink: 0 !important;
}

.chat-media-thumb {
    position: relative !important;
    display: block !important;
    width: min(360px, 62vw) !important;
    max-width: 100% !important;
    min-height: 120px !important;
    background: rgba(255,255,255,.12) !important;
    border: 1px solid rgba(255,255,255,.14) !important;
}

.message.received .chat-media-thumb {
    background: var(--bg-card) !important;
    border-color: var(--border) !important;
}

.chat-attach-image {
    width: 100% !important;
    height: auto !important;
    min-height: 120px !important;
    max-height: 360px !important;
    object-fit: cover !important;
    background: rgba(0,0,0,.08) !important;
}

.chat-media-broken {
    display: none;
    position: absolute;
    inset: 0;
    align-items: center;
    justify-content: center;
    padding: 16px;
    color: var(--text-secondary);
    font-weight: 700;
    background: var(--bg-card);
}

.chat-media-thumb.is-broken .chat-attach-image {
    opacity: 0;
}

.chat-media-thumb.is-broken .chat-media-broken {
    display: flex;
}

.message.sent .chat-attach-caption {
    color: rgba(255,255,255,.88) !important;
}

.chat-attach-caption span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-attach-caption a {
    flex: 0 0 auto;
}

@media (max-width: 1024px) {
    body[data-page="chats"] .app {
        height: 100dvh !important;
    }

    body[data-page="chats"] .main-content {
        height: calc(100dvh - 72px) !important;
    }

    .chat-media-thumb,
    .chat-attach-image {
        width: min(280px, 72vw) !important;
        max-width: min(280px, 72vw) !important;
    }

    .chat-attach-image {
        max-height: 300px !important;
    }
}

@media (min-width: 1025px) {
    .chat-main {
        height: 100% !important;
    }

    .chat-active:not(.hidden) {
        height: 100% !important;
    }
}

/* ===== STAGE 11C: chat media viewer polish + viewport edge fix ===== */
body.media-viewer-open {
    overflow: hidden !important;
}

/* Чат чуть не должен вылезать за нижнюю границу viewport на ПК */
body[data-page="chats"] .main-content {
    height: calc(100dvh - 64px) !important;
    max-height: calc(100dvh - 64px) !important;
}

body[data-page="chats"] .page-content {
    padding-bottom: 0 !important;
}

.chats-page {
    height: 100% !important;
    max-height: 100% !important;
}

.chats-container {
    height: 100% !important;
    max-height: 100% !important;
    overflow: hidden !important;
}

.chat-main,
.chat-active {
    min-height: 0 !important;
    height: 100% !important;
}

.chat-input-area {
    position: relative !important;
    z-index: 5 !important;
}

/* Fullscreen media viewer как в мессенджере: медиа занимает экран, кнопки прозрачные */
.chat-media-viewer {
    padding: 0 !important;
    background: rgba(2, 6, 23, 0.88) !important;
}

.chat-media-viewer-backdrop {
    background: rgba(2, 6, 23, 0.88) !important;
    backdrop-filter: blur(16px) !important;
}

.chat-media-viewer-panel {
    width: 100vw !important;
    height: 100dvh !important;
    max-width: none !important;
    max-height: none !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

.chat-media-viewer-stage {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    max-height: none !important;
    height: 100% !important;
    padding: 16px !important;
    background: transparent !important;
}

.chat-media-viewer-media {
    max-width: min(100%, 1200px) !important;
    max-height: calc(100dvh - 92px) !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    border-radius: 14px !important;
    box-shadow: 0 24px 90px rgba(0, 0, 0, .35) !important;
}

.chat-media-viewer-close {
    top: max(14px, env(safe-area-inset-top)) !important;
    right: max(14px, env(safe-area-inset-right)) !important;
    width: 46px !important;
    height: 46px !important;
    background: rgba(15, 23, 42, .38) !important;
    color: #fff !important;
    border: 1px solid rgba(255,255,255,.16) !important;
    backdrop-filter: blur(10px) !important;
    box-shadow: none !important;
}

.chat-media-viewer-close:hover {
    background: rgba(15, 23, 42, .62) !important;
}

.chat-media-viewer-footer {
    position: absolute !important;
    left: 50% !important;
    bottom: max(18px, env(safe-area-inset-bottom)) !important;
    transform: translateX(-50%) !important;
    width: auto !important;
    max-width: calc(100vw - 32px) !important;
    padding: 8px !important;
    border-radius: 999px !important;
    background: rgba(15, 23, 42, .38) !important;
    border: 1px solid rgba(255,255,255,.14) !important;
    backdrop-filter: blur(14px) !important;
    display: flex !important;
    gap: 10px !important;
    align-items: center !important;
    justify-content: center !important;
}

.chat-media-viewer-title {
    display: none !important;
}

.chat-media-viewer-actions {
    display: inline-flex !important;
    gap: 6px !important;
    flex-wrap: nowrap !important;
    justify-content: center !important;
}

.chat-media-action {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 40px !important;
    padding: 0 16px !important;
    border-radius: 999px !important;
    color: #fff !important;
    text-decoration: none !important;
    font-weight: 700 !important;
    background: rgba(255,255,255,.10) !important;
    border: 1px solid rgba(255,255,255,.12) !important;
    cursor: pointer !important;
}

.chat-media-action:hover {
    background: rgba(255,255,255,.18) !important;
}

@media (max-width: 520px) {
    .chat-media-viewer-stage {
        padding: 8px !important;
    }

    .chat-media-viewer-media {
        max-width: 100% !important;
        max-height: calc(100dvh - 86px) !important;
        border-radius: 10px !important;
    }

    .chat-media-viewer-close {
        width: 42px !important;
        height: 42px !important;
        font-size: 26px !important;
    }

    .chat-media-viewer-footer {
        bottom: max(12px, env(safe-area-inset-bottom)) !important;
        max-width: calc(100vw - 20px) !important;
    }

    .chat-media-action {
        min-height: 38px !important;
        padding: 0 14px !important;
        font-size: .86rem !important;
    }
}

/* ===== STAGE 11D: final chat bottom edge + true fullscreen media viewer ===== */
/* Используем grid-высоту приложения вместо рискованного calc, чтобы input не уходил ниже viewport на ПК */
body[data-page="chats"] .app {
    height: 100dvh !important;
    min-height: 100dvh !important;
    grid-template-rows: auto var(--app-menu-bar-h, 0px) minmax(0, 1fr) !important;
    overflow: hidden !important;
}

body[data-page="chats"] .main-content {
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    overflow: hidden !important;
}

body[data-page="chats"] .page-content {
    height: 100% !important;
    max-height: 100% !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
}

.chats-page,
.chats-container {
    height: 100% !important;
    max-height: 100% !important;
    min-height: 0 !important;
    overflow: hidden !important;
}

.chat-active {
    height: 100% !important;
    max-height: 100% !important;
    min-height: 0 !important;
    overflow: hidden !important;
}

.chat-messages {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    padding-bottom: 14px !important;
}

.chat-input-area {
    flex: 0 0 auto !important;
    position: relative !important;
    bottom: auto !important;
    margin: 0 !important;
    padding-bottom: 10px !important;
    transform: translateY(0) !important;
}

@media (min-width: 1025px) {
    .chat-input-area {
        padding-top: 10px !important;
        padding-bottom: 10px !important;
    }
}

/* Фото/видео viewer: само медиа занимает максимум экрана, кнопки прозрачным оверлеем */
.chat-media-viewer-stage {
    position: absolute !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100dvh !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: transparent !important;
}

.chat-media-viewer-media {
    width: auto !important;
    height: auto !important;
    max-width: 100vw !important;
    max-height: 100dvh !important;
    object-fit: contain !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
}

.chat-media-viewer-panel {
    overflow: hidden !important;
}

.chat-media-viewer-close {
    background: rgba(15, 23, 42, .28) !important;
    border-color: rgba(255,255,255,.18) !important;
}

.chat-media-viewer-footer {
    z-index: 5 !important;
    bottom: max(18px, env(safe-area-inset-bottom)) !important;
    background: rgba(15, 23, 42, .28) !important;
}

.chat-media-action {
    background: rgba(255,255,255,.08) !important;
    border-color: rgba(255,255,255,.14) !important;
}

@media (max-width: 520px) {
    .chat-media-viewer-stage {
        padding: 0 !important;
    }

    .chat-media-viewer-media {
        max-width: 100vw !important;
        max-height: 100dvh !important;
        border-radius: 0 !important;
    }

    .chat-input-area {
        padding-bottom: calc(8px + env(safe-area-inset-bottom)) !important;
    }
}

/* ===== STAGE 11E: media viewer true edge-to-edge override + bottom input safe edge ===== */
/* Сам overlay должен занимать весь экран без внутренних max-width/max-height из старых правил */
.chat-media-viewer:not(.hidden),
.chat-media-viewer:not(.hidden) .chat-media-viewer-backdrop,
.chat-media-viewer:not(.hidden) .chat-media-viewer-panel,
.chat-media-viewer:not(.hidden) .chat-media-viewer-stage {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100dvh !important;
    min-width: 100vw !important;
    min-height: 100dvh !important;
    max-width: 100vw !important;
    max-height: 100dvh !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
    overflow: hidden !important;
}

.chat-media-viewer:not(.hidden) {
    z-index: 20000 !important;
    background: rgba(2, 6, 23, .96) !important;
}

.chat-media-viewer:not(.hidden) .chat-media-viewer-backdrop {
    z-index: 0 !important;
    background: rgba(2, 6, 23, .96) !important;
    backdrop-filter: blur(10px) !important;
}

.chat-media-viewer:not(.hidden) .chat-media-viewer-panel {
    z-index: 1 !important;
    display: block !important;
}

.chat-media-viewer:not(.hidden) .chat-media-viewer-stage {
    z-index: 1 !important;
    display: grid !important;
    place-items: center !important;
}

/* Важно: элемент media сам занимает весь viewport, а картинка вписывается без рамки.
   На портретных скринах это даёт максимальный размер по высоте, как в мессенджерах. */
.chat-media-viewer:not(.hidden) .chat-media-viewer-media {
    display: block !important;
    width: 100vw !important;
    height: 100dvh !important;
    max-width: 100vw !important;
    max-height: 100dvh !important;
    object-fit: contain !important;
    object-position: center center !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
}

.chat-media-viewer:not(.hidden) .chat-media-viewer-close {
    position: fixed !important;
    z-index: 3 !important;
    top: max(12px, env(safe-area-inset-top)) !important;
    right: max(12px, env(safe-area-inset-right)) !important;
    width: 46px !important;
    height: 46px !important;
    border-radius: 50% !important;
    background: rgba(15, 23, 42, .28) !important;
    border: 1px solid rgba(255,255,255,.18) !important;
    color: #fff !important;
    backdrop-filter: blur(10px) !important;
}

.chat-media-viewer:not(.hidden) .chat-media-viewer-footer {
    position: fixed !important;
    z-index: 3 !important;
    left: 50% !important;
    right: auto !important;
    bottom: max(14px, env(safe-area-inset-bottom)) !important;
    transform: translateX(-50%) !important;
    width: auto !important;
    max-width: calc(100vw - 20px) !important;
    padding: 7px !important;
    border-radius: 999px !important;
    background: rgba(15, 23, 42, .22) !important;
    border: 1px solid rgba(255,255,255,.14) !important;
    backdrop-filter: blur(14px) !important;
}

.chat-media-viewer:not(.hidden) .chat-media-action {
    min-height: 38px !important;
    padding: 0 15px !important;
    border-radius: 999px !important;
    background: rgba(255,255,255,.08) !important;
    border: 1px solid rgba(255,255,255,.14) !important;
    color: #fff !important;
}

/* ПК: не даём input упираться ниже нижней границы окна */
@media (min-width: 1025px) {
    body[data-page="chats"] .app {
        height: 100vh !important;
        max-height: 100vh !important;
    }

    body[data-page="chats"] .main-content,
    body[data-page="chats"] .page-content,
    .chats-page,
    .chats-container,
    .chat-main,
    .chat-active {
        min-height: 0 !important;
        overflow: hidden !important;
    }

    .chat-input-area {
        padding-bottom: 8px !important;
        border-bottom-left-radius: 0 !important;
        border-bottom-right-radius: 0 !important;
    }
}

@media (max-width: 520px) {
    .chat-media-viewer:not(.hidden) .chat-media-viewer-close {
        width: 42px !important;
        height: 42px !important;
    }

    .chat-media-viewer:not(.hidden) .chat-media-viewer-footer {
        bottom: max(10px, env(safe-area-inset-bottom)) !important;
        padding: 6px !important;
    }

    .chat-media-viewer:not(.hidden) .chat-media-action {
        min-height: 36px !important;
        padding: 0 12px !important;
        font-size: .84rem !important;
    }
}


/* ===== STAGE 11F: Voice messages polish ===== */
.voice-recording-bar {
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: 86px;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 22px;
    background: rgba(15, 20, 34, 0.92);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-xl);
    backdrop-filter: blur(14px);
}
.voice-recording-bar.hidden { display: none !important; }
.voice-rec-left,
.voice-rec-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
.voice-rec-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--danger);
    animation: voicePulse 1.2s ease-in-out infinite;
}
@keyframes voicePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .45; }
}
.voice-rec-label {
    font-weight: 800;
    color: var(--text);
}
.voice-rec-time {
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    min-width: 42px;
}
.voice-rec-btn {
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 8px 12px;
    font-weight: 800;
    cursor: pointer;
}
.voice-rec-btn.ghost {
    background: rgba(255,255,255,.06);
    color: var(--text-secondary);
}
.voice-rec-btn.primary {
    background: var(--primary);
    color: #fff;
    border-color: transparent;
}
#voice-record-btn.recording {
    color: #fff;
    background: var(--danger);
    box-shadow: 0 0 0 4px var(--danger-light);
}
.voice-message {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: min(280px, 72vw);
}
.voice-message-icon {
    width: 38px;
    height: 38px;
    border-radius: 999px;
    background: rgba(255,255,255,.16);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 38px;
}
.message.received .voice-message-icon {
    background: var(--primary-light);
    color: var(--primary);
}
.voice-message-main {
    min-width: 0;
    flex: 1;
}
.voice-message-main audio {
    width: 100%;
    max-width: 280px;
    height: 36px;
    display: block;
}
.voice-message-main small {
    display: block;
    margin-top: 3px;
    color: currentColor;
    opacity: .72;
}
body.theme-light .voice-recording-bar {
    background: rgba(255,255,255,.96);
    border-color: rgba(15,23,42,.10);
}
@media (max-width: 768px) {
    .voice-recording-bar {
        left: 10px;
        right: 10px;
        bottom: calc(74px + env(safe-area-inset-bottom));
        padding: 10px;
        border-radius: 18px;
    }
    .voice-rec-label { display: none; }
    .voice-rec-actions { gap: 6px; }
    .voice-rec-btn { padding: 8px 10px; }
    .voice-message { min-width: min(250px, 76vw); }
    .voice-message-main audio { max-width: 220px; }
}

/* ===== STAGE 11G: premium voice messages + hashed storage UI ===== */
.voice-message {
    display: grid !important;
    grid-template-columns: 44px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    min-width: min(340px, 76vw) !important;
    max-width: min(380px, 82vw);
    padding: 4px 2px;
}
.voice-play-btn {
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: rgba(255,255,255,.18);
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.16);
    transition: transform .15s ease, background .15s ease;
    flex: 0 0 44px;
}
.voice-play-btn:hover { transform: scale(1.04); background: rgba(255,255,255,.24); }
.message.received .voice-play-btn {
    background: var(--primary-light);
    color: var(--primary);
    box-shadow: inset 0 0 0 1px var(--border);
}
.voice-play-icon.pause { display: none; }
.voice-message.playing .voice-play-icon.play { display: none; }
.voice-message.playing .voice-play-icon.pause { display: block; }
.voice-message-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.voice-wave {
    height: 26px;
    display: flex;
    align-items: center;
    gap: 3px;
    overflow: hidden;
}
.voice-wave span {
    width: 3px;
    border-radius: 999px;
    background: currentColor;
    opacity: .58;
    display: block;
}
.voice-wave span:nth-child(1) { height: 9px; opacity: .38; }
.voice-wave span:nth-child(2) { height: 15px; opacity: .55; }
.voice-wave span:nth-child(3) { height: 22px; opacity: .72; }
.voice-wave span:nth-child(4) { height: 13px; opacity: .5; }
.voice-wave span:nth-child(5) { height: 25px; opacity: .78; }
.voice-wave span:nth-child(6) { height: 17px; opacity: .62; }
.voice-wave span:nth-child(7) { height: 10px; opacity: .42; }
.voice-wave span:nth-child(8) { height: 21px; opacity: .68; }
.voice-wave span:nth-child(9) { height: 14px; opacity: .54; }
.voice-wave span:nth-child(10) { height: 8px; opacity: .36; }
.voice-message.playing .voice-wave span {
    animation: voiceWavePulse .9s ease-in-out infinite alternate;
}
.voice-message.playing .voice-wave span:nth-child(2n) { animation-delay: .12s; }
.voice-message.playing .voice-wave span:nth-child(3n) { animation-delay: .22s; }
@keyframes voiceWavePulse {
    from { transform: scaleY(.65); opacity: .42; }
    to { transform: scaleY(1.08); opacity: .9; }
}
.voice-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: .76rem;
    line-height: 1.2;
    opacity: .82;
}
.voice-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.voice-duration {
    font-variant-numeric: tabular-nums;
    flex: 0 0 auto;
}
.voice-message audio {
    display: none !important;
}
body.theme-light .message.sent .voice-play-btn {
    background: rgba(255,255,255,.22);
    color: #fff;
}
body.theme-light .message.received .voice-message {
    color: var(--text);
}
@media (max-width: 768px) {
    .voice-message {
        min-width: min(270px, 78vw) !important;
        max-width: 78vw;
        grid-template-columns: 40px minmax(0, 1fr);
        gap: 10px;
    }
    .voice-play-btn {
        width: 40px;
        height: 40px;
        flex-basis: 40px;
    }
    .voice-wave { height: 22px; }
    .voice-meta { font-size: .72rem; }
}

/* ===== STAGE 11J: Telegram-like voice recorder and playback progress ===== */
.chat-input-area.voice-recording-active {
    gap: 0 !important;
}
.chat-input-area.voice-recording-active .chat-input-actions,
.chat-input-area.voice-recording-active .chat-input-wrapper,
.chat-input-area.voice-recording-active #send-message-btn {
    display: none !important;
}
.voice-recording-bar {
    position: static !important;
    inset: auto !important;
    z-index: 1 !important;
    width: 100% !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 10px !important;
    min-height: 48px;
    border-radius: 24px !important;
    background: var(--bg-tertiary) !important;
    border: 1px solid var(--border) !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
}
.voice-recording-bar.hidden { display: none !important; }
.voice-rec-left {
    min-width: 0;
    flex: 1;
    display: flex;
    align-items: center;
    gap: 9px;
}
.voice-rec-label {
    font-size: .78rem;
    font-weight: 500;
    white-space: nowrap;
}
.voice-rec-time {
    font-size: .86rem;
    font-variant-numeric: tabular-nums;
    color: var(--text);
    font-weight: 600;
    letter-spacing: .025em;
}
.voice-rec-wave {
    flex: 1 1 100px;
    min-width: 48px;
    max-width: 180px;
    height: 30px;
    display: flex;
    align-items: center;
    gap: 2px;
    color: var(--text-secondary);
    opacity: .92;
}
.voice-rec-wave span {
    flex: 1 1 3px;
    min-width: 1px;
    max-width: 3px;
    height: 28px;
    border-radius: 999px;
    background: currentColor;
    transform-origin: center;
    transform: scaleY(.18);
    opacity: .42;
    transition: transform 90ms linear, opacity 90ms linear;
}
@media (prefers-reduced-motion: reduce) {
    .voice-rec-dot { animation: none; }
    .voice-rec-wave span { transition: none; }
}
.voice-rec-actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
}
.voice-rec-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
    touch-action: manipulation;
    border-radius: 999px !important;
    font-size: .82rem;
}
.voice-message {
    --voice-progress: 0%;
}
.voice-progress {
    position: relative;
    isolation: isolate;
    padding: 0 2px;
}
.voice-progress-fill {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--voice-progress, 0%);
    border-radius: 999px;
    background: currentColor;
    opacity: .18;
    z-index: -1;
    transition: width .08s linear;
}
.voice-message.playing .voice-progress-fill {
    opacity: .24;
}
body.theme-light .voice-recording-bar {
    background: #fff !important;
    border-color: rgba(15,23,42,.10) !important;
}
@media (max-width: 520px) {
    .voice-rec-label { display: none; }
    .voice-rec-wave { min-width: 42px; }
    .voice-rec-btn { padding: 0 !important; }
    .voice-recording-bar { min-height: 46px; padding: 7px 8px !important; }
}

/* ===== STAGE 11K: voice recorder level meter / anti-silent UI ===== */
.voice-rec-wave {
    align-items: center !important;
    gap: 2px !important;
}
.voice-rec-level {
    font-size: 0.68rem;
    line-height: 1;
    color: var(--text-muted);
    white-space: nowrap;
    margin-left: 4px;
}
.voice-rec-level.ok { color: var(--success); }
.voice-rec-level.silent { color: var(--warning); }
@media (max-width: 520px) {
    .voice-rec-level { display: none; }
}


/* ===== STAGE 11L: mobile chat input safe viewport + cleaner voice recorder ===== */
/* Убираем диагностическую подпись уровня микрофона: оставляем только живую волну записи. */
.voice-rec-level {
    display: none !important;
}

@media (max-width: 768px) {
    body[data-page="chats"],
    body[data-page="chats"] .app {
        height: var(--chat-vh, 100dvh) !important;
        min-height: var(--chat-vh, 100dvh) !important;
        max-height: var(--chat-vh, 100dvh) !important;
        overflow: hidden !important;
    }

    body[data-page="chats"] .main-content {
        height: calc(var(--chat-vh, 100dvh) - var(--chat-header-h, 60px)) !important;
        min-height: 0 !important;
        max-height: calc(var(--chat-vh, 100dvh) - var(--chat-header-h, 60px)) !important;
        overflow: hidden !important;
    }

    body[data-page="chats"] .page-content,
    .chats-page,
    .chats-container,
    .chat-main,
    .chat-active {
        height: 100% !important;
        min-height: 0 !important;
        max-height: 100% !important;
        overflow: hidden !important;
    }

    .chat-active:not(.hidden) {
        display: grid !important;
        grid-template-rows: auto minmax(0, 1fr) auto !important;
    }

    .chat-messages {
        min-height: 0 !important;
        overflow-y: auto !important;
        padding-bottom: 10px !important;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }

    .chat-input-area {
        width: 100% !important;
        min-height: 58px !important;
        flex: 0 0 auto !important;
        align-items: center !important;
        padding: 8px 10px calc(8px + env(safe-area-inset-bottom)) !important;
        border-top: 1px solid var(--border) !important;
        transform: translateZ(0) !important;
    }

    .chat-input-wrapper {
        min-width: 0 !important;
    }

    .chat-input-wrapper textarea {
        min-height: 42px !important;
        max-height: 96px !important;
        padding-top: 10px !important;
        padding-bottom: 10px !important;
    }

    #send-message-btn {
        flex: 0 0 44px !important;
        width: 44px !important;
        height: 44px !important;
        margin: 0 !important;
    }

    .chat-input-actions {
        flex: 0 0 auto !important;
        margin: 0 !important;
    }

    .voice-recording-bar {
        min-width: 0 !important;
        min-height: 46px !important;
        padding: 7px 8px !important;
    }

    .voice-rec-left {
        min-width: 0 !important;
    }

    .voice-rec-wave {
        flex: 1 1 auto !important;
        min-width: 48px !important;
        max-width: 110px !important;
    }

    .voice-rec-actions {
        flex: 0 0 auto !important;
    }
}

@media (max-width: 380px) {
    .voice-rec-time { font-size: .78rem !important; }
    .voice-rec-btn { padding: 0 !important; font-size: .76rem !important; }
}

/* ===== STAGE 11N: full-width waveform voice player ===== */
.voice-message {
    --voice-progress: 0%;
    grid-template-columns: 48px minmax(190px, 1fr) !important;
    gap: 14px !important;
    min-width: min(440px, 82vw) !important;
    max-width: min(500px, 86vw) !important;
    width: min(500px, 86vw);
    padding: 6px 2px !important;
}
.voice-message-main {
    gap: 5px !important;
    width: 100%;
}
.voice-progress,
.voice-wave {
    width: 100% !important;
    height: 40px !important;
    min-width: 0;
    position: relative;
    display: block !important;
    padding: 0 !important;
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    overflow: hidden;
    isolation: isolate;
}
.voice-progress:focus-visible {
    outline: 2px solid rgba(255,255,255,.45);
    outline-offset: 4px;
    border-radius: 999px;
}
.message.received .voice-progress:focus-visible {
    outline-color: var(--primary);
}
.voice-wave-bars {
    position: absolute;
    inset: 0;
    display: flex !important;
    align-items: center;
    gap: 3px;
    width: 100%;
    height: 100%;
    overflow: hidden;
}
.voice-wave-bars span,
.voice-wave span {
    flex: 1 1 0;
    min-width: 2px;
    max-width: 5px;
    height: var(--h, 18px) !important;
    border-radius: 999px;
    background: currentColor;
    opacity: .38;
    display: block;
    transform-origin: center;
}
.voice-wave-played {
    position: absolute;
    inset: 0;
    width: 100%;
    overflow: hidden;
    color: #ffffff;
    pointer-events: none;
    clip-path: inset(0 calc(100% - var(--voice-progress, 0%)) 0 0);
    transition: clip-path .08s linear;
    z-index: 2;
}
.message.received .voice-wave-played {
    color: var(--primary);
}
.voice-wave-played .voice-wave-bars {
    width: 100%;
    min-width: 100%;
}
.voice-wave-played .voice-wave-bars span {
    opacity: .95;
}
.voice-wave-thumb {
    position: absolute;
    top: 50%;
    left: var(--voice-progress, 0%);
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: currentColor;
    opacity: 0;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 0 4px rgba(255,255,255,.12);
    transition: opacity .14s ease, left .08s linear;
    z-index: 3;
    pointer-events: none;
}
.voice-message.playing .voice-wave-thumb,
.voice-message:hover .voice-wave-thumb {
    opacity: .9;
}
.voice-message.playing .voice-wave span {
    animation: none !important;
}
.voice-meta {
    display: grid !important;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 8px !important;
    font-size: .76rem !important;
    opacity: .86 !important;
}
.voice-current,
.voice-duration {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    opacity: .92;
}
.voice-label {
    text-align: left;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    opacity: .9;
}
.message.sent .voice-wave-bars span { opacity: .42; }
.message.sent .voice-wave-played .voice-wave-bars span { opacity: 1; }
.message.received .voice-wave-bars span { opacity: .34; }
body.theme-light .message.sent .voice-wave-played { color: #fff; }
body.theme-light .message.received .voice-wave-played { color: var(--primary); }
@media (max-width: 768px) {
    .voice-message {
        width: min(360px, 82vw) !important;
        min-width: min(300px, 80vw) !important;
        max-width: 82vw !important;
        grid-template-columns: 42px minmax(0, 1fr) !important;
        gap: 10px !important;
    }
    .voice-progress,
    .voice-wave { height: 34px !important; }
    .voice-wave-bars { gap: 2px; }
    .voice-wave-bars span,
    .voice-wave span {
        min-width: 2px;
        max-width: 4px;
        height: calc(var(--h, 18px) * .82) !important;
    }
    .voice-meta { font-size: .7rem !important; gap: 6px !important; }
}
@media (max-width: 420px) {
    .voice-message {
        width: min(310px, 78vw) !important;
        min-width: min(260px, 76vw) !important;
        max-width: 78vw !important;
    }
    .voice-wave-bars span,
    .voice-wave span { max-width: 3px; }
    .voice-label { display: none; }
    .voice-meta { grid-template-columns: auto 1fr; }
    .voice-duration { text-align: right; }
}

/* ===== STAGE 11O: voice overflow / no horizontal scrollbar ===== */
.chat-main,
.chat-active,
.chat-messages {
    overflow-x: hidden !important;
}

.message {
    overflow: hidden !important;
}

.message-content {
    min-width: 0 !important;
    max-width: 100% !important;
    overflow: hidden !important;
}

.voice-message {
    box-sizing: border-box !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    grid-template-columns: 48px minmax(0, 1fr) !important;
}

.voice-message-main,
.voice-progress,
.voice-wave,
.voice-meta,
.voice-wave-bars,
.voice-wave-played {
    min-width: 0 !important;
    max-width: 100% !important;
}

.voice-wave,
.voice-progress {
    width: 100% !important;
}

.voice-wave-bars {
    left: 0 !important;
    right: 0 !important;
}

.voice-wave-bars span,
.voice-wave span {
    flex: 1 1 0 !important;
    min-width: 0 !important;
}

@media (min-width: 769px) {
    .message .voice-message {
        width: min(100%, 480px) !important;
        max-width: min(100%, 480px) !important;
    }
}

@media (max-width: 768px) {
    .voice-message {
        grid-template-columns: 42px minmax(0, 1fr) !important;
        gap: 10px !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
    }

    .message {
        max-width: 88% !important;
    }
}

/* ===== STAGE 11P: rollback bad voice overflow constraints / stable voice layout ===== */
/* 11O слишком агрессивно обрезал контент сообщений. Возвращаем нормальное поведение. */
.chat-main,
.chat-active,
.chat-messages {
    min-width: 0 !important;
    overflow-x: hidden !important;
}

.message,
.message-content {
    overflow: visible !important;
}

.message:has(.voice-message) {
    box-sizing: border-box !important;
    width: min(500px, 72%) !important;
    max-width: min(500px, 72%) !important;
    min-width: min(360px, 72%) !important;
    padding: 10px 12px !important;
}

.message:has(.voice-message) .message-content {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
}

.voice-message {
    box-sizing: border-box !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    display: grid !important;
    grid-template-columns: 48px minmax(0, 1fr) !important;
    align-items: center !important;
    gap: 14px !important;
}

.voice-message-main {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    overflow: hidden !important;
}

.voice-progress,
.voice-wave {
    box-sizing: border-box !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    overflow: hidden !important;
}

.voice-wave-bars {
    box-sizing: border-box !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    overflow: hidden !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 2px !important;
}

.voice-wave-bars span,
.voice-wave span {
    flex: 1 1 0 !important;
    min-width: 2px !important;
    max-width: 4px !important;
}

.voice-meta {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
}

@media (max-width: 768px) {
    .message:has(.voice-message) {
        width: 88% !important;
        max-width: 88% !important;
        min-width: 0 !important;
    }

    .voice-message {
        grid-template-columns: 42px minmax(0, 1fr) !important;
        gap: 10px !important;
    }

    .voice-wave-bars span,
    .voice-wave span {
        min-width: 2px !important;
        max-width: 3px !important;
    }
}

@media (max-width: 420px) {
    .message:has(.voice-message) {
        width: 90% !important;
        max-width: 90% !important;
    }

    .voice-label {
        display: inline !important;
    }
}

/* ===== STAGE 11R: cleaner message actions, inline edit, forward attribution ===== */
.message {
    overflow: visible !important;
}

.message-content {
    min-width: 0 !important;
}

.message-forwarded-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    margin-bottom: 6px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: .72rem;
    line-height: 1;
    font-weight: 800;
    color: rgba(255,255,255,.82);
    background: rgba(255,255,255,.12);
}
.message.received .message-forwarded-badge {
    color: var(--primary);
    background: var(--primary-light);
}
.message-forwarded-badge span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.message-actions-menu {
    position: static !important;
    display: flex !important;
    justify-content: flex-end !important;
    align-items: center !important;
    gap: 6px !important;
    margin-top: 7px !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transform: translateY(-2px) !important;
    transition: opacity .14s ease, transform .14s ease !important;
}
.message:hover .message-actions-menu,
.message:focus-within .message-actions-menu,
.message-actions-menu:hover {
    opacity: 1 !important;
    pointer-events: auto !important;
    transform: translateY(0) !important;
}
.message-action-btn {
    width: 30px;
    height: 30px;
    min-width: 30px;
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: inherit;
    background: rgba(255,255,255,.10);
    cursor: pointer;
    transition: transform .12s ease, background .12s ease, border-color .12s ease;
}
.message-action-btn:hover {
    transform: translateY(-1px);
    background: rgba(255,255,255,.18);
    border-color: rgba(255,255,255,.28);
}
.message.received .message-action-btn {
    background: var(--bg-secondary);
    border-color: var(--border);
    color: var(--text-muted);
}
.message.received .message-action-btn:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: var(--primary-light);
}
.message-action-btn.danger:hover {
    color: var(--danger) !important;
    border-color: var(--danger) !important;
    background: color-mix(in srgb, var(--danger) 10%, transparent) !important;
}
.message-action-btn:disabled {
    display: none !important;
}

.chat-edit-inline {
    width: 100%;
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) 34px;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    padding: 9px 10px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: var(--bg-tertiary);
}
.chat-edit-inline.hidden { display: none !important; }
.chat-edit-inline-icon {
    width: 36px;
    height: 36px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    color: var(--primary);
}
.chat-edit-inline-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.chat-edit-inline-text b {
    font-size: .82rem;
    color: var(--primary);
}
.chat-edit-inline-text span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-muted);
    font-size: .78rem;
}
.chat-edit-inline-close {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 999px;
    background: var(--bg-secondary);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 20px;
}
.chat-edit-inline-close:hover {
    color: var(--danger);
}

.chat-action-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 30000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(2, 6, 23, .58);
    backdrop-filter: blur(10px);
}
.chat-action-modal {
    width: min(460px, calc(100vw - 24px));
    max-height: min(680px, calc(100dvh - 32px));
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 12px;
    border-radius: 24px;
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: 0 28px 80px rgba(0,0,0,.34);
    padding: 16px;
}
.chat-action-modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}
.chat-action-modal-head b { display:block; font-size: 1rem; }
.chat-action-modal-head small { display:block; margin-top: 4px; color: var(--text-muted); line-height:1.35; }
.chat-action-modal-close {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 999px;
    background: var(--bg-tertiary);
    color: var(--text);
    cursor: pointer;
    font-size: 22px;
}
.chat-forward-origin-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--bg-tertiary);
    color: var(--text);
    font-weight: 700;
    font-size: .84rem;
}
.chat-forward-origin-toggle input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}
.chat-forward-search {
    width: 100%;
    border: 1px solid var(--border);
    background: var(--bg-tertiary);
    color: var(--text);
    border-radius: 16px;
    padding: 12px 14px;
    outline: none;
}
.chat-forward-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    padding-right: 2px;
}
.chat-forward-user {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--bg-secondary);
    color: var(--text);
    padding: 10px;
    cursor: pointer;
    text-align: left;
}
.chat-forward-user:hover { border-color: var(--primary); background: var(--primary-light); }
.chat-forward-avatar {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-weight: 900;
}
.chat-forward-user b,
.chat-forward-user small {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.chat-forward-user small { color: var(--text-muted); margin-top: 2px; }
.chat-forward-empty {
    padding: 18px;
    text-align: center;
    color: var(--text-muted);
}
.chat-action-row {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .message-actions-menu {
        opacity: 1 !important;
        pointer-events: auto !important;
        justify-content: flex-end !important;
    }
    .message-action-btn {
        width: 28px;
        height: 28px;
        min-width: 28px;
    }
}
@media (max-width: 520px) {
    .chat-action-modal-overlay {
        align-items: flex-end;
        padding: 10px;
    }
    .chat-action-modal {
        width: 100%;
        border-radius: 24px 24px max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-bottom));
        max-height: calc(100dvh - 24px);
    }
    .chat-edit-inline {
        grid-template-columns: 32px minmax(0, 1fr) 32px;
        border-radius: 16px;
        padding: 8px;
    }
    .chat-edit-inline-icon,
    .chat-edit-inline-close {
        width: 32px;
        height: 32px;
    }
}

/* ===== STAGE 11S: mobile action sheet, compact quick actions, non-breaking inline edit ===== */
.message-actions-menu {
    position: static !important;
    display: flex !important;
    justify-content: flex-end !important;
    align-items: center !important;
    gap: 5px !important;
    margin-top: 5px !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    opacity: .72 !important;
    pointer-events: auto !important;
    transform: none !important;
}
.message:hover .message-actions-menu,
.message:focus-within .message-actions-menu,
.message-actions-menu:hover {
    opacity: 1 !important;
    transform: none !important;
}
.message-action-btn {
    width: 24px !important;
    height: 24px !important;
    min-width: 24px !important;
    border: 0 !important;
    border-radius: 999px !important;
    background: rgba(255,255,255,.10) !important;
    color: currentColor !important;
    opacity: .78;
}
.message-action-btn svg { width: 13px !important; height: 13px !important; }
.message-action-btn:hover { opacity: 1; transform: translateY(-1px); }
.message.received .message-action-btn {
    background: rgba(99,102,241,.08) !important;
    color: var(--text-muted) !important;
}
.message.received .message-action-btn:hover { color: var(--primary) !important; }

.message-forwarded-user {
    border: 0;
    padding: 0;
    margin: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: 900;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.message-forwarded-user:hover { opacity: .82; }
.message-forwarded-user:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
    border-radius: 4px;
}

.chat-input-area {
    position: relative !important;
}
.chat-edit-inline {
    position: absolute !important;
    left: 74px !important;
    bottom: calc(100% + 8px) !important;
    z-index: 30 !important;
    width: auto !important;
    max-width: calc(100% - 92px) !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    margin: 0 !important;
    padding: 6px 8px 6px 10px !important;
    border-radius: 999px !important;
    border: 1px solid var(--border) !important;
    background: color-mix(in srgb, var(--bg-secondary) 92%, transparent) !important;
    box-shadow: var(--shadow-md) !important;
    backdrop-filter: blur(10px);
}
.chat-edit-inline.hidden { display: none !important; }
.chat-edit-inline-chip {
    font-size: .76rem;
    line-height: 1;
    font-weight: 800;
    color: var(--primary);
    white-space: nowrap;
}
.chat-edit-inline-icon,
.chat-edit-inline-text { display: none !important; }
.chat-edit-inline-close {
    width: 22px !important;
    height: 22px !important;
    min-width: 22px !important;
    font-size: 16px !important;
    line-height: 1 !important;
    border-radius: 999px !important;
    background: var(--bg-tertiary) !important;
}
.chat-input-area.editing-mode .chat-input-wrapper {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 2px var(--primary-light) !important;
}

.chat-message-action-sheet.hidden { display: none !important; }
.chat-message-action-sheet {
    position: fixed;
    inset: 0;
    z-index: 32000;
    display: flex;
    /* Column so the selected-message layer stacks ABOVE the action panel
       (both centered horizontally, anchored to the bottom). */
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
}
.chat-message-action-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2,6,23,.42);
    backdrop-filter: blur(8px);
}
.chat-message-action-panel {
    position: relative;
    z-index: 1;
    --message-action-text: var(--text);
    --message-action-icon: var(--text-secondary);
    width: min(420px, calc(100vw - 18px));
    margin: 0 9px max(9px, env(safe-area-inset-bottom));
    padding: 10px;
    max-height: calc(100vh - 36px - env(safe-area-inset-bottom, 0px));
    max-height: calc(100dvh - 36px - env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
    border-radius: 24px;
    /* Same neutral glass as the avatar three-dot menu, with a little more
       transparency so the chat wallpaper softly shows through. */
    border: 1px solid var(--border);
    color: var(--message-action-text);
    background: color-mix(in srgb, var(--bg-modal) 88%, transparent);
    box-shadow: 0 24px 70px rgba(0,0,0,.45);
    backdrop-filter: blur(24px) saturate(120%);
    -webkit-backdrop-filter: blur(24px) saturate(120%);
    animation: chatSheetUp .18s ease;
}
@keyframes chatSheetUp {
    from { transform: translateY(18px); opacity: .4; }
    to { transform: translateY(0); opacity: 1; }
}
/* #7: drag-zone — узкая (не вся панель) зона над меню, ловит вертикальный
   pointer-жест для swipe-down close. touch-action:none обязателен, иначе iOS
   Safari забирает вертикаль под скролл и жест не доходит. */
.chat-message-action-dragzone {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    margin: -4px -10px 4px;
    touch-action: none;
    cursor: grab;
}
.chat-message-action-dragzone:active { cursor: grabbing; }
.chat-message-action-handle {
    width: 44px;
    height: 4px;
    border-radius: 999px;
    background: var(--border-dark);
    pointer-events: none;
}
.chat-message-action-title {
    /* The dialog keeps its accessible name; a visible heading is redundant. */
    display: none;
    padding: 0 8px 8px;
    font-size: .78rem;
    color: var(--text-muted);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .06em;
}
/* #2: Telegram-like единая reaction-pill — цельный фон, без отдельных рамок.
   Quick-кнопки responsive (flex:1 1 0; min-width:0), поэтому 6 emoji +
   chevron всегда помещаются в ширину панели без overflow; высота ≥44px. */
.chat-reaction-pill {
    display: flex;
    align-items: center;
    gap: 2px;
    margin: 2px 10px 8px;
    padding: 4px 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .07);
    border: 1px solid rgba(255, 255, 255, .08);
    width: auto;
    max-width: calc(100% - 20px);
    box-sizing: border-box;
}
.chat-reaction-pill.hidden { display: none; }
.chat-reaction-quick {
    flex: 1 1 0;
    min-width: 0;
    height: 44px;
    border: 0;
    background: transparent;
    border-radius: 999px;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    text-align: center;
}
.chat-reaction-quick.active {
    background: rgba(109, 93, 252, .28);
}
.chat-reaction-chevron {
    flex: 0 0 auto;
    width: 40px;
    height: 44px;
    margin-inline-start: 2px;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, .12);
    color: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.chat-reaction-chevron svg { transition: transform .18s ease; }
.chat-reaction-chevron.expanded svg { transform: rotate(180deg); }
body.theme-light .chat-reaction-pill {
    background: rgba(15, 23, 42, .05);
    border-color: rgba(15, 23, 42, .10);
}
body.theme-light .chat-reaction-chevron { background: rgba(15, 23, 42, .08); }
/* #1: selected-message layer — SIBLING панели (не внутри), над backdrop.
   Выбранное сообщение сохраняет собственную геометрию и выравнивание,
   а панель действий не растягивается. */
.chat-message-selected-layer {
    /* Transparent media captions sit over the dark action scrim in all themes. */
    --selected-preview-text: #f8fafc;
    --selected-preview-muted: #e2e8f0;
    position: relative;
    z-index: 1;
    width: min(420px, calc(100vw - 18px));
    margin: 0 9px 8px;
    box-sizing: border-box;
    display: flex;
    pointer-events: none;
}
.chat-message-selected-layer:empty { display: none; }
/* garant(170): wrapper НЕ обрезает всё сообщение (иначе высокие фото режут
   вместе с временем/реакциями). Ограничивается только media-area через
   --selected-preview-media-max-height, вычисляемую по visualViewport. */
.action-sheet-message-preview {
    max-width: 100%;
    overflow: visible;
    pointer-events: none;
    opacity: .98;
}
/* sent → к правому краю, received → к левому (как в чате). */
/* J3: the layer itself never captures taps, so empty areas fall through to the
   backdrop (close). Only the media wrappers below opt back into pointer-events. */
.chat-message-selected-layer { justify-content: flex-start; pointer-events: none; }
.action-sheet-message-preview.sent { margin-left: auto; }
.action-sheet-message-preview.received { margin-right: auto; }
/* Scoped preview: измеренная ширina bubble, без stretch на всю панель,
   без анимаций/интерактива. */
.action-sheet-message-preview .chat-selected-preview-message {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    animation: none !important;
    pointer-events: none;
}
.action-sheet-message-preview .message-content {
    box-shadow: 0 0 0 2px rgba(109, 93, 252, .55);
}
/* File-card в preview: не растягивается, имя — ellipsis. */
.action-sheet-message-preview .chat-file-card { max-width: 100%; }
.action-sheet-message-preview .chat-file-info b {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
    max-width: 100%;
}
/* garant(170): media-thumb в preview не хранит жёсткую высоту и НЕ режет
   изображение через overflow; letterbox-фон и border-radius сохранены. */
.action-sheet-message-preview .chat-media-thumb,
.action-sheet-message-preview .chat-media-image-btn {
    width: auto !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    display: block !important;
}
/* Обычное фото: целиком (contain, letterbox), высота — по реально доступному
   месту (var), а не по фикс. 30vh; !important перебивает
   chat-attach-image { object-fit: cover !important; max-height: 360px }. */
.action-sheet-message-preview img,
.action-sheet-message-preview video,
.action-sheet-message-preview .chat-attach-image,
.action-sheet-message-preview .message:has(.chat-media-thumb) .chat-attach-image {
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    min-height: 0 !important;
    max-height: var(--selected-preview-media-max-height, 46vh) !important;
    object-fit: contain !important;
    object-position: center !important;
    display: block !important;
    pointer-events: none;
}
/* Video circle остаётся круглым (cover), фикс-размер из chat CSS сохраняется;
   var/contain-правила выше на него не влияют (max-height снят, cover/radius
   возвращены). */
.action-sheet-message-preview .video-circle-message video,
.action-sheet-message-preview .video-circle-message img {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    border-radius: 50% !important;
    object-fit: cover !important;
}
/* J2: the clone lives in #chat-message-selected-layer, OUTSIDE #chat-messages, so
   the chat rules that hide the inner circle duration and lay out the single
   message-time do not reach it — the result was a second, clipped timer. Reapply
   both here so a previewed circle shows exactly one time, under the circle. */
.action-sheet-message-preview .video-circle-duration { display: none !important; }
.action-sheet-message-preview .message:has(.video-circle-message) .message-time {
    position: static !important;
    display: block !important;
    width: fit-content !important;
    margin: 5px 8px 0 auto !important;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    color: var(--text-muted) !important;
    line-height: 1 !important;
    opacity: .78 !important;
    pointer-events: none !important;
}
/* J3: the preview is inert by default (pointer-events:none). Re-enable taps on the
   media wrappers ONLY, so a single delegated handler can route a deliberate tap to
   the canonical viewer/controller. Empty areas stay pass-through so backdrop/
   swipe-down close still work. Inner img/video keep pointer-events:none, so the
   tap lands on the wrapper. */
.action-sheet-message-preview .chat-media-image-btn,
.action-sheet-message-preview .chat-video-attachment,
.action-sheet-message-preview .video-circle-message,
.action-sheet-message-preview .voice-message,
.action-sheet-message-preview .chat-audio-attachment,
.action-sheet-message-preview .chat-file-card {
    pointer-events: auto !important;
    cursor: pointer;
}
.action-sheet-message-preview .chat-video-attachment.playing video { pointer-events: auto !important; }
.action-sheet-message-preview .chat-audio-attachment audio {
    pointer-events: auto !important;
    max-width: 100%;
}
.chat-media-viewer.from-message-sheet { z-index: 33020 !important; }
.chat-media-viewer.from-message-sheet .chat-media-viewer-more,
.chat-media-viewer.from-message-sheet .chat-media-viewer-more-menu { display: none !important; }
/* #3: полный picker из 49 emoji — прозрачные ячейки (не тяжёлые квадраты),
   responsive auto-fit без обрезанного крайнего столбца и без h-scroll. */
.chat-reaction-picker {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
    grid-auto-rows: 44px;
    gap: 2px;
    width: 100%;
    min-width: 0;
    max-height: min(38vh, 280px);
    max-height: min(38dvh, 280px);
    overflow-x: hidden;
    overflow-y: auto;
    box-sizing: border-box;
    padding: 6px 10px calc(10px + env(safe-area-inset-bottom, 0px));
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}
.chat-reaction-picker.hidden { display: none; }
.chat-reaction-pick {
    width: 100%;
    min-width: 0;
    height: 44px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}
.chat-reaction-pick:hover,
.chat-reaction-pick:active { background: rgba(255, 255, 255, .10); }
body.theme-light .chat-reaction-pick:hover,
body.theme-light .chat-reaction-pick:active { background: rgba(15, 23, 42, .06); }
/* 8 колонок на средних, 7 на узких — по числу колонок, а не min-width. */
.chat-reaction-picker { grid-template-columns: repeat(8, minmax(0, 1fr)); }
@media (max-width: 360px) {
    .chat-reaction-picker { grid-template-columns: repeat(7, minmax(0, 1fr)); }
}
.chat-sheet-action {
    width: 100%;
    min-height: 48px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 12px;
    border: 0;
    border-radius: 16px;
    background: transparent;
    color: var(--message-action-text, var(--text));
    font-weight: 800;
    cursor: pointer;
    text-align: start;
}
.chat-sheet-action > span {
    min-width: 0;
    overflow-wrap: anywhere;
    text-align: start;
}
.chat-sheet-action:hover { background: var(--bg-hover); }
.chat-sheet-action svg { color: var(--message-action-icon, var(--primary)); flex: 0 0 auto; }
.chat-sheet-action.danger { color: var(--danger); }
.chat-sheet-action.danger svg { color: var(--danger); }
.chat-sheet-action[hidden] { display: none !important; }
.chat-message-action-panel .chat-sheet-action.danger {
    margin-top: 4px;
    box-shadow: inset 0 1px 0 var(--border);
}
.chat-message-action-panel :is(button, [href], [tabindex]):focus-visible {
    outline: 2px solid color-mix(in srgb, var(--primary) 78%, white 22%);
    outline-offset: 2px;
}

/* Mouse and touch now use the same anchored popup lifecycle. */
@media all {
    .chat-message-action-sheet[data-presentation="popover"] {
        display: block;
        pointer-events: none;
    }
    .chat-message-action-sheet[data-presentation="popover"] .chat-message-action-backdrop {
        pointer-events: auto;
        background: transparent;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
    .chat-message-action-sheet[data-presentation="popover"] .chat-message-selected-layer,
    .chat-message-action-sheet[data-presentation="popover"] .chat-message-action-dragzone,
    .chat-message-action-sheet[data-presentation="popover"] .chat-message-action-title {
        display: none;
    }
    .chat-message-action-sheet[data-presentation="popover"] .chat-message-action-panel {
        position: fixed;
        pointer-events: auto;
        margin: 0;
        width: min(308px, calc(100vw - 16px));
        max-height: calc(100dvh - 16px);
        padding: 6px;
        border-radius: 16px;
        box-shadow: 0 16px 44px rgba(0,0,0,.28);
        backdrop-filter: blur(16px) saturate(115%);
        -webkit-backdrop-filter: blur(16px) saturate(115%);
        animation: chatContextPop .14s ease-out;
    }
    .chat-message-action-sheet[data-presentation="popover"] .chat-reaction-pill {
        margin: 2px 4px 5px;
        padding: 2px 4px;
        max-width: calc(100% - 8px);
    }
    .chat-message-action-sheet[data-presentation="popover"] .chat-reaction-quick {
        height: 44px;
        font-size: 1.2rem;
    }
    .chat-message-action-sheet[data-presentation="popover"] .chat-reaction-chevron {
        width: 44px;
        height: 44px;
    }
    .chat-message-action-sheet[data-presentation="popover"] .chat-reaction-picker {
        grid-template-columns: repeat(6, minmax(0, 1fr));
        grid-auto-rows: 44px;
        max-height: min(42dvh, 238px);
        padding: 4px 4px 7px;
    }
    .chat-message-action-sheet[data-presentation="popover"] .chat-reaction-pick {
        height: 44px;
        font-size: 1.2rem;
    }
    .chat-message-action-sheet[data-presentation="popover"] .chat-sheet-action {
        min-height: 40px;
        gap: 9px;
        padding: 0 10px;
        border-radius: 10px;
        font-size: .9rem;
        font-weight: 720;
    }
}

@keyframes chatContextPop {
    from { opacity: .5; transform: translateY(3px) scale(.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 768px), (hover: none), (pointer: coarse) {
    .chat-message-action-sheet[data-presentation="popover"] .chat-message-action-panel {
        --message-action-row-height: clamp(24px, calc((var(--message-action-viewport-height, 100dvh) - 82px) / var(--message-action-visible-rows, 9)), 34px);
        width: min(296px, calc(var(--message-action-viewport-width, 100vw) - 16px));
        max-height: none;
        overflow: visible;
        padding: 0;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
    .chat-message-action-sheet[data-presentation="popover"] :is(.chat-reaction-pill, .chat-reaction-picker, .chat-message-action-list) {
        border: 1px solid var(--border);
        background: color-mix(in srgb, var(--bg-modal) 94%, transparent);
        box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
    }
    .chat-message-action-sheet[data-presentation="popover"] .chat-message-action-list {
        width: 100%;
        padding: 4px;
        border-radius: 12px;
        box-sizing: border-box;
        display: block;
        overflow: visible;
    }
    .chat-message-action-sheet[data-presentation="popover"] .chat-reaction-pill {
        width: 100%;
        max-width: 100%;
        margin: 0 0 6px;
        padding: 4px;
        box-sizing: border-box;
    }
    .chat-message-action-sheet[data-presentation="popover"] .chat-reaction-quick {
        min-width: 44px;
        height: 44px;
        font-size: 1.125rem !important;
    }
    .chat-message-action-sheet[data-presentation="popover"] .chat-reaction-chevron {
        width: 44px;
        height: 44px;
        margin-inline-start: 0;
    }
    .chat-message-action-sheet[data-presentation="popover"] .chat-sheet-action {
        min-width: 0;
        width: 100%;
        min-height: var(--message-action-row-height);
        gap: 8px;
        padding: 3px 8px;
        border-radius: 8px;
        line-height: 1.25;
        /* The legacy mobile form-zoom rule forces all buttons to 16px.
           Only these context labels opt out; actual text inputs stay untouched. */
        font-size: .82rem !important;
        font-weight: 720;
    }
    .chat-message-action-sheet[data-presentation="popover"] .chat-sheet-action svg {
        width: 16px;
        height: 16px;
        min-width: 16px;
        min-height: 16px;
    }
    .chat-message-action-sheet[data-presentation="popover"] .chat-message-action-panel:has(.chat-reaction-picker:not(.hidden)) {
        --message-action-row-height: 24px;
    }
    .chat-message-action-sheet[data-presentation="popover"] .chat-reaction-picker {
        /* Only the explicitly expanded emoji catalogue scrolls, never actions. */
        max-height: min(192px, max(44px, calc(var(--message-action-viewport-height, 100dvh) - var(--message-action-visible-rows, 9) * 24px - 82px)));
        margin: 0 0 6px;
        padding: 4px;
        border-radius: 12px;
        grid-template-columns: repeat(6, minmax(0, 1fr));
        grid-auto-rows: 44px;
    }
    .chat-message-action-sheet[data-presentation="popover"] .chat-reaction-pick {
        height: 44px;
        font-size: 1.125rem !important;
    }
}

@media (max-width: 520px) {
    .chat-message-action-panel .chat-sheet-action {
        min-height: 44px;
        gap: 10px;
        padding: 0 10px;
        border-radius: 14px;
        font-size: .94rem;
    }
    .chat-message-action-panel .chat-sheet-action svg {
        width: 19px;
        height: 19px;
        min-width: 19px;
        min-height: 19px;
    }
    .chat-edit-inline {
        left: 58px !important;
        bottom: calc(100% + 6px) !important;
        max-width: calc(100% - 74px) !important;
    }
    .message-actions-menu {
        gap: 4px !important;
        opacity: .8 !important;
    }
    .message-action-btn {
        width: 23px !important;
        height: 23px !important;
        min-width: 23px !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .chat-message-action-panel,
    .chat-message-action-panel .chat-reaction-chevron svg,
    .chat-message-action-panel .chat-sheet-action,
    .chat-message-action-panel .chat-reaction-pick {
        animation: none !important;
        transition-duration: .01ms !important;
    }
}

html[data-text-dir="rtl"] .chat-message-action-title {
    letter-spacing: normal;
    text-transform: none;
}

/* Preserve the former collapsed workspace without a sidebar state marker. */
@media (min-width: 1025px) {
    .app .page-content { max-width: none !important; }
    .app .page-content[data-page="chats"],
    .app .page-content:has(.deals-page) {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
    .app .chats-container,
    .app .deals-container { border-radius: 0 !important; }
}

/* ===== STAGE 11T: mobile forward flow + composer forward bar ===== */
.chat-forward-inline {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    padding: 9px 10px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: var(--bg-tertiary);
}
.chat-forward-inline.hidden { display: none !important; }
.chat-forward-inline-main {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}
.chat-forward-inline-icon {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border-radius: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    background: var(--primary-light);
}
.chat-forward-inline-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.chat-forward-inline-text b {
    font-size: .82rem;
    color: var(--primary);
}
.chat-forward-inline-text span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .76rem;
    color: var(--text-muted);
}
.chat-forward-inline-toggle {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 10px;
    border-radius: 999px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    font-size: .76rem;
    font-weight: 800;
    white-space: nowrap;
}
.chat-forward-inline-toggle input {
    width: 15px;
    height: 15px;
    accent-color: var(--primary);
}
.chat-forward-inline-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}
.chat-forward-inline-btn {
    min-height: 32px;
    padding: 0 11px;
    border-radius: 999px;
    border: 1px solid var(--border);
    cursor: pointer;
    font-weight: 800;
    font-size: .76rem;
}
.chat-forward-inline-btn.ghost {
    color: var(--text-secondary);
    background: var(--bg-secondary);
}
.chat-forward-inline-btn.primary {
    color: #fff;
    background: var(--primary);
    border-color: var(--primary);
}
.chat-forward-mobile-flow .chat-action-modal {
    width: min(520px, 100vw);
}
@media (max-width: 768px) {
    .chat-forward-mobile-flow {
        align-items: stretch !important;
        justify-content: stretch !important;
        padding: 0 !important;
    }
    .chat-forward-mobile-flow .chat-action-modal {
        width: 100vw !important;
        max-width: 100vw !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        border-radius: 0 !important;
        border: 0 !important;
        padding: calc(12px + env(safe-area-inset-top)) 12px calc(12px + env(safe-area-inset-bottom)) !important;
    }
    .chat-forward-mobile-flow .chat-forward-list {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
    }
    .chat-forward-inline {
        grid-template-columns: minmax(0, 1fr);
        gap: 8px;
        padding: 9px;
        border-radius: 16px;
    }
    .chat-forward-inline-main {
        gap: 8px;
    }
    .chat-forward-inline-toggle {
        width: 100%;
        justify-content: space-between;
        padding: 8px 10px;
    }
    .chat-forward-inline-actions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
    .chat-forward-inline-btn {
        width: 100%;
    }
}


/* ===== STAGE 11U: remove inline quick buttons + reliable forward picker ===== */
.message-actions-menu {
    display: none !important;
}

.chat-forward-step.hidden {
    display: none !important;
}

.chat-forward-confirm-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border-radius: 18px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    margin-bottom: 12px;
}

.chat-forward-confirm-avatar {
    width: 44px;
    height: 44px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 900;
    flex: 0 0 44px;
}

.chat-forward-confirm-card b,
.chat-forward-confirm-card small {
    display: block;
}

.chat-forward-confirm-card small {
    color: var(--text-muted);
    margin-top: 2px;
    font-size: .78rem;
}

.chat-forward-confirm-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 12px;
}

.chat-forward-back,
.chat-forward-send {
    min-height: 42px;
    border: 1px solid var(--border);
    border-radius: 14px;
    font-weight: 800;
    cursor: pointer;
}

.chat-forward-back {
    background: var(--bg-tertiary);
    color: var(--text);
}

.chat-forward-send {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

@media (max-width: 768px) {
    .chat-forward-mobile-flow .chat-action-modal {
        width: 100vw !important;
        max-width: 100vw !important;
        height: min(88dvh, 720px) !important;
        max-height: min(88dvh, 720px) !important;
        border-radius: 24px 24px 0 0 !important;
        display: flex !important;
        flex-direction: column !important;
    }

    .chat-forward-mobile-flow .chat-forward-step-list,
    .chat-forward-mobile-flow .chat-forward-step-confirm {
        min-height: 0 !important;
        display: flex;
        flex-direction: column;
    }

    .chat-forward-mobile-flow .chat-forward-list {
        flex: 1 1 auto !important;
        max-height: none !important;
        overflow-y: auto !important;
    }

    .chat-forward-mobile-flow .chat-forward-step-confirm.hidden,
    .chat-forward-mobile-flow .chat-forward-step-list.hidden {
        display: none !important;
    }
}

/* ===== STAGE 11W: messenger-like forward flow repair ===== */
.chat-forward-pick-banner {
    margin: 10px 10px 8px;
    padding: 12px 12px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: color-mix(in srgb, var(--primary) 12%, var(--bg-card));
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    box-shadow: var(--shadow-sm);
}
.chat-forward-pick-banner b {
    display: block;
    font-size: .9rem;
    margin-bottom: 2px;
}
.chat-forward-pick-banner span {
    display: block;
    font-size: .76rem;
    color: var(--text-secondary);
    line-height: 1.25;
}
.chat-forward-pick-banner button {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 999px;
    background: rgba(255,255,255,.08);
    color: var(--text);
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    flex: 0 0 32px;
}
.chat-forward-pick-banner button:hover {
    background: rgba(255,255,255,.14);
}
body.theme-light .chat-forward-pick-banner {
    background: rgba(99,102,241,.08);
    border-color: rgba(99,102,241,.18);
}
body.theme-light .chat-forward-pick-banner button {
    background: rgba(15,23,42,.06);
}
.chats-container.forward-pick-mode .chat-item {
    border-color: transparent;
}
.chats-container.forward-pick-mode .chat-item:hover {
    background: var(--primary-light);
    border-color: color-mix(in srgb, var(--primary) 40%, transparent);
}
.chat-forward-inline {
    order: -5;
}
.chat-input-area.forward-mode {
    flex-wrap: wrap;
}
.chat-input-area.forward-mode .chat-forward-inline {
    width: 100%;
}
.chat-forward-inline-toggle input {
    accent-color: var(--primary);
}
@media (max-width: 768px) {
    .chat-forward-pick-banner {
        position: sticky;
        top: 8px;
        z-index: 5;
        margin: 8px;
    }
    .chat-forward-inline {
        gap: 8px !important;
        padding: 8px !important;
    }
    .chat-forward-inline-main {
        min-width: 0;
        flex: 1 1 100%;
    }
    .chat-forward-inline-toggle {
        flex: 1 1 auto;
    }
    .chat-forward-inline-actions {
        flex: 0 0 auto;
    }
}

/* ===== STAGE 11X: messenger forward flow polish ===== */
.chat-forward-desktop-flow .chat-forward-modal {
    width: min(760px, calc(100vw - 56px)) !important;
    max-height: min(760px, calc(100dvh - 72px)) !important;
    border-radius: 30px !important;
    background: color-mix(in srgb, var(--bg-card) 88%, transparent) !important;
    backdrop-filter: blur(24px) saturate(150%) !important;
}

.chat-forward-desktop-flow .chat-forward-list {
    max-height: min(520px, calc(100dvh - 250px)) !important;
    overflow-y: auto !important;
    padding-right: 4px !important;
}

.chat-forward-user.saved-notes .chat-forward-avatar,
.chat-item.saved-notes .avatar.small {
    background: linear-gradient(135deg, #f59e0b, #f97316) !important;
    color: #fff !important;
}

.chat-input-area.forward-mode {
    display: grid !important;
    grid-template-columns: auto auto minmax(0, 1fr) auto auto !important;
    align-items: center !important;
    gap: 8px !important;
}

.chat-input-area.forward-mode .chat-forward-inline {
    grid-column: 1 / -1 !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    width: 100% !important;
    min-height: 34px !important;
    padding: 6px 8px !important;
    border-radius: 16px !important;
    background: color-mix(in srgb, var(--primary-light) 65%, transparent) !important;
    border: 1px solid color-mix(in srgb, var(--primary) 22%, transparent) !important;
    box-shadow: none !important;
}

.chat-forward-inline.hidden { display: none !important; }

.chat-forward-inline-caption {
    min-width: 0 !important;
    flex: 1 1 auto !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    font-size: .82rem !important;
    font-weight: 800 !important;
    color: var(--text) !important;
}

.chat-forward-inline-icon {
    width: 24px !important;
    height: 24px !important;
    flex: 0 0 24px !important;
    border-radius: 999px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: var(--primary) !important;
    color: #fff !important;
}

.chat-forward-inline-toggle {
    flex: 0 0 auto !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    font-size: .76rem !important;
    color: var(--text-muted) !important;
    white-space: nowrap !important;
}

.chat-forward-inline-toggle input {
    width: 16px !important;
    height: 16px !important;
    accent-color: var(--primary) !important;
}

.chat-forward-inline-cancel {
    width: 26px !important;
    height: 26px !important;
    flex: 0 0 26px !important;
    border: 0 !important;
    border-radius: 999px !important;
    background: color-mix(in srgb, var(--bg-tertiary) 86%, transparent) !important;
    color: var(--text-muted) !important;
    font-size: 18px !important;
    line-height: 1 !important;
    cursor: pointer !important;
}

.chat-forward-inline-cancel:hover {
    color: var(--danger) !important;
}

.chat-forward-inline-main,
.chat-forward-inline-text,
.chat-forward-inline-actions,
.chat-forward-inline-btn {
    display: none !important;
}

@media (max-width: 768px) {
    .chat-input-area.forward-mode .chat-forward-inline {
        min-height: 32px !important;
        padding: 5px 7px !important;
        border-radius: 14px !important;
    }

    .chat-forward-inline-toggle span {
        display: none !important;
    }

    .chat-forward-inline-caption {
        font-size: .76rem !important;
    }
}

/* ===== STAGE 11Y: forward composer mobile repair / send via normal button ===== */
.chat-input-area.forward-mode {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 8px !important;
}

.chat-input-area.forward-mode .chat-forward-inline {
    order: -1 !important;
    flex: 0 0 100% !important;
    width: 100% !important;
    min-width: 0 !important;
    min-height: 30px !important;
    display: grid !important;
    grid-template-columns: 24px minmax(0, 1fr) auto 28px !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 5px 7px !important;
    border-radius: 14px !important;
    background: color-mix(in srgb, var(--primary-light) 70%, transparent) !important;
    border: 1px solid color-mix(in srgb, var(--primary) 20%, transparent) !important;
    box-shadow: none !important;
}

.chat-forward-inline.hidden { display: none !important; }

.chat-forward-inline-icon {
    width: 22px !important;
    height: 22px !important;
    flex: 0 0 22px !important;
}

.chat-forward-inline-caption {
    min-width: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    font-size: .78rem !important;
    font-weight: 800 !important;
    color: var(--text) !important;
}

.chat-forward-inline-toggle {
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    background: transparent !important;
    white-space: nowrap !important;
    font-size: .72rem !important;
    color: var(--text-muted) !important;
}

.chat-forward-inline-toggle input {
    width: 15px !important;
    height: 15px !important;
    margin: 0 !important;
    accent-color: var(--primary) !important;
}

.chat-forward-inline-cancel {
    width: 24px !important;
    height: 24px !important;
    flex: 0 0 24px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 17px !important;
}

.chat-input-area.forward-mode .chat-input-actions,
.chat-input-area.forward-mode .chat-input-wrapper,
.chat-input-area.forward-mode #send-message-btn {
    flex: 0 0 auto;
}

.chat-input-area.forward-mode .chat-input-wrapper {
    flex: 1 1 180px !important;
    min-width: 0 !important;
}

.chat-input-area.forward-mode #send-message-btn:not(:disabled) {
    background: var(--primary) !important;
    color: #fff !important;
    opacity: 1 !important;
}

@media (max-width: 768px) {
    .chat-input-area.forward-mode {
        gap: 7px !important;
    }

    .chat-input-area.forward-mode .chat-forward-inline {
        grid-template-columns: 22px minmax(0, 1fr) auto 24px !important;
        gap: 6px !important;
        min-height: 28px !important;
        padding: 4px 6px !important;
        border-radius: 12px !important;
    }

    .chat-forward-inline-caption {
        font-size: .72rem !important;
    }

    .chat-forward-inline-toggle span {
        display: inline !important;
        font-size: 0 !important;
    }

    .chat-forward-inline-toggle span::after {
        content: 'Имя';
        font-size: .68rem;
    }

    .chat-forward-inline-toggle input {
        width: 14px !important;
        height: 14px !important;
    }
}

@media (max-width: 380px) {
    .chat-forward-inline-caption {
        max-width: 150px !important;
    }
}

/* ===== STAGE 11Z: Saved messages / Избранное ===== */
.chat-item.saved-notes {
    background: linear-gradient(135deg, rgba(245, 158, 11, .10), rgba(249, 115, 22, .06));
}

.chat-item.saved-notes:hover,
.chat-item.saved-notes.active {
    background: linear-gradient(135deg, rgba(245, 158, 11, .18), rgba(249, 115, 22, .10)) !important;
}

.chat-item.saved-notes .chat-item-name {
    font-weight: 800;
}

.chat-item.saved-notes .chat-item-preview {
    color: var(--text-muted);
}

.chat-forward-user.saved-notes .chat-forward-avatar,
.chat-item.saved-notes .avatar.small,
.avatar.saved-notes-avatar {
    background: linear-gradient(135deg, #f59e0b, #f97316) !important;
    color: #fff !important;
    box-shadow: 0 12px 24px rgba(245, 158, 11, .22);
}

.chat-item.saved-notes .avatar.small {
    font-size: 1rem;
}

body.theme-light .chat-item.saved-notes {
    background: linear-gradient(135deg, rgba(245, 158, 11, .12), rgba(249, 115, 22, .05));
}

body.theme-light .chat-item.saved-notes.active,
body.theme-light .chat-item.saved-notes:hover {
    background: linear-gradient(135deg, rgba(245, 158, 11, .20), rgba(249, 115, 22, .10)) !important;
}

/* ===== STAGE 11AA: mobile swipe-right back to dialogs ===== */
@media (max-width: 1024px) {
    .chat-active {
        touch-action: pan-y !important;
        overscroll-behavior-x: contain;
    }

    .chat-active.swiping-back {
        transition: transform .12s ease !important;
        box-shadow: -18px 0 38px rgba(15, 23, 42, .14);
    }

    .chat-messages {
        overscroll-behavior-x: contain;
    }
}

/* ===== STAGE 11AB: Telegram-style video circles ===== */
#voice-record-btn {
    touch-action: none;
    user-select: none;
}
#send-message-btn.send-disabled:not(.video-circle-mode) {
    opacity: .52;
    filter: grayscale(.12);
}
#voice-record-btn.video-circle-mode {
    background: var(--primary-grad) !important;
    color: #fff !important;
    box-shadow: 0 0 0 3px var(--primary-light), 0 14px 32px rgba(99,102,241,.28) !important;
    transform: translateY(-2px);
}
#voice-record-btn.video-circle-mode svg {
    stroke: #fff !important;
}
#voice-record-btn.video-circle-mode.recording,
.chat-input-area.video-circle-recording-active #voice-record-btn {
    background: var(--danger) !important;
    color: #fff !important;
    animation: videoCirclePulse 1s ease-in-out infinite alternate;
}
@keyframes videoCirclePulse {
    from { box-shadow: 0 0 0 3px rgba(239,68,68,.20), 0 0 0 0 rgba(239,68,68,.20); }
    to { box-shadow: 0 0 0 4px rgba(239,68,68,.22), 0 0 0 12px rgba(239,68,68,.05); }
}
.video-circle-recorder.hidden { display: none !important; }
.video-circle-recorder {
    position: absolute;
    right: 18px;
    bottom: calc(78px + env(safe-area-inset-bottom));
    z-index: 80;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 999px;
    background: rgba(15,23,42,.72);
    border: 1px solid rgba(255,255,255,.12);
    box-shadow: 0 18px 48px rgba(0,0,0,.32);
    backdrop-filter: blur(14px);
    color: #fff;
}
.video-circle-preview-wrap {
    width: 88px;
    height: 88px;
    border-radius: 999px;
    overflow: hidden;
    background: #020617;
    border: 2px solid rgba(255,255,255,.18);
    flex: 0 0 88px;
}
.video-circle-preview-wrap video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
}
.video-circle-rec-meta {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 110px;
    font-size: .8rem;
}
.video-circle-rec-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--danger);
    display: inline-block;
    box-shadow: 0 0 0 6px rgba(239,68,68,.16);
    margin-bottom: 2px;
}
#video-circle-rec-time {
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}
.video-circle-rec-hint {
    color: rgba(255,255,255,.7);
    white-space: nowrap;
}
.video-circle-cancel {
    border: 0;
    border-radius: 999px;
    padding: 8px 12px;
    background: rgba(255,255,255,.12);
    color: #fff;
    cursor: pointer;
    font-weight: 700;
}
.video-circle-cancel:hover { background: rgba(255,255,255,.2); }
.video-circle-message {
    position: relative;
    width: 180px;
    height: 180px;
    border-radius: 999px;
    overflow: hidden;
    border: 0;
    padding: 0;
    background: #020617;
    cursor: pointer;
    display: block;
    box-shadow: 0 12px 30px rgba(0,0,0,.22);
}
.video-circle-message video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.video-circle-message .video-circle-poster {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    pointer-events: none;
}
.video-circle-message.playing .video-circle-poster { opacity: 0; }
.video-circle-message .video-circle-play,
.video-circle-message .video-circle-duration { z-index: 2; }
/* M1: iOS cannot decode legacy WebM circles, so no real first frame is possible.
   Show a branded gradient (clearly NOT a real frame) instead of a pure-black circle;
   the play affordance stays on top. */
.video-circle-message.circle-no-preview { background: linear-gradient(135deg, #6d5dfc 0%, #3a2fb0 100%); }
.video-circle-message.circle-no-preview video { visibility: hidden; }
.video-circle-message.circle-no-preview:not(.has-preview) {
    background:
        radial-gradient(circle at 32% 24%, rgba(255,255,255,.22), transparent 34%),
        linear-gradient(135deg, #6d5dfc 0%, #30258f 100%) !important;
}
#chat-messages .video-circle-message.circle-no-preview:not(.has-preview) {
    background:
        radial-gradient(circle at 32% 24%, rgba(255,255,255,.22), transparent 34%),
        linear-gradient(135deg, #6d5dfc 0%, #30258f 100%) !important;
}
#chat-messages .video-circle-message.circle-preview-pending:not(.has-preview):not(.playing) {
    background:
        radial-gradient(circle at 30% 22%, rgba(255,255,255,.18), transparent 33%),
        linear-gradient(145deg, #715cff, #27206f) !important;
}
#chat-messages .video-circle-message.circle-preview-pending:not(.has-preview):not(.playing) video {
    visibility: hidden !important;
}
.video-circle-play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: rgba(0,0,0,.18);
    opacity: .95;
    transition: opacity .16s ease, background .16s ease;
}
.video-circle-message:hover .video-circle-play { background: rgba(0,0,0,.28); }
.video-circle-duration {
    position: absolute;
    right: 12px;
    bottom: 10px;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(0,0,0,.45);
    color: #fff;
    font-size: .72rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}
.message.sent .video-circle-message { margin-left: auto; }
@media (max-width: 768px) {
    .video-circle-recorder {
        left: 12px;
        right: 12px;
        bottom: calc(76px + env(safe-area-inset-bottom));
        justify-content: space-between;
        border-radius: 26px;
    }
    .video-circle-preview-wrap {
        width: 78px;
        height: 78px;
        flex-basis: 78px;
    }
    .video-circle-rec-hint { display: none; }
    .video-circle-message {
        width: 154px;
        height: 154px;
    }
}
@media (max-width: 380px) {
    .video-circle-message {
        width: 136px;
        height: 136px;
    }
    .video-circle-cancel { padding: 7px 10px; }
}

/* ===== STAGE 11AC: video circles Telegram polish ===== */
/* Во время записи кружок должен быть главным объектом по центру экрана, а не маленькой плашкой у input. */
.video-circle-recorder {
    position: fixed !important;
    inset: 0 !important;
    z-index: 19000 !important;
    display: grid !important;
    place-items: center !important;
    padding: 24px !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: rgba(2, 6, 23, .72) !important;
    box-shadow: none !important;
    backdrop-filter: blur(12px) !important;
    color: #fff !important;
}
.video-circle-recorder.hidden { display: none !important; }
.video-circle-preview-wrap {
    position: relative !important;
    width: min(62vmin, 420px) !important;
    height: min(62vmin, 420px) !important;
    max-width: calc(100vw - 42px) !important;
    max-height: calc(100dvh - 180px) !important;
    border-radius: 999px !important;
    overflow: hidden !important;
    background: #020617 !important;
    border: 0 !important;
    box-shadow: 0 28px 80px rgba(0,0,0,.42), 0 0 0 1px rgba(255,255,255,.12) inset !important;
}
.video-circle-preview-wrap video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
}
.video-circle-rec-timer {
    position: absolute !important;
    right: 18px !important;
    bottom: 18px !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    min-height: 34px !important;
    padding: 0 12px !important;
    border-radius: 999px !important;
    background: rgba(2, 6, 23, .44) !important;
    color: #fff !important;
    font-weight: 900 !important;
    font-variant-numeric: tabular-nums !important;
    backdrop-filter: blur(12px) !important;
}
.video-circle-rec-dot {
    width: 8px !important;
    height: 8px !important;
    border-radius: 999px !important;
    background: #ef4444 !important;
    box-shadow: 0 0 0 6px rgba(239,68,68,.16) !important;
    animation: videoCircleDot 1s ease-in-out infinite alternate;
}
@keyframes videoCircleDot { from { opacity: .55; } to { opacity: 1; } }
.video-circle-rec-controls {
    position: fixed !important;
    left: 50% !important;
    bottom: max(28px, env(safe-area-inset-bottom)) !important;
    transform: translateX(-50%) !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 12px !important;
    padding: 8px !important;
    border-radius: 999px !important;
    background: rgba(15, 23, 42, .24) !important;
    border: 1px solid rgba(255,255,255,.12) !important;
    backdrop-filter: blur(16px) !important;
}
.video-circle-control,
.video-circle-cancel {
    width: 48px !important;
    height: 48px !important;
    min-width: 48px !important;
    border-radius: 999px !important;
    border: 1px solid rgba(255,255,255,.16) !important;
    background: rgba(255,255,255,.10) !important;
    color: #fff !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    font-size: 26px !important;
    font-weight: 900 !important;
    padding: 0 !important;
}
.video-circle-control:hover,
.video-circle-cancel:hover { background: rgba(255,255,255,.18) !important; }
.video-circle-control.danger,
.video-circle-cancel.danger { background: rgba(239,68,68,.22) !important; }
.video-circle-rec-hint {
    position: fixed !important;
    left: 50% !important;
    bottom: max(92px, calc(72px + env(safe-area-inset-bottom))) !important;
    transform: translateX(-50%) !important;
    max-width: calc(100vw - 40px) !important;
    padding: 8px 14px !important;
    border-radius: 999px !important;
    background: rgba(15,23,42,.24) !important;
    color: rgba(255,255,255,.84) !important;
    font-size: .82rem !important;
    white-space: nowrap !important;
    backdrop-filter: blur(16px) !important;
}

/* Отправленный кружок — это не обычный bubble. Он должен быть чистым круглым видео без белой карточки. */
.message:has(.video-circle-message) {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    overflow: visible !important;
    max-width: max-content !important;
}
.message:has(.video-circle-message) .message-content {
    overflow: visible !important;
}
.message:has(.video-circle-message) .message-time {
    margin-top: 6px !important;
    padding: 0 8px !important;
    color: var(--text-muted) !important;
    text-align: right !important;
}
.video-circle-message {
    width: 190px !important;
    height: 190px !important;
    border-radius: 999px !important;
    overflow: hidden !important;
    border: 0 !important;
    padding: 0 !important;
    background: #020617 !important;
    box-shadow: 0 18px 42px rgba(15,23,42,.18) !important;
    display: block !important;
    cursor: pointer !important;
    transition: width .22s ease, height .22s ease, border-radius .22s ease, box-shadow .22s ease, transform .22s ease !important;
}
.message.sent .video-circle-message { margin-left: auto !important; }
.video-circle-message video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
}
.video-circle-message.expanded {
    width: min(72vmin, 420px) !important;
    height: min(72vmin, 420px) !important;
    max-width: calc(100vw - 40px) !important;
    max-height: calc(100dvh - 180px) !important;
    box-shadow: 0 28px 80px rgba(15,23,42,.34) !important;
    z-index: 50 !important;
}
.video-circle-message.playing .video-circle-play { opacity: 0 !important; }
.video-circle-message.expanded .video-circle-play { background: rgba(0,0,0,.08) !important; }
.video-circle-message.expanded:not(.playing) .video-circle-play { opacity: .9 !important; }
.video-circle-duration {
    right: 12px !important;
    bottom: 12px !important;
    background: rgba(2,6,23,.52) !important;
    backdrop-filter: blur(10px) !important;
}

@media (max-width: 768px) {
    .video-circle-preview-wrap {
        width: min(74vmin, 360px) !important;
        height: min(74vmin, 360px) !important;
        max-height: calc(100dvh - 170px) !important;
    }
    .video-circle-message {
        width: 164px !important;
        height: 164px !important;
    }
    .video-circle-message.expanded {
        width: min(86vmin, 390px) !important;
        height: min(86vmin, 390px) !important;
        max-height: calc(100dvh - 160px) !important;
    }
    .video-circle-rec-hint { font-size: .76rem !important; }
}

@media (max-width: 380px) {
    .video-circle-message {
        width: 144px !important;
        height: 144px !important;
    }
    .video-circle-control,
    .video-circle-cancel {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
    }
}

/* ===== STAGE 12B: messenger-style chat top bar / mobile header polish ===== */
.avatar.has-image,
.avatar.small.has-image {
    padding: 0 !important;
    overflow: hidden !important;
    background: var(--bg-tertiary) !important;
}
.avatar.has-image img,
.avatar.small.has-image img {
    width: 100% !important;
    height: 100% !important;
    display: block !important;
    object-fit: cover !important;
}

.chat-active {
    position: relative !important;
}
.chat-header {
    position: absolute !important;
    top: 12px !important;
    left: 18px !important;
    right: 18px !important;
    z-index: 45 !important;
    min-height: 0 !important;
    height: auto !important;
    padding: 0 !important;
    background: transparent !important;
    border-bottom: 0 !important;
    box-shadow: none !important;
    pointer-events: none !important;
}
.chat-header .chat-peer-info,
.chat-header .chat-header-actions {
    pointer-events: auto !important;
}
.chat-header .chat-peer-info {
    min-width: 0 !important;
    max-width: min(440px, 48vw) !important;
    padding: 7px 12px 7px 7px !important;
    border-radius: 999px !important;
    background: color-mix(in srgb, var(--bg-secondary) 78%, transparent) !important;
    border: 1px solid color-mix(in srgb, var(--border) 78%, transparent) !important;
    box-shadow: 0 14px 40px rgba(15, 23, 42, .12) !important;
    backdrop-filter: blur(18px) saturate(1.15) !important;
}
.chat-header .chat-peer-info .avatar {
    width: 44px !important;
    height: 44px !important;
    flex: 0 0 44px !important;
    border-radius: 999px !important;
}
.chat-header .chat-peer-name {
    max-width: 280px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}
.chat-header-actions {
    gap: 8px !important;
    align-items: center !important;
}
.chat-header-actions .btn.icon {
    width: 44px !important;
    height: 44px !important;
    border-radius: 999px !important;
    background: color-mix(in srgb, var(--bg-secondary) 74%, transparent) !important;
    border: 1px solid color-mix(in srgb, var(--border) 72%, transparent) !important;
    box-shadow: 0 14px 34px rgba(15, 23, 42, .10) !important;
    backdrop-filter: blur(18px) saturate(1.15) !important;
}
.chat-header-actions .btn.icon:hover {
    background: var(--primary-light) !important;
    color: var(--primary) !important;
    transform: translateY(-1px) !important;
}
.chat-header-actions .btn.icon svg {
    width: 20px !important;
    height: 20px !important;
}
.chat-create-deal-btn {
    display: inline-flex !important;
}
.chat-messages {
    padding-top: 86px !important;
    overflow-x: hidden !important;
}

#chat-search-bar,
.chat-search-bar {
    position: absolute !important;
    top: 68px !important;
    left: 18px !important;
    right: 18px !important;
    z-index: 44 !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 8px !important;
    border-radius: 22px !important;
    background: color-mix(in srgb, var(--bg-secondary) 86%, transparent) !important;
    border: 1px solid color-mix(in srgb, var(--border) 78%, transparent) !important;
    box-shadow: 0 18px 44px rgba(15, 23, 42, .16) !important;
    backdrop-filter: blur(18px) saturate(1.15) !important;
    flex-shrink: 0 !important;
}
#chat-search-bar input {
    min-width: 0 !important;
    height: 38px !important;
    border-radius: 18px !important;
}
#chat-search-bar .btn.icon {
    width: 38px !important;
    height: 38px !important;
    flex: 0 0 38px !important;
}

@media (max-width: 1024px) {
    .chat-back-btn {
        display: none !important;
    }
    .chat-header {
        top: 8px !important;
        left: 10px !important;
        right: 10px !important;
    }
    .chat-header .chat-peer-info {
        max-width: calc(100vw - 218px) !important;
        padding: 5px 9px 5px 5px !important;
    }
    .chat-header .chat-peer-info .avatar {
        width: 40px !important;
        height: 40px !important;
        flex-basis: 40px !important;
    }
    .chat-peer-name {
        max-width: 120px !important;
    }
    .chat-header-actions {
        gap: 6px !important;
    }
    .chat-header-actions .btn.icon {
        width: 40px !important;
        height: 40px !important;
        display: inline-flex !important;
    }
    .chat-header-actions .btn.icon:not(.chat-back-btn) {
        display: inline-flex !important;
    }
    #chat-info-btn {
        display: none !important;
    }
    .chat-messages {
        padding-top: 72px !important;
    }
    #chat-search-bar,
    .chat-search-bar {
        top: 58px !important;
        left: 10px !important;
        right: 10px !important;
        gap: 6px !important;
        padding: 7px !important;
    }
    #chat-search-bar input {
        height: 36px !important;
        font-size: .85rem !important;
    }
    #search-result-count {
        min-width: 34px !important;
        font-size: .76rem !important;
    }
    #chat-search-bar .btn.icon {
        width: 34px !important;
        height: 34px !important;
        flex-basis: 34px !important;
    }
}

@media (max-width: 420px) {
    .chat-header .chat-peer-info {
        max-width: calc(100vw - 204px) !important;
    }
    .chat-header-actions .btn.icon {
        width: 38px !important;
        height: 38px !important;
    }
    .chat-header-actions {
        gap: 4px !important;
    }
    .chat-peer-status {
        display: none !important;
    }
    .chat-peer-name {
        max-width: 96px !important;
    }
}

/* ===== STAGE 12C: chat header buttons cleanup ===== */
/* Старый toggle поиска не используется: username-поиск постоянно виден в списке диалогов. */
#chats-search-toggle {
    display: none !important;
}

/* В активном чате оставляем один набор действий: звонок, видео, сделка, поиск. */
#chat-info-btn {
    display: none !important;
}

.chat-header-actions .chat-create-deal-btn {
    display: inline-flex !important;
}

/* На телефоне вместо кнопки назад первым действием показываем создание сделки.
   Возврат к списку диалогов уже реализован свайпом вправо. */
@media (max-width: 1024px) {
    .chat-back-btn {
        display: none !important;
    }

    .chat-header-actions .chat-create-deal-btn {
        order: -1 !important;
    }

    .chat-header-actions {
        gap: 5px !important;
    }
}


/* ===== STAGE 12D: mobile chat first action is create deal, no back button ===== */
.mobile-chat-deal-btn {
    display: none !important;
}

@media (min-width: 1025px) {
    .mobile-chat-deal-btn {
        display: none !important;
    }
}

@media (max-width: 1024px) {
    .chat-header-actions .chat-back-btn {
        display: none !important;
    }

    .chat-header-actions #chat-create-deal-btn {
        display: none !important;
    }

    .chat-header-actions .mobile-chat-deal-btn {
        display: inline-flex !important;
        order: -10 !important;
        color: var(--primary) !important;
        background: color-mix(in srgb, var(--primary-light) 72%, var(--bg-secondary)) !important;
        border-color: color-mix(in srgb, var(--primary) 32%, var(--border)) !important;
    }
}

/* ===== STAGE 12E: точечный фикс кнопки сделки в шапке активного чата =====
   Цель: ПК — ровно одна кнопка создания сделки; мобилка — кнопка сделки вместо назад.
   Не трогаем JS-логику свайпа, поиск сообщений, звонки, голосовые, кружки и пересылку. */

/* Базово используем обычную desktop-кнопку сделки, мобильный дубль скрыт. */
.chat-header-actions #chat-create-deal-btn {
    display: inline-flex !important;
}
.chat-header-actions #chat-mobile-create-deal-btn,
.chat-header-actions .mobile-chat-deal-btn {
    display: none !important;
}

@media (min-width: 1025px) {
    .chat-header-actions #chat-create-deal-btn {
        display: inline-flex !important;
    }
    .chat-header-actions #chat-mobile-create-deal-btn,
    .chat-header-actions .mobile-chat-deal-btn {
        display: none !important;
    }
}

@media (max-width: 1024px) {
    /* Возврат к списку диалогов остаётся свайпом вправо, кнопку назад не показываем. */
    .chat-header-actions .chat-back-btn,
    #chat-back-btn {
        display: none !important;
    }

    /* На мобильном показываем только мобильную кнопку сделки, desktop-дубль скрываем. */
    .chat-header-actions #chat-create-deal-btn {
        display: none !important;
    }
    .chat-header-actions #chat-mobile-create-deal-btn.mobile-chat-deal-btn {
        display: inline-flex !important;
        order: -10 !important;
        flex: 0 0 40px !important;
        color: var(--primary) !important;
        background: color-mix(in srgb, var(--primary-light) 72%, var(--bg-secondary)) !important;
        border-color: color-mix(in srgb, var(--primary) 32%, var(--border)) !important;
    }

    /* Старые mobile-правила не должны прятать поиск по сообщениям и звонки. */
    .chat-header-actions #call-voice-btn,
    .chat-header-actions #call-video-btn,
    .chat-header-actions #chat-search-msg-btn {
        display: inline-flex !important;
    }
}


/* ===== STAGE 12F: mobile create-deal button specificity fix =====
   Причина: старое mobile-правило через :not(#call-voice-btn):not(#call-video-btn):not(#chat-search-msg-btn)
   имело высокую специфичность и скрывало #chat-mobile-create-deal-btn на телефонах.
   Исправление: mobile-кнопка сделки исключена из старого hide-селектора и дополнительно
   закреплена более специфичным правилом ниже. */
@media (max-width: 1024px) {
    .chat-header-actions .btn.icon#chat-mobile-create-deal-btn.mobile-chat-deal-btn {
        display: inline-flex !important;
        order: -10 !important;
        flex: 0 0 40px !important;
        width: 40px !important;
        height: 40px !important;
        align-items: center !important;
        justify-content: center !important;
        color: var(--primary) !important;
        background: color-mix(in srgb, var(--primary-light) 72%, var(--bg-secondary)) !important;
        border-color: color-mix(in srgb, var(--primary) 32%, var(--border)) !important;
    }

    .chat-header-actions .btn.icon#chat-create-deal-btn {
        display: none !important;
    }

    .chat-header-actions .chat-back-btn,
    #chat-back-btn {
        display: none !important;
    }
}

@media (min-width: 1025px) {
    .chat-header-actions .btn.icon#chat-mobile-create-deal-btn.mobile-chat-deal-btn {
        display: none !important;
    }
    .chat-header-actions .btn.icon#chat-create-deal-btn {
        display: inline-flex !important;
    }
}

/* ===== STAGE 13A: Calls foundation UI / controls ===== */
.call-fullscreen[aria-hidden="true"] { display: none !important; }
.call-fullscreen {
    z-index: 24000 !important;
    background:
        radial-gradient(circle at 50% 16%, rgba(99,102,241,.32), transparent 34%),
        linear-gradient(180deg, rgba(15,23,42,.94), rgba(2,6,23,.98)) !important;
}
.call-wrapper {
    max-width: min(430px, calc(100vw - 28px)) !important;
    min-height: min(620px, calc(100dvh - 36px));
    justify-content: center;
    gap: 28px !important;
}
.call-fullscreen.video-call .call-wrapper {
    max-width: min(920px, calc(100vw - 28px)) !important;
    width: min(920px, calc(100vw - 28px)) !important;
}
.call-wrapper::before { pointer-events: none; }
.call-header-info { width: 100%; }
.call-video-area.hidden { display: none !important; }
.call-video-area {
    width: min(760px, 100%) !important;
    height: min(58dvh, 520px);
    border-radius: 30px !important;
    overflow: hidden !important;
    background: rgba(2,6,23,.78) !important;
    border: 1px solid rgba(255,255,255,.10);
}
.call-video-placeholder {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: rgba(255,255,255,.56);
    font-weight: 700;
    pointer-events: none;
}
#call-remote-video {
    width: 100% !important;
    height: 100% !important;
    aspect-ratio: auto !important;
    object-fit: cover !important;
    position: relative;
    z-index: 1;
    background: transparent;
}
#call-remote-video[srcObject] + .call-video-placeholder { display: none; }
#call-local-video {
    z-index: 2;
    width: 112px !important;
    height: 148px !important;
    border-radius: 22px !important;
}
.call-actions-row.hidden { display: none !important; }
.call-actions-row {
    flex-wrap: wrap;
    justify-content: center;
    max-width: 100%;
}
.call-action-btn {
    color: #fff;
    user-select: none;
}
.call-action-btn.active-off {
    background: rgba(239,68,68,.28) !important;
    border-color: rgba(239,68,68,.42) !important;
}
.call-accept-circle {
    width: 64px !important;
    height: 64px !important;
    background: linear-gradient(135deg, #22c55e, #16a34a) !important;
    border: none !important;
    box-shadow: 0 14px 40px rgba(34,197,94,.32);
}
.call-decline-circle {
    width: 64px !important;
    height: 64px !important;
    background: linear-gradient(135deg, #ef4444, #dc2626) !important;
    border: none !important;
    box-shadow: 0 14px 40px rgba(239,68,68,.32);
}
.call-decline-circle svg { transform: rotate(135deg); }
.call-end-circle svg { transform: rotate(135deg); }
.call-fullscreen.incoming-call .call-avatar-ring {
    animation: callIncomingPulse 1.2s ease-in-out infinite;
}
@keyframes callIncomingPulse {
    0%,100% { transform: scale(1); box-shadow: 0 0 0 rgba(99,102,241,0); }
    50% { transform: scale(1.04); box-shadow: 0 0 0 16px rgba(99,102,241,.08); }
}
@media (max-width: 768px) {
    .call-fullscreen {
        align-items: stretch !important;
        justify-content: stretch !important;
    }
    .call-wrapper,
    .call-fullscreen.video-call .call-wrapper {
        width: 100vw !important;
        max-width: 100vw !important;
        min-height: 100dvh !important;
        padding: 18px 12px calc(18px + env(safe-area-inset-bottom)) !important;
        border-radius: 0 !important;
    }
    .call-video-area {
        width: calc(100vw - 24px) !important;
        height: min(62dvh, 560px) !important;
        border-radius: 24px !important;
    }
    #call-local-video {
        width: 86px !important;
        height: 116px !important;
        top: 12px !important;
        right: 12px !important;
    }
    .call-actions-row { gap: 9px !important; }
    .call-action-btn { width: 44px !important; height: 44px !important; }
    .call-end-circle,
    .call-accept-circle,
    .call-decline-circle { width: 58px !important; height: 58px !important; }
    .call-action-btn span { display: none; }
}

/* ===== STAGE 13B: call controls / remote hangup / minimize / fullscreen ===== */
.call-fullscreen.call-minimized {
    inset: auto 18px 18px auto !important;
    width: min(310px, calc(100vw - 24px)) !important;
    height: auto !important;
    min-height: 0 !important;
    align-items: flex-end !important;
    justify-content: flex-end !important;
    padding: 0 !important;
    background: transparent !important;
    pointer-events: none !important;
}

.call-fullscreen.call-minimized .call-backdrop {
    display: none !important;
}

.call-fullscreen.call-minimized .call-wrapper {
    pointer-events: auto !important;
    width: 100% !important;
    min-height: 92px !important;
    max-height: none !important;
    border-radius: 24px !important;
    padding: 12px !important;
    gap: 10px !important;
    cursor: pointer;
    box-shadow: 0 24px 70px rgba(0,0,0,.38) !important;
}

.call-fullscreen.call-minimized .call-header-info {
    display: grid !important;
    grid-template-columns: 48px minmax(0, 1fr) !important;
    grid-template-rows: auto auto !important;
    align-items: center !important;
    column-gap: 10px !important;
    width: 100% !important;
    text-align: left !important;
}

.call-fullscreen.call-minimized .call-avatar-ring {
    grid-row: 1 / 3 !important;
    width: 48px !important;
    height: 48px !important;
}

.call-fullscreen.call-minimized .call-avatar-img {
    width: 42px !important;
    height: 42px !important;
    font-size: 18px !important;
}

.call-fullscreen.call-minimized .call-name,
.call-fullscreen.call-minimized .call-status {
    text-align: left !important;
    max-width: 100% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

.call-fullscreen.call-minimized .call-name {
    font-size: 15px !important;
}

.call-fullscreen.call-minimized .call-status {
    font-size: 12px !important;
}

.call-fullscreen.call-minimized .call-video-area {
    display: none !important;
}

.call-fullscreen.call-minimized .call-actions-row {
    justify-content: flex-end !important;
    gap: 8px !important;
    width: 100% !important;
}

.call-fullscreen.call-minimized .call-action-btn:not(#call-end-btn):not(#call-minimize-btn) {
    display: none !important;
}

.call-fullscreen.call-minimized .call-action-btn,
.call-fullscreen.call-minimized .call-end-circle {
    width: 42px !important;
    height: 42px !important;
}

.call-fullscreen.call-minimized .call-action-btn span {
    display: none !important;
}

.call-fullscreen.call-browser-fullscreen .call-wrapper {
    width: 100vw !important;
    height: 100dvh !important;
    max-width: none !important;
    max-height: none !important;
    border-radius: 0 !important;
}

.call-action-btn.active-off {
    background: rgba(239, 68, 68, .88) !important;
    box-shadow: 0 14px 32px rgba(239, 68, 68, .24) !important;
}

.call-action-btn#call-camera-btn:not(.hidden),
.call-action-btn#call-fullscreen-btn,
.call-action-btn#call-minimize-btn,
.call-action-btn#call-deal-btn,
.call-action-btn#call-chat-btn,
.call-action-btn#call-mute-btn {
    display: inline-flex !important;
}

.call-fullscreen.audio-call .call-video-area {
    display: none !important;
}

.call-fullscreen.video-call .call-video-area {
    display: flex !important;
}

@media (max-width: 768px) {
    .call-actions-row {
        flex-wrap: wrap !important;
        max-width: min(360px, calc(100vw - 24px)) !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    .call-action-btn {
        width: 46px !important;
        height: 46px !important;
    }

    .call-action-btn span {
        display: none !important;
    }

    .call-fullscreen.call-minimized {
        right: 10px !important;
        bottom: max(10px, env(safe-area-inset-bottom)) !important;
        width: min(290px, calc(100vw - 20px)) !important;
    }
}


/* ===== STAGE 13D: stable call states + real fullscreen video layout ===== */
.call-fullscreen.video-call:not(.call-minimized) .call-wrapper {
    width: 100vw !important;
    height: 100dvh !important;
    max-width: none !important;
    min-height: 100dvh !important;
    border-radius: 0 !important;
    padding: 0 !important;
    gap: 0 !important;
    overflow: hidden !important;
    background: #020617 !important;
}

.call-fullscreen.video-call:not(.call-minimized) .call-header-info {
    position: absolute !important;
    top: max(16px, env(safe-area-inset-top)) !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    z-index: 5 !important;
    width: min(520px, calc(100vw - 32px)) !important;
    padding: 10px 14px !important;
    border-radius: 999px !important;
    background: rgba(15, 23, 42, .38) !important;
    border: 1px solid rgba(255,255,255,.12) !important;
    backdrop-filter: blur(14px) !important;
}

.call-fullscreen.video-call:not(.call-minimized) .call-avatar-ring {
    display: none !important;
}

.call-fullscreen.video-call:not(.call-minimized) .call-name,
.call-fullscreen.video-call:not(.call-minimized) .call-status {
    color: #fff !important;
    text-align: center !important;
}

.call-fullscreen.video-call:not(.call-minimized) .call-video-area {
    position: absolute !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100dvh !important;
    max-width: none !important;
    max-height: none !important;
    border-radius: 0 !important;
    border: 0 !important;
    background: #020617 !important;
}

.call-fullscreen.video-call:not(.call-minimized) #call-remote-video {
    width: 100vw !important;
    height: 100dvh !important;
    object-fit: cover !important;
}

.call-fullscreen.video-call:not(.call-minimized) #call-local-video {
    position: absolute !important;
    top: max(78px, calc(env(safe-area-inset-top) + 78px)) !important;
    right: max(16px, env(safe-area-inset-right)) !important;
    width: min(150px, 30vw) !important;
    height: min(200px, 24dvh) !important;
    border-radius: 22px !important;
    border: 1px solid rgba(255,255,255,.24) !important;
    box-shadow: 0 20px 60px rgba(0,0,0,.35) !important;
}

.call-fullscreen.video-call:not(.call-minimized) .call-actions-row#call-active-actions {
    position: absolute !important;
    left: 50% !important;
    bottom: max(18px, env(safe-area-inset-bottom)) !important;
    transform: translateX(-50%) !important;
    z-index: 6 !important;
    padding: 10px !important;
    border-radius: 999px !important;
    background: rgba(15, 23, 42, .38) !important;
    border: 1px solid rgba(255,255,255,.12) !important;
    backdrop-filter: blur(16px) !important;
}

.call-fullscreen.call-waiting:not(.incoming-call) .call-status::after {
    content: '';
    display: inline-block;
    width: 1.4em;
    text-align: left;
    animation: callDots 1.2s steps(4, end) infinite;
}

@keyframes callDots {
    0% { content: ''; }
    25% { content: '.'; }
    50% { content: '..'; }
    75%, 100% { content: '...'; }
}

.call-fullscreen.audio-call #call-camera-btn.active-off {
    opacity: .68 !important;
}

@media (max-width: 768px) {
    .call-fullscreen.video-call:not(.call-minimized) .call-header-info {
        width: calc(100vw - 24px) !important;
        top: max(10px, env(safe-area-inset-top)) !important;
    }

    .call-fullscreen.video-call:not(.call-minimized) #call-local-video {
        top: max(70px, calc(env(safe-area-inset-top) + 70px)) !important;
        right: 12px !important;
        width: 92px !important;
        height: 124px !important;
    }

    .call-fullscreen.video-call:not(.call-minimized) .call-actions-row#call-active-actions {
        max-width: calc(100vw - 20px) !important;
        border-radius: 28px !important;
        flex-wrap: wrap !important;
    }
}

/* ===== STAGE 13J: native WebRTC reference call UI / no PeerJS ===== */
.call-fullscreen.call-reference-ui {
    position: fixed !important;
    inset: 0 !important;
    z-index: 9999 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 18px !important;
    background:
        radial-gradient(circle at 50% 25%, rgba(99,102,241,.16), transparent 34%),
        rgba(3, 7, 22, .94) !important;
    color: #fff !important;
    overflow: hidden !important;
}
.call-fullscreen.call-reference-ui.hidden { display: none !important; }
.call-fullscreen.call-reference-ui .call-backdrop {
    position: absolute !important;
    inset: 0 !important;
    background: linear-gradient(145deg, rgba(10,15,35,.7), rgba(2,6,18,.92)) !important;
    backdrop-filter: blur(18px) !important;
}
.call-fullscreen.call-reference-ui .call-wrapper {
    position: relative !important;
    z-index: 2 !important;
    width: min(820px, 94vw) !important;
    min-height: min(560px, 86dvh) !important;
    border-radius: 34px !important;
    border: 1px solid rgba(148,163,184,.18) !important;
    background: rgba(8, 13, 31, .66) !important;
    box-shadow: 0 28px 90px rgba(0,0,0,.45) !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
}
.call-fullscreen.call-reference-ui .call-header-info {
    position: relative !important;
    z-index: 8 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 16px !important;
    padding: 34px 22px !important;
    width: min(680px, 90vw) !important;
    min-height: 340px !important;
    border-radius: 30px !important;
    border: 1px solid rgba(148,163,184,.18) !important;
    background: linear-gradient(145deg, rgba(15,23,42,.72), rgba(2,6,23,.52)) !important;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.03) !important;
}
.call-fullscreen.call-reference-ui .call-avatar-ring {
    width: 148px !important;
    height: 148px !important;
    border-radius: 50% !important;
    padding: 7px !important;
    background: linear-gradient(135deg, rgba(129,140,248,1), rgba(124,58,237,1)) !important;
    box-shadow: 0 0 48px rgba(124,58,237,.42) !important;
}
.call-fullscreen.call-reference-ui .call-avatar-img {
    width: 100% !important;
    height: 100% !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: linear-gradient(135deg, #4f46e5, #8b5cf6) !important;
    color: #fff !important;
    font-size: 4.2rem !important;
    font-weight: 900 !important;
}
.call-fullscreen.call-reference-ui .call-name {
    color: #fff !important;
    font-size: clamp(1.65rem, 3vw, 2.45rem) !important;
    font-weight: 950 !important;
    line-height: 1.05 !important;
    text-align: center !important;
}
.call-fullscreen.call-reference-ui .call-status {
    color: rgba(226,232,240,.64) !important;
    font-size: clamp(1rem, 1.8vw, 1.25rem) !important;
    font-weight: 800 !important;
    text-align: center !important;
}
.call-fullscreen.call-reference-ui .call-actions-row,
.call-fullscreen.call-reference-ui .call-top-controls {
    position: absolute !important;
    z-index: 15 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 14px !important;
    transition: opacity .22s ease, transform .22s ease !important;
}
.call-fullscreen.call-reference-ui .call-top-controls {
    top: 28px !important;
    right: 28px !important;
}
.call-fullscreen.call-reference-ui #call-active-actions {
    left: 50% !important;
    bottom: 32px !important;
    transform: translateX(-50%) !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}
.call-fullscreen.call-reference-ui #call-incoming-actions {
    left: 50% !important;
    bottom: 38px !important;
    transform: translateX(-50%) !important;
    gap: 40px !important;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
}
.call-fullscreen.call-reference-ui .call-action-btn {
    width: 62px !important;
    height: 62px !important;
    min-width: 62px !important;
    border-radius: 999px !important;
    border: 1px solid rgba(255,255,255,.14) !important;
    background: rgba(15, 23, 42, .45) !important;
    color: #fff !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: 0 14px 34px rgba(0,0,0,.28), inset 0 0 0 1px rgba(255,255,255,.03) !important;
    backdrop-filter: blur(14px) !important;
    cursor: pointer !important;
    transition: transform .16s ease, background .16s ease, border-color .16s ease !important;
}
.call-fullscreen.call-reference-ui .call-action-btn:hover { transform: translateY(-2px) scale(1.03) !important; background: rgba(30,41,59,.62) !important; }
.call-fullscreen.call-reference-ui .call-action-btn span { display: none !important; }
.call-fullscreen.call-reference-ui .call-action-btn svg { stroke: currentColor !important; }
.call-fullscreen.call-reference-ui .call-mini-icon { width: 58px !important; height: 58px !important; min-width: 58px !important; }
.call-fullscreen.call-reference-ui .call-accept-circle { background: #22c55e !important; border-color: rgba(34,197,94,.85) !important; }
.call-fullscreen.call-reference-ui .call-decline-circle,
.call-fullscreen.call-reference-ui .call-end-circle { background: #ef4444 !important; border-color: rgba(239,68,68,.85) !important; }
.call-fullscreen.call-reference-ui .call-decline-circle svg,
.call-fullscreen.call-reference-ui .call-end-circle svg { transform: rotate(135deg) !important; }
.call-fullscreen.call-reference-ui .call-action-btn.active-off { background: rgba(239,68,68,.78) !important; border-color: rgba(248,113,113,.8) !important; }
.call-fullscreen.call-reference-ui .call-video-area {
    position: absolute !important;
    inset: 0 !important;
    z-index: 3 !important;
    display: block !important;
    background: #020617 !important;
}
.call-fullscreen.call-reference-ui .call-video-area.hidden { display: none !important; }
.call-fullscreen.call-reference-ui #call-remote-video {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    background: #020617 !important;
}
.call-fullscreen.call-reference-ui #call-local-video {
    position: absolute !important;
    top: 96px !important;
    right: 28px !important;
    width: min(220px, 28vw) !important;
    height: min(150px, 20vw) !important;
    object-fit: cover !important;
    border-radius: 24px !important;
    border: 1px solid rgba(255,255,255,.18) !important;
    box-shadow: 0 18px 42px rgba(0,0,0,.35) !important;
    z-index: 12 !important;
    background: rgba(15,23,42,.8) !important;
}
.call-fullscreen.call-reference-ui .call-video-placeholder {
    position: absolute !important;
    inset: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: rgba(255,255,255,.68) !important;
    z-index: 4 !important;
    background: radial-gradient(circle at center, rgba(99,102,241,.12), rgba(2,6,23,.92)) !important;
}
.call-fullscreen.call-reference-ui.video-call .call-header-info.call-video-hide-header,
.call-fullscreen.call-reference-ui.video-call #call-header-info {
    display: none !important;
}
.call-fullscreen.call-reference-ui.call-controls-hidden #call-active-actions,
.call-fullscreen.call-reference-ui.call-controls-hidden .call-top-controls,
.call-fullscreen.call-reference-ui.call-controls-hidden #call-local-video {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: translateY(10px) translateX(-50%) !important;
}
.call-fullscreen.call-reference-ui.call-controls-hidden .call-top-controls {
    transform: translateY(-8px) !important;
}
.call-fullscreen.call-reference-ui.incoming-call .call-wrapper {
    width: min(700px, 92vw) !important;
    min-height: min(620px, 86dvh) !important;
}
.call-fullscreen.call-reference-ui.incoming-call .call-header-info {
    min-height: 360px !important;
}
.call-fullscreen.call-reference-ui.incoming-call .call-top-controls,
.call-fullscreen.call-reference-ui.incoming-call #call-active-actions { display: none !important; }
.call-fullscreen.call-reference-ui.call-minimized {
    inset: auto auto 22px 22px !important;
    width: 310px !important;
    height: 112px !important;
    padding: 0 !important;
    background: transparent !important;
    overflow: visible !important;
}
.call-fullscreen.call-reference-ui.call-minimized .call-backdrop,
.call-fullscreen.call-reference-ui.call-minimized .call-video-area,
.call-fullscreen.call-reference-ui.call-minimized .call-top-controls,
.call-fullscreen.call-reference-ui.call-minimized #call-incoming-actions,
.call-fullscreen.call-reference-ui.call-minimized #call-active-actions { display: none !important; }
.call-fullscreen.call-reference-ui.call-minimized .call-wrapper {
    width: 310px !important;
    height: 112px !important;
    min-height: 112px !important;
    border-radius: 22px !important;
    cursor: grab !important;
    flex-direction: row !important;
    justify-content: flex-start !important;
    padding: 14px !important;
}
.call-fullscreen.call-reference-ui.call-minimized .call-header-info {
    display: grid !important;
    grid-template-columns: 58px 1fr !important;
    grid-template-rows: auto auto !important;
    gap: 3px 12px !important;
    min-height: auto !important;
    width: 100% !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}
.call-fullscreen.call-reference-ui.call-minimized .call-avatar-ring { grid-row: 1 / 3; width: 58px !important; height: 58px !important; padding: 3px !important; }
.call-fullscreen.call-reference-ui.call-minimized .call-avatar-img { font-size: 1.5rem !important; }
.call-fullscreen.call-reference-ui.call-minimized .call-name { font-size: 1rem !important; text-align: left !important; align-self: end !important; }
.call-fullscreen.call-reference-ui.call-minimized .call-status { font-size: .82rem !important; text-align: left !important; align-self: start !important; }
.call-invite-panel {
    position: fixed !important;
    inset: 0 !important;
    z-index: 10020 !important;
    display: grid !important;
    place-items: center !important;
    background: rgba(2,6,23,.55) !important;
    backdrop-filter: blur(10px) !important;
}
.call-invite-panel.hidden { display: none !important; }
.call-invite-card {
    width: min(460px, 92vw) !important;
    border-radius: 26px !important;
    background: var(--bg-card) !important;
    border: 1px solid var(--border) !important;
    box-shadow: 0 24px 80px rgba(0,0,0,.35) !important;
    padding: 20px !important;
    position: relative !important;
}
.call-invite-title { font-size: 1.2rem !important; font-weight: 900 !important; margin-bottom: 12px !important; }
.call-invite-close { position:absolute; right:14px; top:12px; width:36px; height:36px; border-radius:50%; border:0; background:var(--bg-tertiary); color:var(--text); font-size:24px; cursor:pointer; }
.call-invite-results { display:flex; flex-direction:column; gap:8px; max-height: 320px; overflow:auto; margin:12px 0; }
.call-invite-user { display:flex; align-items:center; gap:10px; border:1px solid var(--border); background:var(--bg-secondary); color:var(--text); border-radius:16px; padding:10px; cursor:pointer; text-align:left; }
.call-invite-user .call-invite-check { margin-left:auto; opacity:0; color:var(--primary); font-weight:900; }
.call-invite-user.selected { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, var(--bg-secondary)); }
.call-invite-user.selected .call-invite-check { opacity:1; }
@media (max-width: 768px) {
    .call-fullscreen.call-reference-ui { padding: 0 !important; }
    .call-fullscreen.call-reference-ui .call-wrapper { width: 100vw !important; height: 100dvh !important; min-height: 100dvh !important; border-radius: 0 !important; border: 0 !important; }
    .call-fullscreen.call-reference-ui .call-header-info { width: min(92vw, 520px) !important; min-height: 330px !important; }
    .call-fullscreen.call-reference-ui .call-avatar-ring { width: 128px !important; height: 128px !important; }
    .call-fullscreen.call-reference-ui .call-avatar-img { font-size: 3.4rem !important; }
    .call-fullscreen.call-reference-ui #call-active-actions { bottom: calc(26px + env(safe-area-inset-bottom)) !important; gap: 10px !important; }
    .call-fullscreen.call-reference-ui .call-action-btn { width: 54px !important; height: 54px !important; min-width: 54px !important; }
    .call-fullscreen.call-reference-ui .call-top-controls { top: calc(18px + env(safe-area-inset-top)) !important; right: 14px !important; gap: 10px !important; }
    .call-fullscreen.call-reference-ui .call-mini-icon { width: 50px !important; height: 50px !important; min-width: 50px !important; }
    .call-fullscreen.call-reference-ui #call-local-video { top: calc(78px + env(safe-area-inset-top)) !important; right: 14px !important; width: 132px !important; height: 176px !important; border-radius: 22px !important; }
    .call-fullscreen.call-reference-ui.call-minimized { width: min(310px, 88vw) !important; height: 104px !important; left: 12px !important; bottom: calc(14px + env(safe-area-inset-bottom)) !important; }
    .call-fullscreen.call-reference-ui.call-minimized .call-wrapper { width: 100% !important; height: 104px !important; min-height:104px !important; border-radius: 22px !important; }
}

/* ===== STAGE 13K: clean reference call states / no duplicate controls ===== */
.call-fullscreen.call-reference-ui:not(.incoming-call) #call-incoming-actions,
.call-fullscreen.call-reference-ui:not(.incoming-call) .call-accept-circle,
.call-fullscreen.call-reference-ui:not(.incoming-call) .call-decline-circle {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.call-fullscreen.call-reference-ui.incoming-call #call-active-actions,
.call-fullscreen.call-reference-ui.incoming-call .call-top-controls,
.call-fullscreen.call-reference-ui.incoming-call .call-video-area,
.call-fullscreen.call-reference-ui.incoming-call #call-local-video {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.call-fullscreen.call-reference-ui.incoming-call .call-wrapper {
    width: min(560px, 92vw) !important;
    min-height: auto !important;
    padding: 42px 34px 36px !important;
    border-radius: 34px !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    gap: 30px !important;
    background: linear-gradient(145deg, rgba(15, 23, 42, .78), rgba(2, 6, 23, .68)) !important;
    border: 1px solid rgba(148,163,184,.22) !important;
    box-shadow: 0 28px 90px rgba(0,0,0,.46) !important;
}

.call-fullscreen.call-reference-ui.incoming-call .call-header-info {
    position: relative !important;
    width: 100% !important;
    min-height: auto !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    gap: 16px !important;
}

.call-fullscreen.call-reference-ui.incoming-call #call-incoming-actions {
    position: relative !important;
    left: auto !important;
    bottom: auto !important;
    transform: none !important;
    display: flex !important;
    visibility: visible !important;
    pointer-events: auto !important;
    gap: 42px !important;
    margin: 0 auto !important;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
}

.call-fullscreen.call-reference-ui.incoming-call .call-accept-circle,
.call-fullscreen.call-reference-ui.incoming-call .call-decline-circle {
    display: inline-flex !important;
    visibility: visible !important;
    pointer-events: auto !important;
    width: 74px !important;
    height: 74px !important;
    min-width: 74px !important;
    border: 0 !important;
    box-shadow: 0 18px 40px rgba(0,0,0,.32) !important;
}

.call-fullscreen.call-reference-ui.video-call:not(.incoming-call):not(.call-minimized) {
    padding: 0 !important;
    background: #020617 !important;
}

.call-fullscreen.call-reference-ui.video-call:not(.incoming-call):not(.call-minimized) .call-wrapper {
    width: 100vw !important;
    height: 100dvh !important;
    min-height: 100dvh !important;
    border-radius: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

.call-fullscreen.call-reference-ui.video-call:not(.incoming-call):not(.call-minimized) .call-backdrop {
    background: #020617 !important;
    backdrop-filter: none !important;
}

.call-fullscreen.call-reference-ui.video-call:not(.incoming-call):not(.call-minimized) .call-video-area {
    inset: 0 !important;
    display: block !important;
    z-index: 3 !important;
}

.call-fullscreen.call-reference-ui.video-call:not(.incoming-call):not(.call-minimized) #call-remote-video,
.call-fullscreen.call-reference-ui.video-call:not(.incoming-call):not(.call-minimized) .call-video-placeholder {
    width: 100% !important;
    height: 100% !important;
    border-radius: 0 !important;
}

.call-fullscreen.call-reference-ui.video-call:not(.incoming-call):not(.call-minimized) #call-active-actions {
    position: absolute !important;
    left: 50% !important;
    bottom: calc(32px + env(safe-area-inset-bottom)) !important;
    transform: translateX(-50%) !important;
    display: flex !important;
    gap: 20px !important;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
}

.call-fullscreen.call-reference-ui.video-call:not(.incoming-call):not(.call-minimized) .call-top-controls {
    position: absolute !important;
    top: calc(26px + env(safe-area-inset-top)) !important;
    right: 28px !important;
    display: flex !important;
    gap: 18px !important;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
}

.call-fullscreen.call-reference-ui.video-call:not(.incoming-call):not(.call-minimized) .call-action-btn,
.call-fullscreen.call-reference-ui.video-call:not(.incoming-call):not(.call-minimized) .call-mini-icon {
    width: 58px !important;
    height: 58px !important;
    min-width: 58px !important;
    border-radius: 50% !important;
    border: 1px solid rgba(255,255,255,.16) !important;
    background: rgba(2, 6, 23, .20) !important;
    color: rgba(255,255,255,.94) !important;
    box-shadow: 0 16px 36px rgba(0,0,0,.28) !important;
    backdrop-filter: blur(10px) !important;
}

.call-fullscreen.call-reference-ui.video-call:not(.incoming-call):not(.call-minimized) .call-action-btn:hover {
    background: rgba(15,23,42,.34) !important;
}

.call-fullscreen.call-reference-ui.video-call:not(.incoming-call):not(.call-minimized) .call-end-circle {
    background: rgba(239,68,68,.92) !important;
    border-color: rgba(248,113,113,.45) !important;
}

.call-fullscreen.call-reference-ui.video-call:not(.incoming-call):not(.call-minimized) .call-deal-btn,
.call-fullscreen.call-reference-ui.video-call:not(.incoming-call):not(.call-minimized) #call-deal-btn {
    background: rgba(2,6,23,.20) !important;
}

.call-fullscreen.call-reference-ui.audio-call:not(.incoming-call) #call-incoming-actions {
    display: none !important;
}

.call-fullscreen.call-reference-ui.audio-call:not(.incoming-call) #call-active-actions {
    width: min(440px, calc(100% - 32px)) !important;
    display: flex !important;
    left: 50% !important;
    bottom: 34px !important;
    transform: translateX(-50%) !important;
    gap: 18px !important;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
}

.call-fullscreen.call-reference-ui.audio-call:not(.incoming-call) .call-action-btn:not(.call-end-circle):not(.call-decline-circle):not(.call-accept-circle):not(.active-off) {
    border: 1px solid rgba(255,255,255,.13) !important;
    background: rgba(15,23,42,.22) !important;
    box-shadow: 0 16px 34px rgba(0,0,0,.25) !important;
}

.call-fullscreen.call-reference-ui.call-controls-hidden:not(.incoming-call) #call-active-actions {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: translateX(-50%) translateY(14px) !important;
}

.call-fullscreen.call-reference-ui.call-controls-hidden:not(.incoming-call) .call-top-controls {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: translateY(-10px) !important;
}

.call-fullscreen.call-reference-ui.call-controls-hidden:not(.incoming-call) #call-local-video {
    opacity: 0 !important;
    pointer-events: none !important;
}

@media (max-width: 768px) {
    .call-fullscreen.call-reference-ui.incoming-call .call-wrapper {
        width: min(420px, 92vw) !important;
        padding: 34px 24px 30px !important;
        gap: 26px !important;
    }
    .call-fullscreen.call-reference-ui.video-call:not(.incoming-call):not(.call-minimized) #call-active-actions {
        bottom: calc(24px + env(safe-area-inset-bottom)) !important;
        gap: 10px !important;
    }
    .call-fullscreen.call-reference-ui.video-call:not(.incoming-call):not(.call-minimized) .call-action-btn,
    .call-fullscreen.call-reference-ui.video-call:not(.incoming-call):not(.call-minimized) .call-mini-icon {
        width: 52px !important;
        height: 52px !important;
        min-width: 52px !important;
    }
}

/* ===== STAGE 13L: call fullscreen incoming + remote state + glass invite polish ===== */
.call-fullscreen.call-reference-ui {
    background: radial-gradient(circle at 50% 22%, rgba(99, 102, 241, .18), transparent 34%), rgba(2, 6, 23, .94) !important;
}

.call-fullscreen.call-reference-ui.incoming-call {
    align-items: center !important;
    justify-content: center !important;
    padding: clamp(14px, 3vw, 34px) !important;
}

.call-fullscreen.call-reference-ui.incoming-call .call-wrapper {
    width: min(760px, 94vw) !important;
    min-height: min(680px, 86dvh) !important;
    height: auto !important;
    max-height: 92dvh !important;
    border-radius: 38px !important;
    background: linear-gradient(180deg, rgba(15, 23, 42, .82), rgba(2, 6, 23, .86)) !important;
    border: 1px solid rgba(148, 163, 184, .20) !important;
    box-shadow: 0 34px 120px rgba(0, 0, 0, .50), inset 0 1px 0 rgba(255,255,255,.06) !important;
    display: grid !important;
    place-items: center !important;
    gap: 34px !important;
    padding: clamp(28px, 5vw, 62px) !important;
}

.call-fullscreen.call-reference-ui.incoming-call .call-header-info {
    width: 100% !important;
    max-width: 560px !important;
    min-height: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 16px !important;
}

.call-fullscreen.call-reference-ui.incoming-call .call-avatar-ring {
    width: clamp(132px, 18vw, 190px) !important;
    height: clamp(132px, 18vw, 190px) !important;
    padding: 6px !important;
}

.call-fullscreen.call-reference-ui.incoming-call .call-avatar-img {
    font-size: clamp(3.6rem, 7vw, 5.8rem) !important;
}

.call-fullscreen.call-reference-ui.incoming-call .call-name {
    font-size: clamp(2rem, 4vw, 3rem) !important;
    line-height: 1.05 !important;
}

.call-fullscreen.call-reference-ui.incoming-call .call-status {
    font-size: clamp(1rem, 2vw, 1.25rem) !important;
    color: rgba(226, 232, 240, .72) !important;
}

.call-fullscreen.call-reference-ui.incoming-call #call-incoming-actions {
    position: static !important;
    display: flex !important;
    transform: none !important;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    gap: clamp(32px, 7vw, 84px) !important;
}

.call-fullscreen.call-reference-ui.incoming-call .call-accept-circle,
.call-fullscreen.call-reference-ui.incoming-call .call-decline-circle {
    width: 86px !important;
    height: 86px !important;
    min-width: 86px !important;
    border-radius: 999px !important;
    box-shadow: 0 18px 42px rgba(0,0,0,.36) !important;
    position: relative !important;
}

.call-fullscreen.call-reference-ui.incoming-call .call-accept-circle span,
.call-fullscreen.call-reference-ui.incoming-call .call-decline-circle span {
    display: block !important;
    position: absolute !important;
    top: calc(100% + 12px) !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    color: rgba(241,245,249,.92) !important;
    font-weight: 800 !important;
    white-space: nowrap !important;
    font-size: .92rem !important;
}

/* Active audio/video call screens are fullscreen, not small cards. */
.call-fullscreen.call-reference-ui:not(.incoming-call):not(.call-minimized) .call-wrapper {
    width: min(1180px, 96vw) !important;
    height: min(790px, 92dvh) !important;
    min-height: min(620px, 88dvh) !important;
    border-radius: 34px !important;
    background: linear-gradient(180deg, rgba(8, 13, 30, .86), rgba(2, 6, 23, .90)) !important;
    border: 1px solid rgba(148, 163, 184, .18) !important;
    box-shadow: 0 26px 90px rgba(0, 0, 0, .44) !important;
}

.call-fullscreen.call-reference-ui.video-call:not(.incoming-call):not(.call-minimized) .call-wrapper {
    width: min(1240px, 96vw) !important;
    height: min(820px, 92dvh) !important;
    background: rgba(2, 6, 23, .96) !important;
    overflow: hidden !important;
}

/* Truly transparent messenger controls: icons floating over the call. */
.call-fullscreen.call-reference-ui:not(.incoming-call) #call-active-actions,
.call-fullscreen.call-reference-ui:not(.incoming-call) .call-top-controls {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
}

.call-fullscreen.call-reference-ui:not(.incoming-call) .call-action-btn,
.call-fullscreen.call-reference-ui:not(.incoming-call) .call-mini-icon {
    background: rgba(15, 23, 42, .30) !important;
    border: 1px solid rgba(255, 255, 255, .15) !important;
    box-shadow: 0 14px 36px rgba(0,0,0,.34) !important;
    color: rgba(255,255,255,.92) !important;
    backdrop-filter: blur(14px) !important;
    -webkit-backdrop-filter: blur(14px) !important;
}

.call-fullscreen.call-reference-ui:not(.incoming-call) .call-action-btn:hover,
.call-fullscreen.call-reference-ui:not(.incoming-call) .call-mini-icon:hover {
    background: rgba(30, 41, 59, .50) !important;
}

.call-fullscreen.call-reference-ui:not(.incoming-call) .call-end-circle {
    background: rgba(239, 68, 68, .92) !important;
    border-color: rgba(248, 113, 113, .85) !important;
}

.call-fullscreen.call-reference-ui:not(.incoming-call) .call-accept-circle {
    background: rgba(34, 197, 94, .92) !important;
    border-color: rgba(74, 222, 128, .85) !important;
}

.call-fullscreen.call-reference-ui:not(.incoming-call) .call-action-btn.active-off {
    background: rgba(239, 68, 68, .82) !important;
    color: #fff !important;
}

.call-peer-state {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 35;
    padding: 12px 18px;
    border-radius: 999px;
    color: #fff;
    font-weight: 900;
    font-size: .98rem;
    background: rgba(15, 23, 42, .58);
    border: 1px solid rgba(255,255,255,.16);
    box-shadow: 0 20px 60px rgba(0,0,0,.36);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    pointer-events: none;
    opacity: 1;
    transition: opacity .18s ease, transform .18s ease;
}

.call-peer-state.hidden {
    opacity: 0;
    transform: translate(-50%, -50%) scale(.96);
}

.call-video-placeholder:not(.hidden) {
    display: grid !important;
    place-items: center !important;
    text-align: center !important;
    color: rgba(255,255,255,.82) !important;
    font-weight: 900 !important;
    font-size: clamp(1rem, 2vw, 1.35rem) !important;
    background: radial-gradient(circle at 50% 35%, rgba(99,102,241,.18), transparent 32%), rgba(2, 6, 23, .44) !important;
    z-index: 12 !important;
}

#call-local-video.local-camera-off {
    opacity: .22 !important;
    filter: grayscale(1) blur(2px) !important;
}

.call-invite-panel {
    background: rgba(2, 6, 23, .48) !important;
    backdrop-filter: blur(18px) !important;
    -webkit-backdrop-filter: blur(18px) !important;
}

.call-invite-card {
    background: linear-gradient(180deg, rgba(15, 23, 42, .76), rgba(2, 6, 23, .82)) !important;
    border: 1px solid rgba(148, 163, 184, .22) !important;
    box-shadow: 0 28px 100px rgba(0,0,0,.44), inset 0 1px 0 rgba(255,255,255,.06) !important;
    backdrop-filter: blur(22px) !important;
    -webkit-backdrop-filter: blur(22px) !important;
    border-radius: 28px !important;
    max-width: min(520px, 92vw) !important;
}

.call-invite-card .input,
#call-invite-search {
    background: rgba(15, 23, 42, .52) !important;
    border: 1px solid rgba(148, 163, 184, .20) !important;
    color: #fff !important;
    border-radius: 18px !important;
}

.call-invite-user {
    background: rgba(15, 23, 42, .46) !important;
    border-color: rgba(148, 163, 184, .18) !important;
    border-radius: 18px !important;
}

.call-invite-user.selected {
    background: rgba(99, 102, 241, .22) !important;
    border-color: rgba(129, 140, 248, .72) !important;
}

@media (max-width: 768px) {
    .call-fullscreen.call-reference-ui.incoming-call .call-wrapper,
    .call-fullscreen.call-reference-ui:not(.incoming-call):not(.call-minimized) .call-wrapper {
        width: 100vw !important;
        height: 100dvh !important;
        min-height: 100dvh !important;
        max-height: 100dvh !important;
        border-radius: 0 !important;
        border: 0 !important;
    }

    .call-fullscreen.call-reference-ui.incoming-call .call-avatar-ring {
        width: 136px !important;
        height: 136px !important;
    }

    .call-fullscreen.call-reference-ui.incoming-call #call-incoming-actions {
        gap: 54px !important;
    }

    .call-fullscreen.call-reference-ui.incoming-call .call-accept-circle,
    .call-fullscreen.call-reference-ui.incoming-call .call-decline-circle {
        width: 76px !important;
        height: 76px !important;
        min-width: 76px !important;
    }
}

/* ===== STAGE 13M: Telegram-like call overlay refinement ===== */
/* Incoming call is a compact notification card over the app, not a fullscreen call screen. */
.call-fullscreen.call-reference-ui.incoming-call {
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    padding: 0 !important;
    align-items: center !important;
    justify-content: center !important;
    pointer-events: none !important;
}

.call-fullscreen.call-reference-ui.incoming-call .call-backdrop {
    background: rgba(2, 6, 23, .18) !important;
    backdrop-filter: blur(5px) !important;
    -webkit-backdrop-filter: blur(5px) !important;
    pointer-events: none !important;
}

.call-fullscreen.call-reference-ui.incoming-call .call-wrapper {
    pointer-events: auto !important;
    width: min(430px, 92vw) !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    padding: 34px 30px 30px !important;
    gap: 26px !important;
    border-radius: 30px !important;
    background:
        radial-gradient(circle at 50% 22%, rgba(99,102,241,.18), transparent 34%),
        rgba(7, 12, 30, .86) !important;
    border: 1px solid rgba(148, 163, 184, .22) !important;
    box-shadow: 0 24px 80px rgba(0,0,0,.46), inset 0 1px 0 rgba(255,255,255,.06) !important;
    backdrop-filter: blur(22px) !important;
    -webkit-backdrop-filter: blur(22px) !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
}

.call-fullscreen.call-reference-ui.incoming-call .call-header-info {
    width: 100% !important;
    min-height: 0 !important;
    max-width: 100% !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    gap: 12px !important;
}

.call-fullscreen.call-reference-ui.incoming-call .call-avatar-ring {
    width: 124px !important;
    height: 124px !important;
    padding: 5px !important;
}

.call-fullscreen.call-reference-ui.incoming-call .call-avatar-img {
    font-size: 3.2rem !important;
}

.call-fullscreen.call-reference-ui.incoming-call .call-name {
    font-size: 1.65rem !important;
}

.call-fullscreen.call-reference-ui.incoming-call .call-status {
    font-size: 1rem !important;
    color: rgba(226, 232, 240, .70) !important;
}

.call-fullscreen.call-reference-ui.incoming-call #call-incoming-actions {
    position: static !important;
    transform: none !important;
    display: flex !important;
    gap: 34px !important;
    margin-top: 8px !important;
}

.call-fullscreen.call-reference-ui.incoming-call .call-accept-circle,
.call-fullscreen.call-reference-ui.incoming-call .call-decline-circle {
    width: 74px !important;
    height: 74px !important;
    min-width: 74px !important;
}

/* Outgoing and active calls are fullscreen-style over the call overlay. */
.call-fullscreen.call-reference-ui:not(.incoming-call):not(.call-minimized) {
    padding: 0 !important;
    background:
        radial-gradient(circle at 50% 10%, rgba(79, 70, 229, .12), transparent 35%),
        rgba(2, 6, 23, .96) !important;
}

.call-fullscreen.call-reference-ui:not(.incoming-call):not(.call-minimized) .call-backdrop {
    background: rgba(2, 6, 23, .72) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
}

.call-fullscreen.call-reference-ui:not(.incoming-call):not(.call-minimized) .call-wrapper {
    width: 100vw !important;
    max-width: none !important;
    height: 100dvh !important;
    min-height: 100dvh !important;
    max-height: none !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

.call-fullscreen.call-reference-ui.audio-call:not(.incoming-call):not(.call-minimized) .call-header-info {
    width: min(560px, 86vw) !important;
    min-height: 420px !important;
    border-radius: 34px !important;
    border: 1px solid rgba(148, 163, 184, .18) !important;
    background: linear-gradient(180deg, rgba(15, 23, 42, .54), rgba(2, 6, 23, .38)) !important;
    box-shadow: 0 24px 90px rgba(0,0,0,.34), inset 0 1px 0 rgba(255,255,255,.04) !important;
}

.call-fullscreen.call-reference-ui.video-call:not(.incoming-call):not(.call-minimized) .call-video-area {
    inset: 0 !important;
    width: 100vw !important;
    height: 100dvh !important;
}

/* No heavy control panels: only glass icons over the call. */
.call-fullscreen.call-reference-ui:not(.incoming-call) #call-active-actions,
.call-fullscreen.call-reference-ui:not(.incoming-call) .call-top-controls {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

.call-fullscreen.call-reference-ui:not(.incoming-call) #call-active-actions {
    bottom: calc(28px + env(safe-area-inset-bottom)) !important;
    gap: 18px !important;
}

.call-fullscreen.call-reference-ui:not(.incoming-call) .call-top-controls {
    top: calc(26px + env(safe-area-inset-top)) !important;
    right: 28px !important;
    gap: 16px !important;
}

.call-fullscreen.call-reference-ui:not(.incoming-call) .call-action-btn,
.call-fullscreen.call-reference-ui:not(.incoming-call) .call-mini-icon {
    width: 58px !important;
    height: 58px !important;
    min-width: 58px !important;
    border-radius: 999px !important;
    background: rgba(2, 6, 23, .16) !important;
    border: 1px solid rgba(255,255,255,.13) !important;
    color: rgba(255,255,255,.92) !important;
    box-shadow: 0 14px 34px rgba(0,0,0,.25) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
}

.call-fullscreen.call-reference-ui:not(.incoming-call) .call-end-circle {
    background: rgba(239, 68, 68, .90) !important;
    border-color: rgba(248,113,113,.55) !important;
}

.call-fullscreen.call-reference-ui:not(.incoming-call) .call-action-btn.active-off {
    background: rgba(239, 68, 68, .72) !important;
}

/* Remote state messages/“waiting video” are small lower badges, not text in the center. */
.call-peer-state {
    top: auto !important;
    bottom: calc(108px + env(safe-area-inset-bottom)) !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    padding: 8px 12px !important;
    border-radius: 999px !important;
    font-size: .82rem !important;
    font-weight: 800 !important;
    background: rgba(2, 6, 23, .28) !important;
    color: rgba(255,255,255,.88) !important;
    border: 1px solid rgba(255,255,255,.12) !important;
    box-shadow: 0 10px 30px rgba(0,0,0,.22) !important;
}

.call-peer-state.hidden {
    opacity: 0 !important;
    transform: translateX(-50%) translateY(8px) !important;
}

.call-video-placeholder:not(.hidden) {
    inset: auto auto calc(108px + env(safe-area-inset-bottom)) 50% !important;
    transform: translateX(-50%) !important;
    width: auto !important;
    height: auto !important;
    min-width: 0 !important;
    padding: 8px 12px !important;
    border-radius: 999px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(2, 6, 23, .26) !important;
    border: 1px solid rgba(255,255,255,.12) !important;
    color: rgba(255,255,255,.82) !important;
    font-size: .84rem !important;
    font-weight: 850 !important;
    z-index: 13 !important;
}

.call-video-placeholder:not(.hidden)::before,
.call-peer-state::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(129, 140, 248, .95);
    margin-right: 8px;
    box-shadow: 0 0 14px rgba(129, 140, 248, .62);
}

@media (max-width: 768px) {
    .call-fullscreen.call-reference-ui.incoming-call .call-wrapper {
        width: min(360px, 88vw) !important;
        padding: 28px 22px 26px !important;
        border-radius: 28px !important;
    }
    .call-fullscreen.call-reference-ui.incoming-call .call-avatar-ring {
        width: 110px !important;
        height: 110px !important;
    }
    .call-fullscreen.call-reference-ui:not(.incoming-call) #call-active-actions {
        gap: 10px !important;
        bottom: calc(22px + env(safe-area-inset-bottom)) !important;
    }
    .call-fullscreen.call-reference-ui:not(.incoming-call) .call-action-btn,
    .call-fullscreen.call-reference-ui:not(.incoming-call) .call-mini-icon {
        width: 52px !important;
        height: 52px !important;
        min-width: 52px !important;
    }
    .call-fullscreen.call-reference-ui:not(.incoming-call) .call-top-controls {
        top: calc(16px + env(safe-area-inset-top)) !important;
        right: 12px !important;
        gap: 10px !important;
    }
    .call-fullscreen.call-reference-ui #call-local-video {
        top: calc(78px + env(safe-area-inset-top)) !important;
        right: 12px !important;
        width: 118px !important;
        height: 158px !important;
        border-radius: 22px !important;
    }
}


/* ===== STAGE 13N: call final polish - compact incoming labels, no waiting text, mute slash, avatar fallback ===== */
/* Incoming call remains a compact card above the app; labels stay inside bounds. */
.call-fullscreen.call-reference-ui.incoming-call .call-wrapper {
    width: min(420px, 92vw) !important;
    padding: 30px 28px 44px !important;
    gap: 22px !important;
    overflow: visible !important;
}
.call-fullscreen.call-reference-ui.incoming-call .call-avatar-ring {
    width: 118px !important;
    height: 118px !important;
}
.call-fullscreen.call-reference-ui.incoming-call .call-name {
    font-size: 1.52rem !important;
    line-height: 1.05 !important;
}
.call-fullscreen.call-reference-ui.incoming-call .call-status {
    font-size: .96rem !important;
    line-height: 1.25 !important;
}
.call-fullscreen.call-reference-ui.incoming-call #call-incoming-actions {
    gap: 38px !important;
    margin-top: 4px !important;
    padding-bottom: 24px !important;
    align-items: flex-start !important;
}
.call-fullscreen.call-reference-ui.incoming-call .call-accept-circle,
.call-fullscreen.call-reference-ui.incoming-call .call-decline-circle {
    width: 68px !important;
    height: 68px !important;
    min-width: 68px !important;
}
.call-fullscreen.call-reference-ui.incoming-call .call-accept-circle span,
.call-fullscreen.call-reference-ui.incoming-call .call-decline-circle span {
    top: calc(100% + 8px) !important;
    font-size: .86rem !important;
    line-height: 1.1 !important;
}

/* Remove the central “waiting video” text. Only show a circular avatar when the peer turned camera off. */
.call-fullscreen.call-reference-ui .call-video-placeholder {
    background: transparent !important;
}
.call-fullscreen.call-reference-ui .call-video-placeholder:not(.peer-camera-off-placeholder) {
    display: none !important;
}
.call-fullscreen.call-reference-ui .call-video-placeholder.peer-camera-off-placeholder:not(.hidden) {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    transform: none !important;
    background: radial-gradient(circle at 50% 40%, rgba(99,102,241,.14), transparent 34%), rgba(2,6,23,.52) !important;
    display: grid !important;
    place-items: center !important;
    z-index: 11 !important;
}
.call-fullscreen.call-reference-ui .call-video-placeholder.peer-camera-off-placeholder::before,
.call-fullscreen.call-reference-ui .call-video-placeholder.peer-camera-off-placeholder::after {
    display: none !important;
    content: none !important;
}
.call-video-avatar-fallback {
    display: grid !important;
    place-items: center !important;
}
.call-video-avatar-ring {
    width: clamp(130px, 16vw, 190px) !important;
    height: clamp(130px, 16vw, 190px) !important;
    border-radius: 50% !important;
    padding: 6px !important;
    background: linear-gradient(135deg, rgba(129,140,248,.98), rgba(124,58,237,.96)) !important;
    box-shadow: 0 0 38px rgba(99,102,241,.35), 0 24px 70px rgba(0,0,0,.42) !important;
}
.call-video-avatar-img {
    width: 100% !important;
    height: 100% !important;
    border-radius: 50% !important;
    display: grid !important;
    place-items: center !important;
    color: #fff !important;
    font-size: clamp(3.6rem, 6vw, 5.6rem) !important;
    font-weight: 950 !important;
    background: linear-gradient(135deg, #4f46e5, #7c3aed) !important;
}

/* Peer status is a small unobtrusive badge near controls, not center text. */
.call-peer-state {
    top: auto !important;
    bottom: calc(100px + env(safe-area-inset-bottom)) !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    max-width: min(86vw, 420px) !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}
.call-peer-state.hidden {
    transform: translateX(-50%) translateY(8px) !important;
}

/* Muted camera/mic buttons: red slash over the icon, messenger-style. */
.call-fullscreen.call-reference-ui .call-action-btn.active-off {
    background: rgba(239,68,68,.18) !important;
    border-color: rgba(248,113,113,.42) !important;
    color: #fff !important;
    position: relative !important;
}
.call-fullscreen.call-reference-ui .call-action-btn.active-off::after {
    content: '' !important;
    position: absolute !important;
    left: 50% !important;
    top: 50% !important;
    width: 62% !important;
    height: 3px !important;
    border-radius: 999px !important;
    background: #ef4444 !important;
    box-shadow: 0 0 12px rgba(239,68,68,.65) !important;
    transform: translate(-50%, -50%) rotate(-42deg) !important;
    pointer-events: none !important;
}

@media (max-width: 768px) {
    .call-fullscreen.call-reference-ui.incoming-call .call-wrapper {
        width: min(360px, 90vw) !important;
        padding: 26px 22px 42px !important;
        gap: 18px !important;
    }
    .call-fullscreen.call-reference-ui.incoming-call .call-avatar-ring {
        width: 104px !important;
        height: 104px !important;
    }
    .call-fullscreen.call-reference-ui.incoming-call .call-name {
        font-size: 1.35rem !important;
    }
    .call-fullscreen.call-reference-ui.incoming-call .call-status {
        font-size: .88rem !important;
    }
    .call-fullscreen.call-reference-ui.incoming-call #call-incoming-actions {
        gap: 30px !important;
        padding-bottom: 24px !important;
    }
    .call-fullscreen.call-reference-ui.incoming-call .call-accept-circle,
    .call-fullscreen.call-reference-ui.incoming-call .call-decline-circle {
        width: 62px !important;
        height: 62px !important;
        min-width: 62px !important;
    }
    .call-peer-state {
        bottom: calc(92px + env(safe-area-inset-bottom)) !important;
        font-size: .78rem !important;
    }
}

/* ===== STAGE 13O: clean video avatar fallback + draggable mini call ===== */
/* The old “more” action was foundation-only and had no handler. Keep it removed from DOM, hide defensively for cached markup. */
#call-more-btn {
    display: none !important;
}

/* When peer camera is off, show only a clean round avatar in the center, not a rectangular card. */
.call-fullscreen.call-reference-ui.video-call:not(.incoming-call):not(.call-minimized) .call-video-placeholder.peer-camera-off-placeholder:not(.hidden) {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    outline: 0 !important;
    transform: none !important;
    display: grid !important;
    place-items: center !important;
    background:
        radial-gradient(circle at 50% 42%, rgba(99,102,241,.13), transparent 30%),
        rgba(2, 6, 23, .64) !important;
    z-index: 11 !important;
    pointer-events: none !important;
}
.call-fullscreen.call-reference-ui.video-call:not(.incoming-call):not(.call-minimized) .call-video-placeholder.peer-camera-off-placeholder::before,
.call-fullscreen.call-reference-ui.video-call:not(.incoming-call):not(.call-minimized) .call-video-placeholder.peer-camera-off-placeholder::after {
    display: none !important;
    content: none !important;
}
.call-fullscreen.call-reference-ui.video-call:not(.incoming-call):not(.call-minimized) .call-video-avatar-fallback {
    width: auto !important;
    height: auto !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 50% !important;
    background: transparent !important;
    box-shadow: none !important;
    display: grid !important;
    place-items: center !important;
}
.call-fullscreen.call-reference-ui.video-call:not(.incoming-call):not(.call-minimized) .call-video-avatar-ring {
    width: clamp(132px, 17vw, 196px) !important;
    height: clamp(132px, 17vw, 196px) !important;
    border-radius: 50% !important;
    padding: 6px !important;
    background: linear-gradient(135deg, rgba(129,140,248,.98), rgba(124,58,237,.96)) !important;
    border: 0 !important;
    box-shadow: 0 0 42px rgba(99,102,241,.34), 0 24px 78px rgba(0,0,0,.44) !important;
}
.call-fullscreen.call-reference-ui.video-call:not(.incoming-call):not(.call-minimized) .call-video-avatar-img,
.call-fullscreen.call-reference-ui .call-avatar-img {
    overflow: hidden !important;
}
.call-fullscreen.call-reference-ui.video-call:not(.incoming-call):not(.call-minimized) .call-video-avatar-img img,
.call-fullscreen.call-reference-ui .call-avatar-img img {
    width: 100% !important;
    height: 100% !important;
    display: block !important;
    object-fit: cover !important;
    border-radius: 50% !important;
}

/* If own camera is switched off after being enabled, remove the local rectangular preview completely. */
.call-fullscreen.call-reference-ui.video-call:not(.incoming-call):not(.call-minimized) #call-local-video.local-camera-off {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    transform: scale(.92) !important;
}

/* Mini-call window: draggable bubble, tap/click expands; no stream reset. */
.call-fullscreen.call-reference-ui.call-minimized {
    touch-action: none !important;
    user-select: none !important;
}
.call-fullscreen.call-reference-ui.call-minimized .call-wrapper {
    cursor: grab !important;
    touch-action: none !important;
    user-select: none !important;
}
.call-fullscreen.call-reference-ui.call-minimized.dragging .call-wrapper {
    cursor: grabbing !important;
    transition: none !important;
}
.call-fullscreen.call-reference-ui.call-minimized.dragging {
    transition: none !important;
}

@media (max-width: 768px) {
    .call-fullscreen.call-reference-ui.video-call:not(.incoming-call):not(.call-minimized) .call-video-avatar-ring {
        width: 132px !important;
        height: 132px !important;
    }
    .call-fullscreen.call-reference-ui.video-call:not(.incoming-call):not(.call-minimized) .call-video-avatar-img {
        font-size: 3.7rem !important;
    }
}

/* ===== STAGE 13P: clean audio avatar + reliable remote video/avatar state + global incoming card ===== */
/* Audio call: remove the rectangular profile card. Keep only a clean round avatar/name/status over the call background. */
.call-fullscreen.call-reference-ui.audio-call:not(.incoming-call):not(.call-minimized) .call-header-info,
.call-fullscreen.call-reference-ui.audio-call:not(.incoming-call):not(.call-minimized) #call-header-info {
    width: auto !important;
    max-width: min(520px, 88vw) !important;
    min-height: 0 !important;
    height: auto !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 18px !important;
}
.call-fullscreen.call-reference-ui.audio-call:not(.incoming-call):not(.call-minimized) .call-avatar-ring {
    width: clamp(138px, 17vw, 196px) !important;
    height: clamp(138px, 17vw, 196px) !important;
}
.call-fullscreen.call-reference-ui.audio-call:not(.incoming-call):not(.call-minimized) .call-avatar-img {
    font-size: clamp(3.7rem, 6vw, 5.7rem) !important;
}

/* Video call: header avatar must never stay over real video; only peer-camera-off placeholder may show avatar. */
.call-fullscreen.call-reference-ui.video-call:not(.incoming-call):not(.call-minimized) #call-header-info,
.call-fullscreen.call-reference-ui.video-call:not(.incoming-call):not(.call-minimized) .call-header-info {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}
.call-fullscreen.call-reference-ui.video-call:not(.incoming-call):not(.call-minimized) .call-video-placeholder.hidden,
.call-fullscreen.call-reference-ui.video-call:not(.incoming-call):not(.call-minimized) .call-video-placeholder:not(.peer-camera-off-placeholder) {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}
.call-fullscreen.call-reference-ui.video-call:not(.incoming-call):not(.call-minimized) .call-video-placeholder.peer-camera-off-placeholder:not(.hidden) {
    border: 0 !important;
    box-shadow: none !important;
    outline: 0 !important;
}
.call-fullscreen.call-reference-ui.video-call:not(.incoming-call):not(.call-minimized) .call-video-avatar-fallback,
.call-fullscreen.call-reference-ui.video-call:not(.incoming-call):not(.call-minimized) .call-video-avatar-ring,
.call-fullscreen.call-reference-ui.video-call:not(.incoming-call):not(.call-minimized) .call-video-avatar-img {
    border-radius: 50% !important;
}

/* The call overlay may be injected globally on non-chat pages; it must still sit above the app. */
#call-modal.call-fullscreen.call-reference-ui {
    z-index: 10050 !important;
}

@media (max-width: 768px) {
    .call-fullscreen.call-reference-ui.audio-call:not(.incoming-call):not(.call-minimized) .call-avatar-ring {
        width: 132px !important;
        height: 132px !important;
    }
    .call-fullscreen.call-reference-ui.audio-call:not(.incoming-call):not(.call-minimized) .call-avatar-img {
        font-size: 3.7rem !important;
    }
}

@media (max-width: 599px) {
    .call-fullscreen.call-reference-ui.audio-call:not(.incoming-call):not(.call-minimized) #call-active-actions {
        display: grid !important;
        grid-template-columns: repeat(3, 52px) !important;
        justify-content: center !important;
    }
}

/* A short audio viewport needs a smaller identity block above its real controls. */
@media (max-height: 650px) {
    .call-fullscreen.call-reference-ui.audio-call:not(.incoming-call):not(.call-minimized) .call-header-info,
    .call-fullscreen.call-reference-ui.audio-call:not(.incoming-call):not(.call-minimized) #call-header-info {
        gap: 10px !important;
    }
    .call-fullscreen.call-reference-ui.audio-call:not(.incoming-call):not(.call-minimized) .call-avatar-ring {
        width: clamp(72px, 20dvh, 110px) !important;
        height: clamp(72px, 20dvh, 110px) !important;
    }
    .call-fullscreen.call-reference-ui.audio-call:not(.incoming-call):not(.call-minimized) .call-avatar-img {
        font-size: 2.8rem !important;
    }
    .call-fullscreen.call-reference-ui.audio-call:not(.incoming-call):not(.call-minimized) .call-name {
        font-size: clamp(20px, 4dvh, 24px) !important;
    }
    .call-fullscreen.call-reference-ui.audio-call:not(.incoming-call):not(.call-minimized) .call-status {
        font-size: .94rem !important;
    }
}

/* ===== STAGE 13Q: local preview focus + live draggable square mini-call + participant picker polish ===== */
/* Tap the small local camera preview to bring own camera to the main stage, messenger-style. */
.call-fullscreen.call-reference-ui.video-call:not(.incoming-call):not(.call-minimized) #call-local-video {
    cursor: pointer !important;
}
.call-fullscreen.call-reference-ui.video-call.call-local-expanded:not(.incoming-call):not(.call-minimized) #call-local-video {
    position: absolute !important;
    inset: 0 !important;
    top: 0 !important;
    right: auto !important;
    width: 100% !important;
    height: 100% !important;
    border-radius: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
    z-index: 5 !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    transform: none !important;
    background: #020617 !important;
}
.call-fullscreen.call-reference-ui.video-call.call-local-expanded:not(.incoming-call):not(.call-minimized) #call-remote-video,
.call-fullscreen.call-reference-ui.video-call.call-local-expanded:not(.incoming-call):not(.call-minimized) .call-video-placeholder.peer-camera-off-placeholder:not(.hidden) {
    position: absolute !important;
    inset: auto !important;
    top: 96px !important;
    right: 28px !important;
    width: min(220px, 28vw) !important;
    height: min(150px, 20vw) !important;
    border-radius: 24px !important;
    border: 1px solid rgba(255,255,255,.18) !important;
    box-shadow: 0 18px 42px rgba(0,0,0,.35) !important;
    overflow: hidden !important;
    z-index: 13 !important;
    background: #020617 !important;
    pointer-events: none !important;
}
.call-fullscreen.call-reference-ui.video-call.call-local-expanded:not(.incoming-call):not(.call-minimized) .call-video-placeholder.peer-camera-off-placeholder:not(.hidden) .call-video-avatar-ring {
    width: 76px !important;
    height: 76px !important;
    padding: 4px !important;
}
.call-fullscreen.call-reference-ui.video-call.call-local-expanded:not(.incoming-call):not(.call-minimized) .call-video-placeholder.peer-camera-off-placeholder:not(.hidden) .call-video-avatar-img {
    font-size: 2rem !important;
}
.call-fullscreen.call-reference-ui.video-call.call-local-expanded.call-controls-hidden:not(.incoming-call):not(.call-minimized) #call-local-video {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    transform: none !important;
}
.call-fullscreen.call-reference-ui.video-call.call-local-expanded.call-controls-hidden:not(.incoming-call):not(.call-minimized) #call-remote-video,
.call-fullscreen.call-reference-ui.video-call.call-local-expanded.call-controls-hidden:not(.incoming-call):not(.call-minimized) .call-video-placeholder.peer-camera-off-placeholder:not(.hidden) {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: translateY(-8px) !important;
}

/* Minimized call is now a live square preview, not a text card. It stays draggable and click/tap expands. */
.call-fullscreen.call-reference-ui.call-minimized {
    width: 184px !important;
    height: 184px !important;
    min-width: 184px !important;
    min-height: 184px !important;
    border-radius: 28px !important;
    overflow: visible !important;
    touch-action: none !important;
    user-select: none !important;
}
.call-fullscreen.call-reference-ui.call-minimized .call-wrapper {
    width: 184px !important;
    height: 184px !important;
    min-height: 184px !important;
    padding: 0 !important;
    border-radius: 28px !important;
    overflow: hidden !important;
    background: radial-gradient(circle at 50% 35%, rgba(99,102,241,.22), #020617 70%) !important;
    border: 1px solid rgba(255,255,255,.16) !important;
    box-shadow: 0 18px 52px rgba(0,0,0,.46) !important;
    cursor: grab !important;
}
.call-fullscreen.call-reference-ui.call-minimized.video-call .call-video-area {
    display: block !important;
    visibility: visible !important;
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 2 !important;
    background: #020617 !important;
}
.call-fullscreen.call-reference-ui.call-minimized.video-call #call-remote-video,
.call-fullscreen.call-reference-ui.call-minimized.video-call .call-video-placeholder.peer-camera-off-placeholder:not(.hidden) {
    display: block !important;
    visibility: visible !important;
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    object-fit: cover !important;
    z-index: 2 !important;
}
.call-fullscreen.call-reference-ui.call-minimized.video-call .call-video-placeholder.peer-camera-off-placeholder:not(.hidden) {
    display: grid !important;
    place-items: center !important;
    background: radial-gradient(circle at 50% 35%, rgba(99,102,241,.25), #020617 76%) !important;
}
.call-fullscreen.call-reference-ui.call-minimized.video-call .call-video-avatar-ring,
.call-fullscreen.call-reference-ui.call-minimized.audio-call .call-avatar-ring {
    width: 82px !important;
    height: 82px !important;
    padding: 4px !important;
}
.call-fullscreen.call-reference-ui.call-minimized.video-call .call-video-avatar-img,
.call-fullscreen.call-reference-ui.call-minimized.audio-call .call-avatar-img {
    font-size: 2.1rem !important;
}
.call-fullscreen.call-reference-ui.call-minimized.video-call #call-local-video,
.call-fullscreen.call-reference-ui.call-minimized.video-call .call-top-controls,
.call-fullscreen.call-reference-ui.call-minimized.video-call #call-active-actions,
.call-fullscreen.call-reference-ui.call-minimized.video-call #call-incoming-actions,
.call-fullscreen.call-reference-ui.call-minimized.video-call .call-header-info {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}
.call-fullscreen.call-reference-ui.call-minimized.audio-call .call-video-area,
.call-fullscreen.call-reference-ui.call-minimized.audio-call .call-top-controls,
.call-fullscreen.call-reference-ui.call-minimized.audio-call #call-active-actions,
.call-fullscreen.call-reference-ui.call-minimized.audio-call #call-incoming-actions {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}
.call-fullscreen.call-reference-ui.call-minimized.audio-call .call-header-info {
    display: flex !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    padding: 18px 14px !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
}
.call-fullscreen.call-reference-ui.call-minimized.audio-call .call-name {
    font-size: .95rem !important;
    line-height: 1.1 !important;
    max-width: 150px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    text-align: center !important;
}
.call-fullscreen.call-reference-ui.call-minimized.audio-call .call-status {
    font-size: .74rem !important;
    opacity: .72 !important;
    text-align: center !important;
}
.call-fullscreen.call-reference-ui.call-minimized::after {
    content: '' !important;
    position: absolute !important;
    inset: 0 !important;
    border-radius: 28px !important;
    pointer-events: none !important;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.08) !important;
}

/* Participant picker: use dialog list style and make selected rows obvious. */
.call-invite-user .avatar img,
.call-invite-user .avatar.has-image img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 50% !important;
    display: block !important;
}
.call-invite-user span:nth-child(2) {
    display: flex !important;
    flex-direction: column !important;
    min-width: 0 !important;
}
.call-invite-user span:nth-child(2) small {
    color: var(--text-secondary) !important;
    font-size: .78rem !important;
    max-width: 320px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}
.call-peer-state.invite {
    background: rgba(99,102,241,.22) !important;
    border-color: rgba(129,140,248,.42) !important;
}

@media (max-width: 768px) {
    .call-fullscreen.call-reference-ui.video-call.call-local-expanded:not(.incoming-call):not(.call-minimized) #call-remote-video,
    .call-fullscreen.call-reference-ui.video-call.call-local-expanded:not(.incoming-call):not(.call-minimized) .call-video-placeholder.peer-camera-off-placeholder:not(.hidden) {
        top: calc(78px + env(safe-area-inset-top)) !important;
        right: 14px !important;
        width: 132px !important;
        height: 176px !important;
        border-radius: 22px !important;
    }
    .call-fullscreen.call-reference-ui.call-minimized {
        width: 152px !important;
        height: 152px !important;
        min-width: 152px !important;
        min-height: 152px !important;
        left: 12px !important;
        bottom: calc(14px + env(safe-area-inset-bottom)) !important;
        border-radius: 24px !important;
    }
    .call-fullscreen.call-reference-ui.call-minimized .call-wrapper {
        width: 152px !important;
        height: 152px !important;
        min-height: 152px !important;
        border-radius: 24px !important;
    }
    .call-fullscreen.call-reference-ui.call-minimized.audio-call .call-avatar-ring,
    .call-fullscreen.call-reference-ui.call-minimized.video-call .call-video-avatar-ring {
        width: 68px !important;
        height: 68px !important;
    }
    .call-fullscreen.call-reference-ui.call-minimized.audio-call .call-name {
        max-width: 120px !important;
        font-size: .86rem !important;
    }
}

/* ===== STAGE 13R: robust local camera preview tap target ===== */
/* Older auto-hide rules made the local preview lose pointer events, so taps never reached JS. */
.call-fullscreen.call-reference-ui.video-call:not(.incoming-call):not(.call-minimized) #call-local-video {
    pointer-events: auto !important;
    touch-action: manipulation !important;
    cursor: pointer !important;
}
.call-fullscreen.call-reference-ui.video-call.call-controls-hidden:not(.incoming-call):not(.call-minimized) #call-local-video {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    transform: none !important;
}
.call-fullscreen.call-reference-ui.video-call:not(.incoming-call):not(.call-minimized) .call-video-area {
    touch-action: manipulation !important;
}


/* === Stage 14A: group chat foundation === */
.chat-new-group-btn {
    position: relative;
}

.chat-item.group-dialog .group-avatar,
.avatar.group-avatar {
    background: linear-gradient(135deg, var(--primary, #6d5dfc), #20c6ff);
    color: #fff;
}

.chat-item.group-dialog .chat-item-preview {
    color: var(--text-muted, #7b8190);
}

.group-chat-modal.hidden {
    display: none !important;
}

.group-chat-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: grid;
    place-items: center;
    padding: 18px;
}

.group-chat-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 12, 24, 0.56);
    backdrop-filter: blur(10px);
}

.group-chat-card {
    position: relative;
    width: min(520px, 100%);
    max-height: min(720px, calc(100vh - 36px));
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 18px;
    border-radius: 24px;
    background: var(--card-bg, #fff);
    color: var(--text-primary, #151823);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.26);
    border: 1px solid rgba(120, 132, 170, 0.18);
}

.group-chat-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.group-chat-title {
    font-weight: 800;
    font-size: 20px;
    letter-spacing: -0.02em;
}

.group-chat-subtitle {
    margin-top: 2px;
    font-size: 13px;
    color: var(--text-muted, #7b8190);
}

.group-chat-close {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 14px;
    background: rgba(120, 132, 170, 0.12);
    color: inherit;
    cursor: pointer;
    font-size: 26px;
    line-height: 1;
}

.group-chat-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted, #7b8190);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.group-chat-selected {
    min-height: 38px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.group-selected-empty {
    color: var(--text-muted, #7b8190);
    font-size: 13px;
}

.group-selected-chip {
    border: 0;
    border-radius: 999px;
    padding: 8px 10px 8px 12px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(109, 93, 252, 0.12);
    color: var(--primary, #6d5dfc);
    font-weight: 700;
    cursor: pointer;
}

.group-selected-chip b {
    font-size: 17px;
    line-height: 1;
}

.group-chat-results {
    overflow: auto;
    min-height: 160px;
    max-height: 280px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-right: 2px;
}

.group-candidate {
    width: 100%;
    border: 0;
    border-radius: 18px;
    padding: 10px;
    background: transparent;
    color: inherit;
    display: grid;
    grid-template-columns: 42px 1fr 28px;
    align-items: center;
    gap: 10px;
    text-align: left;
    cursor: pointer;
}

.group-candidate:hover,
.group-candidate.selected {
    background: rgba(109, 93, 252, 0.10);
}

.group-candidate-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.group-candidate-main b,
.group-candidate-main small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.group-candidate-main small {
    color: var(--text-muted, #7b8190);
    font-size: 12px;
}

.group-candidate-check {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    opacity: 0;
    transform: scale(0.86);
    background: var(--primary, #6d5dfc);
    color: #fff;
    font-weight: 900;
    transition: 0.16s ease;
}

.group-candidate.selected .group-candidate-check {
    opacity: 1;
    transform: scale(1);
}

.group-chat-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 6px;
}

.message.group-message.received .message-content {
    padding-top: 8px;
}

.message-sender-name {
    margin-bottom: 4px;
    font-size: 12px;
    font-weight: 800;
    color: var(--primary, #6d5dfc);
}

.group-disabled {
    opacity: 0.55;
}

@media (max-width: 640px) {
    .group-chat-modal {
        padding: 10px;
        align-items: end;
    }

    .group-chat-card {
        width: 100%;
        max-height: 88vh;
        border-radius: 26px 26px 18px 18px;
        padding: 16px;
    }

    .group-chat-results {
        max-height: 42vh;
    }

    .group-chat-actions {
        flex-direction: column-reverse;
    }

    .group-chat-actions .btn {
        width: 100%;
    }
}


/* === Stage 14B: robust group create modal open/picker === */
body.group-chat-modal-open {
    overflow: hidden;
}

.group-empty {
    padding: 18px 14px;
    border-radius: 18px;
    background: rgba(120, 132, 170, 0.08);
    color: var(--text-muted, #7b8190);
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: center;
}

.group-empty b {
    color: var(--text-primary, #151823);
}

.group-empty span {
    font-size: 13px;
}

.group-chat-modal:not(.hidden) {
    pointer-events: auto !important;
}

.chat-new-group-btn {
    pointer-events: auto !important;
}


/* ===== STAGE 14N: group chat isolation + mobile dark surface repair ===== */
.group-chat-modal {
    position: fixed !important;
    inset: 0 !important;
    z-index: 2147483000 !important;
    display: grid !important;
    place-items: center !important;
    padding: 18px !important;
    background: rgba(3, 7, 18, .46) !important;
    backdrop-filter: blur(14px) !important;
    -webkit-backdrop-filter: blur(14px) !important;
    pointer-events: auto !important;
}
.group-chat-modal.hidden,
.group-chat-modal[aria-hidden="true"] {
    display: none !important;
    pointer-events: none !important;
}
.group-chat-backdrop {
    position: absolute !important;
    inset: 0 !important;
    z-index: 0 !important;
    background: transparent !important;
}
.group-chat-card {
    position: relative !important;
    z-index: 2 !important;
    background: color-mix(in srgb, var(--bg-secondary) 78%, transparent) !important;
    color: var(--text) !important;
    border: 1px solid rgba(255,255,255,.12) !important;
    box-shadow: 0 28px 90px rgba(0,0,0,.34) !important;
    backdrop-filter: blur(22px) saturate(1.25) !important;
    -webkit-backdrop-filter: blur(22px) saturate(1.25) !important;
}
body.theme-light .group-chat-modal { background: rgba(15,23,42,.22) !important; }
body.theme-light .group-chat-card {
    background: rgba(255,255,255,.86) !important;
    color: #0f172a !important;
    border-color: rgba(15,23,42,.10) !important;
}
body.theme-light .group-empty b { color: #0f172a !important; }

/* Do not let a failed group request leave old private messages on screen. */
.chat-active[data-chat-type="group"] .message:not(.group-message) .message-sender-name { display: block; }

@media (max-width: 1024px) {
    body:not(.theme-light)[data-page="chats"],
    body:not(.theme-light)[data-page="chats"] .app,
    /* A1: .chat-main/.chat-active/.chat-messages removed from this solid-color
       list — they used to overpaint the Stage 149 wallpaper on mobile dark
       theme (higher specificity + later shorthand background). The chat column
       keeps the same #0b1020 base via the Stage 149 .chat-main rule. */
    body:not(.theme-light)[data-page="chats"] .main-content,
    body:not(.theme-light)[data-page="chats"] .page-content,
    body:not(.theme-light)[data-page="chats"] .chats-page,
    body:not(.theme-light)[data-page="chats"] .chats-container {
        background: #0b1020 !important;
        background-color: #0b1020 !important;
    }
    body:not(.theme-light)[data-page="chats"] .chat-header {
        background: #111827 !important;
        border-bottom-color: rgba(255,255,255,.08) !important;
    }
    body:not(.theme-light)[data-page="chats"] .chat-messages {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        background-image: radial-gradient(circle at 25% 0%, rgba(99,102,241,.06), transparent 30%) !important;
    }
    body:not(.theme-light)[data-page="chats"] .chat-input-area {
        background: #0b1020 !important;
        background-color: #0b1020 !important;
        border-top-color: rgba(255,255,255,.08) !important;
        box-shadow: 0 -12px 28px rgba(0,0,0,.26) !important;
    }
    body:not(.theme-light)[data-page="chats"] .chat-input-wrapper {
        background: #111827 !important;
        border-color: rgba(255,255,255,.06) !important;
    }
    body:not(.theme-light)[data-page="chats"] .chat-input-wrapper:focus-within {
        background: #151c2d !important;
        border-color: rgba(139,92,246,.55) !important;
    }
    .group-chat-modal {
        align-items: end !important;
        padding: 10px !important;
    }
    .group-chat-card {
        width: 100% !important;
        max-height: min(88dvh, 720px) !important;
        border-radius: 26px 26px 18px 18px !important;
    }
}


/* === Stage 14O: group members panel + clearer group initials === */
#group-members-btn.hidden {
    display: none !important;
}

.chat-item.group-dialog .group-avatar,
.avatar.group-avatar {
    font-weight: 800;
    letter-spacing: -0.02em;
}

.group-members-panel.hidden,
.group-members-panel[aria-hidden="true"] {
    display: none !important;
    pointer-events: none !important;
}

.group-members-panel {
    position: fixed;
    inset: 0;
    z-index: 2147483001;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(3, 7, 18, .42);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.group-members-backdrop {
    position: absolute;
    inset: 0;
}

.group-members-card {
    position: relative;
    z-index: 2;
    width: min(460px, 100%);
    max-height: min(680px, calc(100dvh - 36px));
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 18px;
    border-radius: 24px;
    background: color-mix(in srgb, var(--bg-secondary) 80%, transparent);
    color: var(--text);
    border: 1px solid rgba(255,255,255,.12);
    box-shadow: 0 28px 90px rgba(0,0,0,.34);
    backdrop-filter: blur(22px) saturate(1.25);
    -webkit-backdrop-filter: blur(22px) saturate(1.25);
}

body.theme-light .group-members-panel {
    background: rgba(15,23,42,.22);
}

body.theme-light .group-members-card {
    background: rgba(255,255,255,.88);
    color: #0f172a;
    border-color: rgba(15,23,42,.10);
}

.group-members-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.group-members-title {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.group-members-subtitle {
    margin-top: 2px;
    font-size: 13px;
    color: var(--text-muted);
}

.group-members-close {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 14px;
    background: rgba(120, 132, 170, 0.14);
    color: inherit;
    cursor: pointer;
    font-size: 26px;
    line-height: 1;
}

.group-members-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow: auto;
    padding-right: 2px;
}

.group-member-row {
    display: grid;
    grid-template-columns: 42px 1fr;
    gap: 10px;
    align-items: center;
    padding: 10px;
    border-radius: 18px;
    cursor: pointer;
}

.group-member-row:hover {
    background: rgba(109, 93, 252, 0.10);
}

.group-member-avatar {
    background: linear-gradient(135deg, var(--primary, #6d5dfc), #20c6ff);
    color: #fff;
    font-weight: 800;
}

.group-member-main {
    min-width: 0;
}

.group-member-name {
    font-weight: 750;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.group-member-name span {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
}

.group-member-role {
    margin-top: 2px;
    font-size: 12px;
    color: var(--text-muted);
}

.group-members-empty {
    padding: 18px 14px;
    border-radius: 18px;
    background: rgba(120, 132, 170, 0.08);
    color: var(--text-muted);
    text-align: center;
}

@media (max-width: 640px) {
    .group-members-panel {
        align-items: end;
        padding: 10px;
    }
    .group-members-card {
        width: 100%;
        max-height: min(84dvh, 680px);
        border-radius: 26px 26px 18px 18px;
    }
}


/* === Stage 14P: Telegram-style group info by avatar click === */
#group-members-btn {
    display: none !important;
}

#chat-peer-avatar.group-info-trigger {
    cursor: pointer !important;
    transition: transform .16s ease, box-shadow .16s ease;
}
#chat-peer-avatar.group-info-trigger:hover {
    transform: translateY(-1px) scale(1.03);
    box-shadow: 0 12px 28px rgba(109, 93, 252, .20);
}

.group-members-panel.group-info-panel.hidden,
.group-members-panel.group-info-panel[aria-hidden="true"] {
    display: block !important;
    opacity: 0 !important;
    transform: translateX(22px) scale(.985);
    pointer-events: none !important;
}

.group-members-panel.group-info-panel {
    position: absolute !important;
    inset: 78px 18px 18px auto !important;
    z-index: 90 !important;
    width: min(390px, calc(100% - 36px)) !important;
    display: block !important;
    padding: 0 !important;
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    opacity: 1 !important;
    transform: translateX(0) scale(1);
    transition: opacity .18s ease, transform .18s ease;
    pointer-events: auto !important;
}

.group-members-panel.group-info-panel .group-members-backdrop {
    display: none !important;
}

.group-members-panel.group-info-panel .group-members-card {
    width: 100% !important;
    height: 100% !important;
    max-height: none !important;
    padding: 0 !important;
    gap: 0 !important;
    border-radius: 26px !important;
    overflow: hidden !important;
    background: color-mix(in srgb, var(--bg-secondary) 86%, transparent) !important;
    border: 1px solid color-mix(in srgb, var(--border) 78%, transparent) !important;
    box-shadow: 0 24px 70px rgba(0,0,0,.26) !important;
    backdrop-filter: blur(24px) saturate(1.18) !important;
    -webkit-backdrop-filter: blur(24px) saturate(1.18) !important;
}

body.theme-light .group-members-panel.group-info-panel .group-members-card {
    background: rgba(255,255,255,.92) !important;
    border-color: rgba(15,23,42,.10) !important;
    box-shadow: 0 24px 70px rgba(15,23,42,.16) !important;
}

.group-info-cover {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 17px 16px 14px;
    border-bottom: 1px solid color-mix(in srgb, var(--border) 76%, transparent);
    background:
        radial-gradient(circle at 18% 0%, rgba(109,93,252,.24), transparent 34%),
        radial-gradient(circle at 88% 18%, rgba(32,198,255,.18), transparent 32%),
        rgba(120,132,170,.06);
}

.group-info-avatar {
    width: 72px !important;
    height: 72px !important;
    border-radius: 999px !important;
    font-size: 24px !important;
    box-shadow: 0 14px 30px rgba(109,93,252,.20);
    overflow: hidden !important;
}
.group-info-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.group-members-panel.group-info-panel .group-members-title {
    font-size: 20px !important;
    font-weight: 850 !important;
    max-width: 100%;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.group-members-panel.group-info-panel .group-members-subtitle {
    margin-top: -1px !important;
    font-size: 12px !important;
}

.group-members-section-title {
    padding: 14px 18px 8px;
    font-size: 13px;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.group-members-panel.group-info-panel .group-members-close {
    position: absolute !important;
    top: 14px !important;
    right: 14px !important;
    z-index: 2 !important;
    width: 38px !important;
    height: 38px !important;
    border-radius: 999px !important;
    background: rgba(15,23,42,.18) !important;
    color: inherit !important;
}

.group-members-panel.group-info-panel .group-members-list {
    height: calc(100% - 190px);
    overflow: auto;
    padding: 0 10px 12px;
}

.group-members-panel.group-info-panel .group-member-row {
    border-radius: 16px !important;
    padding: 10px 12px !important;
}

@media (max-width: 1024px) {
    .group-members-panel.group-info-panel {
        inset: 0 !important;
        width: 100% !important;
        height: 100% !important;
        transform: translateX(0) !important;
    }
    .group-members-panel.group-info-panel.hidden,
    .group-members-panel.group-info-panel[aria-hidden="true"] {
        transform: translateX(100%) !important;
        opacity: 1 !important;
    }
    .group-members-panel.group-info-panel .group-members-card {
        border-radius: 0 !important;
        border: 0 !important;
    }
    .group-members-panel.group-info-panel .group-members-list {
        height: calc(100% - 190px);
        padding-bottom: max(16px, env(safe-area-inset-bottom));
    }
}

/* === Stage 14Q: Telegram-like group settings inside info panel === */
.group-info-avatar {
    border: 0;
    cursor: default;
    position: relative;
}
.group-info-avatar.can-edit {
    cursor: pointer;
}
.group-avatar-edit-badge {
    position: absolute;
    right: 3px;
    bottom: 3px;
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 900;
    color: #fff;
    background: rgba(109, 93, 252, .92);
    box-shadow: 0 8px 20px rgba(0,0,0,.28);
}
.group-info-notifications {
    margin: 10px 12px 0;
    border: 1px solid color-mix(in srgb, var(--border) 78%, transparent);
    border-radius: 16px;
    overflow: clip;
    background: color-mix(in srgb, var(--bg-tertiary) 72%, transparent);
}
.group-info-notifications > summary {
    min-height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 13px;
    list-style: none;
    cursor: pointer;
    color: var(--text);
    user-select: none;
}
.group-info-notifications > summary::-webkit-details-marker { display: none; }
.group-info-notifications > summary:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -3px;
    border-radius: 14px;
}
.group-info-notifications-copy { min-width: 0; display: grid; gap: 2px; }
.group-info-notifications-copy b { font-size: 14px; font-weight: 820; line-height: 1.25; }
.group-info-notifications-copy small { color: var(--text-muted); font-size: 11px; line-height: 1.35; overflow-wrap: anywhere; }
.group-info-notifications-chevron { flex: 0 0 auto; color: var(--text-muted); transition: transform .16s ease; }
.group-info-notifications[open] .group-info-notifications-chevron { transform: rotate(90deg); }
.group-info-notifications[open] > summary { border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent); }
.group-info-notifications-body { padding: 0 10px 10px; }
.chats-page .group-info-notifications .group-notification-preferences {
    margin: 10px 0 0;
    padding: 12px;
    border: 0;
    border-radius: 12px;
    background: color-mix(in srgb, var(--bg-secondary) 84%, transparent);
}
body.theme-light .group-info-notifications,
html[data-theme="light"] body .group-info-notifications {
    background: rgba(15,23,42,.035);
    border-color: rgba(15,23,42,.10);
}
body.theme-glass .group-info-notifications,
html[data-theme="glass"] body .group-info-notifications {
    background: color-mix(in srgb, var(--bg-secondary) 52%, transparent);
}

.group-info-actions {
    display: grid;
    gap: 6px;
    padding: 10px;
    border-bottom: 1px solid color-mix(in srgb, var(--border) 76%, transparent);
}
.group-info-action {
    width: 100%;
    height: 42px;
    border: 0;
    border-radius: 14px;
    padding: 0 14px;
    text-align: left;
    cursor: pointer;
    color: var(--text);
    background: rgba(120,132,170,.08);
    font-weight: 750;
}
.group-info-action:hover:not(:disabled) {
    background: rgba(109,93,252,.14);
}
.group-info-action.muted,
.group-info-action:disabled {
    cursor: not-allowed;
    color: var(--text-muted);
    opacity: .72;
}
.group-info-add {
    padding: 10px;
    border-bottom: 1px solid color-mix(in srgb, var(--border) 76%, transparent);
}
.group-info-add.hidden {
    display: none !important;
}
.group-info-add-title,
.group-info-bg-title {
    padding: 2px 4px 8px;
    font-size: 12px;
    font-weight: 850;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
}
.group-info-add-search {
    width: 100%;
    margin-bottom: 8px;
}
.group-info-selected {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 2px 0 8px;
}
.group-info-candidates {
    display: grid;
    gap: 6px;
    max-height: 210px;
    overflow: auto;
}
.group-info-add-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 10px;
}
.group-members-empty.small {
    padding: 10px;
    font-size: 13px;
}
.group-members-panel.group-info-panel .group-members-list {
    height: auto !important;
    min-height: 120px;
    flex: 1 1 auto;
}
.group-members-panel.group-info-panel .group-members-card {
    display: flex !important;
    flex-direction: column !important;
}
.group-member-row {
    grid-template-columns: 42px 1fr auto;
}
.group-member-remove {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 999px;
    background: rgba(239, 68, 68, .12);
    color: #ef4444;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
}
.group-member-remove:hover {
    background: rgba(239, 68, 68, .20);
}
@media (max-width: 1024px) {
    .group-info-bg-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .group-info-candidates {
        max-height: 28dvh;
    }
}
.group-info-rename {
    padding: 10px;
    border-bottom: 1px solid color-mix(in srgb, var(--border) 76%, transparent);
}
.group-info-rename.hidden {
    display: none !important;
}
.group-info-rename-input {
    width: 100%;
}


/* === Stage 14R: group avatar image fix + chat notification toggles === */
.avatar.group-avatar.has-image,
.chat-item.group-dialog .avatar.group-avatar.has-image,
#chat-peer-avatar.group-avatar.has-image {
    padding: 0 !important;
    overflow: hidden !important;
    background: var(--bg-tertiary) !important;
}
.avatar.group-avatar img,
.chat-item.group-dialog .avatar.group-avatar img,
#chat-peer-avatar.group-avatar img {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    display: block !important;
    object-fit: cover !important;
    border-radius: inherit !important;
}

.chat-notification-setting {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 48px;
    padding: 10px 12px;
    border-radius: 16px;
    background: rgba(120,132,170,.08);
    color: var(--text);
}
.chat-notification-main {
    min-width: 0;
    display: grid;
    gap: 2px;
}
.chat-notification-main b {
    font-size: 14px;
    font-weight: 850;
}
.chat-notification-main span {
    font-size: 12px;
    color: var(--text-muted);
}
.chat-toggle {
    position: relative;
    width: 48px;
    height: 28px;
    flex: 0 0 auto;
    border: 0;
    border-radius: 999px;
    background: rgba(120,132,170,.28);
    cursor: pointer;
    transition: background .16s ease;
}
.chat-toggle span {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 5px 14px rgba(0,0,0,.24);
    transition: transform .16s ease;
}
.chat-toggle.active {
    background: linear-gradient(135deg, var(--primary), #20c6ff);
}
.chat-toggle.active span {
    transform: translateX(20px);
}
.user-info-section {
    margin: 14px 0;
}
.group-info-actions .chat-notification-setting {
    margin-bottom: 4px;
}


/* === Stage 14S: group info scroll + no deals in groups + safe group call placeholders === */
.chat-active[data-chat-type="group"] .chat-header-actions .btn.icon#chat-create-deal-btn,
.chat-active[data-chat-type="group"] .chat-header-actions .btn.icon#chat-mobile-create-deal-btn,
.chat-active[data-chat-type="group"] .chat-header-actions .chat-create-deal-btn,
.chats-container.group-chat-open .chat-header-actions .btn.icon#chat-create-deal-btn,
.chats-container.group-chat-open .chat-header-actions .btn.icon#chat-mobile-create-deal-btn,
.chats-container.group-chat-open .chat-header-actions .chat-create-deal-btn {
    display: none !important;
}

.chat-active[data-chat-type="group"] .chat-header-actions .call-btn,
.chats-container.group-chat-open .chat-header-actions .call-btn {
    display: inline-flex !important;
}

.chat-header-actions .call-btn.group-call-pending {
    opacity: .72;
}

.group-members-panel.group-info-panel {
    max-height: calc(100% - 96px) !important;
}

.group-members-panel.group-info-panel .group-members-card {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    overscroll-behavior: contain !important;
    scrollbar-width: thin;
}

.group-members-panel.group-info-panel .group-info-cover {
    flex: 0 0 auto !important;
}

.group-members-panel.group-info-panel .group-info-actions,
.group-members-panel.group-info-panel .group-info-rename,
.group-members-panel.group-info-panel .group-info-add,
.group-members-panel.group-info-panel .group-members-section-title {
    flex: 0 0 auto !important;
}

.group-members-panel.group-info-panel .group-members-list {
    height: auto !important;
    min-height: 96px !important;
    overflow: visible !important;
    flex: 0 0 auto !important;
    padding-bottom: 18px !important;
}

@media (max-width: 1024px) {
    .group-members-panel.group-info-panel {
        max-height: none !important;
    }
}

/* === Stage 14T: desktop group info opens as full chat overlay, not sidebar === */
@media (min-width: 1025px) {
    .group-members-panel.group-info-panel {
        position: absolute !important;
        inset: 0 !important;
        z-index: 90 !important;
        width: 100% !important;
        height: 100% !important;
        max-height: none !important;
        display: block !important;
        padding: 0 !important;
        background: transparent !important;
        opacity: 1 !important;
        transform: translateX(0) !important;
        transition: transform .22s ease, opacity .18s ease !important;
        pointer-events: auto !important;
    }

    .group-members-panel.group-info-panel.hidden,
    .group-members-panel.group-info-panel[aria-hidden="true"] {
        display: block !important;
        opacity: 1 !important;
        transform: translateX(100%) !important;
        pointer-events: none !important;
    }

    .group-members-panel.group-info-panel .group-members-card {
        width: 100% !important;
        height: 100% !important;
        max-height: none !important;
        border-radius: 0 !important;
        border: 0 !important;
        box-shadow: none !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        background: color-mix(in srgb, var(--bg-secondary) 92%, transparent) !important;
        backdrop-filter: blur(22px) saturate(1.14) !important;
        -webkit-backdrop-filter: blur(22px) saturate(1.14) !important;
    }

    body.theme-light .group-members-panel.group-info-panel .group-members-card {
        background: rgba(255,255,255,.96) !important;
        box-shadow: none !important;
    }

    .group-members-panel.group-info-panel .group-info-cover {
        padding-top: 34px !important;
    }

    .group-members-panel.group-info-panel .group-info-notifications,
    .group-members-panel.group-info-panel .group-info-actions,
    .group-members-panel.group-info-panel .group-info-rename,
    .group-members-panel.group-info-panel .group-info-add,
    .group-members-panel.group-info-panel .group-members-section-title,
    .group-members-panel.group-info-panel .group-members-list {
        width: min(720px, calc(100% - 40px)) !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    .group-members-panel.group-info-panel .group-members-list {
        padding-left: 0 !important;
        padding-right: 0 !important;
        padding-bottom: 28px !important;
    }
}

/* Stage 9 — Telegram-like delete/leave actions */
.chat-dialog-action-sheet.hidden { display: none !important; }
.chat-dialog-action-sheet {
    position: fixed;
    inset: 0;
    z-index: 32010;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}
.chat-dialog-action-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2,6,23,.42);
    backdrop-filter: blur(8px);
}
.chat-dialog-action-panel {
    position: relative;
    z-index: 1;
    --message-action-text: #fff;
    --message-action-icon: rgba(255,255,255,.90);
    width: min(420px, calc(100vw - 18px));
    margin: 0 9px max(9px, env(safe-area-inset-bottom));
    padding: 10px;
    border-radius: 24px;
    border: 1px solid rgba(255,255,255,.10);
    color: var(--message-action-text);
    background: rgba(31,33,39,.78);
    box-shadow: 0 24px 70px rgba(0,0,0,.45);
    backdrop-filter: blur(24px) saturate(120%);
    -webkit-backdrop-filter: blur(24px) saturate(120%);
    animation: chatSheetUp .18s ease;
    flex: 0 1 auto;
    min-height: 0;
    max-height: min(62vh, calc(var(--vvh, 100vh) * .62));
    overflow-y: auto;
    overscroll-behavior: contain;
}
.chat-dialog-action-title {
    padding: 0 8px 8px;
    font-size: .78rem;
    color: rgba(226,232,240,.72);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .06em;
}
.chat-dialog-sheet-handle {
    width: 44px;
    height: 44px;
    margin: -8px auto -4px;
    padding: 0;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: rgba(226,232,240,.72);
    cursor: pointer;
    touch-action: none;
}
.chat-dialog-sheet-handle span {
    width: 44px;
    height: 4px;
    display: block;
    border-radius: 999px;
    background: currentColor;
    opacity: .72;
}
.chat-dialog-sheet-handle:focus-visible { outline: 2px solid var(--primary); outline-offset: -4px; }
/* O: read-only Telegram-like dialog preview. ONE overlay, TWO visually separate
   cards — (1) this preview card (header + wallpapered, scrollable body), (2) the
   action menu (.chat-dialog-action-panel) below — stacked at the bottom. The menu
   is always reachable. Read-only: no markRead/activePeer/SSE/scroll/unread. */
#chat-dialog-action-sheet {
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    padding-bottom: max(9px, env(safe-area-inset-bottom));
}
#chat-dialog-action-sheet .chat-dialog-action-panel { margin: 0 9px; }
.chat-dialog-preview-card {
    position: relative;
    z-index: 1;
    width: min(420px, calc(100vw - 18px));
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 90px;
    max-height: min(44vh, calc(var(--vvh, 100vh) * .44));
    border-radius: 24px;
    border: 1px solid rgba(255,255,255,.10);
    background: rgba(31,33,39,.78);
    box-shadow: 0 24px 70px rgba(0,0,0,.45);
    backdrop-filter: blur(24px) saturate(120%);
    -webkit-backdrop-filter: blur(24px) saturate(120%);
    overflow: hidden;
    animation: chatSheetUp .18s ease;
}
.chat-dialog-preview-card.hidden { display: none; }
.chat-dialog-preview-head {
    display: flex; align-items: center; gap: 8px; min-width: 0; flex: 0 0 auto;
    padding: 8px 10px; border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
}
.chat-dialog-preview-open { display: flex; align-items: center; gap: 10px; flex: 1 1 auto; min-width: 0; min-height: 44px; padding: 2px 4px; border: 0; border-radius: 12px; background: transparent; color: var(--text); font: inherit; text-align: start; cursor: pointer; }
.chat-dialog-preview-open .avatar { flex-shrink: 0; }
.chat-dialog-preview-close { display: grid; place-items: center; flex: 0 0 44px; width: 44px; height: 44px; padding: 0; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-hover); color: var(--text-secondary); cursor: pointer; }
.chat-dialog-preview-open:hover, .chat-dialog-preview-close:hover { color: var(--text); background: var(--bg-hover); }
.chat-dialog-preview-open:focus-visible, .chat-dialog-preview-close:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.chat-dialog-preview-meta { flex: 1; min-width: 0; text-align: start; }
.chat-dialog-preview-meta b {
    display: block; font-size: .95rem; font-weight: 700; color: var(--text);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chat-dialog-preview-meta small { color: var(--text-muted); font-size: .74rem; }
.chat-dialog-preview-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 10px;
    /* Reuse the existing premium wallpaper + a readability overlay (dark theme). */
    background-color: #0b1020;
    background-image:
        linear-gradient(180deg, rgba(7,10,22,.55), rgba(7,10,22,.64)),
        url('./assets/chat-pattern-premium.webp');
    background-repeat: repeat;
    background-size: 920px 920px;
    background-position: center top;
}
@media (max-width: 768px) {
    .chat-dialog-preview-body {
        background-image:
            linear-gradient(180deg, rgba(7,10,22,.55), rgba(7,10,22,.64)),
            url('./assets/chat-pattern-premium-mobile.webp');
    }
}
body.theme-light .chat-dialog-preview-body,
html[data-theme="light"] body .chat-dialog-preview-body {
    background-color: #dfe7fb;
    background-image:
        linear-gradient(180deg, rgba(255,255,255,.58), rgba(255,255,255,.46)),
        url('./assets/chat-pattern-premium.webp');
}
@media (max-width: 768px) {
    body.theme-light .chat-dialog-preview-body,
    html[data-theme="light"] body .chat-dialog-preview-body {
        background-image:
            linear-gradient(180deg, rgba(255,255,255,.58), rgba(255,255,255,.46)),
            url('./assets/chat-pattern-premium-mobile.webp');
    }
}
/* The sheet uses renderMessage, including the same media, metadata and reply UI.
   Only its containing width differs from an open conversation. */
#chat-dialog-preview-body .message-wrap {
    min-width: 0;
    max-width: 94%;
    flex: 0 0 auto;
    animation: none;
}
#chat-dialog-preview-body .message {
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box;
}
#chat-dialog-preview-body .message-content,
#chat-dialog-preview-body .message-source-card,
#chat-dialog-preview-body .message-feed-share-card {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}
#chat-dialog-preview-body .message-wrap:has(.voice-message),
#chat-dialog-preview-body .message-wrap:has(.chat-audio-attachment),
#chat-dialog-preview-body .message-wrap:has(.message-source-card) { width: 94%; }
#chat-dialog-preview-body .message:has(.voice-message),
#chat-dialog-preview-body .message:has(.chat-audio-attachment),
#chat-dialog-preview-body .message:has(.message-source-card) { width: 100% !important; }
#chat-dialog-preview-body .chat-audio-attachment audio { width: 100%; min-width: 0; }
#chat-dialog-preview-body .voice-message { grid-template-columns: 42px minmax(0, 1fr) !important; gap: 10px !important; }
#chat-dialog-preview-body .chat-file-card { min-width: 0 !important; max-width: 100% !important; }
#chat-dialog-preview-body .message-source-card { width: 100%; }
#chat-dialog-preview-body .message-mini-avatar { flex-shrink: 0; }
.chat-dialog-preview-loading,
.chat-dialog-preview-empty {
    margin: auto; padding: 18px 10px; text-align: center;
    color: #fff; font-size: .82rem;
    background: rgba(0,0,0,.32); border-radius: 12px;
}
body.theme-light .chat-dialog-preview-loading,
body.theme-light .chat-dialog-preview-empty { color: #0f172a; background: rgba(255,255,255,.6); }
@media (min-width: 769px) {
    #chat-dialog-action-sheet { align-items: center; }
    #chat-dialog-action-sheet .chat-dialog-action-panel { margin: 0; width: 420px; }
    .chat-dialog-preview-card { width: 420px; }
}
.group-info-danger-zone {
    display: flex;
    justify-content: center;
    padding: 18px 18px 28px;
}
.group-info-leave-btn {
    min-width: 190px;
    min-height: 44px;
    border: 0;
    border-radius: 999px;
    background: color-mix(in srgb, var(--danger) 14%, transparent);
    color: var(--danger);
    font-weight: 900;
    cursor: pointer;
}
.group-info-leave-btn:hover {
    background: color-mix(in srgb, var(--danger) 22%, transparent);
}
.group-owner-modal,
.message-delete-scope-modal {
    width: min(420px, calc(100vw - 24px));
}
.group-owner-list,
.message-delete-scope-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow: auto;
    max-height: min(360px, 55dvh);
}
.group-owner-row {
    width: 100%;
    min-height: 52px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    border: 0;
    border-radius: 16px;
    background: transparent;
    color: var(--text);
    font-weight: 800;
    cursor: pointer;
    text-align: left;
}
.group-owner-row:hover { background: var(--bg-hover); }


/* ===== STAGE 9B: Telegram-like mini avatars in chat messages ===== */
.message-wrap {
    max-width: 82%;
    display: flex;
    align-items: flex-end;
    gap: 7px;
    animation: messageIn 0.2s ease;
}
.message-wrap.received {
    align-self: flex-start;
}
.message-wrap.sent {
    align-self: flex-end;
    justify-content: flex-end;
}
.message-wrap .message {
    max-width: 100% !important;
    align-self: auto !important;
}
.message-mini-avatar {
    flex: 0 0 26px;
    width: 26px;
    height: 26px;
    border: 0;
    border-radius: 999px;
    padding: 0;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 78%, #ffffff), color-mix(in srgb, var(--primary) 54%, #111827));
    color: #fff;
    font-size: 11px;
    font-weight: 900;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 5px 14px rgba(0,0,0,.16);
    margin-bottom: 2px;
}
.message-mini-avatar img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}
.message-mini-avatar:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(0,0,0,.2);
}
.message-mini-avatar:active {
    transform: scale(.96);
}
.message-mini-avatar:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
.group-owner-modal-overlay.closing {
    pointer-events: none;
    opacity: 0;
}
@media (max-width: 640px) {
    .message-wrap { max-width: 90%; gap: 6px; }
    .message-mini-avatar { width: 24px; height: 24px; flex-basis: 24px; font-size: 10px; }
}


/* ===== STAGE 9C: group service messages + safe sender avatars ===== */
.message-system-row {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 7px 0 8px;
    pointer-events: none;
}
.message-system-pill {
    max-width: min(86%, 520px);
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.34);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.62);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.3;
    text-align: center;
    box-shadow: 0 8px 20px rgba(0,0,0,.12);
    backdrop-filter: blur(12px);
}
@media (max-width: 640px) {
    .message-system-pill {
        max-width: 90%;
        font-size: 11px;
        padding: 5px 10px;
    }
}

/* ===== STAGE 10: group call MVP grid ===== */
.call-fullscreen.call-reference-ui.group-call .call-wrapper {
    width: min(980px, 96vw) !important;
    min-height: min(660px, 90dvh) !important;
    justify-content: stretch !important;
}
.call-fullscreen.call-reference-ui.group-call .call-header-info {
    position: absolute !important;
    top: 24px !important;
    left: 28px !important;
    z-index: 14 !important;
    width: auto !important;
    min-height: auto !important;
    max-width: calc(100% - 210px) !important;
    padding: 10px 14px !important;
    display: grid !important;
    grid-template-columns: 44px auto !important;
    grid-template-rows: auto auto !important;
    gap: 2px 10px !important;
    align-items: center !important;
    border-radius: 999px !important;
    background: rgba(2,6,23,.48) !important;
    border: 1px solid rgba(255,255,255,.12) !important;
    box-shadow: 0 10px 34px rgba(0,0,0,.28) !important;
    backdrop-filter: blur(14px) !important;
}
.call-fullscreen.call-reference-ui.group-call .call-avatar-ring {
    grid-row: 1 / 3 !important;
    width: 44px !important;
    height: 44px !important;
    padding: 2px !important;
    box-shadow: none !important;
}
.call-fullscreen.call-reference-ui.group-call .call-avatar-img { font-size: 1.1rem !important; }
.call-fullscreen.call-reference-ui.group-call .call-avatar-img img {
    width: 100% !important;
    height: 100% !important;
    border-radius: 50% !important;
    object-fit: cover !important;
}
.call-fullscreen.call-reference-ui.group-call .call-name {
    font-size: 1rem !important;
    text-align: left !important;
    max-width: 360px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}
.call-fullscreen.call-reference-ui.group-call .call-status {
    font-size: .78rem !important;
    text-align: left !important;
    white-space: nowrap !important;
}
.call-fullscreen.call-reference-ui.group-call #call-remote-video,
.call-fullscreen.call-reference-ui.group-call #call-local-video,
.call-fullscreen.call-reference-ui.group-call .call-video-placeholder {
    display: none !important;
}
.call-fullscreen.call-reference-ui.group-call .call-video-area {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    box-sizing: border-box !important;
    padding: 96px 28px 116px !important;
    overflow: hidden !important;
    background:
      radial-gradient(circle at 20% 15%, rgba(99,102,241,.18), transparent 35%),
      radial-gradient(circle at 80% 5%, rgba(14,165,233,.14), transparent 35%),
      #020617 !important;
}
.group-call-grid {
    width: 100% !important;
    height: 100% !important;
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)) !important;
    grid-auto-rows: minmax(150px, 1fr) !important;
    gap: 12px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    overscroll-behavior: contain !important;
    align-content: stretch !important;
    scrollbar-gutter: stable !important;
}
.group-call-grid.hidden { display: none !important; }
.group-call-tile {
    position: relative !important;
    overflow: hidden !important;
    border-radius: 26px !important;
    border: 1px solid rgba(255,255,255,.12) !important;
    background: linear-gradient(145deg, rgba(15,23,42,.78), rgba(30,41,59,.45)) !important;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.03), 0 16px 36px rgba(0,0,0,.2) !important;
    min-height: 150px !important;
}
.group-call-tile.self { border-color: rgba(129,140,248,.46) !important; }
.group-call-tile.waiting { opacity: .72 !important; }
.group-call-grid.has-pinned-participant .group-call-tile.pinned {
    grid-column: 1 / -1 !important;
    min-height: clamp(280px, 48vh, 560px) !important;
    order: -1 !important;
    border-color: rgba(129,140,248,.76) !important;
}
.group-call-tile-pin {
    position: absolute !important;
    inset-block-start: 10px !important;
    inset-inline-end: 10px !important;
    z-index: 6 !important;
    width: 40px !important;
    height: 40px !important;
    border: 1px solid rgba(255,255,255,.16) !important;
    border-radius: 14px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    color: #fff !important;
    background: rgba(2,6,23,.62) !important;
    cursor: pointer !important;
    opacity: .82 !important;
}
.group-call-tile-pin svg {
    width: 20px !important;
    height: 20px !important;
}
.group-call-tile:hover .group-call-tile-pin,
.group-call-tile-pin:focus-visible,
.group-call-tile-pin[aria-pressed="true"] {
    opacity: 1 !important;
    background: rgba(79,70,229,.9) !important;
}
.group-call-tile-pin:focus-visible {
    outline: 2px solid rgba(255,255,255,.94) !important;
    outline-offset: 2px !important;
}
.call-fullscreen.call-reference-ui.group-call.call-minimized .group-call-tile-pin {
    display: none !important;
}
.group-call-video {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: none !important;
    background: #020617 !important;
}
.group-call-tile.has-video:not(.camera-off) .group-call-video { display: block !important; }
.group-call-avatar {
    position: absolute !important;
    left: 50% !important;
    top: 48% !important;
    transform: translate(-50%, -50%) !important;
    width: 78px !important;
    height: 78px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 2rem !important;
    font-weight: 950 !important;
    color: #fff !important;
    background: linear-gradient(135deg, #4f46e5, #8b5cf6) !important;
    box-shadow: 0 20px 44px rgba(0,0,0,.28) !important;
    overflow: hidden !important;
}
.group-call-avatar img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 50% !important;
}
.group-call-tile.has-video:not(.camera-off) .group-call-avatar { display: none !important; }
.group-call-tile-footer {
    position: absolute !important;
    left: 10px !important;
    right: 10px !important;
    bottom: 10px !important;
    min-height: 34px !important;
    border-radius: 999px !important;
    padding: 7px 12px !important;
    background: rgba(2,6,23,.58) !important;
    color: #fff !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    backdrop-filter: blur(12px) !important;
    border: 1px solid rgba(255,255,255,.1) !important;
}
.group-call-tile-footer span {
    font-size: .9rem !important;
    font-weight: 900 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}
.group-call-tile-footer small {
    margin-left: auto !important;
    color: rgba(226,232,240,.7) !important;
    font-size: .74rem !important;
    white-space: nowrap !important;
}
.group-call-tile.muted .group-call-tile-footer::before {
    content: '✕';
    width: 18px !important;
    height: 18px !important;
    border-radius: 50% !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(239,68,68,.88) !important;
    color: #fff !important;
    font-size: .7rem !important;
    font-weight: 950 !important;
}
.call-fullscreen.call-reference-ui.group-call.call-controls-hidden .call-header-info {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: translateY(-8px) !important;
}
.call-fullscreen.call-reference-ui.group-call.call-minimized .call-header-info {
    opacity: 1 !important;
    transform: none !important;
}
.call-fullscreen.call-reference-ui.group-call.call-minimized .group-call-grid { display: none !important; }
.call-fullscreen.call-reference-ui.group-call #call-deal-btn { display: none !important; }
@media (max-width: 768px) {
    .call-fullscreen.call-reference-ui.group-call .call-wrapper {
        width: 100vw !important;
        height: 100dvh !important;
        min-height: 100dvh !important;
        border-radius: 0 !important;
    }
    .call-fullscreen.call-reference-ui.group-call .call-header-info {
        top: calc(16px + env(safe-area-inset-top)) !important;
        left: 14px !important;
        max-width: calc(100vw - 120px) !important;
    }
    .call-fullscreen.call-reference-ui.group-call .call-video-area {
        padding: calc(86px + env(safe-area-inset-top)) 12px calc(108px + env(safe-area-inset-bottom)) !important;
        min-height: 0 !important;
    }
    .group-call-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        grid-auto-rows: minmax(132px, 1fr) !important;
        gap: 8px !important;
        min-height: 0 !important;
        max-height: 100% !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        align-content: stretch !important;
    }
    .group-call-tile {
        border-radius: 20px !important;
        min-height: 0 !important;
        min-width: 0 !important;
    }
    .group-call-grid.has-pinned-participant .group-call-tile.pinned {
        min-height: clamp(240px, 44dvh, 420px) !important;
    }
    .group-call-avatar { width: 64px !important; height: 64px !important; font-size: 1.65rem !important; }
}
.call-fullscreen.call-reference-ui.group-call.video-call #call-header-info {
    display: grid !important;
}
.call-fullscreen.call-reference-ui.group-call.video-call .call-header-info.call-video-hide-header {
    display: grid !important;
}
/* ===== STAGE 10I: desktop group call must not inherit private 100vw video area ===== */
.call-fullscreen.call-reference-ui.group-call.video-call:not(.incoming-call):not(.call-minimized) .call-video-area {
    inset: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    box-sizing: border-box !important;
}
.call-fullscreen.call-reference-ui.group-call.video-call:not(.incoming-call):not(.call-minimized) .group-call-grid {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
}
.call-fullscreen.call-reference-ui.group-call.video-call:not(.incoming-call):not(.call-minimized) .group-call-tile {
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
}

/* ===== STAGE 10B: group call incoming uses same card as private calls ===== */
.call-fullscreen.call-reference-ui.group-call.incoming-call .call-video-area,
.call-fullscreen.call-reference-ui.group-call.incoming-call .group-call-grid,
.call-fullscreen.call-reference-ui.incoming-call .group-call-grid {
    display: none !important;
}
.call-fullscreen.call-reference-ui.incoming-call #call-deal-btn {
    display: none !important;
}

/* ===== STAGE 10C: group-call minimized preview + unclipped private mini title ===== */
/* Group calls were hiding the grid in minimized mode, so the small window showed only the call card.
   Keep exactly one focused tile alive inside the mini window: first remote camera, then first joined remote, then self. */
.call-fullscreen.call-reference-ui.group-call.call-minimized .call-wrapper {
    width: 184px !important;
    height: 184px !important;
    min-height: 184px !important;
    padding: 0 !important;
    border-radius: 28px !important;
    overflow: hidden !important;
    background: #020617 !important;
}
.call-fullscreen.call-reference-ui.group-call.call-minimized .call-video-area {
    display: block !important;
    visibility: visible !important;
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    background: #020617 !important;
    z-index: 2 !important;
}
.call-fullscreen.call-reference-ui.group-call.call-minimized .group-call-grid {
    display: block !important;
    visibility: visible !important;
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    background: #020617 !important;
}
.call-fullscreen.call-reference-ui.group-call.call-minimized .group-call-tile {
    display: none !important;
}
.call-fullscreen.call-reference-ui.group-call.call-minimized .group-call-tile.mini-focus {
    display: block !important;
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: radial-gradient(circle at 50% 35%, rgba(99,102,241,.22), #020617 72%) !important;
}
.call-fullscreen.call-reference-ui.group-call.call-minimized .group-call-tile.mini-focus .group-call-video {
    display: none !important;
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border: 0 !important;
    border-radius: 0 !important;
}
.call-fullscreen.call-reference-ui.group-call.call-minimized .group-call-tile.mini-focus.has-video:not(.camera-off) .group-call-video {
    display: block !important;
}
.call-fullscreen.call-reference-ui.group-call.call-minimized .group-call-tile.mini-focus.has-video:not(.camera-off) .group-call-avatar {
    display: none !important;
}
.call-fullscreen.call-reference-ui.group-call.call-minimized .group-call-avatar {
    width: 82px !important;
    height: 82px !important;
    font-size: 2.1rem !important;
}
.call-fullscreen.call-reference-ui.group-call.call-minimized .group-call-tile-footer {
    left: 8px !important;
    right: 8px !important;
    bottom: 8px !important;
    min-height: 30px !important;
    padding: 6px 9px !important;
    border-radius: 999px !important;
    background: rgba(2,6,23,.58) !important;
}
.call-fullscreen.call-reference-ui.group-call.call-minimized .group-call-tile-footer span {
    font-size: .8rem !important;
    max-width: 126px !important;
}
.call-fullscreen.call-reference-ui.group-call.call-minimized .group-call-tile-footer small {
    display: none !important;
}
.call-fullscreen.call-reference-ui.group-call.call-minimized .call-header-info,
.call-fullscreen.call-reference-ui.group-call.call-minimized .call-top-controls,
.call-fullscreen.call-reference-ui.group-call.call-minimized #call-active-actions,
.call-fullscreen.call-reference-ui.group-call.call-minimized #call-incoming-actions {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* Private 1-on-1 audio mini: the square bubble was clipping long names too aggressively. */
.call-fullscreen.call-reference-ui.call-minimized.audio-call:not(.group-call) {
    width: 214px !important;
    height: 152px !important;
    min-width: 214px !important;
    min-height: 152px !important;
}
.call-fullscreen.call-reference-ui.call-minimized.audio-call:not(.group-call) .call-wrapper {
    width: 214px !important;
    height: 152px !important;
    min-height: 152px !important;
}
.call-fullscreen.call-reference-ui.call-minimized.audio-call:not(.group-call) .call-header-info {
    padding: 14px 16px !important;
    gap: 7px !important;
}
.call-fullscreen.call-reference-ui.call-minimized.audio-call:not(.group-call) .call-name {
    max-width: 184px !important;
    white-space: normal !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    line-height: 1.12 !important;
}
.call-fullscreen.call-reference-ui.call-minimized.audio-call:not(.group-call) .call-status {
    max-width: 184px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

@media (max-width: 768px) {
    .call-fullscreen.call-reference-ui.group-call.call-minimized,
    .call-fullscreen.call-reference-ui.group-call.call-minimized .call-wrapper {
        width: 152px !important;
        height: 152px !important;
        min-width: 152px !important;
        min-height: 152px !important;
        border-radius: 24px !important;
    }
    .call-fullscreen.call-reference-ui.group-call.call-minimized .group-call-avatar {
        width: 68px !important;
        height: 68px !important;
        font-size: 1.8rem !important;
    }
    .call-fullscreen.call-reference-ui.group-call.call-minimized .group-call-tile-footer span {
        max-width: 100px !important;
        font-size: .74rem !important;
    }
    .call-fullscreen.call-reference-ui.call-minimized.audio-call:not(.group-call),
    .call-fullscreen.call-reference-ui.call-minimized.audio-call:not(.group-call) .call-wrapper {
        width: min(214px, calc(100vw - 24px)) !important;
        height: 148px !important;
        min-height: 148px !important;
    }
}


/* ===== STAGE 10G: square mini window for group calls ===== */
.call-fullscreen.call-reference-ui.group-call.call-minimized {
    width: 184px !important;
    height: 184px !important;
    min-width: 184px !important;
    min-height: 184px !important;
    max-width: 184px !important;
    max-height: 184px !important;
    inset: auto auto 22px 22px !important;
    padding: 0 !important;
    background: transparent !important;
    overflow: visible !important;
}
.call-fullscreen.call-reference-ui.group-call.call-minimized .call-wrapper {
    width: 184px !important;
    height: 184px !important;
    min-width: 184px !important;
    min-height: 184px !important;
    max-width: 184px !important;
    max-height: 184px !important;
    padding: 0 !important;
    border-radius: 28px !important;
    overflow: hidden !important;
    display: block !important;
    flex-direction: unset !important;
    justify-content: unset !important;
}
.call-fullscreen.call-reference-ui.group-call.call-minimized.audio-call,
.call-fullscreen.call-reference-ui.group-call.call-minimized.video-call {
    width: 184px !important;
    height: 184px !important;
    min-width: 184px !important;
    min-height: 184px !important;
}
.call-fullscreen.call-reference-ui.group-call.call-minimized .call-video-area,
.call-fullscreen.call-reference-ui.group-call.call-minimized .group-call-grid {
    display: block !important;
    visibility: visible !important;
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
}
.call-fullscreen.call-reference-ui.group-call.call-minimized .call-header-info,
.call-fullscreen.call-reference-ui.group-call.call-minimized .call-top-controls,
.call-fullscreen.call-reference-ui.group-call.call-minimized #call-active-actions,
.call-fullscreen.call-reference-ui.group-call.call-minimized #call-incoming-actions {
    display: none !important;
}
@media (max-width: 768px) {
    .call-fullscreen.call-reference-ui.group-call.call-minimized,
    .call-fullscreen.call-reference-ui.group-call.call-minimized .call-wrapper {
        width: 152px !important;
        height: 152px !important;
        min-width: 152px !important;
        min-height: 152px !important;
        max-width: 152px !important;
        max-height: 152px !important;
        border-radius: 24px !important;
    }
}

/* ===== STAGE 10H: stable group mini preview + no header leak ===== */
.call-fullscreen.call-reference-ui.group-call.call-minimized #call-header-info,
.call-fullscreen.call-reference-ui.group-call.call-minimized .call-header-info,
.call-fullscreen.call-reference-ui.group-call.call-minimized .call-avatar,
.call-fullscreen.call-reference-ui.group-call.call-minimized .call-name,
.call-fullscreen.call-reference-ui.group-call.call-minimized .call-status,
.call-fullscreen.call-reference-ui.group-call.call-minimized .call-peer-state {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}
.call-fullscreen.call-reference-ui.group-call.call-minimized .call-video-area,
.call-fullscreen.call-reference-ui.group-call.call-minimized #group-call-grid {
    z-index: 20 !important;
    overflow: hidden !important;
    border-radius: inherit !important;
}
.call-fullscreen.call-reference-ui.group-call.call-minimized .group-call-tile.mini-focus .group-call-video {
    z-index: 1 !important;
    background: #020617 !important;
    opacity: 1 !important;
}
.call-fullscreen.call-reference-ui.group-call.call-minimized .group-call-tile.mini-focus.has-video:not(.camera-off) .group-call-video {
    display: block !important;
    visibility: visible !important;
}
.call-fullscreen.call-reference-ui.group-call.call-minimized .group-call-avatar {
    z-index: 2 !important;
}
.call-fullscreen.call-reference-ui.group-call.call-minimized .group-call-tile-footer {
    z-index: 3 !important;
    max-width: calc(100% - 16px) !important;
}
.call-fullscreen.call-reference-ui.group-call.call-minimized .group-call-tile-footer span {
    max-width: 100% !important;
}

/* === Stage 10L: clean Telegram-style private chat info panel === */
.chat-info-sidebar {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-height: none !important;
    border: 0 !important;
    border-radius: 0 !important;
    z-index: 92 !important;
    background: color-mix(in srgb, var(--bg-secondary) 94%, transparent) !important;
    backdrop-filter: blur(22px) saturate(1.12) !important;
    -webkit-backdrop-filter: blur(22px) saturate(1.12) !important;
    box-shadow: none !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
}
.chat-info-sidebar.hidden {
    display: none !important;
}
body.theme-light .chat-info-sidebar {
    background: rgba(255,255,255,.96) !important;
}
/* No visible "Информация" title (owner, 2026-10-08): the bar only holds the
   close control; the panel keeps its name through aria-label. */
.chat-info-header {
    min-height: 0 !important;
    justify-content: flex-end !important;
    padding: 12px 16px 0 !important;
    border-bottom: 0 !important;
    background: transparent !important;
}
.chat-info-header #close-info-btn {
    width: 44px !important;
    height: 44px !important;
    border-radius: 999px !important;
    background: color-mix(in srgb, var(--bg-card) 74%, transparent) !important;
    color: var(--text) !important;
}
.chat-info-header #close-info-btn:hover {
    background: color-mix(in srgb, var(--bg-hover) 88%, transparent) !important;
    transform: none !important;
}
.chat-info-content {
    flex: 1 1 auto !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 26px 20px 34px !important;
    scrollbar-width: thin;
}
.chat-info-content .user-info {
    width: min(520px, 100%) !important;
    margin: 0 auto !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 14px !important;
}
.chat-info-content .user-info-avatar {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    padding: 0 0 6px !important;
}
.chat-info-sidebar .avatar.large {
    width: 138px !important;
    height: 138px !important;
    min-width: 138px !important;
    min-height: 138px !important;
    border-radius: 999px !important;
    border: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    font-size: 4.2rem !important;
    font-weight: 900 !important;
    line-height: 1 !important;
    cursor: default !important;
    text-shadow: 0 3px 8px rgba(0,0,0,.22) !important;
    box-shadow: 0 18px 52px rgba(99,102,241,.22), inset 0 0 0 1px rgba(255,255,255,.10) !important;
    background: var(--primary-grad) !important;
    color: #fff !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transform: none !important;
}
.chat-info-sidebar .avatar.large:hover {
    transform: none !important;
    box-shadow: 0 18px 52px rgba(99,102,241,.22), inset 0 0 0 1px rgba(255,255,255,.10) !important;
}
.chat-info-sidebar .avatar.large::after,
.chat-info-sidebar .avatar.large:hover::after {
    content: none !important;
    display: none !important;
    opacity: 0 !important;
}
.chat-info-sidebar .avatar.large.has-image img,
.chat-info-sidebar .avatar.large img {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    display: block !important;
    object-fit: cover !important;
    border-radius: inherit !important;
}
.chat-info-content .user-info-name {
    text-align: center !important;
    font-size: clamp(1.25rem, 2vw, 1.65rem) !important;
    line-height: 1.15 !important;
    font-weight: 950 !important;
    color: var(--text) !important;
    margin: 0 0 6px !important;
    word-break: break-word !important;
}
.chat-info-content .user-info-name > span {
    display: block;
}
.chat-info-content .user-info-name .chat-peer-status {
    display: block !important;
    margin-top: 6px;
    font-size: .86rem;
    line-height: 1.2;
    font-weight: 700;
    color: var(--text-muted);
}
.chat-info-content .user-info-name .chat-peer-status.online {
    color: #31d158;
}
.chat-info-content .user-info-section {
    margin: 4px 0 0 !important;
}
.chat-info-content .chat-notification-setting {
    min-height: 64px !important;
    padding: 12px 14px !important;
    border-radius: 18px !important;
    background: color-mix(in srgb, var(--bg-card) 82%, transparent) !important;
    border: 1px solid color-mix(in srgb, var(--border) 70%, transparent) !important;
}
.chat-info-content .chat-notification-main b {
    font-size: 1rem !important;
}
.chat-info-content .chat-notification-main span {
    font-size: .86rem !important;
}
.chat-info-content .user-info-stats {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 10px !important;
    margin: 0 !important;
}
.chat-info-content .user-info-stats .stat {
    min-height: 64px !important;
    padding: 12px 14px !important;
    border-radius: 18px !important;
    background: color-mix(in srgb, var(--bg-card) 78%, transparent) !important;
    border: 1px solid color-mix(in srgb, var(--border) 70%, transparent) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 14px !important;
}
.chat-info-content .user-info-stats .stat-value {
    order: 2 !important;
    min-width: 42px !important;
    text-align: right !important;
    font-size: 1.25rem !important;
    line-height: 1 !important;
    font-weight: 950 !important;
    color: var(--text) !important;
}
.chat-info-content .user-info-stats .stat-label {
    order: 1 !important;
    color: var(--text-secondary) !important;
    font-size: .94rem !important;
    font-weight: 760 !important;
}
.chat-info-content .user-info-actions {
    margin-top: 0 !important;
}
.chat-info-content .user-info-actions .btn.fullwidth,
.chat-info-content .user-info-actions .btn.primary.fullwidth {
    width: 100% !important;
    min-height: 54px !important;
    border-radius: 18px !important;
    font-size: 1rem !important;
    font-weight: 950 !important;
    box-shadow: 0 12px 28px rgba(99,102,241,.24) !important;
}
@media (max-width: 768px) {
    .chat-info-header {
        min-height: 0 !important;
        padding: 10px 12px 0 !important;
    }
    .chat-info-content {
        padding: 22px 14px max(28px, env(safe-area-inset-bottom)) !important;
    }
    .chat-info-sidebar .avatar.large {
        width: 126px !important;
        height: 126px !important;
        min-width: 126px !important;
        min-height: 126px !important;
        font-size: 3.8rem !important;
    }
}


/* Stage 11C: safe anti-flicker polish */
#chat-messages .message,
#chat-messages .message-wrap,
#chat-messages .message-system-row {
    animation: none !important;
}

#chat-messages {
    overflow-anchor: auto;
}

/* === Stage 14B: mobile chat header compact overlay cleanup === */
@media (max-width: 1024px) {
    .chat-active {
        overflow: hidden !important;
    }

    .chat-header {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) auto !important;
        align-items: start !important;
        column-gap: 8px !important;
        row-gap: 0 !important;
        width: auto !important;
        min-height: 0 !important;
        padding: 8px 10px 0 !important;
    }

    .chat-header .chat-peer-info {
        justify-self: start !important;
        align-self: start !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: 100% !important;
        padding: 5px 10px 5px 5px !important;
        border-radius: 999px !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
    }

    .chat-header .chat-peer-info > div:last-child {
        min-width: 0 !important;
        overflow: hidden !important;
    }

    .chat-header .chat-peer-name {
        display: block !important;
        max-width: 100% !important;
        font-size: .95rem !important;
        line-height: 1.15 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .chat-header .chat-peer-status {
        display: block !important;
        max-width: 100% !important;
        margin-top: 2px !important;
        line-height: 1.15 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .chat-header-actions {
        justify-self: end !important;
        align-self: start !important;
        flex-wrap: nowrap !important;
        gap: 6px !important;
        padding-top: 2px !important;
        margin-left: 0 !important;
    }

    .chat-header-actions .btn.icon {
        width: 38px !important;
        height: 38px !important;
        flex: 0 0 38px !important;
    }

    .chat-messages {
        padding-top: 76px !important;
    }

    .chat-search-active .chat-messages,
    .chat-active.chat-search-open .chat-messages {
        padding-top: 124px !important;
    }
}

@media (max-width: 480px) {
    .chat-header {
        column-gap: 7px !important;
        padding: 8px 8px 0 !important;
    }

    .chat-header .chat-peer-info {
        padding: 4px 9px 4px 4px !important;
    }

    .chat-header .chat-peer-info .avatar {
        width: 36px !important;
        height: 36px !important;
        flex: 0 0 36px !important;
    }

    .chat-header .chat-peer-name {
        font-size: .9rem !important;
    }

    .chat-header .chat-peer-status {
        font-size: .68rem !important;
    }

    .chat-header-actions {
        gap: 5px !important;
    }

    .chat-header-actions .btn.icon {
        width: 36px !important;
        height: 36px !important;
        flex-basis: 36px !important;
    }

    .chat-messages {
        padding-top: 72px !important;
    }

    .chat-search-active .chat-messages,
    .chat-active.chat-search-open .chat-messages {
        padding-top: 120px !important;
    }
}


/* === Stage 14C: remove mobile chat header base strip, leave floating pills only === */
@media (max-width: 1024px) {
    body[data-page="chats"] .chat-active .chat-header,
    body:not(.theme-light)[data-page="chats"] .chat-active .chat-header,
    body.theme-light[data-page="chats"] .chat-active .chat-header {
        background: transparent !important;
        background-color: transparent !important;
        border: 0 !important;
        border-bottom: 0 !important;
        box-shadow: none !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        min-height: 0 !important;
        height: auto !important;
        max-height: none !important;
        padding: 8px 10px 0 !important;
        pointer-events: none !important;
    }

    body[data-page="chats"] .chat-active .chat-header .chat-peer-info,
    body[data-page="chats"] .chat-active .chat-header .chat-header-actions {
        pointer-events: auto !important;
    }

    body[data-page="chats"] .chat-active .chat-header .chat-peer-info {
        background: rgba(17, 24, 39, .72) !important;
        border: 1px solid rgba(255,255,255,.08) !important;
        box-shadow: 0 10px 30px rgba(0,0,0,.18) !important;
        backdrop-filter: blur(16px) saturate(1.12) !important;
        -webkit-backdrop-filter: blur(16px) saturate(1.12) !important;
    }

    body.theme-light[data-page="chats"] .chat-active .chat-header .chat-peer-info {
        background: rgba(255,255,255,.76) !important;
        border-color: rgba(15,23,42,.10) !important;
        box-shadow: 0 10px 28px rgba(15,23,42,.10) !important;
    }

    body[data-page="chats"] .chat-active .chat-header-actions .btn.icon {
        background: rgba(17, 24, 39, .72) !important;
        border: 1px solid rgba(255,255,255,.08) !important;
        box-shadow: 0 10px 28px rgba(0,0,0,.18) !important;
        backdrop-filter: blur(16px) saturate(1.12) !important;
        -webkit-backdrop-filter: blur(16px) saturate(1.12) !important;
    }

    body.theme-light[data-page="chats"] .chat-active .chat-header-actions .btn.icon {
        background: rgba(255,255,255,.76) !important;
        border-color: rgba(15,23,42,.10) !important;
        box-shadow: 0 10px 24px rgba(15,23,42,.10) !important;
    }
}

@media (max-width: 480px) {
    body[data-page="chats"] .chat-active .chat-header,
    body:not(.theme-light)[data-page="chats"] .chat-active .chat-header,
    body.theme-light[data-page="chats"] .chat-active .chat-header {
        padding: 7px 8px 0 !important;
    }
}


/* === Stage 14D: mobile floating chat composer, no bottom base strip === */
@media (max-width: 1024px) {
    body[data-page="chats"] .chat-active .chat-input-area,
    body:not(.theme-light)[data-page="chats"] .chat-active .chat-input-area,
    body.theme-light[data-page="chats"] .chat-active .chat-input-area {
        position: sticky !important;
        bottom: 0 !important;
        z-index: 46 !important;
        display: grid !important;
        grid-template-columns: auto auto minmax(0, 1fr) auto !important;
        align-items: end !important;
        gap: 8px !important;
        padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px)) !important;
        min-height: 0 !important;
        background: transparent !important;
        background-color: transparent !important;
        border-top: 0 !important;
        box-shadow: none !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    body[data-page="chats"] .chat-active .chat-input-wrapper,
    body:not(.theme-light)[data-page="chats"] .chat-active .chat-input-wrapper {
        min-height: 48px !important;
        border-radius: 999px !important;
        padding: 0 12px !important;
        background: rgba(17, 24, 39, .76) !important;
        border: 1px solid rgba(255,255,255,.07) !important;
        box-shadow: 0 14px 36px rgba(0,0,0,.20) !important;
        backdrop-filter: blur(16px) saturate(1.12) !important;
        -webkit-backdrop-filter: blur(16px) saturate(1.12) !important;
    }

    body.theme-light[data-page="chats"] .chat-active .chat-input-wrapper {
        background: rgba(255,255,255,.82) !important;
        border-color: rgba(15,23,42,.10) !important;
        box-shadow: 0 14px 30px rgba(15,23,42,.10) !important;
    }

    body[data-page="chats"] .chat-active .chat-input-wrapper textarea {
        min-height: 46px !important;
        max-height: 112px !important;
        padding: 13px 44px 11px 0 !important;
        background: transparent !important;
        border: 0 !important;
        box-shadow: none !important;
        resize: none !important;
    }

    body[data-page="chats"] .chat-active .chat-input-wrapper .char-counter,
    body[data-page="chats"] .chat-active #char-counter {
        right: 14px !important;
        bottom: 13px !important;
        font-size: .72rem !important;
        opacity: .78 !important;
    }

    body[data-page="chats"] .chat-active .chat-input-area > .btn.icon,
    body[data-page="chats"] .chat-active .chat-input-actions .btn.icon,
    body[data-page="chats"] .chat-active #attach-file-btn,
    body[data-page="chats"] .chat-active #voice-record-btn {
        width: 42px !important;
        height: 42px !important;
        flex: 0 0 42px !important;
        border-radius: 999px !important;
        background: rgba(17, 24, 39, .64) !important;
        border: 1px solid rgba(255,255,255,.06) !important;
        box-shadow: 0 12px 28px rgba(0,0,0,.16) !important;
        backdrop-filter: blur(14px) saturate(1.1) !important;
        -webkit-backdrop-filter: blur(14px) saturate(1.1) !important;
    }

    body.theme-light[data-page="chats"] .chat-active .chat-input-area > .btn.icon,
    body.theme-light[data-page="chats"] .chat-active .chat-input-actions .btn.icon,
    body.theme-light[data-page="chats"] .chat-active #attach-file-btn,
    body.theme-light[data-page="chats"] .chat-active #voice-record-btn {
        background: rgba(255,255,255,.78) !important;
        border-color: rgba(15,23,42,.10) !important;
        box-shadow: 0 12px 24px rgba(15,23,42,.10) !important;
    }

    body[data-page="chats"] .chat-active #send-message-btn {
        width: 48px !important;
        height: 48px !important;
        flex: 0 0 48px !important;
        border-radius: 999px !important;
        box-shadow: 0 16px 34px rgba(109, 93, 252, .26) !important;
    }

    body[data-page="chats"] .chat-active .chat-messages {
        padding-bottom: 14px !important;
    }

    body[data-page="chats"] .chat-active .new-messages-wrap,
    body[data-page="chats"] .chat-active .chat-typing-indicator {
        margin-bottom: 4px !important;
    }
}

@media (max-width: 480px) {
    body[data-page="chats"] .chat-active .chat-input-area {
        gap: 7px !important;
        padding: 7px 8px calc(7px + env(safe-area-inset-bottom, 0px)) !important;
    }

    body[data-page="chats"] .chat-active .chat-input-wrapper {
        min-height: 46px !important;
        padding: 0 11px !important;
    }

    body[data-page="chats"] .chat-active .chat-input-wrapper textarea {
        min-height: 44px !important;
        padding-top: 12px !important;
        padding-bottom: 10px !important;
        font-size: .9rem !important;
    }

    body[data-page="chats"] .chat-active #attach-file-btn,
    body[data-page="chats"] .chat-active #voice-record-btn,
    body[data-page="chats"] .chat-active .chat-input-actions .btn.icon {
        width: 40px !important;
        height: 40px !important;
        flex-basis: 40px !important;
    }

    body[data-page="chats"] .chat-active #send-message-btn {
        width: 46px !important;
        height: 46px !important;
        flex-basis: 46px !important;
    }
}


/* === Stage 14E: floating composer on desktop + remove send button base area === */
/* Единый Telegram-style composer: без общей нижней полосы на ПК и телефоне. */
body[data-page="chats"] .chat-active .chat-input-area,
body:not(.theme-light)[data-page="chats"] .chat-active .chat-input-area,
body.theme-light[data-page="chats"] .chat-active .chat-input-area {
    position: sticky !important;
    bottom: 0 !important;
    z-index: 46 !important;
    display: grid !important;
    grid-template-columns: auto auto minmax(0, 1fr) auto !important;
    align-items: end !important;
    gap: 10px !important;
    padding: 10px 18px calc(10px + env(safe-area-inset-bottom, 0px)) !important;
    min-height: 0 !important;
    height: auto !important;
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    border: 0 !important;
    border-top: 0 !important;
    box-shadow: none !important;
    outline: 0 !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

/* Убираем возможную подложку с обёрток кнопок. */
body[data-page="chats"] .chat-active .chat-input-actions,
body[data-page="chats"] .chat-active .chat-send-actions,
body[data-page="chats"] .chat-active .send-actions,
body[data-page="chats"] .chat-active .voice-actions,
body[data-page="chats"] .chat-active .record-actions {
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    border: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    min-height: 0 !important;
    display: contents !important;
}

/* Поле ввода — отдельная плавающая капсула. */
body[data-page="chats"] .chat-active .chat-input-wrapper,
body:not(.theme-light)[data-page="chats"] .chat-active .chat-input-wrapper {
    min-height: 52px !important;
    height: auto !important;
    border-radius: 999px !important;
    padding: 0 14px !important;
    background: rgba(17, 24, 39, .76) !important;
    background-image: none !important;
    border: 1px solid rgba(255,255,255,.07) !important;
    box-shadow: 0 14px 36px rgba(0,0,0,.20) !important;
    backdrop-filter: blur(16px) saturate(1.12) !important;
    -webkit-backdrop-filter: blur(16px) saturate(1.12) !important;
}

body.theme-light[data-page="chats"] .chat-active .chat-input-wrapper {
    background: rgba(255,255,255,.82) !important;
    border-color: rgba(15,23,42,.10) !important;
    box-shadow: 0 14px 30px rgba(15,23,42,.10) !important;
}

body[data-page="chats"] .chat-active .chat-input-wrapper textarea,
body[data-page="chats"] .chat-active #message-input {
    min-height: 50px !important;
    max-height: 128px !important;
    padding: 14px 52px 12px 0 !important;
    background: transparent !important;
    background-color: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    outline: 0 !important;
    resize: none !important;
}

/* Скрепка/микрофон — отдельные круглые floating-кнопки. */
body[data-page="chats"] .chat-active #attach-file-btn,
body[data-page="chats"] .chat-active #voice-record-btn,
body[data-page="chats"] .chat-active .chat-input-area > .btn.icon:not(#send-message-btn),
body[data-page="chats"] .chat-active .chat-input-actions .btn.icon:not(#send-message-btn) {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    flex: 0 0 44px !important;
    border-radius: 999px !important;
    background: rgba(17, 24, 39, .64) !important;
    background-image: none !important;
    border: 1px solid rgba(255,255,255,.06) !important;
    box-shadow: 0 12px 28px rgba(0,0,0,.16) !important;
    backdrop-filter: blur(14px) saturate(1.1) !important;
    -webkit-backdrop-filter: blur(14px) saturate(1.1) !important;
}

body.theme-light[data-page="chats"] .chat-active #attach-file-btn,
body.theme-light[data-page="chats"] .chat-active #voice-record-btn,
body.theme-light[data-page="chats"] .chat-active .chat-input-area > .btn.icon:not(#send-message-btn),
body.theme-light[data-page="chats"] .chat-active .chat-input-actions .btn.icon:not(#send-message-btn) {
    background: rgba(255,255,255,.78) !important;
    border-color: rgba(15,23,42,.10) !important;
    box-shadow: 0 12px 24px rgba(15,23,42,.10) !important;
}

/* Кнопка отправки / кружка — только круг, без нижней площадки. */
body[data-page="chats"] .chat-active #send-message-btn,
body[data-page="chats"] .chat-active .send-btn,
body[data-page="chats"] .chat-active .record-send-btn {
    width: 52px !important;
    height: 52px !important;
    min-width: 52px !important;
    min-height: 52px !important;
    flex: 0 0 52px !important;
    align-self: end !important;
    border-radius: 999px !important;
    margin: 0 !important;
    padding: 0 !important;
    background-image: linear-gradient(135deg, var(--primary), var(--primary-dark, #6d5dfc)) !important;
    border: 0 !important;
    box-shadow: 0 16px 34px rgba(109, 93, 252, .26) !important;
    overflow: hidden !important;
}

/* Если старая тема рисует pseudo-подложку под кнопкой — гасим. */
body[data-page="chats"] .chat-active #send-message-btn::before,
body[data-page="chats"] .chat-active #send-message-btn::after,
body[data-page="chats"] .chat-active .send-btn::before,
body[data-page="chats"] .chat-active .send-btn::after,
body[data-page="chats"] .chat-active .record-send-btn::before,
body[data-page="chats"] .chat-active .record-send-btn::after {
    display: none !important;
    content: none !important;
}

/* Счётчик внутри капсулы, без отдельной зоны. */
body[data-page="chats"] .chat-active .chat-input-wrapper .char-counter,
body[data-page="chats"] .chat-active #char-counter {
    right: 16px !important;
    bottom: 14px !important;
    font-size: .72rem !important;
    opacity: .78 !important;
    background: transparent !important;
}

/* На всякий случай убираем декоративную полосу от нижнего layout-а. */
body[data-page="chats"] .chat-active::after,
body[data-page="chats"] .chat-main::after {
    display: none !important;
    content: none !important;
}

@media (max-width: 1024px) {
    body[data-page="chats"] .chat-active .chat-input-area {
        gap: 8px !important;
        padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px)) !important;
    }

    body[data-page="chats"] .chat-active .chat-input-wrapper {
        min-height: 48px !important;
        padding: 0 12px !important;
    }

    body[data-page="chats"] .chat-active .chat-input-wrapper textarea,
    body[data-page="chats"] .chat-active #message-input {
        min-height: 46px !important;
        max-height: 112px !important;
        padding: 13px 46px 11px 0 !important;
    }

    body[data-page="chats"] .chat-active #attach-file-btn,
    body[data-page="chats"] .chat-active #voice-record-btn,
    body[data-page="chats"] .chat-active .chat-input-area > .btn.icon:not(#send-message-btn),
    body[data-page="chats"] .chat-active .chat-input-actions .btn.icon:not(#send-message-btn) {
        width: 42px !important;
        height: 42px !important;
        min-width: 42px !important;
        min-height: 42px !important;
        flex-basis: 42px !important;
    }

    body[data-page="chats"] .chat-active #send-message-btn,
    body[data-page="chats"] .chat-active .send-btn,
    body[data-page="chats"] .chat-active .record-send-btn {
        width: 48px !important;
        height: 48px !important;
        min-width: 48px !important;
        min-height: 48px !important;
        flex-basis: 48px !important;
    }
}


/* === Stage 14F: composer overlay must not block/cover chat scroll area === */
/* Нижний composer остаётся поверх чата, но сама прозрачная область больше не ловит скролл/клики.
   Кликабельны только реальные элементы: скрепка, микрофон, поле, отправка/кружок. */
body[data-page="chats"] .chat-active {
    position: relative !important;
    overflow: hidden !important;
}

body[data-page="chats"] .chat-active .chat-messages {
    padding-bottom: 96px !important;
    scroll-padding-bottom: 104px !important;
}

body[data-page="chats"] .chat-active .chat-input-area,
body:not(.theme-light)[data-page="chats"] .chat-active .chat-input-area,
body.theme-light[data-page="chats"] .chat-active .chat-input-area {
    position: absolute !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 46 !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    pointer-events: none !important;
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    border: 0 !important;
    box-shadow: none !important;
    outline: 0 !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

/* Возвращаем клики только настоящим элементам ввода. */
body[data-page="chats"] .chat-active .chat-input-area > *,
body[data-page="chats"] .chat-active .chat-input-wrapper,
body[data-page="chats"] .chat-active .chat-input-wrapper *,
body[data-page="chats"] .chat-active .chat-input-area button,
body[data-page="chats"] .chat-active .chat-input-area textarea,
body[data-page="chats"] .chat-active .chat-input-area input,
body[data-page="chats"] .chat-active #attach-file-btn,
body[data-page="chats"] .chat-active #voice-record-btn,
body[data-page="chats"] .chat-active #send-message-btn {
    pointer-events: auto !important;
}

/* Убираем любые невидимые нижние декоративные слои/полосы, если их рисуют старые правила. */
body[data-page="chats"] .chat-active .chat-input-area::before,
body[data-page="chats"] .chat-active .chat-input-area::after,
body[data-page="chats"] .chat-active .chat-input-actions::before,
body[data-page="chats"] .chat-active .chat-input-actions::after,
body[data-page="chats"] .chat-active .chat-input-wrapper::before,
body[data-page="chats"] .chat-active .chat-input-wrapper::after {
    display: none !important;
    content: none !important;
    pointer-events: none !important;
}

/* Голос/кружок/record overlay не должен создавать большую нижнюю подложку. */
body[data-page="chats"] .chat-active .recording-panel,
body[data-page="chats"] .chat-active .voice-recording-panel,
body[data-page="chats"] .chat-active .video-circle-recording-panel,
body[data-page="chats"] .chat-active .recording-overlay {
    pointer-events: auto !important;
    background: rgba(17, 24, 39, .78) !important;
    border: 1px solid rgba(255,255,255,.08) !important;
    box-shadow: 0 18px 38px rgba(0,0,0,.22) !important;
    backdrop-filter: blur(16px) saturate(1.12) !important;
    -webkit-backdrop-filter: blur(16px) saturate(1.12) !important;
}

body.theme-light[data-page="chats"] .chat-active .recording-panel,
body.theme-light[data-page="chats"] .chat-active .voice-recording-panel,
body.theme-light[data-page="chats"] .chat-active .video-circle-recording-panel,
body.theme-light[data-page="chats"] .chat-active .recording-overlay {
    background: rgba(255,255,255,.86) !important;
    border-color: rgba(15,23,42,.10) !important;
    box-shadow: 0 18px 34px rgba(15,23,42,.12) !important;
}

@media (max-width: 1024px) {
    body[data-page="chats"] .chat-active .chat-messages {
        padding-bottom: 86px !important;
        scroll-padding-bottom: 94px !important;
    }
}

@media (max-width: 480px) {
    body[data-page="chats"] .chat-active .chat-messages {
        padding-bottom: 82px !important;
        scroll-padding-bottom: 90px !important;
    }
}


/* === Stage 14G: remove last visible blur haze around composer base === */
/* Финальная подчистка: общая зона composer полностью невидимая.
   Blur/тени остаются только у реальных кнопок и поля, не у всей нижней области. */
body[data-page="chats"] .chat-active .chat-input-area,
body:not(.theme-light)[data-page="chats"] .chat-active .chat-input-area,
body.theme-light[data-page="chats"] .chat-active .chat-input-area {
    background: none !important;
    background-color: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
    filter: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    opacity: 1 !important;
    mix-blend-mode: normal !important;
    isolation: auto !important;
}

/* Убираем любые старые декоративные следы вокруг всей строки ввода. */
body[data-page="chats"] .chat-active .chat-input-area::before,
body[data-page="chats"] .chat-active .chat-input-area::after,
body[data-page="chats"] .chat-active .chat-input-actions::before,
body[data-page="chats"] .chat-active .chat-input-actions::after,
body[data-page="chats"] .chat-active .chat-forward-inline::before,
body[data-page="chats"] .chat-active .chat-forward-inline::after {
    display: none !important;
    content: none !important;
    background: none !important;
    box-shadow: none !important;
    filter: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

/* Убираем лишний общий blur у боковых кнопок, чтобы не было заметной мутной полосы.
   Кнопки остаются стеклянными через полупрозрачный background, но без backdrop blur. */
body[data-page="chats"] .chat-active #attach-file-btn,
body[data-page="chats"] .chat-active #voice-record-btn,
body[data-page="chats"] .chat-active #send-message-btn,
body[data-page="chats"] .chat-active .chat-input-area > .btn.icon,
body[data-page="chats"] .chat-active .chat-input-actions .btn.icon {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

/* Поле оставляем аккуратной капсулой, но blur делаем слабее, чтобы не светилась зона вокруг. */
body[data-page="chats"] .chat-active .chat-input-wrapper {
    backdrop-filter: blur(6px) saturate(1.04) !important;
    -webkit-backdrop-filter: blur(6px) saturate(1.04) !important;
    box-shadow: 0 10px 24px rgba(0,0,0,.14) !important;
}

body.theme-light[data-page="chats"] .chat-active .chat-input-wrapper {
    box-shadow: 0 10px 22px rgba(15,23,42,.08) !important;
}

@media (max-width: 1024px) {
    body[data-page="chats"] .chat-active .chat-input-wrapper {
        box-shadow: 0 8px 18px rgba(0,0,0,.12) !important;
    }
}


/* === Stage 14H: rollback 14G haze regression, keep 14F no-blocking overlay === */
/* 14G вернул визуальную нижнюю область. Финально принудительно делаем общий composer-слой
   полностью невидимым, но НЕ трогаем layout 14F. Видимыми остаются только реальные элементы. */

.chats-page .chat-active .chat-input-area,
body .chats-page .chat-active .chat-input-area,
body[data-page="chats"] .chat-active .chat-input-area,
body:not(.theme-light)[data-page="chats"] .chat-active .chat-input-area,
body.theme-light[data-page="chats"] .chat-active .chat-input-area {
    position: absolute !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 46 !important;
    display: grid !important;
    grid-template-columns: auto auto minmax(0, 1fr) auto !important;
    align-items: end !important;
    gap: 10px !important;
    padding: 10px 18px calc(10px + env(safe-area-inset-bottom, 0px)) !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    pointer-events: none !important;

    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    border: 0 !important;
    border-top: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    outline: 0 !important;
    filter: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

/* Гасим все возможные старые подложки на прямых контейнерах ввода. */
.chats-page .chat-active .chat-input-area::before,
.chats-page .chat-active .chat-input-area::after,
.chats-page .chat-active .chat-input-actions,
.chats-page .chat-active .chat-input-actions::before,
.chats-page .chat-active .chat-input-actions::after,
.chats-page .chat-active .chat-send-actions,
.chats-page .chat-active .chat-send-actions::before,
.chats-page .chat-active .chat-send-actions::after,
.chats-page .chat-active .send-actions,
.chats-page .chat-active .send-actions::before,
.chats-page .chat-active .send-actions::after,
.chats-page .chat-active .voice-actions,
.chats-page .chat-active .voice-actions::before,
.chats-page .chat-active .voice-actions::after,
.chats-page .chat-active .record-actions,
.chats-page .chat-active .record-actions::before,
.chats-page .chat-active .record-actions::after {
    content: none !important;
    display: contents !important;
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    filter: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    padding: 0 !important;
    margin: 0 !important;
    min-height: 0 !important;
    pointer-events: none !important;
}

/* Кликабельность возвращаем только самим контролам. */
.chats-page .chat-active .chat-input-area > *,
.chats-page .chat-active .chat-input-wrapper,
.chats-page .chat-active .chat-input-wrapper *,
.chats-page .chat-active .chat-input-area button,
.chats-page .chat-active .chat-input-area textarea,
.chats-page .chat-active .chat-input-area input,
.chats-page .chat-active #attach-file-btn,
.chats-page .chat-active #voice-record-btn,
.chats-page .chat-active #send-message-btn {
    pointer-events: auto !important;
}

/* Реальные элементы оставляем floating. */
.chats-page .chat-active .chat-input-wrapper,
body:not(.theme-light) .chats-page .chat-active .chat-input-wrapper,
body:not(.theme-light)[data-page="chats"] .chat-active .chat-input-wrapper {
    min-height: 52px !important;
    border-radius: 999px !important;
    padding: 0 14px !important;
    background: rgba(17, 24, 39, .76) !important;
    background-image: none !important;
    border: 1px solid rgba(255,255,255,.07) !important;
    box-shadow: 0 14px 36px rgba(0,0,0,.20) !important;
    backdrop-filter: blur(16px) saturate(1.12) !important;
    -webkit-backdrop-filter: blur(16px) saturate(1.12) !important;
}

body.theme-light .chats-page .chat-active .chat-input-wrapper,
body.theme-light[data-page="chats"] .chat-active .chat-input-wrapper {
    background: rgba(255,255,255,.82) !important;
    border-color: rgba(15,23,42,.10) !important;
    box-shadow: 0 14px 30px rgba(15,23,42,.10) !important;
}

.chats-page .chat-active .chat-input-wrapper textarea,
.chats-page .chat-active #message-input {
    min-height: 50px !important;
    max-height: 128px !important;
    padding: 14px 52px 12px 0 !important;
    background: transparent !important;
    background-color: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    outline: 0 !important;
    resize: none !important;
}

.chats-page .chat-active #attach-file-btn,
.chats-page .chat-active #voice-record-btn,
.chats-page .chat-active .chat-input-area > .btn.icon:not(#send-message-btn),
.chats-page .chat-active .chat-input-actions .btn.icon:not(#send-message-btn) {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    flex: 0 0 44px !important;
    border-radius: 999px !important;
    background: rgba(17, 24, 39, .64) !important;
    background-image: none !important;
    border: 1px solid rgba(255,255,255,.06) !important;
    box-shadow: 0 12px 28px rgba(0,0,0,.16) !important;
    backdrop-filter: blur(14px) saturate(1.1) !important;
    -webkit-backdrop-filter: blur(14px) saturate(1.1) !important;
}

.chats-page .chat-active #send-message-btn,
.chats-page .chat-active .send-btn,
.chats-page .chat-active .record-send-btn {
    width: 52px !important;
    height: 52px !important;
    min-width: 52px !important;
    min-height: 52px !important;
    flex: 0 0 52px !important;
    align-self: end !important;
    border-radius: 999px !important;
    margin: 0 !important;
    padding: 0 !important;
    background-image: linear-gradient(135deg, var(--primary), var(--primary-dark, #6d5dfc)) !important;
    border: 0 !important;
    box-shadow: 0 16px 34px rgba(109, 93, 252, .26) !important;
    overflow: hidden !important;
}

/* Место под последними сообщениями, но без визуальной панели. */
.chats-page .chat-active .chat-messages,
body[data-page="chats"] .chat-active .chat-messages {
    padding-bottom: 96px !important;
    scroll-padding-bottom: 104px !important;
}

@media (max-width: 1024px) {
    .chats-page .chat-active .chat-input-area,
    body[data-page="chats"] .chat-active .chat-input-area {
        gap: 8px !important;
        padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px)) !important;
    }

    .chats-page .chat-active .chat-input-wrapper,
    body[data-page="chats"] .chat-active .chat-input-wrapper {
        min-height: 48px !important;
        padding: 0 12px !important;
    }

    .chats-page .chat-active .chat-input-wrapper textarea,
    .chats-page .chat-active #message-input {
        min-height: 46px !important;
        max-height: 112px !important;
        padding: 13px 46px 11px 0 !important;
    }

    .chats-page .chat-active #attach-file-btn,
    .chats-page .chat-active #voice-record-btn,
    .chats-page .chat-active .chat-input-area > .btn.icon:not(#send-message-btn),
    .chats-page .chat-active .chat-input-actions .btn.icon:not(#send-message-btn) {
        width: 42px !important;
        height: 42px !important;
        min-width: 42px !important;
        min-height: 42px !important;
        flex-basis: 42px !important;
    }

    .chats-page .chat-active #send-message-btn,
    .chats-page .chat-active .send-btn,
    .chats-page .chat-active .record-send-btn {
        width: 48px !important;
        height: 48px !important;
        min-width: 48px !important;
        min-height: 48px !important;
        flex-basis: 48px !important;
    }

    .chats-page .chat-active .chat-messages,
    body[data-page="chats"] .chat-active .chat-messages {
        padding-bottom: 86px !important;
        scroll-padding-bottom: 94px !important;
    }
}


/* === Stage 14I: stronger/cleaner sidebar top action buttons === */
.chats-sidebar-header {
    align-items: center !important;
    gap: 12px !important;
}

/* The ordinary list has no title bar (owner, 2026-10-08): group creation moved
   into the search row. The archive keeps its bar (back + title). The heading
   stays available to screen readers. */
.chats-sidebar:not(.archive-view) .chats-sidebar-header {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    min-height: 0 !important;
    margin: -1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

#new-group-top-btn {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 16px !important;
    border: 1px solid rgba(255,255,255,.08) !important;
    box-shadow: 0 10px 24px rgba(0,0,0,.16) !important;
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease, color .18s ease !important;
}

#new-group-top-btn {
    background: rgba(17, 24, 39, .64) !important;
    color: rgba(255,255,255,.92) !important;
    backdrop-filter: blur(10px) saturate(1.08) !important;
    -webkit-backdrop-filter: blur(10px) saturate(1.08) !important;
}

#new-group-top-btn {
    border-color: rgba(109,93,252,.28) !important;
}

#new-group-top-btn:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 14px 28px rgba(0,0,0,.20) !important;
}

#new-group-top-btn:hover {
    background: linear-gradient(135deg, rgba(109,93,252,.24), rgba(32,198,255,.16)) !important;
    color: #ffffff !important;
}

#new-group-top-btn svg {
    width: 22px !important;
    height: 22px !important;
    stroke-width: 2 !important;
    stroke: currentColor !important;
    opacity: .98 !important;
}

@media (max-width: 1024px) {
    #new-group-top-btn {
        width: 42px !important;
        height: 42px !important;
        min-width: 42px !important;
        min-height: 42px !important;
        border-radius: 15px !important;
    }

    #new-group-top-btn svg {
        width: 21px !important;
        height: 21px !important;
    }
}

@media (max-width: 480px) {
    #new-group-top-btn {
        border-radius: 14px !important;
    }
}


/* === Stage 14J: final chat visual polish, CSS-only === */
/* Общая полировка: Telegram-like bubbles, dialog list, system rows, avatars/timestamps. */

.chats-page {
    --chat-surface-soft: rgba(17, 24, 39, .58);
    --chat-surface-pill: rgba(17, 24, 39, .70);
    --chat-line-soft: rgba(255,255,255,.075);
    --chat-hover-soft: rgba(109,93,252,.095);
    --chat-active-soft: rgba(109,93,252,.145);
}

body.theme-light .chats-page {
    --chat-surface-soft: rgba(255,255,255,.72);
    --chat-surface-pill: rgba(255,255,255,.82);
    --chat-line-soft: rgba(15,23,42,.085);
    --chat-hover-soft: rgba(109,93,252,.075);
    --chat-active-soft: rgba(109,93,252,.13);
}

/* Левый список диалогов: чище карточки, активный диалог заметнее. */
.chats-list {
    padding: 8px 8px 14px !important;
    gap: 6px !important;
}

.chat-item {
    border-radius: 18px !important;
    margin: 0 0 6px !important;
    padding: 12px 12px !important;
    border: 1px solid transparent !important;
    background: transparent !important;
    transition: background .16s ease, border-color .16s ease, transform .16s ease, box-shadow .16s ease !important;
}

.chat-item:hover {
    background: var(--chat-hover-soft) !important;
    border-color: var(--chat-line-soft) !important;
    transform: translateY(-1px) !important;
}

.chat-item.active,
.chat-item.is-active,
.chat-item.selected,
.chat-item[aria-selected="true"] {
    background: linear-gradient(135deg, rgba(109,93,252,.20), rgba(32,198,255,.055)) !important;
    border-color: rgba(139,92,246,.26) !important;
    box-shadow: inset 3px 0 0 rgba(139,92,246,.85), 0 10px 28px rgba(0,0,0,.10) !important;
}

.chat-item .avatar,
.chat-item-avatar,
.chat-item .group-avatar {
    box-shadow: 0 8px 20px rgba(0,0,0,.16) !important;
    border: 1px solid rgba(255,255,255,.10) !important;
}

.chat-item-title,
.chat-item-name {
    font-weight: 800 !important;
    letter-spacing: -.015em !important;
}

.chat-item-preview {
    line-height: 1.25 !important;
    opacity: .86 !important;
}

.chat-item-time {
    opacity: .78 !important;
    font-size: .76rem !important;
    white-space: nowrap !important;
}

/* Сообщения: компактнее, без лишнего визуального шума. */
.chat-messages {
    gap: 8px !important;
    scroll-behavior: smooth !important;
}

.message,
.chat-message {
    margin-block: 3px !important;
}

.message-bubble,
.chat-message-bubble,
.message-content {
    border-radius: 20px !important;
    line-height: 1.42 !important;
    box-shadow: 0 8px 20px rgba(0,0,0,.10) !important;
}

.message.incoming .message-bubble,
.chat-message.incoming .chat-message-bubble,
.message:not(.own):not(.outgoing) .message-bubble {
    background: rgba(17, 24, 39, .72) !important;
    border: 1px solid rgba(255,255,255,.065) !important;
}

body.theme-light .message.incoming .message-bubble,
body.theme-light .chat-message.incoming .chat-message-bubble,
body.theme-light .message:not(.own):not(.outgoing) .message-bubble {
    background: rgba(255,255,255,.90) !important;
    border-color: rgba(15,23,42,.07) !important;
}

.message.own .message-bubble,
.message.outgoing .message-bubble,
.chat-message.own .chat-message-bubble,
.chat-message.outgoing .chat-message-bubble {
    background: linear-gradient(135deg, #8b5cf6, #a879ff) !important;
    color: #fff !important;
    border: 1px solid rgba(255,255,255,.16) !important;
    box-shadow: 0 10px 24px rgba(139,92,246,.18) !important;
}

.message.own .message-time,
.message.outgoing .message-time,
.chat-message.own .message-time,
.chat-message.outgoing .message-time {
    color: rgba(255,255,255,.78) !important;
}

/* Мини-аватарки у сообщений — ровнее и аккуратнее. */
.message-sender-avatar,
.message-mini-avatar,
.chat-message-avatar {
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    min-height: 28px !important;
    border-radius: 999px !important;
    overflow: hidden !important;
    box-shadow: 0 6px 16px rgba(0,0,0,.16) !important;
    border: 1px solid rgba(255,255,255,.12) !important;
    cursor: pointer !important;
}

.message-sender-avatar:hover,
.message-mini-avatar:hover,
.chat-message-avatar:hover {
    transform: translateY(-1px) scale(1.03) !important;
}

/* Таймстемпы и статусы в пузырях. */
.message-time,
.chat-message-time,
.message-meta {
    font-size: .72rem !important;
    opacity: .78 !important;
    line-height: 1 !important;
}

.message-status,
.message-read-status {
    opacity: .82 !important;
}

/* Системные строки: звонки, группа создана, участник добавлен — как Telegram chip по центру. */
.message.system,
.chat-system-row,
.system-message,
.call-system-row,
.group-system-row {
    display: flex !important;
    justify-content: center !important;
    margin: 10px auto !important;
    text-align: center !important;
    pointer-events: none !important;
}

.message.system .message-bubble,
.chat-system-row > *,
.system-message > *,
.call-system-row > *,
.group-system-row > * {
    max-width: min(84%, 460px) !important;
    width: auto !important;
    padding: 6px 12px !important;
    border-radius: 999px !important;
    background: rgba(148, 163, 184, .16) !important;
    border: 1px solid rgba(255,255,255,.06) !important;
    color: rgba(226,232,240,.84) !important;
    box-shadow: none !important;
    font-size: .78rem !important;
    line-height: 1.25 !important;
    backdrop-filter: blur(8px) saturate(1.05) !important;
    -webkit-backdrop-filter: blur(8px) saturate(1.05) !important;
}

body.theme-light .message.system .message-bubble,
body.theme-light .chat-system-row > *,
body.theme-light .system-message > *,
body.theme-light .call-system-row > *,
body.theme-light .group-system-row > * {
    background: rgba(100, 116, 139, .12) !important;
    color: rgba(15,23,42,.68) !important;
    border-color: rgba(15,23,42,.05) !important;
}

/* Дата по центру. */
.date-separator,
.chat-date-separator,
.messages-date,
.message-date-row {
    margin: 14px auto 10px !important;
    text-align: center !important;
}

.date-separator span,
.chat-date-separator span,
.messages-date span,
.message-date-row span {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 5px 11px !important;
    border-radius: 999px !important;
    background: rgba(148, 163, 184, .14) !important;
    border: 1px solid rgba(255,255,255,.055) !important;
    color: rgba(226,232,240,.80) !important;
    font-size: .75rem !important;
    font-weight: 700 !important;
}

body.theme-light .date-separator span,
body.theme-light .chat-date-separator span,
body.theme-light .messages-date span,
body.theme-light .message-date-row span {
    background: rgba(100,116,139,.11) !important;
    color: rgba(15,23,42,.66) !important;
    border-color: rgba(15,23,42,.05) !important;
}

/* Медиа и вложения — мягче. */
.message-attachment,
.attachment-card,
.voice-message,
.video-circle-message,
.chat-file-message {
    border-radius: 18px !important;
    overflow: hidden !important;
    border: 1px solid rgba(255,255,255,.07) !important;
}

.message img,
.message video,
.chat-message img,
.chat-message video {
    border-radius: 16px !important;
}

/* Новые сообщения / typing — меньше давят на контент. */
.new-messages-wrap {
    pointer-events: none !important;
}

#new-messages-btn {
    pointer-events: auto !important;
    border-radius: 999px !important;
    box-shadow: 0 5px 18px rgba(0,0,0,.16) !important;
}

.chat-typing-indicator {
    width: fit-content !important;
    max-width: min(86%, 360px) !important;
    border-radius: 999px !important;
    background: rgba(17,24,39,.62) !important;
    border: 1px solid rgba(255,255,255,.06) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
}

body.theme-light .chat-typing-indicator {
    background: rgba(255,255,255,.82) !important;
    border-color: rgba(15,23,42,.08) !important;
}

/* Search bar в чате — без тяжёлой полосы. */
#chat-search-bar,
.chat-search-bar {
    box-shadow: 0 14px 34px rgba(0,0,0,.16) !important;
}

/* Мобильная подстройка пузырей и списка. */
@media (max-width: 1024px) {
    .chats-list {
        padding-inline: 8px !important;
    }

    .chat-item {
        border-radius: 17px !important;
        padding: 11px 11px !important;
    }

    .chat-messages {
        gap: 7px !important;
    }

    .message-bubble,
    .chat-message-bubble,
    .message-content {
        border-radius: 18px !important;
    }

    .message-sender-avatar,
    .message-mini-avatar,
    .chat-message-avatar {
        width: 26px !important;
        height: 26px !important;
        min-width: 26px !important;
        min-height: 26px !important;
    }
}

@media (max-width: 480px) {
    .chat-item {
        margin-bottom: 5px !important;
    }

    .message-bubble,
    .chat-message-bubble,
    .message-content {
        border-radius: 17px !important;
    }

    .message.system .message-bubble,
    .chat-system-row > *,
    .system-message > *,
    .call-system-row > *,
    .group-system-row > * {
        max-width: 90% !important;
        font-size: .75rem !important;
    }
}


/* === Stage 14K: fix nested inner bubble + improve light-theme top button icon contrast === */

/* 1) Убираем случайный "внутренний пузырь" в сообщениях.
   После Stage 14J стили попали на .message-content, хотя bubble у нас — это .message. */
.message .message-content,
.chat-message .message-content,
.message .chat-message-bubble,
.chat-message .chat-message-bubble {
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    border: 0 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
}

/* Оставляем bubble именно на .message */
.message.sent,
.message.received {
    overflow: visible !important;
}

/* 2) Светлая тема: сохраняем контраст иконки создания группы. */
body.theme-light #new-group-top-btn {
    background: rgba(51, 65, 85, .10) !important;
    color: #334155 !important;
    border-color: rgba(51,65,85,.10) !important;
    box-shadow: 0 8px 18px rgba(15,23,42,.08) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

body.theme-light #new-group-top-btn:hover {
    background: rgba(109,93,252,.12) !important;
    color: #4338ca !important;
    border-color: rgba(109,93,252,.18) !important;
}

body.theme-light #new-group-top-btn svg {
    stroke: currentColor !important;
    opacity: 1 !important;
}

/* === Stage 15: forwarding to/from groups polish === */
.chat-forward-user.group-forward-user .chat-forward-avatar,
.chat-forward-avatar.group-avatar {
    background: linear-gradient(135deg, var(--primary, #6d5dfc), #20c6ff) !important;
    color: #fff !important;
}

.chat-forward-avatar.has-image {
    overflow: hidden !important;
    background: transparent !important;
}

.chat-forward-avatar.has-image img {
    width: 100% !important;
    height: 100% !important;
    display: block !important;
    object-fit: cover !important;
}

.message-forwarded-badge .message-forwarded-user {
    color: inherit !important;
}


/* === Stage 16: clean photo messages + media viewer forward polish === */
/* Фото в сообщении — без нижней подписи "Скачать" и без огромной цветной подложки. */
.message:has(.chat-media-thumb),
.message.sent:has(.chat-media-thumb),
.message.received:has(.chat-media-thumb),
.chat-message:has(.chat-media-thumb) {
    padding: 3px !important;
    background: transparent !important;
    background-image: none !important;
    border: 0 !important;
    box-shadow: none !important;
    overflow: visible !important;
}

.message:has(.chat-media-thumb) .message-content,
.chat-message:has(.chat-media-thumb) .message-content {
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
}

.message:has(.chat-media-thumb) .chat-media-thumb {
    width: min(420px, 68vw) !important;
    max-width: 100% !important;
    min-height: 0 !important;
    border-radius: 20px !important;
    overflow: hidden !important;
    border: 1px solid rgba(255,255,255,.10) !important;
    background: rgba(15,23,42,.18) !important;
    box-shadow: 0 14px 34px rgba(0,0,0,.18) !important;
}

.message.received:has(.chat-media-thumb) .chat-media-thumb {
    border-color: rgba(15,23,42,.08) !important;
    background: rgba(255,255,255,.10) !important;
}

.message:has(.chat-media-thumb) .chat-attach-image {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    min-height: 0 !important;
    max-height: 420px !important;
    object-fit: cover !important;
    border-radius: 20px !important;
}

/* Старую подпись под фото скрываем, если старые сообщения ещё её отрендерят из кэша. */
.message:has(.chat-media-thumb) .chat-attach-caption {
    display: none !important;
}

/* Время на фото — маленькая плашка поверх картинки. */
.message:has(.chat-media-thumb) > .message-time,
.message:has(.chat-media-thumb) .message-time {
    position: absolute !important;
    right: 10px !important;
    bottom: 8px !important;
    margin: 0 !important;
    padding: 4px 7px !important;
    border-radius: 999px !important;
    color: #fff !important;
    background: rgba(15, 23, 42, .46) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    font-size: .68rem !important;
    opacity: 1 !important;
    z-index: 2 !important;
}

/* Media viewer: убираем кнопку Скачать и тяжёлую нижнюю область, оставляем рабочую Переслать. */
#chat-media-download {
    display: none !important;
}

.chat-media-viewer-footer {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    padding: 0 !important;
}

#chat-media-forward.chat-media-action {
    min-height: 42px !important;
    padding: 0 18px !important;
    border-radius: 999px !important;
    background: rgba(109, 93, 252, .88) !important;
    border: 1px solid rgba(255,255,255,.18) !important;
    color: #fff !important;
    box-shadow: 0 14px 32px rgba(0,0,0,.24) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
}

#chat-media-forward.chat-media-action:hover {
    background: rgba(139, 92, 246, .94) !important;
}

@media (max-width: 1024px) {
    .message:has(.chat-media-thumb) .chat-media-thumb {
        width: min(320px, 76vw) !important;
    }

    .message:has(.chat-media-thumb) .chat-attach-image {
        max-height: 340px !important;
    }
}

@media (max-width: 480px) {
    .message:has(.chat-media-thumb) .chat-media-thumb {
        width: min(300px, 78vw) !important;
        border-radius: 18px !important;
    }

    .message:has(.chat-media-thumb) .chat-attach-image {
        border-radius: 18px !important;
        max-height: 320px !important;
    }
}


/* === Stage 16B: restore video circles + add download action in message sheet === */
/* Stage 16 media/photo styles made video-circle rectangular. Force Telegram circle shape back. */
.message:has(.video-circle-message) {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
}

.message:has(.video-circle-message) .message-content {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    border-radius: 0 !important;
}

.video-circle-message,
.message .video-circle-message,
.chat-message .video-circle-message {
    width: 180px !important;
    height: 180px !important;
    min-width: 180px !important;
    min-height: 180px !important;
    max-width: 180px !important;
    max-height: 180px !important;
    aspect-ratio: 1 / 1 !important;
    border-radius: 999px !important;
    overflow: hidden !important;
    padding: 0 !important;
    border: 0 !important;
    background: #020617 !important;
    display: block !important;
    box-shadow: 0 12px 30px rgba(0,0,0,.22) !important;
}

.video-circle-message video,
.message .video-circle-message video,
.chat-message .video-circle-message video {
    width: 100% !important;
    height: 100% !important;
    min-width: 100% !important;
    min-height: 100% !important;
    display: block !important;
    object-fit: cover !important;
    border-radius: 999px !important;
    background: #020617 !important;
}

.video-circle-message .video-circle-play {
    border-radius: 999px !important;
}

.message:has(.video-circle-message) .message-time {
    position: static !important;
    display: block !important;
    width: fit-content !important;
    margin: 4px 8px 0 auto !important;
    padding: 0 !important;
    background: transparent !important;
    color: var(--text-muted) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

/* Кнопка скачать в action sheet для фото/файлов/гс/кружков. */
#sheet-download-message[hidden] {
    display: none !important;
}

#sheet-download-message:not([hidden]) {
    display: flex !important;
}

@media (max-width: 1024px) {
    .video-circle-message,
    .message .video-circle-message,
    .chat-message .video-circle-message {
        width: 148px !important;
        height: 148px !important;
        min-width: 148px !important;
        min-height: 148px !important;
        max-width: 148px !important;
        max-height: 148px !important;
    }
}

@media (max-width: 480px) {
    .video-circle-message,
    .message .video-circle-message,
    .chat-message .video-circle-message {
        width: 132px !important;
        height: 132px !important;
        min-width: 132px !important;
        min-height: 132px !important;
        max-width: 132px !important;
        max-height: 132px !important;
    }
}


/* === Stage 17: centered empty chat/support state + support action cleanup === */
.chat-messages.is-empty-chat {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.empty-chat {
    min-height: 100% !important;
    width: 100% !important;
    flex: 1 1 auto !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    margin: auto !important;
    padding: 32px 18px 96px !important;
    color: var(--text-muted) !important;
}

.empty-chat svg {
    margin: 0 0 14px !important;
    opacity: .55 !important;
}

.empty-chat-text {
    font-size: clamp(1.15rem, 2.4vw, 1.65rem) !important;
    font-weight: 800 !important;
    line-height: 1.2 !important;
    color: var(--text) !important;
}

.empty-chat-subtext {
    margin-top: 6px !important;
    font-size: clamp(.95rem, 1.8vw, 1.15rem) !important;
    line-height: 1.35 !important;
    color: var(--text-muted) !important;
}

/* Защита стилем: если активна поддержка, не показываем сделку/голосовые даже при старом inline состоянии. */
.chat-active[data-chat-type="support"] .chat-create-deal-btn,
.chat-active[data-chat-type="support"] #voice-record-btn {
    display: none !important;
}


/* === Stage 17B: support chat controls/composer hard fix === */
/* В поддержке сверху не должно быть сделок/звонков/поиска/участников. */
.chat-active[data-chat-type="support"] .chat-header-actions .call-btn,
.chat-active[data-chat-type="support"] .chat-header-actions #call-voice-btn,
.chat-active[data-chat-type="support"] .chat-header-actions #call-video-btn,
.chat-active[data-chat-type="support"] .chat-header-actions #chat-create-deal-btn,
.chat-active[data-chat-type="support"] .chat-header-actions #chat-mobile-create-deal-btn,
.chat-active[data-chat-type="support"] .chat-header-actions .chat-create-deal-btn,
.chat-active[data-chat-type="support"] .chat-header-actions #chat-search-msg-btn,
.chat-active[data-chat-type="support"] .chat-header-actions #group-members-btn,
.chat-active.support-chat-active .chat-header-actions .call-btn,
.chat-active.support-chat-active .chat-header-actions #chat-create-deal-btn,
.chat-active.support-chat-active .chat-header-actions #chat-mobile-create-deal-btn,
.chat-active.support-chat-active .chat-header-actions .chat-create-deal-btn,
.chat-active.support-chat-active .chat-header-actions #chat-search-msg-btn,
.chat-active.support-chat-active .chat-header-actions #group-members-btn {
    display: none !important;
}

/* В поддержке composer: скрепка + широкое поле + отправка. Без голосовых/кружка. */
.chat-active[data-chat-type="support"] .chat-input-area,
.chat-active.support-chat-active .chat-input-area {
    grid-template-columns: auto minmax(260px, 1fr) auto !important;
}

.chat-active[data-chat-type="support"] #voice-record-btn,
.chat-active.support-chat-active #voice-record-btn {
    display: none !important;
}

.chat-active[data-chat-type="support"] .chat-input-wrapper,
.chat-active.support-chat-active .chat-input-wrapper {
    min-width: min(420px, 52vw) !important;
    width: 100% !important;
}

.chat-active[data-chat-type="support"] #message-input,
.chat-active.support-chat-active #message-input {
    min-width: 0 !important;
    width: 100% !important;
}

/* Пустое состояние поддержки/чата строго по центру свободной области. */
.chat-active[data-chat-type="support"] #chat-messages,
.chat-active.support-chat-active #chat-messages {
    display: flex !important;
    flex-direction: column !important;
}

.chat-active[data-chat-type="support"] #chat-messages .empty-chat,
.chat-active.support-chat-active #chat-messages .empty-chat,
#chat-messages .empty-chat {
    margin: auto !important;
    min-height: 0 !important;
    width: min(520px, 92%) !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    color: var(--text) !important;
}

#chat-messages .empty-chat svg {
    margin-bottom: 18px !important;
    opacity: .55 !important;
}

#chat-messages .empty-chat-text {
    font-size: clamp(1.5rem, 2.4vw, 2.25rem) !important;
    line-height: 1.12 !important;
    font-weight: 900 !important;
    letter-spacing: -.03em !important;
    margin-bottom: 10px !important;
}

#chat-messages .empty-chat-subtext {
    font-size: clamp(1rem, 1.4vw, 1.35rem) !important;
    line-height: 1.35 !important;
    color: var(--text-muted) !important;
}

@media (max-width: 1024px) {
    .chat-active[data-chat-type="support"] .chat-input-area,
    .chat-active.support-chat-active .chat-input-area {
        grid-template-columns: auto minmax(0, 1fr) auto !important;
    }

    .chat-active[data-chat-type="support"] .chat-input-wrapper,
    .chat-active.support-chat-active .chat-input-wrapper {
        min-width: 0 !important;
    }
}


/* === Stage 18: SSE read/typing polish === */
.message-read-mark {
    display: inline-flex;
    align-items: center;
    margin-left: 5px;
    font-size: .72rem;
    line-height: 1;
    letter-spacing: -0.08em;
    color: rgba(255,255,255,.58);
    vertical-align: -1px;
}

.message-read-mark.read {
    color: #c7f0ff;
}

.message.received .message-read-mark {
    display: none;
}

body.theme-light .message.sent .message-read-mark {
    color: rgba(255,255,255,.72);
}

.chat-typing-indicator {
    transition: opacity .14s ease, transform .14s ease;
}

.chat-typing-indicator:not(.hidden) {
    opacity: 1;
    transform: translateY(0);
}


/* === Stage 18B: typing status in chat header, not under composer === */
.chat-typing-indicator {
    display: none !important;
}

.chat-peer-status.typing {
    color: var(--primary, #8b5cf6) !important;
    font-weight: 800 !important;
}


/* === Stage 18C: final support composer width fix === */
/* Поддержка: нижняя строка должна занимать всю ширину чата:
   скрепка + широкое поле + отправка. */
.chat-active[data-chat-type="support"] .chat-input-area,
.chat-active.support-chat-active .chat-input-area {
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: none !important;
    box-sizing: border-box !important;
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) auto !important;
    justify-content: stretch !important;
    align-items: end !important;
    padding-left: 28px !important;
    padding-right: 28px !important;
}

/* Обёртка кнопок в поддержке не должна занимать отдельную широкую колонку. */
.chat-active[data-chat-type="support"] .chat-input-actions,
.chat-active.support-chat-active .chat-input-actions {
    display: contents !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
}

/* В поддержке голосовых нет, значит место под микрофон не резервируем. */
.chat-active[data-chat-type="support"] #voice-record-btn,
.chat-active.support-chat-active #voice-record-btn {
    display: none !important;
    width: 0 !important;
    min-width: 0 !important;
    flex-basis: 0 !important;
}

/* Поле ввода в поддержке — растянуть, убрать старые min/max ограничения. */
.chat-active[data-chat-type="support"] .chat-input-wrapper,
.chat-active.support-chat-active .chat-input-wrapper {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    justify-self: stretch !important;
    box-sizing: border-box !important;
}

.chat-active[data-chat-type="support"] #message-input,
.chat-active.support-chat-active #message-input {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    box-sizing: border-box !important;
}

/* Кнопка отправки не должна сжимать поле. */
.chat-active[data-chat-type="support"] #send-message-btn,
.chat-active.support-chat-active #send-message-btn,
.chat-active[data-chat-type="support"] #attach-file-btn,
.chat-active.support-chat-active #attach-file-btn {
    flex-shrink: 0 !important;
}

@media (max-width: 1024px) {
    .chat-active[data-chat-type="support"] .chat-input-area,
    .chat-active.support-chat-active .chat-input-area {
        padding-left: 10px !important;
        padding-right: 10px !important;
        grid-template-columns: auto minmax(0, 1fr) auto !important;
    }
}

@media (max-width: 480px) {
    .chat-active[data-chat-type="support"] .chat-input-area,
    .chat-active.support-chat-active .chat-input-area {
        padding-left: 8px !important;
        padding-right: 8px !important;
        gap: 7px !important;
    }
}


/* === Stage 18D: hard support composer width override === */
/* Final: support composer uses flex, not old grid, so input cannot stay cropped on PC. */
.chat-active[data-chat-type="support"] .chat-input-area,
.chat-active.support-chat-active .chat-input-area {
    display: flex !important;
    grid-template-columns: none !important;
    align-items: flex-end !important;
    gap: 12px !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: none !important;
    box-sizing: border-box !important;
    justify-content: stretch !important;
    padding-left: 28px !important;
    padding-right: 28px !important;
}

.chat-active[data-chat-type="support"] .chat-input-actions,
.chat-active.support-chat-active .chat-input-actions {
    display: flex !important;
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    padding: 0 !important;
    margin: 0 !important;
    gap: 0 !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
}

.chat-active[data-chat-type="support"] #voice-record-btn,
.chat-active.support-chat-active #voice-record-btn {
    display: none !important;
    width: 0 !important;
    min-width: 0 !important;
    flex: 0 0 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

.chat-active[data-chat-type="support"] .chat-input-wrapper,
.chat-active.support-chat-active .chat-input-wrapper {
    flex: 1 1 auto !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    justify-self: stretch !important;
    box-sizing: border-box !important;
}

.chat-active[data-chat-type="support"] #message-input,
.chat-active.support-chat-active #message-input {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    box-sizing: border-box !important;
}

.chat-active[data-chat-type="support"] #send-message-btn,
.chat-active.support-chat-active #send-message-btn,
.chat-active[data-chat-type="support"] #attach-file-btn,
.chat-active.support-chat-active #attach-file-btn {
    flex: 0 0 auto !important;
    flex-shrink: 0 !important;
}

@media (max-width: 1024px) {
    .chat-active[data-chat-type="support"] .chat-input-area,
    .chat-active.support-chat-active .chat-input-area {
        padding-left: 10px !important;
        padding-right: 10px !important;
        gap: 8px !important;
    }
}

@media (max-width: 480px) {
    .chat-active[data-chat-type="support"] .chat-input-area,
    .chat-active.support-chat-active .chat-input-area {
        padding-left: 8px !important;
        padding-right: 8px !important;
        gap: 7px !important;
    }
}


/* === Stage 18E: final support composer force width === */
/* ID-level selectors beat older global floating-composer rules with !important. */
body[data-page="chats"] #chat-active[data-chat-type="support"] .chat-input-area,
body[data-page="chats"] #chat-active.support-chat-active .chat-input-area,
#chat-active[data-chat-type="support"] .chat-input-area,
#chat-active.support-chat-active .chat-input-area {
    display: flex !important;
    grid-template-columns: none !important;
    align-items: flex-end !important;
    justify-content: stretch !important;
    gap: 12px !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    box-sizing: border-box !important;
    padding-left: 28px !important;
    padding-right: 28px !important;
}

body[data-page="chats"] #chat-active[data-chat-type="support"] .chat-input-actions,
body[data-page="chats"] #chat-active.support-chat-active .chat-input-actions,
#chat-active[data-chat-type="support"] .chat-input-actions,
#chat-active.support-chat-active .chat-input-actions {
    display: flex !important;
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    padding: 0 !important;
    margin: 0 !important;
    gap: 0 !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
}

body[data-page="chats"] #chat-active[data-chat-type="support"] #voice-record-btn,
body[data-page="chats"] #chat-active.support-chat-active #voice-record-btn,
#chat-active[data-chat-type="support"] #voice-record-btn,
#chat-active.support-chat-active #voice-record-btn {
    display: none !important;
    width: 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
    flex: 0 0 0 !important;
    flex-basis: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

body[data-page="chats"] #chat-active[data-chat-type="support"] .chat-input-wrapper,
body[data-page="chats"] #chat-active.support-chat-active .chat-input-wrapper,
#chat-active[data-chat-type="support"] .chat-input-wrapper,
#chat-active.support-chat-active .chat-input-wrapper {
    display: flex !important;
    flex: 1 1 0 !important;
    flex-basis: calc(100% - 170px) !important;
    width: calc(100% - 170px) !important;
    min-width: 0 !important;
    max-width: none !important;
    justify-self: stretch !important;
    box-sizing: border-box !important;
}

body[data-page="chats"] #chat-active[data-chat-type="support"] #message-input,
body[data-page="chats"] #chat-active.support-chat-active #message-input,
#chat-active[data-chat-type="support"] #message-input,
#chat-active.support-chat-active #message-input {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    box-sizing: border-box !important;
}

body[data-page="chats"] #chat-active[data-chat-type="support"] #attach-file-btn,
body[data-page="chats"] #chat-active.support-chat-active #attach-file-btn,
body[data-page="chats"] #chat-active[data-chat-type="support"] #send-message-btn,
body[data-page="chats"] #chat-active.support-chat-active #send-message-btn,
#chat-active[data-chat-type="support"] #attach-file-btn,
#chat-active.support-chat-active #attach-file-btn,
#chat-active[data-chat-type="support"] #send-message-btn,
#chat-active.support-chat-active #send-message-btn {
    flex: 0 0 auto !important;
    flex-shrink: 0 !important;
}

@media (max-width: 1024px) {
    body[data-page="chats"] #chat-active[data-chat-type="support"] .chat-input-area,
    body[data-page="chats"] #chat-active.support-chat-active .chat-input-area,
    #chat-active[data-chat-type="support"] .chat-input-area,
    #chat-active.support-chat-active .chat-input-area {
        padding-left: 10px !important;
        padding-right: 10px !important;
        gap: 8px !important;
    }
}

@media (max-width: 480px) {
    body[data-page="chats"] #chat-active[data-chat-type="support"] .chat-input-area,
    body[data-page="chats"] #chat-active.support-chat-active .chat-input-area,
    #chat-active[data-chat-type="support"] .chat-input-area,
    #chat-active.support-chat-active .chat-input-area {
        padding-left: 8px !important;
        padding-right: 8px !important;
        gap: 7px !important;
    }

    body[data-page="chats"] #chat-active[data-chat-type="support"] .chat-input-wrapper,
    body[data-page="chats"] #chat-active.support-chat-active .chat-input-wrapper,
    #chat-active[data-chat-type="support"] .chat-input-wrapper,
    #chat-active.support-chat-active .chat-input-wrapper {
        flex-basis: calc(100% - 110px) !important;
        width: calc(100% - 110px) !important;
    }
}


/* === Stage 18F: Saved Notes final polish === */
/* Избранное/заметки: сверху только поиск, без сделок и звонков. */
#chat-active[data-chat-type="saved"] .chat-header-actions .call-btn,
#chat-active.saved-notes-chat-active .chat-header-actions .call-btn,
#chat-active[data-chat-type="saved"] .chat-header-actions #call-voice-btn,
#chat-active[data-chat-type="saved"] .chat-header-actions #call-video-btn,
#chat-active.saved-notes-chat-active .chat-header-actions #call-voice-btn,
#chat-active.saved-notes-chat-active .chat-header-actions #call-video-btn,
#chat-active[data-chat-type="saved"] .chat-header-actions .chat-create-deal-btn,
#chat-active.saved-notes-chat-active .chat-header-actions .chat-create-deal-btn,
#chat-active[data-chat-type="saved"] .chat-header-actions #chat-create-deal-btn,
#chat-active[data-chat-type="saved"] .chat-header-actions #chat-mobile-create-deal-btn,
#chat-active.saved-notes-chat-active .chat-header-actions #chat-create-deal-btn,
#chat-active.saved-notes-chat-active .chat-header-actions #chat-mobile-create-deal-btn,
#chat-active[data-chat-type="saved"] .chat-header-actions #group-members-btn,
#chat-active.saved-notes-chat-active .chat-header-actions #group-members-btn {
    display: none !important;
}

/* Поиск в Избранном оставляем видимым и аккуратным. */
#chat-active[data-chat-type="saved"] .chat-header-actions #chat-search-msg-btn,
#chat-active.saved-notes-chat-active .chat-header-actions #chat-search-msg-btn {
    display: inline-flex !important;
}

/* Фирменная фиолетовая звезда вместо оранжевой. */
#chat-active[data-chat-type="saved"] #chat-peer-avatar,
#chat-active.saved-notes-chat-active #chat-peer-avatar,
#chat-active[data-chat-type="saved"] .saved-notes-avatar,
#chat-active.saved-notes-chat-active .saved-notes-avatar,
.chat-item.saved-chat .avatar,
.chat-item .saved-notes-avatar {
    background: linear-gradient(135deg, #8b5cf6 0%, #6d5dfc 55%, #a879ff 100%) !important;
    color: #fff !important;
    border-color: rgba(255,255,255,.18) !important;
    box-shadow: 0 14px 34px rgba(109, 93, 252, .28) !important;
}

/* Сообщения в Избранном — тот же фирменный фиолетовый, как кнопка отправки. */
#chat-active[data-chat-type="saved"] .message.sent:not(:has(.story-share-card[data-story-kind="share"])),
#chat-active[data-chat-type="saved"] .message.received:not(:has(.story-share-card[data-story-kind="share"])),
#chat-active.saved-notes-chat-active .message.sent:not(:has(.story-share-card[data-story-kind="share"])),
#chat-active.saved-notes-chat-active .message.received:not(:has(.story-share-card[data-story-kind="share"])) {
    background: linear-gradient(135deg, #8b5cf6 0%, #6d5dfc 58%, #a879ff 100%) !important;
    color: #fff !important;
    border: 1px solid rgba(255,255,255,.16) !important;
    box-shadow: 0 12px 28px rgba(109, 93, 252, .22) !important;
}

/* Вложенные старые .message-content не должны рисовать белый блок внутри фиолетовой заметки. */
#chat-active[data-chat-type="saved"] .message .message-content,
#chat-active.saved-notes-chat-active .message .message-content {
    background: transparent !important;
    color: inherit !important;
    border: 0 !important;
    box-shadow: none !important;
}

/* Время в заметках читаемое на фиолетовом фоне. */
#chat-active[data-chat-type="saved"] .message-time,
#chat-active.saved-notes-chat-active .message-time {
    color: rgba(255,255,255,.78) !important;
}

body.theme-light #chat-active[data-chat-type="saved"] #chat-peer-avatar,
body.theme-light #chat-active.saved-notes-chat-active #chat-peer-avatar,
body.theme-light #chat-active[data-chat-type="saved"] .saved-notes-avatar,
body.theme-light #chat-active.saved-notes-chat-active .saved-notes-avatar,
body.theme-light .chat-item.saved-chat .avatar,
body.theme-light .chat-item .saved-notes-avatar {
    background: linear-gradient(135deg, #8b5cf6 0%, #6d5dfc 55%, #a879ff 100%) !important;
    color: #fff !important;
    box-shadow: 0 14px 34px rgba(109, 93, 252, .20) !important;
}


/* === Stage 18G: Saved Notes color in dialogs list === */
/* В левом списке "Избранное" тоже должно быть фирменным фиолетовым, а не оранжевым. */
.chat-item:has(.chat-item-title),
.chat-item:has(.chat-item-name) {
    --saved-notes-purple: #7c5cff;
}

/* Надёжно ловим карточку Избранного по тексту и перекрашиваем её аватар/звезду. */
.chat-item:has(.chat-item-title:is(:not(:empty))),
.chat-item:has(.chat-item-name:is(:not(:empty))) {
    isolation: auto;
}

.chat-item:has(.chat-item-title) .avatar.saved-notes-avatar,
.chat-item:has(.chat-item-name) .avatar.saved-notes-avatar,
.chat-item.saved-chat .avatar,
.chat-item[data-peer-id="saved"] .avatar,
.chat-item[data-dialog-type="saved"] .avatar,
.chat-item[data-is-saved="1"] .avatar {
    background: linear-gradient(135deg, #8b5cf6 0%, #6d5dfc 56%, #a879ff 100%) !important;
    color: #fff !important;
    border-color: rgba(255,255,255,.18) !important;
    box-shadow: 0 12px 28px rgba(109, 93, 252, .24) !important;
}

/* Fallback: текущий "Избранное" часто рендерится первым элементом списка с оранжевой звездой.
   Красим только если внутри карточки есть заголовок "Избранное". */
.chat-item:has(.chat-item-title) .avatar:has(+ *),
.chat-item:has(.chat-item-name) .avatar:has(+ *) {
    transition: background .15s ease, box-shadow .15s ease;
}

.chat-item:has(.chat-item-title) .avatar,
.chat-item:has(.chat-item-name) .avatar {
    color: inherit;
}

/* Браузерный :has с текстом не умеет, поэтому добавляем более широкий safe fallback:
   аватар со звездой в первом saved/self диалоге будет фиолетовым. */
#chats-list .chat-item:first-child .avatar,
.chats-list .chat-item:first-child .avatar {
    background: linear-gradient(135deg, #8b5cf6 0%, #6d5dfc 56%, #a879ff 100%) !important;
    color: #fff !important;
    border-color: rgba(255,255,255,.18) !important;
    box-shadow: 0 12px 28px rgba(109, 93, 252, .24) !important;
}

/* Если у аватарки есть inline/background от старого orange saved style — перебиваем конкретно star-like avatar. */
#chats-list .chat-item .avatar,
.chats-list .chat-item .avatar {
    background-clip: padding-box;
}

body.theme-light #chats-list .chat-item:first-child .avatar,
body.theme-light .chats-list .chat-item:first-child .avatar,
body.theme-light .chat-item.saved-chat .avatar,
body.theme-light .chat-item[data-is-saved="1"] .avatar {
    background: linear-gradient(135deg, #8b5cf6 0%, #6d5dfc 56%, #a879ff 100%) !important;
    color: #fff !important;
    box-shadow: 0 12px 28px rgba(109, 93, 252, .18) !important;
}

/* === Stage 19A: profile settings polish === */
.profile-settings-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(280px, .75fr);
    gap: 18px;
}

.profile-settings-card h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.profile-settings-form {
    display: grid;
    gap: 10px;
}

.profile-settings-form textarea.input {
    resize: vertical;
    min-height: 112px;
    line-height: 1.45;
}

.profile-settings-actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.profile-quick-settings {
    display: grid;
    gap: 10px;
}

.profile-quick-card {
    width: 100%;
    display: grid;
    gap: 4px;
    text-align: left;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 18px;
    padding: 14px 15px;
    background: rgba(255,255,255,.045);
    color: var(--text);
    cursor: pointer;
    transition: transform .16s ease, border-color .16s ease, background .16s ease;
}

.profile-quick-card:hover {
    transform: translateY(-1px);
    border-color: rgba(139,92,246,.30);
    background: rgba(139,92,246,.10);
}

.profile-quick-card b {
    font-size: .98rem;
}

.profile-quick-card span {
    color: var(--text-muted);
    font-size: .86rem;
    line-height: 1.35;
}

body.theme-light .profile-quick-card {
    background: rgba(15,23,42,.035);
    border-color: rgba(15,23,42,.08);
}

body.theme-light .profile-quick-card:hover {
    background: rgba(109,93,252,.075);
    border-color: rgba(109,93,252,.18);
}

@media (max-width: 900px) {
    .profile-settings-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 520px) {
    .profile-settings-actions .btn {
        width: 100%;
    }
}


/* === Stage 19B: profile settings without verification === */
.profile-settings-form .form-hint {
    margin: -6px 0 12px;
    color: var(--text-muted);
    font-size: .82rem;
    line-height: 1.35;
}

#tab-verification {
    display: none !important;
}


/* === Stage 19C: Telegram-style profile center, privacy, theme, listings === */

/* Скрываем кнопку смены темы в общей шапке: теперь тема в профиле. */
#theme-toggle,
.theme-toggle {
    display: none !important;
}

/* Профиль не должен выглядеть тёмными плитами на светлой теме. */

body.theme-light .profile-page .glass,
body.theme-light .profile-page .info-card,
body.theme-light .profile-page .profile-settings-card,
body.theme-light .profile-page .rating-summary,
body.theme-light .profile-page .review-card,
body.theme-light .profile-page .profile-private-card,
body.theme-light .profile-page .profile-listings-empty,
body.theme-light .profile-page .profile-listing-card {
    background: rgba(255,255,255,.82) !important;
    border: 1px solid rgba(15,23,42,.08) !important;
    color: #0f172a !important;
    box-shadow: 0 18px 45px rgba(15,23,42,.08) !important;
    backdrop-filter: blur(18px) saturate(1.08) !important;
    -webkit-backdrop-filter: blur(18px) saturate(1.08) !important;
}

body.theme-light .profile-page .profile-settings-card p,
body.theme-light .profile-page .form-hint,
body.theme-light .profile-page small,
body.theme-light .profile-page .stat-label-new,
body.theme-light .profile-page .empty-state-modern p {
    color: #64748b !important;
}

body.theme-light .profile-page .input,
body.theme-light .profile-page textarea,
body.theme-light .profile-page select {
    background: rgba(248,250,252,.88) !important;
    color: #0f172a !important;
    border-color: rgba(15,23,42,.12) !important;
}

/* Общая новая сетка настроек профиля. */
.profile-settings-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr);
    gap: 22px;
    align-items: start;
}

.profile-settings-main,
.profile-settings-card {
    border-radius: 28px !important;
    padding: 26px !important;
}

.profile-settings-head h3,
.profile-settings-card h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 8px;
    font-size: 1.2rem;
}

.profile-settings-head p {
    margin: 0 0 18px;
    color: var(--text-muted);
}

.profile-settings-form {
    display: grid;
    gap: 12px;
}

.profile-settings-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.profile-settings-side {
    display: grid;
    gap: 16px;
}

.profile-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid rgba(148,163,184,.16);
}

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

.profile-toggle-row span {
    display: grid;
    gap: 4px;
}

.profile-toggle-row small {
    color: var(--text-muted);
    line-height: 1.3;
}

.profile-toggle-row input[type="checkbox"],
.alert-preferences input[type="checkbox"] {
    appearance: none;
    width: 48px;
    height: 28px;
    border-radius: 999px;
    background: rgba(148,163,184,.28);
    border: 1px solid rgba(148,163,184,.25);
    position: relative;
    cursor: pointer;
    flex: 0 0 auto;
    transition: background .18s ease, border-color .18s ease;
}

.profile-toggle-row input[type="checkbox"]::after,
.alert-preferences input[type="checkbox"]::after {
    content: "";
    position: absolute;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    background: #fff;
    box-shadow: 0 5px 14px rgba(0,0,0,.18);
    transition: transform .18s ease;
}

.profile-toggle-row input[type="checkbox"]:checked,
.alert-preferences input[type="checkbox"]:checked {
    background: linear-gradient(135deg, #8b5cf6, #6d5dfc);
    border-color: rgba(139,92,246,.65);
}

.profile-toggle-row input[type="checkbox"]:checked::after,
.alert-preferences input[type="checkbox"]:checked::after {
    transform: translateX(20px);
}

.profile-theme-choice {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.profile-theme-choice button {
    border: 1px solid rgba(148,163,184,.18);
    background: rgba(148,163,184,.12);
    color: var(--text);
    border-radius: 16px;
    padding: 12px 10px;
    font-weight: 800;
    cursor: pointer;
}

.profile-theme-choice button.active {
    color: #fff;
    background: linear-gradient(135deg, #8b5cf6, #6d5dfc);
    border-color: rgba(255,255,255,.18);
    box-shadow: 0 14px 28px rgba(109,93,252,.24);
}

.profile-settings-sticky-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: -4px;
}

/* Вкладка объявлений. */
.profile-listings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.profile-listing-card {
    border-radius: 24px !important;
    overflow: hidden;
    padding: 0 !important;
}

.profile-listing-cover {
    height: 150px;
    background: linear-gradient(135deg, rgba(139,92,246,.16), rgba(32,198,255,.12));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 2rem;
}

.profile-listing-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-listing-body {
    padding: 16px;
}

.profile-listing-body h4 {
    margin: 0 0 8px;
}

.profile-listing-price {
    font-size: 1.05rem;
    font-weight: 900;
    color: var(--primary);
}

.profile-listing-meta {
    margin-top: 6px;
    color: var(--text-muted);
    font-size: .9rem;
}

.profile-listings-empty,
.profile-private-card {
    border-radius: 28px !important;
    padding: 44px 24px !important;
    text-align: center;
}

.profile-listings-empty-icon,
.profile-private-icon {
    width: 68px;
    height: 68px;
    margin: 0 auto 16px;
    border-radius: 24px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, rgba(139,92,246,.22), rgba(109,93,252,.12));
    color: var(--primary);
    font-size: 2rem;
}

.profile-private-note {
    margin-top: 10px;
    color: var(--text-muted);
    font-size: .9rem;
}

/* Публичные действия профиля как Telegram actions. */

/* Мобильная адаптация профиля. */
@media (max-width: 1024px) {
    .profile-settings-shell {
        grid-template-columns: 1fr;
    }

    .profile-settings-row {
        grid-template-columns: 1fr;
    }

    .profile-settings-sticky-actions {
        justify-content: stretch;
    }

    .profile-settings-sticky-actions .btn {
        flex: 1;
    }
}

@media (max-width: 560px) {
    .profile-settings-main,
    .profile-settings-card {
        border-radius: 22px !important;
        padding: 18px !important;
    }

    .profile-theme-choice {
        grid-template-columns: 1fr;
    }
}


/* === Stage 19D: private profile lock polish === */
.profile-private-card {
    max-width: 560px;
    margin: 0 auto;
}

.profile-private-card h3 {
    margin: 0 0 10px;
    font-size: 1.42rem;
    font-weight: 900;
}

.profile-private-card p {
    margin: 0 auto;
    max-width: 420px;
    color: var(--text-muted);
    line-height: 1.55;
}

.profile-private-lock {
    width: 96px !important;
    height: 96px !important;
    margin-bottom: 20px !important;
    border-radius: 30px !important;
    background: linear-gradient(135deg, rgba(139,92,246,.26), rgba(109,93,252,.14)) !important;
    box-shadow: 0 18px 34px rgba(109,93,252,.18);
}

.profile-private-lock svg {
    width: 56px;
    height: 56px;
}

body.theme-light .profile-page .profile-private-lock {
    background: linear-gradient(135deg, rgba(139,92,246,.18), rgba(109,93,252,.10)) !important;
    box-shadow: 0 18px 34px rgba(109,93,252,.12);
}


/* === Stage 19F: profile final polish / followers / accordion === */

.stat-action-new {
    appearance: none;
    border: 0;
    text-align: left;
    cursor: pointer;
    color: inherit;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}

.stat-action-new:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(109,93,252,.18);
}

.profile-settings-accordion-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
}

/* Shared notification controls, scoped to their own component on both pages. */
/* Device push controls: shared profile / notification-center component only. */
.web-push-panel { min-width: 0; grid-column: 1 / -1; padding: 18px 0; border-top: 1px solid var(--border); color: var(--text); }
.web-push-panel h4 { margin: 0 0 10px; font-size: 16px; }
.web-push-panel .web-push-hint { margin: 8px 0; font-size: 13px; line-height: 1.5; color: var(--text-secondary); overflow-wrap: anywhere; }
.web-push-panel .web-push-state { font-size: 14px; font-weight: 650; margin: 12px 0 6px; }
.web-push-panel .web-push-label { display: grid; gap: 8px; margin: 14px 0; font-size: 13px; }
.web-push-panel input { box-sizing: border-box; min-height: 44px; width: 100%; min-width: 0; padding: 9px 11px; border: 1px solid var(--border); border-radius: 9px; background: var(--bg); color: var(--text); font: inherit; font-size: 16px; }
.web-push-panel .web-push-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.web-push-panel button { min-height: 44px; padding: 9px 13px; border: 1px solid var(--border); border-radius: 9px; background: var(--bg-secondary); color: var(--text); font: inherit; font-size: 13px; cursor: pointer; white-space: normal; }
.web-push-panel button:hover { border-color: var(--primary); }
.web-push-panel :disabled { opacity: .55; cursor: default; }
.web-push-panel :focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.web-push-panel .web-push-error { min-height: 0; color: var(--danger, #e36574); font-size: 13px; line-height: 1.5; }
.web-push-panel .web-push-device { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.web-push-panel .web-push-device > span { min-width: 0; overflow-wrap: anywhere; font-size: 14px; }
.web-push-panel .web-push-device small { display: block; margin-top: 4px; color: var(--text-secondary); }
.web-push-panel .web-push-device button { flex-shrink: 0; }

.alert-preferences { min-width: 0; grid-column: 1 / -1; display: grid; gap: 18px; color: var(--text); }
.alert-preferences fieldset { min-inline-size: 0; margin: 0; padding: 14px 0 0; border: 0; border-top: 1px solid var(--border); }
.alert-preferences legend { max-width: 100%; padding: 0 12px 0 0; font-size: 15px; font-weight: 650; }
.alert-preferences .alert-preferences .alert-preference-mode { display: grid; gap: 8px; margin-block: 10px; min-width: 0; }
.alert-preferences .alert-preference-mode select { width: 100%; min-width: 0; min-height: 44px; color: var(--text); }
.alert-preference-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 48px; font-size: 14px; cursor: pointer; }
.alert-preferences .alert-preference-row > span { min-width: 0; overflow-wrap: anywhere; }
.alert-preferences input[type="checkbox"] { margin: 0; min-width: 48px; min-height: 28px; -webkit-appearance: none; }
.alert-preferences:dir(rtl) input[type="checkbox"]::after { left: auto; right: 2px; }
.alert-preferences:dir(rtl) input[type="checkbox"]:checked::after { transform: translateX(-20px); }
@media (prefers-reduced-motion: reduce) {
    .alert-preferences input[type="checkbox"], .alert-preferences input[type="checkbox"]::after { transition: none; }
}
@media (forced-colors: active) {
    .alert-preferences input[type="checkbox"] { border-color: ButtonText; background: Canvas; forced-color-adjust: none; }
    .alert-preferences input[type="checkbox"]::after { background: ButtonText; }
    .alert-preferences input[type="checkbox"]:checked { background: Highlight; }
    .alert-preferences input[type="checkbox"]:checked::after { background: HighlightText; }
}
.alert-preferences input[type="text"], .alert-preferences input[type="time"] { box-sizing: border-box; width: 100%; min-width: 0; min-height: 44px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 9px; background: var(--bg); color: var(--text); font: inherit; font-size: 16px; }
.alert-preferences .alert-preference-hint { margin: 7px 0 10px; color: var(--text-secondary); font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.alert-preferences .alert-preference-pauses { display: flex; flex-wrap: wrap; gap: 7px; }
.alert-preferences button { min-height: 44px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--bg-secondary); color: var(--text); font: inherit; font-size: 13px; cursor: pointer; white-space: normal; }
.alert-preferences button:hover { border-color: var(--primary); }
.alert-preferences button:disabled, .alert-preferences input:disabled { opacity: .6; cursor: default; }
.alert-preferences :focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.alert-preferences .alert-preference-times { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 10px 0; }
.alert-preferences .alert-preference-times label, .alert-preferences .alert-preference-zone { display: grid; gap: 7px; font-size: 13px; }
.alert-preferences .alert-preference-zone-button { margin-top: 8px; }
.alert-preferences .alert-preference-example { display: grid; gap: 5px; padding: 13px; border: 1px solid var(--border); border-radius: 11px; background: var(--bg-secondary); overflow-wrap: anywhere; }
.alert-preferences .alert-preference-example small { color: var(--text-secondary); font-size: 12px; }
.alert-preferences .alert-preference-example span { font-size: 14px; }
.profile-page.profile-redesign .device-preferences { display: grid; gap: 8px; min-width: 0; }
.profile-page.profile-redesign .device-text-example { padding: 16px; margin: 6px 0 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-secondary); color: var(--text); line-height: 1.5; overflow-wrap: anywhere; }
@media (max-width: 480px) {
    .alert-preferences .alert-preference-pauses button { flex: 1 1 100px; }
    .alert-preferences .alert-preference-zone-button { width: 100%; }
}

/* Profile settings additions; no global control or navigation overrides. */
.profile-page.profile-redesign .profile-settings-search { display: grid; gap: 8px; padding: 16px; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 14px; }
.profile-page.profile-redesign .profile-settings-search .input { min-height: 44px; min-width: 0; background: var(--bg); color: var(--text); }
.profile-page.profile-redesign .profile-settings-search .input::placeholder { color: var(--text-secondary); opacity: 1; }
.profile-page.profile-redesign .profile-settings-section[hidden],
.profile-page.profile-redesign [data-profile-city-row][hidden],
.profile-page.profile-redesign [data-profile-website-row][hidden],
.profile-page.profile-redesign .profile-bio-brief[hidden] { display: none; }
.profile-page.profile-redesign .profile-privacy-presets { display: flex; gap: 8px; flex-wrap: wrap; }
.profile-page.profile-redesign .profile-privacy-presets .btn { min-height: 44px; white-space: normal; }
.profile-page.profile-redesign .profile-settings-sticky-actions { flex-wrap: wrap; align-items: center; }
.profile-page.profile-redesign .profile-settings-status { margin-inline-end: auto; color: var(--text-secondary); font-size: 13px; overflow-wrap: anywhere; }
.profile-page.profile-redesign .profile-settings-status[data-dirty="true"] { color: var(--primary); }
.profile-page.profile-redesign .profile-settings-section .input { max-width: 100%; min-width: 0; }
@media (max-width: 600px) {
    .profile-page.profile-redesign .profile-settings-status { flex-basis: 100%; }
    .profile-page.profile-redesign .profile-privacy-presets .btn { flex: 1 1 120px; padding: 10px; }
}

.profile-settings-accordion {
    display: grid;
    gap: 12px;
}

.profile-settings-section {
    border-radius: 24px !important;
    overflow: hidden;
    padding: 0 !important;
}

.profile-settings-section summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    user-select: none;
}

.profile-settings-section summary::-webkit-details-marker {
    display: none;
}

.profile-settings-summary-icon {
    width: 42px;
    height: 42px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, rgba(139,92,246,.24), rgba(109,93,252,.12));
    color: var(--primary);
    flex: 0 0 auto;
    font-weight: 900;
}

.profile-settings-section summary span:nth-child(2) {
    display: grid;
    gap: 3px;
    min-width: 0;
    flex: 1;
}

.profile-settings-section summary b {
    font-size: 1.05rem;
}

.profile-settings-section summary small {
    color: var(--text-muted);
    font-size: .86rem;
}

.profile-settings-section summary i {
    width: 10px;
    height: 10px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    opacity: .55;
    transition: transform .18s ease;
}

.profile-settings-section[open] summary i {
    transform: rotate(225deg);
}

.profile-settings-section-body {
    padding: 0 20px 20px;
    display: grid;
    gap: 12px;
}

.profile-followers-overlay {
    position: fixed;
    inset: 0;
    z-index: 10050;
    width: 100vw;
    height: 100dvh;
    display: block;
    overflow: hidden;
    background: rgba(2, 6, 23, .62);
    backdrop-filter: blur(14px) saturate(1.06);
    -webkit-backdrop-filter: blur(14px) saturate(1.06);
}

.profile-followers-overlay.hidden {
    display: none !important;
}

.profile-followers-panel {
    width: 100vw;
    min-width: 0;
    height: 100dvh;
    min-height: 100dvh;
    max-width: none;
    max-height: 100dvh;
    border: 0 !important;
    border-radius: 0 !important;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(circle at 12% 0%, rgba(109, 93, 252, .18), transparent 34%),
        color-mix(in srgb, var(--bg-modal) 97%, transparent) !important;
    box-shadow: 0 32px 100px rgba(0, 0, 0, .42);
}

.profile-followers-head {
    width: min(100%, 1120px);
    margin-inline: auto;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: calc(24px + env(safe-area-inset-top, 0px)) clamp(18px, 4vw, 52px) 20px;
    border-bottom: 1px solid rgba(148,163,184,.14);
}

.profile-followers-head h3 {
    margin: 0;
    font-size: clamp(1.35rem, 2.6vw, 2rem);
    line-height: 1.08;
}

.profile-followers-head p {
    margin: 7px 0 0;
    color: var(--text-muted);
    font-size: .94rem;
}

.profile-modal-close {
    width: 48px;
    height: 48px;
    min-width: 48px;
    padding: 0;
    border: 1px solid rgba(148,163,184,.20);
    border-radius: 17px;
    display: grid;
    place-items: center;
    background: linear-gradient(145deg, rgba(255,255,255,.14), rgba(148,163,184,.08));
    color: var(--text);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 12px 28px rgba(0,0,0,.20);
    backdrop-filter: blur(14px) saturate(1.12);
    -webkit-backdrop-filter: blur(14px) saturate(1.12);
    cursor: pointer;
    transition: transform .16s ease, background .16s ease, border-color .16s ease;
    -webkit-tap-highlight-color: transparent;
}

.profile-modal-close svg {
    width: 21px;
    height: 21px;
    display: block;
}

.profile-modal-close:hover,
.profile-modal-close:focus-visible {
    border-color: color-mix(in srgb, var(--primary) 48%, transparent);
    background: linear-gradient(145deg, rgba(139,92,246,.30), rgba(109,93,252,.16));
    outline: 3px solid color-mix(in srgb, var(--primary) 30%, transparent);
    outline-offset: 2px;
}

.profile-modal-close:active {
    transform: scale(.96);
}

.profile-followers-tabs {
    width: min(100%, 1120px);
    margin: 0 auto;
    padding: 18px clamp(18px, 4vw, 52px) 8px;
    box-sizing: border-box;
    display: grid;
    /* Owner panel now has three tabs (подписчики / мои подписки / запросы).
       The container is rendered only for the owner, so the columns follow the
       real tab count and no empty third column can appear. */
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: 10px;
}

.profile-followers-tab {
    min-width: 0;
    min-height: 50px;
    padding: 11px 18px;
    border: 1px solid rgba(148,163,184,.16);
    border-radius: 17px;
    background: rgba(148,163,184,.08);
    color: var(--text-muted);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    transition: color .16s ease, background .16s ease, border-color .16s ease, transform .16s ease;
    -webkit-tap-highlight-color: transparent;
}

.profile-followers-tab.active {
    color: #fff;
    border-color: rgba(139,92,246,.42);
    background: linear-gradient(135deg, #8b5cf6, #6d5dfc);
    box-shadow: 0 12px 26px rgba(109,93,252,.22);
}

.profile-followers-tab:hover,
.profile-followers-tab:focus-visible {
    border-color: rgba(139,92,246,.42);
    outline: 3px solid color-mix(in srgb, var(--primary) 24%, transparent);
    outline-offset: 2px;
}

.profile-followers-tab:active {
    transform: scale(.985);
}

.profile-followers-list {
    width: min(100%, 1120px);
    min-height: 0;
    margin: 0 auto;
    padding: 14px clamp(18px, 4vw, 52px) calc(26px + env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
    flex: 1 1 auto;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

.profile-followers-more {
    width: 100%;
    min-height: 50px;
    margin-top: 12px;
    padding: 12px 18px;
    border: 1px solid rgba(139,92,246,.28);
    border-radius: 18px;
    background: rgba(139,92,246,.11);
    color: var(--primary);
    font: inherit;
    font-weight: 850;
    cursor: pointer;
    transition: background .16s ease, border-color .16s ease, transform .16s ease;
}

.profile-followers-more:hover,
.profile-followers-more:focus-visible {
    background: rgba(139,92,246,.18);
    border-color: rgba(139,92,246,.44);
    outline: 3px solid color-mix(in srgb, var(--primary) 22%, transparent);
    outline-offset: 2px;
}

.profile-followers-more:active {
    transform: scale(.992);
}

.profile-followers-more:disabled {
    cursor: wait;
    opacity: .68;
}

.profile-follower-row {
    width: 100%;
    border: 1px solid rgba(148,163,184,.12);
    background: rgba(148,163,184,.065);
    color: inherit;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border-radius: 20px;
    cursor: pointer;
    text-align: left;
    transition: transform .16s ease, background .16s ease, border-color .16s ease;
    -webkit-tap-highlight-color: transparent;
}

.profile-follower-row + .profile-follower-row {
    margin-top: 9px;
}

.profile-follower-row:hover,
.profile-follower-row:focus-visible {
    background: rgba(139,92,246,.12);
    border-color: rgba(139,92,246,.30);
    outline: 3px solid color-mix(in srgb, var(--primary) 22%, transparent);
    outline-offset: 2px;
}

.profile-follower-row:active {
    transform: scale(.992);
}

.profile-follower-avatar {
    width: 48px;
    height: 48px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #8b5cf6, #6d5dfc);
    color: #fff;
    font-weight: 900;
    overflow: hidden;
    flex: 0 0 auto;
}

.profile-follower-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-follower-info {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.profile-follower-info b,
.profile-follower-info small {
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-follower-info small {
    color: var(--text-muted);
}

.profile-followers-empty {
    min-height: min(360px, 48dvh);
    padding: 28px;
    box-sizing: border-box;
    display: grid;
    place-items: center;
    text-align: center;
    color: var(--text-muted);
}

body.theme-light .profile-settings-section {
    background: rgba(255,255,255,.88) !important;
    color: #0f172a !important;
    border: 1px solid rgba(15,23,42,.08) !important;
}

body.theme-light .profile-followers-panel {
    background:
        radial-gradient(circle at 12% 0%, rgba(109,93,252,.12), transparent 34%),
        rgba(248,250,252,.97) !important;
    color: #0f172a !important;
    border: 0 !important;
}

body.theme-light .profile-followers-overlay {
    background: rgba(15,23,42,.22);
}

body.theme-light .profile-followers-tab {
    background: rgba(255,255,255,.74);
    border-color: rgba(15,23,42,.10);
    color: #64748b;
}

body.theme-light .profile-followers-tab.active {
    color: #fff;
    border-color: rgba(109,93,252,.32);
    background: linear-gradient(135deg, #8b5cf6, #6d5dfc);
}

body.theme-light .profile-follower-row {
    background: rgba(255,255,255,.72);
    border-color: rgba(15,23,42,.08);
}

body.theme-light .profile-follower-row:hover,
body.theme-light .profile-follower-row:focus-visible {
    background: rgba(109,93,252,.09);
    border-color: rgba(109,93,252,.20);
}

body.theme-light .profile-modal-close {
    color: #0f172a;
    background: linear-gradient(145deg, rgba(255,255,255,.96), rgba(226,232,240,.80));
    border-color: rgba(15,23,42,.10);
    box-shadow: inset 0 1px 0 #fff, 0 12px 28px rgba(15,23,42,.12);
}

@media (max-width: 560px) {
    .profile-settings-section summary {
        padding: 14px;
    }

    .profile-settings-section-body {
        padding: 0 14px 16px;
    }

    .profile-settings-summary-icon {
        width: 38px;
        height: 38px;
        border-radius: 14px;
    }

    .profile-followers-head {
        padding: calc(14px + env(safe-area-inset-top, 0px)) 14px 14px;
    }

    .profile-modal-close {
        width: 46px;
        height: 46px;
        min-width: 46px;
        border-radius: 16px;
    }

    .profile-followers-tabs {
        padding: 14px 14px 6px;
        gap: 6px;
    }

    .profile-followers-tab {
        min-height: 48px;
        padding-inline: 6px;
        font-size: clamp(.72rem, 3.1vw, .86rem);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .profile-followers-list {
        padding: 12px 14px calc(18px + env(safe-area-inset-bottom, 0px));
    }
}


/* === Stage 19G: profile action/followers/listings bugfix === */




/* === Stage 19H: profile actions/follow/call hotfix === */


/* === Stage 19I: profile visual/privacy final fixes === */
/* Подписчики в статистике — без лишней подложки button и без обрезания. */

/* Рейтинг — фирменный фиолетовый, без оранжевого warning. */

/* SVG в настройках вместо emoji. */
.profile-settings-summary-icon svg {
    width: 20px !important;
    height: 20px !important;
    display: block !important;
}

.profile-settings-summary-icon {
    font-size: 0 !important;
}

/* Чат с пользователем, который запретил сообщения. */
.chat-active.peer-messages-locked .chat-input-wrapper {
    position: relative;
    background: rgba(139,92,246,.10) !important;
    border-color: rgba(139,92,246,.24) !important;
}

.chat-active.peer-messages-locked #message-input {
    cursor: not-allowed !important;
    color: var(--text-muted) !important;
    opacity: 1 !important;
}

.chat-active.peer-messages-locked #send-message-btn,
.chat-active.peer-messages-locked #attach-file-btn,
.chat-active.peer-messages-locked #voice-record-btn {
    opacity: .42 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
}

body.theme-light .chat-active.peer-messages-locked .chat-input-wrapper {
    background: rgba(109,93,252,.08) !important;
    border-color: rgba(109,93,252,.18) !important;
}

/* === Stage 19J: profile stats glow, followers click target, perfect tabs === */
/* Все три иконки статистики светятся в одном фирменном стиле. */

/* Вкладки профиля — ровная сетка, без наложений и кривых отступов. */


/* === Stage 19K: compact stats row + clean follow pill === */
/* Статистика: компактно, всегда 3 в ряд на ПК и телефоне. */

/* Кнопка подписки: без emoji, фирменный пузырёк. */

.profile-follow-spinner {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,.35);
    border-top-color: currentColor;
    animation: profile-follow-spin .8s linear infinite;
}

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


/* === Stage 19L: avatar modal/file limits === */

.avatar-upload-modal-v2 {
    display: grid;
    gap: 18px;
    justify-items: center;
    text-align: center;
    padding: 4px 0 0;
}

.avatar-upload-modal-v2 .avatar-preview-container {
    width: 170px;
    height: 170px;
    display: grid;
    place-items: center;
}

.avatar-preview-ring {
    width: 166px;
    height: 166px;
    border-radius: 50%;
    padding: 5px;
    background: linear-gradient(135deg, #8b5cf6, #6d5dfc, #a879ff);
    box-shadow: 0 22px 48px rgba(109,93,252,.24);
}

.avatar-preview-ring img,
.avatar-upload-modal-v2 #avatar-preview {
    width: 100% !important;
    height: 100% !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    background: var(--bg-secondary) !important;
    display: block;
}

.avatar-upload-info {
    display: grid;
    gap: 6px;
}

.avatar-upload-info b {
    font-size: 1.08rem;
}

.avatar-upload-info span {
    color: var(--text-muted);
    font-size: .9rem;
    line-height: 1.4;
}

.avatar-file-field {
    width: 100%;
    display: grid;
    justify-items: center;
    gap: 10px;
}

.avatar-file-field input[type="file"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 1px;
    height: 1px;
}

.avatar-file-label {
    border-radius: 999px !important;
    min-height: 44px;
    padding: 0 18px !important;
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
}

.avatar-upload-modal-v2 .avatar-actions {
    width: 100%;
    display: flex;
    justify-content: center;
}

.avatar-upload-modal-v2 #remove-avatar-btn {
    border-radius: 999px !important;
}

@media (max-width: 560px) {
    .avatar-upload-modal-v2 .avatar-preview-container {
        width: 146px;
        height: 146px;
    }

    .avatar-preview-ring {
        width: 142px;
        height: 142px;
    }
}


/* === Stage 19N: follow button contrast + avatar edit hitbox polish === */
/* Подписка: текст должен быть читаемым в тёмной и светлой теме. */

/* Кнопка редактирования аватарки: только компактный пузырёк, без большой подложки. */
.profile-avatar-edit,
.edit-avatar-btn,
#edit-avatar-btn,
.profile-avatar-wrapper .edit-avatar-btn,
.profile-avatar-container .edit-avatar-btn,
.profile-avatar-new .edit-avatar-btn,
.avatar-edit-btn {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    min-height: 44px !important;
    max-height: 44px !important;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 18px !important;
    display: inline-grid !important;
    place-items: center !important;
    overflow: hidden !important;
    background: rgba(32,24,56,.92) !important;
    border: 1px solid rgba(255,255,255,.16) !important;
    box-shadow: 0 12px 26px rgba(0,0,0,.26) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
}

/* Если кнопка лежит внутри лишнего wrapper — wrapper не должен рисовать область. */
.profile-avatar-edit-wrap,
.profile-avatar-edit-wrapper,
.avatar-edit-wrapper,
.profile-avatar-wrapper .avatar-actions,
.profile-avatar-container .avatar-actions {
    width: auto !important;
    height: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    overflow: visible !important;
}

.profile-avatar-edit svg,
.edit-avatar-btn svg,
#edit-avatar-btn svg,
.profile-avatar-wrapper .edit-avatar-btn svg,
.profile-avatar-container .edit-avatar-btn svg,
.profile-avatar-new .edit-avatar-btn svg,
.avatar-edit-btn svg {
    width: 20px !important;
    height: 20px !important;
    display: block !important;
}

/* Старые псевдо-подложки около кнопки редактирования аватарки отключаем. */
.profile-avatar-edit::before,
.profile-avatar-edit::after,
.edit-avatar-btn::before,
.edit-avatar-btn::after,
#edit-avatar-btn::before,
#edit-avatar-btn::after,
.avatar-edit-btn::before,
.avatar-edit-btn::after {
    content: none !important;
    display: none !important;
}

body.theme-light .profile-avatar-edit,
body.theme-light .edit-avatar-btn,
body.theme-light #edit-avatar-btn,
body.theme-light .profile-avatar-wrapper .edit-avatar-btn,
body.theme-light .profile-avatar-container .edit-avatar-btn,
body.theme-light .profile-avatar-new .edit-avatar-btn,
body.theme-light .avatar-edit-btn {
    background: rgba(32,24,56,.92) !important;
    color: #ffffff !important;
    border-color: rgba(255,255,255,.18) !important;
    box-shadow: 0 12px 26px rgba(15,23,42,.20) !important;
}


/* === Stage 19P: avatar edit real hitbox + foreign avatar viewer === */
.profile-avatar-wrapper {
    position: relative !important;
    display: inline-block !important;
    width: fit-content !important;
    height: fit-content !important;
    overflow: visible !important;
}

.profile-avatar-clickable {
    cursor: pointer !important;
    user-select: none !important;
}

/* На случай если старые button rules раздувают hitbox через inherited min-width/min-height. */


/* === Stage 19Q: profile avatar/cover display refresh + layout fix === */
/* Avatar must sit under the cover edge, not inside the cover/header area. */

/* Real small edit bubble; no enlarged hitbox. */


/* === Stage 19R: profile upload display stabilization === */

.avatar-upload-modal-v2 img[src^="blob:"] {
    opacity: 1 !important;
    transform: none !important;
}


/* ===== Stage 19AM: profile/chat online presence ===== */
.chat-online-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #31d158;
    box-shadow: 0 0 0 3px rgba(49, 209, 88, 0.16);
    flex: 0 0 auto;
}
.chat-item-name {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.chat-peer-status.online {
    color: #31d158;
}

/* Light theme: #31d158 on white was 1.95:1 (contrast audit 2026-10-13);
   #047857 is the light-theme green text colour already in use. */
body.theme-light .chat-peer-status.online,
body.theme-light .chat-info-content .user-info-name .chat-peer-status.online,
body.theme-light .profile-follower-status.online {
    color: #047857;
}


/* ===== Stage 19AN: inline profile presence + live status polish ===== */


/* ===== Stage 19AR: followers online presence ===== */
.profile-follower-avatar {
    position: relative;
}
.profile-follower-online-dot {
    position: absolute;
    right: 1px;
    bottom: 1px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #31d158;
    border: 2px solid rgba(12, 15, 24, 0.96);
    box-shadow: 0 0 0 2px rgba(49, 209, 88, 0.16);
}
.profile-follower-status.online {
    color: #31d158;
}
.profile-follower-info small {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}


/* ===== Stage 19AS: profile action buttons under name ===== */
.profile-actions-call-row {
    margin: -3px auto 12px;
    display: flex;
    justify-content: center;
}
.profile-actions-call-row .btn {
    min-height: 38px;
    border-radius: 999px;
    padding-inline: 15px;
}
@media (max-width: 640px) {
    .profile-actions-call-row .btn {
        width: min(100%, 220px);
        justify-content: center;
    }
}


/* ===== Stage 19AT: desktop right-of-name actions + mobile row layout ===== */
.profile-actions-call-row {
    margin-top: 4px;
}
@media (max-width: 640px) {
    .profile-actions-call-row {
        margin: 3px auto 12px;
    }
    .profile-actions-call-row .btn {
        width: min(100%, 220px);
        justify-content: center;
    }
}


/* ===== Stage 19AU: clean profile contacts layout, no deal button ===== */
.profile-follow-side {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding-top: 8px;
}
.profile-follow-side .profile-follow-btn {
    min-width: 168px;
    min-height: 46px;
    border-radius: 999px;
    white-space: nowrap;
}
.profile-actions-call-row {
    display: none !important;
}
@media (max-width: 640px) {
    .profile-follow-side {
        padding-top: 6px;
        justify-content: flex-end;
    }
    .profile-follow-side .profile-follow-btn {
        min-width: 112px;
        max-width: 132px;
        min-height: 38px;
        padding-inline: 10px;
        font-size: 0.8rem;
        gap: 5px;
        overflow: visible;
    }
    .profile-follow-side .profile-follow-btn svg {
        width: 15px;
        height: 15px;
        flex: 0 0 auto;
    }
    .profile-follow-side .profile-follow-btn span:not(.profile-follow-spinner) {
        overflow: visible;
        text-overflow: clip;
        white-space: nowrap;
    }
}
@media (max-width: 380px) {
    .profile-follow-side .profile-follow-btn {
        min-width: 104px;
        max-width: 118px;
        padding-inline: 8px;
        font-size: 0.76rem;
    }
}

/* ===== Stage 19AV: profile empty states + call icon polish ===== */
.profile-empty-card,
.empty-state-modern.profile-empty-card {
    border-radius: 28px !important;
    padding: 44px 24px !important;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 320px;
}
.profile-empty-card h3,
.empty-state-modern.profile-empty-card h3 {
    margin: 0 0 12px;
    font-size: clamp(1.65rem, 2vw, 2.25rem);
}
.profile-empty-card p,
.empty-state-modern.profile-empty-card p {
    margin: 0;
    max-width: 720px;
    color: var(--text-muted);
    font-size: clamp(1rem, 1.4vw, 1.2rem);
    line-height: 1.5;
}
.profile-empty-card .profile-listings-empty-icon,
.empty-state-modern.profile-empty-card .profile-listings-empty-icon {
    width: 100px;
    height: 100px;
    margin: 0 auto 22px;
    border-radius: 30px;
    background: linear-gradient(135deg, rgba(139,92,246,.20), rgba(109,93,252,.10));
    box-shadow: inset 0 1px 0 rgba(255,255,255,.15);
}
.profile-empty-card .profile-listings-empty-icon svg,
.empty-state-modern.profile-empty-card .profile-listings-empty-icon svg {
    width: 40px;
    height: 40px;
    display: block;
}
@media (max-width: 640px) {
    .profile-empty-card,
    .empty-state-modern.profile-empty-card {
        min-height: 250px;
        padding: 34px 18px !important;
    }
    .profile-empty-card h3,
    .empty-state-modern.profile-empty-card h3 {
        font-size: 1.7rem;
    }
    .profile-empty-card p,
    .empty-state-modern.profile-empty-card p {
        font-size: 1rem;
    }
    .profile-empty-card .profile-listings-empty-icon,
    .empty-state-modern.profile-empty-card .profile-listings-empty-icon {
        width: 84px;
        height: 84px;
        margin-bottom: 18px;
        border-radius: 24px;
    }
}


/* ===== Stage 19AW: profile layout final polish ===== */

/* Свой профиль: имя/ник/онлайн слева, под аватаркой, а не по центру. */

/* Пустые состояния: крупнее и разные иконки для объявлений/отзывов. */
.profile-empty-card,
.empty-state-modern.profile-empty-card {
    min-height: 360px !important;
    padding: 54px 28px !important;
}
.profile-empty-card .profile-listings-empty-icon,
.empty-state-modern.profile-empty-card .profile-listings-empty-icon {
    width: 116px !important;
    height: 116px !important;
    border-radius: 34px !important;
    margin-bottom: 26px !important;
}
.profile-empty-card .profile-listings-empty-icon svg,
.empty-state-modern.profile-empty-card .profile-listings-empty-icon svg {
    width: 50px !important;
    height: 50px !important;
}
.profile-listings-empty .profile-listings-empty-icon {
    background: linear-gradient(135deg, rgba(139,92,246,.24), rgba(109,93,252,.12)) !important;
}
.profile-reviews-empty-icon {
    background: linear-gradient(135deg, rgba(255,191,87,.22), rgba(139,92,246,.12)) !important;
    color: #f59e0b !important;
}
.profile-empty-card h3,
.empty-state-modern.profile-empty-card h3 {
    font-size: clamp(1.9rem, 2.25vw, 2.45rem) !important;
}
.profile-empty-card p,
.empty-state-modern.profile-empty-card p {
    font-size: clamp(1.05rem, 1.45vw, 1.28rem) !important;
}

/* Чуть ровнее иконка звонка внутри кнопки. */

@media (max-width: 640px) {
    .profile-empty-card,
    .empty-state-modern.profile-empty-card {
        min-height: 280px !important;
        padding: 40px 18px !important;
    }
    .profile-empty-card .profile-listings-empty-icon,
    .empty-state-modern.profile-empty-card .profile-listings-empty-icon {
        width: 94px !important;
        height: 94px !important;
        border-radius: 28px !important;
        margin-bottom: 20px !important;
    }
    .profile-empty-card .profile-listings-empty-icon svg,
    .empty-state-modern.profile-empty-card .profile-listings-empty-icon svg {
        width: 42px !important;
        height: 42px !important;
    }
    .profile-empty-card h3,
    .empty-state-modern.profile-empty-card h3 {
        font-size: 1.85rem !important;
    }
}


/* ===== Stage 20A: Profile stories MVP ===== */
.profile-avatar-wrapper.has-story {
    padding: 4px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8b5cf6, #ec4899, #f59e0b);
    box-shadow: 0 16px 42px rgba(139, 92, 246, .28);
}
/* The gap between the story ring and the photo. Sized by --story-ring-gap so
   the same rule serves the 132px profile avatar and the smaller feed rail. */
.profile-avatar-wrapper.has-story > .avatar {
    border: var(--story-ring-gap, 4px) solid var(--bg, #0b1020);
}
/* The light theme is applied as [data-theme="light"] on <html>; the body
   classes are older aliases that are still present in places. All three must
   be listed or the ring gap stays dark on a light background. */
body.theme-light .profile-avatar-wrapper.has-story > .avatar,
body.light-theme .profile-avatar-wrapper.has-story > .avatar,
[data-theme="light"] .profile-avatar-wrapper.has-story > .avatar {
    border-color: #f8fafc;
}
.profile-story-ring-btn {
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    border: 0;
    background: transparent;
    cursor: pointer;
    z-index: 2;
}
.profile-story-viewer {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0,0,0,.82);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: grid;
    place-items: center;
    padding: 18px;
}

/* Ответ на историю и пересылка. Открываются поверх просмотрщика, поэтому
   z-index обязан быть выше 10000 — иначе окно окажется под сторис. */
.story-action-overlay {
    position: fixed;
    inset: 0;
    z-index: 10010;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(0, 0, 0, .68);
}

.story-action-modal {
    width: 100%;
    max-width: 380px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    overflow: hidden;
}

.story-action-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 16px;
    border-bottom: 1px solid var(--border);
}

.story-action-head h3 { font-size: 1.02rem; }

.story-action-body {
    display: grid;
    gap: 10px;
    padding: 14px 16px 16px;
    overflow-y: auto;
}

.story-action-hint {
    color: var(--text-secondary);
    font-size: .84rem;
    line-height: 1.45;
}

.story-action-textarea {
    width: 100%;
    resize: vertical;
    min-height: 76px;
}

.story-action-error {
    min-height: 16px;
    color: var(--danger);
    font-size: .84rem;
}

.story-action-list {
    display: grid;
    gap: 4px;
    max-height: 46vh;
    overflow-y: auto;
}

.story-action-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border: none;
    border-radius: 12px;
    background: none;
    color: var(--text);
    text-align: left;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.story-action-row:hover:not(:disabled) { background: var(--bg-hover); }
.story-action-row:disabled { opacity: .55; cursor: default; }

.story-action-avatar {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    background-color: rgba(148, 163, 184, .2);
    display: grid;
    place-items: center;
    font-size: .84rem;
    font-weight: 600;
}

.story-action-row-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.story-action-empty {
    padding: 16px;
    text-align: center;
    color: var(--text-secondary);
    font-size: .86rem;
}
.profile-story-box {
    position: relative;
    width: min(430px, 96vw);
    height: min(760px, 92vh);
    border-radius: 30px;
    overflow: hidden;
    background: #050816;
    box-shadow: 0 26px 80px rgba(0,0,0,.55);
    display: flex;
    flex-direction: column;
}
.profile-story-progress {
    position: absolute;
    top: 12px;
    left: 14px;
    right: 14px;
    height: 4px;
    display: flex;
    gap: 5px;
    z-index: 5;
}
.profile-story-progress span {
    flex: 1;
    border-radius: 999px;
    background: rgba(255,255,255,.28);
}
.profile-story-progress span.active,
.profile-story-progress span.done {
    background: rgba(255,255,255,.92);
}
.profile-story-close,
.profile-story-delete,
.profile-story-nav {
    position: absolute;
    z-index: 6;
    border: 0;
    color: #fff;
    cursor: pointer;
}
.profile-story-close {
    top: 25px;
    right: 14px;
}
.profile-story-close,
.profile-story-sheet-close {
    width: 42px;
    height: 42px;
    min-width: 42px;
    min-height: 42px;
    padding: 0;
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: rgba(15,23,42,.30);
    box-shadow: 0 12px 30px rgba(0,0,0,.18), inset 0 1px 0 rgba(255,255,255,.08);
    backdrop-filter: blur(12px) saturate(1.14);
    -webkit-backdrop-filter: blur(12px) saturate(1.14);
    font-size: 0;
    line-height: 1;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.profile-story-close svg,
.profile-story-sheet-close svg {
    width: 18px;
    height: 18px;
    display: block;
    flex: 0 0 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.35;
    stroke-linecap: round;
    stroke-linejoin: round;
    pointer-events: none;
}
.profile-story-close:hover,
.profile-story-close:focus-visible,
.profile-story-sheet-close:hover,
.profile-story-sheet-close:focus-visible {
    background: rgba(30,41,59,.46);
    border-color: rgba(167,139,250,.26);
    outline: none;
}
.profile-story-delete {
    top: 30px;
    left: 14px;
    border-radius: 999px;
    padding: 8px 13px;
    background: rgba(239,68,68,.82);
    font-weight: 800;
}
.profile-story-nav {
    top: 50%;
    transform: translateY(-50%);
    width: 46px;
    height: 72px;
    border-radius: 999px;
    background: rgba(15,23,42,.35);
    font-size: 3rem;
    display: grid;
    place-items: center;
}
.profile-story-nav.prev { left: 8px; }
.profile-story-nav.next { right: 8px; }
.profile-story-media {
    flex: 1;
    min-height: 0;
    display: grid;
    place-items: center;
}
.profile-story-media img,
.profile-story-media video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #050816;
}
.profile-story-caption {
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: 18px;
    z-index: 5;
    color: #fff;
    font-weight: 800;
    text-align: center;
    text-shadow: 0 2px 14px rgba(0,0,0,.65);
}
@media (max-width: 640px) {
    .profile-story-viewer {
        padding: 0;
    }
    .profile-story-box {
        width: 100vw;
        height: 100dvh;
        border-radius: 0;
    }
}


/* ===== Stage 20B: separate avatar edit and add-story buttons ===== */
/* The add-story button geometry lives with #change-avatar-btn in the profile
   section (2026-10-18); these legacy !important layers placed them unevenly. */
.profile-avatar-wrapper {
    position: relative;
}
.profile-avatar-wrapper .profile-story-ring-btn {
    z-index: 2 !important;
}


/* ===== Stage 20D: hard-fix avatar edit button size only ===== */


/* ===== Stage 20E: Telegram-like stories viewer ===== */

/* Purple-only SAVECHAT story ring */
.profile-avatar-wrapper.has-story {
    background: linear-gradient(135deg, #6d5dfc 0%, #8b5cf6 45%, #b05cff 100%) !important;
    box-shadow: 0 16px 44px rgba(139, 92, 246, .34) !important;
}

.profile-story-viewer.telegram-style {
    background: radial-gradient(circle at 50% 20%, rgba(109,93,252,.24), rgba(0,0,0,.88) 48%, rgba(0,0,0,.94)) !important;
    touch-action: none;
}

.profile-story-viewer.telegram-style .profile-story-box {
    width: min(430px, 96vw);
    height: min(780px, 92vh);
    border-radius: 30px;
    background: #050712;
    overflow: hidden;
}

.profile-story-viewer.telegram-style .profile-story-progress {
    top: 10px;
    left: 12px;
    right: 12px;
    height: 3px;
    gap: 4px;
    z-index: 10;
}

.profile-story-viewer.telegram-style .profile-story-progress span {
    position: relative;
    overflow: hidden;
    background: rgba(255,255,255,.25);
}

.profile-story-viewer.telegram-style .profile-story-progress span i {
    position: absolute;
    inset: 0 auto 0 0;
    width: 0%;
    border-radius: inherit;
    background: rgba(255,255,255,.96);
    transition: width .08s linear;
}

.profile-story-topbar {
    position: absolute;
    top: 22px;
    left: 12px;
    right: 12px;
    z-index: 8;
    display: flex;
    align-items: center;
    justify-content: space-between;
    pointer-events: none;
}

.profile-story-user {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    color: #fff;
    text-shadow: 0 2px 12px rgba(0,0,0,.7);
}

.profile-story-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-weight: 900;
    background: linear-gradient(135deg, #6d5dfc, #8b5cf6);
    box-shadow: 0 8px 22px rgba(0,0,0,.24);
}

.profile-story-user b,
.profile-story-user small {
    display: block;
    line-height: 1.1;
}

.profile-story-user small {
    color: rgba(255,255,255,.72);
    font-size: .78rem;
}

.profile-story-viewer.telegram-style .profile-story-close {
    top: 20px;
    right: 10px;
    pointer-events: auto;
}

.profile-story-viewer.telegram-style .profile-story-delete {
    top: 64px;
    left: 14px;
    background: rgba(239,68,68,.68);
    backdrop-filter: blur(10px);
}

.profile-story-viewer.telegram-style .profile-story-media {
    position: absolute;
    inset: 0;
    user-select: none;
    -webkit-user-select: none;
    cursor: pointer;
}

.profile-story-viewer.telegram-style .profile-story-media img,
.profile-story-viewer.telegram-style .profile-story-media video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #050712;
}

.profile-story-viewer.telegram-style .profile-story-nav {
    width: 32px;
    height: 56px;
    border-radius: 999px;
    background: rgba(255,255,255,.08);
    color: rgba(255,255,255,.55);
    font-size: 2.25rem;
    opacity: .45;
    transition: opacity .16s ease, background .16s ease;
    backdrop-filter: blur(10px);
}

.profile-story-viewer.telegram-style .profile-story-nav:hover {
    opacity: .9;
    background: rgba(255,255,255,.14);
}

.profile-story-viewer.telegram-style .profile-story-caption {
    bottom: 82px;
    left: 18px;
    right: 18px;
    font-size: .98rem;
}

.profile-story-reply {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 8;
    display: flex;
    align-items: center;
    gap: 8px;
}

.profile-story-reply-input {
    flex: 1;
    min-width: 0;
    height: 44px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,.14);
    background: rgba(15,23,42,.58);
    color: #fff;
    padding: 0 16px;
    outline: none;
    backdrop-filter: blur(16px);
}

.profile-story-reply-input::placeholder {
    color: rgba(255,255,255,.62);
}

.profile-story-reply-send {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 0;
    display: grid;
    place-items: center;
    color: #fff;
    background: linear-gradient(135deg, #6d5dfc, #8b5cf6);
    cursor: pointer;
    box-shadow: 0 12px 28px rgba(109,93,252,.35);
}

.profile-story-own-note {
    width: 100%;
    min-height: 42px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: rgba(15,23,42,.58);
    border: 1px solid rgba(255,255,255,.12);
    color: rgba(255,255,255,.78);
    font-weight: 800;
    backdrop-filter: blur(16px);
}

body.story-viewer-open {
    overflow: hidden;
}

@media (max-width: 640px) {
    .profile-story-viewer.telegram-style .profile-story-box {
        width: 100vw;
        height: 100dvh;
        border-radius: 0;
    }
    .profile-story-viewer.telegram-style .profile-story-nav {
        display: none;
    }
    .profile-story-viewer.telegram-style .profile-story-close {
        right: 8px;
    }
    .profile-story-viewer.telegram-style .profile-story-close,
    .profile-story-sheet-close {
        width: 40px;
        height: 40px;
        min-width: 40px;
        min-height: 40px;
    }
    .profile-story-viewer.telegram-style .profile-story-caption {
        bottom: 78px;
    }
}


/* ===== Stage 20F: Telegram story menu, edit and visibility ===== */
.profile-story-viewer.stage20f .profile-story-topbar {
    top: 20px;
}
.profile-story-viewer.stage20f .profile-story-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}
.profile-story-top-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: auto;
}
.profile-story-more {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,.16);
    background: rgba(15,23,42,.28);
    color: #fff;
    font-weight: 900;
    letter-spacing: -2px;
    cursor: pointer;
    display: grid;
    place-items: center;
    backdrop-filter: blur(12px);
}
.profile-story-viewer.stage20f .profile-story-close {
    position: static;
    top: auto;
    right: auto;
    pointer-events: auto;
}
.profile-story-menu {
    position: absolute;
    top: 66px;
    right: 12px;
    z-index: 25;
    width: min(310px, calc(100% - 24px));
    padding: 10px;
    border-radius: 26px;
    background: rgba(22, 24, 30, .78);
    border: 1px solid rgba(255,255,255,.12);
    box-shadow: 0 24px 80px rgba(0,0,0,.45);
    backdrop-filter: blur(24px) saturate(1.2);
    -webkit-backdrop-filter: blur(24px) saturate(1.2);
}
.profile-story-menu.hidden {
    display: none;
}
.profile-story-menu button {
    width: 100%;
    min-height: 54px;
    padding: 10px 12px;
    border: 0;
    border-radius: 16px;
    background: transparent;
    color: #fff;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    column-gap: 10px;
    align-items: center;
    text-align: left;
    cursor: pointer;
}
.profile-story-menu button:hover {
    background: rgba(255,255,255,.08);
}
.profile-story-menu button > span {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    font-size: 0;
    opacity: .9;
    text-align: center;
}
.profile-story-menu button > span svg {
    width: 21px;
    height: 21px;
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.profile-story-menu button[data-story-action="delete"] > span {
    color: #fb7185;
}
.profile-story-menu button b {
    font-size: .98rem;
    line-height: 1.12;
}
.profile-story-menu button small {
    grid-column: 2;
    display: block;
    color: rgba(255,255,255,.55);
    margin-top: 2px;
    font-weight: 700;
}
.profile-story-own-footer {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 46px;
    gap: 12px;
}
.profile-story-view-count {
    color: rgba(255,255,255,.88);
    font-weight: 900;
    padding-left: 4px;
}
.profile-story-footer-delete {
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid rgba(248,113,113,.25);
    border-radius: 50%;
    background: rgba(239,68,68,.18);
    color: #fff;
    cursor: pointer;
    display: grid;
    place-items: center;
    box-shadow: 0 10px 26px rgba(127,29,29,.20), inset 0 1px 0 rgba(255,255,255,.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.profile-story-footer-delete svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    pointer-events: none;
}
.profile-story-footer-delete:hover,
.profile-story-footer-delete:focus-visible {
    background: rgba(239,68,68,.34);
    border-color: rgba(248,113,113,.46);
    outline: none;
}
.profile-story-sheet {
    position: absolute;
    inset: 0;
    z-index: 40;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: rgba(0,0,0,.38);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.profile-story-sheet-panel {
    position: relative;
    width: 100%;
    max-height: 82%;
    overflow-y: auto;
    border-radius: 34px 34px 0 0;
    padding: 24px 22px 22px;
    background: rgba(24,24,28,.96);
    color: #fff;
    box-shadow: 0 -20px 70px rgba(0,0,0,.55);
}
.profile-story-sheet-close {
    position: absolute;
    left: 18px;
    top: 18px;
    z-index: 2;
}
.profile-story-sheet-icon {
    width: 78px;
    height: 78px;
    margin: 20px auto 12px;
    border-radius: 28px;
    display: grid;
    place-items: center;
    font-size: 2.2rem;
    background: rgba(139,92,246,.2);
}
.profile-story-sheet h3 {
    margin: 0 0 22px;
    text-align: center;
    font-size: 1.45rem;
}
.profile-story-sheet-label {
    display: block;
    margin: 14px 0 8px;
    color: rgba(255,255,255,.6);
    font-size: .78rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.profile-story-caption-input {
    width: 100%;
    min-height: 74px;
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,.12);
    background: rgba(255,255,255,.08);
    color: #fff;
    padding: 13px 14px;
    resize: vertical;
    outline: none;
}
.profile-story-visibility-list {
    display: grid;
    gap: 8px;
}
.profile-story-visibility-list label {
    min-height: 74px;
    border-radius: 20px;
    padding: 12px 12px;
    background: rgba(255,255,255,.07);
    display: grid;
    grid-template-columns: 28px 44px 1fr;
    grid-template-rows: auto auto;
    column-gap: 10px;
    align-items: center;
    cursor: pointer;
}
.profile-story-visibility-list input {
    grid-row: 1 / 3;
    width: 22px;
    height: 22px;
    accent-color: #8b5cf6;
}
.profile-story-visibility-list label > span {
    grid-row: 1 / 3;
    width: 44px;
    height: 44px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #6d5dfc, #8b5cf6);
}
.profile-story-visibility-list b {
    font-size: 1rem;
}
.profile-story-visibility-list small {
    color: rgba(255,255,255,.55);
    font-weight: 700;
}
.profile-story-save-settings {
    width: 100%;
    min-height: 54px;
    margin-top: 18px;
    border: 0;
    border-radius: 999px;
    color: #fff;
    font-weight: 950;
    font-size: 1.05rem;
    background: linear-gradient(135deg, #6d5dfc, #8b5cf6);
    cursor: pointer;
}
@media (max-width: 640px) {
    .profile-story-menu {
        top: 66px;
        right: 10px;
        width: min(330px, calc(100% - 20px));
    }
    .profile-story-sheet-panel {
        max-height: 88%;
        padding-bottom: max(22px, env(safe-area-inset-bottom));
    }
}


/* ===== Stage 20G: real story views and viewers list ===== */
.profile-story-own-footer {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 46px;
    align-items: center;
    gap: 10px;
}
.profile-story-own-views {
    min-width: 0;
    height: 46px;
    border: 0;
    border-radius: 999px;
    background: rgba(15,23,42,.58);
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 13px;
    cursor: pointer;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}
.profile-story-view-avatars {
    display: flex;
    align-items: center;
    min-width: 0;
}
.profile-story-viewer-avatar {
    width: 28px;
    height: 28px;
    margin-left: -8px;
    border-radius: 50%;
    border: 2px solid rgba(5,7,18,.96);
    display: grid;
    place-items: center;
    overflow: hidden;
    background: linear-gradient(135deg, #6d5dfc, #8b5cf6);
    color: #fff;
    font-weight: 900;
    font-size: .78rem;
}
.profile-story-viewer-avatar:first-child {
    margin-left: 0;
}
.profile-story-viewer-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.profile-story-view-count {
    color: rgba(255,255,255,.92);
    font-weight: 900;
    white-space: nowrap;
}
.profile-story-viewers-subtitle {
    margin: -12px 0 16px;
    text-align: center;
    color: rgba(255,255,255,.6);
    font-weight: 800;
}
.profile-story-viewers-list {
    display: grid;
    gap: 8px;
}
.profile-story-viewer-row {
    width: 100%;
    min-height: 62px;
    border: 0;
    border-radius: 18px;
    padding: 8px 10px;
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    text-align: left;
    background: rgba(255,255,255,.07);
    color: #fff;
    cursor: pointer;
}
.profile-story-viewer-row:hover {
    background: rgba(255,255,255,.11);
}
.profile-story-viewer-row-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    overflow: hidden;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #6d5dfc, #8b5cf6);
    font-weight: 900;
}
.profile-story-viewer-row-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.profile-story-viewer-row b,
.profile-story-viewer-row small {
    display: block;
}
.profile-story-viewer-row small {
    color: rgba(255,255,255,.55);
    margin-top: 3px;
    font-weight: 700;
}
.profile-story-no-viewers {
    min-height: 100px;
    border-radius: 20px;
    display: grid;
    place-items: center;
    text-align: center;
    color: rgba(255,255,255,.58);
    background: rgba(255,255,255,.06);
    font-weight: 800;
}


/* ===== Stage 20H: story ring visibility + SAVECHAT reply button + media replace ===== */

/* Strong visible purple ring around avatars with active stories */
.profile-avatar-wrapper.has-story {
    padding: var(--story-ring-pad, 5px) !important;
    background:
        conic-gradient(from 180deg, #6d5dfc, #8b5cf6, #b05cff, #6d5dfc) !important;
    box-shadow:
        0 0 0 var(--story-ring-halo, 4px) rgba(139,92,246,.18),
        0 18px 48px rgba(109,93,252,.34) !important;
}
.profile-avatar-wrapper.has-story::before {
    content: "";
    position: absolute;
    inset: var(--story-ring-pulse-inset, -8px);
    border-radius: 50%;
    border: 2px solid rgba(139,92,246,.35);
    pointer-events: none;
    animation: storyRingPulse 1.8s ease-in-out infinite;
}
@keyframes storyRingPulse {
    0%,100% { opacity: .45; transform: scale(.98); }
    50% { opacity: .9; transform: scale(1.025); }
}
.profile-avatar-wrapper.has-story > .avatar {
    box-shadow: inset 0 0 0 3px rgba(255,255,255,.08) !important;
}

/* Reply send button must match SAVECHAT/chat style, not Telegram blue */
.profile-story-reply-send {
    background: linear-gradient(135deg, #6d5dfc 0%, #8b5cf6 100%) !important;
    box-shadow:
        0 12px 28px rgba(109,93,252,.38),
        inset 0 1px 0 rgba(255,255,255,.18) !important;
    color: #fff !important;
}
.profile-story-reply-send:hover {
    filter: brightness(1.07);
    transform: translateY(-1px);
}
.profile-story-reply-send svg {
    transform: translateX(1px);
}

/* Media replacement sheet */
.profile-story-media-edit {
    display: grid;
    gap: 10px;
    margin: 6px 0 16px;
}
.profile-story-media-preview {
    width: min(210px, 72%);
    aspect-ratio: 9 / 16;
    margin: 0 auto;
    border-radius: 24px;
    overflow: hidden;
    background: #050712;
    border: 1px solid rgba(255,255,255,.12);
    box-shadow: 0 18px 44px rgba(0,0,0,.32);
    display: grid;
    place-items: center;
}
.profile-story-media-preview img,
.profile-story-media-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.profile-story-replace-media {
    width: min(260px, 100%);
    min-height: 44px;
    margin: 0 auto;
    border: 0;
    border-radius: 999px;
    color: #fff;
    font-weight: 900;
    background: rgba(139,92,246,.22);
    border: 1px solid rgba(139,92,246,.34);
    cursor: pointer;
}

/* Story editor (ui/story-editor.js, owner 2026-10-18). Dark in both themes,
   like the story viewer it publishes to; above the viewer (10000). */
body.story-editor-open {
    overflow: hidden;
}

.story-editor {
    position: fixed;
    inset: 0;
    z-index: 10030;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    height: 100dvh;
    padding: max(10px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
    gap: 10px;
    background: #050507;
    color: #fff;
    font-family: var(--font-sans);
    -webkit-user-select: none;
    user-select: none;
}

.story-editor-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.story-editor-tools {
    display: flex;
    gap: 8px;
}

.story-editor-icon {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: #fff;
    background: rgba(255, 255, 255, .14);
    cursor: pointer;
}

.story-editor-icon svg {
    width: 22px;
    height: 22px;
}

.story-editor-icon[aria-pressed="true"] {
    color: #111;
    background: #fff;
}

.story-editor-icon:disabled {
    opacity: .38;
    cursor: default;
}

.story-editor-icon:focus-visible,
.story-editor-chip:focus-visible,
.story-editor-share:focus-visible,
.story-editor-item:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.story-editor-stage {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 0;
    overflow: hidden;
}

.story-editor-frame {
    position: relative;
    overflow: hidden;
    border-radius: 18px;
    background: #000;
    touch-action: none;
}

.story-editor-media {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}

.story-editor-ink,
.story-editor-layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.story-editor-ink {
    pointer-events: none;
}

.story-editor.drawing .story-editor-frame {
    cursor: crosshair;
}

.story-editor.drawing .story-editor-item {
    pointer-events: none;
}

.story-editor-item {
    position: absolute;
    transform: translate(-50%, -50%);
    max-width: 92%;
    padding: .1em .3em;
    border-radius: .3em;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    text-shadow: 0 1px 6px rgba(0, 0, 0, .45);
    cursor: grab;
    touch-action: none;
}

.story-editor-item.sticker,
.story-editor-item.with-background {
    text-shadow: none;
}

.story-editor-item.selected {
    outline: 2px dashed rgba(255, 255, 255, .85);
    outline-offset: 4px;
}

.story-editor-item-bar,
.story-editor-panel,
.story-editor-bottom {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.story-editor-item-bar[hidden],
.story-editor-panel[hidden],
.story-editor-confirm[hidden] {
    display: none;
}

/* Tools lie over the picture: the item bar at the top, a tool panel at the
   bottom, so the picture keeps its size while a tool is open. */
.story-editor-item-bar,
.story-editor-panel {
    position: absolute;
    left: 50%;
    z-index: 2;
    width: min(calc(100% - 16px), 520px);
    padding: 10px 12px;
    border-radius: 20px;
    background: rgba(18, 18, 22, .84);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    transform: translateX(-50%);
}

.story-editor-item-bar {
    top: 8px;
}

.story-editor-panel {
    bottom: 8px;
}

.story-editor-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 40px;
    padding: 0 14px;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 999px;
    color: #fff;
    background: rgba(255, 255, 255, .1);
    font-size: 14px;
    font-weight: 650;
    cursor: pointer;
}

.story-editor-chip svg {
    width: 18px;
    height: 18px;
}

.story-editor-chip[aria-checked="true"],
.story-editor-chip[aria-pressed="true"] {
    color: #111;
    border-color: #fff;
    background: #fff;
}

.story-editor-chip.primary,
.story-editor-share {
    color: #fff;
    border-color: transparent;
    background: var(--primary);
}

.story-editor-chip.danger {
    border-color: rgba(255, 69, 58, .5);
    color: #ff6961;
}

.story-editor-colors,
.story-editor-brushes {
    display: flex;
    gap: 8px;
}

.story-editor-color {
    width: 30px;
    height: 30px;
    padding: 0;
    border: 2px solid rgba(255, 255, 255, .55);
    border-radius: 50%;
    cursor: pointer;
}

.story-editor-color[aria-checked="true"] {
    border-color: #fff;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, .35);
}

.story-editor-brush {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
}

.story-editor-brush i {
    display: block;
    border-radius: 50%;
    background: #fff;
}

.story-editor-brush i[data-size="0"] { width: 6px; height: 6px; }
.story-editor-brush i[data-size="1"] { width: 11px; height: 11px; }
.story-editor-brush i[data-size="2"] { width: 18px; height: 18px; }

.story-editor-brush[aria-checked="true"] {
    border-color: #fff;
    background: rgba(255, 255, 255, .16);
}

.story-editor-stickers {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 6px;
    width: min(100%, 460px);
}

.story-editor-sticker {
    min-height: 44px;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: rgba(255, 255, 255, .08);
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
}

.story-editor-text-panel {
    flex-direction: column;
}

.story-editor-text-input,
.story-editor-caption {
    width: min(100%, 520px);
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 16px;
    padding: 10px 14px;
    color: #fff;
    background: rgba(255, 255, 255, .08);
    font: inherit;
    font-size: 16px;
    -webkit-user-select: text;
    user-select: text;
}

.story-editor-text-input {
    resize: none;
}

.story-editor-text-input::placeholder,
.story-editor-caption::placeholder {
    color: rgba(255, 255, 255, .55);
}

.story-editor-text-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.story-editor-bottom {
    flex-direction: column;
}

.story-editor-note {
    margin: 0;
    color: rgba(255, 255, 255, .7);
    font-size: 13px;
    text-align: center;
}

.story-editor-audience {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
}

.story-editor-share {
    width: min(100%, 520px);
    min-height: 48px;
    border: 0;
    border-radius: 999px;
    font-size: 16px;
    font-weight: 750;
    cursor: pointer;
}

.story-editor-share:disabled {
    opacity: .6;
    cursor: progress;
}

.story-editor-confirm {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(0, 0, 0, .6);
}

.story-editor-confirm-card {
    display: grid;
    gap: 16px;
    width: min(100%, 340px);
    padding: 22px;
    border-radius: 22px;
    background: rgba(28, 28, 32, .98);
    text-align: center;
}

@media (max-width: 640px) {
    .story-editor {
        padding-left: 8px;
        padding-right: 8px;
        gap: 8px;
    }

    .story-editor-icon {
        width: 40px;
        height: 40px;
    }

    .story-editor-stickers {
        grid-template-columns: repeat(6, 1fr);
    }

    .story-editor-chip {
        min-height: 36px;
        padding: 0 12px;
        font-size: 13px;
    }
}

/* Menu functions visual polish */
.profile-story-menu button[data-story-action="copy"] span,
.profile-story-menu button[data-story-action="share"] span,
.profile-story-menu button[data-story-action="download"] span {
    font-size: 1.08rem;
}
@media (max-width: 640px) {
    .profile-avatar-wrapper.has-story {
        padding: var(--story-ring-pad, 4px) !important;
    }
    .profile-avatar-wrapper.has-story::before {
        inset: var(--story-ring-pulse-inset, -6px);
    }
    .profile-story-media-preview {
        width: min(190px, 76%);
    }
}


/* ===== Stage 20I: pause story settings + real SAVECHAT reply button + SVG settings icons ===== */

/* Hard override: reply button should look like our chat send button, not Telegram. */
.profile-story-reply .profile-story-reply-send.chat-send-style,
.profile-story-viewer .profile-story-reply-send.chat-send-style,
.profile-story-viewer.telegram-style .profile-story-reply-send.chat-send-style {
    width: 46px !important;
    height: 46px !important;
    min-width: 46px !important;
    min-height: 46px !important;
    border: 0 !important;
    border-radius: 16px !important;
    display: grid !important;
    place-items: center !important;
    padding: 0 !important;
    color: #fff !important;
    background: linear-gradient(135deg, #7c3aed 0%, #8b5cf6 55%, #6d5dfc 100%) !important;
    box-shadow:
        0 14px 30px rgba(109,93,252,.38),
        inset 0 1px 0 rgba(255,255,255,.20) !important;
}
.profile-story-reply .profile-story-reply-send.chat-send-style svg,
.profile-story-viewer .profile-story-reply-send.chat-send-style svg,
.profile-story-viewer.telegram-style .profile-story-reply-send.chat-send-style svg {
    width: 21px !important;
    height: 21px !important;
    transform: none !important;
    display: block !important;
}

/* Normal SVG icons in story settings instead of emoji placeholders. */
.profile-story-sheet-icon svg,
.profile-story-visibility-list label > span svg {
    width: 34px;
    height: 34px;
    display: block;
}
.profile-story-visibility-list label > span svg {
    width: 24px;
    height: 24px;
}
.profile-story-sheet-icon {
    color: #fff;
    background: linear-gradient(135deg, rgba(109,93,252,.55), rgba(139,92,246,.30)) !important;
}
.profile-story-visibility-list label > span {
    color: #fff;
}

/* ===== Stage 20J: Stories rail in the main feed ===== */
.feed-stories-wrap {
    position: relative;
    z-index: 2;
    width: 100%;
    padding: 10px 12px 8px;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, .16);
    border-radius: 16px;
    background: rgba(15, 23, 42, .74);
    box-shadow: none;
    backdrop-filter: blur(18px) saturate(135%);
    -webkit-backdrop-filter: blur(18px) saturate(135%);
}
.feed-stories-host {
    min-height: 109px;
}
.stories-rail {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    /* Top padding clears the pulsing story ring (::before, --story-ring-pulse-inset),
       which would otherwise be cut off by overflow-y: hidden. */
    padding: 6px 2px 6px;
    scroll-padding-inline: 2px;
    scrollbar-width: none;
    overscroll-behavior-inline: contain;
    touch-action: pan-x;
    -webkit-overflow-scrolling: touch;
}
.stories-rail::-webkit-scrollbar {
    display: none;
}
.stories-rail__item {
    /* The ringed avatar diameter: the «+» badge is placed from it. */
    --story-rail-avatar: 76px;
    position: relative;
    flex: 0 0 76px;
    min-width: 0;
    text-align: center;
}
/* «Ваша история» fits on one line: the own item is a little wider. */
.stories-rail__item.stories-rail__self { flex-basis: 92px; }
.stories-rail__owner {
    width: 100%;
    min-width: 0;
    padding: 0;
    border: 0;
    color: var(--text-primary, #f8fafc);
    background: transparent;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
/* The ring itself is NOT redefined here: the rail reuses
   .profile-avatar-wrapper.has-story from the profile. Only the scale differs,
   so the rail supplies the size variables that rule reads. The ratios match
   the profile avatar (photo = 87% of the outer diameter). */
.stories-rail__avatar {
    --story-ring-pad: 3px;
    --story-ring-gap: 2px;
    --story-ring-halo: 2px;
    --story-ring-pulse-inset: -4px;
    transition: transform .16s ease, filter .16s ease, box-shadow .16s ease;
}
/* "Add story" state: no ring yet, but the same outer diameter so the rail does
   not jump once the first story is published. */
.stories-rail__avatar:not(.has-story) {
    padding: var(--story-ring-pad);
    border-radius: 50%;
    background: rgba(148, 163, 184, .35);
}
.stories-rail__avatar-media {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    box-sizing: border-box;
    object-fit: cover;
    color: #fff;
    background: linear-gradient(135deg, #6d5dfc, #8b5cf6);
    font-size: 1.25rem;
    font-weight: 900;
}
.stories-rail__item.is-seen .stories-rail__avatar {
    filter: grayscale(1) opacity(.62);
}
.stories-rail__item.is-seen .stories-rail__avatar::before {
    animation: none;
    opacity: .3;
}
.stories-rail__owner:hover .stories-rail__avatar,
.stories-rail__owner:focus-visible .stories-rail__avatar {
    transform: translateY(-2px) scale(1.025);
    filter: none;
    box-shadow: 0 14px 32px rgba(139, 92, 246, .34);
}
.stories-rail__owner:focus-visible {
    border-radius: 14px;
    outline: 2px solid rgba(167, 139, 250, .82);
    outline-offset: 3px;
}
.stories-rail__name {
    display: block;
    width: 100%;
    overflow: hidden;
    color: inherit;
    font-size: .74rem;
    font-weight: 750;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* Centred on the avatar circle at 45° (owner 2026-10-18: it looked crooked):
   85.36% down / 14.64% in from the avatar edge, the avatar centred in the item. */
.stories-rail__add {
    position: absolute;
    top: calc(var(--story-rail-avatar) * .8536 - 12px);
    right: calc((100% - var(--story-rail-avatar)) / 2 + var(--story-rail-avatar) * .1464 - 12px);
    z-index: 4;
    width: 24px;
    height: 24px;
    padding: 0 0 1px;
    border: 2px solid rgba(10, 15, 30, .96);
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: #fff;
    background: linear-gradient(135deg, #7c3aed, #6d5dfc);
    box-shadow: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 900;
    line-height: 1;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.stories-rail__add:hover,
.stories-rail__add:focus-visible {
    transform: scale(1.08);
    outline: 2px solid rgba(196, 181, 253, .92);
    outline-offset: 2px;
}
body.theme-light .feed-stories-wrap,
body.light-theme .feed-stories-wrap,
[data-theme="light"] .feed-stories-wrap {
    border-color: rgba(99, 102, 241, .15);
    background:
        radial-gradient(circle at 8% 0%, rgba(139, 92, 246, .13), transparent 35%),
        rgba(255, 255, 255, .80);
    box-shadow: 0 18px 44px rgba(71, 85, 105, .13);
}
body.theme-light .stories-rail__owner,
body.light-theme .stories-rail__owner,
[data-theme="light"] .stories-rail__owner {
    color: #172033;
}
/* The ring gap on the avatar itself is handled by the shared
   .profile-avatar-wrapper.has-story rule above; only the add button is local. */
body.theme-light .stories-rail__add,
body.light-theme .stories-rail__add,
[data-theme="light"] .stories-rail__add {
    border-color: rgba(248, 250, 252, .98);
}
@media (max-width: 640px) {
    .feed-stories-wrap {
        margin-inline: -2px;
        width: calc(100% + 4px);
        padding: 12px 8px 10px;
        border-radius: 20px;
    }
    .feed-stories-host {
        min-height: 98px;
    }
    .stories-rail {
        gap: 9px;
        padding-inline: 1px;
        padding-top: 5px;
    }
    .stories-rail__item {
        --story-rail-avatar: 70px;
        flex-basis: 70px;
    }
    .stories-rail__item.stories-rail__self { flex-basis: 86px; }
    .stories-rail__avatar-media {
        width: 64px;
        height: 64px;
    }
    .stories-rail__name {
        font-size: .7rem;
    }
}


/* Package 173 (owner 2026-10-20): the QR code of another person's page, on the
   themed frame of the app's dialogs (.chat-action-modal). */
.profile-qr-dialog {
    width: min(400px, calc(100vw - 24px));
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
    gap: 0;
    padding: 0;
}
.profile-qr-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 14px 0 20px; }
.profile-qr-head h3 { margin: 0; font-size: 17px; font-weight: 700; line-height: 1.3; }
.profile-qr-close {
    appearance: none;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 999px;
    background: var(--bg-tertiary);
    color: var(--text);
    cursor: pointer;
}
.profile-qr-close:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.profile-qr-card {
    position: relative;
    display: grid;
    justify-items: center;
    gap: 4px;
    margin: 52px 20px 0;
    padding: 52px 20px 22px;
    border-radius: 24px;
    background: linear-gradient(160deg, rgba(255, 255, 255, .16), rgba(255, 255, 255, 0) 55%), var(--primary-grad, var(--primary));
    color: #fff;
}
.profile-qr-avatar {
    position: absolute;
    top: -40px;
    left: 50%;
    display: grid;
    place-items: center;
    width: 80px;
    height: 80px;
    overflow: hidden;
    border-radius: 50%;
    box-shadow: 0 0 0 4px var(--bg-card);
    background: var(--bg-card);
    color: var(--primary);
    font-size: 30px;
    font-weight: 700;
    transform: translateX(-50%);
}
.profile-qr-avatar .person-avatar { display: grid; place-items: center; width: 100%; height: 100%; }
.profile-qr-avatar .person-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-qr-code {
    display: grid;
    place-items: center;
    width: min(232px, 100%);
    aspect-ratio: 1;
    padding: 8px;
    border-radius: 20px;
    background: #fff;
    color: #000;
}
.profile-qr-code svg { display: block; width: 100%; height: auto; }
.profile-qr-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(0, 0, 0, .12);
    border-top-color: rgba(0, 0, 0, .5);
    border-radius: 50%;
    animation: profile-qr-spin .8s linear infinite;
}
@keyframes profile-qr-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .profile-qr-spinner { animation: none; } }
.profile-qr-name { margin-top: 10px; max-width: 100%; font-size: 18px; font-weight: 700; line-height: 1.3; text-align: center; overflow-wrap: anywhere; }
.profile-qr-handle { color: rgba(255, 255, 255, .86); font-size: 14px; font-weight: 600; }
.profile-qr-hint { margin: 14px 24px 0; color: var(--text-muted); font-size: 14px; line-height: 1.45; text-align: center; }
.profile-qr-status { min-height: 20px; margin: 6px 20px 0; color: var(--text-muted); font-size: 13px; line-height: 1.4; text-align: center; }
.profile-qr-status[data-error="1"] { color: var(--danger); }
.profile-qr-actions { display: grid; gap: 10px; padding: 10px 20px 20px; }
.profile-qr-actions .btn { width: 100%; min-height: 46px; }

/* Package 171 (owner 2026-10-19): another person's short page — Telegram's
   layout in the style of «Меню». The .dashboard-home classes are reused as
   they are; everything below is scoped to .profile-mini. */
.profile-mini { display: grid; gap: 4px; padding-bottom: 24px; }
.profile-mini .dashboard-home-header,
.profile-mini .dashboard-home-content { width: min(calc(100% - 24px), 680px); }
.profile-mini .dashboard-home-content { gap: 16px; }
.profile-mini .dashboard-home-header { padding-top: 22px; }
.profile-mini-back { inset-inline: 0 auto; }
html[data-text-dir="rtl"] .profile-mini-back svg { transform: scaleX(-1); }
.profile-mini-presence.is-online { display: flex; justify-content: center; align-items: center; min-height: 16px; color: var(--success); }
.profile-mini-presence .profile-presence-dot { display: inline-block; width: 9px; height: 9px; background: currentColor; border-radius: 50%; animation: profile-presence-breathe 2.4s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .profile-mini-presence .profile-presence-dot { animation: none; } }
.profile-mini-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(64px, 1fr));
    gap: 10px;
}
.profile-mini-action {
    appearance: none;
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 6px;
    min-width: 0;
    min-height: 70px;
    padding: 12px 4px 10px;
    border: 1px solid var(--border-light);
    border-radius: 18px;
    background: var(--bg-card);
    color: var(--primary);
    font: inherit;
    cursor: pointer;
    transition: background var(--transition-fast);
}
.profile-mini-action > span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
}
.profile-mini-action:hover:not(:disabled) { background: var(--bg-hover); }
.profile-mini-action:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.profile-mini-action:disabled { opacity: .55; cursor: default; }
.profile-mini-field { display: grid; gap: 2px; min-width: 0; padding: 12px 18px; }
.profile-mini-field + .profile-mini-field { border-top: 1px solid var(--border-light); }
.profile-mini-field small { color: var(--text-muted); font-size: 13px; }
.profile-mini-field > span { color: var(--text); font-weight: 600; overflow-wrap: anywhere; }
.profile-mini-field > .profile-mini-username { color: var(--primary); }
.profile-mini-actions:has(> :only-child) { grid-template-columns: minmax(64px, 136px); justify-content: center; }
/* Following and blocking are rows of the card, as in Telegram's. */
.profile-mini-row-action {
    appearance: none;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 52px;
    padding: 12px 18px;
    border: 0;
    border-top: 1px solid var(--border-light);
    background: none;
    color: var(--primary);
    font: inherit;
    font-weight: 650;
    text-align: start;
    cursor: pointer;
}
.profile-mini-info > .profile-mini-row-action:first-child { border-top: 0; }
.profile-mini-row-action:hover:not(:disabled) { background: var(--bg-hover); }
.profile-mini-row-action:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.profile-mini-row-action:disabled { opacity: .55; cursor: default; }
.profile-mini-row-action.profile-mini-block { color: var(--danger); }
/* The counters of the full profile, laid out for this card. */
.profile-mini .profile-metrics { display: flex; flex-wrap: wrap; justify-content: space-around; gap: 4px 6px; padding: 10px 8px; }
.profile-mini .profile-metric {
    appearance: none;
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 2px;
    min-width: 0;
    min-height: 50px;
    margin: 0;
    padding: 4px 2px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--text);
    font: inherit;
    text-align: center;
}
.profile-mini button.profile-metric { cursor: pointer; }
.profile-mini button.profile-metric:hover { background: var(--bg-hover); }
.profile-mini .profile-metric strong { font-size: 16px; font-weight: 700; }
.profile-mini .profile-metric strong,
.profile-mini .profile-metric span { line-height: 1.25; }
.profile-mini .profile-metric span { color: var(--text-secondary); font-size: 12px; font-weight: 600; white-space: nowrap; }
.profile-mini-wall { display: grid; gap: 10px; min-width: 0; }
/* Package 172/173: their music as Telegram's line under the tiles. */
.profile-mini-music {
    appearance: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    min-width: 0;
    min-height: 40px;
    margin-top: -6px;
    padding: 6px 12px;
    border: 0;
    border-radius: 14px;
    background: none;
    color: var(--primary);
    font: inherit;
    font-size: 15px;
    cursor: pointer;
}
.profile-mini-music[hidden] { display: none; }
.profile-mini-music:hover { background: var(--bg-hover); }
.profile-mini-music:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.profile-mini-music > svg { flex: 0 0 18px; width: 18px; height: 18px; }
.profile-mini-music-now {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.profile-mini-music-title { font-weight: 700; }
.profile-mini-music-artist { color: var(--text-muted); font-weight: 500; }
/* Package 173: the glyphs of «Меню» on the tiles, the QR button in the username field. */
.profile-mini-action > svg { width: 24px; height: 24px; }
.profile-mini-field.has-action { position: relative; padding-inline-end: 68px; }
.profile-mini-qr {
    appearance: none;
    position: absolute;
    inset-block: 0;
    inset-inline-end: 12px;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin-block: auto;
    border: 0;
    border-radius: 12px;
    background: none;
    color: var(--primary);
    cursor: pointer;
}
.profile-mini-qr:hover { background: var(--bg-hover); }
.profile-mini-qr:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ===== Stage 21A: Profile photos VK-like MVP ===== */
/* Owner 2026-10-19: the photo tab is the Instagram profile — albums, head and
   grid share Instagram's profile column of at most 935px. */
.profile-photos-shell {
    display: grid;
    gap: 20px;
    width: min(100%, 935px);
    margin-inline: auto;
}
.profile-photos-head,
.profile-photos-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 6px 2px 0;
}
.profile-photos-head h3 {
    margin: 0;
    font-size: 1.45rem;
}
/* Package 170 (owner 2026-10-19): albums as Instagram highlights between the
   profile header and its tabs — a row of round covers with a title. */
.profile-highlights { min-width: 0; }
.profile-highlights-row {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    padding: 8px 16px 10px;
    scrollbar-width: none;
}
.profile-highlights-row::-webkit-scrollbar { display: none; }
.profile-highlight {
    flex: 0 0 auto;
    display: grid;
    justify-items: center;
    gap: 6px;
    width: 76px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--text);
    cursor: pointer;
}
.profile-highlight-ring {
    display: grid;
    place-items: center;
    width: 68px;
    height: 68px;
    padding: 3px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--bg-card);
    overflow: hidden;
}
.profile-highlight-ring img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.profile-highlight-ring i { color: var(--text-muted); font-size: 22px; font-style: normal; }
.profile-highlight-new .profile-highlight-ring { border-style: dashed; color: var(--text-muted); }
.profile-highlight-title {
    max-width: 76px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 600;
}
.profile-highlight:hover .profile-highlight-ring { border-color: var(--primary); }
.profile-highlight:focus-visible { outline: none; }
.profile-highlight:focus-visible .profile-highlight-ring { outline: 2px solid var(--primary); outline-offset: 2px; }
/* An open album: «‹ Все фото» back to the whole grid; the owner's «•••». */
.profile-photo-album-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.profile-photo-album-back {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 40px;
    padding: 0 12px 0 6px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-card);
    color: var(--text);
    font-weight: 700;
    cursor: pointer;
}
html[data-text-dir="rtl"] .profile-photo-album-back svg { transform: scaleX(-1); }
/* The album «•••» was a badge over an album card; in the bar it is a button. */
.profile-photo-album-bar .profile-photo-album-more {
    position: static;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    backdrop-filter: none;
}
.profile-photos-head p {
    margin: 4px 0 0;
    color: var(--text-muted);
    font-weight: 800;
}
/* Owner 2026-10-19 («чисто инстаграм, 1 в 1»), replacing PHOTO-GRID-03:
   exactly three square columns at every width with Instagram's thin gaps;
   one photo is one tile. */
.profile-photos-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    overflow: hidden;
}
/* More than 150 photos: the next page loads under the grid. */
.profile-photos-more {
    display: block;
    margin: 12px auto 4px;
}
.profile-photo-tile {
    position: relative;
    border: 0;
    padding: 0;
    aspect-ratio: 1 / 1;
    background: rgba(148,163,184,.12);
    cursor: pointer;
    overflow: hidden;
}
.profile-photo-tile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .18s ease, filter .18s ease;
}
.profile-photo-tile span {
    position: absolute;
    left: 8px;
    right: 8px;
    bottom: 8px;
    border-radius: 12px;
    padding: 6px 8px;
    background: rgba(0,0,0,.46);
    color: #fff;
    font-size: .82rem;
    font-weight: 800;
    text-align: left;
    backdrop-filter: blur(10px);
}
.profile-photos-empty .profile-listings-empty-icon {
    color: #8b5cf6;
}
.profile-photo-viewer {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0,0,0,.94);
    display: grid;
    place-items: center;
    padding: 64px 18px 42px;
}
.profile-photo-viewer-top {
    position: absolute;
    top: 12px;
    left: 16px;
    right: 16px;
    height: 46px;
    display: grid;
    grid-template-columns: 44px 1fr 44px 44px;
    align-items: center;
    gap: 8px;
    color: #fff;
    z-index: 4;
}
.profile-photo-viewer-top button,
.profile-photo-nav {
    border: 0;
    border-radius: 50%;
    background: rgba(255,255,255,.08);
    color: #fff;
    cursor: pointer;
    display: grid;
    place-items: center;
    backdrop-filter: blur(12px);
}
.profile-photo-back,
.profile-photo-close,
.profile-photo-more {
    width: 44px;
    height: 44px;
    font-size: 1.8rem;
}
.profile-photo-more {
    font-size: 1.1rem;
    letter-spacing: -2px;
}
.profile-photo-viewer-top button svg { width: 22px; height: 22px; }
.profile-photo-nav svg { width: 28px; height: 28px; }
.profile-photo-counter {
    text-align: center;
    font-size: 1.02rem;
}
.profile-photo-viewer-media {
    width: min(980px, 94vw);
    height: min(76vh, 760px);
    display: grid;
    place-items: center;
}
.profile-photo-viewer-media img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    border-radius: 8px;
}
.profile-photo-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 42px;
    height: 66px;
    border-radius: 999px;
    font-size: 2.7rem;
    opacity: .55;
}
.profile-photo-nav.prev { left: 18px; }
.profile-photo-nav.next { right: 18px; }
.profile-photo-caption {
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: 16px;
    color: #fff;
    text-align: center;
    font-weight: 800;
    text-shadow: 0 2px 12px rgba(0,0,0,.6);
}
.profile-photo-menu {
    position: absolute;
    top: 64px;
    right: 16px;
    z-index: 5;
    width: min(320px, calc(100vw - 32px));
    padding: 8px;
    border-radius: 24px;
    background: rgba(31, 33, 39, .88);
    border: 1px solid rgba(255,255,255,.1);
    backdrop-filter: blur(24px);
    box-shadow: 0 24px 70px rgba(0,0,0,.45);
}
.profile-photo-menu.hidden {
    display: none;
}
.profile-photo-menu button {
    width: 100%;
    min-height: 52px;
    border: 0;
    border-radius: 15px;
    padding: 0 12px;
    background: transparent;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 900;
    font-size: .98rem;
    cursor: pointer;
}
.profile-photo-menu button:hover {
    background: rgba(255,255,255,.08);
}
.profile-photo-menu button.danger {
    color: #ff6b6b;
}
/* N: the private chat "⋯" menu reuses this exact component (grey glass popover).
   Only the icon size and a stacking value above the chat header are scoped to it,
   so it looks identical to .group-info-more-menu in light and dark. */
.peer-actions-menu { z-index: 32050; }
.peer-actions-menu button svg { width: 19px; height: 19px; min-width: 19px; }
/* The photo menu takes the same icon column as the chat «⋯» menu. */
.profile-photo-menu button svg { width: 19px; height: 19px; min-width: 19px; }
@media (max-width: 640px) {
    .profile-photos-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 2px;
    }
    .profile-photos-head {
        align-items: flex-start;
        flex-direction: column;
    }
    /* Package 170: the grid stays edge to edge; its head, the album bar and
       the empty-state toolbar keep the phone's side gutter. */
    .profile-photos-head,
    .profile-photos-toolbar,
    .profile-photo-album-bar {
        padding-inline: 12px;
    }
    .profile-photos-head .btn,
    .profile-photos-toolbar .btn {
        width: 100%;
        justify-content: center;
    }
    .profile-photo-viewer {
        padding: 58px 0 48px;
    }
    .profile-photo-viewer-media {
        width: 100vw;
        height: calc(100dvh - 120px);
    }
    .profile-photo-viewer-media img {
        border-radius: 0;
    }
    .profile-photo-nav:not(body:has(.feed-page) .feed-post-media-viewer .profile-photo-nav) {
        display: none;
    }
}


/* ===== Stage 21B: profile photo albums ===== */
.profile-photo-albums {
    display: grid;
    gap: 12px;
}
.profile-section-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.profile-section-title-row h3 {
    margin: 0;
    font-size: 1.35rem;
}
.profile-photo-mini-btn {
    min-height: 36px;
    padding: 0 14px;
    border: 1px solid rgba(139,92,246,.25);
    border-radius: 999px;
    background: rgba(139,92,246,.12);
    color: var(--accent, #8b5cf6);
    font-weight: 900;
    cursor: pointer;
}
.profile-photo-album-row {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(170px, 210px);
    gap: 14px;
    overflow-x: auto;
    padding: 2px 2px 8px;
    scrollbar-width: thin;
}
.profile-photo-album-card {
    border: 1px solid rgba(148,163,184,.14);
    border-radius: 22px;
    background: rgba(15,23,42,.40);
    padding: 10px;
    text-align: left;
    color: var(--text);
    cursor: pointer;
    transition: transform .16s ease, border-color .16s ease, background .16s ease;
}
body.theme-light .profile-photo-album-card {
    background: rgba(255,255,255,.8);
}
.profile-photo-album-card:hover,
.profile-photo-album-card.active {
    transform: translateY(-2px);
    border-color: rgba(139,92,246,.45);
    background: rgba(139,92,246,.13);
}
.profile-photo-album-cover {
    width: 100%;
    aspect-ratio: 16 / 10;
    border-radius: 16px;
    overflow: hidden;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, rgba(109,93,252,.35), rgba(139,92,246,.16));
    margin-bottom: 10px;
}
.profile-photo-album-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.profile-photo-album-cover i {
    color: #fff;
    font-style: normal;
    font-size: 2rem;
    font-weight: 900;
}
.profile-photo-album-card b,
.profile-photo-album-card small {
    display: block;
}
.profile-photo-album-card b {
    font-size: .98rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.profile-photo-album-card small {
    margin-top: 3px;
    color: var(--text-muted);
    font-weight: 800;
}
@media (max-width: 640px) {
    .profile-photo-album-row {
        grid-auto-columns: minmax(138px, 160px);
        gap: 10px;
    }
    .profile-photo-album-card {
        border-radius: 18px;
        padding: 8px;
    }
    .profile-photo-album-cover {
        border-radius: 13px;
    }
}


/* Stage 21C compact cards are intentionally excluded from global full-screen
   modal promotion by ui/mobile_modals.js (Phase 1AD). */
/* ===== Stage 21C: custom photo album modals/actions ===== */
.profile-photo-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 10020;
    background: rgba(0,0,0,.54);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    display: grid;
    place-items: center;
    padding: 18px;
}
.profile-photo-modal-card {
    position: relative;
    width: min(520px, 100%);
    border-radius: 28px;
    padding: 26px;
    background: rgba(17, 24, 39, .94);
    border: 1px solid rgba(255,255,255,.12);
    color: #fff;
    box-shadow: 0 30px 90px rgba(0,0,0,.45);
}
body.theme-light .profile-photo-modal-card {
    background: rgba(255,255,255,.96);
    color: #0f172a;
}
.profile-photo-modal-card h3 {
    margin: 0 0 16px;
    font-size: 1.45rem;
}
.profile-photo-modal-card p {
    margin: -4px 0 18px;
    color: var(--text-muted);
    font-weight: 700;
}
.profile-photo-modal-card label {
    display: block;
    margin: 0 0 8px;
    color: var(--text-muted);
    font-weight: 900;
}
.profile-photo-modal-input {
    width: 100%;
    min-height: 52px;
    border-radius: 16px;
    border: 1px solid rgba(139,92,246,.36);
    background: rgba(255,255,255,.06);
    color: inherit;
    padding: 0 15px;
    outline: none;
    font-weight: 800;
}
body.theme-light .profile-photo-modal-input {
    background: rgba(15,23,42,.04);
}
.profile-photo-modal-input:focus {
    border-color: rgba(139,92,246,.75);
    box-shadow: 0 0 0 4px rgba(139,92,246,.14);
}
.profile-photo-modal-actions {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}
.profile-photo-modal-actions .btn {
    min-width: 118px;
}
.profile-photo-modal-actions .btn.danger {
    background: linear-gradient(135deg, #ef4444, #f97316);
    color: #fff;
}
.profile-photo-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 50%;
    background: rgba(148,163,184,.14);
    color: inherit;
    font-size: 1.65rem;
    line-height: 1;
    cursor: pointer;
}
.profile-photo-album-wrap {
    position: relative;
}
.profile-photo-album-wrap .profile-photo-album-card {
    width: 100%;
    height: 100%;
}
.profile-photo-album-more {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: rgba(0,0,0,.42);
    color: #fff;
    font-weight: 900;
    letter-spacing: -2px;
    display: grid;
    place-items: center;
    cursor: pointer;
    backdrop-filter: blur(10px);
}
.profile-photo-actions-card {
    width: min(360px, 100%);
    padding: 10px;
    border-radius: 26px;
    background: rgba(24, 24, 28, .94);
    border: 1px solid rgba(255,255,255,.1);
    box-shadow: 0 30px 90px rgba(0,0,0,.48);
}
.profile-photo-actions-card button {
    width: 100%;
    min-height: 52px;
    border: 0;
    border-radius: 16px;
    background: transparent;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 14px;
    font-weight: 900;
    font-size: 1rem;
    cursor: pointer;
}
.profile-photo-actions-card button:hover {
    background: rgba(255,255,255,.08);
}
.profile-photo-actions-card button.danger {
    color: #ff6b6b;
}
.profile-photo-actions-card button[data-action="cancel"] {
    justify-content: center;
    background: rgba(255,255,255,.08);
    margin-top: 6px;
}
.profile-photo-move-card {
    max-width: 480px;
}
.profile-photo-move-list {
    display: grid;
    gap: 8px;
}
.profile-photo-move-list button {
    width: 100%;
    min-height: 52px;
    border: 0;
    border-radius: 16px;
    background: rgba(139,92,246,.12);
    color: inherit;
    text-align: left;
    padding: 0 14px;
    font-weight: 900;
    cursor: pointer;
}
.profile-photo-move-list button:hover {
    background: rgba(139,92,246,.22);
}
@media (max-width: 640px) {
    .profile-photo-modal-overlay {
        align-items: end;
        padding: 10px;
    }
    .profile-photo-modal-card,
    .profile-photo-actions-card {
        width: 100%;
        border-radius: 26px;
    }
    .profile-photo-modal-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
}


/* ===== Stage 21D: photo likes/comments + stable album covers ===== */
/* Instagram: hovering a tile darkens it and shows ♥ and 💬 counts in the
   middle; phones (no hover) show the clean grid. */
.profile-photo-tile-meta {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 22px;
    background: rgba(0, 0, 0, .32);
    color: #fff;
    font-style: normal;
    font-size: 1rem;
    font-weight: 800;
    opacity: 0;
    transition: opacity .16s ease;
    pointer-events: none;
}
.profile-photo-tile-meta b {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
@media (hover: hover) {
    .profile-photo-tile:hover .profile-photo-tile-meta,
    .profile-photo-tile:focus-visible .profile-photo-tile-meta {
        opacity: 1;
    }
}
.profile-photo-socialbar {
    position: absolute;
    left: 50%;
    bottom: 54px;
    transform: translateX(-50%);
    z-index: 4;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 999px;
    background: rgba(15,23,42,.48);
    border: 1px solid rgba(255,255,255,.10);
    backdrop-filter: blur(16px);
}
.profile-photo-socialbar button {
    min-width: 74px;
    height: 42px;
    border: 0;
    border-radius: 999px;
    background: rgba(255,255,255,.08);
    color: #fff;
    font-weight: 950;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
}
.profile-photo-socialbar button:hover {
    background: rgba(255,255,255,.14);
}
.profile-photo-like-btn.liked {
    color: #fb7185;
    background: rgba(244,63,94,.16);
}
.profile-photo-comments-panel {
    position: absolute;
    right: 18px;
    bottom: 112px;
    width: min(390px, calc(100vw - 36px));
    max-height: min(480px, 58vh);
    z-index: 6;
    border-radius: 26px;
    background: rgba(24,24,28,.92);
    border: 1px solid rgba(255,255,255,.10);
    box-shadow: 0 26px 80px rgba(0,0,0,.48);
    backdrop-filter: blur(24px);
    overflow: hidden;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
}
.profile-photo-comments-panel.hidden {
    display: none;
}
.profile-photo-comments-list {
    overflow-y: auto;
    padding: 12px;
    display: grid;
    gap: 10px;
}
.profile-photo-comment {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 10px;
    color: #fff;
}
.profile-photo-comment-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    overflow: hidden;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #6d5dfc, #8b5cf6);
    color: #fff;
    font-weight: 900;
}
.profile-photo-comment-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.profile-photo-comment b {
    display: block;
    font-size: .9rem;
    margin-bottom: 2px;
}
.profile-photo-comment p {
    margin: 0;
    color: rgba(255,255,255,.82);
    line-height: 1.35;
    word-break: break-word;
}
.profile-photo-no-comments {
    min-height: 86px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    text-align: center;
    color: rgba(255,255,255,.58);
    background: rgba(255,255,255,.06);
    font-weight: 800;
}
.profile-photo-comment-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 42px;
    gap: 8px;
    padding: 10px;
    border-top: 1px solid rgba(255,255,255,.08);
}
.profile-photo-comment-form input {
    height: 42px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,.12);
    background: rgba(255,255,255,.08);
    color: #fff;
    padding: 0 13px;
    outline: none;
}
.profile-photo-comment-form button {
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 50%;
    color: #fff;
    background: linear-gradient(135deg, #6d5dfc, #8b5cf6);
    cursor: pointer;
    font-weight: 900;
}
@media (max-width: 640px) {
    .profile-photo-tile-meta {
        display: none;
    }
    .profile-photo-socialbar {
        bottom: 50px;
    }
    .profile-photo-comments-panel {
        left: 10px;
        right: 10px;
        bottom: 104px;
        width: auto;
        max-height: 50vh;
    }
}


/* ===== Stage 21E: VK-like photo likers and comments ===== */
.profile-photo-liked-summary {
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: 102px;
    z-index: 4;
    min-height: 44px;
    border: 0;
    border-top: 1px solid rgba(255,255,255,.10);
    border-bottom: 1px solid rgba(255,255,255,.10);
    background: rgba(15,23,42,.34);
    color: rgba(255,255,255,.76);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 12px;
    text-align: left;
    cursor: pointer;
    backdrop-filter: blur(10px);
}
.profile-photo-liked-summary.hidden {
    display: none;
}
.profile-photo-liked-summary b {
    font-size: .95rem;
    color: rgba(255,255,255,.78);
}
.profile-photo-socialbar {
    left: 18px !important;
    right: 18px !important;
    bottom: 54px !important;
    transform: none !important;
    justify-content: space-between;
    border-radius: 0 !important;
    background: rgba(0,0,0,.22) !important;
    border: 0 !important;
    border-top: 1px solid rgba(255,255,255,.08) !important;
    padding: 8px 0 !important;
}
.profile-photo-socialbar button {
    min-width: 74px !important;
    height: 42px !important;
    background: transparent !important;
    color: rgba(255,255,255,.88) !important;
    border-radius: 12px !important;
    font-size: 1.25rem;
}
.profile-photo-socialbar button svg {
    width: 28px;
    height: 28px;
}
.profile-photo-socialbar button span {
    font-size: 1.05rem;
}
.profile-photo-socialbar button.liked {
    color: #fb7185 !important;
}
.profile-photo-socialbar button:hover {
    background: rgba(255,255,255,.08) !important;
}
.profile-photo-likers-sheet {
    position: absolute;
    inset: 0;
    z-index: 20;
    background: rgba(0,0,0,.54);
    backdrop-filter: blur(12px);
    display: grid;
    place-items: center;
    padding: 16px;
}
.profile-photo-likers-card {
    width: min(480px, 100%);
    max-height: min(720px, 86vh);
    border-radius: 28px;
    background: rgba(24,24,28,.96);
    color: #fff;
    overflow: hidden;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    box-shadow: 0 28px 90px rgba(0,0,0,.52);
}
.profile-photo-likers-head {
    min-height: 86px;
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.profile-photo-likers-close {
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: rgba(255,255,255,.08);
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
}
.profile-photo-likers-head h3 {
    margin: 0;
    font-size: 1.35rem;
}
.profile-photo-likers-head p {
    margin: 4px 0 0;
    color: rgba(255,255,255,.62);
    font-weight: 800;
}
.profile-photo-likers-list {
    overflow-y: auto;
    padding: 8px;
}
.profile-photo-user-row {
    width: 100%;
    min-height: 66px;
    border: 0;
    border-radius: 18px;
    background: transparent;
    color: #fff;
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) 42px;
    gap: 12px;
    align-items: center;
    text-align: left;
    padding: 8px;
    cursor: pointer;
}
.profile-photo-user-row:hover {
    background: rgba(255,255,255,.08);
}
.profile-photo-user-avatar {
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: visible;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #6d5dfc, #8b5cf6);
    color: #fff;
    font-weight: 900;
}
.profile-photo-user-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}
.profile-photo-user-avatar.online::after,
.profile-photo-comment-avatar.online::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: 0;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #31d158;
    border: 2px solid rgba(24,24,28,.96);
}
.profile-photo-user-info b,
.profile-photo-user-info small {
    display: block;
}
.profile-photo-user-info b {
    font-size: 1rem;
}
.profile-photo-user-info small {
    color: rgba(255,255,255,.58);
    margin-top: 3px;
    font-weight: 800;
}
.profile-photo-user-info small.online {
    color: #31d158;
}
.profile-photo-user-follow {
    width: 38px;
    height: 38px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    color: #fff;
    background: rgba(109,93,252,.28);
    border: 1px solid rgba(139,92,246,.38);
    font-weight: 950;
    font-size: 1.45rem;
}
.profile-photo-user-follow.following {
    font-size: 1.05rem;
    background: rgba(49,209,88,.18);
    color: #31d158;
}
.profile-photo-comments-panel {
    left: 18px !important;
    right: 18px !important;
    bottom: 112px !important;
    width: auto !important;
    max-height: min(520px, 58vh) !important;
}
.profile-photo-comment {
    grid-template-columns: 42px minmax(0, 1fr) !important;
}
.profile-photo-comment-avatar {
    position: relative;
    overflow: visible !important;
}
.profile-photo-comment-avatar img {
    border-radius: 50%;
}
.profile-photo-comment-author {
    border: 0;
    background: transparent;
    color: #fff;
    padding: 0;
    margin: 0 0 2px;
    font-weight: 950;
    cursor: pointer;
}
.profile-photo-comment small {
    display: block;
    color: rgba(255,255,255,.52);
    font-size: .78rem;
    font-weight: 800;
    margin-bottom: 4px;
}
/* «Удалить» sits in the time line and takes its colour and size in every theme.
   The global button rules set font-size 16px (the iOS no-zoom rule for inputs)
   and weight 640 with !important; this text-sized control is not an input, so
   it takes the line's size and weight with !important too. */
.profile-photo-comment-delete {
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    padding: 0;
    cursor: pointer;
}
.profile-photo-comment small .profile-photo-comment-delete {
    font-size: inherit !important;
    font-weight: inherit !important;
}
.profile-photo-comment-delete:hover,
.profile-photo-comment-delete:focus-visible {
    text-decoration: underline;
}
.profile-photo-comment-delete:disabled {
    opacity: .5;
    cursor: default;
}
.profile-photo-comment-form {
    grid-template-columns: 42px minmax(0, 1fr) 42px !important;
}
.profile-photo-comment-form::before {
    content: "+";
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: rgba(255,255,255,.86);
    background: rgba(255,255,255,.08);
    font-size: 1.8rem;
    line-height: 1;
}
.profile-photo-comment-form button {
    border-radius: 16px !important;
    background: linear-gradient(135deg, #6d5dfc, #8b5cf6) !important;
}
@media (max-width: 640px) {
    .profile-photo-liked-summary {
        bottom: 100px;
        left: 0;
        right: 0;
        border-radius: 0;
    }
    .profile-photo-socialbar {
        left: 0 !important;
        right: 0 !important;
        bottom: 46px !important;
        padding: 6px 14px !important;
    }
    .profile-photo-comments-panel {
        left: 0 !important;
        right: 0 !important;
        bottom: 98px !important;
        max-height: 54vh !important;
        border-radius: 24px 24px 0 0 !important;
    }
    .profile-photo-likers-sheet {
        padding: 0;
        align-items: stretch;
    }
    .profile-photo-likers-card {
        width: 100%;
        height: 100%;
        max-height: none;
        border-radius: 0;
    }
}


/* ===== Stage 21F: VK-like photo viewer layout fix ===== */

/* Viewer becomes a VK-like scroll page: photo, liked row, actions, comments under photo. */
.profile-photo-viewer {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;
    place-items: unset !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 68px 0 0 !important;
    background: rgba(0,0,0,.94) !important;
}

.profile-photo-viewer-media {
    width: min(820px, 100vw) !important;
    height: auto !important;
    max-height: none !important;
    display: grid !important;
    place-items: center !important;
    background: transparent !important;
}

.profile-photo-viewer-media img {
    display: block !important;
    width: auto !important;
    max-width: min(820px, 100vw) !important;
    max-height: calc(100vh - 190px) !important;
    object-fit: contain !important;
    border-radius: 0 !important;
    background: #000 !important;
}

.profile-photo-caption {
    position: static !important;
    width: min(820px, 100vw) !important;
    min-height: 0 !important;
    padding: 10px 18px 0 !important;
    color: rgba(255,255,255,.9) !important;
    text-align: left !important;
    font-weight: 800 !important;
    text-shadow: none !important;
}

/* VK-like liked row directly below the photo. */
.profile-photo-liked-summary {
    position: static !important;
    width: min(820px, 100vw) !important;
    min-height: 48px !important;
    margin: 0 !important;
    border: 0 !important;
    border-top: 1px solid rgba(255,255,255,.10) !important;
    border-bottom: 1px solid rgba(255,255,255,.08) !important;
    background: rgba(18,18,22,.94) !important;
    color: rgba(255,255,255,.72) !important;
    display: flex !important;
    align-items: center !important;
    gap: 9px !important;
    padding: 0 18px !important;
    cursor: pointer !important;
    text-align: left !important;
    transform: none !important;
    backdrop-filter: none !important;
}

.profile-photo-liked-summary.hidden {
    display: none !important;
}

.profile-photo-liked-summary b {
    color: rgba(255,255,255,.72) !important;
    font-size: .98rem !important;
    font-weight: 900 !important;
}

.profile-photo-liked-summary small {
    margin-left: auto;
    color: rgba(255,255,255,.44);
    font-weight: 800;
}

/* Clean VK-like action bar. No weird horizontal overlay under icons. */
.profile-photo-socialbar {
    position: static !important;
    width: min(820px, 100vw) !important;
    min-height: 58px !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    transform: none !important;
    display: grid !important;
    grid-template-columns: 1fr 1fr 1fr !important;
    align-items: center !important;
    justify-items: center !important;
    margin: 0 !important;
    padding: 0 14px !important;
    border: 0 !important;
    border-bottom: 1px solid rgba(255,255,255,.08) !important;
    border-radius: 0 !important;
    background: rgba(18,18,22,.94) !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
}

.profile-photo-socialbar button {
    width: 100% !important;
    min-width: 0 !important;
    height: 48px !important;
    border: 0 !important;
    border-radius: 12px !important;
    background: transparent !important;
    color: rgba(255,255,255,.86) !important;
    box-shadow: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 9px !important;
    font-weight: 950 !important;
    cursor: pointer !important;
}

.profile-photo-socialbar button:hover {
    background: rgba(255,255,255,.07) !important;
}

.profile-photo-socialbar button svg {
    width: 28px !important;
    height: 28px !important;
    display: block !important;
}

.profile-photo-like-btn.liked,
.profile-photo-socialbar button.liked {
    color: #fb7185 !important;
    background: rgba(244,63,94,.10) !important;
}

.profile-photo-socialbar button span {
    font-size: 1.08rem !important;
    font-weight: 950 !important;
}

/* Comments are a section under the photo, not a floating layer over it. */
.profile-photo-comments-panel {
    position: static !important;
    width: min(820px, 100vw) !important;
    max-height: none !important;
    min-height: 0 !important;
    margin: 0 0 80px !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    border-radius: 0 !important;
    border: 0 !important;
    background: rgba(18,18,22,.98) !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    display: grid !important;
    grid-template-rows: minmax(0, auto) auto !important;
}

.profile-photo-comments-panel.hidden {
    display: none !important;
}

.profile-photo-comments-list {
    max-height: none !important;
    overflow: visible !important;
    padding: 12px 18px !important;
    display: grid !important;
    gap: 12px !important;
}

.profile-photo-comment {
    display: grid !important;
    grid-template-columns: 44px minmax(0, 1fr) !important;
    gap: 11px !important;
    padding: 6px 0 !important;
    color: #fff !important;
}

.profile-photo-comment-avatar {
    width: 44px !important;
    height: 44px !important;
}

.profile-photo-comment-author {
    color: rgba(255,255,255,.95) !important;
    font-size: .98rem !important;
}

.profile-photo-comment small {
    color: rgba(255,255,255,.46) !important;
}

.profile-photo-comment p {
    color: rgba(255,255,255,.86) !important;
    font-size: .98rem !important;
}

.profile-photo-comment-form {
    position: sticky !important;
    bottom: 0 !important;
    display: grid !important;
    grid-template-columns: 44px minmax(0, 1fr) 48px !important;
    gap: 9px !important;
    padding: 12px 16px !important;
    border-top: 1px solid rgba(255,255,255,.08) !important;
    background: rgba(18,18,22,.98) !important;
}

.profile-photo-comment-form input {
    height: 46px !important;
    border-radius: 999px !important;
    background: rgba(255,255,255,.10) !important;
    border: 1px solid rgba(255,255,255,.10) !important;
    color: #fff !important;
}

.profile-photo-comment-form button {
    width: 48px !important;
    height: 46px !important;
    border-radius: 16px !important;
    background: linear-gradient(135deg, #6d5dfc, #8b5cf6) !important;
}

/* Big separate VK-like likers window. */
.profile-photo-likers-sheet {
    position: fixed !important;
    inset: 0 !important;
    z-index: 10040 !important;
    background: rgba(0,0,0,.72) !important;
    backdrop-filter: blur(14px) !important;
    -webkit-backdrop-filter: blur(14px) !important;
    display: grid !important;
    place-items: center !important;
    padding: 16px !important;
}

.profile-photo-likers-card {
    width: min(560px, 100%) !important;
    height: min(760px, 92vh) !important;
    max-height: 92vh !important;
    border-radius: 30px !important;
    background: rgba(24,24,28,.98) !important;
    color: #fff !important;
    overflow: hidden !important;
    display: grid !important;
    grid-template-rows: auto minmax(0, 1fr) !important;
    box-shadow: 0 32px 110px rgba(0,0,0,.62) !important;
}

.profile-photo-likers-head {
    min-height: 92px !important;
    grid-template-columns: 54px minmax(0, 1fr) !important;
    border-bottom: 1px solid rgba(255,255,255,.10) !important;
}

.profile-photo-likers-head h3 {
    font-size: 1.55rem !important;
}

.profile-photo-likers-head p {
    color: rgba(255,255,255,.62) !important;
}

.profile-photo-likers-list {
    overflow-y: auto !important;
    padding: 10px !important;
}

/* Keep nav arrows over photo but outside content. */
.profile-photo-nav {
    position: fixed !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    z-index: 5 !important;
}

.profile-photo-nav.prev { left: 18px !important; }
.profile-photo-nav.next { right: 18px !important; }

@media (max-width: 640px) {
    .profile-photo-viewer {
        padding-top: 58px !important;
    }

    .profile-photo-viewer-media,
    .profile-photo-liked-summary,
    .profile-photo-socialbar,
    .profile-photo-comments-panel {
        width: 100vw !important;
    }

    .profile-photo-viewer-media img {
        max-width: 100vw !important;
        max-height: calc(100dvh - 190px) !important;
    }

    .profile-photo-liked-summary {
        min-height: 44px !important;
        padding: 0 14px !important;
    }

    .profile-photo-socialbar {
        min-height: 54px !important;
    }

    .profile-photo-comments-panel {
        margin-bottom: 0 !important;
    }

    .profile-photo-likers-sheet {
        padding: 0 !important;
        place-items: stretch !important;
    }

    .profile-photo-likers-card {
        width: 100% !important;
        height: 100% !important;
        max-height: none !important;
        border-radius: 0 !important;
    }
}


/* ===== Stage 21G: hard VK-like photo viewer layout cleanup ===== */

/* Global viewer page: centered column, no overlay bars stretching across desktop */
.profile-photo-viewer {
    --vk-photo-width: min(760px, calc(100vw - 280px));
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 76px 0 34px !important;
    background: rgba(0, 0, 0, .94) !important;
}

/* Real photo area */
.profile-photo-viewer-media {
    position: static !important;
    width: var(--vk-photo-width) !important;
    max-width: var(--vk-photo-width) !important;
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    display: grid !important;
    place-items: center !important;
    margin: 0 auto !important;
    background: transparent !important;
}

.profile-photo-viewer-media img {
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: calc(100vh - 225px) !important;
    object-fit: contain !important;
    display: block !important;
    margin: 0 auto !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

/* Caption, likes row, actions, comments — same width as photo */
.profile-photo-caption,
.profile-photo-liked-summary,
.profile-photo-socialbar,
.profile-photo-comments-panel {
    position: static !important;
    width: var(--vk-photo-width) !important;
    max-width: var(--vk-photo-width) !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    bottom: auto !important;
    transform: none !important;
    margin-left: auto !important;
    margin-right: auto !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

/* Caption directly under photo if it exists */
.profile-photo-caption {
    padding: 10px 16px 0 !important;
    min-height: 0 !important;
    color: rgba(255,255,255,.9) !important;
    text-align: left !important;
    font-weight: 800 !important;
    background: rgba(18,18,22,.96) !important;
    text-shadow: none !important;
}

/* "Liked by" row like VK, not floating overlay */
.profile-photo-liked-summary {
    min-height: 48px !important;
    padding: 0 16px !important;
    border: 0 !important;
    border-top: 1px solid rgba(255,255,255,.10) !important;
    border-bottom: 1px solid rgba(255,255,255,.08) !important;
    background: rgba(18,18,22,.96) !important;
    color: rgba(255,255,255,.72) !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
}

.profile-photo-liked-summary.hidden {
    display: none !important;
}

.profile-photo-liked-summary b {
    color: rgba(255,255,255,.74) !important;
    font-size: .98rem !important;
    font-weight: 900 !important;
}

.profile-photo-liked-summary small {
    margin-left: auto !important;
    color: rgba(255,255,255,.45) !important;
    font-size: .82rem !important;
    font-weight: 900 !important;
}

/* Clean actions row. No colored stripe/line under icons. */
.profile-photo-socialbar {
    min-height: 58px !important;
    padding: 0 8px !important;
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    align-items: center !important;
    justify-items: stretch !important;
    gap: 0 !important;
    border: 0 !important;
    border-bottom: 1px solid rgba(255,255,255,.08) !important;
    background: rgba(18,18,22,.96) !important;
}

.profile-photo-socialbar button,
.profile-photo-socialbar button:hover,
.profile-photo-socialbar button:focus,
.profile-photo-socialbar button:active {
    width: 100% !important;
    height: 50px !important;
    min-width: 0 !important;
    border: 0 !important;
    border-radius: 12px !important;
    background: transparent !important;
    box-shadow: none !important;
    outline: none !important;
    color: rgba(255,255,255,.86) !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    font-weight: 950 !important;
}

.profile-photo-socialbar button:hover {
    background: rgba(255,255,255,.06) !important;
}

.profile-photo-socialbar button.liked,
.profile-photo-socialbar .profile-photo-like-btn.liked {
    color: #fb7185 !important;
    background: transparent !important;
}

.profile-photo-socialbar button svg {
    width: 28px !important;
    height: 28px !important;
    display: block !important;
}

.profile-photo-socialbar button span {
    font-size: 1.05rem !important;
    font-weight: 950 !important;
}

/* Comments open as an inline section under actions. */
.profile-photo-comments-panel {
    display: grid !important;
    grid-template-rows: minmax(0, auto) auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    margin-bottom: 48px !important;
    border: 0 !important;
    background: rgba(18,18,22,.98) !important;
    scroll-margin-top: 82px !important;
}

.profile-photo-comments-panel.hidden {
    display: none !important;
}

.profile-photo-comments-list {
    max-height: none !important;
    overflow: visible !important;
    padding: 12px 16px !important;
    display: grid !important;
    gap: 12px !important;
}

.profile-photo-no-comments {
    min-height: 84px !important;
    border-radius: 18px !important;
    background: rgba(255,255,255,.07) !important;
}

.profile-photo-comment {
    display: grid !important;
    grid-template-columns: 44px minmax(0, 1fr) !important;
    gap: 11px !important;
    padding: 6px 0 !important;
}

.profile-photo-comment-avatar {
    width: 44px !important;
    height: 44px !important;
}

.profile-photo-comment-author {
    color: rgba(255,255,255,.96) !important;
    font-size: .98rem !important;
    font-weight: 950 !important;
    text-align: left !important;
}

.profile-photo-comment small {
    color: rgba(255,255,255,.48) !important;
    font-weight: 800 !important;
}

.profile-photo-comment p {
    color: rgba(255,255,255,.86) !important;
    font-size: .98rem !important;
    line-height: 1.38 !important;
}

/* Comment input stays under the comments section */
.profile-photo-comment-form {
    position: sticky !important;
    bottom: 0 !important;
    display: grid !important;
    grid-template-columns: 44px minmax(0, 1fr) 48px !important;
    gap: 9px !important;
    padding: 12px 16px !important;
    border-top: 1px solid rgba(255,255,255,.08) !important;
    background: rgba(18,18,22,.98) !important;
}

.profile-photo-comment-form::before {
    width: 44px !important;
    height: 44px !important;
    border-radius: 50% !important;
    background: rgba(255,255,255,.08) !important;
}

.profile-photo-comment-form input {
    height: 44px !important;
    border-radius: 999px !important;
    background: rgba(255,255,255,.10) !important;
    border: 1px solid rgba(255,255,255,.12) !important;
    color: #fff !important;
}

.profile-photo-comment-form button {
    width: 48px !important;
    height: 44px !important;
    border-radius: 16px !important;
    background: linear-gradient(135deg, #6d5dfc, #8b5cf6) !important;
}

/* Top bar and arrows stay fixed, not part of the content column */
.profile-photo-viewer-top {
    position: fixed !important;
    top: 12px !important;
    left: 16px !important;
    right: 16px !important;
    z-index: 30 !important;
}

.profile-photo-nav {
    position: fixed !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    z-index: 24 !important;
    background: rgba(255,255,255,.08) !important;
    box-shadow: none !important;
}

.profile-photo-nav.prev { left: 22px !important; }
.profile-photo-nav.next { right: 22px !important; }

/* Likers modal remains separate and centered */
.profile-photo-likers-sheet {
    position: fixed !important;
    inset: 0 !important;
    z-index: 10050 !important;
    display: grid !important;
    place-items: center !important;
    background: rgba(0,0,0,.72) !important;
    backdrop-filter: blur(14px) !important;
    -webkit-backdrop-filter: blur(14px) !important;
}

.profile-photo-likers-card {
    width: min(560px, calc(100vw - 28px)) !important;
    height: min(760px, calc(100vh - 40px)) !important;
    max-height: calc(100vh - 40px) !important;
    border-radius: 30px !important;
}

/* Mobile: full-width VK photo page. Comments really go below photo/actions. */
@media (max-width: 760px) {
    .profile-photo-viewer {
        --vk-photo-width: 100vw;
        padding-top: 58px !important;
        padding-bottom: 0 !important;
    }

    .profile-photo-viewer-media,
    .profile-photo-caption,
    .profile-photo-liked-summary,
    .profile-photo-socialbar,
    .profile-photo-comments-panel {
        width: 100vw !important;
        max-width: 100vw !important;
    }

    .profile-photo-viewer-media img {
        max-width: 100vw !important;
        max-height: calc(100dvh - 190px) !important;
    }

    .profile-photo-liked-summary {
        min-height: 44px !important;
        padding: 0 14px !important;
    }

    .profile-photo-socialbar {
        min-height: 54px !important;
        padding: 0 10px !important;
    }

    .profile-photo-comments-panel {
        margin-bottom: 0 !important;
        scroll-margin-top: 64px !important;
    }

    .profile-photo-comment-form {
        padding-bottom: max(12px, env(safe-area-inset-bottom)) !important;
    }

    .profile-photo-likers-sheet {
        padding: 0 !important;
        place-items: stretch !important;
    }

    .profile-photo-likers-card {
        width: 100% !important;
        height: 100% !important;
        max-height: none !important;
        border-radius: 0 !important;
    }
}


/* ===== Stage 21H: strict centered VK photo column ===== */

/*
   21G made comments inline, but the lower block was still wider than the photo.
   This hard-fix forces the viewer into one centered VK-like column:
   image width == liked row width == actions width == comments width.
*/
body .profile-photo-viewer {
    --vk-photo-width: clamp(340px, 36vw, 620px) !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 76px 0 42px !important;
    background: rgba(0, 0, 0, .94) !important;
}

body .profile-photo-viewer > .profile-photo-viewer-media,
body .profile-photo-viewer > .profile-photo-caption,
body .profile-photo-viewer > .profile-photo-liked-summary,
body .profile-photo-viewer > .profile-photo-socialbar,
body .profile-photo-viewer > .profile-photo-comments-panel {
    width: var(--vk-photo-width) !important;
    max-width: var(--vk-photo-width) !important;
    min-width: 0 !important;
    margin-left: auto !important;
    margin-right: auto !important;
    position: static !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    bottom: auto !important;
    transform: none !important;
    box-sizing: border-box !important;
}

body .profile-photo-viewer > .profile-photo-viewer-media {
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    display: block !important;
    background: #000 !important;
    line-height: 0 !important;
    overflow: hidden !important;
}

body .profile-photo-viewer > .profile-photo-viewer-media img {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: none !important;
    object-fit: contain !important;
    margin: 0 !important;
    border-radius: 0 !important;
    background: #000 !important;
}

/* No empty huge top/bottom overlays under the image. */
body .profile-photo-caption {
    display: block !important;
    padding: 10px 16px 0 !important;
    background: rgba(18, 18, 22, .98) !important;
    color: rgba(255,255,255,.88) !important;
    text-align: left !important;
    font-weight: 800 !important;
    text-shadow: none !important;
}

body .profile-photo-caption:empty {
    display: none !important;
}

/* Liked summary exactly under photo. */
body .profile-photo-liked-summary {
    min-height: 46px !important;
    padding: 0 16px !important;
    border: 0 !important;
    border-top: 1px solid rgba(255,255,255,.09) !important;
    border-bottom: 1px solid rgba(255,255,255,.07) !important;
    border-radius: 0 !important;
    background: rgba(18, 18, 22, .98) !important;
    color: rgba(255,255,255,.72) !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
}

body .profile-photo-liked-summary.hidden {
    display: none !important;
}

/* Clean centered action row; remove accidental underline/stripe/pill shifts. */
body .profile-photo-socialbar {
    min-height: 56px !important;
    padding: 0 8px !important;
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    align-items: center !important;
    justify-items: stretch !important;
    gap: 0 !important;
    border: 0 !important;
    border-bottom: 1px solid rgba(255,255,255,.08) !important;
    border-radius: 0 !important;
    background: rgba(18, 18, 22, .98) !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
}

body .profile-photo-socialbar button,
body .profile-photo-socialbar button:hover,
body .profile-photo-socialbar button:active,
body .profile-photo-socialbar button:focus {
    width: 100% !important;
    height: 48px !important;
    min-width: 0 !important;
    border: 0 !important;
    border-radius: 12px !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    outline: none !important;
    color: rgba(255,255,255,.88) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
}

body .profile-photo-socialbar button:hover {
    background: rgba(255,255,255,.055) !important;
}

body .profile-photo-socialbar button.liked,
body .profile-photo-socialbar .profile-photo-like-btn.liked {
    color: #fb7185 !important;
    background: transparent !important;
}

/* Comments are attached to the same column under actions. */
body .profile-photo-comments-panel {
    display: grid !important;
    grid-template-rows: auto auto !important;
    max-height: none !important;
    min-height: 0 !important;
    overflow: visible !important;
    margin: 0 auto 44px !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: rgba(18, 18, 22, .99) !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    scroll-margin-top: 86px !important;
}

body .profile-photo-comments-panel.hidden {
    display: none !important;
}

body .profile-photo-comments-list {
    max-height: none !important;
    overflow: visible !important;
    padding: 12px 16px !important;
    background: transparent !important;
}

body .profile-photo-comment-form {
    position: static !important;
    bottom: auto !important;
    width: 100% !important;
    display: grid !important;
    grid-template-columns: 44px minmax(0, 1fr) 48px !important;
    gap: 9px !important;
    padding: 12px 16px !important;
    border-top: 1px solid rgba(255,255,255,.08) !important;
    background: rgba(18, 18, 22, .99) !important;
    box-sizing: border-box !important;
}

/* Fixed top controls/arrows stay separate from the centered content column. */
body .profile-photo-viewer-top {
    position: fixed !important;
    top: 12px !important;
    left: 16px !important;
    right: 16px !important;
    z-index: 40 !important;
}

body .profile-photo-nav {
    position: fixed !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    z-index: 32 !important;
}

body .profile-photo-nav.prev {
    left: 18px !important;
}

body .profile-photo-nav.next {
    right: 18px !important;
}

/* Mobile: one full-width VK column. */
@media (max-width: 760px) {
    body .profile-photo-viewer {
        --vk-photo-width: 100vw !important;
        padding: 58px 0 0 !important;
    }

    body .profile-photo-viewer > .profile-photo-viewer-media,
    body .profile-photo-viewer > .profile-photo-caption,
    body .profile-photo-viewer > .profile-photo-liked-summary,
    body .profile-photo-viewer > .profile-photo-socialbar,
    body .profile-photo-viewer > .profile-photo-comments-panel {
        width: 100vw !important;
        max-width: 100vw !important;
    }

    body .profile-photo-viewer > .profile-photo-viewer-media img {
        width: 100vw !important;
        max-width: 100vw !important;
        height: auto !important;
        max-height: none !important;
    }

    body .profile-photo-liked-summary {
        min-height: 44px !important;
        padding: 0 14px !important;
    }

    body .profile-photo-socialbar {
        min-height: 54px !important;
        padding: 0 10px !important;
    }

    body .profile-photo-comments-panel {
        margin-bottom: 0 !important;
        scroll-margin-top: 64px !important;
    }

    body .profile-photo-comment-form {
        padding-bottom: max(12px, env(safe-area-inset-bottom)) !important;
    }
}


/* ===== Stage 21I: fullscreen photo viewer with bottom footer ===== */

/*
   Final geometry fix:
   The photo viewer must be a real fullscreen gallery, not a profile column.
   Photo fills the screen area, footer is docked to the bottom.
*/

body .profile-photo-viewer {
    position: fixed !important;
    inset: 0 !important;
    z-index: 10000 !important;
    width: 100vw !important;
    height: 100dvh !important;
    min-height: 100vh !important;
    padding: 0 !important;
    margin: 0 !important;
    display: block !important;
    overflow: hidden !important;
    background: rgba(0, 0, 0, .94) !important;
}

/* Top controls stay above the photo */
body .profile-photo-viewer-top {
    position: fixed !important;
    top: 12px !important;
    left: 16px !important;
    right: 16px !important;
    z-index: 60 !important;
    height: 48px !important;
}

/* Photo area: full screen minus top controls and bottom footer */
body .profile-photo-viewer > .profile-photo-viewer-media {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    top: 66px !important;
    bottom: 134px !important;
    width: 100vw !important;
    max-width: 100vw !important;
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 20px !important;
    display: grid !important;
    place-items: center !important;
    background: transparent !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
    line-height: 0 !important;
}

body .profile-photo-viewer > .profile-photo-viewer-media img {
    display: block !important;
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    margin: 0 auto !important;
    border-radius: 0 !important;
    background: #000 !important;
    box-shadow: none !important;
}

/* Caption becomes a small overlay over the photo, not a layout block that pushes footer */
body .profile-photo-caption {
    position: fixed !important;
    left: 50% !important;
    bottom: 150px !important;
    transform: translateX(-50%) !important;
    width: min(760px, calc(100vw - 32px)) !important;
    max-width: min(760px, calc(100vw - 32px)) !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 8px 12px !important;
    border-radius: 14px !important;
    background: rgba(0,0,0,.34) !important;
    color: rgba(255,255,255,.92) !important;
    text-align: left !important;
    font-weight: 800 !important;
    text-shadow: 0 2px 10px rgba(0,0,0,.5) !important;
    backdrop-filter: blur(12px) !important;
    box-sizing: border-box !important;
    z-index: 50 !important;
}

body .profile-photo-caption:empty {
    display: none !important;
}

/* Bottom footer width. On PC it is centered and not stretched to half-screen. */
body .profile-photo-liked-summary,
body .profile-photo-socialbar {
    position: fixed !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: min(760px, calc(100vw - 32px)) !important;
    max-width: min(760px, calc(100vw - 32px)) !important;
    margin: 0 !important;
    border-radius: 0 !important;
    box-sizing: border-box !important;
    z-index: 55 !important;
    backdrop-filter: blur(18px) !important;
    -webkit-backdrop-filter: blur(18px) !important;
}

/* "Liked by" row docks above action row */
body .profile-photo-liked-summary {
    bottom: 76px !important;
    min-height: 48px !important;
    padding: 0 16px !important;
    border: 0 !important;
    border-top: 1px solid rgba(255,255,255,.10) !important;
    border-bottom: 1px solid rgba(255,255,255,.08) !important;
    background: rgba(18,18,22,.88) !important;
    color: rgba(255,255,255,.76) !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    box-shadow: 0 -14px 44px rgba(0,0,0,.28) !important;
}

body .profile-photo-liked-summary.hidden {
    display: none !important;
}

body .profile-photo-liked-summary b {
    color: rgba(255,255,255,.78) !important;
    font-size: .98rem !important;
    font-weight: 900 !important;
}

body .profile-photo-liked-summary small {
    margin-left: auto !important;
    color: rgba(255,255,255,.48) !important;
    font-weight: 900 !important;
}

/* Action row is always at the bottom */
body .profile-photo-socialbar {
    bottom: 20px !important;
    min-height: 56px !important;
    padding: 0 8px !important;
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    align-items: center !important;
    justify-items: stretch !important;
    gap: 0 !important;
    border: 0 !important;
    border-radius: 0 0 18px 18px !important;
    background: rgba(18,18,22,.88) !important;
    box-shadow: 0 18px 50px rgba(0,0,0,.34) !important;
}

body .profile-photo-socialbar button,
body .profile-photo-socialbar button:hover,
body .profile-photo-socialbar button:focus,
body .profile-photo-socialbar button:active {
    width: 100% !important;
    height: 50px !important;
    min-width: 0 !important;
    border: 0 !important;
    outline: 0 !important;
    border-radius: 12px !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    color: rgba(255,255,255,.88) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
}

body .profile-photo-socialbar button:hover {
    background: rgba(255,255,255,.06) !important;
}

body .profile-photo-socialbar button.liked,
body .profile-photo-socialbar .profile-photo-like-btn.liked {
    color: #fb7185 !important;
    background: transparent !important;
}

body .profile-photo-socialbar button svg {
    width: 28px !important;
    height: 28px !important;
    display: block !important;
}

body .profile-photo-socialbar button span {
    font-size: 1.06rem !important;
    font-weight: 950 !important;
}

/* Comments open as a bottom sheet above the footer */
body .profile-photo-comments-panel {
    position: fixed !important;
    left: 50% !important;
    bottom: 20px !important;
    transform: translateX(-50%) !important;
    width: min(760px, calc(100vw - 32px)) !important;
    max-width: min(760px, calc(100vw - 32px)) !important;
    max-height: min(520px, calc(100dvh - 110px)) !important;
    min-height: 220px !important;
    margin: 0 !important;
    border: 1px solid rgba(255,255,255,.10) !important;
    border-radius: 26px !important;
    background: rgba(18,18,22,.96) !important;
    box-shadow: 0 28px 100px rgba(0,0,0,.62) !important;
    backdrop-filter: blur(22px) !important;
    -webkit-backdrop-filter: blur(22px) !important;
    overflow: hidden !important;
    display: grid !important;
    grid-template-rows: minmax(0, 1fr) auto !important;
    z-index: 80 !important;
}

body .profile-photo-comments-panel.hidden {
    display: none !important;
}

body .profile-photo-comments-list {
    overflow-y: auto !important;
    max-height: none !important;
    padding: 14px 16px !important;
    display: grid !important;
    gap: 12px !important;
}

body .profile-photo-comment-form {
    position: static !important;
    bottom: auto !important;
    width: 100% !important;
    display: grid !important;
    grid-template-columns: 44px minmax(0, 1fr) 48px !important;
    gap: 9px !important;
    padding: 12px 16px !important;
    border-top: 1px solid rgba(255,255,255,.08) !important;
    background: rgba(18,18,22,.99) !important;
    box-sizing: border-box !important;
}

/* Arrows are independent from the photo/footer */
body .profile-photo-nav {
    position: fixed !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    z-index: 45 !important;
    background: rgba(255,255,255,.08) !important;
    box-shadow: none !important;
}

body .profile-photo-nav.prev {
    left: 18px !important;
}

body .profile-photo-nav.next {
    right: 18px !important;
}

/* Keep the likers modal fullscreen and above everything */
body .profile-photo-likers-sheet {
    position: fixed !important;
    inset: 0 !important;
    z-index: 10100 !important;
}

/* Mobile: full screen photo, bottom actions at bottom */
@media (max-width: 760px) {
    body .profile-photo-viewer > .profile-photo-viewer-media {
        top: 58px !important;
        bottom: 122px !important;
        padding: 0 !important;
    }

    body .profile-photo-viewer > .profile-photo-viewer-media img {
        max-width: 100vw !important;
        max-height: 100% !important;
    }

    body .profile-photo-caption,
    body .profile-photo-liked-summary,
    body .profile-photo-socialbar,
    body .profile-photo-comments-panel {
        width: 100vw !important;
        max-width: 100vw !important;
        left: 0 !important;
        transform: none !important;
    }

    body .profile-photo-caption {
        bottom: 134px !important;
        border-radius: 0 !important;
    }

    body .profile-photo-liked-summary {
        bottom: 54px !important;
        min-height: 44px !important;
        padding: 0 14px !important;
        border-radius: 0 !important;
    }

    body .profile-photo-socialbar {
        bottom: 0 !important;
        min-height: 54px !important;
        padding: 0 10px max(0px, env(safe-area-inset-bottom)) !important;
        border-radius: 0 !important;
    }

    body .profile-photo-comments-panel {
        bottom: 0 !important;
        max-height: min(70dvh, 560px) !important;
        min-height: 260px !important;
        border-radius: 24px 24px 0 0 !important;
    }

    body .profile-photo-nav:not(body:has(.feed-page) .feed-post-media-viewer .profile-photo-nav) {
        display: none !important;
    }
}


/* ===== Stage 21J: absolute hard fixed fullscreen footer for photo viewer ===== */

/*
   This stage ignores all previous column experiments.
   The photo viewer is a real fullscreen overlay:
   top controls fixed, media fills center, liked row + actions are fixed at bottom 100vw.
*/

html body .profile-photo-viewer {
    position: fixed !important;
    inset: 0 !important;
    z-index: 10000 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    min-width: 100vw !important;
    min-height: 100vh !important;
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
    overflow: hidden !important;
    /* Opaque (owner 2026-10-18): at .94 the page and its menu showed through. */
    background: #000 !important;
}

/* Top controls */
html body .profile-photo-viewer .profile-photo-viewer-top {
    position: fixed !important;
    top: 12px !important;
    left: 16px !important;
    right: 16px !important;
    width: auto !important;
    height: 50px !important;
    z-index: 10060 !important;
    margin: 0 !important;
}

/* Media must use the full available central viewport */
html body .profile-photo-viewer .profile-photo-viewer-media {
    position: fixed !important;
    top: 64px !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 126px !important;
    width: 100vw !important;
    max-width: 100vw !important;
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 14px !important;
    display: grid !important;
    place-items: center !important;
    overflow: hidden !important;
    background: transparent !important;
    box-sizing: border-box !important;
    transform: none !important;
    z-index: 10010 !important;
}

html body .profile-photo-viewer .profile-photo-viewer-media img {
    display: block !important;
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    margin: 0 auto !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: #000 !important;
}

/* Caption overlays above footer only if exists */
html body .profile-photo-viewer .profile-photo-caption {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 126px !important;
    width: 100vw !important;
    max-width: 100vw !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 8px 16px !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: linear-gradient(to top, rgba(0,0,0,.58), rgba(0,0,0,0)) !important;
    color: rgba(255,255,255,.94) !important;
    text-align: left !important;
    font-weight: 800 !important;
    text-shadow: 0 2px 10px rgba(0,0,0,.55) !important;
    box-shadow: none !important;
    transform: none !important;
    z-index: 10030 !important;
    box-sizing: border-box !important;
}

html body .profile-photo-viewer .profile-photo-caption:empty {
    display: none !important;
}

/* Liked row: full width, fixed above actions */
html body .profile-photo-viewer .profile-photo-liked-summary {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 58px !important;
    width: 100vw !important;
    max-width: 100vw !important;
    min-height: 44px !important;
    height: 44px !important;
    margin: 0 !important;
    padding: 0 18px !important;
    border: 0 !important;
    border-top: 1px solid rgba(255,255,255,.10) !important;
    border-bottom: 1px solid rgba(255,255,255,.07) !important;
    border-radius: 0 !important;
    background: rgba(18,18,22,.94) !important;
    color: rgba(255,255,255,.74) !important;
    display: flex !important;
    align-items: center !important;
    gap: 9px !important;
    box-shadow: none !important;
    backdrop-filter: blur(18px) !important;
    -webkit-backdrop-filter: blur(18px) !important;
    transform: none !important;
    z-index: 10050 !important;
    box-sizing: border-box !important;
}

html body .profile-photo-viewer .profile-photo-liked-summary.hidden {
    display: none !important;
}

html body .profile-photo-viewer .profile-photo-liked-summary b {
    color: rgba(255,255,255,.78) !important;
    font-size: .96rem !important;
    font-weight: 900 !important;
}

html body .profile-photo-viewer .profile-photo-liked-summary small {
    margin-left: auto !important;
    color: rgba(255,255,255,.46) !important;
    font-size: .82rem !important;
    font-weight: 900 !important;
}

/* Action footer: fixed to the very bottom, full width */
html body .profile-photo-viewer .profile-photo-socialbar {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    min-height: 58px !important;
    height: 58px !important;
    margin: 0 !important;
    padding: 0 18px !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: rgba(18,18,22,.96) !important;
    box-shadow: none !important;
    backdrop-filter: blur(18px) !important;
    -webkit-backdrop-filter: blur(18px) !important;
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    align-items: center !important;
    justify-items: stretch !important;
    gap: 0 !important;
    transform: none !important;
    z-index: 10055 !important;
    box-sizing: border-box !important;
}

html body .profile-photo-viewer .profile-photo-socialbar button,
html body .profile-photo-viewer .profile-photo-socialbar button:hover,
html body .profile-photo-viewer .profile-photo-socialbar button:focus,
html body .profile-photo-viewer .profile-photo-socialbar button:active {
    width: 100% !important;
    min-width: 0 !important;
    height: 52px !important;
    min-height: 52px !important;
    max-height: 52px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    outline: 0 !important;
    border-radius: 13px !important;
    background: transparent !important;
    box-shadow: none !important;
    color: rgba(255,255,255,.88) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    line-height: 1 !important;
}

html body .profile-photo-viewer .profile-photo-socialbar button:hover {
    background: rgba(255,255,255,.06) !important;
}

html body .profile-photo-viewer .profile-photo-socialbar .profile-photo-like-btn.liked,
html body .profile-photo-viewer .profile-photo-socialbar button.liked {
    color: #fb7185 !important;
    background: transparent !important;
}

html body .profile-photo-viewer .profile-photo-socialbar button svg {
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    display: block !important;
}

html body .profile-photo-viewer .profile-photo-socialbar button span {
    font-size: 1.05rem !important;
    font-weight: 950 !important;
}

/* Comments: proper bottom sheet over the footer */
html body .profile-photo-viewer .profile-photo-comments-panel {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    height: min(62vh, 560px) !important;
    min-height: 260px !important;
    max-height: 62vh !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 1px solid rgba(255,255,255,.10) !important;
    border-left: 0 !important;
    border-right: 0 !important;
    border-bottom: 0 !important;
    border-radius: 24px 24px 0 0 !important;
    background: rgba(18,18,22,.98) !important;
    box-shadow: 0 -26px 90px rgba(0,0,0,.62) !important;
    backdrop-filter: blur(22px) !important;
    -webkit-backdrop-filter: blur(22px) !important;
    overflow: hidden !important;
    display: grid !important;
    grid-template-rows: minmax(0, 1fr) auto !important;
    transform: none !important;
    z-index: 10080 !important;
    box-sizing: border-box !important;
}

html body .profile-photo-viewer .profile-photo-comments-panel.hidden {
    display: none !important;
}

html body .profile-photo-viewer .profile-photo-comments-list {
    overflow-y: auto !important;
    max-height: none !important;
    padding: 16px !important;
    display: grid !important;
    align-content: start !important;
    grid-auto-rows: max-content !important;
    gap: 12px !important;
    background: transparent !important;
}

html body .profile-photo-viewer .profile-photo-comment-form {
    position: static !important;
    width: 100% !important;
    display: grid !important;
    grid-template-columns: 44px minmax(0,1fr) 48px !important;
    gap: 9px !important;
    padding: 12px 16px !important;
    border-top: 1px solid rgba(255,255,255,.08) !important;
    background: rgba(18,18,22,.99) !important;
    box-sizing: border-box !important;
}

/* A wide bottom drawer keeps desktop comments in the photo viewer context.
   These declarations replace the former 760px cap, using the same specificity
   as the fullscreen viewer's earlier !important geometry. */
@media (min-width: 900px) {
    html body .profile-photo-viewer .profile-photo-comments-panel {
        left: 0 !important;
        right: 0 !important;
        width: 100vw !important;
        max-width: 100vw !important;
        height: min(58dvh, 640px) !important;
        max-height: 58dvh !important;
        transform: none !important;
    }
    html body .profile-photo-viewer .profile-photo-comments-list,
    html body .profile-photo-viewer .profile-photo-comment-form {
        padding-inline: clamp(24px, 3vw, 64px) !important;
    }
}

/* Nav arrows stay independent */
html body .profile-photo-viewer .profile-photo-nav {
    position: fixed !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    z-index: 10040 !important;
}

html body .profile-photo-viewer .profile-photo-nav.prev {
    left: 18px !important;
}

html body .profile-photo-viewer .profile-photo-nav.next {
    right: 18px !important;
}

/* Mobile footer safe-area */
@media (max-width: 760px) {
    html body .profile-photo-viewer .profile-photo-viewer-media {
        top: 58px !important;
        bottom: calc(112px + env(safe-area-inset-bottom)) !important;
        padding: 0 !important;
    }

    html body .profile-photo-viewer .profile-photo-liked-summary {
        bottom: calc(54px + env(safe-area-inset-bottom)) !important;
        height: 44px !important;
        min-height: 44px !important;
        padding: 0 14px !important;
    }

    html body .profile-photo-viewer .profile-photo-socialbar {
        bottom: 0 !important;
        height: calc(54px + env(safe-area-inset-bottom)) !important;
        min-height: calc(54px + env(safe-area-inset-bottom)) !important;
        padding: 0 12px env(safe-area-inset-bottom) !important;
    }

    html body .profile-photo-viewer .profile-photo-socialbar button {
        height: 50px !important;
        min-height: 50px !important;
        max-height: 50px !important;
    }

    html body .profile-photo-viewer .profile-photo-caption {
        bottom: calc(108px + env(safe-area-inset-bottom)) !important;
    }

    html body .profile-photo-viewer .profile-photo-nav:not(body:has(.feed-page) .feed-post-media-viewer .profile-photo-nav) {
        display: none !important;
    }

    html body .profile-photo-viewer .profile-photo-comments-panel {
        height: min(72dvh, 620px) !important;
        max-height: 72dvh !important;
        padding-bottom: env(safe-area-inset-bottom) !important;
    }
}


/* ===== Stage 21K: full-width photo footer + backdrop close + user-plus icon ===== */

/* Force desktop footer full screen width as requested */
html body .profile-photo-viewer .profile-photo-liked-summary {
    left: 0 !important;
    right: 0 !important;
    bottom: 58px !important;
    width: 100vw !important;
    max-width: 100vw !important;
    transform: none !important;
    border-radius: 0 !important;
}

html body .profile-photo-viewer .profile-photo-socialbar {
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    transform: none !important;
    border-radius: 0 !important;
}

/* Keep central media above full-width footer */
html body .profile-photo-viewer .profile-photo-viewer-media {
    bottom: 126px !important;
}

/* Backdrop is clickable; keep actual controls interactive */
html body .profile-photo-viewer {
    cursor: default !important;
}
html body .profile-photo-viewer .profile-photo-viewer-media img,
html body .profile-photo-viewer .profile-photo-liked-summary,
html body .profile-photo-viewer .profile-photo-socialbar,
html body .profile-photo-viewer .profile-photo-comments-panel,
html body .profile-photo-viewer .profile-photo-menu,
html body .profile-photo-viewer .profile-photo-likers-sheet,
html body .profile-photo-viewer .profile-photo-viewer-top,
html body .profile-photo-viewer .profile-photo-nav {
    cursor: auto !important;
}

/* VK-like user-plus icon, not a bare + */
.profile-photo-user-follow {
    width: 42px !important;
    height: 42px !important;
    border-radius: 14px !important;
    display: grid !important;
    place-items: center !important;
    padding: 0 !important;
    color: #fff !important;
    background: rgba(109,93,252,.28) !important;
    border: 1px solid rgba(139,92,246,.42) !important;
}
.profile-photo-user-follow svg {
    width: 24px !important;
    height: 24px !important;
    display: block !important;
}
.profile-photo-user-follow.following {
    background: rgba(49,209,88,.16) !important;
    color: #31d158 !important;
}

/* Photo viewer menu add action */
.profile-photo-menu button[data-photo-action="add_photo"] {
    color: #fff !important;
}
.profile-photo-menu button[data-photo-action="add_photo"]::first-letter {
    color: #8b5cf6;
}

/* Comments sheet remains bottom sheet above full-width footer */
html body .profile-photo-viewer .profile-photo-comments-panel {
    z-index: 10090 !important;
}

/* Desktop footer spans edge-to-edge with the comment drawer. */
@media (min-width: 900px) {
    html body .profile-photo-viewer .profile-photo-liked-summary,
    html body .profile-photo-viewer .profile-photo-socialbar {
        width: 100vw !important;
        max-width: 100vw !important;
        left: 0 !important;
        right: 0 !important;
        transform: none !important;
    }
}

/* Mobile safe area stays full width too */
@media (max-width: 760px) {
    html body .profile-photo-viewer .profile-photo-liked-summary {
        bottom: calc(54px + env(safe-area-inset-bottom)) !important;
    }
    html body .profile-photo-viewer .profile-photo-socialbar {
        bottom: 0 !important;
        height: calc(54px + env(safe-area-inset-bottom)) !important;
        min-height: calc(54px + env(safe-area-inset-bottom)) !important;
        padding-bottom: env(safe-area-inset-bottom) !important;
    }
}


/* ===== Stage 21L: comment media attachments ===== */
/* Desktop and mobile share the full-width comment drawer above. */
html body .profile-photo-viewer .profile-photo-comments-panel {
    z-index: 10120 !important;
}

/* Attachment button is now a real button, not pseudo before. */
html body .profile-photo-viewer .profile-photo-comment-form {
    grid-template-columns: 44px minmax(0, 1fr) 48px !important;
}
html body .profile-photo-viewer .profile-photo-comment-form::before {
    display: none !important;
    content: none !important;
}
html body .profile-photo-viewer .profile-photo-comment-attach {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    border: 1px solid rgba(255,255,255,.11) !important;
    border-radius: 13px !important;
    background: rgba(255,255,255,.045) !important;
    color: rgba(255,255,255,.78) !important;
    display: grid !important;
    place-items: center !important;
    cursor: pointer !important;
}
html body .profile-photo-viewer .profile-photo-comment-attach:hover {
    background: rgba(255,255,255,.12) !important;
}
html body .profile-photo-viewer .profile-photo-comment-attach:focus-visible {
    outline: 2px solid rgba(255,255,255,.9);
    outline-offset: 2px;
}

/* Preview selected media before sending comment. */
.profile-photo-comment-attach-preview {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr) 34px;
    gap: 10px;
    align-items: center;
    padding: 10px 16px;
    border-top: 1px solid rgba(255,255,255,.08);
    background: rgba(18,18,22,.98);
    color: rgba(255,255,255,.86);
    font-weight: 800;
}
.profile-photo-comment-attach-preview.hidden {
    display: none !important;
}
.profile-photo-comment-attach-preview img,
.profile-photo-comment-attach-preview video {
    grid-column: 1;
    grid-row: 1;
    width: 64px;
    height: 46px;
    border-radius: 10px;
    object-fit: cover;
    background: #000;
}
.profile-photo-comment-attach-preview span {
    grid-column: 2;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.profile-photo-comment-attach-remove {
    grid-column: 3;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: rgba(255,255,255,.10);
    color: #fff;
    font-size: 1.35rem;
    cursor: pointer;
}

/* Media displayed inside comments. */
.profile-photo-comment-media {
    margin-top: 8px;
    max-width: 280px;
    border-radius: 14px;
    overflow: hidden;
    background: rgba(0,0,0,.34);
}
.profile-photo-comment-media img,
.profile-photo-comment-media video {
    display: block;
    width: 100%;
    max-height: 260px;
    object-fit: cover;
    background: #000;
}
.profile-photo-comment-media.video video {
    object-fit: contain;
}

/* Backdrop closing should feel clickable outside the comments sheet. */
html body .profile-photo-viewer {
    cursor: pointer !important;
}
html body .profile-photo-viewer .profile-photo-viewer-top,
html body .profile-photo-viewer .profile-photo-viewer-media,
html body .profile-photo-viewer .profile-photo-liked-summary,
html body .profile-photo-viewer .profile-photo-socialbar,
html body .profile-photo-viewer .profile-photo-comments-panel,
html body .profile-photo-viewer .profile-photo-menu,
html body .profile-photo-viewer .profile-photo-nav {
    cursor: auto !important;
}


/* ===== Stage 21M: open comment media fullscreen ===== */
.profile-photo-comment-media {
    position: relative;
    border: 0 !important;
    padding: 0 !important;
    cursor: zoom-in !important;
    text-align: left !important;
}
.profile-photo-comment-media:hover img,
.profile-photo-comment-media:hover video {
    filter: brightness(.88);
}
.profile-comment-media-play {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 2.2rem;
    text-shadow: 0 4px 18px rgba(0,0,0,.75);
    pointer-events: none;
}
.profile-comment-media-viewer {
    position: fixed;
    inset: 0;
    z-index: 10250;
    background: rgba(0,0,0,.96);
    display: grid;
    place-items: center;
    padding: 56px 18px 28px;
}
.profile-comment-media-stage {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
}
.profile-comment-media-stage img,
.profile-comment-media-stage video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    background: #000;
}
.profile-comment-media-close {
    position: fixed;
    top: 16px;
    right: 18px;
    z-index: 10260;
    width: 48px;
    height: 48px;
    border: 0;
    border-radius: 50%;
    background: rgba(255,255,255,.10);
    color: #fff;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    display: grid;
    place-items: center;
}
.profile-comment-media-close:hover {
    background: rgba(255,255,255,.16);
}
@media (max-width: 760px) {
    .profile-comment-media-viewer {
        padding: 52px 0 0;
    }
    .profile-comment-media-stage img,
    .profile-comment-media-stage video {
        width: 100vw;
        max-width: 100vw;
    }
}


/* ===== Stage 21N: photo comments privacy lock ===== */
.profile-photo-comments-panel.comments-locked .profile-photo-comment-attach-preview,
.profile-photo-comments-panel.comments-locked .profile-photo-comment-form {
    display: none !important;
}

.profile-photo-comments-locked {
    min-height: 260px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 18px;
    text-align: center;
    color: #fff;
}

.profile-photo-comments-lock-icon {
    width: 96px;
    height: 96px;
    border-radius: 32px;
    display: grid;
    place-items: center;
    color: #fff;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.14);
    box-shadow: 0 20px 60px rgba(0,0,0,.28);
}

.profile-photo-comments-lock-icon svg {
    width: 54px;
    height: 54px;
}

.profile-photo-comments-locked b {
    font-size: 1.28rem;
    font-weight: 950;
    color: #fff;
}

@media (max-width: 760px) {
    .profile-photo-comments-locked {
        min-height: 230px;
    }
    .profile-photo-comments-lock-icon {
        width: 82px;
        height: 82px;
        border-radius: 28px;
    }
    .profile-photo-comments-lock-icon svg {
        width: 46px;
        height: 46px;
    }
}


/* ===== Stage 22A: user blocklist ===== */
.profile-blocked-note {
    margin-top: 8px;
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    color: var(--text);
    background: rgba(239, 68, 68, .16);
    border: 1px solid rgba(239, 68, 68, .28);
    font-size: 13px;
    font-weight: 650;
    line-height: 1.3;
}

.profile-block-btn,
.profile-unblock-btn {
    margin-top: 8px;
    width: 100%;
}

.profile-block-btn {
    color: #ff8a8a !important;
    border-color: rgba(239,68,68,.28) !important;
    background: rgba(239,68,68,.08) !important;
}

.profile-unblock-btn {
    background: var(--profile-action, var(--primary-grad)) !important;
    color: #fff !important;
}

.profile-blocklist-box {
    display: grid;
    gap: 10px;
}

.profile-blocklist-empty,
.profile-blocklist-loading {
    min-height: 76px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    color: var(--text-muted);
    background: rgba(148,163,184,.10);
    font-weight: 900;
    text-align: center;
}

.profile-blocklist-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 10px;
    border-radius: 20px;
    background: rgba(148,163,184,.10);
    border: 1px solid rgba(148,163,184,.12);
}

.profile-blocklist-user {
    min-width: 0;
    border: 0;
    background: transparent;
    color: inherit;
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    text-align: left;
    cursor: pointer;
}

.profile-blocklist-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    overflow: hidden;
    display: grid;
    place-items: center;
    color: #fff;
    font-weight: 950;
    background: linear-gradient(135deg, #6d5dfc, #8b5cf6);
}

.profile-blocklist-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-blocklist-user b,
.profile-blocklist-user small {
    display: block;
}

.profile-blocklist-user b {
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-blocklist-user small {
    margin-top: 3px;
    color: var(--text-muted);
    font-weight: 800;
}

.profile-blocklist-unblock {
    white-space: nowrap;
}

@media (max-width: 640px) {
    .profile-blocklist-row {
        grid-template-columns: 1fr;
    }
    .profile-blocklist-unblock {
        width: 100%;
    }
}


/* ===== Stage 22B: compact profile actions + more menu + reports ===== */

/* Keep profile action buttons in one clean line */

/* The old side column should not create overlaps if old CSS still targets it */
.profile-follow-side {
    display: contents !important;
}

.profile-more-menu-overlay {
    position: fixed;
    inset: 0;
    z-index: 10060;
    background: rgba(0,0,0,.14);
}

.profile-more-menu {
    position: fixed;
    right: 16px;
    top: 92px;
    width: min(310px, calc(100vw - 24px));
    padding: 10px;
    border-radius: 24px;
    background: rgba(18, 18, 24, .86);
    border: 1px solid rgba(255,255,255,.12);
    box-shadow: 0 22px 70px rgba(0,0,0,.42);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    display: grid;
    gap: 4px;
}

.profile-more-menu button {
    width: 100%;
    min-height: 52px;
    border: 0;
    border-radius: 16px;
    background: transparent;
    color: #fff;
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    text-align: left;
    padding: 0 12px;
    cursor: pointer;
    font-weight: 900;
}

.profile-more-menu button:hover {
    background: rgba(255,255,255,.08);
}

.profile-more-menu button svg {
    width: 24px;
    height: 24px;
}

.profile-more-menu button.danger {
    color: #ff8a8a;
}

.profile-report-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 10080;
    background: rgba(0,0,0,.56);
    display: grid;
    place-items: center;
    padding: 16px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.profile-report-modal {
    width: min(520px, 100%);
    border-radius: 28px;
    padding: 24px;
    color: var(--text-primary);
    background: rgba(18,18,24,.94);
    border: 1px solid rgba(255,255,255,.12);
    box-shadow: 0 24px 90px rgba(0,0,0,.48);
}

.profile-report-modal h3 {
    margin: 0 0 8px;
    font-size: 1.35rem;
}

.profile-report-modal p {
    margin: 0 0 18px;
    color: var(--text-muted);
    font-weight: 800;
}

.profile-report-modal label {
    display: block;
    margin: 12px 0 7px;
    font-weight: 900;
}

/* Light theme: the dark surface above kept the light theme's dark text
   (title and labels 1.01:1). Same surface as the light profile-stats window. */
body.theme-light .profile-report-modal {
    background: rgba(255,255,255,.96);
    border-color: rgba(15,23,42,.08);
    box-shadow: 0 24px 64px rgba(15,23,42,.16);
}

.profile-report-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 16px;
}

/* Better blocklist visibility */
.profile-blocklist-box > .btn {
    justify-self: start;
}

@media (max-width: 760px) {

    .profile-more-menu {
        top: auto !important;
        left: 10px !important;
        right: 10px !important;
        bottom: 12px !important;
        width: auto !important;
        border-radius: 26px;
    }

    .profile-report-modal {
        padding: 20px;
        border-radius: 24px;
    }

    .profile-report-actions {
        display: grid;
        grid-template-columns: 1fr;
    }
}


/* ===== Stage 22C: profile actions aligned with name ===== */

/*
   Name/action layout:
   Desktop: name block left, message/follow/more right in one row.
   Mobile: name left, action stack right next to the name, not below stats.
*/
.profile-identity-new {
    width: min(940px, 100%);
    margin-left: auto !important;
    margin-right: auto !important;
}

.profile-main-info {
    width: 100% !important;
}

.profile-main-info > .profile-name-row {
    min-width: 0 !important;
}

/* The actions are inside .profile-main-info; place them beside name. */
.profile-main-info:has(.profile-actions-compact) {
    display: grid !important;
    grid-template-columns: minmax(220px, max-content) minmax(360px, 520px) !important;
    grid-template-areas:
        "name actions"
        "handle actions"
        "note note" !important;
    align-items: center !important;
    justify-content: center !important;
    column-gap: 26px !important;
    row-gap: 4px !important;
}

.profile-main-info:has(.profile-actions-compact) .profile-name-row {
    grid-area: name !important;
    justify-self: start !important;
}

.profile-main-info:has(.profile-actions-compact) .profile-handle-new {
    grid-area: handle !important;
    justify-self: start !important;
}

.profile-main-info:has(.profile-actions-compact) .profile-blocked-note {
    grid-area: note !important;
    justify-self: start !important;
}

.profile-main-info:has(.profile-actions-compact) .profile-actions-compact {
    grid-area: actions !important;
    align-self: center !important;
    justify-self: start !important;
    margin: 0 !important;
}

/* Desktop row */

/* Do not let previous side/follow CSS reserve a separate column */
.profile-follow-side {
    display: contents !important;
}

/* Slightly pull stats up after the new compact header */

/* Tablet and phone */
@media (max-width: 760px) {
    .profile-identity-new {
        width: 100% !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    .profile-main-info:has(.profile-actions-compact) {
        grid-template-columns: minmax(0, 1fr) minmax(118px, 148px) !important;
        grid-template-areas:
            "name actions"
            "handle actions"
            "note note" !important;
        justify-content: stretch !important;
        align-items: start !important;
        column-gap: 10px !important;
        row-gap: 2px !important;
        text-align: left !important;
    }

    .profile-main-info:has(.profile-actions-compact) .profile-name-row {
        align-self: start !important;
        justify-self: start !important;
    }

    .profile-main-info:has(.profile-actions-compact) .profile-handle-new {
        justify-self: start !important;
    }

    .profile-main-info:has(.profile-actions-compact) .profile-actions-compact {
        justify-self: end !important;
        align-self: start !important;
        margin-top: 0 !important;
    }
}

/* Very narrow phones: keep text from breaking the header */
@media (max-width: 390px) {
    .profile-main-info:has(.profile-actions-compact) {
        grid-template-columns: minmax(0, 1fr) 138px !important;
        column-gap: 8px !important;
    }
}

/* If the browser does not support :has, keep a safe compact non-overlap fallback. */
@supports not selector(:has(*)) {
}


/* ===== Stage 22D: real profile header actions alignment + blocklist auto-load ===== */

/* Reset wrong 22C targeting: actual DOM uses .profile-topline-new and .profile-identity-block */

/* Keep stats below header, not mixed with buttons */

/* Mobile: name left, compact buttons right beside name, not under it */


/* ===== Stage 22E: mobile profile actions size + blocklist button reliability ===== */

@media (max-width: 760px) {
    /* Keep desktop perfect; only tune mobile. */
}

/* Make blocklist load button obviously clickable and not swallowed by details layout */
#load-blocklist-btn,
[data-load-blocklist="1"] {
    pointer-events: auto !important;
    cursor: pointer !important;
    position: relative !important;
    z-index: 2 !important;
}


/* ===== Stage 23A: profile rating/reviews/deals final system ===== */

.profile-stat-button {
    appearance: none;
    border: 0;
    text-align: left;
    cursor: pointer;
    font: inherit;
}

.profile-stat-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 34px rgba(88, 80, 236, .18);
}

.profile-stat-button:active {
    transform: translateY(0);
}

.stat-label-new {
    white-space: nowrap;
}

.profile-rating-dashboard {
    display: grid;
    grid-template-columns: minmax(120px, 180px) minmax(180px, 1fr) minmax(120px, 190px);
    gap: 18px;
    align-items: center;
    padding: 18px;
    margin-bottom: 16px;
}

.profile-rating-bars {
    display: grid;
    gap: 7px;
}

.profile-rating-bar-row {
    display: grid;
    grid-template-columns: 42px 1fr 28px;
    gap: 9px;
    align-items: center;
    font-size: .82rem;
    color: var(--muted);
}

.profile-rating-bar-row > div {
    height: 8px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(148, 163, 184, .18);
}

.profile-rating-bar-row > div > i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #f59e0b, #facc15);
}

.profile-rating-bar-row b {
    color: var(--text);
    text-align: right;
}

.profile-rating-mini-stats,
.profile-rating-extra {
    display: grid;
    gap: 10px;
}

.profile-rating-mini-stats span,
.profile-rating-extra > div {
    padding: 12px;
    border-radius: 16px;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(148, 163, 184, .16);
}

.profile-rating-mini-stats b,
.profile-rating-extra b {
    display: block;
    font-size: 1.15rem;
    color: var(--text);
}

.rating-star {
    color: rgba(148, 163, 184, .38);
}

.rating-star.filled {
    color: #f59e0b;
}

.profile-stats-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 10050;
    background: rgba(2, 6, 23, .58);
    backdrop-filter: blur(10px);
    display: grid;
    place-items: center;
    padding: 18px;
}

.profile-stats-modal {
    width: min(560px, 100%);
    max-height: min(760px, calc(100vh - 36px));
    overflow: auto;
    border-radius: 28px;
    box-shadow: 0 30px 90px rgba(0,0,0,.36);
}

.profile-stats-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px 10px;
}

.profile-stats-modal-head h3 {
    margin: 0;
    font-size: 1.15rem;
}

.profile-stats-modal-body {
    padding: 12px 20px 20px;
}

.profile-stats-hero {
    padding: 18px;
    border-radius: 22px;
    background: linear-gradient(135deg, rgba(109,93,252,.20), rgba(124,58,237,.10));
    border: 1px solid rgba(167,139,250,.20);
    margin-bottom: 14px;
}

.profile-stats-hero b {
    display: block;
    font-size: 2.2rem;
    line-height: 1;
}

.profile-stats-hero span {
    display: block;
    margin-top: 6px;
    color: var(--muted);
}

.profile-recent-deals-list {
    display: grid;
    gap: 10px;
}

.profile-recent-deal-row {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 14px;
    border-radius: 18px;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(148, 163, 184, .14);
}

.profile-recent-deal-main,
.profile-recent-deal-side {
    display: grid;
    gap: 4px;
}

.profile-recent-deal-main b,
.profile-recent-deal-side b {
    color: var(--text);
}

.profile-recent-deal-main span,
.profile-recent-deal-side span {
    color: var(--muted);
    font-size: .84rem;
}

.profile-recent-deal-side {
    text-align: right;
    flex: 0 0 auto;
}

/* «Кто смотрел профиль». Список живёт в той же модалке статистики и повторяет
   оформление строк сделок, но строка кликабельна и ведёт в профиль зрителя. */
.profile-viewers-list {
    display: grid;
    gap: 10px;
}

.profile-viewer-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 14px;
    border-radius: 18px;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(148, 163, 184, .14);
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: background .18s ease, border-color .18s ease;
}

.profile-viewer-row:hover,
.profile-viewer-row:focus-visible {
    background: rgba(255,255,255,.10);
    border-color: rgba(167,139,250,.35);
}

.profile-viewer-avatar {
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    background-color: rgba(148, 163, 184, .18);
    display: grid;
    place-items: center;
    font-weight: 600;
    color: var(--text);
}

.profile-viewer-main {
    display: grid;
    gap: 3px;
    min-width: 0;
    flex: 1 1 auto;
}

.profile-viewer-main b {
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-viewer-main span {
    color: var(--muted);
    font-size: .82rem;
}

.profile-viewer-chevron {
    flex: 0 0 auto;
    color: var(--muted);
}

.profile-viewers-note {
    margin-top: 12px;
    text-align: center;
    color: var(--muted);
    font-size: .82rem;
}

/* Кнопка-глаз «Кто смотрел ваш профиль» рядом с «Редактировать профиль». Показывается только владельцу. */

.profile-viewers-eye-btn {
    margin-left: auto;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 12px;
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.22);
    color: var(--text);
    cursor: pointer;
    transition: background .18s ease, border-color .18s ease;
}

.profile-viewers-eye-btn:hover,
.profile-viewers-eye-btn:focus-visible {
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(167,139,250,.45);
}

.profile-stats-empty {
    padding: 22px;
    border-radius: 20px;
    text-align: center;
    background: rgba(255,255,255,.05);
    border: 1px dashed rgba(148, 163, 184, .25);
}

.profile-stats-empty b {
    display: block;
    margin-bottom: 6px;
}

.profile-stats-empty span {
    color: var(--muted);
}

.profile-rating-modal-summary {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 18px;
    align-items: center;
}

.profile-rating-big {
    text-align: center;
    padding: 18px 12px;
    border-radius: 22px;
    background: linear-gradient(135deg, rgba(245,158,11,.16), rgba(109,93,252,.12));
    border: 1px solid rgba(245,158,11,.18);
}

.profile-rating-big b {
    display: block;
    font-size: 2.6rem;
    line-height: 1;
}

.profile-rating-big span {
    display: block;
    color: var(--muted);
    margin-top: 6px;
}

.profile-rating-extra {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 14px;
}

.profile-open-reviews-btn {
    width: 100%;
    margin-top: 14px;
}

.review-author .avatar.small img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
}

.recommend-badge.muted {
    opacity: .75;
}

@media (max-width: 760px) {
    .profile-rating-dashboard {
        grid-template-columns: 1fr;
    }

    .profile-rating-modal-summary {
        grid-template-columns: 1fr;
    }

    .profile-recent-deal-row {
        display: grid;
    }

    .profile-recent-deal-side {
        text-align: left;
    }

    .profile-stats-modal-overlay {
        align-items: end;
        padding: 10px;
    }

    .profile-stats-modal {
        width: 100%;
        border-radius: 26px 26px 20px 20px;
        max-height: calc(100vh - 20px);
    }
}


/* ===== Stage 23B: light theme readability for deals/rating modals ===== */
body.theme-light .profile-stats-modal-overlay {
    background: rgba(15, 23, 42, .20) !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

body.theme-light .profile-stats-modal.glass,
body.theme-light .profile-stats-modal {
    background: rgba(255,255,255,.96) !important;
    color: #0f172a !important;
    border: 1px solid rgba(15,23,42,.08) !important;
    box-shadow: 0 24px 64px rgba(15,23,42,.16) !important;
    backdrop-filter: blur(18px) saturate(1.05) !important;
    -webkit-backdrop-filter: blur(18px) saturate(1.05) !important;
}

body.theme-light .profile-stats-modal-head h3,
body.theme-light .profile-stats-modal-body,
body.theme-light .profile-stats-modal b,
body.theme-light .profile-stats-modal .profile-recent-deal-main b,
body.theme-light .profile-stats-modal .profile-recent-deal-side b,
body.theme-light .profile-stats-modal .profile-stats-hero b,
body.theme-light .profile-stats-modal .profile-rating-big b,
body.theme-light .profile-stats-modal .profile-rating-bar-row b {
    color: #0f172a !important;
}

body.theme-light .profile-stats-modal .profile-stats-hero,
body.theme-light .profile-stats-modal .profile-rating-big {
    background: linear-gradient(135deg, rgba(109,93,252,.16), rgba(124,58,237,.08)) !important;
    border-color: rgba(109,93,252,.18) !important;
}

body.theme-light .profile-stats-modal .profile-recent-deal-row,
body.theme-light .profile-stats-modal .profile-rating-mini-stats span,
body.theme-light .profile-stats-modal .profile-rating-extra > div,
body.theme-light .profile-stats-modal .profile-stats-empty {
    background: rgba(248,250,252,.92) !important;
    border-color: rgba(15,23,42,.09) !important;
    color: #0f172a !important;
}

body.theme-light .profile-stats-modal .profile-rating-bar-row,
body.theme-light .profile-stats-modal .profile-recent-deal-main span,
body.theme-light .profile-stats-modal .profile-recent-deal-side span,
body.theme-light .profile-stats-modal .profile-stats-hero span,
body.theme-light .profile-stats-modal .profile-stats-empty span,
body.theme-light .profile-stats-modal .profile-rating-big span {
    color: #64748b !important;
}

body.theme-light .profile-stats-modal .profile-rating-bar-row > div {
    background: rgba(148,163,184,.22) !important;
}

/* ===== Stage 24A: header search polish + compact auto-hide header ===== */

.header {
    transition:
        transform .24s ease,
        opacity .20s ease,
        padding .20s ease,
        min-height .20s ease,
        height .20s ease,
        border-color .20s ease;
}

.header-search-user-card {
    gap: 12px;
    align-items: center;
}

.search-result-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
}

.search-result-topline .search-result-name {
    font-size: .92rem;
    font-weight: 750;
}

.search-result-presence {
    flex: 0 0 auto;
    font-size: .68rem;
    color: var(--text-muted);
    border: 1px solid var(--border);
    background: var(--bg-tertiary);
    border-radius: 999px;
    padding: 3px 7px;
    max-width: 110px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-presence.online {
    color: #16a34a;
    border-color: rgba(34,197,94,.22);
    background: rgba(34,197,94,.10);
}

.search-result-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px 9px;
    line-height: 1.25;
}

.search-result-meta span {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

.search-result-open {
    flex: 0 0 auto;
    font-size: .72rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #7c3aed, #6d5dfc);
    border-radius: 999px;
    padding: 7px 10px;
    box-shadow: 0 8px 20px rgba(109,93,252,.22);
}

.search-results-dropdown {
    border-radius: 18px !important;
    overflow: hidden;
}

body.theme-light .search-results-dropdown {
    background: rgba(255,255,255,.96) !important;
    border-color: rgba(15,23,42,.10) !important;
    box-shadow: 0 18px 45px rgba(15,23,42,.14) !important;
}

body.theme-light .search-result-item:hover {
    background: rgba(109,93,252,.08) !important;
}

body.theme-light .search-result-presence {
    color: #64748b;
    background: rgba(248,250,252,.92);
    border-color: rgba(15,23,42,.10);
}

@media (max-width: 768px) {
    .app.header-compact-mode.header-collapsed {
        grid-template-rows: 0 var(--app-menu-bar-h, 0px) minmax(0, 1fr) !important;
    }


    .search-result-open {
        display: none;
    }

    .search-result-topline {
        align-items: flex-start;
    }

    .search-result-presence {
        max-width: 92px;
    }

    .search-result-meta {
        gap: 4px 7px;
        font-size: .72rem;
    }

    .header-search-user-card {
        padding: 11px 12px !important;
    }
}

@media (max-width: 420px) {
    .search-result-presence {
        display: none;
    }

    .search-result-meta span:nth-child(3) {
        display: none;
    }
}


/* ===== Stage 24B: search online badge inline + sidebar swipe polish ===== */

.header-search-user-card .search-result-info {
    min-width: 0 !important;
    flex: 1 1 auto !important;
}

.header-search-user-card .search-result-topline {
    justify-content: flex-start !important;
    align-items: center !important;
    width: auto !important;
    max-width: 100% !important;
    gap: 8px !important;
}

.header-search-user-card .search-result-topline .search-result-name {
    flex: 0 1 auto !important;
    min-width: 0 !important;
    max-width: calc(100% - 74px) !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

.header-search-user-card .search-result-presence {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 0 0 auto !important;
    max-width: 92px !important;
    height: 26px !important;
    padding: 0 9px !important;
    line-height: 1 !important;
}

.sidebar,
.sidebar-overlay {
    touch-action: pan-y !important;
}

@media (max-width: 768px) {
    .header-search-user-card .search-result-topline {
        align-items: center !important;
    }

    .header-search-user-card .search-result-presence {
        max-width: 86px !important;
        height: 24px !important;
        padding: 0 8px !important;
        font-size: .66rem !important;
    }
}

@media (max-width: 420px) {
    .header-search-user-card .search-result-presence {
        display: inline-flex !important;
        max-width: 76px !important;
    }
}


/* ===== Stage 24C: dark header icons + mobile search field + header swipe ===== */

/* In dark/glass themes some header icons were almost black on dark background. */
/* Package 174: the bell has its own colour (the header block below) — no
   forced white, no drop-shadow that blurred its glyph. */
body:not(.theme-light) #menu-toggle,
body:not(.theme-light) .header .icon-btn,
body:not(.theme-light) .header button.icon-btn,
body:not(.theme-light) .header button[aria-label*="Меню"],
body:not(.theme-light) .header button[title*="Меню"] {
    color: #f8fafc !important;
    opacity: 1 !important;
}

body:not(.theme-light) #menu-toggle svg,
body:not(.theme-light) .header .icon-btn svg {
    color: #f8fafc !important;
    stroke: currentColor !important;
    fill: none;
    opacity: 1 !important;
    filter: drop-shadow(0 1px 3px rgba(0,0,0,.45));
}

body:not(.theme-light) #menu-toggle:hover,
body:not(.theme-light) .header .icon-btn:hover {
    background: rgba(255,255,255,.08) !important;
}

/* Mobile: show the actual search input in the header, not only the magnifier button. */
@media (max-width: 768px) {
    

    .header {
        gap: 8px !important;
        padding: 8px 10px !important;
        min-height: 58px !important;
        overflow: visible !important;
    }

    .header-left,
    .header-right {
        gap: 6px !important;
        flex: 0 0 auto !important;
        min-width: 0 !important;
    }

    .header-center {
        flex: 1 1 auto !important;
        min-width: 0 !important;
        justify-content: stretch !important;
    }

    .header-search {
        display: block !important;
        position: relative !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        flex: 1 1 auto !important;
        width: 100% !important;
        min-width: 118px !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
        background: transparent !important;
        border: 0 !important;
        z-index: 120 !important;
    }

    

    .header .search-container {
        width: 100% !important;
    }

    #header-search-input {
        display: block !important;
        width: 100% !important;
        height: 38px !important;
        min-height: 38px !important;
        padding: 0 12px !important;
        border-radius: 17px !important;
        font-size: .84rem !important;
        background: var(--bg-tertiary) !important;
        color: var(--text) !important;
        border: 1px solid var(--border) !important;
    }

    #header-search-input::placeholder {
        font-size: .80rem !important;
    }

    .search-results-dropdown {
        position: absolute !important;
        top: calc(100% + 8px) !important;
        left: 0 !important;
        right: 0 !important;
        max-width: min(420px, calc(100vw - 20px)) !important;
        width: max(100%, min(420px, calc(100vw - 20px))) !important;
    }

    body:not(.theme-light) #header-search-input {
        background: rgba(255,255,255,.06) !important;
        border-color: rgba(255,255,255,.12) !important;
        color: #f8fafc !important;
    }
}

@media (max-width: 520px) {
    .header {
        gap: 6px !important;
    }

    .logo-text,
    .header-title {
        display: none !important;
    }

    #menu-toggle,
    #notification-bell-btn,
    .header .icon-btn {
        width: 38px !important;
        min-width: 38px !important;
        height: 38px !important;
        min-height: 38px !important;
        padding: 0 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .header-right .user-menu,
    .header-right .user-avatar,
    .header-right #user-menu-btn {
        flex: 0 0 auto !important;
    }

    #header-search-input {
        height: 36px !important;
        min-height: 36px !important;
        font-size: .80rem !important;
        padding: 0 10px !important;
    }

    #header-search-input::placeholder {
        color: transparent !important;
    }

    #header-search-input:focus::placeholder {
        color: var(--text-muted) !important;
    }
}

/* Header-only vertical gestures leave page scrolling with its owner. */

.header {
    touch-action: pan-y !important;
}


/* ===== Stage 24E: safe rollback after broken mobile header 24D ===== */

/* Undo any overly broad 24D-style hiding. */
@media (max-width: 768px) {
    .header {
        display: flex !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 8px !important;
        min-height: auto !important;
        height: auto !important;
        padding: 8px 10px !important;
        overflow: visible !important;
    }

    .header-left,
    .header-right {
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
        min-width: 0 !important;
        flex: 0 0 auto !important;
    }

    .header-center {
        display: flex !important;
        order: 10 !important;
        width: 100% !important;
        flex: 0 0 100% !important;
        min-width: 0 !important;
        justify-content: stretch !important;
    }

    .logo,
    .logo-icon {
        display: flex !important;
    }

    .logo-text,
    .header-title {
        display: none !important;
    }

    #menu-toggle,
    #notification-bell-btn,
    .notification-bell,
    .header .icon-btn,
    .header button.icon-btn,
    .header-right .icon-btn {
        display: inline-flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        width: 40px !important;
        min-width: 40px !important;
        max-width: 40px !important;
        height: 40px !important;
        min-height: 40px !important;
        max-height: 40px !important;
        padding: 0 !important;
        margin: 0 !important;
        align-items: center !important;
        justify-content: center !important;
        pointer-events: auto !important;
        overflow: visible !important;
        flex: 0 0 auto !important;
    }

    .header-right .user-menu,
    .header-right #user-menu-btn,
    .header-right .user-avatar {
        display: inline-flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        flex: 0 0 auto !important;
    }

    /* Search must be visible and usable; stable fallback is full-width row. */
    .header-search {
        display: block !important;
        position: relative !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        order: 10 !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
        background: transparent !important;
        border: 0 !important;
        z-index: 130 !important;
        flex: 1 1 100% !important;
    }

    

    .header .search-container,
    .header-search .search-container {
        width: 100% !important;
        min-width: 0 !important;
    }

    #header-search-input {
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
        height: 38px !important;
        min-height: 38px !important;
        padding: 0 12px !important;
        border-radius: 18px !important;
        font-size: .82rem !important;
        line-height: 38px !important;
        color: var(--text) !important;
        background: var(--bg-tertiary) !important;
        border: 1px solid var(--border) !important;
    }

    .search-results-dropdown {
        top: calc(100% + 8px) !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: calc(100vw - 20px) !important;
    }

    /* Old round magnifier can remain hidden, but do NOT hide other buttons. */
    
}

/* Dark theme icons readable, without hiding anything. */
body:not(.theme-light) #menu-toggle,
body:not(.theme-light) .header .icon-btn {
    color: #f8fafc !important;
    opacity: 1 !important;
}

body:not(.theme-light) #menu-toggle svg,
body:not(.theme-light) .header .icon-btn svg {
    color: #f8fafc !important;
    stroke: currentColor !important;
    opacity: 1 !important;
    filter: drop-shadow(0 1px 3px rgba(0,0,0,.45));
}


/* ===== Stage 24F: safe one-line mobile header search ===== */

@media (max-width: 768px) {
    /*
      Safe one-line layout:
      left = menu only, center = search, right = notifications/avatar.
      No broad button hiding.
    */
    .header {
        display: grid !important;
        grid-template-columns: 40px minmax(118px, 1fr) auto !important;
        grid-template-areas: "left center right" !important;
        align-items: center !important;
        gap: 7px !important;
        height: 58px !important;
        min-height: 58px !important;
        max-height: 58px !important;
        padding: 8px 8px !important;
        overflow: visible !important;
    }

    .header-left {
        grid-area: left !important;
        display: flex !important;
        align-items: center !important;
        justify-content: flex-start !important;
        width: 40px !important;
        min-width: 40px !important;
        max-width: 40px !important;
        overflow: visible !important;
        gap: 0 !important;
    }

    .header-center {
        grid-area: center !important;
        display: flex !important;
        align-items: center !important;
        justify-content: stretch !important;
        width: 100% !important;
        min-width: 0 !important;
        flex: unset !important;
        order: initial !important;
    }

    .header-right {
        grid-area: right !important;
        display: flex !important;
        align-items: center !important;
        justify-content: flex-end !important;
        gap: 6px !important;
        min-width: 0 !important;
        width: auto !important;
        flex: unset !important;
        order: initial !important;
    }

    /* Hide only brand on mobile to make space; keep burger visible. */
    .header-left .logo,
    .header-left .logo-icon,
    .header-left .logo-text,
    .header-title {
        display: none !important;
    }

    #menu-toggle {
        display: inline-flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        width: 40px !important;
        min-width: 40px !important;
        max-width: 40px !important;
        height: 40px !important;
        min-height: 40px !important;
        max-height: 40px !important;
        padding: 0 !important;
        margin: 0 !important;
        align-items: center !important;
        justify-content: center !important;
        pointer-events: auto !important;
        overflow: visible !important;
        flex: 0 0 40px !important;
    }

    /* Hide only the old round magnifier button by exact ID/class. */
    

    .header-search {
        display: block !important;
        position: relative !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
        background: transparent !important;
        border: 0 !important;
        z-index: 150 !important;
        flex: 1 1 auto !important;
        order: initial !important;
    }

    

    .header-search .search-container,
    .header .search-container {
        width: 100% !important;
        min-width: 0 !important;
    }

    #header-search-input {
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
        height: 40px !important;
        min-height: 40px !important;
        padding: 0 12px !important;
        border-radius: 18px !important;
        font-size: .82rem !important;
        line-height: 40px !important;
        box-sizing: border-box !important;
        color: var(--text) !important;
        background: var(--bg-tertiary) !important;
        border: 1px solid var(--border) !important;
    }

    #header-search-input::placeholder {
        color: var(--text-muted) !important;
        font-size: .78rem !important;
    }

    .search-results-dropdown {
        position: absolute !important;
        top: calc(100% + 8px) !important;
        left: 0 !important;
        right: auto !important;
        width: min(420px, calc(100vw - 16px)) !important;
        max-width: calc(100vw - 16px) !important;
    }

    #notification-bell-btn,
    .notification-bell,
    .header-right .icon-btn {
        display: inline-flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        width: 38px !important;
        min-width: 38px !important;
        max-width: 38px !important;
        height: 40px !important;
        min-height: 40px !important;
        max-height: 40px !important;
        padding: 0 !important;
        margin: 0 !important;
        align-items: center !important;
        justify-content: center !important;
        pointer-events: auto !important;
        overflow: visible !important;
        flex: 0 0 auto !important;
    }

    .header-right .user-menu,
    .header-right #user-menu-btn,
    .header-right .user-avatar {
        display: inline-flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        flex: 0 0 auto !important;
        min-width: 0 !important;
    }
}

@media (max-width: 430px) {
    .header {
        grid-template-columns: 36px minmax(94px, 1fr) auto !important;
        gap: 5px !important;
        padding-left: 6px !important;
        padding-right: 6px !important;
    }

    .header-left {
        width: 36px !important;
        min-width: 36px !important;
        max-width: 36px !important;
    }

    #menu-toggle {
        width: 36px !important;
        min-width: 36px !important;
        max-width: 36px !important;
        height: 38px !important;
        min-height: 38px !important;
        max-height: 38px !important;
        flex-basis: 36px !important;
    }

    #notification-bell-btn,
    .notification-bell,
    .header-right .icon-btn {
        width: 34px !important;
        min-width: 34px !important;
        max-width: 34px !important;
        height: 38px !important;
        min-height: 38px !important;
        max-height: 38px !important;
    }

    #header-search-input {
        height: 38px !important;
        min-height: 38px !important;
        line-height: 38px !important;
        font-size: .76rem !important;
        padding: 0 9px !important;
    }

    #header-search-input::placeholder {
        color: transparent !important;
    }

    #header-search-input:focus::placeholder {
        color: var(--text-muted) !important;
    }
}


/* ===== Stage 24G: physical mobile header search slot ===== */

@media (max-width: 768px) {
    .header {
        display: flex !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        justify-content: flex-start !important;
        gap: 7px !important;
        height: 58px !important;
        min-height: 58px !important;
        max-height: 58px !important;
        padding: 8px 8px !important;
        overflow: visible !important;
    }

    .header-left {
        display: flex !important;
        align-items: center !important;
        flex: 0 0 40px !important;
        width: 40px !important;
        min-width: 40px !important;
        max-width: 40px !important;
        gap: 0 !important;
        overflow: visible !important;
    }

    .header-left .logo,
    .header-left .logo-icon,
    .header-left .logo-text,
    .header-title {
        display: none !important;
    }

    

    

    

    

    

    

    

    .header-right {
        display: flex !important;
        align-items: center !important;
        justify-content: flex-end !important;
        gap: 6px !important;
        flex: 0 0 auto !important;
        width: auto !important;
        min-width: 0 !important;
    }

    #menu-toggle,
    #notification-bell-btn,
    .notification-bell,
    .header-right .icon-btn {
        display: inline-flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        width: 38px !important;
        min-width: 38px !important;
        max-width: 38px !important;
        height: 40px !important;
        min-height: 40px !important;
        max-height: 40px !important;
        padding: 0 !important;
        margin: 0 !important;
        align-items: center !important;
        justify-content: center !important;
        pointer-events: auto !important;
        overflow: visible !important;
        flex: 0 0 auto !important;
    }

    
}

@media (max-width: 430px) {
    .header {
        gap: 5px !important;
        padding-left: 6px !important;
        padding-right: 6px !important;
    }

    .header-left {
        flex-basis: 34px !important;
        width: 34px !important;
        min-width: 34px !important;
        max-width: 34px !important;
    }

    #menu-toggle {
        width: 34px !important;
        min-width: 34px !important;
        max-width: 34px !important;
        height: 38px !important;
        min-height: 38px !important;
        max-height: 38px !important;
    }

    #notification-bell-btn,
    .notification-bell,
    .header-right .icon-btn {
        width: 34px !important;
        min-width: 34px !important;
        max-width: 34px !important;
        height: 38px !important;
        min-height: 38px !important;
        max-height: 38px !important;
    }

    

    

    
}


/* ===== Stage 24H: wider mobile search + remove duplicated header page title ===== */

/* PC/tablet: page title is already visible inside the page content, so don't duplicate it in header. */
.header-title {
    display: none !important;
}

/* Let the center search breathe more after removing duplicated title. */
@media (min-width: 769px) {
    .header-center {
        justify-content: center !important;
    }

    .header-search {
        max-width: 520px !important;
        width: min(520px, 44vw) !important;
        margin-left: 16px !important;
        margin-right: 16px !important;
    }
}

@media (max-width: 768px) {
    /*
      Final mobile row:
      burger | WIDE search | bell | compact avatar
    */
    .header {
        display: flex !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        gap: 6px !important;
        height: 58px !important;
        min-height: 58px !important;
        max-height: 58px !important;
        padding: 8px 6px !important;
        overflow: visible !important;
    }

    .header-left {
        flex: 0 0 34px !important;
        width: 34px !important;
        min-width: 34px !important;
        max-width: 34px !important;
    }

    #menu-toggle {
        width: 34px !important;
        min-width: 34px !important;
        max-width: 34px !important;
        height: 38px !important;
        min-height: 38px !important;
        max-height: 38px !important;
        flex: 0 0 34px !important;
    }

    

    

    

    

    .header-right {
        flex: 0 0 auto !important;
        width: auto !important;
        min-width: 0 !important;
        gap: 5px !important;
        display: flex !important;
        align-items: center !important;
    }

    #notification-bell-btn,
    .notification-bell,
    .header-right .icon-btn {
        width: 32px !important;
        min-width: 32px !important;
        max-width: 32px !important;
        height: 38px !important;
        min-height: 38px !important;
        max-height: 38px !important;
        padding: 0 !important;
        flex: 0 0 32px !important;
    }

    .notification-count {
        top: -5px !important;
        right: -3px !important;
        min-width: 17px !important;
        height: 17px !important;
        padding: 1px 5px !important;
        font-size: .62rem !important;
        line-height: 15px !important;
    }
}

@media (max-width: 430px) {
    .header {
        gap: 4px !important;
        padding-left: 5px !important;
        padding-right: 5px !important;
    }

    .header-left,
    #menu-toggle {
        width: 32px !important;
        min-width: 32px !important;
        max-width: 32px !important;
        flex-basis: 32px !important;
    }

    #notification-bell-btn,
    .notification-bell,
    .header-right .icon-btn {
        width: 30px !important;
        min-width: 30px !important;
        max-width: 30px !important;
        flex-basis: 30px !important;
    }

    
}


/* ===== Stage 24I: expand mobile search to the left ===== */

@media (max-width: 768px) {
    /*
      After the search is physically moved into mobile-header-search-slot,
      the old header-center becomes empty but can still consume flex space.
      Hide it on mobile so search starts right after the burger.
    */
    .header > .header-center {
        display: none !important;
        visibility: hidden !important;
        width: 0 !important;
        min-width: 0 !important;
        max-width: 0 !important;
        flex: 0 0 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        overflow: hidden !important;
        pointer-events: none !important;
    }

    .header {
        justify-content: flex-start !important;
    }

    

    .header-left {
        order: 1 !important;
    }

    .header-right {
        order: 3 !important;
    }

    
}

@media (max-width: 430px) {
    
}


/* ===== Stage 24J: mobile search results stay inside viewport ===== */

@media (max-width: 768px) {
    .header .search-results-dropdown {
        position: fixed !important;
        top: 62px !important;
        left: 8px !important;
        right: 8px !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
        max-height: min(420px, calc(100vh - 78px)) !important;
        overflow-y: auto !important;
        z-index: 6000 !important;
        border-radius: 18px !important;
        box-sizing: border-box !important;
    }

    .header-search-user-card,
    .search-result-item {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
    }

    .header-search-user-card .search-result-info {
        min-width: 0 !important;
        overflow: hidden !important;
    }

    .header-search-user-card .search-result-name {
        max-width: 100% !important;
        min-width: 0 !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }

    .header-search-user-card .search-result-meta {
        max-width: 100% !important;
        overflow: hidden !important;
        gap: 4px 7px !important;
    }

    .header-search-user-card .search-result-meta span {
        min-width: 0 !important;
        max-width: 100% !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }

    .header-search-user-card .search-result-open {
        display: none !important;
    }
}

@media (max-width: 430px) {
    .header .search-results-dropdown {
        top: 60px !important;
        left: 6px !important;
        right: 6px !important;
        max-height: min(390px, calc(100vh - 74px)) !important;
    }

    .header-search-user-card .search-result-meta span:nth-child(3) {
        display: none !important;
    }
}


/* ===== Stage 25A: Dashboard foundation polish ===== */

.dashboard-v2 {
    display: grid;
    gap: 18px;
    padding-bottom: 24px;
}

.dashboard-v2 .glass {
    background: rgba(20, 28, 45, .62);
    border: 1px solid rgba(255,255,255,.11);
    box-shadow: 0 22px 50px -14px rgba(0,0,0,.30);
}

.dashboard-hero {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    gap: 18px;
    padding: 22px;
    border-radius: 28px;
    overflow: hidden;
    position: relative;
}

.dashboard-hero::before {
    content: "";
    position: absolute;
    inset: -80px -120px auto auto;
    width: 260px;
    height: 260px;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(124,58,237,.30), transparent 62%);
    pointer-events: none;
}

.dashboard-hero-main {
    position: relative;
    min-width: 0;
}

.dashboard-kicker {
    color: var(--primary);
    font-weight: 800;
    font-size: .78rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.dashboard-hero h1 {
    color: var(--text);
    background: none;
    -webkit-text-fill-color: initial;
    margin: 0 0 8px;
    font-size: clamp(1.5rem, 3vw, 2.25rem);
}

.dashboard-hero p {
    color: var(--text-secondary);
    max-width: 620px;
    margin: 0;
}

.dashboard-hero-wallet {
    position: relative;
    flex: 0 0 270px;
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 16px;
    border-radius: 22px;
    background: rgba(255,255,255,.055);
    border: 1px solid rgba(255,255,255,.08);
}

.dashboard-hero-wallet.is-linked {
    background: linear-gradient(135deg, rgba(16,185,129,.16), rgba(109,93,252,.10));
    border-color: rgba(16,185,129,.18);
}

.dashboard-wallet-icon,
.dashboard-kpi-icon,
.dashboard-action-icon,
.dashboard-row-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.dashboard-wallet-icon {
    width: 48px;
    height: 48px;
    border-radius: 18px;
    color: #fff;
    background: linear-gradient(135deg, #7c3aed, #6d5dfc);
}

.dashboard-hero-wallet b {
    display: block;
    color: var(--text);
    font-size: .98rem;
    margin-bottom: 4px;
}

.dashboard-hero-wallet span {
    display: block;
    color: var(--text-muted);
    font-size: .82rem;
    word-break: break-all;
}

.dashboard-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.dashboard-kpi-card {
    appearance: none;
    border: 0;
    text-align: left;
    cursor: pointer;
    border-radius: 24px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 13px;
    color: var(--text);
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.dashboard-kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 22px 46px rgba(0,0,0,.22);
}

.dashboard-kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 18px;
    color: #fff;
    background: rgba(109,93,252,.18);
}

.dashboard-kpi-card.tone-primary .dashboard-kpi-icon { background: linear-gradient(135deg, #6d5dfc, #7c3aed); }
.dashboard-kpi-card.tone-warning .dashboard-kpi-icon { background: linear-gradient(135deg, #f59e0b, #f97316); }
.dashboard-kpi-card.tone-success .dashboard-kpi-icon { background: linear-gradient(135deg, #10b981, #059669); }
.dashboard-kpi-card.tone-danger .dashboard-kpi-icon { background: linear-gradient(135deg, #ef4444, #dc2626); }

.dashboard-kpi-content {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.dashboard-kpi-value {
    font-size: 1.55rem;
    line-height: 1;
    color: var(--text);
}

.dashboard-kpi-title {
    color: var(--text);
    font-weight: 750;
    font-size: .92rem;
}

.dashboard-kpi-content small {
    color: var(--text-muted);
}

.dashboard-main-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
    gap: 16px;
    align-items: start;
}

.dashboard-panel {
    border-radius: 26px;
    padding: 18px;
    min-width: 0;
}

.dashboard-panel-wide,
.dashboard-panel-chart {
    grid-column: span 1;
}

.dashboard-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.dashboard-panel-head .dashboard-quick-title,
.dashboard-panel-head h3 {
    margin: 0 0 4px;
    color: var(--text);
    font-size: 1.05rem;
}

.dashboard-panel-head .dashboard-quick-title {
    background: none;
    -webkit-text-fill-color: initial;
}

.dashboard-v2 .dashboard-panel-actions > .dashboard-quick-title {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.dashboard-panel-head p {
    margin: 0;
    color: var(--text-muted);
    font-size: .84rem;
}

.dashboard-link {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--primary);
    font-weight: 750;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    padding: 4px 0;
}

/* Dashboard account home: natural page scroll, shared identity and route actions.
   Local icon hues identify destinations; they are not financial/status colors. */
.dashboard-home {
    --dashboard-icon-blue: #257be4;
    --dashboard-icon-green: #279b56;
    --dashboard-icon-amber: #bb7220;
    --dashboard-icon-red: #d84c61;
    --dashboard-icon-violet: #8354c7;
    --dashboard-icon-teal: #168b91;
    --dashboard-icon-neutral: #66758a;
    --dashboard-icon-ink: #fff;
    align-content: start;
}

.dashboard-home-header,
.dashboard-home-content {
    width: min(calc(100% - 24px), 960px);
    min-width: 0;
    margin-inline: auto;
}

.dashboard-home-header {
    position: relative;
    display: grid;
    justify-items: center;
    gap: 10px;
    padding: 30px 54px 22px;
    text-align: center;
}

.dashboard-home-avatar,
.dashboard-home-utility,
.dashboard-statistics-header button {
    appearance: none;
    display: inline-grid;
    place-items: center;
    flex-shrink: 0;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    padding: 0;
    cursor: pointer;
    transition: background var(--transition-fast), opacity var(--transition-fast);
}

.dashboard-home-avatar {
    width: 104px;
    height: 104px;
    border-radius: 50%;
    border: 0;
    margin-bottom: 4px;
}

.dashboard-home-avatar > .person-avatar {
    width: 100%;
    height: 100%;
    border-radius: inherit;
    font-size: 2.25rem;
}

.dashboard-home-utility {
    position: absolute;
    inset-block-start: 0;
    inset-inline-end: 0;
    width: 44px;
    height: 44px;
    border-radius: 50%;
}

.dashboard-home-utility svg,
.dashboard-statistics-header button svg {
    width: 22px;
    height: 22px;
}

.dashboard-home-name {
    max-width: 100%;
    margin: 0;
    color: var(--text);
    background: none;
    -webkit-text-fill-color: currentColor;
    font-size: max(24px, 1.8rem);
    overflow-wrap: anywhere;
}

.dashboard-home-meta {
    max-width: 100%;
    margin: 0;
    color: var(--text-muted);
    font-size: max(14px, .9rem);
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.dashboard-home-content,
.dashboard-home-groups {
    display: grid;
    gap: 24px;
    align-items: start;
}

.dashboard-home-groups {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dashboard-home-group {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--border-light);
    border-radius: 24px;
    background: var(--bg-card);
}

.dashboard-home-row,
.dashboard-home-account,
.dashboard-home-account-add {
    appearance: none;
    position: relative;
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr) 16px;
    align-items: center;
    gap: 14px;
    width: 100%;
    min-width: 0;
    min-height: 60px;
    padding: 12px 18px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--text);
    font: inherit;
    text-align: start;
    text-decoration: none;
    white-space: normal;
    cursor: pointer;
    scroll-margin-block: 80px calc(var(--mobile-bottom-nav-h, 0px) + env(safe-area-inset-bottom, 0px) + 20px);
    transition: background var(--transition-fast), opacity var(--transition-fast);
}

.dashboard-home-row + .dashboard-home-row::before,
.dashboard-home-account + .dashboard-home-account::before,
.dashboard-home-account-add::before {
    content: "";
    position: absolute;
    inset-block-start: 0;
    inset-inline: 64px 18px;
    height: 1px;
    background: var(--border-light);
    pointer-events: none;
}

.dashboard-home-row:has(> .dashboard-home-badge:not(.hidden)) {
    grid-template-columns: 32px minmax(0, 1fr) auto 16px;
}
.dashboard-home-badge {
    display: inline-grid;
    place-items: center;
    min-width: 24px;
    min-height: 24px;
    padding: 2px 7px;
    border-radius: 999px;
    background: var(--primary-light);
    color: var(--primary-text);
    font-size: .8rem;
    font-weight: 650;
    line-height: 1;
    white-space: nowrap;
}
.dashboard-home-badge.hidden { display: none; }

.dashboard-home-icon {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: var(--dashboard-icon-blue);
    color: var(--dashboard-icon-ink);
}

.dashboard-home-icon:is([data-icon="plus"], [data-icon="music"], [data-icon="tag"]) { background: var(--dashboard-icon-violet); }
.dashboard-home-icon:is([data-icon="wallet"], [data-icon="shield"]) { background: var(--dashboard-icon-green); }
.dashboard-home-icon:is([data-icon="help"], [data-icon="scales"], [data-icon="onramp"], [data-icon="stats"]) { background: var(--dashboard-icon-amber); }
.dashboard-home-icon:is([data-icon="profile"], [data-icon="bell"]) { background: var(--dashboard-icon-red); }
.dashboard-home-icon:is([data-icon="exchange"], [data-icon="feed"]) { background: var(--dashboard-icon-teal); }
.dashboard-home-icon:is([data-icon="settings"], [data-icon="admin"]) { background: var(--dashboard-icon-neutral); }

.dashboard-home-icon svg {
    display: block;
    width: 22px;
    height: 22px;
}

.dashboard-home-label,
.dashboard-home-account-name {
    min-width: 0;
    color: var(--text);
    font-size: max(16px, 1rem);
    font-weight: 550;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.dashboard-home-chevron {
    display: grid;
    place-items: center;
    color: var(--text-muted);
}

.dashboard-home-chevron svg {
    display: block;
    width: 16px;
    height: 16px;
}

.dashboard-home-account,
.dashboard-home-account-add {
    grid-template-columns: 40px minmax(0, 1fr) auto;
    min-height: 70px;
}

.dashboard-home-account + .dashboard-home-account::before,
.dashboard-home-account-add::before { inset-inline-start: 72px; }

.dashboard-home-account:not(button) { cursor: default; }

.dashboard-home-account[role="status"],
.dashboard-home-account[data-dashboard-account-retry] {
    display: block;
    padding-block: 22px;
    color: var(--text-muted);
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.dashboard-home-account-avatar,
.dashboard-home-account-avatar .person-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.dashboard-home-account-copy {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.dashboard-home-account-meta {
    color: var(--text-muted);
    font-size: max(12px, .8rem);
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.dashboard-home-account-current {
    max-width: 8em;
    color: var(--primary-text);
    font-size: .75rem;
    line-height: 1.3;
    text-align: end;
    overflow-wrap: anywhere;
}

.dashboard-home-account-add,
.dashboard-home-account-add .dashboard-home-label,
.dashboard-home-account-add .dashboard-home-account-name {
    color: var(--primary-text);
}

.dashboard-home-account-add .dashboard-home-account-avatar {
    display: grid;
    place-items: center;
}

.dashboard-home-account-add .dashboard-home-account-avatar svg {
    width: 26px;
    height: 26px;
}

.dashboard-home-row:hover:not(:disabled),
button.dashboard-home-account:hover:not(:disabled),
.dashboard-home-account-add:hover:not(:disabled),
.dashboard-home-utility:hover:not(:disabled),
.dashboard-statistics-header button:hover:not(:disabled) {
    background: var(--bg-hover);
}

.dashboard-home-avatar:hover:not(:disabled) { opacity: .88; }

.dashboard-home-row:active:not(:disabled),
button.dashboard-home-account:active:not(:disabled),
.dashboard-home-account-add:active:not(:disabled),
.dashboard-home-utility:active:not(:disabled),
.dashboard-statistics-header button:active:not(:disabled) {
    background: var(--primary-light);
}

.dashboard-home-avatar:focus-visible,
.dashboard-home-utility:focus-visible,
.dashboard-statistics-header button:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
}

.dashboard-home-row:focus-visible,
.dashboard-home-account:focus-visible,
.dashboard-home-account-add:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -3px;
}

.dashboard-home :is(button:disabled, button[aria-busy="true"]),
.dashboard-statistics-header button:disabled {
    opacity: .6;
    cursor: default;
}

.dashboard-home :is(.dashboard-home-row, .dashboard-home-group)[hidden] { display: none; }


.dashboard-profile-level { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-width: 0; padding: 14px 18px; border: 1px solid var(--border); border-radius: 16px; background: var(--bg-secondary); color: var(--text-secondary); }
.dashboard-profile-level strong { color: var(--text); font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.dashboard-personal-nav { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-block: 0 20px; }
.dashboard-personal-link { display: flex; align-items: center; gap: 12px; min-width: 0; min-height: 64px; padding: 16px; border: 1px solid var(--border); border-radius: 18px; background: var(--bg-secondary); color: var(--text); text-decoration: none; }
.dashboard-personal-link > span { color: var(--primary); }
/* Menu tile geometry (.dashboard-home-icon: 32px, Ionicons 22px) and the menu's
   own destination hues: «Сделки» blue, «Объявления» violet and «Продажи»
   (wallet) green as in the menu; «Рейтинг» amber and «Отзывы» teal so that
   all five stay distinguishable. The hue variables are scoped to
   .dashboard-home, so the same values are restated here. */
.dashboard-statistics {
    --dashboard-icon-blue: #257be4;
    --dashboard-icon-green: #279b56;
    --dashboard-icon-amber: #bb7220;
    --dashboard-icon-violet: #8354c7;
    --dashboard-icon-teal: #168b91;
    --dashboard-icon-ink: #fff;
}
.dashboard-personal-link > .dashboard-home-icon.dashboard-personal-icon { flex: 0 0 auto; background: var(--dashboard-icon-blue); color: var(--dashboard-icon-ink); }
.dashboard-personal-link > .dashboard-personal-icon[data-section="sales"] { background: var(--dashboard-icon-green); }
.dashboard-personal-link > .dashboard-personal-icon[data-section="rating"] { background: var(--dashboard-icon-amber); }
.dashboard-personal-link > .dashboard-personal-icon[data-section="listings"] { background: var(--dashboard-icon-violet); }
.dashboard-personal-link > .dashboard-personal-icon[data-section="reviews"] { background: var(--dashboard-icon-teal); }
.dashboard-personal-link b { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.dashboard-personal-link > svg { flex-shrink: 0; }
.dashboard-personal-link:focus-visible, .dashboard-personal-row:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.dashboard-personal-statistics { max-width: 960px; margin-inline: auto; align-content: start; }
.dashboard-personal-summary { display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 24px 12px; }
.dashboard-personal-summary strong { font-size: clamp(2rem, 7vw, 3rem); font-variant-numeric: tabular-nums; }
.dashboard-personal-summary span, .dashboard-personal-summary small { color: var(--text-secondary); text-align: center; }
.dashboard-personal-list { display: grid; gap: 0; min-width: 0; }
.dashboard-personal-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 4px; border-top: 1px solid var(--border); color: var(--text); text-decoration: none; min-width: 0; }
.dashboard-personal-row > div { min-width: 0; overflow-wrap: anywhere; }
.dashboard-personal-row p { white-space: pre-wrap; }
.dashboard-personal-row small { display: block; color: var(--text-secondary); margin-block-start: 5px; }
.dashboard-personal-row > span { flex-shrink: 0; color: var(--primary); }
.dashboard-personal-empty { padding: 24px; text-align: center; color: var(--text-secondary); }
@media (max-width: 640px) { .dashboard-personal-nav { grid-template-columns: minmax(0, 1fr); } }
.dashboard-statistics-header {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.dashboard-statistics-header button {
    min-width: 44px;
    min-height: 44px;
    padding: 10px 16px;
    border-radius: 14px;
}

.dashboard-statistics-header h1 {
    margin: 0;
    font-size: clamp(1.25rem, 3vw, 1.65rem);
    color: var(--text);
    background: none;
    -webkit-text-fill-color: currentColor;
    overflow-wrap: anywhere;
}

/* Statistics: headings stay in the document for assistive technology only. */
.dashboard-visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Round back control, identical to the settings header (.dxs-back): the
   settings variables are scoped to .dxs, so they are restated here. */
.dashboard-statistics-header .dashboard-back-btn {
    --dxs-card: var(--bg-secondary, #1e1e22);
    --dxs-line: color-mix(in srgb, var(--text) 10%, transparent);
    flex: 0 0 48px;
    width: 48px;
    min-width: 48px;
    height: 48px;
    min-height: 48px;
    padding: 0;
    border: 1px solid var(--dxs-line);
    border-radius: 50%;
    background: var(--dxs-card);
    color: var(--text);
}
.dashboard-statistics-header .dashboard-back-btn .dxs-icon svg { width: 27px; height: 27px; }
html[data-text-dir="rtl"] .dashboard-statistics-header .dashboard-back-btn svg { transform: scaleX(-1); }

.dashboard-home-secondary { display: contents; }

@media (min-width: 981px) {
    .dashboard-home-groups { grid-template-rows: auto max-content minmax(0, 1fr); }
    .dashboard-home-groups > .dashboard-home-group:has(#profile-action) {
        grid-column: 1 / -1;
    }
    .dashboard-home-groups > .dashboard-home-group:has(#new-deal-action) {
        grid-column: 1;
        grid-row: 2;
    }
    .dashboard-home-groups > .dashboard-home-group:has(#support-action) {
        grid-column: 1;
        grid-row: 3;
        align-self: start;
    }
    .dashboard-home-secondary {
        display: grid;
        grid-column: 2;
        grid-row: 2 / span 2;
        gap: 24px;
        min-width: 0;
        align-content: start;
    }
}

@media (max-width: 980px) {
    .dashboard-home-groups { grid-template-columns: minmax(0, 1fr); }
    .dashboard-home-header,
    .dashboard-home-content { width: min(calc(100% - 24px), 640px); }
}

@media (max-width: 480px) {
    .dashboard-home-header { padding: 18px 44px 16px; }
    .dashboard-home-content,
    .dashboard-home-groups { gap: 20px; }
    .dashboard-home-row,
    .dashboard-home-account,
    .dashboard-home-account-add { padding-inline: 14px; gap: 12px; }
    .dashboard-home-row + .dashboard-home-row::before { inset-inline: 58px 14px; }
    .dashboard-home-account + .dashboard-home-account::before,
    .dashboard-home-account-add::before { inset-inline: 66px 14px; }
}

@media (prefers-reduced-motion: reduce) {
    .dashboard-home :is(button, a),
    .dashboard-statistics-header button { transition: none; }
}

.dashboard-list,
.dashboard-activity-feed {
    display: grid;
    gap: 10px;
}

.dashboard-attention-section {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.dashboard-attention-section[hidden] {
    display: none;
}

.dashboard-attention-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.dashboard-attention-head h4 {
    margin: 0;
    min-width: 0;
    color: var(--warning);
    font-size: .86rem;
    font-weight: 750;
    overflow-wrap: anywhere;
}

.dashboard-attention-section .dashboard-deal-row {
    padding: 10px 12px;
    border-radius: 15px;
    border-color: rgba(245,158,11,.2);
}

.dashboard-deal-row,
.dashboard-notification-row,
.dashboard-activity-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 19px;
    background: rgba(255,255,255,.045);
    border: 1px solid rgba(148,163,184,.12);
    min-width: 0;
}

.dashboard-row-icon {
    width: 42px;
    height: 42px;
    border-radius: 16px;
    background: rgba(109,93,252,.15);
    color: #fff;
    font-size: 1.15rem;
}

.dashboard-row-icon.tone-primary,
.tone-primary.dashboard-row-icon { background: linear-gradient(135deg, #6d5dfc, #7c3aed); }
.dashboard-row-icon.tone-warning,
.tone-warning.dashboard-row-icon { background: linear-gradient(135deg, #f59e0b, #f97316); }
.dashboard-row-icon.tone-success,
.tone-success.dashboard-row-icon { background: linear-gradient(135deg, #10b981, #059669); }
.dashboard-row-icon.tone-danger,
.tone-danger.dashboard-row-icon { background: linear-gradient(135deg, #ef4444, #dc2626); }

.dashboard-row-main {
    min-width: 0;
    display: grid;
    gap: 3px;
    flex: 1 1 auto;
}

.dashboard-row-main b {
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-row-main span {
    color: var(--text-secondary);
    font-size: .86rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-row-main small {
    color: var(--text-muted);
    font-size: .76rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-row-side {
    display: grid;
    gap: 7px;
    justify-items: end;
    flex: 0 0 auto;
}

.dashboard-row-side b {
    color: var(--text);
    font-size: .9rem;
}

.dashboard-unread-dot {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: #ef4444;
    box-shadow: 0 0 0 4px rgba(239,68,68,.12);
}

/* Statistics rows: open with a tap and a menu-style chevron; a swipe towards
   the inline start reveals the chat-style «Удалить» action (same sizes and
   colours as .chat-item-swipe-actions), which runs the section clear. */
.dashboard-swipe-row {
    position: relative;
    overflow: hidden;
    border-radius: 19px;
    touch-action: pan-y;
}
.dashboard-swipe-content {
    position: relative;
    z-index: 2;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    transition: transform .2s cubic-bezier(.2,.8,.2,1);
}
.dashboard-swipe-row.is-swiping .dashboard-swipe-content { transition: none; will-change: transform; }
.dashboard-swipe-actions {
    position: absolute;
    z-index: 1;
    inset-block: 0;
    inset-inline-end: 0;
    width: var(--dashboard-swipe-reveal, 0px);
    display: flex;
    justify-content: flex-end;
    overflow: hidden;
}
.dashboard-swipe-delete {
    flex: 0 0 78px;
    min-width: 78px;
    padding: 6px 4px;
    border: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    color: var(--text-secondary);
    background: transparent;
    font: inherit;
    font-size: .6875rem;
    line-height: 1.2;
    font-weight: 600;
    letter-spacing: -.01em;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.dashboard-swipe-icon {
    width: 64px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    color: #fff;
    background: #e2232c;
    opacity: 0;
    transform: scale(.82);
    transition: opacity .16s ease, transform .18s cubic-bezier(.2,.8,.2,1);
}
.dashboard-swipe-icon svg { width: 25px; height: 25px; display: block; }
.dashboard-swipe-label { width: 100%; overflow: hidden; font-size: .6875rem; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-swipe-row:is(.is-swiping, .is-open) .dashboard-swipe-icon { opacity: 1; transform: scale(1); }
/* Keyboard: tabbing to the hidden action opens the rail without a pointer. */
.dashboard-swipe-row:has(.dashboard-swipe-delete:focus-visible) .dashboard-swipe-actions { width: 78px; }
.dashboard-swipe-row:has(.dashboard-swipe-delete:focus-visible) .dashboard-swipe-content { transform: translate3d(-78px,0,0); }
html[data-text-dir="rtl"] .dashboard-swipe-row:has(.dashboard-swipe-delete:focus-visible) .dashboard-swipe-content { transform: translate3d(78px,0,0); }
.dashboard-swipe-row:has(.dashboard-swipe-delete:focus-visible) .dashboard-swipe-icon { opacity: 1; transform: scale(1); outline: 2px solid var(--text); outline-offset: 2px; }
.dashboard-row-chevron {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
}
.dashboard-row-chevron:hover { color: var(--text); background: var(--bg-hover); }
.dashboard-row-chevron:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
html[data-text-dir="rtl"] .dashboard-row-chevron svg { transform: scaleX(-1); }
.dashboard-attention-section .dashboard-row-side { grid-auto-flow: column; align-items: center; gap: 4px; }
@media (max-width: 460px) {
    .dashboard-activity-row.dashboard-swipe-content { grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; }
}
@media (prefers-reduced-motion: reduce) {
    .dashboard-swipe-content, .dashboard-swipe-icon { transition: none; }
}

.dashboard-chart-controls { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; min-width: 0; }
.dashboard-chart-controls label { display: grid; gap: 5px; min-width: 0; color: var(--text-muted); font-size: .72rem; }
.dashboard-chart-controls label[hidden] { display: none; }
.dashboard-chart-controls .input { width: 100%; min-height: 44px; max-width: 270px; padding: 8px 30px 8px 12px; font-size: .8rem; color: var(--text); border-color: var(--border); background-color: var(--bg-secondary); }
.dashboard-chart-controls .input:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
/* Totals: one tile per metric; label above, tabular value below. A loaded but
   unavailable value («—», data-missing) is muted so it never reads as zero;
   while aria-busy is set the value shows a placeholder bar instead. */
.dashboard-chart-summary { display: grid; grid-template-columns: 1.15fr .85fr 1fr 1fr; gap: 10px; margin: 0 0 18px; }
.dashboard-chart-summary > div { display: flex; flex-direction: column; justify-content: space-between; gap: 10px; min-width: 0; padding: 14px 16px; border: 1px solid var(--border-light); border-radius: 16px; background: var(--bg-hover); }
.dashboard-chart-summary > .dashboard-chart-summary-main { border-color: color-mix(in srgb, var(--primary) 34%, transparent); background: color-mix(in srgb, var(--primary) 11%, var(--bg-hover)); }
.dashboard-chart-summary span { display: block; margin: 0; color: var(--text-muted); font-size: .74rem; font-weight: 600; line-height: 1.3; letter-spacing: .03em; text-transform: uppercase; overflow-wrap: anywhere; }
.dashboard-chart-summary b { display: block; min-height: 1.2em; font-size: clamp(1.15rem, 1.7vw, 1.5rem); color: var(--text); line-height: 1.2; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.dashboard-chart-summary .dashboard-chart-summary-main b { color: var(--primary-text); font-size: clamp(1.7rem, 2.8vw, 2.3rem); line-height: 1; letter-spacing: -.03em; }
.dashboard-chart-summary b[data-missing] { color: var(--text-muted); font-weight: 500; }
.dashboard-chart-summary[aria-busy="true"] b { width: min(5.5ch, 100%); border-radius: 8px; color: transparent; background: linear-gradient(90deg, var(--border-light) 0%, var(--border) 50%, var(--border-light) 100%) 0 0 / 200% 100%; animation: dashboard-summary-pending 1.3s ease-in-out infinite; }
@keyframes dashboard-summary-pending { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .dashboard-chart-summary[aria-busy="true"] b { animation: none; } }
.dashboard-chart-status { position: absolute; inset: 32% 20px auto; margin: 0; padding: 14px 20px; border-radius: 12px; text-align: center; color: var(--text-secondary); background: var(--bg-card); border: 1px solid var(--border); }
.dashboard-chart-status[hidden] { display: none; }
.dashboard-chart-data { margin-top: 12px; color: var(--text-muted); font-size: .78rem; }
.dashboard-chart-data > summary { display: list-item; width: fit-content; min-height: 44px; padding: 12px 4px; color: var(--text-secondary); cursor: pointer; }
.dashboard-chart-data > summary:hover { color: var(--primary-text); }
.dashboard-chart-data > summary:focus-visible, .dashboard-chart-table-scroll:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
.dashboard-chart-table-scroll { max-height: 300px; overflow: auto; overscroll-behavior: contain; }
.dashboard-chart-data table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.dashboard-chart-data caption { padding: 10px; text-align: start; color: var(--text-muted); }
.dashboard-chart-data :is(th, td) { padding: 10px 12px; text-align: end; border-bottom: 1px solid var(--border-light); white-space: nowrap; }
.dashboard-chart-data tr > :first-child { text-align: start; }
.dashboard-chart-data thead th { position: sticky; top: 0; background: var(--bg-card); color: var(--text-secondary); font-weight: 600; }
.dashboard-chart-data tbody th { font-weight: 500; }
@media (max-width: 720px) {
    .dashboard-panel-chart .dashboard-panel-head { flex-direction: column; }
    .dashboard-chart-controls { width: 100%; justify-content: flex-start; }
    .dashboard-chart-controls label { flex: 1 1 180px; }
    .dashboard-chart-controls .input { max-width: none; }
    .dashboard-chart-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
    .dashboard-chart-summary > div { padding: 12px; border-radius: 14px; }
    .dashboard-chart-summary b { font-size: 1.12rem; }
    .dashboard-chart-summary .dashboard-chart-summary-main b { font-size: 1.6rem; }
    .dashboard-chart-summary span { font-size: .7rem; }
}
/* Narrow phones: money totals (grouped with non-breaking spaces) get the full
   row so a long amount and its currency do not collide with the next tile. */
@media (max-width: 420px) {
    .dashboard-chart-summary > div:nth-child(n + 3) { grid-column: 1 / -1; }
}


.dashboard-chart-wrap {
    position: relative;
    height: clamp(230px, 30vw, 330px);
    min-height: 230px;
    padding: 8px 8px 4px;
    border-radius: 16px;
    border: 1px solid var(--border-light);
    background: var(--bg-hover);
}

.dashboard-chart-wrap canvas {
    display: block;
}

/* Empty chart: shown when the drawn metric has no positive value (is-empty,
   set from the same condition as the status text) or when the existing
   placeholder replaced the canvas. The chart is still built; it is only
   hidden, so axes and a blank grid are not presented as data. */
.dashboard-chart-empty-icon { display: none; }
.dashboard-v2 .dashboard-panel-chart .dashboard-chart-wrap.is-empty,
.dashboard-chart-wrap.is-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    height: auto !important;
    min-height: 168px !important;
    padding: 28px 20px;
    border-style: dashed;
}
.dashboard-chart-wrap.is-empty canvas {
    position: absolute;
    inset: 0;
    visibility: hidden;
    pointer-events: none;
}
.dashboard-chart-wrap.is-empty .dashboard-chart-empty-icon,
.dashboard-empty-chart .dashboard-chart-empty-icon {
    display: inline-grid;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: color-mix(in srgb, var(--primary) 20%, transparent);
    color: var(--primary-text);
}
.dashboard-chart-wrap.is-empty .dashboard-chart-empty-icon svg,
.dashboard-empty-chart .dashboard-chart-empty-icon svg { width: 26px; height: 26px; }
.dashboard-chart-wrap.is-empty .dashboard-chart-status {
    position: static;
    max-width: 40ch;
    padding: 0;
    border: 0;
    background: none;
    color: var(--text-secondary);
    font-size: .95rem;
    line-height: 1.45;
}
.dashboard-v2 .dashboard-panel-chart .dashboard-chart-wrap:has(> .dashboard-empty-chart) {
    height: auto !important;
    min-height: 0 !important;
    padding: 0;
    border: 0;
    background: none;
}
.dashboard-chart-wrap > .dashboard-empty-chart {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 168px;
    color: var(--text-secondary);
    font-size: .95rem;
}

.dashboard-mini-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.dashboard-mini-summary div {
    padding: 13px 16px;
    border-radius: 14px;
    background: rgba(255,255,255,.045);
    border: 1px solid rgba(148,163,184,.12);
}

.dashboard-mini-summary span {
    display: block;
    color: var(--text-muted);
    font-size: .78rem;
    margin-bottom: 4px;
}

.dashboard-mini-summary b {
    color: var(--text);
    font-size: 1.08rem;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

.dashboard-empty,
.dashboard-empty-chart {
    padding: 22px;
    border-radius: 20px;
    text-align: center;
    color: var(--text-muted);
    background: rgba(255,255,255,.035);
    border: 1px dashed rgba(148,163,184,.20);
}

.dashboard-empty b {
    display: block;
    color: var(--text);
    margin-bottom: 6px;
}

.dashboard-empty span {
    color: var(--text-muted);
    font-size: .86rem;
}

.dashboard-skeleton {
    height: 58px;
    border-radius: 18px;
    background: linear-gradient(90deg, rgba(148,163,184,.08), rgba(148,163,184,.15), rgba(148,163,184,.08));
    background-size: 200% 100%;
    animation: dashboardSkeleton 1.4s ease-in-out infinite;
}

@keyframes dashboardSkeleton {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

body.theme-light .dashboard-v2 .glass {
    background: rgba(255,255,255,.88) !important;
    border-color: rgba(15,23,42,.08) !important;
    box-shadow: 0 18px 45px rgba(15,23,42,.08) !important;
}

body.theme-light .dashboard-hero,
body.theme-light .dashboard-panel,
body.theme-light .dashboard-kpi-card {
    color: #0f172a !important;
}

body.theme-light .dashboard-hero h1,
body.theme-light .dashboard-panel-head .dashboard-quick-title,
body.theme-light .dashboard-panel-head h3,
body.theme-light .dashboard-kpi-value,
body.theme-light .dashboard-kpi-title,
body.theme-light .dashboard-action-card b,
body.theme-light .dashboard-row-main b,
body.theme-light .dashboard-row-side b,
body.theme-light .dashboard-mini-summary b,
body.theme-light .dashboard-empty b {
    color: #0f172a !important;
}

body.theme-light .dashboard-hero p,
body.theme-light .dashboard-panel-head p,
body.theme-light .dashboard-action-card small,
body.theme-light .dashboard-row-main span,
body.theme-light .dashboard-row-main small,
body.theme-light .dashboard-mini-summary span,
body.theme-light .dashboard-empty span,
body.theme-light .dashboard-hero-wallet span {
    color: #64748b !important;
}

body.theme-light .dashboard-deal-row,
body.theme-light .dashboard-notification-row,
body.theme-light .dashboard-activity-row,
body.theme-light .dashboard-mini-summary div,
body.theme-light .dashboard-empty,
body.theme-light .dashboard-empty-chart,
body.theme-light .dashboard-hero-wallet {
    background: rgba(248,250,252,.92) !important;
    border-color: rgba(15,23,42,.08) !important;
}

@media (max-width: 1180px) {
    .dashboard-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-main-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .dashboard-v2 {
        gap: 14px;
    }

    .dashboard-hero {
        display: grid;
        padding: 18px;
        border-radius: 24px;
    }

    .dashboard-hero-wallet {
        flex-basis: auto;
        width: auto;
    }

    .dashboard-kpi-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 6px;
    }

    .dashboard-kpi-card {
        min-width: 0;
        min-height: 124px;
        padding: 9px 4px;
        border-radius: 17px;
        flex-direction: column;
        justify-content: center;
        gap: 6px;
        text-align: center;
    }

    .dashboard-kpi-icon {
        width: 32px;
        height: 32px;
        min-width: 32px;
        min-height: 32px;
        border-radius: 12px;
    }

    .dashboard-kpi-icon svg {
        width: 18px;
        height: 18px;
    }

    .dashboard-kpi-content {
        width: 100%;
        justify-items: center;
    }

    .dashboard-kpi-value {
        font-size: 1.15rem;
    }

    .dashboard-kpi-title {
        min-height: 2.24em;
        display: grid;
        align-items: center;
        font-size: clamp(.58rem, 2.35vw, .72rem);
        line-height: 1.12;
        overflow-wrap: anywhere;
    }

    .dashboard-kpi-content small {
        font-size: clamp(.53rem, 2.1vw, .64rem);
        line-height: 1.12;
        overflow-wrap: anywhere;
    }

    .dashboard-panel {
        padding: 14px;
        border-radius: 22px;
    }

    .dashboard-deal-row,
    .dashboard-activity-row {
        align-items: flex-start;
    }

    .dashboard-row-side {
        justify-items: start;
    }

    .dashboard-chart-wrap {
        height: 240px;
        min-height: 240px;
    }
}

@media (max-width: 460px) {
    .dashboard-attention-head {
        flex-wrap: wrap;
    }

    .dashboard-deal-row,
    .dashboard-activity-row {
        display: grid;
        grid-template-columns: 42px minmax(0, 1fr);
    }

    .dashboard-row-side {
        grid-column: 2;
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
    }

    .dashboard-mini-summary div {
        padding: 10px 12px;
    }

    .dashboard-mini-summary b {
        font-size: .94rem;
    }
}


/* ===== Stage 26A: Disputes page polish ===== */

.disputes-v2 {
    display: grid;
    gap: 18px;
    padding-bottom: 24px;
}

/* An empty list has no detail panel to fill the viewport. */
.disputes-v2:has(.disputes-empty-state) {
    align-content: start;
}

.disputes-v2 .glass {
    background: rgba(20, 28, 45, .62);
    border: 1px solid rgba(255,255,255,.075);
    box-shadow: 0 18px 45px rgba(0,0,0,.16);
}

.disputes-hero {
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: space-between;
    gap: 18px;
    padding: 22px;
    border-radius: 28px;
}

.disputes-hero::before {
    content: "";
    position: absolute;
    inset: -80px -110px auto auto;
    width: 260px;
    height: 260px;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(239,68,68,.24), transparent 62%);
    pointer-events: none;
}

.disputes-hero-main,
.disputes-hero-note {
    position: relative;
}

.disputes-kicker {
    color: #f97316;
    font-weight: 850;
    font-size: .78rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.disputes-hero h1 {
    margin: 0 0 8px;
    color: var(--text);
    background: none;
    -webkit-text-fill-color: initial;
    font-size: clamp(1.5rem, 3vw, 2.25rem);
}

.disputes-hero p {
    max-width: 660px;
    margin: 0;
    color: var(--text-secondary);
}

.disputes-hero-note {
    flex: 0 0 300px;
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 16px;
    border-radius: 22px;
    background: rgba(255,255,255,.05);
    border: 1px solid rgba(255,255,255,.08);
}

.disputes-hero-icon,
.disputes-kpi-icon,
.dispute-row-icon,
.disputes-empty-state > span,
.dispute-details-empty > span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.disputes-hero-icon {
    width: 48px;
    height: 48px;
    border-radius: 18px;
    color: #fff;
    background: linear-gradient(135deg, #f97316, #ef4444);
    flex: 0 0 auto;
}

.disputes-hero-note b {
    display: block;
    color: var(--text);
    margin-bottom: 4px;
}

.disputes-hero-note span {
    color: var(--text-muted);
    font-size: .85rem;
}

.disputes-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.disputes-kpi-card {
    appearance: none;
    border: 0;
    text-align: left;
    cursor: pointer;
    border-radius: 24px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 13px;
    color: var(--text);
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.disputes-kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 22px 46px rgba(0,0,0,.22);
}

.disputes-kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 18px;
    color: #fff;
    background: rgba(109,93,252,.18);
    flex: 0 0 auto;
}

.disputes-kpi-card.tone-primary .disputes-kpi-icon { background: linear-gradient(135deg, #6d5dfc, #7c3aed); }
.disputes-kpi-card.tone-warning .disputes-kpi-icon { background: linear-gradient(135deg, #f59e0b, #f97316); }
.disputes-kpi-card.tone-success .disputes-kpi-icon { background: linear-gradient(135deg, #10b981, #059669); }
.disputes-kpi-card.tone-muted .disputes-kpi-icon { background: linear-gradient(135deg, #64748b, #475569); }

.disputes-kpi-card span:last-child {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.disputes-kpi-card b {
    color: var(--text);
    font-size: 1.55rem;
    line-height: 1;
}

.disputes-kpi-card strong {
    color: var(--text);
    font-size: .92rem;
}

.disputes-kpi-card small {
    color: var(--text-muted);
}

.disputes-shell {
    border-radius: 28px;
    padding: 16px;
    min-width: 0;
}

.disputes-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    margin-bottom: 16px;
}

/* Same native tab surface as .feed-tabs, scoped to the disputes page.
   Five localized labels stay on one horizontally scrollable row. */
.disputes-tabs {
    display: flex;
    flex-wrap: nowrap;
    gap: 0;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--bg-card);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    box-shadow: 0 2px 12px rgba(0,0,0,.06);
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    scroll-behavior: auto;
}

.dispute-filter-chip {
    position: relative;
    flex: 1 0 0;
    min-width: max-content;
    height: 52px;
    min-height: 52px;
    padding: 0 12px;
    appearance: none;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--text-muted);
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background .16s ease, color .16s ease;
}

.dispute-filter-chip:hover,
.dispute-filter-chip:focus-visible {
    background: var(--bg-hover);
}
.dispute-filter-chip:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}
.dispute-filter-chip.active {
    color: var(--text);
    font-weight: 800;
}
.dispute-filter-chip.active::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 0;
    width: 56px;
    height: 4px;
    border-radius: 999px;
    background: var(--primary);
    transform: translateX(-50%);
}
@media (prefers-reduced-motion: reduce) {
    .dispute-filter-chip { transition: none; }
}

.disputes-search {
    justify-self: end;
    box-sizing: border-box;
    width: min(100%, 320px);
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 220px;
    padding: 0 12px;
    height: 42px;
    border-radius: 18px;
    color: var(--text-muted);
    background: rgba(255,255,255,.045);
    border: 1px solid rgba(148,163,184,.14);
}

.disputes-search input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: none;
    background: transparent;
    color: var(--text);
}

.disputes-search input::placeholder {
    color: var(--text-muted);
}

.disputes-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(330px, .95fr);
    gap: 16px;
    align-items: start;
}

.disputes-layout:has(.disputes-empty-state) {
    grid-template-columns: minmax(0, 1fr);
}

.disputes-layout:has(.disputes-empty-state) > .dispute-details-panel {
    display: none;
}

.disputes-list-v2 {
    display: grid;
    gap: 12px;
}

.dispute-card-v2 {
    border-radius: 23px;
    padding: 14px;
    background: rgba(255,255,255,.045);
    border: 1px solid rgba(148,163,184,.13);
    cursor: pointer;
    transition: transform .16s ease, border-color .16s ease, background .16s ease, box-shadow .16s ease;
}

.dispute-card-v2:hover,
.dispute-card-v2.selected {
    transform: translateY(-1px);
    border-color: rgba(109,93,252,.38);
    background: rgba(109,93,252,.075);
    box-shadow: 0 18px 42px rgba(0,0,0,.18);
}

.dispute-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.dispute-card-title {
    display: flex;
    gap: 11px;
    min-width: 0;
}

.dispute-row-icon {
    width: 42px;
    height: 42px;
    border-radius: 16px;
    color: #fff;
    flex: 0 0 auto;
}

.dispute-row-icon.tone-danger { background: linear-gradient(135deg, #ef4444, #dc2626); }
.dispute-row-icon.tone-warning { background: linear-gradient(135deg, #f59e0b, #f97316); }
.dispute-row-icon.tone-success { background: linear-gradient(135deg, #10b981, #059669); }

.dispute-card-title h3 {
    margin: 0 0 4px;
    color: var(--text);
    font-size: 1rem;
}

.dispute-card-title small {
    color: var(--text-muted);
}

.dispute-status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: .75rem;
    font-weight: 850;
    white-space: nowrap;
}

.dispute-status-pill.tone-danger {
    color: #fecaca;
    background: rgba(239,68,68,.14);
    border: 1px solid rgba(239,68,68,.22);
}

.dispute-status-pill.tone-warning {
    color: #fed7aa;
    background: rgba(245,158,11,.14);
    border: 1px solid rgba(245,158,11,.22);
}

.dispute-status-pill.tone-success {
    color: #bbf7d0;
    background: rgba(16,185,129,.14);
    border: 1px solid rgba(16,185,129,.22);
}

.dispute-card-mainline {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.dispute-card-mainline b {
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dispute-card-mainline span,
.dispute-last-message {
    color: var(--text-secondary);
    font-size: .86rem;
}

.dispute-last-message {
    margin: 10px 0 0;
    padding: 10px 12px;
    border-radius: 16px;
    background: rgba(255,255,255,.035);
    border: 1px solid rgba(148,163,184,.10);
}

.dispute-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 11px;
}

.dispute-card-meta span {
    color: var(--text-muted);
    background: rgba(148,163,184,.10);
    border: 1px solid rgba(148,163,184,.12);
    border-radius: 999px;
    padding: 5px 9px;
    font-size: .76rem;
}

.dispute-card-actions,
.dispute-details-actions,
.dispute-message-modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin-top: 13px;
}

.dispute-details-panel {
    position: sticky;
    top: 78px;
    min-width: 0;
}

.dispute-details-card,
.dispute-details-empty {
    border-radius: 25px;
    padding: 18px;
    background: rgba(255,255,255,.045);
    border: 1px solid rgba(148,163,184,.13);
}

.dispute-details-empty {
    display: grid;
    place-items: center;
    text-align: center;
    min-height: 340px;
    color: var(--text-muted);
}

.dispute-details-empty > span,
.disputes-empty-state > span {
    width: 58px;
    height: 58px;
    border-radius: 22px;
    color: #fff;
    background: linear-gradient(135deg, #7c3aed, #6d5dfc);
    margin-bottom: 12px;
}

.dispute-details-empty h3,
.disputes-empty-state h3 {
    margin: 0 0 6px;
    color: var(--text);
}

.dispute-details-empty p,
.disputes-empty-state p {
    margin: 0;
    color: var(--text-muted);
}

.dispute-details-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 14px;
}

.dispute-details-kicker {
    display: block;
    color: var(--primary);
    font-weight: 850;
    font-size: .74rem;
    letter-spacing: .06em;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.dispute-details-head h3 {
    margin: 0;
    color: var(--text);
}

.dispute-details-deal {
    padding: 14px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(109,93,252,.16), rgba(124,58,237,.08));
    border: 1px solid rgba(167,139,250,.18);
    margin-bottom: 13px;
}

.dispute-details-deal b {
    display: block;
    color: var(--text);
    margin-bottom: 4px;
}

.dispute-details-deal span {
    color: var(--text-secondary);
}

.dispute-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    margin-bottom: 15px;
}

.dispute-detail-grid div {
    padding: 11px;
    border-radius: 16px;
    background: rgba(255,255,255,.035);
    border: 1px solid rgba(148,163,184,.10);
    min-width: 0;
}

.dispute-detail-grid span {
    display: block;
    color: var(--text-muted);
    font-size: .76rem;
    margin-bottom: 4px;
}

.dispute-detail-grid b {
    color: var(--text);
    font-size: .86rem;
    word-break: break-word;
}

.dispute-timeline {
    display: grid;
    gap: 10px;
    margin: 16px 0;
}

.dispute-timeline-item {
    display: grid;
    grid-template-columns: 18px 1fr;
    gap: 10px;
    color: var(--text-muted);
}

.dispute-timeline-item i {
    width: 14px;
    height: 14px;
    border-radius: 999px;
    margin-top: 4px;
    background: rgba(148,163,184,.24);
    box-shadow: 0 0 0 4px rgba(148,163,184,.08);
}

.dispute-timeline-item.active i {
    background: #7c3aed;
    box-shadow: 0 0 0 4px rgba(124,58,237,.16);
}

.dispute-timeline-item b {
    display: block;
    color: var(--text);
    margin-bottom: 2px;
}

.dispute-timeline-item span {
    color: var(--text-muted);
    font-size: .82rem;
}

.dispute-detail-message {
    padding: 13px;
    border-radius: 18px;
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(148,163,184,.12);
}

.dispute-detail-message span {
    display: block;
    color: var(--text-muted);
    font-size: .75rem;
    margin-bottom: 6px;
}

.dispute-detail-message p {
    margin: 0;
    color: var(--text-secondary);
}

.dispute-detail-message.muted {
    border-style: dashed;
}

.disputes-empty-state {
    display: grid;
    place-items: center;
    text-align: center;
    min-height: 320px;
    padding: 28px 16px;
    border-radius: 24px;
    background: rgba(255,255,255,.035);
    border: 1px dashed rgba(148,163,184,.20);
}

.dispute-skeleton {
    height: 132px;
    border-radius: 23px;
    background: linear-gradient(90deg, rgba(148,163,184,.08), rgba(148,163,184,.15), rgba(148,163,184,.08));
    background-size: 200% 100%;
    animation: disputeSkeleton 1.4s ease-in-out infinite;
}

@keyframes disputeSkeleton {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.dispute-message-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 10060;
    background: rgba(2,6,23,.58);
    backdrop-filter: blur(10px);
    display: grid;
    place-items: center;
    padding: 16px;
}

.dispute-message-modal {
    width: min(520px, 100%);
    border-radius: 26px;
    padding: 18px;
}

.dispute-message-modal-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.dispute-message-modal-head h3 {
    margin: 0 0 4px;
    color: var(--text);
}

.dispute-message-modal-head p {
    margin: 0;
    color: var(--text-muted);
}

.dispute-message-modal-head button {
    border: 0;
    border-radius: 14px;
    width: 38px;
    height: 38px;
    cursor: pointer;
    color: var(--text);
    background: rgba(255,255,255,.08);
    font-size: 24px;
    line-height: 1;
}

#dispute-message-textarea {
    width: 100%;
    min-height: 150px;
    resize: vertical;
    border: 1px solid rgba(148,163,184,.18);
    border-radius: 18px;
    outline: none;
    padding: 13px;
    background: rgba(255,255,255,.055);
    color: var(--text);
    box-sizing: border-box;
}

#dispute-message-textarea:focus {
    border-color: rgba(109,93,252,.55);
    box-shadow: 0 0 0 4px rgba(109,93,252,.12);
}

body.theme-light .disputes-v2 .glass,
body.theme-light .dispute-message-modal.glass {
    background: rgba(255,255,255,.88) !important;
    border-color: rgba(15,23,42,.08) !important;
    box-shadow: 0 18px 45px rgba(15,23,42,.08) !important;
}

body.theme-light .disputes-hero h1,
body.theme-light .disputes-kpi-card b,
body.theme-light .disputes-kpi-card strong,
body.theme-light .dispute-card-title h3,
body.theme-light .dispute-card-mainline b,
body.theme-light .dispute-details-head h3,
body.theme-light .dispute-details-deal b,
body.theme-light .dispute-detail-grid b,
body.theme-light .dispute-timeline-item b,
body.theme-light .disputes-empty-state h3,
body.theme-light .dispute-details-empty h3,
body.theme-light .dispute-message-modal-head h3 {
    color: #0f172a !important;
}

body.theme-light .disputes-hero p,
body.theme-light .disputes-hero-note span,
body.theme-light .disputes-kpi-card small,
body.theme-light .dispute-card-title small,
body.theme-light .dispute-card-mainline span,
body.theme-light .dispute-last-message,
body.theme-light .dispute-card-meta span,
body.theme-light .dispute-details-deal span,
body.theme-light .dispute-detail-grid span,
body.theme-light .dispute-timeline-item span,
body.theme-light .dispute-detail-message p,
body.theme-light .dispute-detail-message span,
body.theme-light .disputes-empty-state p,
body.theme-light .dispute-details-empty p,
body.theme-light .dispute-message-modal-head p {
    color: #64748b !important;
}

body.theme-light .disputes-hero-note,
body.theme-light .dispute-card-v2,
body.theme-light .dispute-details-card,
body.theme-light .dispute-details-empty,
body.theme-light .dispute-last-message,
body.theme-light .dispute-detail-grid div,
body.theme-light .dispute-detail-message,
body.theme-light .disputes-empty-state,
body.theme-light .disputes-search,
body.theme-light #dispute-message-textarea {
    background: rgba(248,250,252,.92) !important;
    border-color: rgba(15,23,42,.08) !important;
}

body.theme-light .disputes-search input,
body.theme-light #dispute-message-textarea {
    color: #0f172a !important;
}

body.theme-light .dispute-status-pill.tone-danger {
    color: #991b1b;
    background: rgba(239,68,68,.11);
}

body.theme-light .dispute-status-pill.tone-warning {
    color: #92400e;
    background: rgba(245,158,11,.13);
}

body.theme-light .dispute-status-pill.tone-success {
    color: #047857;
    background: rgba(16,185,129,.12);
}

@media (max-width: 1180px) {
    .disputes-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .disputes-layout {
        grid-template-columns: 1fr;
    }

    .dispute-details-panel {
        position: static;
    }
}

@media (max-width: 760px) {
    .disputes-v2 {
        gap: 14px;
    }

    .dispute-filter-chip {
        min-height: 44px;
    }

    .disputes-hero {
        display: grid;
        padding: 18px;
        border-radius: 24px;
    }

    .disputes-hero-note {
        flex-basis: auto;
    }

    .disputes-kpi-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .disputes-shell {
        padding: 12px;
        border-radius: 24px;
    }

    .disputes-toolbar {
        display: grid;
    }

    .disputes-search {
        min-width: 0;
        width: 100%;
        flex-basis: auto;
    }

    .dispute-detail-grid {
        grid-template-columns: 1fr;
    }

    .dispute-card-actions,
    .dispute-details-actions {
        display: grid;
    }

    .dispute-card-actions .btn,
    .dispute-details-actions .btn {
        width: 100%;
    }
}

@media (max-width: 460px) {
    .dispute-card-top,
    .dispute-details-head {
        display: grid;
    }

    .dispute-status-pill {
        justify-self: start;
    }

    .dispute-card-meta {
        gap: 5px;
    }

    .dispute-card-meta span {
        font-size: .72rem;
        padding: 4px 8px;
    }
}


/* ===== Stage 26B: disputes open-deal action button polish ===== */
.disputes-v2 .dispute-card-actions .btn[data-open-deal],
.disputes-v2 .dispute-details-actions .btn[data-open-deal] {
    min-height: 38px;
    padding: 9px 16px;
    border-radius: 16px;
    color: #fff !important;
    font-weight: 900;
    letter-spacing: .01em;
    background: linear-gradient(135deg, rgba(109,93,252,.98), rgba(59,130,246,.96)) !important;
    border: 1px solid rgba(255,255,255,.18) !important;
    box-shadow: 0 14px 32px rgba(109,93,252,.28), inset 0 1px 0 rgba(255,255,255,.20) !important;
    opacity: 1 !important;
    text-decoration: none;
}

.disputes-v2 .dispute-details-actions .btn[data-open-deal] {
    min-height: 44px;
    padding-inline: 20px;
    border-radius: 18px;
}

.disputes-v2 .dispute-card-actions .btn[data-open-deal]:hover:not(:disabled),
.disputes-v2 .dispute-details-actions .btn[data-open-deal]:hover:not(:disabled) {
    transform: translateY(-1px);
    background: linear-gradient(135deg, rgba(124,58,237,.98), rgba(37,99,235,.98)) !important;
    box-shadow: 0 18px 40px rgba(109,93,252,.38), inset 0 1px 0 rgba(255,255,255,.22) !important;
}

.disputes-v2 .dispute-card-actions .btn[data-open-deal]:active,
.disputes-v2 .dispute-details-actions .btn[data-open-deal]:active {
    transform: translateY(0);
}

body.theme-glass .disputes-v2 .dispute-card-actions .btn[data-open-deal],
body.theme-glass .disputes-v2 .dispute-details-actions .btn[data-open-deal] {
    background: linear-gradient(135deg, rgba(167,139,250,.96), rgba(96,165,250,.92)) !important;
    border-color: rgba(255,255,255,.26) !important;
    box-shadow: 0 16px 38px rgba(139,92,246,.32), inset 0 1px 0 rgba(255,255,255,.26) !important;
    backdrop-filter: blur(14px);
}

body.theme-light .disputes-v2 .dispute-card-actions .btn[data-open-deal],
body.theme-light .disputes-v2 .dispute-details-actions .btn[data-open-deal] {
    color: #fff !important;
    background: linear-gradient(135deg, #4f46e5, #7c3aed) !important;
    border-color: rgba(79,70,229,.18) !important;
    box-shadow: 0 14px 30px rgba(79,70,229,.22), inset 0 1px 0 rgba(255,255,255,.28) !important;
}

body.theme-light .disputes-v2 .dispute-card-actions .btn[data-open-deal]:hover:not(:disabled),
body.theme-light .disputes-v2 .dispute-details-actions .btn[data-open-deal]:hover:not(:disabled) {
    background: linear-gradient(135deg, #4338ca, #6d28d9) !important;
    box-shadow: 0 18px 38px rgba(79,70,229,.30), inset 0 1px 0 rgba(255,255,255,.30) !important;
}


/* ===== Stage 27A: Security settings center v3 — UI-only ===== */

.security-v2.security-center-v3 {
    width: 100%;
    margin: 0 auto;
    padding: 6px 0 34px;
}

.security-center-v3 .security-main-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    align-items: start;
}

.security-center-v3 .glass {
    background: rgba(16, 23, 39, .78);
    border: 1px solid rgba(148, 163, 184, .12);
    box-shadow: 0 14px 36px rgba(2, 6, 23, .12);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.security-center-v3 .security-panel {
    min-width: 0;
    padding: 0;
    border-radius: 17px;
    overflow: hidden;
}

.security-center-v3 .security-setting-details {
    display: block;
}

.security-center-v3 .security-setting-details > summary {
    list-style: none;
}

.security-center-v3 .security-setting-details > summary::-webkit-details-marker {
    display: none;
}

.security-center-v3 .security-setting-summary,
.security-center-v3 .security-setting-row {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    min-height: 78px;
    padding: 15px 17px;
    box-sizing: border-box;
}

.security-center-v3 .security-setting-summary {
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: background .16s ease;
}

.security-center-v3 .security-setting-summary:hover {
    background: rgba(148, 163, 184, .045);
}

.security-center-v3 .security-setting-summary:focus-visible {
    outline: 2px solid rgba(109, 93, 252, .56);
    outline-offset: -2px;
}

.security-center-v3 .security-setting-icon,
.security-center-v3 .security-row-icon,
.security-center-v3 .security-empty-state > span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.security-center-v3 .security-setting-icon {
    width: 42px;
    height: 42px;
    border-radius: 13px;
    color: #cbd5e1;
    background: rgba(100, 116, 139, .13);
    border: 1px solid rgba(148, 163, 184, .10);
}

.security-center-v3 .security-setting-icon svg {
    width: 22px;
    height: 22px;
}

.security-center-v3 .security-setting-icon.tone-primary {
    color: #c4b5fd;
    background: rgba(109, 93, 252, .12);
    border-color: rgba(139, 92, 246, .16);
}

.security-center-v3 .security-setting-icon.tone-success {
    color: #6ee7b7;
    background: rgba(16, 185, 129, .10);
    border-color: rgba(16, 185, 129, .16);
}

.security-center-v3 .security-setting-icon.tone-muted {
    color: #94a3b8;
}

.security-center-v3 .security-setting-copy {
    min-width: 0;
}

.security-center-v3 .security-setting-copy > b,
.security-center-v3 .security-setting-copy > h3 {
    display: block;
    margin: 0;
    color: var(--text);
    font-size: .98rem;
    line-height: 1.28;
    font-weight: 750;
}

.security-center-v3 .security-setting-copy > small,
.security-center-v3 .security-setting-copy > p {
    display: block;
    margin: 3px 0 0;
    color: var(--text-muted);
    font-size: .82rem;
    line-height: 1.42;
}

.security-center-v3 .security-setting-meta,
.security-center-v3 .security-setting-controls {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    min-width: 0;
}

.security-center-v3 .security-setting-chevron {
    width: 9px;
    height: 9px;
    border-right: 1.8px solid currentColor;
    border-bottom: 1.8px solid currentColor;
    color: #64748b;
    transform: rotate(45deg) translateY(-2px);
    transition: transform .18s ease;
}

.security-center-v3 details[open] .security-setting-chevron {
    transform: rotate(225deg) translate(-1px, -1px);
}

.security-center-v3 .security-setting-body {
    padding: 2px 17px 17px 75px;
    border-top: 1px solid rgba(148, 163, 184, .08);
}

.security-center-v3 .security-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding-top: 15px;
}

.security-center-v3 .security-form label {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.security-center-v3 .security-form label span {
    color: var(--text-secondary);
    font-size: .79rem;
    font-weight: 680;
}

.security-center-v3 .security-form input,
.security-center-v3 #security-2fa-form input {
    width: 100%;
    height: 43px;
    box-sizing: border-box;
    padding: 0 12px;
    border: 1px solid rgba(148, 163, 184, .15);
    border-radius: 12px;
    outline: none;
    color: var(--text);
    background: rgba(255, 255, 255, .035);
    transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

.security-center-v3 .security-form input:hover {
    border-color: rgba(148, 163, 184, .23);
}

.security-center-v3 .security-form input:focus {
    border-color: rgba(109, 93, 252, .58);
    background: rgba(255, 255, 255, .05);
    box-shadow: 0 0 0 3px rgba(109, 93, 252, .10);
}

.security-center-v3 .security-code-actions {
    grid-column: 1 / -1;
}

.security-center-v3 .security-form-submit {
    grid-column: 1 / -1;
    justify-self: start;
    width: auto;
    min-width: 190px;
    min-height: 42px;
    padding-inline: 22px;
}

.security-center-v3 .security-form-submit-danger {
    background: rgba(239, 68, 68, .10) !important;
    color: #fca5a5 !important;
    border: 1px solid rgba(239, 68, 68, .24) !important;
    box-shadow: none !important;
}

.security-center-v3 .security-form-submit-danger:hover:not(:disabled) {
    background: rgba(239, 68, 68, .16) !important;
    border-color: rgba(239, 68, 68, .34) !important;
}

.security-center-v3 .security-compact-panel {
    padding: 0;
}

.security-center-v3 .security-setting-row {
    min-height: 86px;
}

.security-center-v3 .security-idle-lock-box {
    border: 0;
    border-radius: 0;
    background: transparent;
}

.security-center-v3 .security-idle-lock-box.enabled {
    background: transparent;
}

.security-center-v3 .security-idle-lock-copy {
    display: block;
}

/* Owner 2026-10-18: «на странице безопасности слишком много технического текста».
   The detail title repeats the status pill and the idle-lock paragraph repeats
   the subtitle: both stay in the DOM (the page updates them) but are not shown.
   The short privacy line of the account memory stays. */
/* 0-3-0: above .security-setting-copy > b (0-2-1), which shows the memory title. */
.security-center-v3 .security-setting-copy > .security-setting-detail-title {
    display: none;
    margin-top: 9px;
    color: var(--text-secondary);
    font-size: .77rem;
    font-weight: 650;
}

.security-center-v3 .security-idle-lock-copy .security-setting-detail-title + p {
    margin-top: 4px;
    font-size: .77rem;
    color: var(--text-muted);
}

.security-center-v3 .security-idle-lock-copy #security-idle-lock-text {
    display: none;
}

.security-center-v3 .security-idle-lock-period {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.security-center-v3 .security-idle-lock-period > span {
    font-size: .76rem;
    color: var(--text-muted);
}

.security-center-v3 .security-idle-lock-period .select {
    width: auto;
    min-width: 108px;
    min-height: 34px;
    padding: 5px 9px;
    font-size: .78rem;
}

.security-center-v3 .security-idle-lock-period .select:disabled {
    opacity: .55;
    cursor: not-allowed;
}

/* The period select is described by this note (aria-describedby): read, not shown. */
.security-center-v3 .security-idle-lock-note {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

.security-center-v3 .security-status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 27px;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: .69rem;
    font-weight: 760;
    white-space: nowrap;
}

.security-center-v3 .security-status-pill.tone-success {
    color: #6ee7b7;
    background: rgba(16, 185, 129, .09);
    border: 1px solid rgba(16, 185, 129, .15);
}

.security-center-v3 .security-status-pill.tone-warning {
    color: #fbbf24;
    background: rgba(245, 158, 11, .08);
    border: 1px solid rgba(245, 158, 11, .14);
}

.security-center-v3 .security-status-pill.tone-muted {
    color: #94a3b8;
    background: rgba(100, 116, 139, .08);
    border: 1px solid rgba(148, 163, 184, .12);
}

.security-center-v3 .security-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    width: 46px;
    height: 27px;
    flex: 0 0 auto;
    cursor: pointer;
}

.security-center-v3 .security-switch input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.security-center-v3 .security-switch > span {
    position: relative;
    width: 46px;
    height: 27px;
    border-radius: 999px;
    background: rgba(100, 116, 139, .30);
    border: 1px solid rgba(148, 163, 184, .18);
    transition: background .18s ease, border-color .18s ease;
}

.security-center-v3 .security-switch > span::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 19px;
    height: 19px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 4px 12px rgba(2, 6, 23, .24);
    transition: transform .18s ease;
}

.security-center-v3 .security-switch input:checked + span {
    background: linear-gradient(135deg, #6d5dfc, #7c3aed);
    border-color: rgba(139, 92, 246, .35);
}

.security-center-v3 .security-switch input:checked + span::after {
    transform: translateX(19px);
}

.security-center-v3 .security-switch input:focus-visible + span {
    box-shadow: 0 0 0 3px rgba(109, 93, 252, .18);
}

.security-center-v3 .security-switch input:disabled + span {
    opacity: .58;
    cursor: progress;
}

.security-center-v3 .security-panel-access {
    padding: 17px;
    border-radius: 17px;
}

.security-center-v3 .security-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin: 0;
}

.security-center-v3 .security-panel-head h3 {
    margin: 0 0 3px;
    color: var(--text);
    font-size: .98rem;
}

.security-center-v3 .security-panel-head p {
    margin: 0;
    color: var(--text-muted);
    font-size: .79rem;
}

.security-center-v3 .security-link-btn {
    appearance: none;
    border: 0;
    background: transparent;
    color: #a78bfa;
    font-size: .77rem;
    font-weight: 720;
    cursor: pointer;
    padding: 3px 0;
}

/* Light theme: #a78bfa on white was 2.65:1 (contrast audit 2026-10-13). */
body.theme-light .security-center-v3 .security-link-btn {
    color: var(--primary-text);
}

.security-center-v3 .security-list {
    display: grid;
    gap: 7px;
}

.security-center-v3 .security-session-row,
.security-center-v3 .security-history-row {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
    padding: 10px 11px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, .09);
    background: rgba(255, 255, 255, .025);
}

.security-center-v3 .security-session-row.current {
    background: rgba(16, 185, 129, .035);
    border-color: rgba(16, 185, 129, .13);
}

.security-center-v3 .security-row-icon {
    width: 37px;
    height: 37px;
    border-radius: 11px;
    color: #cbd5e1;
    background: rgba(100, 116, 139, .14);
}

.security-center-v3 .security-row-icon svg {
    width: 20px;
    height: 20px;
}

.security-center-v3 .security-row-icon.tone-primary { color: #c4b5fd; background: rgba(109,93,252,.11); }
.security-center-v3 .security-row-icon.tone-success { color: #6ee7b7; background: rgba(16,185,129,.09); }
.security-center-v3 .security-row-icon.tone-warning { color: #fbbf24; background: rgba(245,158,11,.09); }
.security-center-v3 .security-row-icon.tone-danger { color: #fca5a5; background: rgba(239,68,68,.09); }

.security-center-v3 .security-row-main {
    display: grid;
    gap: 2px;
    flex: 1 1 auto;
    min-width: 0;
}

.security-center-v3 .security-row-main b {
    color: var(--text);
    font-size: .86rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.security-center-v3 .security-row-main span {
    color: var(--text-secondary);
    font-size: .77rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.security-center-v3 .security-row-main small {
    color: var(--text-muted);
    font-size: .70rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.security-center-v3 .security-row-actions {
    flex: 0 0 auto;
}

.security-center-v3 .security-empty-state {
    display: grid;
    place-items: center;
    text-align: center;
    gap: 6px;
    min-height: 128px;
    padding: 18px;
    border-radius: 12px;
    border: 1px dashed rgba(148, 163, 184, .15);
    background: rgba(255, 255, 255, .02);
}

.security-center-v3 .security-empty-state > span {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    color: #c4b5fd;
    background: rgba(109, 93, 252, .10);
}

.security-center-v3 .security-empty-state b { color: var(--text); }
.security-center-v3 .security-empty-state small { color: var(--text-muted); }

.security-center-v3 .security-skeleton {
    height: 58px;
    border-radius: 11px;
    background: linear-gradient(90deg, rgba(148,163,184,.05), rgba(148,163,184,.11), rgba(148,163,184,.05));
    background-size: 200% 100%;
    animation: securitySkeleton 1.4s ease-in-out infinite;
}

@keyframes securitySkeleton {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

body.theme-light .security-center-v3 .glass,
[data-theme="light"] .security-center-v3 .glass {
    background: rgba(255,255,255,.86) !important;
    border-color: rgba(15,23,42,.08) !important;
    box-shadow: 0 12px 34px rgba(15,23,42,.06) !important;
}

body.theme-light .security-center-v3 .security-setting-copy > b,
body.theme-light .security-center-v3 .security-setting-copy > h3,
body.theme-light .security-center-v3 .security-panel-head h3,
body.theme-light .security-center-v3 .security-form label span,
body.theme-light .security-center-v3 .security-row-main b,
body.theme-light .security-center-v3 .security-empty-state b,
[data-theme="light"] .security-center-v3 .security-setting-copy > b,
[data-theme="light"] .security-center-v3 .security-setting-copy > h3,
[data-theme="light"] .security-center-v3 .security-panel-head h3 {
    color: #0f172a !important;
}

body.theme-light .security-center-v3 .security-setting-copy > small,
body.theme-light .security-center-v3 .security-setting-copy > p,
body.theme-light .security-center-v3 .security-panel-head p,
body.theme-light .security-center-v3 .security-row-main span,
body.theme-light .security-center-v3 .security-row-main small,
[data-theme="light"] .security-center-v3 .security-setting-copy > small,
[data-theme="light"] .security-center-v3 .security-setting-copy > p {
    color: #64748b !important;
}

body.theme-light .security-center-v3 .security-form input,
body.theme-light .security-center-v3 .security-session-row,
body.theme-light .security-center-v3 .security-history-row,
[data-theme="light"] .security-center-v3 .security-form input {
    background: rgba(248,250,252,.82) !important;
    border-color: rgba(15,23,42,.09) !important;
    color: #0f172a !important;
}

/* Light theme (2026-10-11): the status pill tones above are made for dark
   backgrounds; mint/amber text was barely readable on the pale pills. */
body.theme-light .security-center-v3 .security-status-pill.tone-success {
    color: #047857;
    border-color: rgba(4, 120, 87, .22);
}
body.theme-light .security-center-v3 .security-status-pill.tone-warning {
    color: #b45309;
    border-color: rgba(180, 83, 9, .22);
}
body.theme-light .security-center-v3 .security-status-pill.tone-muted {
    color: #475569;
}

@media (max-width: 760px) {
    .security-v2.security-center-v3 {
        padding: 4px 0 max(96px, calc(env(safe-area-inset-bottom) + 78px));
    }

    .security-center-v3 .security-main-grid {
        gap: 9px;
    }

    .security-center-v3 .security-setting-summary,
    .security-center-v3 .security-setting-row {
        grid-template-columns: 40px minmax(0, 1fr) auto;
        gap: 10px;
        min-height: 70px;
        padding: 12px;
    }

    .security-center-v3 .security-setting-icon {
        width: 38px;
        height: 38px;
        border-radius: 12px;
    }

    .security-center-v3 .security-setting-meta {
        gap: 7px;
    }

    .security-center-v3 .security-setting-body {
        padding: 0 12px 13px;
    }

    .security-center-v3 .security-form {
        grid-template-columns: 1fr;
        padding-top: 13px;
    }

    .security-center-v3 .security-form-submit,
    .security-center-v3 .security-code-actions {
        grid-column: 1;
    }

    .security-center-v3 .security-form input,
    .security-center-v3 #security-2fa-form input {
        font-size: 16px !important;
    }

    .security-center-v3 .security-setting-controls {
        gap: 7px;
    }

    .security-center-v3 .security-panel-access {
        padding: 13px;
    }

    .security-center-v3 .security-session-row,
    .security-center-v3 .security-history-row {
        align-items: flex-start;
    }
}

@media (max-width: 460px) {
    .security-center-v3 .security-status-pill {
        display: none;
    }

    .security-center-v3 .security-setting-summary,
    .security-center-v3 .security-setting-row {
        grid-template-columns: 38px minmax(0, 1fr) auto;
    }

    .security-center-v3 .security-setting-controls {
        align-self: center;
    }

    .security-center-v3 .security-idle-lock-period {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .security-center-v3 .security-session-row {
        display: grid;
        grid-template-columns: 37px minmax(0, 1fr);
    }

    .security-center-v3 .security-row-actions {
        grid-column: 2;
    }

    .security-center-v3 .security-row-actions .btn {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .security-center-v3 .security-setting-summary,
    .security-center-v3 .security-setting-chevron,
    .security-center-v3 .security-switch > span,
    .security-center-v3 .security-switch > span::after {
        transition: none !important;
    }
    .security-center-v3 .security-skeleton {
        animation: none !important;
    }
}

/* Security icons use the main menu tile (.dashboard-home-icon: 32px, radius 9px,
   solid hue, white Ionicons glyph 22px). Existing tone classes keep their meaning
   and colour family, mapped onto the menu's own hues; the menu hue variables are
   scoped to .dashboard-home, so the values are restated here. */
.security-center-v3 {
    --security-icon-violet: #8354c7;
    --security-icon-green: #279b56;
    --security-icon-amber: #bb7220;
    --security-icon-red: #d84c61;
    --security-icon-neutral: #66758a;
    --security-icon-ink: #fff;
}

.security-center-v3 .security-setting-icon,
.security-center-v3 .security-row-icon,
html[data-ui-theme="system"] body.theme-system .security-center-v3 .security-setting-icon.tone-primary {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 9px;
    box-shadow: none;
    color: var(--security-icon-ink);
    background: var(--security-icon-neutral);
}

.security-center-v3 .security-setting-icon svg,
.security-center-v3 .security-row-icon svg {
    display: block;
    width: 22px;
    height: 22px;
}

.security-center-v3 :is(.security-setting-icon, .security-row-icon).tone-primary,
html[data-ui-theme="system"] body.theme-system .security-center-v3 .security-setting-icon.tone-primary { background: var(--security-icon-violet); }
.security-center-v3 :is(.security-setting-icon, .security-row-icon).tone-success { background: var(--security-icon-green); }
.security-center-v3 :is(.security-setting-icon, .security-row-icon).tone-warning { background: var(--security-icon-amber); }
.security-center-v3 :is(.security-setting-icon, .security-row-icon).tone-danger { background: var(--security-icon-red); }
.security-center-v3 :is(.security-setting-icon, .security-row-icon).tone-muted { background: var(--security-icon-neutral); }

.security-center-v3 .security-empty-state > span svg {
    width: 22px;
    height: 22px;
}

@media (max-width: 460px) {
    .security-center-v3 .security-session-row {
        grid-template-columns: 32px minmax(0, 1fr);
    }
}

/* Labels removed from view stay available to assistive technology. */
.security-center-v3 .security-visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Round back control, identical to the settings header (.dxs-back, 48px,
   glyph 27px); the settings variables are scoped to .dxs, so they are restated. */
.security-center-v3 .security-head {
    display: flex;
    align-items: center;
    min-width: 0;
    margin: 0 0 12px;
}

.security-center-v3 .security-back-btn {
    --dxs-card: var(--bg-secondary, #1e1e22);
    --dxs-line: color-mix(in srgb, var(--text) 10%, transparent);
    display: grid;
    place-items: center;
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    border: 1px solid var(--dxs-line);
    border-radius: 50%;
    background: var(--dxs-card);
    color: var(--text);
    text-decoration: none;
}

.security-center-v3 .security-back-btn .dxs-icon {
    display: grid;
    place-items: center;
    width: auto;
    height: auto;
    background: none;
}

.security-center-v3 .security-back-btn .dxs-icon svg {
    display: block;
    width: 27px;
    height: 27px;
}

.security-center-v3 .security-back-btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

html[data-text-dir="rtl"] .security-center-v3 .security-back-btn svg { transform: scaleX(-1); }

/* Section captions are hidden; the refresh control keeps its place at the end. */
.security-center-v3 .security-section-head {
    justify-content: flex-end;
}

/* Refresh: an icon instead of the «Обновить» caption, same violet as before;
   the glyph turns while the lists reload. 44px hit area, 22px glyph. */
.security-center-v3 .security-refresh-btn {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin: -6px -10px -6px 0;
    padding: 0;
    border-radius: 50%;
}

.security-center-v3 .security-refresh-btn svg {
    display: block;
    width: 22px;
    height: 22px;
    transform-origin: 50% 50%;
}

.security-center-v3 .security-refresh-btn:hover { background: var(--bg-hover); }

.security-center-v3 .security-refresh-btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.security-center-v3 .security-refresh-btn.is-spinning svg {
    animation: security-refresh-spin .7s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
    .security-center-v3 .security-refresh-btn.is-spinning svg {
        animation: none;
        opacity: .55;
    }
}



/* ===== Stage 27C: mobile anti-zoom + safe overflow stability ===== */

/*
  Main root cause on iPhone/iOS-like browsers:
  focusing input/textarea with font-size < 16px triggers browser zoom.
  After that the SPA can be dragged sideways and blocks fly out of viewport.
*/
html {
    -webkit-text-size-adjust: 100% !important;
    text-size-adjust: 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
}

body {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
    overscroll-behavior-x: none !important;
}

#app,
.app,
.main-content,
.page-content {
    max-width: 100vw !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
    overscroll-behavior-x: none !important;
}

@supports (overflow: clip) {
    html,
    body,
    #app,
    .app,
    .main-content,
    .page-content {
        overflow-x: clip !important;
    }
}

@media (max-width: 1024px) {
    input,
    textarea,
    select,
    [contenteditable="true"],
    .input,
    #message-input,
    #header-search-input,
    #dispute-search,
    #current-password,
    #new-password,
    #confirm-password,
    #two-factor-code,
    .chat-input-wrapper textarea,
    .auth-form input,
    .security-form input,
    .search-container input {
        font-size: 16px !important;
        line-height: 1.25 !important;
        -webkit-text-size-adjust: 100% !important;
        transform: none !important;
    }

    input::placeholder,
    textarea::placeholder {
        font-size: 16px !important;
    }

    /* Prevent cards/pages from being wider than screen while keeping vertical scroll normal. */
    .auth-page,
.dashboard-v2,
.disputes-v2,
.security-v2,
.wallet-page,
.deals-page,
.chats-page,
.admin-page,
.page,
.card,
.glass{
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
    }

    .auth-page {
        width: 100% !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
        padding-left: max(16px, env(safe-area-inset-left, 0px)) !important;
        padding-right: max(16px, env(safe-area-inset-right, 0px)) !important;
    }

    .auth-container {
        width: min(100%, 480px) !important;
        max-width: calc(100vw - 32px) !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    .auth-tabs,
    .auth-form,
    .auth-form .form-group,
    .auth-form input,
    .auth-form button {
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
    }

    .dashboard-hero,
.dashboard-kpi-grid,
.dashboard-main-grid,
.disputes-hero,
.disputes-kpi-grid,
.disputes-shell,
.security-main-grid,
.profile-layout,
.wallet-page{
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
    }

    img,
    video,
    canvas,
    table,
    pre {
        max-width: 100% !important;
    }

    /* Chat: keep old working composer architecture, only stop auto-zoom/side drift. */
    .chats-page,
    .chats-container,
    .chat-main,
    .chat-active,
    .chat-messages,
    .chat-input-area,
    .chat-input-wrapper {
        max-width: 100vw !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
    }

    .chat-input-area {
        left: 0 !important;
        right: 0 !important;
        transform: translate3d(0, 0, 0) !important;
    }

    #message-input {
        min-width: 0 !important;
        width: 100% !important;
        font-size: 16px !important;
    }

    body.mobile-input-focused,
    body.chat-input-focused {
        overflow-x: hidden !important;
    }
}

/* Extra narrow iPhone/Safari polish */
@media (max-width: 430px) {
    .auth-container {
        max-width: calc(100vw - 24px) !important;
    }

    .auth-page {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    #header-search-input {
        font-size: 16px !important;
    }

    
}


/* ===== Stage 27D: hard mobile zoom lock + chat height/keyboard fix ===== */

@media (max-width: 1024px) {
    html,
    body {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
        overscroll-behavior-x: none !important;
        -webkit-text-size-adjust: 100% !important;
        text-size-adjust: 100% !important;
        touch-action: pan-y !important;
    }

    #app,
    .app,
    .main-content,
    .page-content {
        width: 100% !important;
        max-width: 100vw !important;
        min-width: 0 !important;
        overflow-x: hidden !important;
        overscroll-behavior-x: none !important;
        box-sizing: border-box !important;
        touch-action: pan-y !important;
    }

    @supports (overflow: clip) {
        html,
        body,
        #app,
        .app,
        .main-content,
        .page-content {
            overflow-x: clip !important;
        }
    }

    input,
    textarea,
    select,
    /* Emoji choices are non-editable glyphs, not zoom-triggering text fields. */
    button:not(.chat-composer-emoji-option),
    [contenteditable="true"],
    .input,
    #message-input,
    #header-search-input,
    .auth-form input,
    .chat-input,
    .security-form input,
    .search-container input {
        font-size: 16px !important;
        -webkit-text-size-adjust: 100% !important;
        text-size-adjust: 100% !important;
        transform: none !important;
    }

    input::placeholder,
    textarea::placeholder {
        font-size: 16px !important;
    }

    .auth-page,
.auth-container,
.dashboard-v2,
.disputes-v2,
.security-v2,
.wallet-page,
.deals-page,
.chats-page,
.chats-container{
        width: 100% !important;
        max-width: 100vw !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
        overscroll-behavior-x: none !important;
    }

    .auth-container {
        max-width: min(480px, calc(100vw - 28px)) !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    .auth-tabs,
.auth-form,
.auth-form *,
.dashboard-hero,
.dashboard-kpi-grid,
.dashboard-main-grid,
.wallet-card,
.profile-header{
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
    }

    /* Fix the bottom blank space after compact header auto-collapses in chats. */
    .app[data-page="chats"].header-collapsed .main-content,
    .app[data-page="chats"].header-collapsed .page-content,
    .app[data-page="chats"].header-collapsed .chats-page,
    .app[data-page="chats"].header-collapsed .chats-container {
        height: 100dvh !important;
        min-height: 100dvh !important;
        max-height: 100dvh !important;
    }

    .app[data-page="chats"].header-collapsed .chats-sidebar,
    .app[data-page="chats"].header-collapsed .chat-main,
    .app[data-page="chats"].header-collapsed .chat-active {
        height: 100% !important;
        max-height: 100% !important;
    }

    /* Chat keyboard lock: only while message textarea is focused. */
    body.chat-keyboard-lock .app[data-page="chats"] {
        height: var(--mobile-vvh, 100dvh) !important;
        min-height: var(--mobile-vvh, 100dvh) !important;
        max-height: var(--mobile-vvh, 100dvh) !important;
        overflow: hidden !important;
    }

    body.chat-keyboard-lock .app[data-page="chats"] .main-content,
    body.chat-keyboard-lock .app[data-page="chats"] .page-content,
    body.chat-keyboard-lock .app[data-page="chats"] .chats-page,
    body.chat-keyboard-lock .app[data-page="chats"] .chats-container,
    body.chat-keyboard-lock .app[data-page="chats"] .chat-main,
    body.chat-keyboard-lock .app[data-page="chats"] .chat-active {
        height: var(--mobile-vvh, 100dvh) !important;
        min-height: 0 !important;
        max-height: var(--mobile-vvh, 100dvh) !important;
        overflow: hidden !important;
    }

    body.chat-keyboard-lock .app[data-page="chats"] .chat-active:not(.hidden) {
        position: relative !important;
    }

    body.chat-keyboard-lock .app[data-page="chats"] .chat-messages {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        padding-bottom: 96px !important;
        scroll-padding-bottom: 104px !important;
    }

    body.chat-keyboard-lock .app[data-page="chats"] .chat-active .chat-input-area,
    body.chat-keyboard-lock .chats-page .chat-active .chat-input-area,
    body.chat-keyboard-lock body[data-page="chats"] .chat-active .chat-input-area {
        position: absolute !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        top: auto !important;
        transform: translate3d(0, 0, 0) !important;
        z-index: 90 !important;
    }

    body.chat-keyboard-lock .app[data-page="chats"] #message-input {
        font-size: 16px !important;
        transform: none !important;
    }
}

@media (max-width: 430px) {
    .auth-container {
        max-width: calc(100vw - 24px) !important;
    }

    .app[data-page="chats"].header-collapsed .main-content,
    .app[data-page="chats"].header-collapsed .page-content,
    .app[data-page="chats"].header-collapsed .chats-page,
    .app[data-page="chats"].header-collapsed .chats-container {
        height: 100dvh !important;
        max-height: 100dvh !important;
    }
}


/* ===== Stage 27H: chat keyboard shift without fixed composer or height resize ===== */

@media (max-width: 1024px) {
    /*
      Keep anti-zoom from 27D, but disable all previous keyboard layout experiments.
      We do not resize the chat and do not make the composer fixed.
      We only move composer up by the exact overlap with the visible viewport.
    */
    body.chat-keyboard-shift .app[data-page="chats"] {
        overflow-x: hidden !important;
        max-width: 100vw !important;
    }

    body.chat-keyboard-shift .app[data-page="chats"] .main-content,
    body.chat-keyboard-shift .app[data-page="chats"] .page-content,
    body.chat-keyboard-shift .app[data-page="chats"] .chats-page,
    body.chat-keyboard-shift .app[data-page="chats"] .chats-container,
    body.chat-keyboard-shift .app[data-page="chats"] .chat-main,
    body.chat-keyboard-shift .app[data-page="chats"] .chat-active {
        overflow-x: hidden !important;
        max-width: 100vw !important;
        min-width: 0 !important;
    }

    body.chat-keyboard-shift .app[data-page="chats"] .chat-active:not(.hidden) {
        height: 100% !important;
        max-height: 100% !important;
        min-height: 0 !important;
        overflow: hidden !important;
        display: flex !important;
        flex-direction: column !important;
        position: relative !important;
    }

    body.chat-keyboard-shift .app[data-page="chats"] .chat-messages {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        padding-bottom: calc(14px + var(--chat-keyboard-shift, 0px)) !important;
        scroll-padding-bottom: calc(var(--chat-composer-h, 72px) + var(--chat-keyboard-shift, 0px) + 18px) !important;
        -webkit-overflow-scrolling: touch !important;
        overflow-anchor: none !important;
        scroll-behavior: auto !important;
    }

    body.chat-keyboard-shift .app[data-page="chats"] .chat-input-area,
    body.chat-keyboard-shift .chats-page .chat-input-area,
    body.chat-keyboard-shift body[data-page="chats"] .chat-input-area {
        position: sticky !important;
        bottom: 0 !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        transform: translate3d(0, calc(-1 * var(--chat-keyboard-shift, 0px)), 0) !important;
        will-change: transform !important;
        z-index: 120 !important;
        flex: 0 0 auto !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    body.chat-keyboard-shift .app[data-page="chats"] #message-input {
        font-size: 16px !important;
        line-height: 1.25 !important;
        transform: none !important;
        -webkit-text-size-adjust: 100% !important;
        text-size-adjust: 100% !important;
    }

    /*
      Hard neutralize older broken classes if they stay for one frame.
    */
    body.chat-keyboard-shift.chat-keyboard-lock .app[data-page="chats"],
    body.chat-keyboard-shift.chat-composer-fixed .app[data-page="chats"],
    body.chat-keyboard-shift.chat-visual-resize .app[data-page="chats"] {
        height: auto !important;
        max-height: none !important;
    }

    body.chat-keyboard-shift.chat-keyboard-lock .app[data-page="chats"] .chat-input-area,
    body.chat-keyboard-shift.chat-composer-fixed .app[data-page="chats"] .chat-input-area,
    body.chat-keyboard-shift.chat-visual-resize .app[data-page="chats"] .chat-input-area {
        position: sticky !important;
        top: auto !important;
        bottom: 0 !important;
        transform: translate3d(0, calc(-1 * var(--chat-keyboard-shift, 0px)), 0) !important;
    }

    /*
      Keep solved bug: when compact header closes, dialog list/chat uses full viewport.
    */
    .app[data-page="chats"].header-collapsed .main-content,
    .app[data-page="chats"].header-collapsed .page-content,
    .app[data-page="chats"].header-collapsed .chats-page,
    .app[data-page="chats"].header-collapsed .chats-container {
        height: 100dvh !important;
        min-height: 100dvh !important;
        max-height: 100dvh !important;
    }
}


/* ===== Stage 27I: remove mobile keyboard close gap ===== */

@media (max-width: 1024px) {
    /*
      When the keyboard closes, remove the artificial composer shift instantly.
      This prevents the one-second empty area under/around the composer.
    */
    body.chat-keyboard-closing .app[data-page="chats"] .chat-input-area,
    body.chat-keyboard-closing .app[data-page="chats"] .chat-messages,
    body.chat-keyboard-shift .app[data-page="chats"] .chat-input-area {
        transition: none !important;
        animation: none !important;
    }

    body.chat-keyboard-closing .app[data-page="chats"] .chat-input-area {
        transform: translate3d(0, 0, 0) !important;
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
    }

    body.chat-keyboard-closing .app[data-page="chats"] .chat-messages {
        padding-bottom: 14px !important;
        scroll-padding-bottom: 18px !important;
        overflow-anchor: none !important;
        scroll-behavior: auto !important;
    }
}


/* ===== Stage 27J: first tap send while keyboard is open ===== */

@media (max-width: 1024px) {
    body.chat-keyboard-shift .app[data-page="chats"] #send-message-btn,
    body.chat-input-focused .app[data-page="chats"] #send-message-btn {
        touch-action: manipulation !important;
        -webkit-tap-highlight-color: transparent !important;
        pointer-events: auto !important;
        user-select: none !important;
    }

    body.chat-keyboard-shift .app[data-page="chats"] .chat-input-area,
    body.chat-input-focused .app[data-page="chats"] .chat-input-area {
        visibility: visible !important;
        opacity: 1 !important;
    }

    body.chat-keyboard-closing .app[data-page="chats"] .chat-input-area {
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
    }
}


/* ===== Stage 27K: smooth mobile keyboard close, no composer flicker ===== */

@media (max-width: 1024px) {
    /*
      While the keyboard is closing, keep the composer in the same controlled shift mode.
      Removing the mode too early makes the input disappear for a split second.
    */
    body.chat-keyboard-closing.chat-keyboard-shift .app[data-page="chats"] .chat-input-area {
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        transform: translate3d(0, calc(-1 * var(--chat-keyboard-shift, 0px)), 0) !important;
        transition: transform 90ms ease-out !important;
        will-change: transform !important;
    }

    body.chat-keyboard-closing.chat-keyboard-shift .app[data-page="chats"] .chat-messages {
        padding-bottom: calc(14px + var(--chat-keyboard-shift, 0px)) !important;
        scroll-padding-bottom: calc(var(--chat-composer-h, 72px) + var(--chat-keyboard-shift, 0px) + 18px) !important;
        transition: padding-bottom 90ms ease-out !important;
    }

    body.chat-keyboard-closing .app[data-page="chats"] #message-input,
    body.chat-keyboard-closing .app[data-page="chats"] .chat-input-area,
    body.chat-keyboard-closing .app[data-page="chats"] .chat-input-wrapper {
        visibility: visible !important;
        opacity: 1 !important;
    }
}


/* ===== Stage 27L: faster keyboard return, no long delay ===== */

@media (max-width: 1024px) {
    body.chat-keyboard-closing.chat-keyboard-shift .app[data-page="chats"] .chat-input-area {
        transition: transform 35ms linear !important;
    }

    body.chat-keyboard-closing.chat-keyboard-shift .app[data-page="chats"] .chat-messages {
        transition: padding-bottom 35ms linear !important;
    }
}


/* ===== Stage 27M: no-gap keyboard close ===== */

@media (max-width: 1024px) {
    /*
      On blur we keep the keyboard classes briefly, but shift is instantly 0.
      This prevents both problems:
      - input blinking/disappearing;
      - old large padding creating an empty area over messages.
    */
    body.chat-keyboard-closing.chat-keyboard-shift .app[data-page="chats"] .chat-input-area,
    body.chat-keyboard-closing .app[data-page="chats"] .chat-input-area {
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        transform: translate3d(0, 0, 0) !important;
        transition: none !important;
        animation: none !important;
        will-change: auto !important;
    }

    body.chat-keyboard-closing.chat-keyboard-shift .app[data-page="chats"] .chat-messages,
    body.chat-keyboard-closing .app[data-page="chats"] .chat-messages {
        padding-bottom: 14px !important;
        scroll-padding-bottom: 18px !important;
        transition: none !important;
        animation: none !important;
    }

    body.chat-keyboard-closing .app[data-page="chats"] #message-input,
    body.chat-keyboard-closing .app[data-page="chats"] .chat-input-wrapper {
        visibility: visible !important;
        opacity: 1 !important;
    }
}


/* ===== Stage 27N: prevent stale keyboard shift from returning after blur ===== */

@media (max-width: 1024px) {
    /*
      Closing mode must not depend on chat-keyboard-shift.
      It only keeps composer visible while browser finishes closing keyboard.
    */
    body.chat-keyboard-closing:not(.chat-keyboard-shift) .app[data-page="chats"] .chat-input-area {
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        transform: translate3d(0, 0, 0) !important;
        transition: none !important;
        animation: none !important;
        will-change: auto !important;
        z-index: 120 !important;
    }

    body.chat-keyboard-closing:not(.chat-keyboard-shift) .app[data-page="chats"] .chat-messages {
        padding-bottom: 14px !important;
        scroll-padding-bottom: 18px !important;
        transition: none !important;
        animation: none !important;
    }

    body.chat-keyboard-closing:not(.chat-keyboard-shift) .app[data-page="chats"] #message-input,
    body.chat-keyboard-closing:not(.chat-keyboard-shift) .app[data-page="chats"] .chat-input-wrapper {
        visibility: visible !important;
        opacity: 1 !important;
    }
}


/* ===== Stage 27O: freeze full chat viewport while keyboard closes ===== */

@media (max-width: 1024px) {
    /*
      The last flicker/gap was caused by --chat-vh being rewritten to the
      keyboard-shrunken visualViewport during blur. During close we force the
      saved full viewport height so the chat container cannot collapse for one frame.
    */
    body.chat-keyboard-closing[data-page="chats"],
    body.chat-keyboard-closing[data-page="chats"] .app {
        height: var(--chat-keyboard-base-vh, 100dvh) !important;
        min-height: var(--chat-keyboard-base-vh, 100dvh) !important;
        max-height: var(--chat-keyboard-base-vh, 100dvh) !important;
        overflow: hidden !important;
    }

    body.chat-keyboard-closing[data-page="chats"] .main-content {
        height: calc(var(--chat-keyboard-base-vh, 100dvh) - var(--chat-header-h, 60px)) !important;
        min-height: 0 !important;
        max-height: calc(var(--chat-keyboard-base-vh, 100dvh) - var(--chat-header-h, 60px)) !important;
        overflow: hidden !important;
    }

    body.chat-keyboard-closing[data-page="chats"] .page-content,
    body.chat-keyboard-closing[data-page="chats"] .chats-page,
    body.chat-keyboard-closing[data-page="chats"] .chats-container,
    body.chat-keyboard-closing[data-page="chats"] .chat-main,
    body.chat-keyboard-closing[data-page="chats"] .chat-active {
        height: 100% !important;
        min-height: 0 !important;
        max-height: 100% !important;
        overflow: hidden !important;
    }

    body.chat-keyboard-closing[data-page="chats"] .chat-active .chat-input-area {
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        transform: translate3d(0, 0, 0) !important;
        transition: none !important;
        animation: none !important;
    }

    body.chat-keyboard-closing[data-page="chats"] .chat-active .chat-messages {
        padding-bottom: 86px !important;
        scroll-padding-bottom: 94px !important;
        transition: none !important;
        animation: none !important;
    }
}


/* ===== Stage 27P: mobile Signal-style composer expansion ===== */

@media (max-width: 1024px) {
    /*
      Mobile only:
      when user starts typing, hide only the voice record button and let the
      textarea breathe wider. Attach button stays visible. Desktop is unchanged.
    */
    .app[data-page="chats"] .chat-input-area.mobile-composer-expanded {
        gap: 6px !important;
        align-items: flex-end !important;
    }

    .app[data-page="chats"] .chat-input-area.mobile-composer-expanded #voice-record-btn:not(.recording) {
        display: none !important;
        width: 0 !important;
        min-width: 0 !important;
        max-width: 0 !important;
        flex: 0 0 0 !important;
        flex-basis: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        opacity: 0 !important;
        pointer-events: none !important;
        visibility: hidden !important;
        overflow: hidden !important;
    }

    .app[data-page="chats"] .chat-input-area.mobile-composer-expanded .chat-input-actions {
        flex: 0 0 auto !important;
        min-width: 0 !important;
        width: auto !important;
        gap: 0 !important;
    }

    .app[data-page="chats"] .chat-input-area.mobile-composer-expanded .chat-input-wrapper {
        flex: 1 1 auto !important;
        min-width: 0 !important;
        max-width: none !important;
        width: auto !important;
        border-radius: 24px !important;
    }

    .app[data-page="chats"] .chat-input-area.mobile-composer-expanded #message-input {
        min-height: 46px !important;
        width: 100% !important;
        max-width: none !important;
        box-sizing: border-box !important;
        font-size: 16px !important;
    }

    .app[data-page="chats"] .chat-input-area.mobile-composer-expanded #send-message-btn {
        flex: 0 0 48px !important;
        width: 48px !important;
        min-width: 48px !important;
    }

    body.theme-light .app[data-page="chats"] .chat-input-area.mobile-composer-expanded .chat-input-wrapper {
        background: rgba(255,255,255,.98) !important;
    }
}

@media (max-width: 430px) {
    .app[data-page="chats"] .chat-input-area.mobile-composer-expanded {
        gap: 5px !important;
        padding-left: 8px !important;
        padding-right: 8px !important;
    }

    .app[data-page="chats"] .chat-input-area.mobile-composer-expanded .chat-input-wrapper textarea {
        padding-left: 14px !important;
        padding-right: 30px !important;
    }
}

/* === Hotfix 27Q: video circles tap/open repair after mobile composer fixes === */
.video-circle-message,
.message .video-circle-message,
.chat-message .video-circle-message {
    pointer-events: auto !important;
    touch-action: manipulation !important;
    -webkit-tap-highlight-color: transparent !important;
    cursor: pointer !important;
}

.video-circle-message video,
.video-circle-message .video-circle-play,
.video-circle-message .video-circle-duration {
    pointer-events: none !important;
}

.message:has(.video-circle-message.expanded) {
    position: relative !important;
    z-index: 65 !important;
    overflow: visible !important;
}

.video-circle-message.expanded,
.message .video-circle-message.expanded,
.chat-message .video-circle-message.expanded {
    width: min(72vmin, 420px) !important;
    height: min(72vmin, 420px) !important;
    min-width: min(72vmin, 420px) !important;
    min-height: min(72vmin, 420px) !important;
    max-width: calc(100vw - 40px) !important;
    max-height: calc(100dvh - 180px) !important;
    border-radius: 999px !important;
    box-shadow: 0 28px 80px rgba(15, 23, 42, .34) !important;
    transform: translateZ(0) !important;
    z-index: 66 !important;
}

@media (max-width: 768px) {
    .video-circle-message.expanded,
    .message .video-circle-message.expanded,
    .chat-message .video-circle-message.expanded {
        width: min(86vmin, 390px) !important;
        height: min(86vmin, 390px) !important;
        min-width: min(86vmin, 390px) !important;
        min-height: min(86vmin, 390px) !important;
        max-width: calc(100vw - 24px) !important;
        max-height: calc(100dvh - 160px) !important;
    }
}


/* === Hotfix 27R: stop random upward jumps in opened chat ===
   The chat list is re-rendered by SSE/polling/read-status/reaction refreshes.
   We manage scroll position in ui/chats.js, so browser scroll anchoring must not
   fight the manual Telegram-like chat scroll and jump the viewport upward. */
#chat-messages,
#chat-messages .message,
#chat-messages .message-wrap,
#chat-messages .message-system-row {
    overflow-anchor: none !important;
}

/* Full snapshots contain old messages, not newly arriving ones. Their global
   messageIn animation used to move every bubble twice (.message-wrap + .message)
   on dialog open and looked like a scroll jump. Incremental appends keep motion. */
#chat-messages .chat-render-stable,
#chat-messages .chat-render-stable .message {
    animation: none !important;
}


/* Hotfix 27W: mobile app-swipe should not trigger browser/history back.
   Keeps vertical chat/page scrolling intact while disabling horizontal page overscroll. */
@media (max-width: 1024px) {
    html,
    body,
    #app,
    .main-content,
    #page-content,
    .chats-page,
    .chats-container,
    #chat-active,
    #chat-messages {
        overscroll-behavior-x: none;
    }

    body,
    #app,
    .main-content,
    #page-content {
        touch-action: pan-y;
    }
}

/* === Stage 28A: Web3 marketplace/listings base === */
.listings-page {
    display: flex;
    flex-direction: column;
    gap: 18px;
    max-width: 1240px;
    margin: 0 auto;
    width: 100%;
}

.listings-page .glass,
.listing-details-panel.glass {
    background: rgba(15, 20, 34, 0.78);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(18px);
}

body.theme-light .listings-page .glass,
body.theme-light .listing-details-panel.glass,
body.theme-light .listing-deal-panel.glass {
    background: rgba(255, 255, 255, 0.92);
    border-color: rgba(79, 70, 229, 0.12);
}

.listings-toolbar {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) 190px 170px 160px;
    gap: 10px;
    padding: 12px;
    border-radius: 20px;
    align-items: center;
}

/* Marketplace discovery: one search row, progressive filters, real category navigation.
   Scoped owners retain .listings-toolbar/.listings-advanced-filters for the route
   draft guard: saved search fields are not unsent publishing forms. */
.listings-page .listings-market-search {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    padding: 0;
    border: 0;
    background: transparent;
    border-radius: 0;
    align-items: stretch;
}
.listings-page .listings-market-search .listings-searchbox { grid-column: auto; min-height: 60px; }
.listings-page .listings-market-search .input { width: 100%; min-height: 58px; font-size: 1rem; }
.listings-page .listings-market-search .listings-searchbox { padding-inline-end: 4px; }
.listings-page .listings-market-search .listings-searchbox .input { flex: 1 1 auto; width: 0; }
.listings-page .listings-create-inline {
    display: inline-flex; flex: 0 0 44px; width: 44px; height: 44px; min-height: 44px;
    align-items: center; justify-content: center; padding: 0; border: 1px solid var(--border);
    border-radius: 11px; background: var(--primary-light); color: var(--primary-text, var(--primary));
    cursor: pointer; touch-action: manipulation;
}
.listings-page .listings-create-inline svg { color: inherit; pointer-events: none; }
.listings-page .listings-create-inline:hover { background: var(--bg-hover); }
.listings-page .listings-create-inline:focus-visible { outline: 2px solid var(--primary); outline-offset: -3px; }

.listings-browse-tools { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.listings-browse-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; width: 100%; min-width: 0; }
/* The global shell stays LTR; mirror only this localized control row. */
html[data-text-dir="rtl"] .listings-browse-actions { direction: rtl; }
.listings-filter-actions { display: flex; gap: 8px; min-width: 0; max-width: 100%; }
.listings-browse-actions .btn { min-height: 44px; min-width: 0; white-space: normal; }
.listings-filter-actions .btn { flex: 1 1 auto; padding-inline: 14px; }
.listings-browse-actions .btn svg { flex: 0 0 auto; }
.listings-browse-actions .btn span { min-width: 0; overflow-wrap: anywhere; }
.listings-browse-actions #listings-location-toggle { margin-inline-start: auto; max-width: 100%; }
.listings-browse-actions [data-listings-location-label] { max-width: 30ch; text-align: start; }
.listings-catalog-path:empty { display: none; }
.listings-catalog-path { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; color: var(--text-secondary); font-size: .88rem; }
.listings-catalog-path button { font: inherit; color: var(--text-secondary); border: 0; background: transparent; cursor: pointer; padding: 8px 2px; }
.listings-catalog-path button:hover { color: var(--primary-text, var(--primary)); }
.listings-catalog-path [aria-current] { color: var(--text); font-weight: 600; overflow-wrap: anywhere; }
.listings-catalog-path svg { flex-shrink: 0; }
.listings-page .listings-market-filters { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; padding: 18px; }
.listings-page .listings-market-filters[hidden], .listings-page .listings-active-filters:empty { display: none; }
.listings-market-filters .listings-filter-location-shell { display: grid; gap: 6px; min-width: 0; }
.listings-market-filters .listings-filter-location-shell > label { color: var(--text-muted); font-size: .76rem; font-weight: 800; }
.listings-market-filters .input { width: 100%; min-width: 0; }
.listings-market-filters .listings-filter-close { justify-self: end; align-self: end; }
.listings-page .listings-result-sort { display: flex; flex-direction: column; align-items: stretch; gap: 4px; padding: 0; border: 0; background: transparent; border-radius: 0; min-width: 160px; max-width: 220px; }
.listings-result-sort > span { color: var(--text-secondary); font-size: .76rem; }
.listings-result-sort .input { width: 100%; min-height: 42px; }
.listings-page .listings-head-actions { flex-wrap: wrap; }
.listings-page .listings-catalog-dialog {
    position: fixed;
    inset-block-start: var(--catalog-top, 110px);
    inset-block-end: auto;
    inset-inline: 16px;
    margin: 0 auto;
    width: min(1060px, calc(100% - 32px));
    max-width: none;
    max-height: calc(100dvh - var(--catalog-top, 110px) - 24px);
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--bg-card);
    color: var(--text);
    box-shadow: var(--shadow-lg, 0 18px 56px rgba(0,0,0,.28));
    overflow: auto;
    overscroll-behavior: contain;
    font: inherit;
}
.listings-catalog-dialog::backdrop { background: rgba(0,0,0,.4); }
.listings-catalog-head { position: sticky; top: 0; z-index: 1; background: var(--bg-card); display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.listings-catalog-head h2 { margin: 0; font-size: 1.2rem; }
.listings-catalog-head .listings-catalog-close { min-height: 44px; min-width: 44px; padding: 8px; }
.listings-catalog-body { display: grid; grid-template-columns: minmax(220px, 30%) minmax(0, 1fr); }
.listings-catalog-groups { padding: 12px; border-inline-end: 1px solid var(--border); }
.listings-catalog-group, .listings-catalog-all, .listings-catalog-option {
    width: 100%; min-height: 50px; display: flex; align-items: center; gap: 12px; padding: 12px;
    border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--text);
    text-align: start; font: inherit; font-size: .95rem; line-height: 1.35; cursor: pointer;
}
.listings-catalog-group > span, .listings-catalog-all > span, .listings-catalog-option > span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.listings-catalog-group svg, .listings-catalog-option svg, .listings-catalog-all svg { flex: 0 0 auto; }
.listings-catalog-group:hover, .listings-catalog-all:hover, .listings-catalog-option:hover { background: var(--bg-tertiary); }
.listings-catalog-group.active, .listings-catalog-option.active { background: var(--primary-light); color: var(--primary-text, var(--primary)); }
.listings-catalog-option.active { border-color: var(--primary); }
.listings-catalog-choices { padding: 24px; min-width: 0; }
.listings-catalog-choices h3 { margin: 0 0 20px; font-size: 1.35rem; }
.listings-catalog-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.listings-catalog-option { min-height: 70px; padding: 14px; border-color: var(--border); }
.listings-catalog-dialog .listings-catalog-back { display: none; }
.listings-catalog-dialog button:focus-visible, .listings-catalog-path button:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
[dir="rtl"] .listings-catalog-path svg, [dir="rtl"] .listings-catalog-group > svg:last-child,
[dir="rtl"] .listings-catalog-option > svg:last-child, [dir="rtl"] .listings-catalog-back svg { transform: scaleX(-1); }
@media (max-width: 1100px) {
    .listings-page .listings-market-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .listings-page .listings-section-head-modern { align-items: flex-start; flex-direction: column; }
    .listings-page .listings-head-actions { width: 100%; justify-content: space-between; }
}
@media (max-width: 720px) {
    .listings-page .listings-market-search { grid-template-columns: minmax(0, 1fr); gap: 8px; }
    .listings-page .listings-market-search .listings-searchbox { grid-column: 1 / -1; grid-row: 1; }
    .listings-page .listings-market-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 12px; gap: 12px; }
    .listings-market-filters .listings-filter-location-shell { grid-column: 1 / -1; }
    .listings-market-filters .listings-filter-close { grid-column: 1 / -1; max-width: 100%; white-space: normal; }
    .listings-page .listings-result-sort { grid-row: 2; grid-column: 1 / -1; min-width: 0; max-width: none; width: 100%; }
    .listings-page .listings-head-actions { grid-template-columns: minmax(0, 1fr) auto; align-items: end; }
    /* The named view switch takes its own row of three equal segments. */
    .listings-page .listings-head-actions .listings-layout-toggle { grid-row: 3; grid-column: 1 / -1; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; }
    .listings-page .listings-head-actions .listings-layout-btn { min-width: 0; width: 100%; padding-inline: 8px; }
    .listings-page .listings-catalog-dialog { inset-block-start: max(12px, env(safe-area-inset-top)); max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); inset-inline: 10px; width: calc(100% - 20px); }
    .listings-catalog-body { grid-template-columns: minmax(0, 1fr); }
    .listings-catalog-groups { border-inline-end: 0; padding: 8px; }
    .listings-catalog-group.active { background: transparent; color: var(--text); }
    .listings-catalog-choices { display: none; padding: 14px; }
    .listings-catalog-dialog.show-choices .listings-catalog-groups { display: none; }
    .listings-catalog-dialog.show-choices .listings-catalog-choices { display: block; }
    .listings-catalog-dialog .listings-catalog-back { display: inline-flex; margin-bottom: 16px; padding-inline-start: 0; }
    .listings-catalog-options { grid-template-columns: minmax(0, 1fr); gap: 8px; }
    .listings-catalog-option { min-height: 56px; }
}

/* The open result list must sit above sibling filter cards, below app overlays. */
.listings-page .listings-toolbar:has(:is(.listings-search-suggestions, .listings-filter-location-suggestions):not([hidden])),
.listings-page .listings-market-filters:has(.listings-filter-location-suggestions:not([hidden])) { z-index: 2; }

.listings-searchbox {
    position: relative;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 0 12px;
}

body.theme-light .listings-searchbox {
    background: #fff;
}

.listings-searchbox svg {
    color: var(--text-muted);
    flex: 0 0 auto;
}

.listings-searchbox .input {
    border: 0;
    background: transparent;
    padding-left: 0;
    box-shadow: none;
    min-width: 0;
}

.listings-search-suggestions {
    position: absolute;
    z-index: 1250;
    top: calc(100% + 9px);
    left: 0;
    right: 0;
    display: grid;
    gap: 5px;
    max-height: min(390px, 62vh);
    overflow-y: auto;
    padding: 8px;
    border: 1px solid color-mix(in srgb, var(--primary) 28%, var(--border));
    border-radius: 18px;
    background: color-mix(in srgb, var(--bg-card) 96%, transparent);
    box-shadow: 0 24px 64px rgba(10, 14, 31, .34);
    backdrop-filter: blur(20px);
}

.listings-search-suggestions[hidden] {
    display: none;
}

.listings-search-suggestion {
    appearance: none;
    width: 100%;
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr) minmax(0, auto);
    min-height: 72px;
    gap: 10px;
    align-items: center;
    padding: 7px;
    border: 1px solid transparent;
    border-radius: 14px;
    background: transparent;
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
}

.listings-search-suggestion:hover,
.listings-search-suggestion:focus-visible,
.listings-search-suggestion.active {
    border-color: color-mix(in srgb, var(--primary) 36%, transparent);
    background: color-mix(in srgb, var(--primary) 13%, transparent);
}

.listings-search-suggestion-photo {
    width: 56px;
    height: 56px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 12px;
    color: var(--primary);
    background: var(--bg-tertiary);
}

.listings-search-suggestion-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.listings-search-suggestion-copy {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.listings-search-suggestion-copy b,
.listings-search-suggestion-copy small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.listings-search-suggestion-copy small,
.listings-search-suggestion-empty {
    color: var(--text-muted);
    font-size: .78rem;
}

.listings-search-suggestion strong {
    min-width: 0;
    max-width: 110px;
    color: var(--primary-text);
    white-space: normal;
    overflow-wrap: anywhere;
    text-align: end;
    font-size: .84rem;
}
.listings-search-suggestion:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.listings-search-suggestion.listings-search-suggestion-all { grid-template-columns: minmax(0, 1fr); min-height: 44px; text-align: center; }
.listings-search-suggestion-category .listings-search-suggestion-photo { background: var(--primary-light); color: var(--primary-text); }
@media (max-width: 600px) {
    .listings-search-suggestion { grid-template-columns: 48px minmax(0, 1fr) minmax(0, auto); min-height: 64px; gap: 8px; padding: 7px 4px; }
    .listings-search-suggestion-photo { width: 48px; height: 48px; }
    .listings-search-suggestion strong { max-width: 78px; font-size: .78rem; }
}

.listings-search-suggestion-empty {
    padding: 12px;
    text-align: center;
}

.listings-filter-select,
.listings-city-input,
.listings-sort-select {
    min-width: 0;
}

.listings-category-row {
    display: flex;
    gap: 9px;
    overflow-x: auto;
    padding: 2px 2px 8px;
    scrollbar-width: thin;
}

.listing-category-chip {
    appearance: none;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    border-radius: 999px;
    padding: 9px 12px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    transition: transform var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast), color var(--transition-fast);
}

.listing-category-chip:hover {
    transform: translateY(-1px);
    color: var(--text);
    border-color: var(--primary);
}

.listing-category-chip.active {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

.listing-category-chip b {
    min-width: 20px;
    height: 20px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    background: rgba(255,255,255,0.08);
    color: inherit;
    font-size: 0.72rem;
}

body.theme-light .listing-category-chip b {
    background: rgba(79, 70, 229, 0.08);
}

.listings-section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px;
}

.listings-section-head h2 {
    margin: 0 0 4px;
}

.listings-section-head p {
    margin: 0;
    color: var(--text-muted);
}

.listings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(238px, 1fr));
    gap: 14px;
}

.listing-card {
    border-radius: 22px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.listing-card:hover {
    transform: translateY(-3px);
    border-color: rgba(139, 92, 246, 0.42);
    box-shadow: 0 18px 45px rgba(0,0,0,0.18);
}

.listing-card-cover {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 1.25 / 1;
    border: 0;
    padding: 0;
    background: linear-gradient(135deg, rgba(99,102,241,0.16), rgba(139,92,246,0.10));
    color: var(--primary);
    cursor: pointer;
    overflow: hidden;
}

.listing-card-cover img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    background: radial-gradient(circle at center, rgba(139, 92, 246, 0.12), rgba(7, 10, 20, 0.18));
}

.listing-card-cover-empty,
.listing-details-media-empty {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
}

.listing-category-badge {
    position: absolute;
    left: 10px;
    top: 10px;
    max-width: calc(100% - 20px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    border-radius: 999px;
    padding: 5px 9px;
    background: rgba(10, 14, 26, 0.70);
    color: #fff;
    backdrop-filter: blur(10px);
    font-size: 0.72rem;
    font-weight: 800;
}

.listing-category-badge.inline {
    position: static;
    display: inline-flex;
    width: fit-content;
    background: var(--primary-light);
    color: var(--primary);
    margin-bottom: 10px;
}

.listing-card-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 13px;
    min-height: 190px;
}

.listing-card-title {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--text);
    padding: 0;
    margin: 0;
    text-align: left;
    font: inherit;
    font-weight: 800;
    line-height: 1.25;
    cursor: pointer;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.listing-card-title:hover {
    color: var(--primary);
}

.listing-card-price,
.listing-details-price {
    color: var(--primary);
    font-weight: 900;
    font-size: 1.08rem;
}

.listing-card-desc {
    color: var(--text-secondary);
    font-size: 0.84rem;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.25em;
}

.listing-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    color: var(--text-muted);
    font-size: 0.78rem;
}

.listing-seller-row {
    margin-top: auto;
}

.listing-seller {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--text-secondary);
    padding: 0;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    max-width: 100%;
    cursor: pointer;
    font-weight: 700;
}

.listing-seller:hover {
    color: var(--primary);
}

.listing-seller-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary-grad);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    font-size: 0.75rem;
    flex: 0 0 auto;
}

.listing-seller-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.listing-card-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 4px;
}

.listing-card-actions .btn.small {
    justify-content: center;
    min-height: 36px;
}

.listings-empty {
    grid-column: 1 / -1;
    border-radius: 24px;
    padding: 42px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    text-align: center;
    min-height: 280px;
}

.listings-empty-icon {
    width: 86px;
    height: 86px;
    border-radius: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    color: var(--primary);
    margin-bottom: 14px;
    font-size: 2rem;
    font-weight: 900;
}

.listings-empty-icon.danger {
    color: var(--danger);
    background: var(--danger-light);
}

.listings-empty h3 {
    margin: 0 0 8px;
}

.listings-empty p {
    margin: 0 0 14px;
    max-width: 460px;
}

.listing-card-skeleton .listing-card-cover {
    cursor: default;
}
/* Skeleton lines of listing cards and the listing detail: former inline styles (style-src). */
.listing-card-skeleton .listing-skeleton-card-title { width: 72%; height: 18px; }
.listing-card-skeleton .listing-skeleton-card-price { width: 44%; height: 20px; margin-top: 12px; }
.listing-card-skeleton .listing-skeleton-card-meta { width: 62%; height: 14px; margin-top: 14px; }
.listing-detail-info-shell .listing-skeleton-kicker { width: 48%; height: 16px; }
.listing-detail-info-shell .listing-skeleton-heading { width: 86%; height: 34px; margin-top: 14px; }
.listing-detail-info-shell .listing-skeleton-price { width: 42%; height: 28px; margin-top: 14px; }
.listing-detail-info-shell .listing-skeleton-text { width: 100%; height: 84px; margin-top: 18px; }

.listing-details-modal {
    position: fixed;
    inset: 0;
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
}

.listing-details-modal.visible {
    opacity: 1;
    pointer-events: auto;
}

.listing-details-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.58);
    backdrop-filter: blur(10px);
}

.listing-details-panel {
    position: relative;
    z-index: 1;
    width: min(920px, calc(100vw - 28px));
    max-height: min(760px, calc(100dvh - 28px));
    border-radius: 28px;
    overflow: hidden;
    display: grid;
    grid-template-columns: minmax(280px, 0.9fr) 1fr;
}

.listing-details-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    width: 38px;
    height: 38px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(10,14,26,0.66);
    color: #fff;
    font-size: 1.35rem;
    cursor: pointer;
}

.listing-details-media {
    min-height: 420px;
    background: linear-gradient(135deg, rgba(99,102,241,0.18), rgba(139,92,246,0.10));
}

.listing-details-media img {
    width: 100%;
    height: 100%;
    min-height: 420px;
    object-fit: cover;
    display: block;
}

.listing-details-body {
    padding: 26px;
    overflow: auto;
}

.listing-details-body h2 {
    margin: 0 0 12px;
}

.listing-details-body p {
    margin: 12px 0 16px;
    color: var(--text-secondary);
    white-space: pre-wrap;
}

.listing-details-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.listing-details-meta span {
    border-radius: 999px;
    padding: 7px 10px;
    background: var(--bg-hover);
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 700;
}

.listing-details-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.listing-details-note {
    margin-top: 14px;
    padding: 12px;
    border-radius: 16px;
    background: var(--primary-light);
    color: var(--text-secondary);
    font-size: 0.84rem;
}

@media (max-width: 920px) {
    .listings-toolbar {
        grid-template-columns: 1fr 1fr;
    }

    .listings-searchbox {
        grid-column: 1 / -1;
    }

    .listing-details-panel {
        grid-template-columns: 1fr;
        overflow: auto;
    }

    .listing-details-media,
    .listing-details-media img {
        min-height: 260px;
        max-height: 360px;
    }
}

@media (max-width: 640px) {
    .listings-page {
        gap: 14px;
    }

    .listings-page-head {
        flex-direction: column;
        align-items: stretch;
    }

    .listings-page-actions {
        width: 100%;
    }

    .listings-toolbar {
        grid-template-columns: 1fr;
        border-radius: 18px;
    }

    .listings-section-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .listings-section-head .btn {
        width: 100%;
        justify-content: center;
    }

    .listings-grid {
        grid-template-columns: 1fr;
    }

    .listing-card {
        border-radius: 20px;
    }

    .listing-card-body {
        min-height: 0;
    }

    .listing-details-modal {
        align-items: flex-end;
        padding: 0;
    }

    .listing-details-panel {
        width: 100%;
        max-height: 92dvh;
        border-radius: 24px 24px 0 0;
    }

    .listing-details-body {
        padding: 20px 16px 22px;
    }

    .listing-details-actions .btn {
        width: 100%;
        justify-content: center;
    }
}

/* === Stage 28B: create/edit listings with cover photo === */
.listings-section-head-modern {
    align-items: center;
}

.listings-head-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.listings-mode-tabs {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    border-radius: 999px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
}

body.theme-light .listings-mode-tabs {
    background: rgba(79, 70, 229, 0.06);
}

.listings-mode-tab {
    appearance: none;
    border: 0;
    border-radius: 999px;
    padding: 8px 13px;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 800;
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}

.listings-mode-tab:hover {
    color: var(--text);
    transform: translateY(-1px);
}

.listings-mode-tab.active {
    background: var(--primary-grad);
    color: #fff;
    box-shadow: 0 10px 25px rgba(139, 92, 246, 0.24);
}

.listing-status-badge {
    position: absolute;
    right: 10px;
    top: 10px;
    border-radius: 999px;
    padding: 5px 9px;
    background: rgba(245, 158, 11, 0.94);
    color: #111827;
    backdrop-filter: blur(10px);
    font-size: 0.72rem;
    font-weight: 900;
}

.listing-status-badge.inline {
    position: static;
    display: inline-flex;
    width: fit-content;
    color: #111827;
    margin-bottom: 10px;
}

.listing-details-badges {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.listing-card.is-draft {
    border-color: rgba(245, 158, 11, 0.36);
}

.listing-card-actions.owner-actions {
    grid-template-columns: 1fr 1fr;
}

.btn.danger {
    background: rgba(239, 68, 68, 0.16);
    border-color: rgba(239, 68, 68, 0.36);
    color: #ef4444;
}

.btn.danger:hover {
    background: rgba(239, 68, 68, 0.24);
    border-color: rgba(239, 68, 68, 0.52);
}

.listing-form-modal,
.listing-confirm-modal {
    position: fixed;
    inset: 0;
    z-index: 5100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
}

.listing-form-modal.visible,
.listing-confirm-modal.visible {
    opacity: 1;
    pointer-events: auto;
}

.listing-form-backdrop,
.listing-confirm-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.58);
    backdrop-filter: blur(10px);
}

.listing-form-panel,
.listing-confirm-panel {
    position: relative;
    z-index: 1;
    background: rgba(15, 20, 34, 0.88);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(18px);
}

body.theme-light .listing-form-panel,
body.theme-light .listing-confirm-panel {
    background: rgba(255, 255, 255, 0.96);
    border-color: rgba(79, 70, 229, 0.12);
}

.listing-form-panel {
    width: min(820px, calc(100vw - 28px));
    max-height: min(860px, calc(100dvh - 28px));
    overflow: auto;
    border-radius: 28px;
}

.listing-form-close {
    position: absolute;
    z-index: 3;
    top: calc(16px + env(safe-area-inset-top, 0px));
    right: max(16px, env(safe-area-inset-right, 0px));
}

.listing-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 24px;
}

.listing-form-head h2 {
    margin: 0 0 6px;
    font-size: clamp(1.35rem, 2.4vw, 1.9rem);
}

.listing-form-head {
    padding-right: 56px;
}

.listing-form-head p {
    margin: 0;
    color: var(--text-secondary);
}

.listing-cover-picker {
    display: block;
    cursor: pointer;
}

.listing-cover-preview {
    min-height: 220px;
    border-radius: 22px;
    border: 1px dashed rgba(139, 92, 246, 0.46);
    background: linear-gradient(135deg, rgba(99,102,241,0.14), rgba(139,92,246,0.10));
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 8px;
    overflow: hidden;
    transition: border-color var(--transition-fast), transform var(--transition-fast), background var(--transition-fast);
}

.listing-cover-preview:hover {
    border-color: var(--primary);
    transform: translateY(-1px);
}

.listing-cover-preview.has-image {
    border-style: solid;
    min-height: 280px;
}

.listing-cover-preview img {
    width: 100%;
    height: 100%;
    min-height: 280px;
    object-fit: cover;
    display: block;
}

.listing-cover-preview b {
    color: var(--text);
}

.listing-remove-cover {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
}

.listing-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.listing-form-grid .field {
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-width: 0;
}

.listing-form-grid .field.full {
    grid-column: 1 / -1;
}

.listing-form-grid .field > span {
    color: var(--text-secondary);
    font-size: 0.86rem;
    font-weight: 800;
}

.listing-category-auto-hint {
    color: var(--primary);
    font-size: .76rem;
    font-weight: 750;
    line-height: 1.3;
}

.listing-price-currency-note {
    color: var(--text-muted);
    font-size: .74rem;
    font-weight: 650;
    line-height: 1.35;
}

.listing-category-auto-hint[hidden] {
    display: none;
}

.listing-form-grid textarea.input {
    resize: vertical;
    min-height: 120px;
    line-height: 1.4;
}

.listing-form-grid .field.is-disabled {
    opacity: 0.55;
}

.listing-rules-notice {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 14px 16px;
    border-radius: 18px;
    border: 1px solid rgba(139, 92, 246, .24);
    background: linear-gradient(135deg, rgba(139,92,246,.14), rgba(99,102,241,.08));
    color: var(--text-secondary);
}

.listing-rules-notice-icon {
    width: 36px;
    height: 36px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    color: #fff;
    background: var(--primary-grad);
    box-shadow: 0 12px 28px rgba(124,58,237,.28);
}

.listing-rules-notice b {
    display: block;
    margin-bottom: 4px;
    color: var(--text-primary);
    font-weight: 900;
}

.listing-rules-notice p {
    margin: 0;
    line-height: 1.42;
    font-size: .9rem;
}

.listing-form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 4px;
}

.listing-form-actions-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.listing-confirm-panel {
    width: min(430px, calc(100vw - 32px));
    border-radius: 24px;
    padding: 22px;
    text-align: center;
}

.listing-confirm-panel h3 {
    margin: 0 0 8px;
}

.listing-confirm-panel p {
    margin: 0 0 18px;
    color: var(--text-secondary);
}

.listing-confirm-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

@media (max-width: 700px) {
    .listings-head-actions {
        width: 100%;
        justify-content: stretch;
    }

    .listings-mode-tabs,
    .listings-head-actions .btn {
        width: 100%;
    }

    .listings-mode-tab {
        flex: 1;
        text-align: center;
    }

    .listing-form-modal,
    .listing-confirm-modal {
        align-items: flex-end;
        padding: 0;
    }

    .listing-form-panel {
        width: 100%;
        max-height: 92dvh;
        border-radius: 24px 24px 0 0;
    }

    .listing-form {
        padding: 20px 16px 22px;
    }

    .listing-form-grid {
        grid-template-columns: 1fr;
    }

    .listing-cover-preview,
    .listing-cover-preview.has-image,
    .listing-cover-preview img {
        min-height: 210px;
    }

    .listing-form-actions {
        align-items: stretch;
        flex-direction: column-reverse;
    }

    .listing-form-actions-right {
        display: grid;
        grid-template-columns: 1fr 1fr;
        width: 100%;
    }

    .listing-form-actions > .btn,
    .listing-form-actions-right .btn {
        justify-content: center;
        width: 100%;
    }

    .listing-confirm-panel {
        width: 100%;
        border-radius: 24px 24px 0 0;
        padding: 22px 16px calc(22px + env(safe-area-inset-bottom));
    }
}

/* === Stage 28C: listing gallery / private media viewer === */
.listing-photo-count-badge {
    position: absolute;
    right: 10px;
    bottom: 10px;
    border-radius: 999px;
    padding: 5px 9px;
    background: rgba(10, 14, 26, 0.72);
    color: #fff;
    backdrop-filter: blur(10px);
    font-size: 0.72rem;
    font-weight: 900;
}

.listing-details-media-wrap {
    min-width: 0;
    background: linear-gradient(135deg, rgba(99,102,241,0.18), rgba(139,92,246,0.10));
    display: flex;
    flex-direction: column;
    min-height: 420px;
}

.listing-details-main-photo {
    appearance: none;
    border: 0;
    padding: 0;
    margin: 0;
    width: 100%;
    height: 100%;
    min-height: 420px;
    background: transparent;
    cursor: zoom-in;
    display: block;
}

.listing-details-main-photo img,
.listing-details-media > img {
    width: 100%;
    height: 100%;
    min-height: 420px;
    object-fit: contain;
    display: block;
    background: rgba(0, 0, 0, 0.12);
}

.listing-details-thumbs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(54px, 1fr));
    gap: 8px;
    padding: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(10, 14, 26, 0.22);
}

body.theme-light .listing-details-thumbs {
    border-top-color: rgba(79, 70, 229, 0.12);
    background: rgba(79, 70, 229, 0.05);
}

.listing-details-thumb {
    appearance: none;
    border: 2px solid transparent;
    padding: 0;
    border-radius: 13px;
    overflow: hidden;
    aspect-ratio: 1 / 1;
    background: var(--bg-tertiary);
    cursor: pointer;
}

.listing-details-thumb.active,
.listing-details-thumb:hover {
    border-color: var(--primary);
}

.listing-details-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.listing-existing-media,
.listing-new-media-preview {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.listing-media-section-title {
    color: var(--text-secondary);
    font-size: 0.86rem;
    font-weight: 900;
}

.listing-existing-media-grid,
.listing-new-media-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
    gap: 10px;
}

.listing-existing-media-tile,
.listing-new-media-tile {
    position: relative;
    display: block;
    aspect-ratio: 1 / 1;
    border-radius: 16px;
    overflow: hidden;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    cursor: pointer;
}

.listing-existing-media-tile img,
.listing-new-media-tile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.listing-existing-media-tile span,
.listing-new-media-tile span {
    position: absolute;
    left: 7px;
    right: 7px;
    bottom: 7px;
    border-radius: 999px;
    padding: 5px 7px;
    background: rgba(10, 14, 26, 0.76);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 900;
    text-align: center;
    backdrop-filter: blur(8px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.listing-existing-media-tile.is-cover span {
    background: rgba(139, 92, 246, 0.88);
}

.listing-existing-media-tile.marked-remove {
    opacity: 0.48;
    border-color: rgba(239, 68, 68, 0.72);
}

.listing-existing-media-tile.marked-remove::after {
    content: 'Удалится';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 14, 26, 0.58);
    color: #fff;
    font-weight: 900;
}

.listing-cover-preview small {
    color: var(--text-muted);
    font-size: 0.78rem;
}

.listing-photo-viewer {
    position: fixed;
    inset: 0;
    z-index: 5400;
}

.listing-photo-viewer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.82);
    backdrop-filter: blur(8px);
}

.listing-photo-viewer-panel {
    position: absolute;
    inset: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.listing-photo-viewer-panel img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 18px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
}

.listing-photo-viewer-close,
.listing-photo-viewer-nav {
    appearance: none;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(17, 24, 39, 0.72);
    color: #fff;
    backdrop-filter: blur(12px);
    cursor: pointer;
    z-index: 2;
}

.listing-photo-viewer-close {
    position: absolute;
    top: 0;
    right: 0;
    width: 42px;
    height: 42px;
    border-radius: 999px;
    font-size: 1.45rem;
}

.listing-photo-viewer-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 46px;
    height: 64px;
    border-radius: 18px;
    font-size: 2.3rem;
    line-height: 1;
}

.listing-photo-viewer-nav.prev {
    left: 0;
}

.listing-photo-viewer-nav.next {
    right: 0;
}

.listing-photo-viewer-counter {
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    padding: 7px 12px;
    border-radius: 999px;
    background: rgba(17, 24, 39, 0.72);
    color: #fff;
    font-weight: 900;
    backdrop-filter: blur(12px);
}

@media (max-width: 920px) {
    .listing-details-media-wrap,
    .listing-details-main-photo,
    .listing-details-main-photo img,
    .listing-details-media > img {
        min-height: 260px;
        max-height: 430px;
    }
}

@media (max-width: 640px) {
    .listing-existing-media-grid,
    .listing-new-media-preview {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }

    .listing-photo-viewer-panel {
        inset: 14px 10px calc(14px + env(safe-area-inset-bottom));
    }

    .listing-photo-viewer-close {
        top: 4px;
        right: 4px;
    }

    .listing-photo-viewer-nav {
        width: 40px;
        height: 54px;
        border-radius: 16px;
        font-size: 2rem;
    }
}

/* === Stage 28D: expanded marketplace categories, filters, statuses and reports === */
.listings-advanced-filters {
    display: grid;
    grid-template-columns: 120px 120px 190px 190px auto;
    gap: 10px;
    align-items: end;
    padding: 12px;
    border-radius: 20px;
}

.listings-price-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.listings-price-field span {
    color: var(--text-muted);
    font-size: 0.76rem;
    font-weight: 800;
}

.listings-check-pill {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 14px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
}

body.theme-light .listings-check-pill {
    background: #fff;
}

.listings-check-pill input {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.listing-mini-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.listing-mini-tags span,
.listing-info-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(139, 92, 246, 0.12);
    color: var(--primary);
    font-size: 0.74rem;
    font-weight: 900;
}

body.theme-light .listing-mini-tags span,
body.theme-light .listing-info-badge {
    background: rgba(79, 70, 229, 0.08);
}

.listing-card.is-sold {
    opacity: 0.82;
    border-color: rgba(148, 163, 184, 0.28);
}

.listing-card.is-sold .listing-card-cover img {
    filter: grayscale(0.25);
}

.listing-status-badge.sold,
.listing-status-badge.inline.sold {
    background: rgba(100, 116, 139, 0.92);
    color: #fff;
}

.listing-details-seller-card {
    margin: 12px 0 4px;
    padding: 10px;
    border-radius: 18px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
}

body.theme-light .listing-details-seller-card {
    background: rgba(79, 70, 229, 0.05);
}

.listing-seller.large {
    width: 100%;
    justify-content: flex-start;
    text-align: left;
}

.listing-seller-avatar.large {
    width: 42px;
    height: 42px;
    font-size: 1rem;
}

.listing-seller.large b,
.listing-seller.large small {
    display: block;
    line-height: 1.15;
}

.listing-seller.large b {
    color: var(--text);
}

.listing-seller.large small {
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 0.78rem;
}

.listing-details-actions .btn.ghost {
    background: transparent;
    border-color: var(--border);
}

.listing-report-modal {
    position: fixed;
    inset: 0;
    z-index: 5200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
}

.listing-report-modal.visible {
    opacity: 1;
    pointer-events: auto;
}

.listing-report-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.58);
    backdrop-filter: blur(10px);
}

.listing-report-panel {
    position: relative;
    z-index: 1;
    width: min(460px, calc(100vw - 32px));
    border-radius: 24px;
    padding: 22px;
    background: rgba(15, 20, 34, 0.9);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(18px);
}

body.theme-light .listing-report-panel {
    background: rgba(255, 255, 255, 0.96);
    border-color: rgba(79, 70, 229, 0.12);
}

.listing-report-panel form {
    display: flex;
    flex-direction: column;
    gap: 13px;
}

.listing-report-panel h3 {
    margin: 0;
}

.listing-report-panel p {
    margin: -4px 0 2px;
    color: var(--text-secondary);
    font-size: 0.92rem;
}

.listing-report-panel .field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.listing-report-panel .field span {
    color: var(--text-secondary);
    font-size: 0.86rem;
    font-weight: 800;
}

.listing-report-panel textarea.input {
    resize: vertical;
    min-height: 110px;
}

.listing-report-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

@media (max-width: 1000px) {
    .listings-toolbar {
        grid-template-columns: minmax(220px, 1fr) 1fr 1fr;
    }

    .listings-searchbox {
        grid-column: 1 / -1;
    }

    .listings-advanced-filters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .listings-advanced-filters {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        padding: 10px;
    }

    .listings-advanced-filters .listings-filter-select,
    .listings-check-pill {
        grid-column: 1 / -1;
        width: 100%;
    }

    .listing-mini-tags span,
    .listing-info-badge {
        font-size: 0.7rem;
        min-height: 22px;
        padding: 3px 7px;
    }

    .listing-report-modal {
        align-items: flex-end;
        padding: 0;
    }

    .listing-report-panel {
        width: 100%;
        border-radius: 24px 24px 0 0;
        padding: 22px 16px calc(22px + env(safe-area-inset-bottom));
    }

    .listing-details-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .listing-details-actions .btn {
        width: 100%;
        justify-content: center;
    }
}


/* === Stage 28E: full listing detail page === */
.listing-detail-page {
    max-width: 1280px;
}

.listing-detail-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.listing-detail-route-note {
    color: var(--text-muted);
    font-size: 0.86rem;
    font-weight: 800;
}

.listing-detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(340px, 0.65fr);
    gap: 18px;
    padding: 18px;
    border-radius: 26px;
    overflow: hidden;
}

.listing-detail-gallery-shell,
.listing-detail-info-shell {
    min-width: 0;
}

.listing-detail-main-image {
    position: relative;
    overflow: hidden;
    border-radius: 24px;
    background: linear-gradient(135deg, rgba(99,102,241,0.16), rgba(139,92,246,0.10));
    min-height: 520px;
    max-height: 680px;
}

.listing-detail-main-image button {
    appearance: none;
    border: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    min-height: inherit;
    background: transparent;
    cursor: zoom-in;
    display: block;
}

.listing-detail-main-image img {
    width: 100%;
    height: 100%;
    min-height: inherit;
    max-height: 680px;
    display: block;
    object-fit: contain;
    background: rgba(0, 0, 0, 0.12);
}

.listing-detail-main-empty {
    min-height: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--primary);
    font-weight: 900;
}

.listing-detail-photo-count,
.listing-detail-main-image .listing-status-badge {
    position: absolute;
    right: 14px;
    top: 14px;
    border-radius: 999px;
    padding: 7px 11px;
    background: rgba(10, 14, 26, 0.72);
    color: #fff;
    font-size: 0.82rem;
    font-weight: 900;
    backdrop-filter: blur(12px);
}

.listing-detail-main-image .listing-status-badge {
    left: 14px;
    right: auto;
}

.listing-detail-thumb-row {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 12px 2px 2px;
}

.listing-detail-page-thumb,
.listing-detail-skeleton-thumb {
    flex: 0 0 88px;
    width: 88px;
    height: 72px;
    border-radius: 16px;
}

.listing-detail-page-thumb {
    appearance: none;
    padding: 0;
    border: 2px solid transparent;
    background: var(--bg-tertiary);
    overflow: hidden;
    cursor: pointer;
}

.listing-detail-page-thumb.active,
.listing-detail-page-thumb:hover {
    border-color: var(--primary);
}

.listing-detail-page-thumb img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.listing-detail-info-shell {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 6px;
}

.listing-detail-info-shell h1 {
    margin: 0;
    font-size: clamp(1.55rem, 2.4vw, 2.45rem);
    line-height: 1.1;
}

.listing-detail-page-price {
    color: var(--primary);
    font-size: clamp(1.45rem, 2.2vw, 2.2rem);
    font-weight: 1000;
    letter-spacing: -0.03em;
}

.listing-detail-facts {
    display: grid;
    grid-template-columns: 1fr;
    gap: 9px;
}

.listing-detail-facts div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--bg-tertiary);
}

body.theme-light .listing-detail-facts div {
    background: rgba(79, 70, 229, 0.045);
}

.listing-detail-facts span {
    color: var(--text-muted);
    font-weight: 800;
}

.listing-detail-facts b {
    color: var(--text);
    text-align: right;
}

.listing-detail-seller-wide {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: rgba(139, 92, 246, 0.08);
}

body.theme-light .listing-detail-seller-wide {
    background: rgba(79, 70, 229, 0.055);
}

.listing-detail-action-stack {
    display: grid;
    grid-template-columns: 1fr;
    gap: 9px;
}

.listing-detail-action-stack .btn {
    width: 100%;
    justify-content: center;
}

.btn.guarant {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.18), rgba(59, 130, 246, 0.14));
    color: var(--primary);
    border: 1px solid rgba(139, 92, 246, 0.28);
}

.btn.guarant.disabled {
    cursor: default;
    opacity: 0.92;
}

.listing-detail-safe-note {
    color: var(--text-muted);
    font-size: 0.86rem;
    line-height: 1.35;
    padding: 10px 12px;
    border-radius: 16px;
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.16);
}

.listing-detail-description {
    padding: 20px;
    border-radius: 24px;
}

.listing-detail-description h2,
.listing-related-section h2 {
    margin: 0 0 10px;
}

.listing-detail-description p {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.65;
    white-space: pre-wrap;
}

.listing-related-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.listing-related-empty {
    grid-column: 1 / -1;
}

.listing-detail-skeleton-photo {
    min-height: 520px;
    border-radius: 24px;
}

@media (max-width: 1040px) {
    .listing-detail-layout {
        grid-template-columns: 1fr;
    }

    .listing-detail-main-image,
    .listing-detail-skeleton-photo {
        min-height: 420px;
    }
}

@media (max-width: 700px) {
    .listing-detail-topbar {
        align-items: stretch;
        flex-direction: column;
    }

    .listing-detail-route-note {
        display: none;
    }

    .listing-detail-layout {
        padding: 10px;
        border-radius: 22px;
        gap: 12px;
    }

    .listing-detail-main-image,
    .listing-detail-main-image button,
    .listing-detail-main-image img,
    .listing-detail-skeleton-photo {
        min-height: 300px;
        max-height: 440px;
    }

    .listing-detail-page-thumb,
    .listing-detail-skeleton-thumb {
        flex-basis: 72px;
        width: 72px;
        height: 58px;
        border-radius: 13px;
    }

    .listing-detail-info-shell {
        padding: 4px;
    }

    .listing-detail-description {
        padding: 16px;
    }
}

/* Stage 28F — marketplace moderation queue */
.listing-card.is-pending,
.listing-detail-layout.is-pending {
    border-color: rgba(245, 158, 11, 0.38);
}

.listing-card.is-rejected,
.listing-detail-layout.is-rejected {
    border-color: rgba(239, 68, 68, 0.38);
}

.listing-status-badge.pending,
.listing-status-badge.inline.pending {
    background: rgba(245, 158, 11, 0.94);
    color: #111827;
}

.listing-status-badge.rejected,
.listing-status-badge.inline.rejected {
    background: rgba(239, 68, 68, 0.94);
    color: #fff;
}

.listing-status-badge.draft,
.listing-status-badge.inline.draft {
    background: rgba(139, 92, 246, 0.92);
    color: #fff;
}

.listing-detail-safe-note.danger {
    border-color: rgba(239, 68, 68, 0.28);
    color: #fecaca;
    background: rgba(239, 68, 68, 0.10);
}

body.theme-light .listing-detail-safe-note.danger {
    color: #991b1b;
    background: rgba(239, 68, 68, 0.08);
}

.admin-listings-section .card-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.admin-listings-search {
    display: grid;
    grid-template-columns: minmax(160px, 220px) minmax(220px, 1fr) auto auto;
    gap: 10px;
    align-items: center;
}

.admin-listings-grid {
    display: grid;
    gap: 14px;
}

.admin-listing-card {
    display: grid;
    grid-template-columns: 132px minmax(0, 1fr);
    gap: 14px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--bg-card);
}

.admin-listing-thumb {
    width: 132px;
    height: 108px;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 800;
}

.admin-listing-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.admin-listing-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.admin-listing-topline,
.admin-listing-actions,
.admin-listing-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.admin-listing-topline {
    justify-content: space-between;
}

.admin-listing-body h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 900;
    color: var(--text);
}

.admin-listing-body p {
    margin: 0;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.admin-listing-meta span {
    font-size: 0.82rem;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border-radius: 999px;
    padding: 5px 8px;
}

.admin-listing-reject-note {
    padding: 9px 10px;
    border-radius: 14px;
    color: #fecaca;
    background: rgba(239, 68, 68, 0.10);
    border: 1px solid rgba(239, 68, 68, 0.20);
    font-size: 0.88rem;
}

body.theme-light .admin-listing-reject-note {
    color: #991b1b;
    background: rgba(239, 68, 68, 0.07);
}

.badge.warning { background: rgba(245, 158, 11, 0.16); color: #f59e0b; }
.badge.info { background: rgba(59, 130, 246, 0.14); color: #60a5fa; }
.badge.secondary { background: rgba(148, 163, 184, 0.16); color: var(--text-secondary); }

@media (max-width: 720px) {
    .admin-listings-search {
        grid-template-columns: 1fr;
    }

    .admin-listing-card {
        grid-template-columns: 1fr;
    }

    .admin-listing-thumb {
        width: 100%;
        height: 180px;
    }
}


/* Stage 28G: marketplace moderation notifications/counters */
.admin-tab {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.admin-tab-count {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1;
    color: #fff;
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    box-shadow: 0 8px 20px rgba(124, 58, 237, 0.28);
}

.admin-listings-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.admin-listings-subtitle {
    margin: 4px 0 0;
    color: var(--text-secondary);
    font-size: 0.88rem;
}

.admin-listings-pending-pill {
    min-width: 94px;
    padding: 10px 13px;
    border-radius: 18px;
    background: rgba(124, 58, 237, 0.10);
    border: 1px solid rgba(124, 58, 237, 0.22);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    color: var(--text-primary);
}

.admin-listings-pending-pill b {
    font-size: 1.25rem;
    line-height: 1;
    color: #8b5cf6;
}

.admin-listings-pending-pill span {
    margin-top: 3px;
    font-size: 0.72rem;
    color: var(--text-secondary);
}

@media (max-width: 640px) {
    .admin-listings-card-header {
        align-items: stretch;
        flex-direction: column;
    }

    .admin-listings-pending-pill {
        width: 100%;
        flex-direction: row;
        gap: 8px;
    }
}

/* Stage 28H: marketplace moderation modals and reports journal */
.admin-listings-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}

.admin-listings-pending-pill.danger {
    background: rgba(239, 68, 68, 0.10);
    border-color: rgba(239, 68, 68, 0.24);
}

.admin-listings-pending-pill.danger b {
    color: #ef4444;
}

.admin-listing-reports-card {
    margin-top: 18px;
}

.admin-listing-reports-list {
    display: grid;
    gap: 12px;
}

.admin-listing-report-card {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 14px;
    padding: 14px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--bg-card);
}

.admin-listing-report-card.danger {
    border-color: rgba(239, 68, 68, 0.24);
    box-shadow: 0 14px 34px rgba(239, 68, 68, 0.06);
}

.admin-listing-report-card.success {
    border-color: rgba(34, 197, 94, 0.20);
}

.admin-listing-report-thumb {
    width: 92px;
    height: 92px;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 800;
}

.admin-listing-report-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.admin-listing-report-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.admin-listing-report-body h4 {
    margin: 0;
    color: var(--text);
    font-size: 1rem;
    font-weight: 900;
}

.admin-listing-report-body h4 small {
    color: var(--text-secondary);
    font-weight: 700;
}

.admin-listing-report-comment {
    padding: 10px 12px;
    border-radius: 16px;
    color: var(--text);
    background: rgba(124, 58, 237, 0.08);
    border: 1px solid rgba(124, 58, 237, 0.16);
    white-space: pre-wrap;
}

.admin-listing-action-modal {
    position: fixed;
    inset: 0;
    z-index: 10060;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
}

.admin-listing-action-modal.visible {
    display: flex;
}

.admin-listing-action-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 12, 25, 0.62);
    backdrop-filter: blur(12px);
}

.admin-listing-action-panel {
    position: relative;
    width: min(520px, 100%);
    max-height: min(88vh, 680px);
    overflow-y: auto;
    padding: 20px;
    border-radius: 26px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(24, 24, 37, 0.96);
    color: #fff;
    box-shadow: 0 28px 90px rgba(0, 0, 0, 0.42);
}

body.theme-light .admin-listing-action-panel {
    background: rgba(255, 255, 255, 0.98);
    color: #111827;
    border-color: rgba(124, 58, 237, 0.18);
    box-shadow: 0 28px 90px rgba(31, 41, 55, 0.20);
}

.admin-listing-action-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    color: inherit;
    background: rgba(124, 58, 237, 0.14);
    font-size: 1.3rem;
    line-height: 1;
}

.admin-listing-action-panel h3 {
    margin: 0 42px 8px 0;
    font-size: 1.2rem;
    font-weight: 900;
}

.admin-listing-action-panel p {
    margin: 0 0 14px;
    color: var(--text-secondary);
    line-height: 1.45;
}

.admin-listing-action-field {
    display: grid;
    gap: 8px;
    margin: 12px 0;
    font-weight: 800;
}

.admin-listing-action-field textarea {
    min-height: 110px;
    resize: vertical;
}

.admin-listing-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0 4px;
}

.admin-listing-preset {
    border: 1px solid rgba(124, 58, 237, 0.20);
    border-radius: 999px;
    padding: 7px 10px;
    background: rgba(124, 58, 237, 0.10);
    color: inherit;
    cursor: pointer;
    font-weight: 800;
    font-size: 0.82rem;
}

.admin-listing-preset:hover {
    background: rgba(124, 58, 237, 0.20);
}

.admin-listing-action-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 16px;
}

@media (max-width: 720px) {
    .admin-listings-summary,
    .admin-listing-action-actions {
        flex-direction: column;
    }

    .admin-listing-report-card {
        grid-template-columns: 1fr;
    }

    .admin-listing-report-thumb {
        width: 100%;
        height: 170px;
    }

    .admin-listing-action-panel {
        border-radius: 24px 24px 0 0;
        align-self: flex-end;
        width: 100%;
        max-height: 84vh;
    }
}

/* Stage 28I — marketplace moderation rules / anti-spam */
.listing-policy-box {
    display: grid;
    grid-template-columns: 42px 1fr;
    gap: 14px;
    padding: 14px 16px;
    margin: 4px 0 12px;
    border: 1px solid rgba(139, 92, 246, .26);
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(139, 92, 246, .12), rgba(99, 102, 241, .06));
    color: var(--text-primary, #f8fafc);
}
.listing-policy-icon {
    width: 42px;
    height: 42px;
    border-radius: 15px;
    display: grid;
    place-items: center;
    font-weight: 900;
    color: #fff;
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    box-shadow: 0 12px 28px rgba(139, 92, 246, .28);
}
.listing-policy-box b { display: block; margin-bottom: 4px; }
.listing-policy-box p { margin: 0 0 8px; color: var(--text-secondary, rgba(226,232,240,.78)); line-height: 1.45; }
.listing-policy-box ul { margin: 0; padding-left: 18px; color: var(--text-secondary, rgba(226,232,240,.78)); line-height: 1.45; }
.listing-detail-safe-note.warning {
    border-color: rgba(245, 158, 11, .35);
    background: rgba(245, 158, 11, .10);
    color: #f59e0b;
}
.admin-listings-pending-pill.warning {
    border-color: rgba(245, 158, 11, .28);
    background: rgba(245, 158, 11, .10);
}
.admin-listings-pending-pill.warning b { color: #f59e0b; }
.admin-listing-policy-flags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    padding: 10px 12px;
    margin-top: 10px;
    border-radius: 14px;
    border: 1px solid rgba(245, 158, 11, .24);
    background: rgba(245, 158, 11, .08);
}
.admin-listing-policy-flags b,
.admin-listing-policy-flags em {
    font-size: 12px;
    color: #f59e0b;
    font-style: normal;
}
.admin-listing-policy-flags span {
    padding: 5px 8px;
    border-radius: 999px;
    font-size: 12px;
    color: var(--text-primary, #f8fafc);
    background: rgba(245, 158, 11, .14);
    border: 1px solid rgba(245, 158, 11, .18);
}
@media (max-width: 640px) {
    .listing-policy-box {
        grid-template-columns: 34px 1fr;
        padding: 12px;
        gap: 10px;
    }
    .listing-policy-icon { width: 34px; height: 34px; border-radius: 12px; }
}


/* Stage 28J — user listing manager tabs */
.listings-mine-status-row {
    padding: 10px;
    border-radius: 22px;
    margin: -8px 0 2px;
}

.listings-mine-status-row[hidden] {
    display: none !important;
}

.listings-mine-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.listings-mine-tab {
    appearance: none;
    border: 1px solid var(--border);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border-radius: 999px;
    min-height: 38px;
    padding: 7px 10px 7px 13px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 900;
    cursor: pointer;
    transition: transform var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
}

body.theme-light .listings-mine-tab {
    background: rgba(79, 70, 229, 0.05);
}

.listings-mine-tab:hover {
    transform: translateY(-1px);
    color: var(--text);
    border-color: rgba(139, 92, 246, 0.38);
}

.listings-mine-tab.active {
    background: var(--primary-grad);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 12px 26px rgba(139, 92, 246, 0.24);
}

.listings-mine-tab b {
    min-width: 24px;
    height: 24px;
    border-radius: 999px;
    padding: 0 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.14);
    color: inherit;
    font-size: 0.78rem;
}

.listings-mine-tab:not(.active) b {
    background: rgba(139, 92, 246, 0.12);
    color: var(--primary);
}

.listing-owner-note {
    border-radius: 14px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 800;
    line-height: 1.3;
}

body.theme-light .listing-owner-note {
    background: rgba(79, 70, 229, 0.05);
}

.listing-owner-note.pending,
.listing-owner-note.draft {
    border-color: rgba(245, 158, 11, 0.28);
    background: rgba(245, 158, 11, 0.10);
    color: #f59e0b;
}

body.theme-light .listing-owner-note.pending,
body.theme-light .listing-owner-note.draft {
    color: #92400e;
}

.listing-owner-note.rejected {
    border-color: rgba(239, 68, 68, 0.30);
    background: rgba(239, 68, 68, 0.10);
    color: #ef4444;
}

body.theme-light .listing-owner-note.rejected {
    color: #991b1b;
}

.listing-owner-note.sold,
.listing-owner-note.archived {
    border-color: rgba(148, 163, 184, 0.28);
    background: rgba(148, 163, 184, 0.10);
    color: var(--text-secondary);
}

.listing-owner-note.warning {
    border-color: rgba(245, 158, 11, 0.28);
    background: rgba(245, 158, 11, 0.10);
    color: #f59e0b;
}

.listing-card-actions.owner-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.listing-card-actions.owner-actions.is-status-active {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.listing-status-badge.archived,
.listing-status-badge.inline.archived {
    background: rgba(71, 85, 105, 0.92);
    color: #fff;
}

.listing-card.is-archived,
.listing-detail-layout.is-archived {
    opacity: 0.78;
    border-color: rgba(100, 116, 139, 0.32);
}

@media (max-width: 640px) {
    .listings-mine-status-row {
        padding: 8px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .listings-mine-tabs {
        flex-wrap: nowrap;
        min-width: max-content;
    }

    .listings-mine-tab {
        min-height: 36px;
        padding: 7px 9px 7px 11px;
        font-size: 0.82rem;
    }

    .listing-card-actions.owner-actions {
        grid-template-columns: 1fr;
    }
}


/* === Stage 28K: saved listings + views === */
.listing-card {
    position: relative;
}

.listing-favorite-btn {
    position: absolute;
    z-index: 5;
    right: 10px;
    top: 10px;
    width: 38px;
    height: 38px;
    border: 1px solid rgba(255,255,255,0.36);
    border-radius: 50%;
    background: rgba(10, 14, 26, 0.66);
    color: #fff;
    backdrop-filter: blur(12px);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 12px 28px rgba(0,0,0,0.20);
    transition: transform var(--transition-fast), background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

.listing-favorite-btn:hover {
    transform: translateY(-1px) scale(1.04);
    border-color: rgba(139, 92, 246, 0.75);
}

.listing-favorite-btn.active {
    background: var(--primary-grad);
    color: #fff;
    border-color: rgba(139, 92, 246, 0.82);
}

.listing-favorite-btn.active svg {
    fill: currentColor;
}

.listing-card-stats {
    align-items: center;
}

.listing-card-stats span:not(:first-child) {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 7px;
    border-radius: 999px;
    background: rgba(139, 92, 246, 0.10);
    color: var(--text-secondary);
    font-weight: 800;
}

body.theme-light .listing-card-stats span:not(:first-child) {
    background: rgba(79, 70, 229, 0.08);
}

.listing-detail-action-stack [data-listing-favorite].primary {
    box-shadow: 0 12px 28px rgba(139, 92, 246, 0.24);
}

@media (max-width: 720px) {
    .listing-favorite-btn {
        width: 36px;
        height: 36px;
        right: 9px;
        top: 9px;
    }

    .listings-mode-tabs {
        width: 100%;
        justify-content: center;
    }

    .listings-mode-tab {
        flex: 1 1 auto;
        padding-inline: 9px;
    }
}

/* === Stage 28L: listings page final UX polish, filters and compact mode === */
.listings-mobile-filter-btn {
    display: none;
}

.listings-stats-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    padding: 12px;
    border-radius: 20px;
}

.listings-stat-card {
    min-width: 0;
    padding: 13px 14px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: rgba(139, 92, 246, 0.07);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

body.theme-light .listings-stat-card {
    background: rgba(79, 70, 229, 0.055);
}

.listings-stat-card span {
    color: var(--text-muted);
    font-weight: 800;
    font-size: 0.82rem;
    line-height: 1.2;
}

.listings-stat-card b {
    color: var(--primary);
    font-size: 1.16rem;
    font-weight: 1000;
    white-space: nowrap;
}

.listings-stat-card.accent {
    background: var(--primary-light);
    border-color: rgba(139, 92, 246, 0.28);
}

.listings-active-filters {
    min-height: 36px;
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    padding: 0 2px 2px;
    scrollbar-width: thin;
}

.listings-active-filter-placeholder {
    color: var(--text-muted);
    font-size: 0.84rem;
    font-weight: 700;
    padding: 7px 2px;
}

.listings-active-filter-chip,
.listings-active-filter-reset {
    appearance: none;
    border: 1px solid rgba(139, 92, 246, 0.28);
    border-radius: 999px;
    background: var(--primary-light);
    color: var(--primary);
    min-height: 32px;
    padding: 6px 10px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-weight: 900;
    white-space: nowrap;
    cursor: pointer;
}

.listings-active-filter-chip b {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(139, 92, 246, 0.16);
    line-height: 1;
}

.listings-active-filter-reset {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border);
}

.listings-layout-toggle {
    display: inline-grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 4px;
    border-radius: 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
}

body.theme-light .listings-layout-toggle {
    background: #fff;
}

.listings-layout-btn {
    appearance: none;
    border: 0;
    border-radius: 10px;
    min-width: 36px;
    height: 34px;
    background: transparent;
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 1000;
    cursor: pointer;
}

.listings-layout-btn.active {
    color: #fff;
    background: var(--primary-grad);
    box-shadow: 0 8px 22px rgba(124, 58, 237, 0.26);
}

.listings-grid.is-compact {
    grid-template-columns: 1fr;
}

.listings-grid.is-compact .listing-card {
    display: grid;
    grid-template-columns: minmax(180px, 260px) minmax(0, 1fr);
    min-height: 210px;
}

.listings-grid.is-compact .listing-card-cover {
    height: 100%;
    min-height: 210px;
    aspect-ratio: auto;
}

.listings-grid.is-compact .listing-card-body {
    min-height: 0;
    padding: 16px;
}

.listings-grid.is-compact .listing-card-desc {
    -webkit-line-clamp: 3;
}

.listings-grid.is-compact .listing-card-actions {
    max-width: 360px;
}

@media (max-width: 920px) {
    .listings-stats-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .listings-mobile-filter-btn {
        display: inline-flex;
    }

    .listings-page:not(.filters-open) .listings-advanced-filters {
        display: none;
    }
}

@media (max-width: 720px) {
    .listings-page {
        gap: 12px;
        max-width: 100%;
        overflow-x: hidden;
    }

    .listings-page-actions .btn {
        min-height: 42px;
        padding-inline: 10px;
    }

    .listings-stats-strip {
        display: flex;
        overflow-x: auto;
        padding: 10px;
        scrollbar-width: thin;
    }

    .listings-stat-card {
        flex: 0 0 180px;
        padding: 11px 12px;
    }

    .listings-toolbar {
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 10px;
        border-radius: 18px;
    }

    .listings-searchbox {
        grid-column: auto;
    }

    .listings-section-head-modern {
        align-items: stretch;
    }

    .listings-head-actions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr auto;
        gap: 8px;
    }

    .listings-mode-tabs {
        grid-column: 1 / -1;
        width: 100%;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .listings-mode-tab {
        justify-content: center;
        min-height: 44px;
        padding-inline: 8px;
    }

    .listings-layout-toggle {
        justify-self: stretch;
        width: 100%;
    }

    .listings-layout-btn {
        width: 100%;
        min-height: 44px;
    }

    .listings-head-actions #listings-reset-filters {
        min-height: 44px;
    }

    .listings-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .listing-card {
        border-radius: 18px;
    }

    .listing-card-body {
        padding: 10px;
        gap: 6px;
        min-height: 176px;
    }

    .listing-card-title {
        font-size: 0.92rem;
    }

    .listing-card-price {
        font-size: 0.98rem;
    }

    .listing-card-desc,
    .listing-seller-row {
        display: none;
    }

    .listing-mini-tags {
        display: none;
    }

    .listing-card-meta {
        font-size: 0.72rem;
        gap: 4px;
    }

    .listing-card-actions {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .listing-card-actions .btn.small {
        min-height: 34px;
        font-size: 0.8rem;
        padding-inline: 8px;
    }

    .listing-favorite-btn {
        width: 34px;
        height: 34px;
    }

    .listings-grid.is-compact .listing-card {
        grid-template-columns: 112px minmax(0, 1fr);
        min-height: 152px;
    }

    .listings-grid.is-compact .listing-card-cover {
        min-height: 152px;
    }

    .listings-grid.is-compact .listing-card-body {
        min-height: 0;
    }

    .listings-grid.is-compact .listing-card-desc,
    .listings-grid.is-compact .listing-seller-row,
    .listings-grid.is-compact .listing-mini-tags {
        display: flex;
    }

    .listings-grid.is-compact .listing-card-desc {
        display: -webkit-box;
        -webkit-line-clamp: 2;
    }
}

@media (max-width: 420px) {
    .listings-grid {
        grid-template-columns: 1fr;
    }

    .listings-grid.is-compact .listing-card {
        grid-template-columns: 104px minmax(0, 1fr);
    }

    .listing-category-badge {
        max-width: calc(100% - 56px);
        font-size: 0.68rem;
    }
}


/* === Stage 28M: global location, nearby filter, saved filters === */
.listings-quick-filters {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    border-radius: 18px;
    overflow-x: auto;
    scrollbar-width: thin;
}

.listings-quick-chip {
    appearance: none;
    border: 1px solid rgba(139, 92, 246, 0.22);
    border-radius: 999px;
    min-height: 36px;
    padding: 8px 12px;
    background: rgba(139, 92, 246, 0.08);
    color: var(--text-secondary);
    font-weight: 900;
    white-space: nowrap;
    cursor: pointer;
    transition: transform .15s ease, border-color .15s ease, background .15s ease, color .15s ease;
}

.listings-quick-chip:hover {
    transform: translateY(-1px);
    border-color: rgba(139, 92, 246, 0.42);
    color: var(--primary);
}

.listings-quick-chip.active {
    color: #fff;
    border-color: rgba(139, 92, 246, 0.62);
    background: var(--primary-grad);
    box-shadow: 0 10px 26px rgba(124, 58, 237, 0.22);
}

.listings-country-input,
.listings-city-input {
    min-width: 150px;
}

.listings-radius-field {
    max-width: 140px;
}

.listing-geo-row {
    display: grid;
    gap: 8px;
    align-items: start;
}

.listing-geo-row small {
    color: var(--text-muted);
    font-weight: 750;
    line-height: 1.35;
}

.field.is-disabled {
    opacity: .55;
}

.field.is-disabled .btn {
    pointer-events: none;
}

@media (max-width: 920px) {
    .listings-page:not(.filters-open) .listings-quick-filters {
        display: flex;
    }
}

@media (max-width: 720px) {
    .listings-quick-filters {
        padding: 8px;
        border-radius: 16px;
        margin-inline: -2px;
    }

    .listings-quick-chip {
        min-height: 34px;
        padding: 7px 10px;
        font-size: .82rem;
    }

    .listings-radius-field {
        max-width: none;
    }
}

/* === Stage 28N: marketplace SVG quick filters + world map view === */
.listings-quick-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.listings-quick-icon {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    background: rgba(139, 92, 246, 0.12);
    flex: 0 0 auto;
}

.listings-quick-icon svg {
    width: 15px;
    height: 15px;
}

.listings-quick-chip.active .listings-quick-icon {
    color: #fff;
    background: rgba(255,255,255,0.18);
}

.listings-layout-toggle {
    grid-template-columns: repeat(3, minmax(36px, auto));
}

.listings-layout-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 10px;
}

.listings-layout-btn svg {
    width: 17px;
    height: 17px;
}

.listings-layout-btn.map {
    min-width: 78px;
}

/* Every view button names its mode (owner 2026-10-18: three bare icons next to
   «Карта» did not say how to switch the view). */
.listings-layout-btn span {
    font-size: .78rem;
    font-weight: 900;
}

.listing-card-stats svg {
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
}

.listings-grid.is-map {
    display: block;
}

.listings-map-view {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 14px;
    align-items: stretch;
}

.listings-map-panel,
.listings-map-list,
.listings-map-empty {
    border-radius: 24px;
    overflow: hidden;
}

.listings-map-panel {
    min-height: 520px;
    position: relative;
    padding: 12px;
}

.listings-map-bg {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 496px;
    overflow: hidden;
    border-radius: 20px;
    border: 1px solid rgba(139, 92, 246, 0.22);
    background:
        radial-gradient(circle at 20% 35%, rgba(139,92,246,0.28) 0 9%, transparent 10%),
        radial-gradient(circle at 72% 42%, rgba(99,102,241,0.22) 0 13%, transparent 14%),
        radial-gradient(circle at 52% 72%, rgba(168,85,247,0.16) 0 10%, transparent 11%),
        linear-gradient(135deg, rgba(15, 23, 42, 0.94), rgba(30, 27, 75, 0.88));
}

body.theme-light .listings-map-bg {
    background:
        radial-gradient(circle at 20% 35%, rgba(139,92,246,0.18) 0 9%, transparent 10%),
        radial-gradient(circle at 72% 42%, rgba(99,102,241,0.16) 0 13%, transparent 14%),
        radial-gradient(circle at 52% 72%, rgba(168,85,247,0.12) 0 10%, transparent 11%),
        linear-gradient(135deg, #f8fafc, #eef2ff);
}

.listings-map-grid-lines {
    position: absolute;
    inset: 0;
    opacity: .32;
    background-image:
        linear-gradient(rgba(255,255,255,.12) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.12) 1px, transparent 1px);
    background-size: 12.5% 20%;
    pointer-events: none;
}

body.theme-light .listings-map-grid-lines {
    background-image:
        linear-gradient(rgba(79,70,229,.11) 1px, transparent 1px),
        linear-gradient(90deg, rgba(79,70,229,.11) 1px, transparent 1px);
}

.listings-map-watermark {
    position: absolute;
    left: 18px;
    top: 16px;
    color: rgba(255,255,255,.28);
    font-size: .78rem;
    font-weight: 1000;
    letter-spacing: .12em;
    pointer-events: none;
}

body.theme-light .listings-map-watermark {
    color: rgba(79, 70, 229, .28);
}

.listings-map-pin {
    position: absolute;
    transform: translate(-50%, -100%);
    appearance: none;
    border: 1px solid rgba(255,255,255,.34);
    border-radius: 999px;
    min-height: 34px;
    padding: 4px 10px 4px 5px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #fff;
    background: var(--primary-grad);
    box-shadow: 0 16px 36px rgba(76, 29, 149, .36), 0 0 0 4px rgba(139,92,246,.16);
    cursor: pointer;
    z-index: 2;
    transition: transform .15s ease, box-shadow .15s ease;
}

.listings-map-pin:hover {
    transform: translate(-50%, -105%) scale(1.04);
    z-index: 5;
    box-shadow: 0 20px 44px rgba(76, 29, 149, .46), 0 0 0 5px rgba(139,92,246,.22);
}

.listings-map-pin span {
    width: 23px;
    height: 23px;
    border-radius: 50%;
    background: rgba(255,255,255,.18);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.listings-map-pin b {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .78rem;
    font-weight: 1000;
}

.listings-map-hint {
    position: absolute;
    left: 24px;
    bottom: 22px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border-radius: 999px;
    color: #fff;
    background: rgba(15, 23, 42, .62);
    backdrop-filter: blur(12px);
    font-weight: 850;
    font-size: .84rem;
}

body.theme-light .listings-map-hint {
    color: var(--text-primary);
    background: rgba(255,255,255,.72);
}

.listings-map-list {
    padding: 12px;
    display: grid;
    gap: 10px;
    align-content: start;
    max-height: 544px;
    overflow: auto;
}

.listings-map-list-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 4px 2px 6px;
}

.listings-map-list-head b {
    font-size: 1rem;
    color: var(--text-primary);
}

.listings-map-list-head span {
    color: var(--text-muted);
    font-weight: 800;
    font-size: .82rem;
}

.listings-map-card {
    appearance: none;
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: rgba(139, 92, 246, .07);
    color: inherit;
    padding: 8px;
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 10px;
    text-align: left;
    cursor: pointer;
    transition: transform .15s ease, border-color .15s ease, background .15s ease;
}

.listings-map-card:hover {
    transform: translateY(-1px);
    border-color: rgba(139,92,246,.42);
    background: rgba(139,92,246,.12);
}

.listings-map-card-photo {
    width: 64px;
    height: 64px;
    border-radius: 14px;
    overflow: hidden;
    background: var(--primary-light);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.listings-map-card-photo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: rgba(0, 0, 0, 0.10);
}

.listings-map-card-main {
    min-width: 0;
    display: grid;
    align-content: center;
    gap: 3px;
}

.listings-map-card-main b,
.listings-map-card-main em,
.listings-map-card-main small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.listings-map-card-main b {
    color: var(--text-primary);
    font-size: .9rem;
}

.listings-map-card-main em {
    color: var(--primary);
    font-style: normal;
    font-weight: 1000;
}

.listings-map-card-main small {
    color: var(--text-muted);
    font-weight: 750;
}

.listings-map-empty {
    padding: 28px;
    min-height: 360px;
    display: grid;
    place-items: center;
    text-align: center;
    gap: 10px;
}

.listings-map-empty p {
    max-width: 620px;
    margin: 0 auto;
    color: var(--text-muted);
    line-height: 1.45;
}

@media (max-width: 980px) {
    .listings-map-view {
        grid-template-columns: 1fr;
    }

    .listings-map-panel {
        min-height: 420px;
    }

    .listings-map-bg {
        min-height: 396px;
    }

    .listings-map-list {
        max-height: none;
    }
}

@media (max-width: 720px) {
    .listings-layout-toggle {
        width: 100%;
    }

    .listings-layout-btn.map {
        min-width: 0;
    }

    .listings-map-panel {
        min-height: 360px;
        padding: 8px;
        border-radius: 20px;
    }

    .listings-map-bg {
        min-height: 344px;
        border-radius: 16px;
    }

    .listings-map-pin b {
        max-width: 88px;
    }

    .listings-map-hint {
        left: 14px;
        right: 14px;
        bottom: 14px;
        justify-content: center;
        border-radius: 16px;
    }
}


/* === Stage 28O: real interactive listings map (Leaflet + fallback) === */
.listings-leaflet-panel {
    padding: 12px;
    background: color-mix(in srgb, var(--bg-card) 78%, transparent);
}

.listings-leaflet-map {
    position: relative;
    width: 100%;
    min-height: 496px;
    height: 100%;
    overflow: hidden;
    border-radius: 20px;
    border: 1px solid rgba(139, 92, 246, 0.22);
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.94), rgba(30, 27, 75, 0.88));
}

.listings-map-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: rgba(255,255,255,.9);
    font-weight: 950;
    z-index: 1;
}

body.theme-light .listings-map-loading {
    color: var(--text-primary);
}

.listings-leaflet-map .leaflet-tile-pane {
    filter: saturate(.92) contrast(.98);
}

body:not(.theme-light) .listings-leaflet-map .leaflet-tile-pane {
    filter: saturate(.82) brightness(.74) contrast(1.05);
}

.listings-leaflet-map .leaflet-control-container a,
.listings-leaflet-map .leaflet-control-container .leaflet-control-attribution {
    color: #4338ca;
}

.listings-leaflet-map .leaflet-control-zoom a {
    color: var(--text-primary);
    background: color-mix(in srgb, var(--bg-card) 92%, transparent);
    border-color: var(--border);
}

.savechat-map-marker {
    appearance: none;
    min-height: 34px !important;
    width: auto !important;
    min-width: 78px;
    padding: 4px 10px 4px 5px;
    border: 1px solid rgba(255,255,255,.34);
    border-radius: 999px;
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    color: #fff;
    background: var(--primary-grad);
    box-shadow: 0 16px 36px rgba(76, 29, 149, .36), 0 0 0 4px rgba(139,92,246,.16);
    transform: translate(-50%, -100%);
    cursor: pointer;
    pointer-events: auto !important;
}

.savechat-map-marker span {
    width: 23px;
    height: 23px;
    border-radius: 50%;
    background: rgba(255,255,255,.18);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.savechat-map-marker b {
    max-width: 126px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .78rem;
    font-weight: 1000;
}

.listings-leaflet-map .leaflet-popup-content-wrapper,
.listings-leaflet-map .leaflet-popup-tip {
    background: color-mix(in srgb, var(--bg-card) 96%, transparent);
    color: var(--text-primary);
    border: 1px solid rgba(139, 92, 246, .22);
    box-shadow: 0 22px 54px rgba(15,23,42,.24);
}

.savechat-map-popup {
    width: 210px;
    display: grid;
    gap: 7px;
    font-family: inherit;
}

.savechat-map-popup img,
.savechat-map-popup-empty {
    width: 100%;
    height: 118px;
    border-radius: 14px;
    object-fit: cover;
    overflow: hidden;
    background: color-mix(in srgb, var(--primary) 14%, transparent);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.savechat-map-popup b,
.savechat-map-popup em,
.savechat-map-popup small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.savechat-map-popup b {
    color: var(--text-primary);
    font-size: .98rem;
    font-weight: 950;
}

.savechat-map-popup em {
    color: var(--primary);
    font-style: normal;
    font-weight: 1000;
}

.savechat-map-popup small {
    color: var(--text-muted);
    font-weight: 760;
}

.savechat-map-popup .btn.small {
    min-height: 34px;
    border-radius: 12px;
    padding: 7px 10px;
    font-size: .84rem;
}

@media (max-width: 980px) {
    .listings-leaflet-map {
        min-height: 396px;
    }
}

@media (max-width: 720px) {
    .listings-leaflet-panel {
        padding: 8px;
        border-radius: 20px;
    }

    .listings-leaflet-map {
        min-height: 344px;
        border-radius: 16px;
    }

    .savechat-map-marker {
        min-width: 54px;
        padding-right: 8px;
    }

    .savechat-map-marker b {
        max-width: 82px;
    }
}


/* === Stage 28P: manual global map point picker for listings === */
.listing-geo-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.listing-geo-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.listing-form-map-wrap {
    position: relative;
    display: grid;
    gap: 8px;
    padding: 8px;
    border: 1px solid rgba(139, 92, 246, .22);
    border-radius: 20px;
    background: rgba(139, 92, 246, .065);
}

.field.is-disabled .listing-form-map-wrap {
    display: none;
}

.listing-form-map {
    position: relative;
    min-height: 330px;
    width: 100%;
    overflow: hidden;
    border-radius: 16px;
    border: 1px solid rgba(139, 92, 246, .24);
    background: linear-gradient(135deg, rgba(15, 23, 42, .94), rgba(30, 27, 75, .88));
}

body.theme-light .listing-form-map {
    background: linear-gradient(135deg, #f8fafc, #eef2ff);
}

.listing-form-map .leaflet-tile-pane {
    filter: saturate(.92) contrast(.98);
}

body:not(.theme-light) .listing-form-map .leaflet-tile-pane {
    filter: saturate(.82) brightness(.74) contrast(1.05);
}

.listing-form-map .leaflet-control-container a,
.listing-form-map .leaflet-control-container .leaflet-control-attribution {
    color: #4338ca;
}

.listing-form-map .leaflet-control-zoom a {
    color: var(--text-primary);
    background: color-mix(in srgb, var(--bg-card) 92%, transparent);
    border-color: var(--border);
}

.listing-form-map-tip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--text-muted);
    font-weight: 820;
    font-size: .84rem;
    line-height: 1.35;
}

.savechat-map-picker-marker {
    width: 46px !important;
    height: 54px !important;
    display: grid !important;
    place-items: start center;
    background: transparent;
    border: 0;
}

.savechat-map-picker-marker span {
    width: 42px;
    height: 42px;
    border-radius: 50% 50% 50% 10px;
    transform: rotate(-45deg);
    display: grid;
    place-items: center;
    color: #fff;
    background: var(--primary-grad);
    border: 2px solid rgba(255,255,255,.78);
    box-shadow: 0 18px 36px rgba(76, 29, 149, .38), 0 0 0 6px rgba(139,92,246,.18);
    animation: savechat-map-picker-pulse 1.8s ease-in-out infinite;
}

.savechat-map-picker-marker span svg {
    transform: rotate(45deg);
    width: 18px;
    height: 18px;
}

@keyframes savechat-map-picker-pulse {
    0%, 100% { box-shadow: 0 18px 36px rgba(76, 29, 149, .38), 0 0 0 5px rgba(139,92,246,.16); }
    50% { box-shadow: 0 20px 42px rgba(76, 29, 149, .48), 0 0 0 10px rgba(139,92,246,.10); }
}

.listing-map-unavailable {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    text-align: center;
    color: var(--text-muted);
    font-weight: 850;
}

@media (max-width: 720px) {
    .listing-form-map {
        min-height: 260px;
        border-radius: 14px;
    }

    .listing-form-map-wrap {
        padding: 6px;
        border-radius: 16px;
    }

    .listing-geo-actions .btn {
        flex: 1 1 150px;
    }
}


/* === Stage 28Q: Avito-style map search area === */
.listings-map-topbar {
    position: absolute;
    z-index: 720;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    pointer-events: none;
}

.listings-map-topbar > div {
    pointer-events: auto;
}

.listings-map-topbar > div:first-child {
    max-width: min(460px, 64%);
    display: grid;
    gap: 3px;
    padding: 10px 13px;
    border: 1px solid rgba(139, 92, 246, .24);
    border-radius: 17px;
    color: var(--text-primary);
    background: color-mix(in srgb, var(--bg-card) 88%, transparent);
    box-shadow: 0 18px 44px rgba(15, 23, 42, .18);
    backdrop-filter: blur(16px);
}

.listings-map-topbar b {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: .92rem;
    font-weight: 1000;
}

.listings-map-topbar span {
    color: var(--text-muted);
    font-size: .8rem;
    font-weight: 800;
}

.listings-map-top-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.listings-map-search-area {
    box-shadow: 0 16px 42px var(--listings-map-area-shadow-start, rgba(124, 58, 237, .35));
    animation: listings-map-area-pulse 1.6s ease-in-out infinite;
}

.listings-map-search-area[hidden] {
    display: none !important;
}

@keyframes listings-map-area-pulse {
    0%, 100% { transform: translateY(0); box-shadow: 0 16px 42px var(--listings-map-area-shadow-start, rgba(124, 58, 237, .28)); }
    50% { transform: translateY(-1px); box-shadow: 0 20px 52px var(--listings-map-area-shadow-end, rgba(124, 58, 237, .42)); }
}

.listings-map-view.is-loading .listings-leaflet-map::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 650;
    background: linear-gradient(135deg, rgba(15, 23, 42, .12), rgba(124, 58, 237, .11));
    pointer-events: none;
}

.listings-map-list-body {
    display: grid;
    gap: 10px;
}

.listings-map-list-empty {
    min-height: 210px;
    padding: 22px 14px;
    border: 1px dashed rgba(139, 92, 246, .32);
    border-radius: 20px;
    display: grid;
    place-items: center;
    text-align: center;
    gap: 8px;
    color: var(--text-muted);
    background: rgba(139, 92, 246, .055);
}

.listings-map-list-empty b {
    color: var(--text-primary);
    font-size: .98rem;
}

.listings-map-list-empty span {
    max-width: 260px;
    line-height: 1.38;
    font-weight: 760;
    font-size: .86rem;
}

.listings-map-fallback-empty {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    color: rgba(255,255,255,.86);
    font-weight: 900;
}

body.theme-light .listings-map-fallback-empty {
    color: var(--text-primary);
}

@media (max-width: 720px) {
    .listings-map-topbar {
        top: 12px;
        left: 12px;
        right: 12px;
        display: grid;
        grid-template-columns: 1fr;
    }

    .listings-map-topbar > div:first-child {
        max-width: none;
        padding: 9px 11px;
    }

    .listings-map-top-actions {
        justify-content: stretch;
    }

    .listings-map-top-actions .btn {
        flex: 1 1 145px;
    }

    .listings-map-hint {
        font-size: .78rem;
    }
}

/* === Stage 28R: city autocomplete + automatic map point === */
.listing-city-field {
    position: relative;
    z-index: 6;
}

.listing-city-suggest-shell {
    position: relative;
    min-width: 0;
}

.listing-city-suggestions {
    position: absolute;
    z-index: 1200;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    display: grid;
    gap: 6px;
    max-height: 284px;
    overflow: auto;
    padding: 8px;
    border-radius: 18px;
    border: 1px solid rgba(139, 92, 246, .24);
    background: color-mix(in srgb, var(--bg-card) 96%, transparent);
    box-shadow: 0 24px 64px rgba(15, 23, 42, .28), 0 0 0 1px rgba(255,255,255,.06) inset;
    backdrop-filter: blur(18px);
}

.listing-city-suggestions[hidden] {
    display: none !important;
}

.listing-city-suggestion {
    appearance: none;
    width: 100%;
    border: 1px solid transparent;
    border-radius: 14px;
    background: transparent;
    color: var(--text-primary);
    padding: 8px;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 9px;
    align-items: center;
    text-align: left;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, transform .15s ease;
}

.listing-city-suggestion:hover,
.listing-city-suggestion.active {
    background: rgba(139, 92, 246, .12);
    border-color: rgba(139, 92, 246, .28);
    transform: translateY(-1px);
}

.listing-city-suggestion-pin {
    width: 34px;
    height: 34px;
    border-radius: 50% 50% 50% 10px;
    transform: rotate(-45deg);
    display: grid;
    place-items: center;
    color: #fff;
    background: var(--primary-grad);
    box-shadow: 0 10px 24px rgba(76, 29, 149, .28), 0 0 0 4px rgba(139,92,246,.12);
}

.listing-city-suggestion-pin svg {
    transform: rotate(45deg);
}

.listing-city-suggestion-main {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.listing-city-suggestion-main b,
.listing-city-suggestion-main small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.listing-city-suggestion-main b {
    color: var(--text-primary);
    font-weight: 950;
    font-size: .92rem;
}

.listing-city-suggestion-main small,
.listing-city-suggestion-empty {
    color: var(--text-muted);
    font-weight: 760;
    font-size: .8rem;
}

.listing-city-suggestion-empty {
    padding: 10px 12px;
    line-height: 1.35;
}

@media (max-width: 720px) {
    .listing-city-suggestions {
        max-height: 238px;
        border-radius: 16px;
    }

    .listing-city-suggestion {
        grid-template-columns: 32px minmax(0, 1fr);
        padding: 7px;
    }

    .listing-city-suggestion-pin {
        width: 32px;
        height: 32px;
    }
}

/* === Stage 28S: listings/admin moderation UX hotfix === */
.listings-toolbar .listings-filter-location-shell {
    min-width: 0;
    width: 100%;
}

.listings-toolbar .listings-filter-location-shell > .input {
    width: 100%;
}

.listings-advanced-filters {
    grid-template-columns: minmax(112px, 140px) minmax(112px, 1fr) minmax(112px, 1fr) minmax(150px, 1fr) minmax(150px, 1fr) minmax(150px, auto);
    align-items: end;
    overflow: visible;
}

.listings-check-pill {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    white-space: normal;
    line-height: 1.15;
    text-align: center;
}

.listings-check-pill span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.admin-listings-status-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px;
    border-radius: 20px;
    margin: 0 0 12px;
}

.admin-listings-status-tab {
    appearance: none;
    border: 1px solid rgba(139, 92, 246, .22);
    background: rgba(139, 92, 246, .08);
    color: var(--text-primary, var(--text));
    border-radius: 999px;
    min-height: 38px;
    padding: 7px 11px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 850;
    cursor: pointer;
    transition: transform .15s ease, background .15s ease, border-color .15s ease;
}

.admin-listings-status-tab:hover {
    transform: translateY(-1px);
    border-color: rgba(139, 92, 246, .45);
}

.admin-listings-status-tab.active {
    background: linear-gradient(135deg, rgba(124, 58, 237, .95), rgba(167, 139, 250, .82));
    border-color: rgba(167, 139, 250, .72);
    color: #fff;
    box-shadow: 0 12px 28px rgba(124, 58, 237, .28);
}

.admin-listings-status-tab b {
    min-width: 24px;
    height: 24px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 7px;
    background: rgba(255, 255, 255, .16);
    font-size: .78rem;
}

.admin-listing-preview-modal {
    position: fixed;
    inset: 0;
    z-index: 10070;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
}

.admin-listing-preview-modal.visible {
    display: flex;
}

.admin-listing-preview-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 12, 25, .66);
    backdrop-filter: blur(14px);
}

.admin-listing-preview-panel {
    position: relative;
    width: min(1040px, 100%);
    max-height: min(90vh, 820px);
    overflow: auto;
    border-radius: 28px;
    padding: 18px;
    border: 1px solid rgba(255,255,255,.14);
    background: rgba(24,24,37,.97);
    color: #fff;
    box-shadow: 0 28px 90px rgba(0,0,0,.46);
}

body.theme-light .admin-listing-preview-panel {
    background: rgba(255,255,255,.98);
    color: #111827;
    border-color: rgba(124,58,237,.18);
    box-shadow: 0 28px 90px rgba(31,41,55,.20);
}

.admin-listing-preview-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 999px;
    color: inherit;
    background: rgba(139,92,246,.16);
    cursor: pointer;
    font-size: 1.35rem;
    line-height: 1;
}

.admin-listing-preview-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 4px 46px 14px 4px;
}

.admin-listing-preview-head span {
    color: var(--text-secondary);
    font-weight: 800;
    font-size: .82rem;
}

.admin-listing-preview-head h3 {
    margin: 4px 0 0;
    font-size: 1.35rem;
    font-weight: 950;
}

.admin-listing-preview-layout {
    display: grid;
    grid-template-columns: minmax(260px, 430px) minmax(0, 1fr);
    gap: 18px;
}

.admin-listing-preview-main {
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: 22px;
    overflow: hidden;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-weight: 850;
}

.admin-listing-preview-main img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.admin-listing-preview-thumbs {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
    margin-top: 8px;
}

.admin-listing-preview-thumbs img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid rgba(139,92,246,.18);
}

.admin-listing-preview-info {
    display: grid;
    gap: 12px;
    align-content: start;
}

.admin-listing-preview-price {
    font-size: 1.45rem;
    font-weight: 950;
    color: var(--primary);
}

.admin-listing-preview-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.admin-listing-preview-meta span {
    border: 1px solid rgba(139,92,246,.16);
    background: rgba(139,92,246,.08);
    border-radius: 999px;
    padding: 7px 10px;
    font-weight: 750;
    color: var(--text-secondary);
    font-size: .82rem;
}

.admin-listing-preview-desc {
    border: 1px solid rgba(139,92,246,.15);
    background: rgba(139,92,246,.06);
    border-radius: 18px;
    padding: 12px;
}

.admin-listing-preview-desc b {
    display: block;
    margin-bottom: 6px;
}

.admin-listing-preview-desc p {
    margin: 0;
    line-height: 1.5;
    white-space: pre-wrap;
    color: var(--text-secondary);
}

.admin-listing-preview-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
    padding-top: 16px;
}

@media (max-width: 1100px) {
    .listings-advanced-filters {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 820px) {
    .listings-advanced-filters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .listings-check-pill,
    .listings-advanced-filters .listings-filter-select {
        grid-column: auto;
        width: 100%;
    }
    .admin-listing-preview-layout {
        grid-template-columns: 1fr;
    }
    .admin-listing-preview-panel {
        padding: 14px;
        border-radius: 22px;
    }
}

@media (max-width: 560px) {
    .listings-advanced-filters {
        grid-template-columns: 1fr;
    }
    .listings-check-pill,
    .listings-advanced-filters .listings-filter-select,
    .listings-radius-field {
        grid-column: 1 / -1;
    }
    .admin-listings-status-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        scrollbar-width: none;
    }
    .admin-listings-status-tab {
        flex: 0 0 auto;
    }
}

/* Stage 28T — admin listing preview hint */
.admin-listing-preview-hint {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid rgba(139, 92, 246, 0.24);
    background: rgba(139, 92, 246, 0.08);
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.25;
}


/* Stage 28Z — multi-photo picker and no-crop thumbnails */
.listing-new-media-remove {
    position: absolute;
    top: 7px;
    right: 7px;
    width: 26px;
    height: 26px;
    border: 0;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.72);
    color: #fff;
    font-size: 18px;
    font-weight: 900;
    cursor: pointer;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
}

.listing-new-media-remove:hover {
    background: var(--primary);
    transform: translateY(-1px);
}

.listing-cover-preview small {
    max-width: min(460px, 92%);
    text-align: center;
    line-height: 1.35;
}

.listing-card-cover,
.listing-details-media-wrap,
.listing-detail-main-image,
.listings-map-card-photo {
    background-color: rgba(15, 23, 42, 0.24);
}

/* ===== Stage 28Z.1: listing card thumbnail fill fix =====
   В карточке объявления миниатюра должна выглядеть как карточка маркетплейса,
   а не становиться маленькой по центру. Полное фото без обрезки остаётся
   в детальной карточке и fullscreen viewer. */
.listing-card-cover {
    background: linear-gradient(135deg, rgba(99, 102, 241, .22), rgba(139, 92, 246, .14)) !important;
}

.listing-card-cover > img {
    width: 100% !important;
    height: 100% !important;
    min-width: 100% !important;
    min-height: 100% !important;
    object-fit: cover !important;
    object-position: center center !important;
    display: block !important;
    background: rgba(15, 23, 42, .28) !important;
}

/* В компактном виде фото особенно не должно сжиматься в маленькую картинку. */
.listings-grid.is-compact .listing-card-cover > img {
    object-fit: cover !important;
    object-position: center center !important;
}

/* Внутри полной карточки, модалки и просмотра фото оставляем contain — там важно видеть всё изображение целиком. */
.listing-details-main-photo img,
.listing-detail-main-image,
.listing-photo-viewer-panel img,
.listing-details-media > img {
    object-fit: contain !important;
}

/* ===== Stage 28Z.2: listing thumbnails without crop + filled visual background =====
   В карточке показываем фото целиком без обрезки, но фон заполняем размытой
   копией изображения, чтобы карточка не выглядела пустой/мелкой. */
.listing-card-cover.has-image-bg {
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    isolation: isolate !important;
    background: linear-gradient(135deg, rgba(99, 102, 241, .22), rgba(139, 92, 246, .14)) !important;
}

.listing-card-cover.has-image-bg .listing-card-cover-bg {
    position: absolute;
    inset: -14px;
    z-index: 0;
    pointer-events: none;
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
    filter: blur(16px) saturate(1.15);
    opacity: .38;
    transform: scale(1.06);
}

.listing-card-cover.has-image-bg::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(7, 10, 20, .10), rgba(7, 10, 20, .28));
}

.listing-card-cover.has-image-bg > img {
    position: relative !important;
    z-index: 1 !important;
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    object-fit: contain !important;
    object-position: center center !important;
    box-sizing: border-box !important;
    padding: 8px !important;
    background: transparent !important;
}

.listings-grid.is-compact .listing-card-cover.has-image-bg > img {
    object-fit: contain !important;
    padding: 6px !important;
}

.listing-card-cover.has-image-bg .listing-category-badge,
.listing-card-cover.has-image-bg .listing-photo-count-badge,
.listing-card-cover.has-image-bg .listing-status-badge {
    z-index: 3 !important;
}

@media (max-width: 920px) {
    .listing-card-cover.has-image-bg > img {
        padding: 6px !important;
    }
}

/* ===== Stage 28Z.3: listing thumbnail true contain sizing + mobile card fix =====
   Предыдущий no-crop режим оставлял foreground image обычным flex-элементом,
   из-за чего на некоторых соотношениях сторон он мог визуально сжиматься.
   Теперь foreground фото абсолютно растягивается в доступную область через contain,
   а на мобильном compact/list view больше не делает узкую левую колонку. */
.listing-card-cover.has-image-bg {
    position: relative !important;
    overflow: hidden !important;
    min-height: 168px;
}

.listing-card-cover.has-image-bg > img {
    position: absolute !important;
    z-index: 2 !important;
    inset: 8px !important;
    width: calc(100% - 16px) !important;
    height: calc(100% - 16px) !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: none !important;
    max-height: none !important;
    object-fit: contain !important;
    object-position: center center !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
}

.listings-grid.is-compact .listing-card-cover.has-image-bg > img {
    inset: 10px !important;
    width: calc(100% - 20px) !important;
    height: calc(100% - 20px) !important;
    object-fit: contain !important;
}

/* В обычной плитке даём фото достаточно высоты, чтобы портретные изображения
   не превращались в маленький значок. */
.listings-grid:not(.is-compact) .listing-card-cover.has-image-bg {
    aspect-ratio: 1 / 1 !important;
}

/* В компактном desktop-режиме оставляем широкую левую зону, но фото занимает
   всю доступную высоту без обрезки. */
.listings-grid.is-compact .listing-card-cover.has-image-bg {
    min-height: 240px !important;
}

/* На телефоне compact/list view не должен быть узкой левой колонкой — это и
   давало мелкую картинку. Делаем карточку вертикальной, как нормальная карточка маркетплейса. */
@media (max-width: 720px) {
    .listings-grid.is-compact .listing-card {
        display: flex !important;
        flex-direction: column !important;
        min-height: 0 !important;
    }

    .listings-grid.is-compact .listing-card-cover,
    .listings-grid.is-compact .listing-card-cover.has-image-bg {
        width: 100% !important;
        min-height: 220px !important;
        height: auto !important;
        aspect-ratio: 1 / 1 !important;
    }

    .listings-grid.is-compact .listing-card-body {
        width: 100% !important;
    }
}

@media (max-width: 430px) {
    .listing-card-cover.has-image-bg,
    .listings-grid.is-compact .listing-card-cover.has-image-bg {
        min-height: 230px !important;
        aspect-ratio: 1 / 1 !important;
    }

    .listing-card-cover.has-image-bg > img,
    .listings-grid.is-compact .listing-card-cover.has-image-bg > img {
        inset: 6px !important;
        width: calc(100% - 12px) !important;
        height: calc(100% - 12px) !important;
    }
}

/* ===== Stage 28Z.4: natural full-photo thumbnails, no crop/no tiny center =====
   В карточках объявлений показываем именно всю загруженную фотографию.
   Контейнер больше не заставляет фото вписываться в фиксированный высокий блок —
   высота берётся от самой картинки, поэтому нет обрезки и нет маленькой картинки по центру. */
.listing-card-cover.has-image-bg,
.listings-grid.is-compact .listing-card-cover.has-image-bg {
    position: relative !important;
    display: block !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    aspect-ratio: auto !important;
    overflow: hidden !important;
    background: rgba(15, 23, 42, 0.72) !important;
    align-self: start !important;
}

.listing-card-cover.has-image-bg .listing-card-cover-bg {
    display: none !important;
}

.listing-card-cover.has-image-bg::after {
    display: none !important;
}

.listing-card-cover.has-image-bg > img,
.listings-grid.is-compact .listing-card-cover.has-image-bg > img {
    position: relative !important;
    inset: auto !important;
    z-index: 1 !important;
    display: block !important;
    width: 100% !important;
    height: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: 100% !important;
    max-height: none !important;
    object-fit: contain !important;
    object-position: center center !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
}

/* Плитка: карточка остаётся аккуратной, фото занимает всю ширину и показывает весь файл. */
.listings-grid:not(.is-compact) .listing-card-cover.has-image-bg {
    aspect-ratio: auto !important;
}

/* Компактный режим: убираем принудительную высоту левой зоны, из-за неё фото выглядело
   как маленькая вставка и казалось обрезанным. */
.listings-grid.is-compact .listing-card {
    align-items: start !important;
}

.listings-grid.is-compact .listing-card-cover,
.listings-grid.is-compact .listing-card-cover.has-image-bg {
    min-height: 0 !important;
    height: auto !important;
}

/* Если объявления без фото — для пустой заглушки сохраняем нормальную высоту. */
.listing-card-cover:not(.has-image-bg) {
    min-height: 180px;
    aspect-ratio: 1.15 / 1;
}

@media (max-width: 720px) {
    .listings-grid.is-compact .listing-card {
        display: flex !important;
        flex-direction: column !important;
    }

    .listing-card-cover.has-image-bg,
    .listings-grid.is-compact .listing-card-cover.has-image-bg {
        min-height: 0 !important;
        aspect-ratio: auto !important;
    }

    .listing-card-cover.has-image-bg > img,
    .listings-grid.is-compact .listing-card-cover.has-image-bg > img {
        width: 100% !important;
        height: auto !important;
    }
}

/* ===== Stage 28Z.5: desktop compact photo vertical centering =====
   28Z.4 сделал фото естественной высоты, что отлично смотрится на телефоне,
   но в desktop compact/list режиме медиа-блок прижимался к верху высокой карточки.
   На ПК центрируем фото-блок по вертикали, не возвращая crop и не ломая mobile. */
@media (min-width: 721px) {
    .listings-grid.is-compact .listing-card {
        align-items: center !important;
    }

    .listings-grid.is-compact .listing-card-cover.has-image-bg {
        align-self: center !important;
        margin-top: auto !important;
        margin-bottom: auto !important;
    }

    .listings-grid.is-compact .listing-card-cover.has-image-bg > img {
        display: block !important;
        width: 100% !important;
        height: auto !important;
        object-fit: contain !important;
    }

    .listings-grid.is-compact .listing-card-body {
        align-self: center !important;
    }
}

/* ===== Stage 28Z.6: listing detail full-photo fix =====
   В полной карточке объявления убираем фиксированную высокую рамку, из-за которой
   вертикальные/нестандартные фото визуально резались сверху/снизу. Фото теперь
   само задаёт высоту блока и показывается целиком. Карточки списка не трогаем. */
.listing-detail-main-image {
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    overflow: hidden !important;
}

.listing-detail-main-image button {
    min-height: 0 !important;
    height: auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.listing-detail-main-image img {
    position: relative !important;
    display: block !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-width: 100% !important;
    max-height: none !important;
    object-fit: contain !important;
    object-position: center center !important;
    background: rgba(0, 0, 0, 0.18) !important;
}

/* Старое модальное окно предпросмотра объявления тоже не должно резать фото. */
.listing-details-media-wrap,
.listing-details-main-photo,
.listing-details-main-photo img,
.listing-details-media > img {
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
}

.listing-details-main-photo {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.listing-details-main-photo img,
.listing-details-media > img {
    width: 100% !important;
    height: auto !important;
    object-fit: contain !important;
    object-position: center center !important;
}

/* Пустая карточка без фото сохраняет нормальную высоту, чтобы экран не схлопывался. */
.listing-detail-main-empty,
.listing-detail-skeleton-photo {
    min-height: 360px !important;
}

@media (max-width: 700px) {
    .listing-detail-main-image,
    .listing-detail-main-image button,
    .listing-detail-main-image img {
        min-height: 0 !important;
        max-height: none !important;
    }

    .listing-detail-main-empty,
    .listing-detail-skeleton-photo {
        min-height: 260px !important;
    }
}

/* Stage 29A — listing → deal modal */
.listing-deal-modal {
    position: fixed;
    inset: 0;
    z-index: 12000;
    display: grid;
    place-items: center;
    padding: 18px;
}

.listing-deal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(4, 6, 18, 0.72);
    backdrop-filter: blur(10px);
}

.listing-deal-panel {
    position: relative;
    width: min(560px, calc(100vw - 22px));
    max-height: calc(100vh - 28px);
    overflow: auto;
    border-radius: 26px;
    padding: 22px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.42), 0 0 0 1px rgba(167, 139, 250, 0.14) inset;
}

.listing-deal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 38px;
    height: 38px;
    border-radius: 14px;
    border: 1px solid rgba(167, 139, 250, 0.2);
    background: rgba(15, 23, 42, 0.74);
    color: var(--text);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.listing-deal-head {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding-right: 34px;
    margin-bottom: 16px;
}

.listing-deal-head h3 {
    margin: 0 0 4px;
    font-size: 1.28rem;
}

.listing-deal-head p {
    margin: 0;
    color: var(--text-muted);
    line-height: 1.35;
    font-size: 0.92rem;
}

.listing-deal-icon {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    color: #fff;
    background: linear-gradient(135deg, #7c3aed, #a78bfa);
    box-shadow: 0 12px 32px rgba(124, 58, 237, 0.36);
}

.listing-deal-summary {
    display: grid;
    grid-template-columns: 82px 1fr;
    gap: 14px;
    align-items: center;
    padding: 12px;
    margin-bottom: 16px;
    border-radius: 20px;
    background: rgba(15, 23, 42, 0.48);
    border: 1px solid rgba(167, 139, 250, 0.16);
}

.listing-deal-photo {
    width: 82px;
    height: 82px;
    border-radius: 18px;
    overflow: hidden;
    display: grid;
    place-items: center;
    background: rgba(10, 15, 32, 0.86);
    color: var(--primary);
}

.listing-deal-photo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.listing-deal-summary b {
    display: block;
    margin-bottom: 5px;
    color: var(--text);
}

.listing-deal-summary small {
    display: block;
    color: var(--text-muted);
    line-height: 1.35;
}

.listing-deal-form .form-group {
    margin-bottom: 14px;
}

.listing-deal-warning {
    margin: 10px 0 16px;
    padding: 12px 14px;
    border-radius: 16px;
    color: #d8ccff;
    background: rgba(124, 58, 237, 0.12);
    border: 1px solid rgba(167, 139, 250, 0.18);
    font-size: 0.9rem;
    line-height: 1.35;
}

.listing-deal-actions {
    display: grid;
    grid-template-columns: 1fr 1.35fr;
    gap: 10px;
}

.btn.guarant:not(.disabled) {
    cursor: pointer;
    color: #fff;
    background: linear-gradient(135deg, #7c3aed, #a78bfa);
    border-color: rgba(167, 139, 250, 0.46);
    box-shadow: 0 12px 28px rgba(124, 58, 237, 0.22);
}

.btn.guarant:not(.disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 34px rgba(124, 58, 237, 0.28);
}

@media (max-width: 640px) {
    .listing-deal-modal {
        align-items: end;
        padding: 10px;
    }
    .listing-deal-panel {
        width: 100%;
        border-radius: 24px 24px 18px 18px;
        padding: 18px;
    }
    .listing-deal-summary {
        grid-template-columns: 66px 1fr;
    }
    .listing-deal-photo {
        width: 66px;
        height: 66px;
        border-radius: 16px;
    }
    .listing-deal-actions {
        grid-template-columns: 1fr;
    }
}


/* Stage 29C.1 — fixed-price listing deal amount is calculated, not typed */
.listing-deal-auto-amount {
    margin-bottom: 14px;
}

.listing-deal-amount-card {
    display: grid;
    gap: 6px;
    padding: 14px 16px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.16), rgba(167, 139, 250, 0.08));
    border: 1px solid rgba(167, 139, 250, 0.24);
    box-shadow: 0 14px 32px rgba(124, 58, 237, 0.12);
}

.listing-deal-amount-card b {
    color: var(--text);
    font-size: 1.2rem;
    line-height: 1.2;
}

.listing-deal-amount-card small {
    color: var(--text-muted);
    line-height: 1.35;
}

.listing-deal-amount-kicker {
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.listing-deal-amount-card.is-loading small {
    color: #d8ccff;
}

.listing-deal-amount-card.is-ready small {
    color: #c4b5fd;
    font-size: 1.05rem;
    font-weight: 800;
}

.listing-deal-amount-card.is-error {
    border-color: rgba(239, 68, 68, 0.36);
    background: rgba(239, 68, 68, 0.1);
}

.listing-deal-amount-card.is-error small {
    color: #fecaca;
}

/* Light theme: the deal window sits in <body>, outside .listings-page; its
   inner blocks kept the dark-surface colours (text 1.15–1.28:1). */
body.theme-light .listing-deal-summary {
    background: rgba(248, 250, 252, 0.94);
    border-color: rgba(79, 70, 229, 0.14);
}

body.theme-light .listing-deal-photo {
    background: rgba(241, 245, 249, 0.96);
}

body.theme-light .listing-deal-warning {
    color: #4c1d95;
    background: rgba(124, 58, 237, 0.08);
    border-color: rgba(124, 58, 237, 0.2);
}

body.theme-light .listing-deal-amount-card.is-loading small,
body.theme-light .listing-deal-amount-card.is-ready small {
    color: #5b21b6;
}

body.theme-light .listing-deal-amount-card.is-error small {
    color: #b91c1c;
}

/* Stage 30A — i18n language switcher */
/* Language selection now belongs to the account dropdown. */
.language-select {
    min-width: 48px;
    border: 0;
    outline: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    appearance: none;
    padding: 0 14px 0 0;
    background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
    background-position: calc(100% - 8px) 50%, calc(100% - 4px) 50%;
    background-size: 4px 4px, 4px 4px;
    background-repeat: no-repeat;
}

.language-select option {
    color: #111827;
    background: #fff;
}

#user-dropdown .dropdown-language .language-select {
    width: auto;
    min-width: 96px;
    max-width: 100%;
    min-height: 36px;
    margin-left: auto;
    padding: 4px 18px 4px 8px;
    font-size: max(16px, 1rem) !important;
    font-weight: 500;
    color: var(--text) !important;
    border-radius: var(--radius-sm, 6px);
}
#user-dropdown .dropdown-language .language-select:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
#user-dropdown .dropdown-language { flex-wrap: wrap; }
#user-dropdown #desktop-menu-link[aria-current="page"] {
    color: var(--primary) !important;
    background: var(--primary-light);
}
#user-dropdown .dropdown-language > svg { flex: 0 0 18px; }
#user-dropdown .dropdown-item:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -3px;
    background: var(--bg-hover);
}

/* Arabic uses RTL text only. The app shell stays LTR, so sidebars/header do not jump. */
html[data-text-dir="rtl"] [data-i18n],
html[data-text-dir="rtl"] [data-i18n-html],
html[data-text-dir="rtl"] [data-i18n-value] {
    unicode-bidi: plaintext;
}

html[data-text-dir="rtl"] input[data-i18n-placeholder],
html[data-text-dir="rtl"] textarea[data-i18n-placeholder] {
    text-align: start;
    unicode-bidi: plaintext;
}

/* Stage 30Q — profile wall + global feed */
.feed-page {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.feed-toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 0;
}

.feed-toolbar .feed-my-wall-btn {
    min-height: 44px;
    padding-inline: 14px;
}

.feed-toolbar .feed-create-toggle {
    min-height: 44px;
    padding-inline: 14px;
}

.feed-create-panel {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg, 18px);
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
}

.feed-create-panel[hidden],
.feed-publish-result[hidden],
.feed-post-text > [data-feed-caption-preview][hidden],
.feed-post-text > [data-feed-caption-full][hidden] {
    display: none;
}

.feed-create-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.feed-create-close {
    min-height: 44px;
    min-width: 44px;
}

.feed-create-body {
    min-width: 0;
}

.feed-create-body .feed-composer {
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
    background: transparent;
}

.feed-publish-result {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 12px;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius, 10px);
    color: var(--text-secondary);
    background: var(--bg-secondary);
    font-size: 13px;
    line-height: 1.5;
}

.feed-publish-result a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    color: var(--primary-text, var(--primary));
    text-decoration: underline;
    text-underline-offset: 3px;
}

.feed-caption-toggle {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    margin-top: 2px;
    padding: 0 4px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    font-size: 13px;
    font-weight: 650;
    cursor: pointer;
}

.feed-caption-toggle:hover,
.feed-caption-toggle:focus-visible {
    color: var(--primary-text, var(--primary));
    background: var(--bg-hover);
}

.feed-caption-toggle:focus-visible,
.feed-publish-result a:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.feed-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 24px;
    border-radius: var(--radius-lg, 24px);
}
.feed-hero h1 { margin: 4px 0 8px; font-size: clamp(26px, 4vw, 42px); }
.feed-hero p { margin: 0; color: var(--text-secondary, #9ca3af); max-width: 760px; }
.feed-kicker { color: var(--primary, #7c3aed); font-weight: 800; letter-spacing: .08em; text-transform: uppercase; font-size: 12px; }

.feed-composer,
.feed-post,
.feed-empty {
    padding: 18px;
    border-radius: var(--radius-lg, 22px);
}
.feed-composer-head,
.feed-section-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 12px;
    margin-bottom: 12px;
}
.feed-composer-head span,
.feed-section-head span { color: var(--text-secondary, #9ca3af); font-size: 13px; }
.feed-composer textarea { width: 100%; resize: vertical; }
.feed-policy-box {
    display: grid;
    gap: 3px;
    margin-top: 10px;
    padding: 10px 12px;
    border: 1px solid rgba(139, 92, 246, .25);
    border-radius: 14px;
    background: rgba(139, 92, 246, .08);
    color: var(--text-secondary, #9ca3af);
    font-size: 13px;
}
.feed-policy-box b { color: var(--text-primary, #fff); }
.feed-composer-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
}
.feed-composer-actions small { color: var(--text-secondary, #9ca3af); }
.feed-list-wrap { display: grid; gap: 12px; }
/* Owner 2026-10-19 (Twitter): «Для вас» / «Подписки» on top of the feed,
   two equal halves, the open tab underlined. Not sticky: .main-content (and on
   phones body/#app/.page-content) set overflow-x: hidden, which makes them the
   sticky containers without scrolling them. */
.feed-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin-bottom: 12px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--bg-card);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    overflow: hidden;
}
/* Package 168: a second tap on the open tab scrolls the feed page into view
   (selectFeedTab). The margin is the fixed desktop menu (0 on phones) plus the
   page's own top gap, so the tap returns to the very top: the menu no longer
   covers the tabs, and a phone does not scroll up to call its header over them. */
.feed-page { scroll-margin-top: calc(var(--app-menu-bar-h, 0px) + 32px); }
.feed-tab {
    position: relative;
    min-height: 52px;
    padding: 0 12px;
    border: 0;
    color: var(--text-muted);
    background: transparent;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}
.feed-tab:hover,
.feed-tab:focus-visible {
    background: var(--bg-hover);
}
.feed-tab:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}
.feed-tab[aria-selected="true"] {
    color: var(--text);
    font-weight: 800;
}
.feed-tab[aria-selected="true"]::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 0;
    width: 56px;
    height: 4px;
    border-radius: 999px;
    background: var(--primary);
    transform: translateX(-50%);
}
.feed-list { display: grid; gap: 14px; }
.feed-loading { padding: 24px; text-align: center; color: var(--text-secondary, #9ca3af); }
.feed-empty { text-align: center; display: grid; gap: 6px; color: var(--text-secondary, #9ca3af); }
.feed-empty b { color: var(--text-primary, #fff); }

.feed-post { display: grid; gap: 14px; }
.feed-post.status-pending { border-color: rgba(245, 158, 11, .35); }
.feed-post.status-rejected { border-color: rgba(239, 68, 68, .35); }
.feed-post-head,
.feed-post-head-actions,
.feed-author,
.feed-actions,
.feed-comment-head {
    display: flex;
    align-items: center;
    gap: 10px;
}
.feed-post-head { justify-content: space-between; }
.feed-author { color: inherit; text-decoration: none; min-width: 0; }
.feed-author span { display: grid; min-width: 0; }
.feed-author small,
.feed-comment-head span { color: var(--text-secondary, #9ca3af); font-size: 12px; }
.feed-avatar {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, rgba(124,58,237,.9), rgba(59,130,246,.75));
    color: #fff;
    font-weight: 800;
    background-size: cover;
    background-position: center;
}
.feed-post-text { white-space: normal; line-height: 1.55; word-break: break-word; }
.feed-status-badge,
.feed-flags em {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 12px;
    font-weight: 700;
}
.feed-status-badge.success { background: rgba(16,185,129,.13); color: #10b981; }
.feed-status-badge.warning { background: rgba(245,158,11,.13); color: #f59e0b; }
.feed-status-badge.danger { background: rgba(239,68,68,.13); color: #ef4444; }
.feed-status-badge.secondary { background: rgba(148,163,184,.13); color: #94a3b8; }
.feed-icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    border: 1px solid var(--border, rgba(255,255,255,.12));
    background: transparent;
    color: var(--text-secondary, #9ca3af);
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
}
.feed-icon-btn:hover { color: var(--danger, #ef4444); }
.feed-actions { border-top: 1px solid var(--border, rgba(255,255,255,.1)); padding-top: 10px; }
.feed-action {
    border: 0;
    background: rgba(255,255,255,.06);
    color: var(--text-secondary, #9ca3af);
    border-radius: 999px;
    padding: 8px 12px;
    cursor: pointer;
}
.feed-action.active { color: var(--primary, #8b5cf6); background: rgba(139,92,246,.14); }
.feed-action:disabled { opacity: .45; cursor: not-allowed; }
.feed-action.ghost { margin-left: auto; background: transparent; }

.feed-moderation-note {
    display: grid;
    gap: 5px;
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(245, 158, 11, .1);
    color: var(--text-secondary, #9ca3af);
    font-size: 13px;
}
.feed-moderation-note.rejected { background: rgba(239, 68, 68, .1); }
.feed-moderation-note b { color: var(--text-primary, #fff); }
.feed-flags { display: flex; flex-wrap: wrap; gap: 6px; }
.feed-flags em { background: rgba(255,255,255,.08); font-style: normal; }

.feed-comments { display: grid; gap: 10px; }
.feed-comments-heading { display: flex; align-items: baseline; gap: 8px; }
.feed-comments-heading span { color: var(--text-muted); font-size: 12px; }
.feed-comment { display: flex; align-items: flex-start; gap: 10px; padding: 10px; border-radius: 16px; background: rgba(255,255,255,.04); }
.feed-comment .feed-avatar { width: 30px; height: 30px; flex-basis: 30px; font-size: 12px; }
.feed-comment-body { min-width: 0; flex: 1; }
.feed-comment-head { justify-content: space-between; }
.feed-comment-text { font-size: 14px; line-height: 1.45; word-break: break-word; }
.feed-comment-form { display: flex; gap: 8px; }
.feed-comment-form input { flex: 1; }

.admin-feed-list { display: grid; gap: 14px; }
.admin-feed-card {
    padding: 16px;
    border: 1px solid var(--border, rgba(255,255,255,.12));
    border-radius: 18px;
    background: rgba(255,255,255,.04);
}
.admin-feed-card p { white-space: pre-wrap; word-break: break-word; margin: 10px 0; }
.admin-feed-author { color: var(--text-secondary, #9ca3af); font-size: 13px; margin-top: 8px; }

@media (max-width: 720px) {
    .feed-hero,
    .feed-composer-head,
    .feed-section-head,
    .feed-post-head,
    .feed-composer-actions { align-items: stretch; flex-direction: column; }
    .feed-action.ghost { margin-left: 0; }
    .feed-comment-form { flex-direction: column; }
}

/* Stage 30Q.2 — trusted global wall access UI */
.feed-composer.is-locked {
    border: 1px solid rgba(245, 158, 11, 0.25);
}
.feed-progress {
    display: grid;
    gap: 8px;
    margin: 12px 0;
}
.feed-progress-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--text-secondary, #9ca3af);
    font-size: .92rem;
}
.feed-progress-row b { color: var(--text-primary, #f8fafc); }
.feed-progress-track {
    height: 9px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(148, 163, 184, 0.18);
    border: 1px solid rgba(148, 163, 184, 0.14);
}
.feed-progress-track i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--primary, #8b5cf6), var(--accent, #22d3ee));
}
.feed-trusted-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius, 12px);
    background: rgba(16, 185, 129, 0.10);
    border: 1px solid rgba(16, 185, 129, 0.22);
    color: var(--text-secondary, #9ca3af);
}
.feed-trusted-card b { color: var(--success, #10b981); }
.feed-trust-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 9px;
    border-radius: 999px;
    background: rgba(139, 92, 246, 0.13);
    border: 1px solid rgba(139, 92, 246, 0.24);
    color: var(--primary-text);
    font-size: .78rem;
    white-space: nowrap;
}
@media (max-width: 640px) {
    .feed-trusted-card,
    .feed-progress-row { align-items: flex-start; flex-direction: column; }
    .feed-post-head-actions { align-items: flex-end; flex-wrap: wrap; }
}

/* Stage 30Q.3 — VK-like calm wall/feed layout */
.vk-feed-page {
    max-width: 780px;
    margin: 0 auto;
}
.vk-feed-header {
    padding: 14px 16px;
    border-radius: 18px;
    align-items: center;
    background: rgba(255, 255, 255, 0.045);
    border: 1px solid var(--border, rgba(255,255,255,.10));
    box-shadow: none;
}
.vk-feed-header h1 {
    margin: 0 0 3px;
    font-size: 22px;
    line-height: 1.2;
}
.vk-feed-header p {
    margin: 0;
    font-size: 13px;
    line-height: 1.45;
    color: var(--text-secondary, #9ca3af);
}
.vk-feed-wrap,
.vk-profile-wall {
    max-width: 760px;
    width: 100%;
}
.vk-profile-wall {
    margin: 0 auto;
}
.vk-feed-composer,
.vk-feed-card,
.feed-empty {
    border-radius: 18px;
    border: 1px solid var(--border, rgba(255,255,255,.10));
    background: rgba(255,255,255,.045);
    box-shadow: none;
}
.vk-feed-composer {
    padding: 14px;
}
.feed-composer-head.compact {
    margin-bottom: 10px;
    align-items: center;
}
.feed-composer-head.compact b {
    font-size: 15px;
}
.feed-composer-head.compact span {
    font-size: 12px;
    max-width: 420px;
    text-align: right;
}
.vk-feed-composer textarea {
    min-height: 82px;
    border-radius: 14px;
}
.vk-feed-card {
    padding: 14px 16px;
    gap: 12px;
}
.vk-feed-card .feed-post-head {
    padding-bottom: 2px;
}
.vk-feed-card .feed-author b {
    font-size: 14px;
}
.vk-feed-card .feed-post-text {
    font-size: 15px;
    line-height: 1.55;
}
.vk-feed-card .feed-actions {
    justify-content: flex-start;
    gap: 8px;
    border-top: 1px solid var(--border, rgba(255,255,255,.08));
    padding-top: 10px;
}
.vk-feed-card .feed-action {
    background: transparent;
    border: 0;
    padding: 6px 8px;
    color: var(--text-secondary, #9ca3af);
}
.vk-feed-card .feed-action:hover,
.vk-feed-card .feed-action.active {
    background: rgba(139,92,246,.10);
    color: var(--primary-text);
}
.vk-feed-card .feed-action.ghost {
    margin-left: auto;
}
/* Owner 2026-10-19 (0055): reposts and quotes — the banner over a plain
   repost, the preview of the original under a quote and the repost menu. */
.feed-repost-wrap { display: grid; gap: 6px; min-width: 0; }
.feed-repost-banner { display: flex; align-items: center; gap: 6px; padding: 0 6px; color: var(--text-secondary); font-size: 13px; font-weight: 600; }
.feed-repost-banner a { color: inherit; text-decoration: none; overflow-wrap: anywhere; }
.feed-repost-banner a:is(:hover, :focus-visible) { text-decoration: underline; }
.feed-repost-unavailable { display: grid; gap: 8px; padding: 14px 16px; }
.feed-repost-missing { margin: 0; color: var(--text-secondary); font-size: 14px; }
.feed-quote-embed { display: grid; gap: 6px; margin: 10px 0 4px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--bg-secondary); color: var(--text); text-decoration: none; min-width: 0; }
.feed-quote-embed:is(:hover, :focus-visible) { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); }
.feed-quote-embed.is-unavailable { color: var(--text-secondary); font-size: 14px; }
.feed-quote-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.feed-quote-head .feed-avatar { width: 24px; height: 24px; flex: 0 0 24px; }
.feed-quote-head b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-quote-head small { flex-shrink: 0; color: var(--text-secondary); }
.feed-quote-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.45; }
.feed-quote-media { display: inline-flex; align-items: center; gap: 6px; color: var(--text-secondary); font-size: 13px; }
.feed-repost-menu { position: fixed; z-index: 10020; display: grid; min-width: 200px; padding: 6px; border: 1px solid var(--border); border-radius: 14px; background: var(--bg-secondary); box-shadow: 0 18px 40px rgba(0, 0, 0, .28); }
.feed-repost-menu button { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 12px; border: 0; border-radius: 10px; background: transparent; color: var(--text); font-size: 14px; font-weight: 600; text-align: start; cursor: pointer; }
.feed-repost-menu button:is(:hover, :focus-visible) { background: var(--bg-hover); outline: none; }
.feed-trust-badge {
    background: rgba(148,163,184,.10);
    border-color: rgba(148,163,184,.18);
    color: var(--text-secondary, #9ca3af);
}
.feed-section-head h3 {
    margin: 0;
}
.feed-list {
    gap: 10px;
}
@media (max-width: 720px) {
    .vk-feed-page,
    .vk-profile-wall {
        max-width: 100%;
    }
    .vk-feed-header {
        align-items: stretch;
    }
    .feed-composer-head.compact span {
        text-align: left;
        max-width: none;
    }
    .vk-feed-card .feed-action.ghost {
        margin-left: 0;
    }
}

/* Stage 30Q.4 — profile inline wall + forum discussions above feed */

.vk-forum-panel {
    display: grid;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid var(--border, rgba(255,255,255,.10));
    border-radius: 18px;
    background: rgba(255,255,255,.045);
    box-shadow: none;
}
.forum-panel-head,
.forum-composer-actions,
.forum-topic-row,
.forum-reply-head {
    display: flex;
    align-items: center;
    gap: 12px;
}
.forum-panel-head {
    justify-content: space-between;
}
.forum-panel-head h2 {
    margin: 0 0 4px;
    font-size: 18px;
}
.forum-panel-head p {
    margin: 0;
    color: var(--text-secondary, #9ca3af);
    font-size: 13px;
    line-height: 1.4;
}
.forum-composer {
    display: grid;
    gap: 10px;
    padding: 12px;
    border-radius: 14px;
    background: rgba(15,23,42,.22);
    border: 1px solid rgba(148,163,184,.12);
}
.forum-composer.hidden {
    display: none;
}
.forum-composer-actions {
    justify-content: space-between;
}
.forum-composer-actions small {
    color: var(--text-secondary, #9ca3af);
    font-size: 12px;
}
.forum-topics-list {
    display: grid;
    gap: 8px;
}
.forum-topic-row {
    justify-content: space-between;
    padding: 10px 0 10px 54px;
    color: inherit;
    text-decoration: none;
    border-top: 1px solid rgba(148,163,184,.12);
}
.forum-topic-row:first-child {
    border-top: 0;
}
.forum-topic-row:hover b {
    color: var(--primary-text);
}
.forum-topic-main {
    display: grid;
    gap: 3px;
    min-width: 0;
}
.forum-topic-main b {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.forum-topic-main span,
.forum-topic-meta span,
.forum-back-link {
    color: var(--text-secondary, #9ca3af);
    font-size: 12px;
}
.forum-topic-meta {
    display: grid;
    gap: 2px;
    text-align: right;
    color: var(--text-secondary, #9ca3af);
}
.forum-topic-meta strong {
    color: var(--text-primary, #fff);
}
.forum-empty {
    display: grid;
    gap: 4px;
    padding: 12px 0;
    color: var(--text-secondary, #9ca3af);
    text-align: center;
}
.forum-empty b {
    color: var(--text-primary, #fff);
}
.compact-feed-header {
    margin-top: 2px;
}
.forum-topic-page {
    display: grid;
    gap: 12px;
}
.forum-back-link {
    text-decoration: none;
    width: fit-content;
}
.forum-back-link:hover {
    color: var(--primary-text);
}
.forum-topic-view,
.forum-replies-list {
    display: grid;
    gap: 10px;
}
.forum-topic-card h1 {
    margin: 4px 0 0;
    font-size: clamp(20px, 4vw, 28px);
    line-height: 1.25;
}
.forum-reply {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px;
    border-radius: 14px;
    background: rgba(255,255,255,.035);
}
.forum-reply .feed-avatar {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
    font-size: 13px;
}
.forum-reply-body {
    min-width: 0;
    flex: 1;
}
.forum-reply-head {
    justify-content: space-between;
    margin-bottom: 4px;
}
.forum-reply-head span {
    color: var(--text-secondary, #9ca3af);
    font-size: 12px;
}
.forum-reply-text {
    line-height: 1.5;
    word-break: break-word;
}
.forum-reply-form {
    display: grid;
    gap: 10px;
    margin-top: 4px;
}
.forum-reply-form button {
    justify-self: end;
}
@media (max-width: 720px) {
    .forum-panel-head,
    .forum-composer-actions,
    .forum-topic-row {
        align-items: stretch;
        flex-direction: column;
    }
    .forum-topic-meta {
        display: flex;
        gap: 6px;
        text-align: left;
    }
    .forum-reply-head {
        align-items: flex-start;
        flex-direction: column;
        gap: 2px;
    }
    .forum-reply-form button {
        justify-self: stretch;
    }
}

/* Stage 30Q.4.2 — compact forum block + topic review queue */
.vk-forum-panel.compact {
    gap: 8px;
    padding: 10px 12px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(139,92,246,.11), rgba(255,255,255,.035));
}
.vk-forum-panel.compact .forum-panel-head {
    min-height: 34px;
}
.forum-panel-title {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.forum-panel-icon {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: rgba(139,92,246,.16);
    border: 1px solid rgba(167,139,250,.20);
    font-size: 15px;
    flex: 0 0 auto;
}
.vk-forum-panel.compact .forum-panel-head h2 {
    margin: 0;
    font-size: 16px;
    line-height: 1.15;
}
.vk-forum-panel.compact .forum-panel-head p {
    margin: 1px 0 0;
    font-size: 12px;
    line-height: 1.2;
}
.vk-forum-panel.compact .forum-topics-list.compact {
    gap: 0;
    border-radius: 12px;
    overflow: hidden;
}
.vk-forum-panel.compact .forum-topic-row {
    padding: 7px 2px;
    min-height: 34px;
}
.vk-forum-panel.compact .forum-topic-main b {
    font-size: 13px;
}
.vk-forum-panel.compact .forum-topic-main span,
.vk-forum-panel.compact .forum-topic-meta span {
    font-size: 11px;
}
.vk-forum-panel.compact .forum-topic-meta {
    min-width: 42px;
}
.vk-forum-panel.compact .forum-composer.compact {
    margin-top: 2px;
    padding: 10px;
}
.admin-feed-topic-review {
    display: grid;
    gap: 10px;
    padding: 12px;
    margin-bottom: 14px;
    border: 1px solid rgba(245,158,11,.20);
    border-radius: 16px;
    background: rgba(245,158,11,.055);
}
.admin-feed-topic-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.admin-feed-topic-head h4 {
    margin: 0 0 3px;
    font-size: 15px;
}
.admin-feed-topic-head p {
    margin: 0;
    color: var(--text-secondary, #9ca3af);
    font-size: 12px;
}
.admin-feed-topic-head > b {
    display: inline-grid;
    place-items: center;
    min-width: 32px;
    height: 28px;
    padding: 0 8px;
    border-radius: 999px;
    background: rgba(245,158,11,.16);
    color: #fbbf24;
}
/* Forum attachments in moderation cards (migration 0050). */
.admin-forum-media { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0; }
.admin-forum-media img { display: block; width: 120px; height: 120px; object-fit: cover; border-radius: 10px; }
.admin-forum-media audio { width: min(260px, 100%); }
.admin-forum-media video { width: 160px; height: 160px; border-radius: 50%; object-fit: cover; background: #000; }
.admin-feed-topic-card {
    display: grid;
    gap: 8px;
    padding: 12px;
    border: 1px solid rgba(148,163,184,.14);
    border-radius: 14px;
    background: rgba(15,23,42,.22);
}
.admin-feed-topic-card h4,
.admin-feed-topic-card p {
    margin: 0;
}
.admin-feed-topic-card p {
    white-space: pre-wrap;
    color: var(--text-secondary, #cbd5e1);
}
.admin-feed-topic-empty {
    padding: 10px;
    border-radius: 12px;
    color: var(--text-secondary, #9ca3af);
    background: rgba(255,255,255,.035);
    text-align: center;
}

@media (max-width: 640px) {
    .vk-forum-panel.compact .forum-panel-head,
    .forum-panel-title,
    .admin-feed-topic-head {
        align-items: flex-start;
    }
    .vk-forum-panel.compact .forum-panel-head {
        gap: 8px;
    }
}


/* Stage 30Q.5 — richer VK-like wall composer + feed media */
.vk-wall-composer {
    position: relative;
    overflow: hidden;
    padding: 16px;
    border: 1px solid rgba(167,139,250,.18);
    background:
        radial-gradient(circle at 18% 0%, rgba(139,92,246,.14), transparent 34%),
        linear-gradient(180deg, rgba(255,255,255,.070), rgba(255,255,255,.035));
    box-shadow: 0 18px 50px rgba(2,6,23,.18);
}
.vk-wall-composer::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(255,255,255,.08), transparent 42%);
    opacity: .55;
}
.vk-wall-composer > * {
    position: relative;
    z-index: 1;
}
.feed-composer-author {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.feed-composer-author .feed-avatar {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
    box-shadow: 0 0 0 3px rgba(139,92,246,.12);
}
.feed-composer-author > div {
    display: grid;
    gap: 2px;
    min-width: 0;
}
.feed-composer-author span {
    color: var(--text-secondary, #9ca3af);
    font-size: 12px;
}
.vk-wall-composer textarea {
    min-height: 74px;
    border: 1px solid rgba(148,163,184,.14);
    background: rgba(15,23,42,.20);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.03);
}
.vk-wall-composer textarea:focus {
    border-color: rgba(167,139,250,.45);
    box-shadow: 0 0 0 3px rgba(139,92,246,.10);
}
.feed-composer-tools {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.feed-media-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}
.feed-attach-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 38px;
    padding: 0 13px;
    border: 1px solid rgba(148,163,184,.16);
    border-radius: 999px;
    background: rgba(255,255,255,.060);
    color: var(--text-secondary, #cbd5e1);
    cursor: pointer;
    font-weight: 700;
    transition: transform .15s ease, background .15s ease, color .15s ease, border-color .15s ease;
}
.feed-attach-btn:hover {
    transform: translateY(-1px);
    background: rgba(139,92,246,.12);
    border-color: rgba(167,139,250,.28);
    color: var(--primary-text);
}
.feed-attach-btn:disabled {
    opacity: .55;
    cursor: not-allowed;
    transform: none;
}
.feed-compose-preview {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin-top: 10px;
}
.feed-compose-preview.hidden {
    display: none;
}
.feed-compose-preview-item {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid rgba(148,163,184,.14);
    background: rgba(15,23,42,.24);
}
.feed-compose-preview-item img,
.feed-compose-preview-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.feed-compose-preview-item button {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 26px;
    height: 26px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,.22);
    background: rgba(15,23,42,.78);
    color: #fff;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
}
.feed-media-grid {
    display: grid;
    gap: 6px;
    overflow: hidden;
    border-radius: 16px;
}
.feed-media-grid.count-1 { grid-template-columns: 1fr; }
.feed-media-grid.count-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.feed-media-grid.count-3,
.feed-media-grid.count-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.feed-media-item {
    display: block;
    position: relative;
    min-height: 160px;
    max-height: 460px;
    overflow: hidden;
    background: rgba(15,23,42,.28);
    color: inherit;
}
.feed-media-grid.count-1 .feed-media-item { max-height: 540px; }
.feed-media-grid.count-3 .feed-media-item:first-child { grid-row: span 2; }
.feed-media-item img,
.feed-media-item video {
    width: 100%;
    height: 100%;
    min-height: inherit;
    max-height: inherit;
    object-fit: cover;
    display: block;
}
.feed-media-item.is-video::after {
    content: '▶';
    position: absolute;
    left: 12px;
    bottom: 12px;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: rgba(15,23,42,.70);
    color: #fff;
    pointer-events: none;
    font-size: 14px;
}
.feed-media-item.is-video video:focus + .feed-media-item.is-video::after,
.feed-media-item.is-video:hover::after {
    opacity: .35;
}

@media (max-width: 640px) {
    .feed-compose-preview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .feed-attach-btn span { display: none; }
    .feed-composer-actions { flex-direction: row; align-items: center; }
    .feed-media-item { min-height: 130px; }
    .feed-media-grid.count-1 .feed-media-item { max-height: 420px; }
}
.admin-feed-media-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 8px;
    margin: 8px 0 10px;
}
.admin-feed-media-preview img,
.admin-feed-media-preview video {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid rgba(148,163,184,.14);
    background: rgba(15,23,42,.26);
}


/* Stage 30Q.5.1 — real SVG icons instead of emoji glyphs */
.feed-ui-icon {
    width: 18px;
    height: 18px;
    display: inline-block;
    vertical-align: -3px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex: 0 0 auto;
}
.feed-ui-icon path:first-child,
.feed-ui-icon path:nth-child(2) {
    fill: currentColor;
    stroke: none;
}
.feed-ui-icon:not(.feed-ui-icon-voice) path {
    fill: none;
    stroke: currentColor;
}
.feed-ui-icon-voice {
    width: 20px;
    height: 20px;
}
.feed-ui-icon-voice path:nth-child(3),
.feed-ui-icon-voice path:nth-child(4) {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
}
.feed-attach-btn .feed-ui-icon {
    width: 18px;
    height: 18px;
}
.forum-panel-icon .feed-ui-icon {
    width: 20px;
    height: 20px;
}
.feed-like-symbol {
    font-size: 18px;
    line-height: 1;
}

/* Stage 30Q.5.2 — wall action icons, edit/delete/report modal */
.feed-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0;
}
.feed-icon-btn .feed-ui-icon {
    width: 20px;
    height: 20px;
}
.feed-icon-btn.danger:hover,
.feed-icon-btn.danger:focus-visible {
    color: var(--danger, #ef4444);
    border-color: rgba(239, 68, 68, .35);
    background: rgba(239, 68, 68, .10);
}
.feed-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.feed-action.ghost {
    border: 1px solid transparent;
}
.feed-action.ghost:hover,
.feed-action.ghost:focus-visible {
    border-color: rgba(139, 92, 246, .18);
}
.feed-dialog-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10030;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(2, 6, 23, .62);
    backdrop-filter: blur(8px);
}
.feed-dialog {
    width: min(440px, 100%);
    display: grid;
    gap: 14px;
    position: relative;
    padding: 22px;
    border-radius: 24px;
    border: 1px solid var(--border, rgba(255,255,255,.12));
    background: var(--card-bg, rgba(17, 24, 39, .96));
    box-shadow: 0 22px 70px rgba(0,0,0,.45);
    color: var(--text-primary, #fff);
}
.feed-dialog-wide {
    width: min(560px, 100%);
}
.feed-dialog h3 {
    margin: 0;
    font-size: 20px;
}
.feed-dialog p {
    margin: 0;
    color: var(--text-secondary, #9ca3af);
    line-height: 1.55;
}
.feed-dialog-x {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 34px;
    height: 34px;
    border: 1px solid var(--border, rgba(255,255,255,.12));
    border-radius: 999px;
    background: transparent;
    color: var(--text-secondary, #9ca3af);
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
}
.feed-dialog-x:hover { color: var(--text-primary, #fff); background: rgba(255,255,255,.07); }
.feed-dialog-label {
    color: var(--text-secondary, #9ca3af);
    font-size: 13px;
    font-weight: 700;
}
.feed-dialog-textarea {
    min-height: 130px;
    resize: vertical;
}
.feed-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}
.btn.danger {
    border-color: rgba(239, 68, 68, .35);
    background: rgba(239, 68, 68, .14);
    color: #fecaca;
}
.btn.danger:hover { background: rgba(239, 68, 68, .22); }
@media (max-width: 560px) {
    .feed-dialog { padding: 18px; border-radius: 20px; }
    .feed-dialog-actions { justify-content: stretch; }
    .feed-dialog-actions .btn { flex: 1 1 auto; }
}
.profile-photo-tile-meta svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
    stroke: none;
}

/* Stage 30Q.5.3 — clean wall icons, people lists and media editing */
.feed-ui-icon,
.feed-ui-icon * {
    fill: none !important;
    stroke: currentColor !important;
    stroke-width: 1.85 !important;
    stroke-linecap: round !important;
    stroke-linejoin: round !important;
}
.feed-ui-icon {
    width: 18px;
    height: 18px;
    display: inline-block;
    vertical-align: -3px;
    flex: 0 0 auto;
}
.feed-attach-btn .feed-ui-icon {
    width: 19px;
    height: 19px;
    margin-left: -1px;
}
.feed-action-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    padding: 0 2px;
    border-radius: 999px;
    cursor: pointer;
}
.feed-action-count:hover,
.feed-action-count:focus-visible {
    color: var(--primary-text);
    text-decoration: underline;
    text-underline-offset: 3px;
}
.feed-comment-avatar-link {
    display: inline-flex;
    align-self: flex-start;
    flex: 0 0 auto;
    color: inherit;
    text-decoration: none;
}
.feed-comment-head a {
    color: inherit;
    text-decoration: none;
}
.feed-comment-head a:hover,
.feed-comment-head a:focus-visible {
    color: var(--primary-text);
}
.feed-user-list {
    display: grid;
    gap: 8px;
    max-height: min(62vh, 520px);
    overflow: auto;
    padding-right: 2px;
}
.feed-user-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1px solid rgba(148, 163, 184, .12);
    border-radius: 16px;
    background: rgba(255, 255, 255, .045);
    color: inherit;
    text-decoration: none;
    transition: background .15s ease, border-color .15s ease, transform .15s ease;
}
.feed-user-row:hover,
.feed-user-row:focus-visible {
    transform: translateY(-1px);
    background: rgba(139, 92, 246, .10);
    border-color: rgba(167, 139, 250, .22);
}

button.feed-share-recipient {
    width: 100%;
    min-height: 54px;
    font: inherit;
    text-align: start;
    cursor: pointer;
}

button.feed-share-recipient:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

button.feed-share-recipient:disabled { opacity: .58; cursor: progress; }
.feed-user-row-main {
    min-width: 0;
    display: grid;
    gap: 2px;
}
.feed-user-row-main b,
.feed-user-row-main small,
.feed-user-row-main em {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.feed-user-row-main small {
    color: var(--text-muted, #94a3b8);
    font-size: 12px;
    font-style: normal;
}
.feed-user-row-main em {
    color: var(--text-secondary, #cbd5e1);
    font-size: 13px;
    font-style: normal;
}
.feed-empty-mini {
    padding: 14px;
    border: 1px dashed rgba(148, 163, 184, .16);
    border-radius: 16px;
    color: var(--text-muted, #94a3b8);
    text-align: center;
}
.feed-share-comment-preview { display: grid; gap: 5px; min-width: 0; }
.feed-share-comment-preview p { margin: 0; color: var(--text-secondary); line-height: 1.45; }
.feed-share-comment-preview a { width: fit-content; color: var(--primary-text); overflow-wrap: anywhere; }
.feed-share-comment-preview a:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.feed-edit-dialog .feed-dialog-textarea {
    margin-bottom: 10px;
}
.feed-edit-media-title {
    margin: 4px 0 8px;
    color: var(--text-secondary, #cbd5e1);
    font-weight: 800;
    font-size: 13px;
}
.feed-edit-current-media,
.feed-edit-new-media {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: 0 0 10px;
}
.feed-compose-preview-item.is-removed {
    opacity: .42;
    filter: grayscale(.65);
}
.feed-compose-preview-item.is-removed::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(135deg, rgba(239,68,68,.22) 0 6px, rgba(15,23,42,.08) 6px 12px);
    pointer-events: none;
}
.feed-edit-tools {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin: 2px 0 14px;
}
.feed-edit-tools small {
    color: var(--text-muted, #94a3b8);
    font-size: 12px;
}
.feed-comments.is-open {
    border-color: rgba(167, 139, 250, .16);
}
@media (max-width: 640px) {
    .feed-edit-current-media,
    .feed-edit-new-media {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .feed-edit-tools {
        align-items: stretch;
    }
    .feed-edit-tools .feed-attach-btn {
        flex: 1 1 auto;
    }
}

/* Social controls: scoped to their own components; no shell/global input overrides. */
:is(.profile-page.profile-redesign, .dxs) .social-preferences { display: grid; gap: 10px; min-width: 0; }
:is(.profile-page.profile-redesign, .dxs) .social-preferences .input { width: 100%; min-width: 0; min-height: 44px; }
:is(.profile-page.profile-redesign, .dxs) .social-hidden-section { display: grid; gap: 10px; padding-top: 14px; border-top: 1px solid var(--border); }
:is(.profile-page.profile-redesign, .dxs) .social-hidden-section h4 { margin: 0; font-size: 14px; }
:is(.profile-page.profile-redesign, .dxs) .social-hidden-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0; }
:is(.profile-page.profile-redesign, .dxs) .social-hidden-row a { min-width: 0; overflow-wrap: anywhere; color: var(--text); }
:is(.profile-page.profile-redesign, .dxs) .social-preferences .form-hint { font-size: 13px; line-height: 1.5; margin: 0; }
:is(.profile-page.profile-redesign, .dxs) .social-preferences button { min-height: 44px; }
.feed-composer .feed-audience-control, .feed-edit-dialog .feed-audience-control { display: grid; gap: 6px; min-width: 0; margin-top: 12px; font-size: 13px; color: var(--text-secondary); }
.feed-composer .feed-audience-control select, .feed-edit-dialog .feed-audience-control select { min-height: 44px; width: 100%; min-width: 0; max-width: 100%; font-size: 13px; }
.feed-composer .feed-audience-control small, .feed-edit-dialog .feed-audience-control small { line-height: 1.45; font-size: 11px; }
.feed-page .feed-hidden-notice { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 12px; margin-bottom: 12px; border: 1px solid var(--border); border-radius: 12px; color: var(--text); background: var(--bg-secondary); }
.feed-page .feed-hidden-notice[hidden] { display: none; }
.feed-post .feed-hide-author, .feed-comment .feed-reply-btn, .feed-viewer-photo-comment .feed-reply-btn { min-height: 44px; border: 0; background: transparent; padding: 6px 8px; color: var(--text); font-size: 12px; cursor: pointer; }
.feed-post .feed-hide-author { margin-top: 6px; color: var(--text-secondary); text-align: start; }
.feed-post .feed-reply-selection, .feed-post-media-viewer .feed-reply-selection { grid-column: 1 / -1; display: flex; flex-wrap: wrap; flex-basis: 100%; justify-content: space-between; align-items: center; min-width: 0; gap: 8px; font-size: 12px; }
.feed-post .feed-reply-selection[hidden], .feed-post-media-viewer .feed-reply-selection[hidden] { display: none; }
.feed-reply-selection span { min-width: 0; overflow-wrap: anywhere; }
.feed-reply-selection button { min-height: 44px; padding: 4px 8px; border: 0; background: transparent; color: inherit; cursor: pointer; }
.feed-post .feed-comment-form { flex-wrap: wrap; }
.feed-post .feed-reply-btn:focus-visible, .feed-post .feed-hide-author:focus-visible, .feed-reply-selection button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.feed-scroll-nav {
    position: fixed;
    z-index: 180;
    inset-inline-end: max(18px, env(safe-area-inset-right, 0px));
    bottom: max(22px, env(safe-area-inset-bottom, 0px));
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.feed-scroll-nav[hidden] { display: none; }
.feed-scroll-button,
.feed-comment-jump {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--border-dark);
    border-radius: 50%;
    color: var(--text);
    background: var(--bg-card);
    box-shadow: var(--shadow-md);
    cursor: pointer;
}
.feed-scroll-button svg,
.feed-comment-jump svg { width: 20px; height: 20px; }
.feed-scroll-button:hover:not(:disabled),
.feed-comment-jump:hover:not(:disabled) { background: var(--bg-tertiary); }
.feed-scroll-button:focus-visible,
.feed-comment-jump:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.feed-scroll-button:disabled,
.feed-comment-jump:disabled { opacity: .45; box-shadow: none; cursor: default; }
.feed-comment-navigation { display: inline-flex; align-items: center; gap: 6px; margin-inline-start: auto; }
.feed-comments-heading .feed-comment-navigation { margin-inline-start: 8px; }
.feed-comment-jump { width: 36px; height: 36px; box-shadow: none; }
.profile-photo-comments-heading { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); color: var(--text); background: var(--bg-secondary); font-weight: 650; }
@media (max-width: 1024px) {
    .feed-scroll-nav { inset-inline-end: 12px; bottom: calc(var(--mobile-bottom-nav-h, 74px) + 24px + env(safe-area-inset-bottom, 0px)); }
}

.feed-comment-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 9px;
    min-width: 0;
    margin-top: 5px;
}
.feed-comment-actions .feed-reply-btn,
.feed-comment-actions .feed-comment-share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 36px;
    padding: 4px 8px;
    border: 1px solid transparent;
    border-radius: 10px;
    color: var(--text-secondary);
    background: transparent;
    font: inherit;
    font-size: 12px;
    font-weight: 550 !important;
    cursor: pointer;
}
.feed-comment-actions .feed-comment-share-btn svg { width: 16px; height: 16px; flex: 0 0 auto; }
.feed-comment-actions :is(.feed-reply-btn, .feed-comment-share-btn):is(:hover, :focus-visible) {
    color: var(--text);
    background: var(--bg-hover);
    border-color: var(--border);
}
.feed-comment-actions :is(.feed-reply-btn, .feed-comment-share-btn):focus-visible,
.feed-comment-parent:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.feed-comment-parent {
    display: inline-block;
    max-width: 100%;
    margin: 5px 0;
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-inline-start: 2px solid var(--primary);
    border-radius: 9px;
    color: var(--text-secondary);
    background: var(--primary-light);
    font: inherit;
    font-size: 12px;
    font-weight: 550 !important;
    text-align: start;
    overflow-wrap: anywhere;
    cursor: pointer;
}
.feed-comment-parent:hover { color: var(--text); background: var(--bg-hover); }
.feed-comment-focus { background: var(--primary-light) !important; border-radius: 12px; }

@media (max-width: 640px) {
    /* An older mobile rule forces every button to 16px; compact comment
       controls must fit beside each other without changing input zoom safety. */
    .feed-comment-actions :is(.feed-reply-btn, .feed-comment-share-btn),
    :is(.feed-comment, .feed-viewer-photo-comment) .feed-comment-parent,
    .social-reactions :is(.social-reaction-chip, .social-reaction-add) {
        font-size: 12px !important;
    }
    .social-reactions :is(.social-reaction-chip, .social-reaction-add) { min-height: 44px; min-width: 44px; }
    .feed-comment-navigation .feed-comment-jump { width: 44px; height: 44px; }
    .forum-discussion-card .forum-page-button { min-width: 44px; height: 44px; }
}

/* Loading, retry and available states remain discoverable; ACL-hidden targets do not. */
.social-reactions:not([hidden]) {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
    min-width: 0;
    margin-block: 5px;
}
.social-reactions[hidden] { display: none !important; }
.social-reaction-chip,
.social-reaction-add {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-width: 36px;
    min-height: 32px;
    padding: 4px 9px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-secondary);
    background: var(--bg-hover);
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    transition: background .14s ease, border-color .14s ease, transform .14s ease;
}
.social-reaction-chip:is(:hover, :focus-visible),
.social-reaction-add:is(:hover, :focus-visible) { color: var(--text); background: var(--primary-light); border-color: var(--border-dark); }
.social-reaction-chip[aria-pressed="true"] { color: var(--text); background: var(--primary-light); border-color: var(--primary); }
.social-reaction-chip:focus-visible,
.social-reaction-add:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.social-reaction-chip:disabled,
.social-reaction-add:disabled { opacity: .6; cursor: progress; }
.social-reaction-emoji { display: inline-flex; align-items: center; font-size: 20px; line-height: 1; }
.social-reaction-count { color: inherit; font-variant-numeric: tabular-nums; }
.social-reaction-label { font-size: 12px; font-weight: 600; white-space: nowrap; }
/* Owner 2026-10-18: the add-reaction control is the smiley alone, in the feed and
   the profile; its name stays in aria-label/title (or this label for assistive
   tech). Only the retry state keeps its visible word. */
.social-reaction-add:not([data-social-reaction-retry]) .social-reaction-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}
.social-reaction-add svg { width: 22px; height: 22px; flex: 0 0 22px; }
.social-reactions-status { flex-basis: 100%; max-width: 100%; color: var(--text-muted); font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }
.social-reactions[data-social-reactions-state="error"] .social-reaction-add { border-color: var(--border-dark); }
/* Feed/profile add-reaction is a bare icon. Keep the existing hit area,
   counters, retry button and keyboard focus outline. */
.feed-post .social-reactions:is([data-social-scope="feed_post"], [data-social-scope="feed_comment"]) > .social-reaction-add:not([data-social-reaction-retry]) {
    border-color: transparent;
    border-radius: 8px;
    background: transparent;
    box-shadow: none;
}
.feed-post .social-reactions:is([data-social-scope="feed_post"], [data-social-scope="feed_comment"]) > .social-reaction-add:not([data-social-reaction-retry]) > svg { stroke-width: 1.85; }
.social-reaction-picker {
    z-index: 2300;
    box-sizing: border-box;
    overflow: auto;
    overscroll-behavior: contain;
    padding: 9px;
    border: 1px solid var(--border-dark);
    border-radius: 18px;
    color: var(--text);
    background: var(--bg-modal);
    box-shadow: var(--shadow-xl);
}
.social-reaction-picker-close {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    margin: 0 0 5px auto;
    padding: 0;
    border: 0;
    border-radius: 9px;
    color: var(--text-secondary);
    background: var(--bg-hover);
    font: inherit;
    font-size: 22px;
    cursor: pointer;
}
.social-reaction-picker-close:hover { color: var(--text); background: var(--primary-light); }
.social-reaction-picker-close:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.dealix-emoji-picker { display: flex; flex-direction: column; gap: 6px; min-width: 0; min-height: 0; }

/* Stage 30Q.5.4 — wall send button, profile listing links and cleaner icons */
.feed-comment-form {
    align-items: center;
    padding: 8px;
    border-radius: 18px;
    background: rgba(255,255,255,.035);
    border: 1px solid rgba(148,163,184,.10);
}
.feed-comment-form input {
    min-height: 42px;
    border-radius: 14px;
}
.feed-comment-send.chat-send-style {
    width: 42px;
    height: 42px;
    min-width: 42px;
    min-height: 42px;
    border: 0;
    border-radius: 15px;
    display: grid;
    place-items: center;
    padding: 0;
    color: #fff;
    cursor: pointer;
    background: linear-gradient(135deg, #7c3aed 0%, #8b5cf6 55%, #6d5dfc 100%);
    box-shadow: 0 12px 26px rgba(109,93,252,.34), inset 0 1px 0 rgba(255,255,255,.18);
    transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
}
.feed-comment-send.chat-send-style:hover,
.feed-comment-send.chat-send-style:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 16px 34px rgba(109,93,252,.42), inset 0 1px 0 rgba(255,255,255,.20);
    outline: none;
}
.feed-comment-send.chat-send-style:disabled {
    opacity: .55;
    cursor: not-allowed;
    transform: none;
}
.feed-send-icon {
    width: 21px;
    height: 21px;
    display: block;
    fill: currentColor;
    stroke: none;
}
.feed-attach-btn .feed-ui-icon,
.feed-action .feed-ui-icon,
.forum-panel-icon .feed-ui-icon {
    shape-rendering: geometricPrecision;
}
.feed-attach-btn .feed-ui-icon {
    width: 20px;
    height: 20px;
    margin-left: 0;
}
/* The one size owner of the post action icons (owner 2026-10-18: larger, clearer). */
.feed-action .feed-ui-icon {
    width: 22px;
    height: 22px;
}
.profile-listing-card {
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: transform .16s ease, border-color .16s ease, background .16s ease;
}
.profile-listing-card:hover,
.profile-listing-card:focus-visible {
    transform: translateY(-2px);
    border-color: rgba(139,92,246,.30);
    background: rgba(139,92,246,.08);
    outline: none;
}
.profile-listing-card:hover h4,
.profile-listing-card:focus-visible h4 {
    color: var(--primary-text);
}
.feed-comment-avatar-link,
.feed-comment-head a,
.feed-author,
.feed-user-row {
    cursor: pointer;
}
@media (max-width: 560px) {
    .feed-comment-form {
        flex-direction: row;
    }
    .feed-comment-send.chat-send-style {
        width: 40px;
        height: 40px;
        min-width: 40px;
        min-height: 40px;
        border-radius: 14px;
    }
}

/* Stage 30Q.5.5 — profile wall mobile actions + bubble composer polish */
.vk-wall-composer {
    padding: 14px;
    border-color: rgba(167,139,250,.20);
    background:
        radial-gradient(circle at 16% 0%, rgba(139,92,246,.16), transparent 34%),
        linear-gradient(180deg, rgba(255,255,255,.055), rgba(255,255,255,.030));
}
.feed-composer-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}
.feed-composer-avatar {
    flex: 0 0 auto;
    padding-top: 2px;
}
.feed-composer-avatar .feed-avatar {
    width: 42px;
    height: 42px;
    flex-basis: 42px;
    box-shadow: 0 0 0 3px rgba(139,92,246,.14), 0 10px 24px rgba(2,6,23,.22);
}
.feed-composer-bubble {
    position: relative;
    flex: 1;
    min-width: 0;
    padding: 13px 14px 12px;
    border: 1px solid rgba(167,139,250,.20);
    border-radius: 22px 22px 22px 10px;
    background:
        linear-gradient(180deg, rgba(139,92,246,.105), rgba(15,23,42,.20)),
        rgba(255,255,255,.045);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.055), 0 14px 34px rgba(2,6,23,.14);
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.feed-composer-bubble::before {
    content: '';
    position: absolute;
    left: -7px;
    top: 20px;
    width: 14px;
    height: 14px;
    border-left: 1px solid rgba(167,139,250,.20);
    border-bottom: 1px solid rgba(167,139,250,.20);
    background: rgba(44,35,72,.92);
    transform: rotate(45deg);
    border-radius: 0 0 0 4px;
}
.feed-composer-bubble:focus-within {
    border-color: rgba(196,181,253,.55);
    box-shadow: 0 0 0 3px rgba(139,92,246,.12), inset 0 1px 0 rgba(255,255,255,.07), 0 16px 40px rgba(2,6,23,.18);
}
.feed-composer-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 7px;
}
.feed-composer-title b {
    font-size: 14px;
    color: var(--text-primary, #fff);
}
.feed-composer-title span {
    max-width: 44%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-secondary, #9ca3af);
    font-size: 12px;
}
.vk-wall-composer textarea.feed-composer-input,
.feed-composer-input {
    width: 100%;
    min-height: 62px;
    resize: vertical;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    outline: 0;
    color: var(--text-primary, #f8fafc);
    line-height: 1.45;
}
.vk-wall-composer textarea.feed-composer-input:focus,
.feed-composer-input:focus {
    border: 0;
    box-shadow: none;
    background: transparent;
}
.feed-composer-input::placeholder {
    color: rgba(203,213,225,.52);
}
.vk-feed-card .feed-post-head {
    align-items: flex-start;
    gap: 10px;
}
.vk-feed-card .feed-author {
    flex: 1 1 auto;
    min-width: 0;
}
.vk-feed-card .feed-post-head-actions {
    flex: 0 0 auto;
    margin-left: auto;
    align-self: flex-start;
    justify-content: flex-end;
}

@media (max-width: 720px) {
    .vk-feed-card .feed-post-head {
        flex-direction: row;
        align-items: flex-start;
        justify-content: space-between;
    }
    .vk-feed-card .feed-post-head-actions {
        flex-direction: row;
        align-items: center;
        flex-wrap: nowrap;
        gap: 7px;
        margin-left: 8px;
    }
    .vk-feed-card .feed-post-head-actions .feed-icon-btn {
        width: 34px;
        height: 34px;
        min-width: 34px;
        padding: 0;
    }
    .feed-composer-row {
        gap: 10px;
    }
    .feed-composer-avatar .feed-avatar {
        width: 38px;
        height: 38px;
        flex-basis: 38px;
    }
    .feed-composer-bubble {
        padding: 12px 13px 11px;
        border-radius: 20px 20px 20px 9px;
    }
    .feed-composer-title {
        display: block;
        margin-bottom: 6px;
    }
    .feed-composer-title span {
        display: none;
    }
    .feed-composer-input {
        min-height: 58px;
    }
}

/* Stage 30Q.5.6 — cleaner composer bubble and inline comments */
.vk-wall-composer {
    overflow: visible;
}
.vk-wall-composer .feed-composer-bubble {
    background:
        radial-gradient(circle at 18% 0%, rgba(167,139,250,.16), transparent 38%),
        linear-gradient(180deg, rgba(42,33,70,.86), rgba(27,31,48,.78));
}
.vk-wall-composer textarea.feed-composer-input,
.vk-wall-composer .feed-composer-input,
.feed-composer-bubble textarea.feed-composer-input {
    appearance: none !important;
    -webkit-appearance: none !important;
    display: block;
    width: 100%;
    min-height: 62px;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    outline: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    resize: vertical;
}
.vk-wall-composer textarea.feed-composer-input:focus,
.vk-wall-composer .feed-composer-input:focus,
.feed-composer-bubble textarea.feed-composer-input:focus {
    border: 0 !important;
    outline: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}
.feed-comments:not(.is-open) .feed-comment,
.feed-comments:not(.is-open) .feed-empty-mini {
    display: none;
}
.feed-comments.is-open {
    padding: 8px;
    border: 1px solid rgba(167,139,250,.14);
    border-radius: 18px;
    background: rgba(255,255,255,.025);
}
.feed-comments.is-open .feed-comment-form {
    margin-top: 2px;
}
.feed-action[data-feed-comments-toggle] .feed-action-count {
    text-decoration: none;
}
.feed-action[data-feed-comments-toggle]:hover .feed-action-count,
.feed-action[data-feed-comments-toggle]:focus-visible .feed-action-count {
    color: currentColor;
    text-decoration: none;
}

body.theme-light .vk-wall-composer {
    border-color: rgba(109,93,252,.14);
    background:
        radial-gradient(circle at 14% 0%, rgba(109,93,252,.08), transparent 34%),
        linear-gradient(180deg, rgba(255,255,255,.92), rgba(248,250,252,.84));
    box-shadow: 0 18px 45px rgba(15,23,42,.08), inset 0 1px 0 rgba(255,255,255,.78);
}
body.theme-light .vk-wall-composer::before {
    opacity: .28;
    background: linear-gradient(135deg, rgba(109,93,252,.10), transparent 46%);
}
body.theme-light .vk-wall-composer .feed-composer-bubble {
    border-color: rgba(109,93,252,.16);
    background:
        radial-gradient(circle at 12% 0%, rgba(109,93,252,.12), transparent 44%),
        linear-gradient(180deg, rgba(246,244,255,.96), rgba(255,255,255,.92));
    box-shadow: inset 0 1px 0 rgba(255,255,255,.9), 0 14px 32px rgba(15,23,42,.07);
}
body.theme-light .feed-composer-bubble::before {
    border-left-color: rgba(109,93,252,.16);
    border-bottom-color: rgba(109,93,252,.16);
    background: #f2efff;
}
body.theme-light .feed-composer-title b {
    color: #1f2937;
}
body.theme-light .vk-wall-composer textarea.feed-composer-input,
body.theme-light .vk-wall-composer .feed-composer-input,
body.theme-light .feed-composer-bubble textarea.feed-composer-input {
    color: #111827 !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
}
body.theme-light .feed-composer-input::placeholder {
    color: rgba(75,85,99,.56);
}
body.theme-light .feed-comments.is-open {
    border-color: rgba(109,93,252,.12);
    background: rgba(109,93,252,.035);
}

@media (max-width: 720px) {
    .vk-wall-composer .feed-composer-bubble {
        min-width: 0;
    }
    .feed-comments.is-open {
        padding: 7px;
    }
}

/* Stage 30Q.5.7 — feed/profile polish: purple like, info icon, stable trust index styling */
.feed-action[data-feed-like] {
    color: var(--primary-text);
    border: 1px solid rgba(139, 92, 246, .20);
    background: rgba(139, 92, 246, .10);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
}
.feed-action[data-feed-like]:hover,
.feed-action[data-feed-like]:focus-visible {
    color: #fff;
    border-color: rgba(168, 85, 247, .45);
    background: linear-gradient(135deg, rgba(124, 58, 237, .30), rgba(168, 85, 247, .22));
    box-shadow: 0 10px 26px rgba(124, 58, 237, .20), inset 0 1px 0 rgba(255,255,255,.08);
}
.feed-action[data-feed-like].active:not(.feed-page .feed-action) {
    color: #fff !important;
    border-color: rgba(196, 181, 253, .62) !important;
    background: linear-gradient(135deg, #6d5dfc 0%, #8b5cf6 48%, #a855f7 100%) !important;
    box-shadow: 0 14px 34px rgba(139, 92, 246, .36), inset 0 1px 0 rgba(255,255,255,.20) !important;
}
.feed-action[data-feed-like] .feed-ui-icon path {
    stroke-width: 2.15 !important;
}
.feed-action[data-feed-like].active .feed-ui-icon path {
    fill: currentColor !important;
    stroke: currentColor !important;
}
.feed-action[data-feed-like] .feed-action-count {
    font-weight: 800;
}
[data-theme="light"] .feed-action[data-feed-like] {
    color: #6d28d9;
    border-color: rgba(109, 40, 217, .18);
    background: rgba(124, 58, 237, .08);
}
[data-theme="light"] .feed-action[data-feed-like]:hover,
[data-theme="light"] .feed-action[data-feed-like]:focus-visible {
    color: #fff;
    background: linear-gradient(135deg, #6d5dfc 0%, #8b5cf6 55%, #a855f7 100%);
}
.info-card h3 .profile-info-title-icon {
    color: var(--primary-text);
    filter: drop-shadow(0 0 10px rgba(139, 92, 246, .22));
}
[data-theme="light"] .info-card h3 .profile-info-title-icon {
    color: #6d28d9;
    filter: drop-shadow(0 4px 12px rgba(109, 40, 217, .16));
}
.feed-trust-badge {
    white-space: nowrap;
}


/* Stage 30Q.5.8 — profile section icons + borderless composer bubble */
.info-card h3 .profile-section-title-icon,
.info-card h3 .profile-info-title-icon {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    color: #a78bfa !important;
    stroke: currentColor !important;
    opacity: 1 !important;
    filter: drop-shadow(0 0 12px rgba(139,92,246,.36));
}
.info-card h3 .profile-section-title-icon *:not([fill="none"]),
.info-card h3 .profile-info-title-icon *:not([fill="none"]) {
    color: currentColor;
}
body.theme-light .info-card h3 .profile-section-title-icon,
body.theme-light .info-card h3 .profile-info-title-icon,
[data-theme="light"] .info-card h3 .profile-section-title-icon,
[data-theme="light"] .info-card h3 .profile-info-title-icon {
    color: #6d5dfc !important;
    filter: drop-shadow(0 5px 14px rgba(109,93,252,.22));
}
.vk-wall-composer.feed-composer {
    padding: 8px 0 14px !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}
.vk-wall-composer.feed-composer::before {
    display: none !important;
}
.vk-wall-composer.feed-composer .feed-composer-row {
    padding: 0 !important;
    background: transparent !important;
}
.vk-wall-composer textarea.feed-composer-input,
.vk-wall-composer .feed-composer-input,
.feed-composer-bubble textarea.feed-composer-input {
    resize: none !important;
    background: transparent !important;
    box-shadow: none !important;
}
.feed-composer-bubble {
    background: linear-gradient(180deg, rgba(63,49,101,.92), rgba(36,39,59,.86)) !important;
}
body.theme-light .feed-composer-bubble,
[data-theme="light"] .feed-composer-bubble {
    background: linear-gradient(180deg, rgba(246,244,255,.98), rgba(255,255,255,.96)) !important;
}
body.theme-light .vk-wall-composer.feed-composer,
[data-theme="light"] .vk-wall-composer.feed-composer {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
}
@media (max-width: 720px) {
    .vk-wall-composer.feed-composer {
        padding-top: 4px !important;
    }
}

/* Stage 30Q.5.9 — sharper profile icons, media viewer, visible report */
.info-card h3 .profile-section-title-icon {
    width: 21px !important;
    height: 21px !important;
    color: #8b5cf6 !important;
    opacity: 1 !important;
    filter: none !important;
    stroke-width: 2.2 !important;
    shape-rendering: geometricPrecision;
}
body:not(.theme-light) .info-card h3 .profile-section-title-icon,
[data-theme="dark"] .info-card h3 .profile-section-title-icon {
    color: #a78bfa !important;
}
body.theme-light .info-card h3 .profile-section-title-icon,
[data-theme="light"] .info-card h3 .profile-section-title-icon {
    color: #6d5dfc !important;
    filter: none !important;
}
.info-card h3 .profile-section-title-icon [fill-opacity] {
    fill: currentColor !important;
}

/* Remove the remaining heavy card under the profile wall composer; keep the bubble itself. */

.feed-post-head-actions .feed-icon-btn[data-feed-report] {
    color: #a78bfa;
    border-color: rgba(167,139,250,.24);
    background: rgba(139,92,246,.08);
}
.feed-post-head-actions .feed-icon-btn[data-feed-report]:hover,
.feed-post-head-actions .feed-icon-btn[data-feed-report]:focus-visible {
    color: #fff;
    background: linear-gradient(135deg, #6d5dfc, #a855f7);
    border-color: rgba(167,139,250,.44);
}

.feed-media-item.is-image {
    padding: 0;
    border: 0;
    cursor: zoom-in;
    text-align: inherit;
    background: transparent;
}
.feed-media-item.is-video {
    position: relative;
}
.feed-media-open-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 999px;
    color: #fff;
    background: rgba(15,23,42,.56);
    backdrop-filter: blur(10px);
    cursor: zoom-in;
    opacity: .9;
    transition: transform .15s ease, opacity .15s ease, background .15s ease;
}
.feed-media-open-btn:hover,
.feed-media-open-btn:focus-visible {
    opacity: 1;
    transform: translateY(-1px);
    background: rgba(109,93,252,.72);
}
.feed-media-viewer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(2,6,23,.86);
    backdrop-filter: blur(14px);
}
.feed-media-viewer {
    position: relative;
    width: min(1080px, 96vw);
    height: min(760px, 88vh);
    display: flex;
    align-items: center;
    justify-content: center;
}
.feed-media-viewer-stage {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.feed-media-viewer-stage img,
.feed-media-viewer-stage video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 18px;
    box-shadow: 0 30px 90px rgba(0,0,0,.45);
    background: #020617;
}
.feed-media-viewer-x,
.feed-media-viewer-nav {
    position: absolute;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255,255,255,.16);
    color: #fff;
    background: rgba(15,23,42,.62);
    backdrop-filter: blur(12px);
    cursor: pointer;
    transition: transform .15s ease, background .15s ease;
}
.feed-media-viewer-x {
    top: 10px;
    right: 10px;
    width: 44px;
    height: 44px;
    border-radius: 999px;
    font-size: 28px;
    line-height: 1;
}
.feed-media-viewer-nav {
    top: 50%;
    width: 48px;
    height: 64px;
    border-radius: 20px;
    font-size: 46px;
    transform: translateY(-50%);
}
.feed-media-viewer-nav.prev { left: 8px; }
.feed-media-viewer-nav.next { right: 8px; }
.feed-media-viewer-x:hover,
.feed-media-viewer-nav:hover,
.feed-media-viewer-x:focus-visible,
.feed-media-viewer-nav:focus-visible {
    background: rgba(109,93,252,.72);
}
.feed-media-viewer-count {
    position: absolute;
    left: 50%;
    bottom: 12px;
    transform: translateX(-50%);
    padding: 6px 11px;
    border-radius: 999px;
    color: #fff;
    background: rgba(15,23,42,.60);
    font-weight: 800;
    font-size: 13px;
}
.feed-media-viewer-nav.hidden,
.feed-media-viewer-count:empty {
    display: none;
}
@media (max-width: 720px) {
    .feed-media-viewer-backdrop { padding: 8px; }
    .feed-media-viewer { width: 100vw; height: 90vh; }
    .feed-media-viewer-nav { width: 42px; height: 54px; font-size: 38px; }
    .feed-media-viewer-stage img,
    .feed-media-viewer-stage video { border-radius: 14px; }
}

/* Stage 30Q.5.10 — normal star icon, post media viewer like profile photos, cover upload stability */
.info-card h3 .profile-section-title-icon-award {
    overflow: visible !important;
    color: #8b5cf6 !important;
    filter: none !important;
    shape-rendering: geometricPrecision;
}
.info-card h3 .profile-section-title-icon-award polygon {
    fill: none !important;
    stroke: currentColor !important;
    stroke-width: 2.2 !important;
    vector-effect: non-scaling-stroke;
}
body:not(.theme-light) .info-card h3 .profile-section-title-icon-award,
[data-theme="dark"] .info-card h3 .profile-section-title-icon-award {
    color: #a78bfa !important;
}
body.theme-light .info-card h3 .profile-section-title-icon-award,
[data-theme="light"] .info-card h3 .profile-section-title-icon-award {
    color: #6d5dfc !important;
}

.feed-post-media-viewer {
    z-index: 10050;
}
.feed-post-media-viewer .profile-photo-viewer-media video {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 18px;
    background: #020617;
    box-shadow: 0 20px 80px rgba(0,0,0,.38);
}
.feed-post-media-viewer .profile-photo-more.feed-post-viewer-more {
    visibility: hidden;
    pointer-events: none;
}
.feed-post-media-viewer .profile-photo-caption:empty {
    display: none !important;
}
.feed-post-media-viewer .profile-photo-socialbar .feed-ui-icon {
    width: 21px;
    height: 21px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2.15;
}
.feed-post-media-viewer .profile-photo-socialbar .profile-photo-like-btn.liked .feed-ui-icon,
.feed-post-media-viewer .profile-photo-socialbar .profile-photo-like-btn:hover .feed-ui-icon {
    color: #fff;
}
.feed-post-media-viewer .profile-photo-comments-list .feed-comment {
    padding: 10px 0;
}
.feed-post-media-viewer .profile-photo-comments-list .feed-comment:first-child {
    padding-top: 0;
}
.feed-post-media-viewer .profile-photo-comments-list .feed-empty-mini {
    margin: 6px 0;
}
.feed-post-media-viewer .feed-viewer-comment-form .feed-send-icon {
    width: 20px;
    height: 20px;
}
@media (max-width: 720px) {
    .feed-post-media-viewer .profile-photo-viewer-media video {
        border-radius: 14px;
    }
}

/* Stage 30Q.5.11 — viewer comments, share, profile star and cover robustness */
.info-card h3 .profile-section-title-icon-award,
.info-card h3 .profile-section-title-icon-award path,
.info-card h3 .profile-section-title-icon-award polygon {
    fill: none !important;
    stroke: currentColor !important;
    stroke-width: 2 !important;
    stroke-linecap: round !important;
    stroke-linejoin: round !important;
    vector-effect: non-scaling-stroke;
    shape-rendering: geometricPrecision;
}
.info-card h3 .profile-section-title-icon-award {
    width: 22px !important;
    height: 22px !important;
    color: #8b5cf6 !important;
    filter: drop-shadow(0 0 8px rgba(139,92,246,.24)) !important;
}
body:not(.theme-light) .info-card h3 .profile-section-title-icon-award,
[data-theme="dark"] .info-card h3 .profile-section-title-icon-award {
    color: #c4b5fd !important;
}
body.theme-light .info-card h3 .profile-section-title-icon-award,
[data-theme="light"] .info-card h3 .profile-section-title-icon-award {
    color: #6d5dfc !important;
}

.feed-post-media-viewer .profile-photo-socialbar {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}
.feed-post-media-viewer .profile-photo-share-btn .feed-ui-icon,
.feed-share-action .feed-ui-icon {
    fill: none !important;
    stroke: currentColor !important;
    stroke-width: 2.1 !important;
}
.feed-post-media-viewer .profile-photo-comments-panel {
    display: grid !important;
    grid-template-rows: minmax(0, 1fr) auto !important;
    background: rgba(17, 18, 24, .98) !important;
}
.feed-post-media-viewer .profile-photo-comments-panel.hidden {
    display: none !important;
}
.feed-post-media-viewer .profile-photo-comments-list {
    padding: 16px 18px !important;
    overflow-y: auto !important;
    min-height: 0 !important;
}
.feed-post-media-viewer .profile-photo-comment-form.feed-viewer-comment-form {
    grid-template-columns: minmax(0, 1fr) 48px !important;
    gap: 10px !important;
    align-items: center !important;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom)) !important;
    background: rgba(17, 18, 24, .99) !important;
}
.feed-post-media-viewer .profile-photo-comment-form.feed-viewer-comment-form input[name="body"] {
    width: 100% !important;
    min-width: 0 !important;
    height: 44px !important;
    border-radius: 999px !important;
    border: 1px solid rgba(255,255,255,.12) !important;
    background: rgba(255,255,255,.08) !important;
    color: #fff !important;
    padding: 0 16px !important;
    font-weight: 750 !important;
    outline: none !important;
    box-sizing: border-box !important;
}
.feed-post-media-viewer .profile-photo-comment-form.feed-viewer-comment-form input[name="body"]::placeholder {
    color: rgba(255,255,255,.46) !important;
}
.feed-post-media-viewer .profile-photo-comment-form.feed-viewer-comment-form .profile-photo-comment-send {
    width: 48px !important;
    height: 44px !important;
    min-width: 48px !important;
    border-radius: 999px !important;
    display: grid !important;
    place-items: center !important;
    background: linear-gradient(135deg, #6d5dfc, #8b5cf6) !important;
    color: #fff !important;
    border: 0 !important;
}
.feed-share-dialog .feed-share-hint {
    margin: -4px 0 12px;
    color: var(--text-muted, rgba(255,255,255,.62));
    font-weight: 750;
}
.feed-share-dialog .feed-share-search {
    flex: 0 0 auto;
    margin-bottom: 12px;
}
.feed-share-dialog .feed-share-list {
    flex: 1 1 auto;
    min-height: 56px;
    display: grid;
    gap: 8px;
    max-height: min(52vh, 420px);
    overflow-y: auto;
}
.feed-share-dialog .feed-user-row {
    border-radius: 16px;
    padding: 10px;
    background: rgba(255,255,255,.05);
    border: 1px solid rgba(255,255,255,.08);
}
.feed-share-dialog .feed-user-row:hover,
.feed-share-dialog .feed-user-row.is-loading {
    background: rgba(139,92,246,.16);
    border-color: rgba(139,92,246,.36);
}
body.theme-light .feed-share-dialog .feed-share-hint,
[data-theme="light"] .feed-share-dialog .feed-share-hint {
    color: rgba(15,23,42,.62);
}
body.theme-light .feed-share-dialog .feed-user-row,
[data-theme="light"] .feed-share-dialog .feed-user-row {
    background: rgba(109,93,252,.055);
    border-color: rgba(109,93,252,.14);
}

/* Stage 30Q.5.12 — full feed repost card in chats */
.feed-share-dialog {
    width: min(620px, 100%);
    gap: 16px !important;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    max-height: calc(var(--vvh, 100dvh) - 36px);
    min-height: 0;
    overflow: hidden;
}
.feed-share-preview-card {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 14px;
    align-items: stretch;
    padding: 12px;
    border-radius: 20px;
    border: 1px solid rgba(139, 92, 246, .24);
    background: linear-gradient(135deg, rgba(139,92,246,.16), rgba(17,24,39,.36));
    box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
}
.feed-share-preview-media {
    width: 92px;
    min-height: 86px;
    border-radius: 16px;
    overflow: hidden;
    display: grid;
    place-items: center;
    background: rgba(2,6,23,.42);
    color: #c4b5fd;
    border: 1px solid rgba(255,255,255,.08);
    position: relative;
}
.feed-share-preview-media img,
.feed-share-preview-media video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.feed-share-preview-media span {
    position: absolute;
    inset: auto auto 8px 8px;
    width: 30px;
    height: 30px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    color: #fff;
    background: rgba(0,0,0,.42);
    backdrop-filter: blur(8px);
}
.feed-share-preview-main {
    min-width: 0;
    display: grid;
    align-content: center;
    gap: 5px;
}
.feed-share-preview-main b {
    color: var(--text-primary, #fff);
    font-size: 15px;
}
.feed-share-preview-main a {
    width: max-content;
    max-width: 100%;
    color: #a78bfa;
    text-decoration: none;
    font-weight: 850;
    overflow: hidden;
    text-overflow: ellipsis;
}
.feed-share-preview-main p {
    margin: 0 !important;
    color: var(--text-secondary, rgba(255,255,255,.7));
    font-size: 13px;
    line-height: 1.35;
    max-height: 3.9em;
    overflow: hidden;
}
.feed-share-dialog .feed-share-search {
    height: 48px;
    border-radius: 16px;
    font-weight: 750;
    background: rgba(255,255,255,.06);
}
.feed-share-dialog .feed-share-list {
    max-height: min(46vh, 360px);
}
body.theme-light .feed-share-preview-card,
[data-theme="light"] .feed-share-preview-card {
    background: linear-gradient(135deg, rgba(109,93,252,.11), rgba(255,255,255,.92));
    border-color: rgba(109,93,252,.18);
}
body.theme-light .feed-share-preview-media,
[data-theme="light"] .feed-share-preview-media {
    background: rgba(109,93,252,.08);
    border-color: rgba(109,93,252,.16);
}
body.theme-light .feed-share-preview-main p,
[data-theme="light"] .feed-share-preview-main p {
    color: rgba(15,23,42,.62);
}

.message-feed-share-card {
    width: min(360px, 72vw);
    display: grid;
    gap: 10px;
    overflow: hidden;
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,.16);
    background: linear-gradient(145deg, rgba(255,255,255,.13), rgba(255,255,255,.055));
    box-shadow: inset 0 1px 0 rgba(255,255,255,.12);
}
/* Shared source cards show recipient-authorized content inside the chat bubble. */
.message-feed-share-card.message-source-card {
    width: min(360px, 72vw);
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    padding: 14px;
    gap: 8px;
    border-color: var(--border-dark);
    background: var(--bg-secondary);
    color: var(--text);
}
.message-source-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; color: var(--primary-text); background: var(--primary-light); }
.message-source-icon svg { width: 23px; height: 23px; }
.message-source-kind { font-size: 11px; line-height: 1.4; font-weight: 700; color: var(--text-secondary); }
.message-source-content { display: grid; gap: 8px; min-width: 0; }
.message-source-title { font-size: 15px; line-height: 1.35; overflow-wrap: anywhere; }
.message-source-author { font-size: 12px; line-height: 1.4; font-weight: 700; color: var(--primary-text); overflow-wrap: anywhere; }
.message-source-body { margin: 0; font-size: 14px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.message-source-hint,
.message-source-meta,
.message-source-status { color: var(--text-secondary); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.message-source-media-count { position: absolute; right: 8px; bottom: 8px; padding: 3px 7px; border-radius: 999px; background: rgba(0,0,0,.65); color: #fff; font-size: 12px; font-weight: 700; }
.message-source-price { color: var(--text); font-size: 18px; line-height: 1.35; font-weight: 800; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.message-source-media { position: relative; min-width: 0; max-width: 100%; overflow: hidden; border-radius: 12px; background: var(--bg); }
.message-source-media img,
.message-source-media video { display: block; width: 100%; max-height: 260px; object-fit: contain; }
.message-source-card .message-feed-share-open,
.message-source-retry {
    min-height: 44px;
    max-width: 100%;
    margin-top: 3px;
    padding: 10px 12px;
    border: 1px solid var(--border-dark);
    border-radius: 10px;
    background: var(--primary-light);
    color: var(--primary-text);
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    white-space: normal;
    overflow-wrap: anywhere;
    cursor: pointer;
}
.message-source-card .message-feed-share-open:hover,
.message-source-retry:hover:not(:disabled) { background: var(--bg-hover); }
.message-source-card .message-feed-share-open:focus-visible,
.message-source-retry:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.message-source-retry:disabled { opacity: .6; cursor: default; }
.message-source-card[data-content-state="loading"] .message-source-status { min-height: 44px; display: flex; align-items: center; gap: 8px; }
.feed-share-preview-card.content-share-preview {
    display: block;
    flex: 0 1 auto;
    min-height: 0;
    min-width: 0;
    max-height: min(240px, 28dvh);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0;
    color: var(--text);
    background: var(--bg-secondary);
    border-color: var(--border);
}
.content-share-preview .message-source-card { width: 100%; border: 0; border-radius: inherit; box-shadow: none; }
.content-share-preview .message-source-body { margin: 0; font-size: 14px; }
.content-share-preview .message-source-media img,
.content-share-preview .message-source-media video { max-height: 160px; }
.content-share-preview p { margin: 6px 0 0; color: var(--text-secondary); font-size: 13px; line-height: 1.5; }
.message.sent .message-feed-share-card {
    border-color: rgba(255,255,255,.28);
    background: linear-gradient(145deg, rgba(255,255,255,.16), rgba(255,255,255,.08));
}
.message-feed-share-head {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    padding: 12px 12px 0;
}
.message-feed-share-mark {
    width: 38px;
    height: 38px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: rgba(139,92,246,.22);
    color: #ddd6fe;
}
.message-feed-share-head b {
    display: block;
    color: inherit;
    font-size: 14px;
    line-height: 1.2;
}
.message-feed-share-author,
.message-feed-share-profile,
.message-feed-share-open {
    border: 0;
    padding: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font-weight: 850;
    text-align: left;
}
.message-feed-share-author {
    display: inline-block;
    margin-top: 2px;
    opacity: .9;
    font-size: 13px;
}
.message-feed-share-media {
    width: calc(100% - 24px);
    margin: 0 12px;
    min-height: 150px;
    max-height: 240px;
    border: 0;
    border-radius: 16px;
    padding: 0;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    background: rgba(0,0,0,.22);
}
.message-feed-share-media img,
.message-feed-share-media video {
    width: 100%;
    height: 100%;
    max-height: 240px;
    object-fit: cover;
    display: block;
}
.message-feed-share-play {
    position: absolute;
    left: 12px;
    bottom: 12px;
    width: 38px;
    height: 38px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    color: #fff;
    background: rgba(0,0,0,.44);
    backdrop-filter: blur(8px);
}
.message-feed-share-text {
    padding: 0 12px;
    color: inherit;
    line-height: 1.45;
    word-break: break-word;
}
.message-feed-share-text.muted {
    opacity: .72;
}
.message-feed-share-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 0 12px 12px;
}
.message-feed-share-actions button {
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,.18);
    background: rgba(255,255,255,.09);
    color: inherit;
    font-size: 12px;
    font-weight: 900;
}
.message-feed-share-actions button:hover,
.message-feed-share-actions button:focus-visible {
    background: rgba(139,92,246,.24);
    border-color: rgba(196,181,253,.42);
}
.message.received .message-feed-share-card {
    background: linear-gradient(145deg, rgba(139,92,246,.13), rgba(15,23,42,.05));
    border-color: rgba(139,92,246,.18);
}
body.theme-light .message-feed-share-card,
[data-theme="light"] .message-feed-share-card {
    background: linear-gradient(145deg, rgba(109,93,252,.12), rgba(255,255,255,.92));
    border-color: rgba(109,93,252,.16);
}
body.theme-light .message-feed-share-actions button,
[data-theme="light"] .message-feed-share-actions button {
    background: rgba(109,93,252,.08);
    border-color: rgba(109,93,252,.16);
}
@media (max-width: 560px) {
    .feed-share-preview-card { grid-template-columns: 76px minmax(0, 1fr); gap: 10px; }
    .feed-share-preview-media { width: 76px; min-height: 76px; border-radius: 14px; }
    .message-feed-share-card { width: min(330px, 76vw); }
    .message-feed-share-media { min-height: 132px; }
}

/* keep post media viewer comments readable after opening comments from a wall photo */
.feed-post-media-viewer .profile-photo-comments-panel {
    right: 0 !important;
    left: auto !important;
    width: min(420px, 100vw) !important;
    max-width: 100vw !important;
    z-index: 3 !important;
}
@media (max-width: 760px) {
    .feed-post-media-viewer .profile-photo-comments-panel {
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        max-height: 52vh !important;
        border-radius: 24px 24px 0 0 !important;
    }
}

/* Stage 30Q.5.13 — stable photo comments drawer and full repost card like wall post */
html body .feed-post-media-viewer > .profile-photo-comments-panel {
    position: absolute !important;
    top: 86px !important;
    right: 24px !important;
    left: auto !important;
    bottom: 104px !important;
    width: min(430px, calc(100vw - 48px)) !important;
    max-width: calc(100vw - 48px) !important;
    min-width: 320px !important;
    display: grid !important;
    grid-template-rows: minmax(0, 1fr) auto !important;
    background: rgba(13, 15, 24, .97) !important;
    border: 1px solid rgba(139, 92, 246, .22) !important;
    border-radius: 24px !important;
    box-shadow: 0 24px 90px rgba(0, 0, 0, .42), inset 0 1px 0 rgba(255,255,255,.06) !important;
    z-index: 10 !important;
    overflow: hidden !important;
    backdrop-filter: blur(18px) !important;
}
html body .feed-post-media-viewer > .profile-photo-comments-panel.hidden {
    display: none !important;
}
html body .feed-post-media-viewer .profile-photo-comments-list {
    display: block !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    padding: 18px !important;
    color: #fff !important;
}
html body .feed-post-media-viewer .profile-photo-comments-list .feed-comment {
    display: grid !important;
    grid-template-columns: 38px minmax(0, 1fr) !important;
    gap: 10px !important;
    padding: 10px 0 !important;
    border-bottom: 1px solid rgba(255,255,255,.07) !important;
    color: rgba(255,255,255,.9) !important;
}
html body .feed-post-media-viewer .profile-photo-comments-list .feed-comment:last-child {
    border-bottom: 0 !important;
}
html body .feed-post-media-viewer .profile-photo-comments-list .feed-comment-body,
html body .feed-post-media-viewer .profile-photo-comments-list .feed-comment-text,
html body .feed-post-media-viewer .profile-photo-comments-list .feed-comment p {
    color: rgba(255,255,255,.9) !important;
}
html body .feed-post-media-viewer .profile-photo-comments-list .feed-comment-author,
html body .feed-post-media-viewer .profile-photo-comments-list [data-feed-profile-link] {
    color: #c4b5fd !important;
    font-weight: 900 !important;
}
html body .feed-post-media-viewer .profile-photo-comments-list .feed-empty-mini {
    color: rgba(255,255,255,.68) !important;
    padding: 16px !important;
    text-align: center !important;
}
html body .feed-post-media-viewer .profile-photo-comment-form.feed-viewer-comment-form {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 52px !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom)) !important;
    border-top: 1px solid rgba(255,255,255,.08) !important;
    background: rgba(15, 16, 24, .98) !important;
}
html body .feed-post-media-viewer .profile-photo-comment-form.feed-viewer-comment-form input[name="body"] {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    height: 48px !important;
    border-radius: 999px !important;
    border: 1px solid rgba(255,255,255,.12) !important;
    background: rgba(255,255,255,.08) !important;
    color: #fff !important;
    padding: 0 18px !important;
    font-weight: 800 !important;
    box-sizing: border-box !important;
}
html body .feed-post-media-viewer .profile-photo-comment-form.feed-viewer-comment-form input[name="body"]::placeholder {
    color: rgba(255,255,255,.48) !important;
}
html body .feed-post-media-viewer .profile-photo-comment-form.feed-viewer-comment-form .profile-photo-comment-send {
    display: grid !important;
    place-items: center !important;
    width: 52px !important;
    min-width: 52px !important;
    height: 48px !important;
    border-radius: 999px !important;
    border: 0 !important;
    background: linear-gradient(135deg, #6d5dfc, #8b5cf6) !important;
    color: #fff !important;
    box-shadow: 0 12px 34px rgba(109,93,252,.35) !important;
}
@media (max-width: 760px) {
    html body .feed-post-media-viewer > .profile-photo-comments-panel {
        top: auto !important;
        right: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        height: min(58vh, 520px) !important;
        border-radius: 26px 26px 0 0 !important;
    }
}

.feed-share-dialog {
    width: min(680px, calc(100vw - 28px)) !important;
}
.feed-share-preview-card.feed-share-preview-post {
    display: block !important;
    padding: 16px !important;
    border-radius: 24px !important;
    background: linear-gradient(145deg, rgba(22, 25, 38, .96), rgba(33, 26, 58, .92)) !important;
    border: 1px solid rgba(139,92,246,.28) !important;
    color: #fff !important;
    box-shadow: 0 18px 60px rgba(0,0,0,.24), inset 0 1px 0 rgba(255,255,255,.07) !important;
}
.feed-share-preview-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 30px;
    padding: 0 12px;
    border-radius: 999px;
    color: #ddd6fe;
    background: rgba(139,92,246,.16);
    font-weight: 900;
    margin-bottom: 12px;
}
.feed-share-preview-label .feed-ui-icon {
    width: 17px;
    height: 17px;
}
.feed-share-preview-post-head {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    margin-bottom: 10px;
}
.feed-share-preview-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: #fff;
    background: linear-gradient(135deg, #6d5dfc, #8b5cf6);
    font-weight: 1000;
    background-size: cover;
    background-position: center;
    box-shadow: 0 0 0 3px rgba(139,92,246,.22);
}
.feed-share-preview-post-head a {
    display: inline-block;
    color: #c4b5fd !important;
    text-decoration: none;
    font-weight: 950;
}
.feed-share-preview-post-head small {
    display: block;
    margin-top: 2px;
    color: rgba(255,255,255,.58);
    font-weight: 750;
}
.feed-share-preview-post-text {
    color: rgba(255,255,255,.9) !important;
    line-height: 1.45;
    font-weight: 700;
    margin: 8px 0 12px;
    word-break: break-word;
}
.feed-share-preview-post-media {
    display: grid;
    gap: 8px;
    overflow: hidden;
    border-radius: 18px;
}
.feed-share-preview-post-media.count-1 { grid-template-columns: 1fr; }
.feed-share-preview-post-media.count-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.feed-share-preview-post-media.count-3,
.feed-share-preview-post-media.count-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.feed-share-preview-post-media-item {
    position: relative;
    min-height: 120px;
    max-height: 280px;
    overflow: hidden;
    border-radius: 16px;
    background: rgba(2,6,23,.44);
}
.feed-share-preview-post-media.count-1 .feed-share-preview-post-media-item { min-height: 220px; }
.feed-share-preview-post-media-item img,
.feed-share-preview-post-media-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.feed-share-preview-post-media-item span {
    position: absolute;
    left: 12px;
    bottom: 12px;
    min-width: 34px;
    height: 34px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    color: #fff;
    background: rgba(0,0,0,.45);
    backdrop-filter: blur(8px);
    font-weight: 900;
}
body.theme-light .feed-share-preview-card.feed-share-preview-post,
[data-theme="light"] .feed-share-preview-card.feed-share-preview-post {
    background: linear-gradient(145deg, #fff, #f4f0ff) !important;
    color: #101827 !important;
    border-color: rgba(109,93,252,.18) !important;
}
body.theme-light .feed-share-preview-post-text,
[data-theme="light"] .feed-share-preview-post-text {
    color: rgba(15,23,42,.86) !important;
}
body.theme-light .feed-share-preview-post-head small,
[data-theme="light"] .feed-share-preview-post-head small {
    color: rgba(15,23,42,.56) !important;
}

.message.feed-share-message {
    padding: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    border: 0 !important;
    max-width: min(620px, 92vw) !important;
    color: var(--text-primary, #fff) !important;
}
.message.feed-share-message .message-content {
    padding: 0 !important;
}
.message.feed-share-message .message-time {
    margin: 4px 10px 0 !important;
    color: var(--text-muted, rgba(255,255,255,.52)) !important;
}
.message-feed-share-card.message-feed-post-card {
    width: min(560px, 88vw) !important;
    display: block !important;
    padding: 14px !important;
    border-radius: 24px !important;
    border: 1px solid rgba(139,92,246,.22) !important;
    background: linear-gradient(145deg, rgba(22, 25, 38, .98), rgba(31, 28, 48, .96)) !important;
    color: #fff !important;
    box-shadow: 0 14px 50px rgba(0,0,0,.24), inset 0 1px 0 rgba(255,255,255,.06) !important;
    overflow: hidden !important;
}
.message-wrap.sent .message-feed-share-card.message-feed-post-card {
    background: linear-gradient(145deg, rgba(29, 25, 54, .98), rgba(37, 31, 66, .96)) !important;
}
.message-feed-forward-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 30px;
    padding: 0 12px;
    margin-bottom: 12px;
    border-radius: 999px;
    background: rgba(139,92,246,.16);
    color: #ddd6fe;
    font-weight: 950;
    font-size: 13px;
}
.message-feed-forward-label svg {
    width: 17px;
    height: 17px;
}
.message-feed-post-head {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    margin-bottom: 10px;
}
.message-feed-post-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 0;
    display: grid;
    place-items: center;
    color: #fff;
    background: linear-gradient(135deg, #6d5dfc, #8b5cf6);
    background-size: cover;
    background-position: center;
    font-weight: 1000;
    cursor: pointer;
    box-shadow: 0 0 0 3px rgba(139,92,246,.2);
}
.message-feed-post-author-line {
    min-width: 0;
}
.message-feed-post-author-line .message-feed-share-author,
.message-feed-post-author-line .message-feed-share-author-static {
    display: inline-block;
    color: #c4b5fd !important;
    font-weight: 1000 !important;
    text-decoration: none;
    font-size: 15px;
}
.message-feed-post-author-line small {
    display: block;
    margin-top: 2px;
    color: rgba(255,255,255,.55);
    font-weight: 750;
}
.message-feed-post-text {
    margin: 10px 0 12px;
    color: rgba(255,255,255,.92) !important;
    font-weight: 700;
    line-height: 1.45;
    word-break: break-word;
}
.message-feed-post-text.muted {
    color: rgba(255,255,255,.58) !important;
}
.message-feed-post-media-grid {
    display: grid;
    gap: 8px;
    margin: 10px 0 0;
    border-radius: 18px;
    overflow: hidden;
}
.message-feed-post-media-grid.count-1 { grid-template-columns: 1fr; }
.message-feed-post-media-grid.count-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.message-feed-post-media-grid.count-3,
.message-feed-post-media-grid.count-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.message-feed-post-media {
    position: relative;
    display: block;
    border: 0;
    padding: 0;
    min-height: 128px;
    max-height: 300px;
    overflow: hidden;
    cursor: pointer;
    background: rgba(2,6,23,.42);
}
.message-feed-post-media-grid.count-1 .message-feed-post-media {
    min-height: 220px;
    border-radius: 18px;
}
.message-feed-post-media img,
.message-feed-post-media video {
    width: 100%;
    height: 100%;
    max-height: 300px;
    object-fit: cover;
    display: block;
}
.message-feed-post-actions {
    display: flex !important;
    gap: 8px !important;
    flex-wrap: wrap !important;
    padding: 12px 0 0 !important;
}
.message-feed-post-actions button {
    min-height: 36px !important;
    padding: 0 13px !important;
    border-radius: 999px !important;
    border: 1px solid rgba(139,92,246,.26) !important;
    background: rgba(139,92,246,.12) !important;
    color: #ddd6fe !important;
    font-weight: 950 !important;
    cursor: pointer !important;
}
.message-feed-post-actions button:hover,
.message-feed-post-actions button:focus-visible {
    background: rgba(139,92,246,.22) !important;
    border-color: rgba(196,181,253,.42) !important;
}
/* ===== Story card inside a chat bubble =====
   A feed repost is a wide landscape card; a story is a vertical 9:16 clip, so
   the same 560px layout left huge empty side rails around the media and made an
   ordinary reply look like a full-width block.
   Only GEOMETRY is overridden here — background, text colours and both themes
   keep coming from .message-feed-share-card, so light/dark and the repost card
   itself are untouched. !important mirrors the base rules, which use it too. */
.message-feed-share-card.message-feed-post-card.story-share-card {
    width: min(262px, 66vw) !important;
    /* No card padding: the preview must run edge to edge like a Telegram story
       card. The header and the caption carry their own insets instead. */
    padding: 0 !important;
    border-radius: 20px !important;
}
/* Every declaration below carries !important on purpose. Three later blocks
   restyle .message-feed-post-head / -avatar / -forward-label / -text with
   !important, and an !important declaration beats any non-important one no
   matter how specific the selector is. Without the flag the story card silently
   fell back to the feed repost proportions. */
.story-share-card .story-share-head {
    padding: 9px 11px 8px !important;
}
.story-share-card .message-feed-forward-label {
    min-height: 0 !important;
    padding: 0 !important;
    margin-bottom: 6px !important;
    gap: 6px !important;
    background: none !important;
    font-size: 12px !important;
}
.story-share-card .message-feed-forward-label svg {
    width: 14px !important;
    height: 14px !important;
}
.story-share-card .message-feed-post-head {
    grid-template-columns: 26px minmax(0, 1fr) !important;
    gap: 8px !important;
    margin-bottom: 0 !important;
}
.story-share-card .message-feed-post-avatar {
    width: 26px !important;
    height: 26px !important;
    font-size: 11px !important;
    box-shadow: none !important;
}
.story-share-card .message-feed-post-author-line .message-feed-share-author {
    display: block !important;
    overflow: hidden !important;
    font-size: 13.5px !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}
/* Full-bleed preview. Portrait 3/4 keeps the bubble short while object-fit:
   cover fills the whole width — the old landscape strip left side rails. */
/* !important is required, not cosmetic: a later block (search for
   "min-height: 150px !important" on .message-feed-post-media) clamps the feed
   preview to 150–210px. Without the flag the story preview inherits that clamp
   and stops filling the card. These selectors are more specific, so they win
   regardless of source order. */
.story-share-card .message-feed-post-media-grid {
    margin: 0 !important;
    border-radius: 0 !important;
}
/* The frame must be shown whole: no fixed aspect-ratio and no cover crop, so
   the box takes the height the media actually has. A portrait 9:16 story fits
   inside the cap (262 * 16/9 ≈ 466px); anything taller than the cap is scaled
   down by object-fit: contain instead of being cut. */
.story-share-card .message-feed-post-media-grid.count-1 .message-feed-post-media,
.story-share-card .message-feed-post-media {
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    aspect-ratio: auto !important;
    border-radius: 0 !important;
}
.story-share-card .message-feed-post-media img,
.story-share-card .message-feed-post-media video {
    width: 100% !important;
    height: auto !important;
    max-height: 470px !important;
    object-fit: contain !important;
}
.story-share-card .story-share-foot {
    padding: 8px 11px 10px !important;
}
.story-share-card .message-feed-post-text {
    margin: 0 !important;
    max-height: none !important;
    font-size: 13px !important;
    line-height: 1.4 !important;
}
.story-share-card .story-share-foot .message-feed-post-text + .message-feed-post-text {
    margin-top: 6px !important;
}

/* Shared stories: transparent forwarding context above a full-bleed preview.
   The normal/saved text skins exclude this kind below/above; the scoped IDs
   also beat legacy feed-card theme rules without touching reposts or replies. */
#action-sheet-message-preview:has(.story-share-card[data-story-kind="share"]) {
    /* This preview sits on the same dark scrim in every theme, not on the
       light-theme chat surface. A small text shadow covers varied wallpaper. */
    --text: var(--selected-preview-text);
    --text-secondary: var(--selected-preview-text);
    --text-muted: var(--selected-preview-muted);
    text-shadow: 0 1px 3px rgba(2, 6, 23, .9);
}
#action-sheet-message-preview .message:has(.story-share-card[data-story-kind="share"]),
#chat-active #chat-messages .message:has(.story-share-card[data-story-kind="share"]) {
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    color: var(--text) !important;
}
#action-sheet-message-preview .story-share-card[data-story-kind="share"],
#chat-messages .story-share-card[data-story-kind="share"] {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    color: var(--text) !important;
}
#action-sheet-message-preview .story-share-card[data-story-kind="share"] .story-share-head,
#chat-messages .story-share-card[data-story-kind="share"] .story-share-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    padding: 4px 0 8px !important;
    background: transparent !important;
}
#action-sheet-message-preview .story-share-card[data-story-kind="share"] .message-feed-forward-label,
#chat-messages .story-share-card[data-story-kind="share"] .message-feed-forward-label {
    margin-bottom: 0 !important;
    max-width: 100%;
    overflow-wrap: anywhere;
    background: transparent !important;
    color: var(--text-secondary) !important;
}
#action-sheet-message-preview .story-share-card[data-story-kind="share"] .message-feed-post-head,
#chat-messages .story-share-card[data-story-kind="share"] .message-feed-post-head {
    flex: 1 1 100px;
    min-width: 0;
}
#action-sheet-message-preview .story-share-card[data-story-kind="share"] .message-feed-share-author,
#chat-messages .story-share-card[data-story-kind="share"] .message-feed-share-author {
    max-width: 100%;
    text-align: start;
    color: var(--text-secondary) !important;
}
#action-sheet-message-preview .story-share-card[data-story-kind="share"] .message-feed-post-media-grid,
#chat-messages .story-share-card[data-story-kind="share"] .message-feed-post-media-grid {
    border-radius: 18px !important;
}
#action-sheet-message-preview .story-share-card[data-story-kind="share"] .message-feed-post-text,
#chat-messages .story-share-card[data-story-kind="share"] .message-feed-post-text {
    color: inherit !important;
}
#action-sheet-message-preview .message:has(.story-share-card[data-story-kind="share"]) .message-time,
#chat-active #chat-messages .message:has(.story-share-card[data-story-kind="share"]) .message-time {
    color: var(--text-muted) !important;
}

/* A reply is a message with a small story reference, not a second full story.
   Keep the existing snapshot/viewer hooks and palette. The media overrides need
   !important because the shared feed/story media rules above use it as well. */
.story-share-card[data-story-kind="reply"] .story-reply-reference {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
}
.story-share-card[data-story-kind="reply"] .story-reply-context {
    min-width: 0;
}
.story-share-card[data-story-kind="reply"] .message-feed-forward-label {
    display: block;
    margin-bottom: 0 !important;
    overflow-wrap: anywhere;
    line-height: 1.35;
}
.story-share-card[data-story-kind="reply"] .message-feed-share-author {
    max-width: 100%;
    min-height: 32px;
    text-align: start;
}
.story-share-card[data-story-kind="reply"] .message-feed-post-media {
    width: 44px !important;
    height: 52px !important;
    border-radius: 8px !important;
}
.story-share-card[data-story-kind="reply"] .message-feed-post-media img,
.story-share-card[data-story-kind="reply"] .message-feed-post-media video {
    width: 100% !important;
    height: 100% !important;
    max-height: 52px !important;
}
.story-share-card + .story-message-text {
    padding: 8px 11px;
    /* The renderer already emits <br>; preserving raw CRLF doubles breaks. */
    white-space: normal;
    overflow-wrap: anywhere;
    font: inherit;
    color: inherit;
}

body.theme-light .message-feed-share-card.message-feed-post-card,
[data-theme="light"] .message-feed-share-card.message-feed-post-card {
    background: linear-gradient(145deg, #ffffff, #f5f1ff) !important;
    color: #101827 !important;
    border-color: rgba(109,93,252,.18) !important;
}
body.theme-light .message.feed-share-message .message-time,
[data-theme="light"] .message.feed-share-message .message-time {
    color: rgba(15,23,42,.52) !important;
}
body.theme-light .message-feed-post-text,
[data-theme="light"] .message-feed-post-text {
    color: rgba(15,23,42,.88) !important;
}
body.theme-light .message-feed-post-text.muted,
[data-theme="light"] .message-feed-post-text.muted,
body.theme-light .message-feed-post-author-line small,
[data-theme="light"] .message-feed-post-author-line small {
    color: rgba(15,23,42,.56) !important;
}
@media (max-width: 560px) {
    .message.feed-share-message { max-width: 92vw !important; }
    .message-feed-share-card.message-feed-post-card { width: min(420px, 86vw) !important; padding: 12px !important; border-radius: 22px !important; }
    .message-feed-post-media-grid.count-1 .message-feed-post-media { min-height: 180px; }
    .message-feed-post-media { min-height: 116px; }
    .feed-share-preview-post-media.count-1 .feed-share-preview-post-media-item { min-height: 180px; }
}

/* Stage 30Q.5.14 — compact repost cards, readable share dialog, profile-style media comments */
.feed-post-focus {
    animation: feedPostFocusPulse 2.8s ease both;
}
@keyframes feedPostFocusPulse {
    0%, 100% { box-shadow: var(--card-shadow, 0 16px 50px rgba(0,0,0,.16)); }
    18%, 70% { box-shadow: 0 0 0 3px rgba(139,92,246,.38), 0 22px 70px rgba(139,92,246,.24); }
}

html body .feed-post-media-viewer > .profile-photo-comments-panel {
    position: fixed !important;
    top: 84px !important;
    right: 22px !important;
    bottom: 84px !important;
    left: auto !important;
    width: min(390px, calc(100vw - 44px)) !important;
    height: auto !important;
    min-width: 0 !important;
    border-radius: 28px !important;
    border: 1px solid rgba(255,255,255,.12) !important;
    background: rgba(18, 18, 25, .96) !important;
    box-shadow: 0 30px 90px rgba(0,0,0,.46) !important;
    backdrop-filter: blur(22px) !important;
    display: grid !important;
    grid-template-rows: minmax(0, 1fr) auto !important;
    overflow: hidden !important;
    z-index: 10080 !important;
}
html body .feed-post-media-viewer > .profile-photo-comments-panel.hidden { display: none !important; }
html body .feed-post-media-viewer .profile-photo-comments-list {
    padding: 18px !important;
    overflow-y: auto !important;
    min-height: 0 !important;
    display: grid !important;
    align-content: start !important;
    gap: 14px !important;
}
html body .feed-post-media-viewer .profile-photo-comment.feed-viewer-photo-comment {
    display: grid !important;
    grid-template-columns: 38px minmax(0, 1fr) !important;
    gap: 10px !important;
    padding: 0 !important;
    color: #fff !important;
}
html body .feed-post-media-viewer .profile-photo-comment-avatar {
    width: 38px !important;
    height: 38px !important;
    border-radius: 50% !important;
    display: grid !important;
    place-items: center !important;
    overflow: hidden !important;
    background: linear-gradient(135deg, #6d5dfc, #8b5cf6) !important;
    color: #fff !important;
    font-weight: 1000 !important;
}
html body .feed-post-media-viewer .profile-photo-comment-avatar img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}
html body .feed-post-media-viewer .profile-photo-comment-author {
    appearance: none !important;
    border: 0 !important;
    background: transparent !important;
    padding: 0 !important;
    color: #c4b5fd !important;
    font-weight: 950 !important;
    cursor: pointer !important;
}
html body .feed-post-media-viewer .profile-photo-comment small {
    display: block !important;
    margin-top: 2px !important;
    color: rgba(255,255,255,.48) !important;
    font-weight: 700 !important;
}
html body .feed-post-media-viewer .profile-photo-comment p {
    margin: 6px 0 0 !important;
    color: rgba(255,255,255,.88) !important;
    line-height: 1.38 !important;
    word-break: break-word !important;
}
html body .feed-post-media-viewer .profile-photo-no-comments {
    min-height: 120px !important;
    display: grid !important;
    place-items: center !important;
    color: rgba(255,255,255,.56) !important;
    font-weight: 850 !important;
}
html body .feed-post-media-viewer .profile-photo-comment-form.feed-viewer-comment-form {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 50px !important;
    gap: 10px !important;
    align-items: center !important;
    padding: 14px 16px calc(14px + env(safe-area-inset-bottom)) !important;
    border-top: 1px solid rgba(255,255,255,.08) !important;
    background: rgba(13, 13, 19, .98) !important;
}
html body .feed-post-media-viewer .profile-photo-comment-form.feed-viewer-comment-form input[name="body"] {
    width: 100% !important;
    min-width: 0 !important;
    height: 48px !important;
    border-radius: 999px !important;
    border: 1px solid rgba(255,255,255,.12) !important;
    background: rgba(255,255,255,.08) !important;
    color: #fff !important;
    padding: 0 18px !important;
    font-weight: 800 !important;
    box-sizing: border-box !important;
}
html body .feed-post-media-viewer .profile-photo-comment-form.feed-viewer-comment-form .profile-photo-comment-send {
    width: 50px !important;
    height: 48px !important;
    min-width: 50px !important;
    border-radius: 999px !important;
    display: grid !important;
    place-items: center !important;
    border: 0 !important;
    background: linear-gradient(135deg, #6d5dfc, #8b5cf6) !important;
    color: #fff !important;
    box-shadow: 0 12px 34px rgba(109,93,252,.36) !important;
}
@media (max-width: 760px) {
    html body .feed-post-media-viewer > .profile-photo-comments-panel {
        top: auto !important;
        right: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: min(58vh, 520px) !important;
        border-radius: 28px 28px 0 0 !important;
    }
}

.feed-share-dialog {
    width: min(640px, calc(100vw - 26px)) !important;
}
.feed-share-preview-card.feed-share-preview-post {
    max-height: min(46vh, 420px) !important;
    overflow: auto !important;
    background: var(--card-bg, rgba(20,24,38,.96)) !important;
    color: var(--text-primary, #fff) !important;
    border-color: rgba(139,92,246,.24) !important;
}
.feed-share-preview-post-text {
    color: var(--text-primary, #fff) !important;
    font-weight: 800 !important;
}
.feed-share-preview-post-head small {
    color: var(--text-muted, rgba(255,255,255,.58)) !important;
}
body.theme-light .feed-share-preview-card.feed-share-preview-post,
[data-theme="light"] .feed-share-preview-card.feed-share-preview-post {
    background: #fff !important;
    color: #111827 !important;
    border-color: rgba(109,93,252,.18) !important;
    box-shadow: 0 18px 55px rgba(15,23,42,.12) !important;
}
body.theme-light .feed-share-preview-post-text,
[data-theme="light"] .feed-share-preview-post-text {
    color: #111827 !important;
}
body.theme-light .feed-share-preview-label,
[data-theme="light"] .feed-share-preview-label {
    color: #5b4df3 !important;
    background: rgba(109,93,252,.12) !important;
}
body.theme-light .feed-share-preview-post-head small,
[data-theme="light"] .feed-share-preview-post-head small {
    color: rgba(15,23,42,.58) !important;
}

.message.feed-share-message {
    max-width: min(460px, 82vw) !important;
}
.message-feed-share-card.message-feed-post-card {
    width: min(430px, 80vw) !important;
    padding: 12px !important;
    border-radius: 20px !important;
    background: var(--card-bg, rgba(20,24,38,.98)) !important;
    color: var(--text-primary, #fff) !important;
    border: 1px solid rgba(139,92,246,.22) !important;
    box-shadow: 0 12px 36px rgba(0,0,0,.18), inset 0 1px 0 rgba(255,255,255,.05) !important;
}
.message-wrap.sent .message-feed-share-card.message-feed-post-card {
    background: var(--card-bg, rgba(24,22,42,.98)) !important;
}
.message-feed-forward-label {
    margin-bottom: 10px !important;
    font-size: 12px !important;
}
.message-feed-post-head {
    grid-template-columns: 40px minmax(0, 1fr) !important;
    gap: 10px !important;
    margin-bottom: 8px !important;
}
.message-feed-post-avatar {
    width: 40px !important;
    height: 40px !important;
}
.message-feed-post-text {
    color: var(--text-primary, #fff) !important;
    font-size: 14px !important;
    line-height: 1.38 !important;
    margin: 8px 0 10px !important;
    max-height: 7.1em !important;
    overflow: hidden !important;
}
.message-feed-post-media-grid.count-1 .message-feed-post-media {
    min-height: 150px !important;
    max-height: 210px !important;
}
.message-feed-post-media {
    min-height: 96px !important;
    max-height: 190px !important;
    border-radius: 16px !important;
}
.message-feed-post-media img,
.message-feed-post-media video {
    max-height: 210px !important;
}
.message-feed-post-actions {
    padding-top: 10px !important;
    gap: 6px !important;
}
.message-feed-post-actions button {
    min-height: 32px !important;
    padding: 0 11px !important;
    font-size: 12px !important;
}
body.theme-light .message-feed-share-card.message-feed-post-card,
[data-theme="light"] .message-feed-share-card.message-feed-post-card {
    background: #fff !important;
    color: #111827 !important;
    border-color: rgba(109,93,252,.18) !important;
    box-shadow: 0 10px 28px rgba(15,23,42,.08) !important;
}
body.theme-light .message-feed-post-text,
[data-theme="light"] .message-feed-post-text,
body.theme-light .message-feed-post-author-line .message-feed-share-author,
[data-theme="light"] .message-feed-post-author-line .message-feed-share-author {
    color: #111827 !important;
}
body.theme-light .message-feed-post-author-line small,
[data-theme="light"] .message-feed-post-author-line small {
    color: rgba(15,23,42,.56) !important;
}
@media (max-width: 560px) {
    .message.feed-share-message { max-width: 86vw !important; }
    .message-feed-share-card.message-feed-post-card { width: min(360px, 82vw) !important; }
    .message-feed-post-media-grid.count-1 .message-feed-post-media { min-height: 130px !important; }
    .message-feed-post-actions button { min-height: 30px !important; padding: 0 9px !important; }
}

/* ===== Stage 30Q.5.15 — repost light theme + profile-style media comments ===== */
/* Feed post media comments must behave like the profile photo comments sheet, not a side menu. */
html body .feed-post-media-viewer > .profile-photo-comments-panel {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    bottom: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    height: min(62vh, 560px) !important;
    min-height: 260px !important;
    max-height: 62vh !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 24px 24px 0 0 !important;
    border: 1px solid rgba(255,255,255,.10) !important;
    border-left: 0 !important;
    border-right: 0 !important;
    border-bottom: 0 !important;
    background: rgba(18,18,22,.98) !important;
    box-shadow: 0 -26px 90px rgba(0,0,0,.62) !important;
    backdrop-filter: blur(22px) !important;
    -webkit-backdrop-filter: blur(22px) !important;
    display: grid !important;
    grid-template-rows: auto minmax(0, 1fr) auto !important;
    overflow: hidden !important;
    transform: none !important;
    z-index: 10090 !important;
    box-sizing: border-box !important;
}
html body .feed-post-media-viewer > .profile-photo-comments-panel.hidden { display: none !important; }
html body .feed-post-media-viewer .profile-photo-comments-list {
    padding: 16px !important;
    overflow-y: auto !important;
    max-height: none !important;
    display: grid !important;
    align-content: start !important;
    gap: 12px !important;
    background: transparent !important;
}
html body .feed-post-media-viewer .profile-photo-comment.feed-viewer-photo-comment {
    display: grid !important;
    grid-template-columns: 42px minmax(0, 1fr) !important;
    gap: 10px !important;
    padding: 0 !important;
    color: #fff !important;
}
html body .feed-post-media-viewer .profile-photo-comment-form.feed-viewer-comment-form {
    position: static !important;
    width: 100% !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 52px !important;
    gap: 10px !important;
    align-items: center !important;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom)) !important;
    border-top: 1px solid rgba(255,255,255,.08) !important;
    background: rgba(18,18,22,.99) !important;
    box-sizing: border-box !important;
}
html body .feed-post-media-viewer .profile-photo-comment-form.feed-viewer-comment-form input[name="body"] {
    height: 52px !important;
    width: 100% !important;
    min-width: 0 !important;
    border-radius: 999px !important;
    border: 1px solid rgba(255,255,255,.13) !important;
    background: rgba(255,255,255,.08) !important;
    color: #fff !important;
    padding: 0 18px !important;
    font-size: 16px !important;
    font-weight: 500 !important;
    box-sizing: border-box !important;
}
html body .feed-post-media-viewer .profile-photo-comment-form.feed-viewer-comment-form input[name="body"]:focus-visible {
    outline: 2px solid rgba(196,181,253,.85) !important;
    outline-offset: 2px;
}
html body .feed-post-media-viewer .profile-photo-comment-form.feed-viewer-comment-form .profile-photo-comment-send {
    width: 52px !important;
    height: 52px !important;
    min-width: 52px !important;
    border-radius: 999px !important;
    display: grid !important;
    place-items: center !important;
    border: 0 !important;
    background: linear-gradient(135deg, #6d5dfc, #8b5cf6) !important;
    color: #fff !important;
    box-shadow: 0 4px 16px rgba(109,93,252,.20) !important;
}
@media (min-width: 900px) {
    html body .feed-post-media-viewer > .profile-photo-comments-panel {
        left: 50% !important;
        right: auto !important;
        width: min(760px, calc(100vw - 120px)) !important;
        max-width: min(760px, calc(100vw - 120px)) !important;
        transform: translateX(-50%) !important;
        border-left: 1px solid rgba(255,255,255,.10) !important;
        border-right: 1px solid rgba(255,255,255,.10) !important;
    }
}
@media (max-width: 760px) {
    html body .feed-post-media-viewer > .profile-photo-comments-panel {
        height: min(72dvh, 620px) !important;
        max-height: 72dvh !important;
        padding-bottom: env(safe-area-inset-bottom) !important;
    }
}

/* Share dialog: readable on light theme. */
body.theme-light .feed-share-dialog,
html[data-theme="light"] body .feed-share-dialog,
[data-theme="light"] .feed-share-dialog {
    background: rgba(255,255,255,.98) !important;
    color: #111827 !important;
    border-color: rgba(109,93,252,.16) !important;
    box-shadow: 0 30px 90px rgba(15,23,42,.18) !important;
}
body.theme-light .feed-share-dialog h3,
html[data-theme="light"] body .feed-share-dialog h3,
[data-theme="light"] .feed-share-dialog h3,
body.theme-light .feed-share-preview-post-head a,
html[data-theme="light"] body .feed-share-preview-post-head a,
[data-theme="light"] .feed-share-preview-post-head a {
    color: #111827 !important;
}
body.theme-light .feed-share-dialog .feed-dialog-x,
html[data-theme="light"] body .feed-share-dialog .feed-dialog-x,
[data-theme="light"] .feed-share-dialog .feed-dialog-x {
    color: #64748b !important;
    background: rgba(15,23,42,.06) !important;
}
body.theme-light .feed-share-preview-card.feed-share-preview-post,
html[data-theme="light"] body .feed-share-preview-card.feed-share-preview-post,
[data-theme="light"] .feed-share-preview-card.feed-share-preview-post {
    background: linear-gradient(145deg, #ffffff, #f6f2ff) !important;
    color: #111827 !important;
    border: 1px solid rgba(109,93,252,.18) !important;
    box-shadow: 0 18px 55px rgba(15,23,42,.12) !important;
}
body.theme-light .feed-share-preview-post-text,
html[data-theme="light"] body .feed-share-preview-post-text,
[data-theme="light"] .feed-share-preview-post-text {
    color: #111827 !important;
}
body.theme-light .feed-share-dialog .feed-share-search,
html[data-theme="light"] body .feed-share-dialog .feed-share-search,
[data-theme="light"] .feed-share-dialog .feed-share-search {
    background: #fff !important;
    color: #111827 !important;
    border-color: rgba(109,93,252,.28) !important;
}
body.theme-light .feed-share-dialog .feed-share-search::placeholder,
html[data-theme="light"] body .feed-share-dialog .feed-share-search::placeholder,
[data-theme="light"] .feed-share-dialog .feed-share-search::placeholder,
body.theme-light .feed-share-dialog .feed-empty-mini,
html[data-theme="light"] body .feed-share-dialog .feed-empty-mini,
[data-theme="light"] .feed-share-dialog .feed-empty-mini {
    color: rgba(15,23,42,.58) !important;
}

/* Forwarded post in chat: compact, readable on both themes, one clear action. */
.message.feed-share-message {
    max-width: min(390px, 78vw) !important;
    background: transparent !important;
    box-shadow: none !important;
    border: 0 !important;
    padding: 0 !important;
}
.message-feed-share-card.message-feed-post-card {
    width: min(370px, 76vw) !important;
    padding: 11px !important;
    border-radius: 20px !important;
    background: linear-gradient(145deg, rgba(22,25,38,.98), rgba(31,28,48,.96)) !important;
    color: #fff !important;
    border: 1px solid rgba(139,92,246,.24) !important;
    box-shadow: 0 12px 36px rgba(0,0,0,.22), inset 0 1px 0 rgba(255,255,255,.06) !important;
}
.message-feed-post-head {
    grid-template-columns: 38px minmax(0, 1fr) !important;
    gap: 9px !important;
    margin-bottom: 7px !important;
}
.message-feed-post-avatar {
    width: 38px !important;
    height: 38px !important;
}
.message-feed-forward-label {
    min-height: 28px !important;
    padding: 0 10px !important;
    margin-bottom: 9px !important;
    font-size: 12px !important;
}
.message-feed-post-text {
    color: rgba(255,255,255,.92) !important;
    font-size: 13px !important;
    line-height: 1.35 !important;
    max-height: 5.4em !important;
    overflow: hidden !important;
    margin: 7px 0 9px !important;
}
.message-feed-post-media-grid.count-1 .message-feed-post-media {
    min-height: 118px !important;
    max-height: 160px !important;
}
.message-feed-post-media {
    min-height: 86px !important;
    max-height: 150px !important;
    border-radius: 15px !important;
}
.message-feed-post-media img,
.message-feed-post-media video {
    max-height: 160px !important;
}
.message-feed-post-actions.single-action {
    padding-top: 9px !important;
    display: flex !important;
    justify-content: flex-start !important;
}
.message-feed-post-actions.single-action button.primary {
    display: inline-flex !important;
    align-items: center !important;
    gap: 7px !important;
    min-height: 34px !important;
    padding: 0 13px !important;
    border-radius: 999px !important;
    color: #fff !important;
    background: linear-gradient(135deg, #6d5dfc, #8b5cf6) !important;
    border: 0 !important;
    box-shadow: 0 10px 28px rgba(109,93,252,.26) !important;
}
.message-feed-open-icon svg,
.message-feed-open-icon .icon,
.message-feed-open-icon {
    width: 16px !important;
    height: 16px !important;
    display: inline-grid !important;
    place-items: center !important;
}
body.theme-light .message-feed-share-card.message-feed-post-card,
body.theme-light .message-wrap.sent .message-feed-share-card.message-feed-post-card,
body.theme-light .message.sent.feed-share-message .message-feed-share-card.message-feed-post-card,
html[data-theme="light"] body .message-feed-share-card.message-feed-post-card,
html[data-theme="light"] body .message-wrap.sent .message-feed-share-card.message-feed-post-card,
[data-theme="light"] .message-feed-share-card.message-feed-post-card,
[data-theme="light"] .message-wrap.sent .message-feed-share-card.message-feed-post-card {
    background: linear-gradient(145deg, #ffffff, #f6f2ff) !important;
    color: #111827 !important;
    border-color: rgba(109,93,252,.20) !important;
    box-shadow: 0 10px 28px rgba(15,23,42,.10), inset 0 1px 0 rgba(255,255,255,.8) !important;
}
body.theme-light .message-feed-post-text,
html[data-theme="light"] body .message-feed-post-text,
[data-theme="light"] .message-feed-post-text,
body.theme-light .message-feed-post-author-line .message-feed-share-author,
html[data-theme="light"] body .message-feed-post-author-line .message-feed-share-author,
[data-theme="light"] .message-feed-post-author-line .message-feed-share-author,
body.theme-light .message-feed-post-author-line .message-feed-share-author-static,
html[data-theme="light"] body .message-feed-post-author-line .message-feed-share-author-static,
[data-theme="light"] .message-feed-post-author-line .message-feed-share-author-static {
    color: #111827 !important;
}
body.theme-light .message-feed-post-author-line small,
html[data-theme="light"] body .message-feed-post-author-line small,
[data-theme="light"] .message-feed-post-author-line small {
    color: rgba(15,23,42,.58) !important;
}
body.theme-light .message-feed-forward-label,
html[data-theme="light"] body .message-feed-forward-label,
[data-theme="light"] .message-feed-forward-label {
    color: #5b4df3 !important;
    background: rgba(109,93,252,.13) !important;
}
@media (max-width: 560px) {
    .message.feed-share-message { max-width: 84vw !important; }
    .message-feed-share-card.message-feed-post-card { width: min(340px, 82vw) !important; }
    .message-feed-post-media-grid.count-1 .message-feed-post-media { min-height: 110px !important; }
}


/* Stage 30Q.5.18 — minimal viewer/comment width and repost target fix */
/* Keep the post media viewer clean: remove the dark transparent caption stripe under text. */
html body .feed-post-media-viewer .profile-photo-caption {
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    box-shadow: none !important;
    border: 0 !important;
    padding: 8px 24px !important;
    bottom: 126px !important;
}

/* On desktop the comment sheet under a post photo should use the full screen width, like the profile photo viewer. */
@media (min-width: 900px) {
    html body .feed-post-media-viewer > .profile-photo-comments-panel {
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        top: auto !important;
        width: 100vw !important;
        max-width: 100vw !important;
        height: min(58vh, 560px) !important;
        max-height: 58vh !important;
        min-width: 0 !important;
        transform: none !important;
        border-radius: 24px 24px 0 0 !important;
        border-left: 0 !important;
        border-right: 0 !important;
        border-bottom: 0 !important;
    }
}

/* Do not let the comment sheet create a second dark slab over the photo text area. */
html body .feed-post-media-viewer.comments-open .profile-photo-caption {
    background: transparent !important;
}

/* ===== Stage 30R: Telegram-style message replies ===== */
.chat-reply-inline {
    order: -1;
    flex: 0 0 100%;
    width: 100%;
    min-width: 0;
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) 28px;
    align-items: center;
    gap: 9px;
    padding: 8px 10px;
    border-radius: 16px;
    border: 1px solid color-mix(in srgb, var(--primary) 22%, transparent);
    background: color-mix(in srgb, var(--primary-light) 72%, transparent);
    box-shadow: 0 10px 24px rgba(124, 92, 255, .12);
}
.chat-reply-inline.hidden { display: none !important; }
.chat-reply-inline-icon {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 10%, transparent);
}
.chat-reply-inline-main { min-width: 0; display: grid; gap: 2px; }
.chat-reply-inline-main b {
    color: var(--primary);
    font-size: .82rem;
    line-height: 1.15;
    font-weight: 900;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.chat-reply-inline-main small {
    color: var(--text-muted);
    font-size: .78rem;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.chat-reply-inline-cancel {
    width: 26px;
    height: 26px;
    border: 0;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    font-weight: 900;
    color: var(--text-muted);
    background: transparent;
}
.chat-reply-inline-cancel:hover { color: var(--text); background: var(--bg-hover); }
.chat-input-area.reply-mode {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 8px !important;
}
.chat-input-area.reply-mode .chat-input-wrapper { flex: 1 1 180px !important; min-width: 0 !important; }
.message-reply-quote {
    width: 100%;
    max-width: 100%;
    display: grid;
    grid-template-columns: 3px minmax(0, 1fr);
    gap: 8px;
    align-items: stretch;
    margin: 0 0 7px;
    padding: 7px 9px;
    border: 0;
    border-radius: 12px;
    cursor: pointer;
    text-align: left;
    color: inherit;
    background: rgba(255,255,255,.12);
}
.message.received .message-reply-quote {
    background: color-mix(in srgb, var(--primary-light) 65%, transparent);
}
.message-reply-quote:hover { filter: brightness(1.04); }
.message-reply-line {
    width: 3px;
    border-radius: 999px;
    background: var(--primary);
}
.message-reply-copy { min-width: 0; display: grid; gap: 2px; }
.message-reply-copy b {
    color: var(--primary);
    font-size: .78rem;
    line-height: 1.15;
    font-weight: 900;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.message.sent .message-reply-copy b { color: rgba(255,255,255,.92); }
.message-reply-copy small {
    color: rgba(255,255,255,.76);
    font-size: .76rem;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.message.received .message-reply-copy small { color: var(--text-muted); }
.message.message-reply-target {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 35%, transparent), var(--shadow-md) !important;
    transition: box-shadow .18s ease;
}
body.theme-light .message-reply-quote { background: rgba(255,255,255,.18); }
body.theme-light .message.received .message-reply-quote { background: #f4f0ff; }
body.theme-light .message.sent .message-reply-copy small { color: rgba(255,255,255,.82); }
@media (max-width: 520px) {
    .chat-reply-inline { padding: 7px 8px; border-radius: 14px; }
    .chat-reply-inline-main b { font-size: .78rem; }
    .chat-reply-inline-main small { font-size: .74rem; }
}


/* ===== Stage 30R.1: reply preview must not break composer row ===== */
body[data-page="chats"] .chat-active .chat-input-area.reply-mode,
body.theme-light[data-page="chats"] .chat-active .chat-input-area.reply-mode,
body:not(.theme-light)[data-page="chats"] .chat-active .chat-input-area.reply-mode {
    display: grid !important;
    grid-template-columns: auto auto minmax(0, 1fr) auto !important;
    align-items: end !important;
    gap: 10px !important;
    flex-wrap: nowrap !important;
}

body[data-page="chats"] .chat-active .chat-reply-inline {
    position: relative !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    order: initial !important;
    flex: none !important;
    z-index: 55 !important;
    pointer-events: auto !important;
    display: grid !important;
    grid-template-columns: 28px minmax(0, 1fr) 28px !important;
    grid-column: 1 / -1 !important;
    border: 0 !important;
    border-left: 3px solid var(--primary) !important;
    border-radius: 9px !important;
    box-shadow: none !important;
}

body[data-page="chats"] .chat-active .chat-reply-inline.hidden {
    display: none !important;
}

body[data-page="chats"] .chat-active .chat-input-area.reply-mode .chat-input-wrapper {
    grid-column: auto !important;
    flex: initial !important;
    min-width: 0 !important;
}

body[data-page="chats"] .chat-active #char-counter,
body[data-page="chats"] .chat-active .chat-input-hint {
    display: none !important;
}

body[data-page="chats"] .chat-active #message-input::placeholder {
    color: transparent !important;
}

body[data-page="chats"] .chat-active.reply-mode-active.reply-mode-active .chat-messages {
    padding-bottom: 146px !important;
    scroll-padding-bottom: 154px !important;
}

@media (min-width: 1025px) {
    body[data-page="chats"] .chat-active.reply-mode-active.reply-mode-active .chat-messages {
        padding-bottom: max(146px, calc(var(--chat-composer-h, 82px) + 9px)) !important;
        scroll-padding-bottom: max(154px, calc(var(--chat-composer-h, 82px) + 17px)) !important;
    }
}

@media (max-width: 1024px) {
    body[data-page="chats"] .chat-active .chat-reply-inline {
        position: absolute !important;
        left: max(8px, env(safe-area-inset-left, 0px)) !important;
        right: max(8px, env(safe-area-inset-right, 0px)) !important;
        bottom: calc(100% + 6px) !important;
        width: auto !important;
        max-width: none !important;
        padding: 8px 9px !important;
        border-radius: 16px !important;
    }
    body[data-page="chats"] .chat-active .chat-input-area.reply-mode,
    body.theme-light[data-page="chats"] .chat-active .chat-input-area.reply-mode,
    body:not(.theme-light)[data-page="chats"] .chat-active .chat-input-area.reply-mode {
        grid-template-columns: auto auto minmax(0, 1fr) auto !important;
        gap: 7px !important;
    }
}

/* ===== Stage 30S: pinned chat message ===== */
.chat-pinned-bar {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) 32px;
    align-items: center;
    gap: 10px;
    margin: 0 16px 8px;
    padding: 9px 10px;
    border: 1px solid color-mix(in srgb, var(--primary) 32%, transparent);
    border-radius: 16px;
    background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 16%, var(--bg-secondary)), color-mix(in srgb, var(--primary) 8%, var(--bg-secondary)));
    color: var(--text-primary);
    box-shadow: 0 10px 28px rgba(0,0,0,.18);
    cursor: pointer;
    user-select: none;
}
.chat-pinned-bar.hidden { display: none !important; }
.chat-pinned-bar:hover { border-color: color-mix(in srgb, var(--primary) 55%, transparent); transform: translateY(-1px); }
.chat-pinned-icon {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 14%, transparent);
}
.chat-pinned-main { min-width: 0; display: grid; gap: 2px; }
.chat-pinned-main b {
    font-size: .84rem;
    font-weight: 900;
    color: var(--primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.chat-pinned-main small {
    color: var(--text-muted);
    font-size: .78rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.chat-pinned-unpin {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 999px;
    display: grid;
    place-items: center;
    font-size: 22px;
    line-height: 1;
    color: var(--text-muted);
    background: color-mix(in srgb, var(--bg-primary) 50%, transparent);
    cursor: pointer;
}
.chat-pinned-unpin:hover { color: var(--danger); background: color-mix(in srgb, var(--danger) 13%, transparent); }
.message.pinned-message {
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 35%, transparent), var(--shadow-md) !important;
}
body.theme-light .chat-pinned-bar {
    background: linear-gradient(135deg, #f5f0ff, #fff);
    box-shadow: 0 12px 28px rgba(98, 64, 255, .12);
}
@media (max-width: 520px) {
    .chat-pinned-bar {
        margin: 0 8px 7px;
        padding: 8px;
        grid-template-columns: 30px minmax(0, 1fr) 30px;
        border-radius: 14px;
    }
    .chat-pinned-icon { width: 30px; height: 30px; border-radius: 10px; }
    .chat-pinned-main b { font-size: .8rem; }
    .chat-pinned-main small { font-size: .74rem; }
}


/* ===== Stage 30S.1: pinned bar must sit below floating chat header ===== */
.chat-active.has-pinned-message .chat-pinned-bar {
    position: absolute !important;
    top: 74px !important;
    left: 18px !important;
    right: 18px !important;
    z-index: 43 !important;
    margin: 0 !important;
    max-width: none !important;
}
.chat-active.has-pinned-message .chat-messages {
    padding-top: 146px !important;
}
.chat-pinned-icon svg,
#sheet-pin-message svg {
    stroke-linecap: round !important;
    stroke-linejoin: round !important;
}
@media (max-width: 1024px) {
    .chat-active.has-pinned-message .chat-pinned-bar {
        top: 62px !important;
        left: 10px !important;
        right: 10px !important;
    }
    .chat-active.has-pinned-message .chat-messages {
        padding-top: 128px !important;
    }
}
@media (max-width: 520px) {
    .chat-active.has-pinned-message .chat-pinned-bar {
        top: 60px !important;
        left: 8px !important;
        right: 8px !important;
    }
    .chat-active.has-pinned-message .chat-messages {
        padding-top: 124px !important;
    }
}


/* Stage 30S.2 — pinned dialogs in chat list */
.chat-item.pinned-dialog {
    background: linear-gradient(135deg, rgba(139, 92, 246, .16), rgba(32, 198, 255, .045)) !important;
    border-color: rgba(139, 92, 246, .28) !important;
    box-shadow: inset 3px 0 0 rgba(139, 92, 246, .92), 0 10px 26px rgba(109, 93, 252, .10) !important;
}

.chat-item.pinned-dialog:hover {
    background: linear-gradient(135deg, rgba(139, 92, 246, .22), rgba(32, 198, 255, .07)) !important;
}

.chat-dialog-pin-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-right: 6px;
    border-radius: 999px;
    color: #8b5cf6;
    background: rgba(139, 92, 246, .14);
    vertical-align: -3px;
    flex: 0 0 auto;
}

.chat-dialog-pin-badge svg {
    width: 12px;
    height: 12px;
    display: block;
}

.chat-sheet-action.is-active {
    color: #8b5cf6;
    background: rgba(139, 92, 246, .13);
}

.chat-sheet-action .chat-pin-svg {
    transform: rotate(-18deg);
}

body.theme-light .chat-item.pinned-dialog {
    background: linear-gradient(135deg, rgba(139, 92, 246, .13), rgba(32, 198, 255, .045)) !important;
    border-color: rgba(109, 93, 252, .24) !important;
    box-shadow: inset 3px 0 0 rgba(109, 93, 252, .82), 0 10px 24px rgba(109, 93, 252, .09) !important;
}

body.theme-light .chat-dialog-pin-badge {
    color: #6d5dfc;
    background: rgba(109, 93, 252, .13);
}

/* ===== Stage 30T: mobile listings + light language switcher + readable danger buttons ===== */
body.theme-light .language-select {
    color: #4f46e5 !important;
}
body.theme-light .language-select {
    background-color: transparent !important;
}
body.theme-light .language-select option {
    color: #111827 !important;
    background: #fff !important;
}

.btn.danger,
button.btn.danger,
a.btn.danger,
.btn-danger,
.danger-btn,
.button-danger,
button.danger:not(.message-action-btn):not(.chat-sheet-action):not(.dropdown-item) {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
    color: #ffffff !important;
    border-color: rgba(239, 68, 68, 0.55) !important;
    box-shadow: 0 10px 22px rgba(220, 38, 38, 0.22) !important;
    text-shadow: none !important;
    opacity: 1 !important;
    filter: none !important;
}
.btn.danger svg,
button.btn.danger svg,
.btn-danger svg,
.danger-btn svg,
.button-danger svg,
button.danger:not(.message-action-btn):not(.chat-sheet-action):not(.dropdown-item) svg {
    color: #ffffff !important;
    stroke: currentColor !important;
}
.btn.danger:hover:not(:disabled),
button.btn.danger:hover:not(:disabled),
a.btn.danger:hover:not(:disabled),
.btn-danger:hover:not(:disabled),
.danger-btn:hover:not(:disabled),
.button-danger:hover:not(:disabled),
button.danger:not(.message-action-btn):not(.chat-sheet-action):not(.dropdown-item):hover:not(:disabled) {
    background: linear-gradient(135deg, #f87171 0%, #dc2626 100%) !important;
    color: #ffffff !important;
    transform: translateY(-1px);
}
.btn.danger:disabled,
button.btn.danger:disabled,
.btn-danger:disabled,
.danger-btn:disabled,
.button-danger:disabled {
    color: rgba(255, 255, 255, 0.92) !important;
    opacity: 0.62 !important;
}

@media (max-width: 640px) {
    .listings-grid,
    .profile-listings-grid {
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 12px !important;
    }

    .listing-card,
    .profile-listing-card {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }

    .listing-card-body,
    .profile-listing-body {
        min-width: 0 !important;
        padding: 12px !important;
    }

    .listing-card-actions,
    .profile-listing-card .listing-card-actions,
    .profile-listing-body .listing-card-actions,
    .profile-listing-body .listing-details-actions {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 8px !important;
        width: 100% !important;
        min-width: 0 !important;
    }

    .listing-card-actions .btn,
    .profile-listing-card .btn,
    .profile-listing-body .btn,
    .listing-details-actions .btn {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        justify-content: center !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        padding-left: 10px !important;
        padding-right: 10px !important;
        font-size: 0.82rem !important;
        line-height: 1.15 !important;
    }
}

@media (max-width: 430px) {
    .profile-listing-card .btn,
    .profile-listing-body .btn,
    .listing-card-actions .btn {
        min-height: 34px !important;
        padding-top: 7px !important;
        padding-bottom: 7px !important;
        font-size: 0.78rem !important;
    }
}


/* Stage 30T.1 — light theme fixes for feed delete dialog and forum topic composer */
body.theme-light .feed-dialog-backdrop,
html[data-theme="light"] body .feed-dialog-backdrop,
[data-theme="light"] .feed-dialog-backdrop {
    background: rgba(15, 23, 42, .28) !important;
    backdrop-filter: blur(8px) !important;
}

body.theme-light .feed-dialog,
html[data-theme="light"] body .feed-dialog,
[data-theme="light"] .feed-dialog {
    background: #ffffff !important;
    color: #0f172a !important;
    border-color: rgba(79, 70, 229, .12) !important;
    box-shadow: 0 24px 80px rgba(15, 23, 42, .18) !important;
}

body.theme-light .feed-dialog h3,
html[data-theme="light"] body .feed-dialog h3,
[data-theme="light"] .feed-dialog h3,
body.theme-light .feed-dialog .feed-dialog-label,
html[data-theme="light"] body .feed-dialog .feed-dialog-label,
[data-theme="light"] .feed-dialog .feed-dialog-label {
    color: #0f172a !important;
}

body.theme-light .feed-dialog p,
html[data-theme="light"] body .feed-dialog p,
[data-theme="light"] .feed-dialog p {
    color: #475569 !important;
}

body.theme-light .feed-dialog-x,
html[data-theme="light"] body .feed-dialog-x,
[data-theme="light"] .feed-dialog-x {
    background: #f8fafc !important;
    color: #64748b !important;
    border-color: rgba(15, 23, 42, .08) !important;
}

body.theme-light .feed-dialog-x:hover,
html[data-theme="light"] body .feed-dialog-x:hover,
[data-theme="light"] .feed-dialog-x:hover {
    background: #eef2ff !important;
    color: #4f46e5 !important;
}

body.theme-light .feed-dialog .btn.ghost,
html[data-theme="light"] body .feed-dialog .btn.ghost,
[data-theme="light"] .feed-dialog .btn.ghost {
    background: #f8fafc !important;
    color: #334155 !important;
    border-color: rgba(15, 23, 42, .08) !important;
    opacity: 1 !important;
}

body.theme-light .feed-dialog .btn.danger,
html[data-theme="light"] body .feed-dialog .btn.danger,
[data-theme="light"] .feed-dialog .btn.danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
    color: #ffffff !important;
    border-color: rgba(220, 38, 38, .22) !important;
    opacity: 1 !important;
    text-shadow: none !important;
}

body.theme-light .vk-forum-panel,
html[data-theme="light"] body .vk-forum-panel,
[data-theme="light"] .vk-forum-panel,
body.theme-light .vk-forum-panel.compact,
html[data-theme="light"] body .vk-forum-panel.compact,
[data-theme="light"] .vk-forum-panel.compact {
    background: linear-gradient(135deg, #ffffff 0%, #f6f2ff 100%) !important;
    color: #0f172a !important;
    border-color: rgba(79, 70, 229, .12) !important;
    box-shadow: 0 16px 50px rgba(15, 23, 42, .08) !important;
}

body.theme-light .forum-composer,
html[data-theme="light"] body .forum-composer,
[data-theme="light"] .forum-composer,
body.theme-light .vk-forum-panel.compact .forum-composer.compact,
html[data-theme="light"] body .vk-forum-panel.compact .forum-composer.compact,
[data-theme="light"] .vk-forum-panel.compact .forum-composer.compact {
    background: rgba(255, 255, 255, .82) !important;
    color: #0f172a !important;
    border-color: rgba(79, 70, 229, .12) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .70) !important;
}

body.theme-light .forum-composer .input,
body.theme-light .forum-composer .textarea,
html[data-theme="light"] body .forum-composer .input,
html[data-theme="light"] body .forum-composer .textarea,
[data-theme="light"] .forum-composer .input,
[data-theme="light"] .forum-composer .textarea {
    background: #ffffff !important;
    color: #0f172a !important;
    border-color: rgba(15, 23, 42, .10) !important;
    box-shadow: none !important;
}

body.theme-light .forum-composer .input::placeholder,
body.theme-light .forum-composer .textarea::placeholder,
html[data-theme="light"] body .forum-composer .input::placeholder,
html[data-theme="light"] body .forum-composer .textarea::placeholder,
[data-theme="light"] .forum-composer .input::placeholder,
[data-theme="light"] .forum-composer .textarea::placeholder {
    color: rgba(15, 23, 42, .42) !important;
}

body.theme-light .forum-composer-actions small,
html[data-theme="light"] body .forum-composer-actions small,
[data-theme="light"] .forum-composer-actions small,
body.theme-light .forum-panel-head p,
html[data-theme="light"] body .forum-panel-head p,
[data-theme="light"] .forum-panel-head p,
body.theme-light .forum-topic-main span,
html[data-theme="light"] body .forum-topic-main span,
[data-theme="light"] .forum-topic-main span {
    color: #475569 !important;
}



/* Registration security hardening */
.auth-security-note {
    display: grid;
    gap: 6px;
    padding: 12px 14px;
    margin-bottom: var(--space-md);
    border: 1px solid rgba(139, 92, 246, 0.35);
    border-radius: var(--radius-md);
    background: rgba(139, 92, 246, 0.10);
    color: var(--text);
    font-size: 0.85rem;
    line-height: 1.35;
}
.auth-security-note strong {
    color: var(--primary-text);
    font-size: 0.9rem;
}
.auth-security-note span,
.auth-form .form-hint {
    color: var(--text-secondary);
}
.auth-code-input {
    text-align: center;
    letter-spacing: 0.35em;
    font-weight: 800;
    font-size: 1.25rem;
}
#register-code-group .btn.secondary {
    margin-top: 10px;
}
body.theme-light .auth-security-note {
    background: rgba(109, 40, 217, 0.08);
    border-color: rgba(109, 40, 217, 0.22);
}
body.theme-light .auth-security-note strong {
    color: var(--primary);
}

/* ===== STAGE 31A: deals desktop compact-header viewport fix =====
   Fixes the PC deals screen when the top header auto-collapses:
   - no artificial 72px bottom gap;
   - list/details columns fill the real available grid row;
   - only the deals list and details panel scroll;
   - mobile rules stay untouched. */
@media (min-width: 901px) {
    html:has(.deals-page),
    body:has(.deals-page) {
        height: 100%;
        overflow: hidden !important;
    }

    .app:has(.deals-page) {
        height: 100dvh !important;
        min-height: 100dvh !important;
        grid-template-rows: auto var(--app-menu-bar-h, 0px) minmax(0, 1fr) !important;
        overflow: hidden !important;
    }

    .app.header-compact-mode.header-collapsed:has(.deals-page) {
        grid-template-rows: 0 var(--app-menu-bar-h, 0px) minmax(0, 1fr) !important;
    }

    .app.header-compact-mode.header-revealed:has(.deals-page) {
        grid-template-rows: auto var(--app-menu-bar-h, 0px) minmax(0, 1fr) !important;
    }

    .app:has(.deals-page) .main-content {
        height: auto !important;
        min-height: 0 !important;
        overflow: hidden !important;
    }

    .app:has(.deals-page) .page-content:has(.deals-page) {
        height: 100% !important;
        max-height: 100% !important;
        min-height: 0 !important;
        overflow: hidden !important;
        padding-top: 18px !important;
        padding-bottom: 10px !important;
    }

    .app:has(.deals-page) .deals-page,
    .app:has(.deals-page) .deals-container {
        height: 100% !important;
        max-height: 100% !important;
        min-height: 0 !important;
        overflow: hidden !important;
    }

    .app:has(.deals-page) .deals-sidebar,
    .app:has(.deals-page) .deal-details {
        height: 100% !important;
        max-height: 100% !important;
        min-height: 0 !important;
    }

    .app:has(.deals-page) .deals-list,
    .app:has(.deals-page) .deal-details {
        overflow-y: auto !important;
        overflow-x: hidden !important;
        overscroll-behavior: contain;
    }
}

/* Wallet card: presentation only; provider and escrow lifecycles stay unchanged. */
.wallet-page-polished {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    min-width: 0;
    margin-inline: auto;
    padding-block: 12px;
    --wallet-ink: #f1f5f9;
    --wallet-muted: #b8bfd0;
    --wallet-line: rgba(196, 181, 253, 0.16);
}

.wallet-glass-panel,
.wallet-page-polished .card {
    position: relative;
    overflow: hidden;
}

.wallet-hero.wallet-overview-grid {
    display: grid;
    grid-template-columns: minmax(0, 560px) minmax(0, 1fr);
    align-items: start;
    gap: 20px;
    overflow: visible;
}

.wallet-card-face {
    border-radius: 26px;
    border: 1px solid var(--wallet-line);
    color: var(--wallet-ink);
    background:
        radial-gradient(ellipse at 0 0, rgba(124, 58, 237, 0.38), transparent 54%),
        radial-gradient(ellipse at 100% 0, rgba(20, 184, 166, 0.24), transparent 44%),
        linear-gradient(145deg, #1e213a, #111827);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.wallet-card-face {
    position: relative;
    display: grid;
    min-width: 0;
    gap: 20px;
    padding: 24px;
    overflow: hidden;
    isolation: isolate;
}

.wallet-card-face::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: 0;
    background: linear-gradient(120deg, transparent 42%, rgba(255, 255, 255, .045) 42.2%, transparent 78%);
    pointer-events: none;
}

.wallet-hero-main {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    min-width: 0;
}

.wallet-hero-main > div {
    min-width: 0;
}

.wallet-card-mark {
    width: 48px;
    height: 48px;
    flex: 0 0 auto;
    color: var(--wallet-muted);
}

.wallet-eyebrow {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.16em;
    margin-bottom: 14px;
}

.wallet-eyebrow span {
    padding-inline-start: 12px;
    border-inline-start: 1px solid var(--wallet-line);
    color: var(--wallet-muted);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.04em;
}

.wallet-page-polished .wallet-hero h1 {
    margin: 0;
    font-size: clamp(20px, 2.4vw, 26px);
    line-height: 1.15;
    color: var(--wallet-ink);
}

.wallet-page-polished .wallet-subtitle {
    margin: 6px 0 0;
    color: var(--wallet-muted);
    font-size: 13px;
    line-height: 1.45;
}

.wallet-card-details {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    gap: 18px 24px;
    margin: 0;
}

.wallet-card-details > div {
    min-width: 0;
}

.wallet-card-address {
    grid-column: 1 / -1;
}

.wallet-card-details dt {
    color: var(--wallet-muted);
    font-size: 12px;
    margin-bottom: 5px;
}

.wallet-card-details dd {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.wallet-card-address dd {
    width: fit-content;
    max-width: 100%;
    font-family: var(--font-mono, monospace);
    font-size: clamp(23px, 5vw, 28px);
    font-weight: 500;
    letter-spacing: 0.035em;
}

.wallet-hero-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.wallet-btn-soft,
.wallet-btn-primary {
    border-radius: 13px !important;
    min-height: 44px;
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.3;
    padding: 12px 14px;
}

.wallet-btn-soft {
    background: rgba(255, 255, 255, 0.07) !important;
    color: var(--wallet-ink) !important;
    border-color: var(--wallet-line) !important;
}

.wallet-btn-soft:hover {
    background: rgba(255, 255, 255, 0.12) !important;
}

.wallet-btn-primary {
    background: linear-gradient(115deg, #7c3aed, #0f968c) !important;
    box-shadow: 0 5px 18px rgba(124, 58, 237, 0.18) !important;
}

.wallet-disclosure {
    border: 1px solid var(--wallet-line);
    border-radius: 16px;
    color: var(--wallet-ink);
    background: var(--bg-card, rgba(20, 25, 40, 0.8));
    overflow: hidden;
}

.wallet-active-card { min-width: 0; align-self: start; }
.wallet-active-card > .wallet-status-box {
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.wallet-disclosure > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-height: 56px;
    padding: 14px 20px;
    list-style: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.wallet-disclosure > summary::-webkit-details-marker {
    display: none;
}

.wallet-disclosure > summary::after {
    content: '+';
    flex: 0 0 auto;
    color: var(--wallet-muted);
    font-size: 20px;
    font-weight: 400;
}

.wallet-disclosure[open] > summary::after {
    content: '−';
}

.wallet-disclosure > summary:hover {
    background: rgba(139, 92, 246, 0.06);
}

.wallet-disclosure > summary:focus-visible,
.wallet-hero-actions .btn:focus-visible {
    outline: 2px solid var(--primary, #8b5cf6);
    outline-offset: -4px;
}

.wallet-disclosure-body {
    padding: 0 20px 20px;
}

.wallet-disclosure-body > .wallet-section-hint {
    margin: 0 0 14px;
}

.wallet-section-header {
    align-items: flex-start;
}

.wallet-section-hint {
    margin-top: 6px;
    color: rgba(226, 232, 240, 0.62);
    font-size: 13px;
    line-height: 1.45;
    max-width: 760px;
}

.wallet-status-box {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 18px;
    padding: 24px;
    border: 1px solid var(--wallet-line);
    border-radius: 22px;
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
    text-align: start;
}

.linked-wallet-item,
.wallet-faq-item {
    border: 1px solid rgba(255, 255, 255, 0.075);
    background: rgba(8, 13, 25, 0.36);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045);
}

.wallet-current-row {
    display: flex;
    gap: 14px;
    align-items: center;
    padding: 0;
}

.wallet-current-row.is-linked {
    color: #34d399;
}

.wallet-current-row.is-warning {
    color: #fbbf24;
}

.wallet-current-icon,
.linked-wallet-chain-icon {
    width: 50px;
    height: 50px;
    min-width: 50px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    color: #ffffff;
}

.wallet-current-icon svg,
.linked-wallet-chain-icon svg,
.wallet-safety-icon svg {
    width: 26px;
    height: 26px;
}

.wallet-current-icon.polygon,
.linked-wallet-chain-icon.polygon { background: linear-gradient(135deg, #8247e5, #a855f7); }
.wallet-current-icon.hardhat,
.linked-wallet-chain-icon.hardhat { background: linear-gradient(135deg, #facc15, #f97316); color: #111827; }
.wallet-current-icon.ethereum,
.linked-wallet-chain-icon.ethereum { background: linear-gradient(135deg, #64748b, #8b5cf6); }
.wallet-current-icon.bnb,
.linked-wallet-chain-icon.bnb { background: linear-gradient(135deg, #f3ba2f, #f97316); color: #111827; }
.wallet-current-icon.base,
.linked-wallet-chain-icon.base { background: linear-gradient(135deg, #2563eb, #60a5fa); }
.wallet-current-icon.arbitrum,
.linked-wallet-chain-icon.arbitrum { background: linear-gradient(135deg, #28a0f0, #172554); }
.wallet-current-icon.default,
.linked-wallet-chain-icon.default { background: linear-gradient(135deg, #6366f1, #14b8a6); }

.wallet-current-icon.metamask {
    background: linear-gradient(135deg, #f59e0b 0%, #f97316 52%, #ea580c 100%);
    color: #111827;
    box-shadow: 0 16px 34px rgba(249, 115, 22, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.wallet-current-icon.metamask .wallet-metamask-svg {
    width: 34px;
    height: 34px;
    filter: drop-shadow(0 5px 8px rgba(15, 23, 42, 0.20));
}

.wallet-metamask-svg .mm-ear-left,
.wallet-metamask-svg .mm-ear-right { fill: #f97316; }
.wallet-metamask-svg .mm-face-left,
.wallet-metamask-svg .mm-face-right { fill: #fb923c; }
.wallet-metamask-svg .mm-cheek-left,
.wallet-metamask-svg .mm-cheek-right { fill: #fdba74; }
.wallet-metamask-svg .mm-snout { fill: #fed7aa; }
.wallet-metamask-svg .mm-eye-left,
.wallet-metamask-svg .mm-eye-right,
.wallet-metamask-svg .mm-nose { fill: #1f2937; }

.wallet-current-main,
.linked-wallet-chain-main {
    min-width: 0;
    flex: 1;
}

.wallet-current-title,
.linked-wallet-chain-name {
    color: #ffffff;
    font-weight: 800;
    line-height: 1.25;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    overflow-wrap: anywhere;
}

.wallet-current-title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
}

.linked-wallet-chain-name span {
    color: rgba(226, 232, 240, 0.62);
    font-size: 13px;
}

.wallet-current-meta,
.linked-wallet-chain-caption {
    margin-top: 6px;
    color: rgba(226, 232, 240, 0.64);
    font-size: 13px;
    line-height: 1.45;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.wallet-current-meta code,
.linked-wallet-address code {
    color: #d8b4fe;
    background: rgba(139, 92, 246, 0.12);
    border: 1px solid rgba(139, 92, 246, 0.22);
    border-radius: 10px;
    padding: 3px 7px;
    font-weight: 800;
}

.wallet-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
}

.wallet-pill.success {
    color: #34d399;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.22);
}

.wallet-pill.warning {
    color: #fbbf24;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.22);
}

.wallet-safety-note {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 0;
}

.wallet-safety-note > div:last-child {
    min-width: 0;
    overflow-wrap: anywhere;
}

.wallet-safety-note.wallet-network-warning {
    display: grid;
    gap: 10px;
    padding: 14px;
    border: 1px solid rgba(245, 158, 11, 0.28);
    border-radius: 14px;
    background: rgba(245, 158, 11, 0.08);
    font-size: 13px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.wallet-network-warning-title {
    font-weight: 700;
}

.wallet-network-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 0;
}

.wallet-network-actions .wallet-network-switch-btn {
    min-width: 0;
    max-width: 100%;
    min-height: 44px;
    white-space: normal;
    overflow-wrap: anywhere;
}

.wallet-safety-icon {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    color: #ffffff;
    background: linear-gradient(135deg, #7c3aed, #10b981);
}

.wallet-safety-title {
    color: #ffffff;
    font-weight: 800;
    margin-bottom: 5px;
    font-size: 13px;
}

.wallet-safety-text {
    color: rgba(226, 232, 240, 0.66);
    font-size: 13px;
    line-height: 1.48;
}

.wallet-linked-list {
    width: 100%;
    text-align: start;
    color: inherit;
    padding: 0;
}

.linked-wallets-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

.linked-wallet-item {
    border-radius: 22px;
    padding: 16px;
    transition: transform .2s ease, border-color .2s ease, background .2s ease, box-shadow .2s ease;
}

.linked-wallet-item:hover {
    transform: translateY(-2px);
    border-color: rgba(167, 139, 250, 0.24);
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.18);
}

.linked-wallet-item.is-current {
    border-color: rgba(16, 185, 129, 0.28);
    background: linear-gradient(145deg, rgba(16, 185, 129, 0.12), rgba(255, 255, 255, 0.03));
}

.linked-wallet-topline {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.linked-wallet-address {
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.045);
    border: 1px solid rgba(255, 255, 255, 0.07);
    overflow: hidden;
    text-overflow: ellipsis;
}

.linked-wallet-address code {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: bottom;
}

.linked-wallet-meta-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
    color: rgba(226, 232, 240, 0.62);
    font-size: 13px;
}

.linked-wallet-meta-row b {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 800;
    text-align: end;
}

.wallet-empty-linked {
    border-radius: 22px;
    padding: 22px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px dashed rgba(255, 255, 255, 0.12);
}

.wallet-faq-grid {
    display: grid;
    gap: 12px;
}

.wallet-faq-item {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 12px;
    border: 0;
    border-radius: 0;
    padding: 12px 0;
    background: none;
    box-shadow: none;
}

.wallet-faq-icon {
    width: 28px;
    height: 28px;
    border-radius: 9px;
    display: grid;
    place-items: center;
    color: #c4b5fd;
    background: rgba(139, 92, 246, 0.12);
    border: 1px solid rgba(139, 92, 246, 0.2);
    font-weight: 900;
}

.wallet-faq-item .faq-question {
    color: #ffffff;
    font-weight: 800;
}

.wallet-faq-item .faq-answer {
    color: rgba(226, 232, 240, 0.66);
    line-height: 1.48;
}

body.theme-light .wallet-card-face {
    background:
        radial-gradient(circle at 8% 10%, rgba(124, 58, 237, 0.22), transparent 28%),
        radial-gradient(circle at 88% 4%, rgba(20, 184, 166, 0.18), transparent 30%),
        linear-gradient(135deg, #ffffff, #f7f5ff) !important;
    border-color: rgba(124, 58, 237, 0.18) !important;
    box-shadow: 0 20px 60px rgba(31, 41, 55, 0.08) !important;
}

body.theme-light .wallet-page-polished {
    --wallet-ink: #172033;
    --wallet-muted: #586174;
    --wallet-line: rgba(109, 40, 217, 0.16);
}

body.theme-light .wallet-page-polished .wallet-hero h1,
body.theme-light .wallet-current-title,
body.theme-light .linked-wallet-chain-name,
body.theme-light .wallet-safety-title,
body.theme-light .wallet-faq-item .faq-question {
    color: #111827 !important;
}

body.theme-light .wallet-eyebrow {
    color: #7c3aed !important;
}

body.theme-light .wallet-page-polished .wallet-subtitle,
body.theme-light .wallet-section-hint,
body.theme-light .wallet-current-meta,
body.theme-light .linked-wallet-chain-caption,
body.theme-light .linked-wallet-meta-row,
body.theme-light .wallet-safety-text,
body.theme-light .wallet-faq-item .faq-answer,
body.theme-light .linked-wallet-chain-name span {
    color: rgba(17, 24, 39, 0.62) !important;
}

body.theme-light .wallet-active-card,
body.theme-light .wallet-linked-card,
body.theme-light .wallet-faq-card,
body.theme-light .linked-wallet-item {
    background: rgba(255, 255, 255, 0.78) !important;
    border-color: rgba(17, 24, 39, 0.08) !important;
    box-shadow: 0 16px 40px rgba(31, 41, 55, 0.06) !important;
}

body.theme-light .linked-wallet-address,
body.theme-light .wallet-empty-linked {
    background: rgba(124, 58, 237, 0.055) !important;
    border-color: rgba(124, 58, 237, 0.11) !important;
}

body.theme-light .wallet-btn-soft {
    background: rgba(124, 58, 237, 0.08) !important;
    color: #6d28d9 !important;
    border-color: rgba(124, 58, 237, 0.14) !important;
}

body.theme-light .wallet-pill.success {
    color: #047857;
}

body.theme-light .wallet-pill.warning {
    color: #92400e;
}

body.theme-light .wallet-current-meta code,
body.theme-light .linked-wallet-address code {
    color: #6d28d9;
}

body.theme-light .linked-wallet-meta-row b {
    color: rgba(17, 24, 39, 0.86) !important;
}

@media (max-width: 960px) {
    .wallet-hero.wallet-overview-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
    .wallet-card-face { width: min(100%, 560px); justify-self: center; }
}

@media (max-width: 560px) {
    .wallet-page-polished {
        gap: 10px;
    }

    .wallet-card-face {
        border-radius: 22px;
    }

    .wallet-card-face {
        padding: 20px;
        gap: 22px;
    }

    .wallet-status-box {
        padding: 18px 20px;
    }

    .wallet-hero-main {
        align-items: flex-start;
        gap: 12px;
    }

    .wallet-current-row,
    .wallet-safety-note {
        align-items: flex-start;
    }

    .linked-wallet-topline {
        display: grid;
        grid-template-columns: 58px minmax(0, 1fr);
        align-items: flex-start;
        gap: 12px 14px;
        text-align: start;
    }

    .linked-wallet-chain-icon {
        grid-column: 1;
        grid-row: 1 / span 2;
        width: 58px;
        height: 58px;
        min-width: 58px;
        border-radius: 20px;
    }

    .linked-wallet-chain-main {
        grid-column: 2;
        grid-row: 1;
        width: 100%;
        min-width: 0;
        text-align: start;
    }

    .linked-wallet-chain-name {
        justify-content: flex-start;
        align-items: baseline;
        gap: 5px 7px;
        text-align: start;
    }

    .linked-wallet-chain-caption {
        text-align: start;
    }

    .linked-wallet-topline .wallet-pill {
        grid-column: 2;
        grid-row: 2;
        justify-self: flex-start;
        margin-top: 2px;
    }

    .linked-wallet-address {
        text-align: start;
    }

    .linked-wallets-grid {
        grid-template-columns: 1fr;
    }

    .linked-wallet-meta-row {
        flex-direction: column;
        gap: 4px;
    }

    .linked-wallet-meta-row b {
        text-align: start;
    }
}

/* stage31B wallet dashboard-style polish cache bump */


/* ===== STAGE 31D: icon-only share / forward controls =====
   Keeps feed/share and media-forward logic intact; only removes noisy text labels. */
.feed-action.feed-icon-only,
.feed-share-action.feed-icon-only {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0 !important;
}

.feed-action.feed-icon-only span,
.feed-share-action.feed-icon-only span,
.profile-photo-share-btn.feed-icon-only span {
    display: none !important;
}

.feed-action.feed-icon-only .feed-ui-icon,
.feed-share-action.feed-icon-only .feed-ui-icon {
    width: 22px !important;
    height: 22px !important;
}

html body .profile-photo-viewer .profile-photo-socialbar .profile-photo-share-btn.feed-icon-only {
    width: 52px !important;
    max-width: 52px !important;
    min-width: 52px !important;
    border-radius: 16px !important;
    margin: 0 auto !important;
    gap: 0 !important;
}

html body .profile-photo-viewer .profile-photo-socialbar .profile-photo-share-btn.feed-icon-only svg {
    width: 31px !important;
    height: 31px !important;
}

#chat-media-forward.chat-media-action.chat-media-action-icon {
    width: 46px !important;
    min-width: 46px !important;
    height: 46px !important;
    min-height: 46px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 999px !important;
    font-size: 0 !important;
}

#chat-media-forward.chat-media-action.chat-media-action-icon svg {
    width: 22px !important;
    height: 22px !important;
    display: block !important;
}

/* ===== STAGE 31E: deals dashboard-style visual polish =====
   Visual-only layer for the deals page. Does not change API/Web3/action logic. */
.page-content:has(.deals-page) {
    background:
        radial-gradient(circle at 18% 0%, rgba(139, 92, 246, 0.14), transparent 30%),
        radial-gradient(circle at 92% 10%, rgba(16, 185, 129, 0.08), transparent 28%),
        var(--bg-primary);
}

.deals-page .deals-container {
    gap: 18px !important;
}

.deals-page .deals-sidebar,
.deals-page .deal-details-card,
.deals-page .deal-placeholder .placeholder-content {
    border: 1px solid rgba(148, 163, 184, 0.16) !important;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.018)),
        rgba(15, 23, 42, 0.70) !important;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.055) !important;
    backdrop-filter: blur(16px);
}

.deals-page .deals-sidebar {
    border-radius: 28px !important;
}

.deals-page .deals-sidebar::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 86px;
    border-top-left-radius: inherit;
    border-top-right-radius: inherit;
    pointer-events: none;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.22), rgba(20, 184, 166, 0.08) 56%, transparent);
    opacity: 0.95;
}

.deals-page .deals-sidebar-header {
    min-height: 76px;
    padding: 22px 18px 14px !important;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.deals-page .deals-sidebar-header h2 {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    font-size: clamp(1.6rem, 2.8vw, 2.15rem);
    line-height: 1;
    letter-spacing: -0.055em;
}

/* This is one moved DOM button, never viewport-specific duplicate actions.
   Existing CTA rules use !important, so visibility/wrapping must match them. */
#deals-container .deals-sidebar-header #create-new-deal-btn {
    order: -1;
    flex: 1 1 auto;
    min-width: 0;
    white-space: normal !important;
    line-height: 1.3;
}
@media (min-width: 901px) {
    #deals-container .deals-sidebar-header #create-new-deal-btn { display: none !important; }
}
@media (max-width: 900px) {
    .deals-page .deals-sidebar-header h2 { display: none !important; }
}

.deals-page .deals-sidebar-header h2::before {
    content: '';
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border-radius: 16px;
    background:
        linear-gradient(135deg, rgba(139, 92, 246, 0.95), rgba(20, 184, 166, 0.84));
    box-shadow: 0 14px 30px rgba(124, 58, 237, 0.28);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='4' width='16' height='16' rx='3'/%3E%3Cpath d='M8 9h8'/%3E%3Cpath d='M8 13h5'/%3E%3Cpath d='M16 17l2 2 4-4'/%3E%3C/svg%3E") center / 24px 24px no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='4' width='16' height='16' rx='3'/%3E%3Cpath d='M8 9h8'/%3E%3Cpath d='M8 13h5'/%3E%3Cpath d='M16 17l2 2 4-4'/%3E%3C/svg%3E") center / 24px 24px no-repeat;
}

.deals-page #deals-filter-toggle {
    width: 44px !important;
    height: 44px !important;
    border-radius: 16px !important;
    border: 1px solid rgba(167, 139, 250, 0.34) !important;
    background: rgba(139, 92, 246, 0.16) !important;
    color: #c4b5fd !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 12px 24px rgba(0, 0, 0, 0.14);
}

.deals-page #deals-filter-toggle:hover {
    transform: translateY(-1px);
    background: rgba(139, 92, 246, 0.24) !important;
    border-color: rgba(196, 181, 253, 0.58) !important;
}

/* Light theme: #c4b5fd on the lavender plate was 1.48:1 (contrast audit
   2026-10-13). !important only because the base colour above uses it. */
body.theme-light .deals-page #deals-filter-toggle {
    color: var(--primary-text) !important;
}

.deals-page .deals-list {
    padding: 14px !important;
}

.deals-page .deals-group {
    margin-bottom: 18px !important;
}

.deals-page .deals-group-header {
    padding: 8px 4px 10px !important;
    color: rgba(226, 232, 240, 0.88) !important;
    font-size: 0.86rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.deals-page .deals-group-count {
    min-width: 26px;
    height: 26px;
    padding: 0 8px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(139, 92, 246, 0.16);
    color: #c4b5fd;
    border: 1px solid rgba(167, 139, 250, 0.22);
}

.deals-page .deal-list-item {
    position: relative;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(92px, 35%);
    align-items: stretch !important;
    gap: 12px;
    min-height: 118px;
    padding: 15px 14px !important;
    margin-bottom: 10px !important;
    border-radius: 22px !important;
    border: 1px solid rgba(148, 163, 184, 0.13) !important;
    background:
        linear-gradient(135deg, rgba(99, 102, 241, 0.10), rgba(15, 23, 42, 0.18) 54%, rgba(16, 185, 129, 0.055)),
        rgba(30, 41, 59, 0.52) !important;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.045);
    overflow: hidden;
}

.deals-page .deal-list-item::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: linear-gradient(180deg, #8b5cf6, #14b8a6);
    opacity: 0.72;
}

.deals-page .deal-list-item:hover {
    transform: translateY(-2px) !important;
    border-color: rgba(167, 139, 250, 0.36) !important;
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.22), 0 0 0 1px rgba(139, 92, 246, 0.08) !important;
}

.deals-page .deal-list-item.active {
    border-color: rgba(167, 139, 250, 0.74) !important;
    background:
        linear-gradient(135deg, rgba(139, 92, 246, 0.30), rgba(30, 41, 59, 0.42) 52%, rgba(20, 184, 166, 0.16)),
        rgba(49, 46, 129, 0.62) !important;
    box-shadow: 0 22px 56px rgba(88, 28, 135, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
}

.deals-page .deal-item-left {
    min-width: 0;
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    align-items: start;
    gap: 12px;
}

.deals-page .deal-item-type {
    width: 46px;
    height: 46px;
    border-radius: 16px;
    color: #c4b5fd !important;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.25), rgba(99, 102, 241, 0.12));
    border: 1px solid rgba(167, 139, 250, 0.28);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.deals-page .deal-avatar-button { padding: 0; overflow: hidden; cursor: pointer; }
.deals-page .deal-avatar-button:disabled { cursor: default; }
.deals-page .deal-avatar-button:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }

.deals-page .deal-list-item:nth-child(3n+1) .deal-item-type {
    color: #34d399 !important;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.25), rgba(20, 184, 166, 0.10));
    border-color: rgba(52, 211, 153, 0.25);
}

.deals-page .deal-list-item:nth-child(3n+2) .deal-item-type {
    color: #fbbf24 !important;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.24), rgba(251, 191, 36, 0.09));
    border-color: rgba(251, 191, 36, 0.25);
}

.deals-page .deal-item-type .deal-icon-svg {
    width: 23px !important;
    height: 23px !important;
}

.deals-page .deal-item-title {
    margin: 2px 0 8px;
    color: var(--text);
    font-size: 1.02rem;
    line-height: 1.2;
    font-weight: 850;
    letter-spacing: -0.025em;
    overflow-wrap: anywhere;
}

.deals-page .deal-item-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 12px;
    color: var(--text-secondary);
    font-size: 0.82rem;
    line-height: 1.35;
}

.deals-page .deal-item-peer,
.deals-page .deal-item-date {
    min-width: 0;
    padding: 0;
    color: inherit;
    overflow-wrap: anywhere;
}

.deals-page .deal-item-right {
    min-width: 92px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: space-between;
    gap: 8px;
}

.deals-page .deal-item-amount {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
    font-size: 1.05rem;
    line-height: 1.12;
    font-weight: 900;
    color: #c4b5fd !important;
    text-align: right;
    text-shadow: 0 0 22px rgba(139, 92, 246, 0.22);
}

.deals-page .deal-item-status,
.deals-page .deal-status {
    width: fit-content;
    max-width: 100%;
    padding: 7px 10px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(148, 163, 184, 0.12);
    color: rgba(226, 232, 240, 0.88);
    font-size: 0.78rem;
    line-height: 1.1;
    font-weight: 800;
    text-align: center;
}

.deals-page .deal-item-status.pending_accept,
.deals-page .deal-status.pending_accept {
    background: rgba(245, 158, 11, 0.15) !important;
    border-color: rgba(245, 158, 11, 0.26) !important;
    color: #fbbf24 !important;
}

.deals-page .deal-item-status.accepted,
.deals-page .deal-status.accepted {
    background: rgba(139, 92, 246, 0.17) !important;
    border-color: rgba(167, 139, 250, 0.34) !important;
    color: #c4b5fd !important;
}

.deals-page .deal-item-status.funded,
.deals-page .deal-status.funded,
.deals-page .deal-item-status.delivered,
.deals-page .deal-status.delivered {
    background: rgba(59, 130, 246, 0.16) !important;
    border-color: rgba(96, 165, 250, 0.28) !important;
    color: #93c5fd !important;
}

.deals-page .deal-item-status.completed,
.deals-page .deal-status.completed {
    background: rgba(16, 185, 129, 0.16) !important;
    border-color: rgba(52, 211, 153, 0.30) !important;
    color: #6ee7b7 !important;
}

.deals-page .deal-item-status.cancelled,
.deals-page .deal-status.cancelled {
    background: rgba(100, 116, 139, 0.16) !important;
    border-color: rgba(148, 163, 184, 0.24) !important;
    color: #cbd5e1 !important;
}

.deals-page .deal-item-status.dispute,
.deals-page .deal-status.dispute {
    background: rgba(239, 68, 68, 0.16) !important;
    border-color: rgba(248, 113, 113, 0.30) !important;
    color: #fca5a5 !important;
}

.deals-page .deal-open-btn {
    width: 44px !important;
    height: 38px !important;
    min-width: 44px !important;
    padding: 0 !important;
    border-radius: 14px !important;
    color: #ddd6fe !important;
    background: rgba(139, 92, 246, 0.16) !important;
    border: 1px solid rgba(167, 139, 250, 0.24) !important;
    font-size: 0 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.deals-page .deal-open-btn .chev {
    font-size: 1.35rem !important;
    line-height: 1;
    margin: 0;
}

.deals-page .deal-open-btn:hover {
    background: rgba(139, 92, 246, 0.26) !important;
    border-color: rgba(196, 181, 253, 0.52) !important;
    transform: translateY(-1px);
}

.deals-page .deal-badge {
    margin-left: 6px;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(16, 185, 129, 0.16);
    color: #6ee7b7;
    border: 1px solid rgba(52, 211, 153, 0.24);
    font-size: 0.7rem;
    font-weight: 850;
}

.deals-page .deal-details-card {
    position: relative;
    padding: clamp(18px, 2vw, 28px) !important;
    border-radius: 30px !important;
    overflow: hidden;
}

.deals-page .deal-details-card::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 154px;
    pointer-events: none;
    background:
        radial-gradient(circle at 22% 0%, rgba(139, 92, 246, 0.22), transparent 46%),
        radial-gradient(circle at 84% 18%, rgba(20, 184, 166, 0.14), transparent 36%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent);
}

.deals-page .deal-header {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, max-content);
    gap: 16px;
    align-items: start;
    margin-bottom: 18px !important;
    padding: 4px 0 18px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.13);
}

.deals-page .deal-header > div { min-width: 0; }

.deals-page .deal-title {
    overflow-wrap: anywhere;
    margin: 0 0 12px;
    font-size: clamp(1.45rem, 2.8vw, 2.25rem) !important;
    line-height: 1.04;
    font-weight: 950;
    letter-spacing: -0.06em;
}

.deals-page .deal-subtitle {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.deals-page .deal-subtitle span,
.deals-page .deal-subtitle .deal-type,
.deals-page .deal-subtitle .deal-role,
.deals-page .deal-subtitle .deal-id {
    padding: 7px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.055);
    border: 1px solid rgba(148, 163, 184, 0.12);
    color: var(--text-secondary);
    font-size: 0.78rem;
    line-height: 1.1;
    font-weight: 750;
}

.deals-page .deal-subtitle .deal-id {
    color: #c4b5fd;
    border-color: rgba(167, 139, 250, 0.24);
    background: rgba(139, 92, 246, 0.14);
}

.deals-page .deal-header-right {
    min-width: 0;
    max-width: 100%;
    justify-self: end;
    text-align: end;
    overflow-wrap: anywhere;
    padding: 16px;
    border-radius: 24px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.20), rgba(20, 184, 166, 0.09));
    border: 1px solid rgba(167, 139, 250, 0.22);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

.deals-page .deal-amount {
    color: #c4b5fd !important;
    font-size: clamp(1.35rem, 2.3vw, 2rem) !important;
    font-weight: 950 !important;
    line-height: 1.05;
    letter-spacing: -0.04em;
    text-align: right;
    margin-bottom: 10px;
}

.deals-page .deal-timeline {
    position: relative;
    z-index: 1;
    margin: 20px 0 22px !important;
    padding: 18px 14px 12px;
    border-radius: 24px;
    background: rgba(15, 23, 42, 0.36);
    border: 1px solid rgba(148, 163, 184, 0.12);
}

.deals-page .deal-timeline .status-timeline {
    margin: 0 !important;
}

.deals-page .deal-timeline .status-dot {
    width: 28px !important;
    height: 28px !important;
    border: 4px solid rgba(15, 23, 42, 0.88) !important;
    background: rgba(71, 85, 105, 0.92) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.deals-page .deal-timeline .status-step.completed .status-dot {
    background: linear-gradient(135deg, #10b981, #14b8a6) !important;
}

.deals-page .deal-timeline .status-step.active .status-dot {
    background: linear-gradient(135deg, #8b5cf6, #a78bfa) !important;
    box-shadow: 0 0 0 7px rgba(139, 92, 246, 0.16), 0 0 26px rgba(139, 92, 246, 0.24) !important;
}

.deals-page .deal-timeline .status-step.completed::before {
    background: linear-gradient(90deg, #10b981, #14b8a6) !important;
}

.deals-page .deal-timeline .status-label {
    margin-top: 2px;
    font-size: 0.74rem;
    line-height: 1.15;
}

.deals-page .deal-info-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.8fr);
    gap: 16px !important;
}

.deals-page .deal-info-section,
.deals-page .deal-actions-section,
.deals-page .deal-history-section,
.deals-page .deal-events-section,
.deals-page .deal-chat-link,
.deals-page .delivery-section,
.deals-page .dispute-section {
    border: 1px solid rgba(148, 163, 184, 0.14) !important;
    border-radius: 24px !important;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.015)),
        rgba(15, 23, 42, 0.34) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045) !important;
}

.deals-page .deal-info-section,
.deals-page .deal-actions-section,
.deals-page .deal-history-section {
    padding: 18px !important;
    margin-top: 14px !important;
}

.deals-page .deal-info-section h3,
.deals-page .deal-actions-section h3,
.deals-page .deal-history-section h3,
.deals-page .delivery-section h3,
.deals-page .dispute-section h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 14px !important;
    font-size: 1.15rem;
    line-height: 1.1;
    letter-spacing: -0.035em;
}

.deals-page .deal-info-section h3::before,
.deals-page .deal-actions-section h3::before,
.deals-page .deal-history-section h3::before,
.deals-page .delivery-section h3::before,
.deals-page .dispute-section h3::before {
    content: '';
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border-radius: 13px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.24), rgba(20, 184, 166, 0.10));
    border: 1px solid rgba(167, 139, 250, 0.20);
}

.deals-page .deal-terms .terms-list,
.deals-page .terms-list {
    display: grid;
    gap: 10px;
}

.deals-page .term-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.045);
    border: 1px solid rgba(148, 163, 184, 0.10);
}

.deals-page .term-item.total {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.14), rgba(20, 184, 166, 0.06));
    border-color: rgba(52, 211, 153, 0.20);
}

.deals-page .term-item span:last-child,
.deals-page .term-item.total span:last-child {
    color: var(--text);
    font-weight: 900;
}

.deals-page .deal-participants {
    display: grid;
    gap: 10px;
}

.deals-page .participant {
    padding: 12px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.045);
    border: 1px solid rgba(148, 163, 184, 0.10);
}

.deals-page .participant.me {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.13), rgba(20, 184, 166, 0.05));
    border-color: rgba(52, 211, 153, 0.20);
}

.deals-page .participant-name {
    font-weight: 900;
    color: var(--text);
}

.deals-page .participant-role {
    color: var(--text-secondary);
    font-size: 0.78rem;
}

.deals-page .participant.me .participant-role,
.deals-page .participant.me .participant-name {
    color: #6ee7b7;
}

.deals-page .deal-actions {
    gap: 12px !important;
}

.deals-page .deal-actions .btn,
.deals-page .deal-actions .deal-action-chat {
    border-radius: 18px !important;
    min-height: 52px !important;
    font-weight: 900 !important;
    letter-spacing: -0.02em;
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.16) !important;
}

.deals-page .deal-actions .btn.success {
    background: linear-gradient(135deg, #10b981, #14b8a6) !important;
    border-color: rgba(52, 211, 153, 0.20) !important;
}

.deals-page .deal-actions .btn.primary {
    background: linear-gradient(135deg, #7c3aed, #6366f1) !important;
}

.deals-page .deal-actions .btn.danger {
    background: linear-gradient(135deg, #ef4444, #f43f5e) !important;
}

.deals-page .deal-actions .btn.secondary,
.deals-page .deal-actions .deal-action-chat {
    background: rgba(255, 255, 255, 0.055) !important;
    color: var(--text) !important;
    border-color: rgba(148, 163, 184, 0.16) !important;
}

.deals-page .history-item {
    padding: 12px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(148, 163, 184, 0.09);
}

.deals-page .history-icon {
    width: 34px;
    height: 34px;
    border-radius: 13px;
    background: rgba(139, 92, 246, 0.14);
    color: #c4b5fd !important;
}

.deals-page .deal-placeholder .placeholder-content {
    background:
        radial-gradient(circle at 50% 0%, rgba(139, 92, 246, 0.20), transparent 44%),
        rgba(15, 23, 42, 0.72) !important;
}

.deals-page .deal-placeholder .placeholder-icon {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.24), rgba(20, 184, 166, 0.12)) !important;
    border: 1px solid rgba(167, 139, 250, 0.24);
    color: #c4b5fd !important;
}

body.theme-light .page-content:has(.deals-page) {
    background:
        radial-gradient(circle at 18% 0%, rgba(139, 92, 246, 0.11), transparent 30%),
        radial-gradient(circle at 92% 10%, rgba(20, 184, 166, 0.08), transparent 28%),
        #f8fafc;
}

body.theme-light .deals-page .deals-sidebar,
body.theme-light .deals-page .deal-details-card,
body.theme-light .deals-page .deal-placeholder .placeholder-content,
body.theme-light .deals-page .deal-info-section,
body.theme-light .deals-page .deal-actions-section,
body.theme-light .deals-page .deal-history-section,
body.theme-light .deals-page .deal-events-section,
body.theme-light .deals-page .deal-chat-link,
body.theme-light .deals-page .delivery-section,
body.theme-light .deals-page .dispute-section {
    background: rgba(255, 255, 255, 0.92) !important;
    border-color: rgba(15, 23, 42, 0.08) !important;
    box-shadow: 0 22px 55px rgba(15, 23, 42, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.8) !important;
}

body.theme-light .deals-page .deals-sidebar::before,
body.theme-light .deals-page .deal-details-card::before {
    opacity: 0.62;
}

body.theme-light .deals-page .deal-list-item {
    background:
        linear-gradient(135deg, rgba(139, 92, 246, 0.07), rgba(255, 255, 255, 0.95) 56%, rgba(20, 184, 166, 0.045)) !important;
    border-color: rgba(15, 23, 42, 0.08) !important;
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.07) !important;
}

body.theme-light .deals-page .deal-list-item.active {
    background:
        linear-gradient(135deg, rgba(139, 92, 246, 0.16), rgba(255, 255, 255, 0.98) 58%, rgba(20, 184, 166, 0.08)) !important;
    border-color: rgba(139, 92, 246, 0.34) !important;
    box-shadow: 0 18px 44px rgba(99, 102, 241, 0.14) !important;
}

body.theme-light .deals-page .deals-group-header {
    color: #334155 !important;
}

body.theme-light .deals-page .deal-subtitle span,
body.theme-light .deals-page .term-item,
body.theme-light .deals-page .participant,
body.theme-light .deals-page .history-item,
body.theme-light .deals-page .deal-timeline {
    background: rgba(248, 250, 252, 0.86) !important;
    border-color: rgba(15, 23, 42, 0.08) !important;
}

body.theme-light .deals-page .deal-timeline .status-dot {
    border-color: #ffffff !important;
    box-shadow: 0 3px 9px rgba(15, 23, 42, 0.10) !important;
}

body.theme-light .deals-page .deal-actions .btn.secondary,
body.theme-light .deals-page .deal-actions .deal-action-chat {
    background: #ffffff !important;
    border-color: rgba(15, 23, 42, 0.10) !important;
    color: #111827 !important;
}

@media (max-width: 1180px) {
    .deals-page .deal-info-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .deals-page .deals-container {
        gap: 10px !important;
    }
    .deals-page .deals-sidebar {
        border-radius: 22px !important;
    }
    .deals-page .deals-sidebar-header {
        min-height: 64px;
        padding: 16px 14px 12px !important;
    }
    .deals-page .deals-sidebar-header h2::before {
        width: 36px;
        height: 36px;
        flex-basis: 36px;
        border-radius: 14px;
    }
    .deals-page .deal-list-item {
        min-height: 104px;
        grid-template-columns: minmax(0, 1fr) minmax(88px, 35%);
        padding: 12px !important;
        border-radius: 20px !important;
    }
    .deals-page .deal-item-left {
        grid-template-columns: 46px minmax(0, 1fr);
        gap: 10px;
    }
    .deals-page .deal-item-type {
        width: 44px;
        height: 44px;
        border-radius: 14px;
    }
    .deals-page .deal-details-card {
        border-radius: 22px !important;
        padding: 14px !important;
    }
    .deals-page .deal-info-section,
    .deals-page .deal-actions-section,
    .deals-page .deal-history-section {
        border-radius: 20px !important;
        padding: 14px !important;
    }
}

@media (max-width: 560px) {
    .deals-page .deal-list-item {
        grid-template-columns: minmax(0, 1fr) minmax(88px, 35%);
        gap: 10px;
    }
    .deals-page .deal-item-left {
        align-content: start;
    }
    .deals-page .deal-item-main {
        display: contents;
    }
    .deals-page .deal-item-meta {
        grid-column: 1 / -1;
    }
    .deals-page .deal-item-right {
        width: 100%;
        min-width: 0;
        flex-direction: column;
        align-items: flex-end;
        justify-content: flex-start;
    }
    .deals-page .deal-item-amount {
        font-size: clamp(.9rem, 3.8vw, 1.05rem);
        text-align: right;
    }
    .deals-page .deal-open-btn {
        width: 44px !important;
        height: 44px !important;
        min-height: 44px;
        margin-top: auto;
    }
    .deals-page .deal-subtitle {
        gap: 6px;
    }
    .deals-page .deal-header-right {
        padding: 13px;
        border-radius: 20px;
    }
    .deals-page .deal-timeline {
        border-radius: 18px;
        padding: 12px 6px 8px;
    }
    .deals-page .deal-timeline .status-label {
        font-size: 0.50rem !important;
    }
}

/* ===== STAGE 31E.1: deals archive toggle dark-theme readability =====
   Visual-only fix for the “Архив 13 ▲” group button. Keeps deals logic untouched. */
.deals-page .deals-group-header.toggle {
    width: 100% !important;
    min-height: 44px !important;
    padding: 9px 10px !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto auto !important;
    align-items: center !important;
    gap: 8px !important;
    border: 1px solid rgba(167, 139, 250, 0.22) !important;
    border-radius: 16px !important;
    background:
        linear-gradient(135deg, rgba(139, 92, 246, 0.16), rgba(15, 23, 42, 0.28) 62%, rgba(20, 184, 166, 0.08)),
        rgba(15, 23, 42, 0.44) !important;
    color: rgba(248, 250, 252, 0.94) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 10px 24px rgba(0, 0, 0, 0.12) !important;
    cursor: pointer !important;
    text-align: left !important;
    line-height: 1.1 !important;
    appearance: none !important;
    -webkit-appearance: none !important;
}

.deals-page .deals-group-header.toggle > span:first-child {
    min-width: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    color: rgba(248, 250, 252, 0.96) !important;
    font-weight: 850 !important;
}

.deals-page .deals-group-header.toggle .deals-group-count {
    min-width: 30px !important;
    height: 28px !important;
    padding: 0 9px !important;
    flex: 0 0 auto !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 999px !important;
    background: rgba(139, 92, 246, 0.24) !important;
    color: #ede9fe !important;
    border: 1px solid rgba(196, 181, 253, 0.34) !important;
    font-size: 0.82rem !important;
    font-weight: 900 !important;
    line-height: 1 !important;
    box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.04), 0 8px 18px rgba(88, 28, 135, 0.16) !important;
}

.deals-page .deals-group-header.toggle .deals-group-chev {
    width: 28px !important;
    height: 28px !important;
    flex: 0 0 28px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 10px !important;
    background: rgba(255, 255, 255, 0.06) !important;
    border: 1px solid rgba(148, 163, 184, 0.14) !important;
    color: #c4b5fd !important;
    font-size: 0.72rem !important;
    font-weight: 900 !important;
    line-height: 1 !important;
    transform: translateY(0) !important;
}

.deals-page .deals-group-header.toggle:hover,
.deals-page .deals-group-header.toggle:focus-visible {
    background:
        linear-gradient(135deg, rgba(139, 92, 246, 0.22), rgba(15, 23, 42, 0.30) 62%, rgba(20, 184, 166, 0.11)),
        rgba(30, 41, 59, 0.52) !important;
    border-color: rgba(196, 181, 253, 0.42) !important;
    color: #ffffff !important;
    outline: none !important;
}

body.theme-light .deals-page .deals-group-header.toggle {
    background:
        linear-gradient(135deg, rgba(124, 58, 237, 0.08), rgba(255, 255, 255, 0.92) 62%, rgba(20, 184, 166, 0.06)),
        rgba(255, 255, 255, 0.94) !important;
    border-color: rgba(124, 58, 237, 0.16) !important;
    color: #1e1b4b !important;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.75) !important;
}

body.theme-light .deals-page .deals-group-header.toggle > span:first-child {
    color: #1e1b4b !important;
}

body.theme-light .deals-page .deals-group-header.toggle .deals-group-count {
    background: rgba(124, 58, 237, 0.10) !important;
    color: #5b21b6 !important;
    border-color: rgba(124, 58, 237, 0.18) !important;
}

body.theme-light .deals-page .deals-group-header.toggle .deals-group-chev {
    background: rgba(124, 58, 237, 0.08) !important;
    border-color: rgba(124, 58, 237, 0.13) !important;
    color: #6d28d9 !important;
}

/* ===== STAGE 31E.2: deals filter button header alignment =====
   Visual-only fix: move the filter action to the far right of the deals sidebar header. */
.deals-page .deals-sidebar-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 14px !important;
}

.deals-page .deals-sidebar-header h2 {
    flex: 1 1 auto !important;
    min-width: 0 !important;
}

.deals-page #deals-filter-toggle {
    flex: 0 0 46px !important;
    width: 46px !important;
    min-width: 46px !important;
    height: 46px !important;
    min-height: 46px !important;
    margin-left: auto !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.deals-page #deals-filter-toggle svg {
    width: 22px !important;
    height: 22px !important;
}

@media (max-width: 900px) {
    .deals-page .deals-sidebar-header {
        gap: 10px !important;
    }
    .deals-page #deals-filter-toggle {
        flex-basis: 42px !important;
        width: 42px !important;
        min-width: 42px !important;
        height: 42px !important;
        min-height: 42px !important;
        border-radius: 15px !important;
    }
}

@media (max-width: 420px) {
    .deals-page .deals-sidebar-header h2 {
        font-size: 1.45rem !important;
    }
    .deals-page .deals-sidebar-header h2::before {
        width: 34px !important;
        height: 34px !important;
        flex-basis: 34px !important;
    }
}


/* ===== STAGE 31E.3: mobile deals bottom flush =====
   Visual-only fix for phones: the deals list must fill the available screen height
   and stop leaving a dark empty strip under the cards. Does not touch deals logic/API/Web3. */
@media (max-width: 900px) {
    html:has(.deals-page),
    body:has(.deals-page) {
        height: 100% !important;
        min-height: 100% !important;
        overflow: hidden !important;
    }

    .app:has(.deals-page) {
        height: 100dvh !important;
        min-height: 100dvh !important;
        max-height: 100dvh !important;
        grid-template-rows: auto var(--app-menu-bar-h, 0px) minmax(0, 1fr) !important;
        overflow: hidden !important;
    }

    .app.header-compact-mode.header-collapsed:has(.deals-page) {
        grid-template-rows: 0 var(--app-menu-bar-h, 0px) minmax(0, 1fr) !important;
    }

    .app.header-compact-mode.header-revealed:has(.deals-page) {
        grid-template-rows: auto var(--app-menu-bar-h, 0px) minmax(0, 1fr) !important;
    }

    .app:has(.deals-page) .main-content {
        height: 100% !important;
        min-height: 0 !important;
        overflow: hidden !important;
    }

    .app:has(.deals-page) .page-content:has(.deals-page) {
        width: 100% !important;
        height: 100% !important;
        min-height: 0 !important;
        max-height: 100% !important;
        padding: 8px 8px 0 !important;
        margin: 0 auto !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
    }

    .app:has(.deals-page) .deals-page {
        flex: 1 1 auto !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
    }

    .app:has(.deals-page) .deals-container,
    .app:has(.deals-page) .deals-container:not(.mobile-deal-open),
    .app:has(.deals-page) .deals-container.mobile-deal-open {
        flex: 1 1 auto !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: 100% !important;
        overflow: hidden !important;
    }

    .app:has(.deals-page) .deals-container:not(.mobile-deal-open) .deals-sidebar,
    .app:has(.deals-page) .deals-container.mobile-deal-open .deal-details {
        flex: 1 1 auto !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        margin-bottom: 0 !important;
    }

    .app:has(.deals-page) .deals-list,
    .app:has(.deals-page) .deals-container.mobile-deal-open .deal-details {
        overscroll-behavior: contain !important;
        -webkit-overflow-scrolling: touch;
    }

    .app:has(.deals-page) .deals-list {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        padding-bottom: max(8px, env(safe-area-inset-bottom)) !important;
    }
}

/* ===== Mobile contextual swipe fix: chats/deals horizontal swipe should not become page scroll ===== */
@media (max-width: 1024px) {
    .deals-page .deal-details,
    .deals-page .deals-list,
    .deals-page .deal-list-item,
    .chats-container .chat-main,
    .chats-container .chats-list,
    .chats-container .dialog-item {
        touch-action: pan-y;
        overscroll-behavior-x: contain;
    }
}

/* ===== STAGE 31G.1: mobile deals reopen scroll unlock =====
   Fixes: deal -> list -> swipe-left back into deal could render the full card
   inside the compact placeholder and lock vertical scrolling halfway down. */
@media (max-width: 900px) {
    .app:has(.deals-page) .deals-container.mobile-deal-open {
        display: flex !important;
        flex-direction: column !important;
        min-height: 0 !important;
        height: 100% !important;
        max-height: 100% !important;
        overflow: hidden !important;
        touch-action: pan-y !important;
    }

    .app:has(.deals-page) .deals-container.mobile-deal-open .deals-sidebar {
        display: none !important;
    }

    .app:has(.deals-page) .deals-container.mobile-deal-open .deal-details {
        display: block !important;
        flex: 1 1 auto !important;
        min-height: 0 !important;
        height: 100% !important;
        max-height: 100% !important;
        width: 100% !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        overscroll-behavior: contain !important;
        touch-action: pan-y !important;
        padding-bottom: max(10px, env(safe-area-inset-bottom)) !important;
    }

    .app:has(.deals-page) .deals-container.mobile-deal-open #deal-details-content,
    .app:has(.deals-page) .deals-container.mobile-deal-open .deal-details-content,
    .app:has(.deals-page) .deals-container.mobile-deal-open .deal-details-card {
        min-height: 0 !important;
        max-height: none !important;
        overflow: visible !important;
        touch-action: pan-y !important;
    }

    .app:has(.deals-page) .deals-container.mobile-deal-open .deal-placeholder {
        display: none !important;
    }
}


/* Stage A8 — remember me / trusted device auth UI */
.auth-remember-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0 4px;
  color: var(--text-primary);
  font-size: 0.92rem;
  cursor: pointer;
  user-select: none;
}

.auth-remember-checkbox {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  flex: 0 0 auto;
}

.auth-remember-hint {
  margin-top: 0;
  margin-bottom: 10px;
}


/* === Stage A18B: group/feed/wall/header search runtime polish === */
.group-info-avatar {
    overflow: visible !important;
    position: relative !important;
    isolation: isolate;
}
.group-info-avatar img {
    border-radius: 999px !important;
    overflow: hidden !important;
}
.group-avatar-edit-badge {
    right: 1px !important;
    bottom: 1px !important;
    z-index: 5 !important;
    width: 26px !important;
    height: 26px !important;
    border: 2px solid rgba(255,255,255,.92) !important;
    background: linear-gradient(135deg, #7c3aed 0%, #20c6ff 100%) !important;
    color: #fff !important;
    box-shadow: 0 10px 22px rgba(15,23,42,.22) !important;
    transform: none !important;
}
.group-member-name .group-member-you-badge,
.group-member-you-badge {
    display: inline-flex;
    align-items: center;
    margin-left: 6px;
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(139,92,246,.12);
    color: var(--primary, #7c3aed);
    font-size: 12px;
    font-weight: 800;
    vertical-align: 1px;
}
body.theme-light .group-member-you-badge,
[data-theme="light"] .group-member-you-badge {
    background: rgba(99,102,241,.12) !important;
    color: #4f46e5 !important;
}
.vk-forum-panel.compact .forum-panel-head {
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 10px !important;
}
.vk-forum-panel.compact .forum-panel-title {
    min-width: 0 !important;
    flex: 1 1 auto !important;
}
.forum-create-topic-btn {
    flex: 0 0 auto !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 7px !important;
    border-radius: 999px !important;
    padding: 8px 12px !important;
    min-height: 36px !important;
    text-decoration: none !important;
    white-space: nowrap !important;
}
.forum-create-topic-plus {
    display: inline-grid;
    place-items: center;
    width: 20px;
    height: 20px;
    border-radius: 999px;
    background: linear-gradient(135deg, #7c3aed, #20c6ff);
    color: #fff;
    font-weight: 900;
    line-height: 1;
    box-shadow: 0 8px 18px rgba(124,58,237,.20);
}
.feed-my-wall-btn,
.feed-my-wall-btn:visited,
.feed-my-wall-btn:hover,
.feed-my-wall-btn:focus,
.feed-my-wall-btn:active {
    text-decoration: none !important;
}
.feed-my-wall-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    border-radius: 999px !important;
    padding: 9px 13px !important;
    min-height: 38px !important;
    background: linear-gradient(135deg, rgba(124,58,237,.14), rgba(32,198,255,.08)) !important;
    border: 1px solid rgba(124,58,237,.18) !important;
    color: var(--primary, #7c3aed) !important;
    box-shadow: 0 10px 26px rgba(124,58,237,.10) !important;
}
.feed-my-wall-btn .feed-ui-icon {
    width: 17px !important;
    height: 17px !important;
}
body.theme-light .feed-empty,
[data-theme="light"] .feed-empty,
body.theme-light .forum-empty,
[data-theme="light"] .forum-empty {
    background: rgba(255,255,255,.88) !important;
    border-color: rgba(15,23,42,.08) !important;
    color: #475569 !important;
    text-shadow: none !important;
}
body.theme-light .feed-empty b,
[data-theme="light"] .feed-empty b,
body.theme-light .forum-empty b,
[data-theme="light"] .forum-empty b {
    color: #334155 !important;
    opacity: 1 !important;
    text-shadow: none !important;
}
body.theme-light .feed-empty span,
[data-theme="light"] .feed-empty span,
body.theme-light .forum-empty span,
[data-theme="light"] .forum-empty span {
    color: #475569 !important;
    opacity: 1 !important;
    text-shadow: none !important;
}
body.theme-light .forum-topic-meta,
body.theme-light .forum-topic-meta *,
[data-theme="light"] .forum-topic-meta,
[data-theme="light"] .forum-topic-meta * {
    color: #64748b !important;
    opacity: 1 !important;
    text-shadow: none !important;
}
body.theme-light .forum-topic-meta strong,
[data-theme="light"] .forum-topic-meta strong {
    color: #334155 !important;
}
.header-search-user-card {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    min-width: 0 !important;
}
.header-search-user-card .search-result-avatar,
.search-result-item.header-search-user-card .search-result-avatar {
    display: inline-grid !important;
    place-items: center !important;
    flex: 0 0 42px !important;
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    border-radius: 999px !important;
    background-size: cover !important;
    background-position: center !important;
    background-color: rgba(109,93,252,.13) !important;
    color: var(--primary, #7c3aed) !important;
    font-weight: 850 !important;
    overflow: hidden !important;
}
.header-search-user-card .search-result-info {
    min-width: 0 !important;
    flex: 1 1 auto !important;
    overflow: hidden !important;
}
.header-search-user-card .search-result-topline {
    min-width: 0 !important;
    max-width: 100% !important;
}
.header-search-user-card .search-result-topline .search-result-name {
    min-width: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}
.header-search-user-card .search-result-presence {
    min-width: 0 !important;
    max-width: 132px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}
.user-menu {
    position: relative !important;
    overflow: visible !important;
}
.header-right .user-menu #user-dropdown,
#user-dropdown.dropdown {
    z-index: 7000 !important;
    width: 17.5rem;
    min-width: 0 !important;
    max-width: calc(100vw - 16px);
    max-height: calc(100dvh - var(--app-menu-bar-h, 0px) - 80px - env(safe-area-inset-bottom, 0px));
    background: var(--bg-card, var(--bg-tertiary)) !important;
    color: var(--text) !important;
    border: 1px solid var(--border) !important;
    box-shadow: 0 18px 45px rgba(15,23,42,.22) !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
}
body.theme-light #user-dropdown.dropdown,
[data-theme="light"] #user-dropdown.dropdown {
    background: rgba(255,255,255,.98) !important;
    border-color: rgba(15,23,42,.10) !important;
    box-shadow: 0 20px 48px rgba(15,23,42,.16) !important;
}
#user-dropdown .dropdown-item,
#user-dropdown .dropdown-item span,
#user-dropdown .dropdown-item svg:not(.dropdown-item-check) {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    color: inherit !important;
}
#user-dropdown .dropdown-item {
    touch-action: manipulation;
    align-items: center !important;
    gap: 10px !important;
    width: 100% !important;
    min-height: 42px !important;
    padding: 10px 14px !important;
    text-decoration: none !important;
    white-space: nowrap !important;
}
#user-dropdown .dropdown-item span {
    min-width: 0 !important;
    flex: 1 1 auto !important;
    white-space: normal;
    overflow-wrap: anywhere;
}
#user-dropdown .dropdown-divider {
    display: block !important;
    background: var(--border) !important;
    margin: 6px 0 !important;
}
@media (max-width: 768px) {
    .vk-forum-panel.compact .forum-panel-head {
        flex-direction: row !important;
        align-items: center !important;
    }
    .vk-forum-panel.compact .forum-panel-title p {
        max-width: 180px;
    }
    .forum-create-topic-btn {
        padding: 8px 10px !important;
    }
    .header-search-user-card .search-result-presence {
        max-width: 96px !important;
    }
    .header-right .user-menu #user-dropdown,
    #user-dropdown.dropdown {
        position: fixed !important;
        top: 58px !important;
        right: 8px !important;
        left: auto !important;
        width: min(17.5rem, calc(100vw - 16px)) !important;
        max-width: calc(100vw - 16px) !important;
    }
}

/* === Stage A18C: branded collapsible profile sections === */

/* === Stage A18C6: Telegram-glass profile sections dropdown stable fix === */

.profile-page .profile-tab-menu-icon {
    width: 19px !important;
    height: 19px !important;
    min-width: 19px !important;
    color: currentColor !important;
}

@keyframes profileChevronFloat {
    0%, 100% { transform: translateY(-1px); }
    50% { transform: translateY(2px); }
}

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


/* === Stage A18F: deal action confirmation modals visual polish === */
.deal-inline-svg-icon {
    width: 18px;
    height: 18px;
    min-width: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #8b5cf6;
}
.deal-inline-svg-icon svg { width: 100%; height: 100%; stroke: currentColor; }
.deal-inline-svg-icon-success { color: #22c55e; }

.deal-action-modal-overlay.modal-overlay {
    background:
        radial-gradient(circle at 18% 8%, rgba(124, 58, 237, 0.26), transparent 34%),
        radial-gradient(circle at 86% 18%, rgba(59, 130, 246, 0.18), transparent 30%),
        rgba(9, 11, 22, 0.56) !important;
    backdrop-filter: blur(16px) saturate(1.16) !important;
    -webkit-backdrop-filter: blur(16px) saturate(1.16) !important;
    padding: 18px !important;
}

.deal-action-modal-overlay .deal-action-modal {
    position: relative;
    max-width: min(620px, 100%) !important;
    border-radius: 30px !important;
    overflow: auto !important;
    background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(255,255,255,.78)) !important;
    color: #111827 !important;
    border: 1px solid rgba(255,255,255,.58) !important;
    box-shadow: 0 30px 90px rgba(15,23,42,.28), 0 12px 36px rgba(124,58,237,.16) !important;
    backdrop-filter: blur(24px) saturate(1.12) !important;
    -webkit-backdrop-filter: blur(24px) saturate(1.12) !important;
    animation: dealActionModalIn .22s cubic-bezier(.22,.86,.32,1) both;
}

.deal-action-modal-overlay .deal-action-modal::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(124,58,237,.20), transparent 32%, rgba(59,130,246,.12));
    opacity: .72;
}

.deal-action-modal-overlay .modal-header,
.deal-action-modal-overlay .modal-body,
.deal-action-modal-overlay .modal-footer {
    position: relative;
    z-index: 1;
}

.deal-action-modal-overlay .modal-header {
    padding: 20px 20px 14px !important;
    border-bottom: 1px solid rgba(124,58,237,.10) !important;
}

.deal-action-modal-overlay .modal-title {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #111827 !important;
    font-size: 22px !important;
    font-weight: 950 !important;
    letter-spacing: -.02em;
    line-height: 1.18;
}

.deal-action-title-icon {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #7c3aed, #60a5fa);
    color: #fff;
    box-shadow: 0 12px 24px rgba(124,58,237,.24);
}

.deal-action-modal-dispute .deal-action-title-icon {
    background: linear-gradient(135deg, #dc2626, #f97316);
    box-shadow: 0 12px 24px rgba(220,38,38,.20);
}

.deal-action-title-icon svg {
    width: 19px;
    height: 19px;
    stroke: currentColor;
}

.deal-action-modal-overlay .modal-close {
    width: 38px !important;
    height: 38px !important;
    border-radius: 999px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(15,23,42,.06) !important;
    color: #475569 !important;
    font-size: 24px !important;
    line-height: 1 !important;
}

.deal-action-modal-overlay .modal-close:hover { background: rgba(124,58,237,.10) !important; color: #5b21b6 !important; }

.deal-action-modal-overlay .modal-body { padding: 18px 20px !important; }
.deal-action-modal-overlay .modal-footer {
    padding: 14px 20px 20px !important;
    border-top: 1px solid rgba(124,58,237,.10) !important;
    gap: 10px !important;
}

.deal-action-modal-overlay .delivery-info,
.deal-action-modal-overlay .dispute-info,
.deal-action-modal-overlay .delivery-view-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 8px;
    margin-bottom: 16px;
}

.deal-action-modal-overlay .delivery-info-item,
.deal-action-modal-overlay .dispute-info-item,
.deal-action-modal-overlay .delivery-view-item {
    display: grid;
    gap: 5px;
    padding: 11px 12px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(124,58,237,.075), rgba(59,130,246,.055));
    border: 1px solid rgba(124,58,237,.08);
}

.deal-action-modal-overlay .delivery-info-label,
.deal-action-modal-overlay .dispute-info-label,
.deal-action-modal-overlay .delivery-view-label {
    color: #64748b;
    font-size: 12px;
    font-weight: 900;
}

.deal-action-modal-overlay .delivery-info-value,
.deal-action-modal-overlay .dispute-info-value,
.deal-action-modal-overlay .delivery-view-value {
    color: #0f172a;
    font-size: 13px;
    font-weight: 850;
    overflow-wrap: anywhere;
}

.deal-action-modal-overlay .form-group { margin-bottom: 14px !important; }
.deal-action-modal-overlay .form-label { color: #1f2937 !important; font-weight: 900 !important; }
.deal-action-modal-overlay .form-hint { color: #64748b !important; }
.deal-action-modal-overlay .input,
.deal-action-modal-overlay .select,
.deal-action-modal-overlay .textarea {
    border-radius: 18px !important;
    border-color: rgba(124,58,237,.14) !important;
    background: rgba(255,255,255,.72) !important;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.46) !important;
}
.deal-action-modal-overlay .input:focus,
.deal-action-modal-overlay .select:focus,
.deal-action-modal-overlay .textarea:focus {
    border-color: rgba(124,58,237,.38) !important;
    box-shadow: 0 0 0 4px rgba(124,58,237,.10), inset 0 0 0 1px rgba(255,255,255,.52) !important;
}

/* Glass theme: these windows keep the light surface above (only the dark
   theme switches them to dark), but the controls took the glass theme's
   white text (1.02–1.39:1). Same colours as in the light theme. */
body.theme-glass .deal-action-modal-overlay :is(.input, .select, .textarea),
body.theme-glass .deal-action-modal-overlay .file-upload .btn {
    color: #0f172a;
}

body.theme-glass .deal-action-modal-overlay .file-upload .btn {
    background: rgba(0, 0, 0, 0.03);
}

body.theme-glass .deal-action-modal-overlay :is(.input, .textarea)::placeholder {
    color: rgba(0, 0, 0, 0.3);
}

.deal-action-modal-overlay .file-upload .btn,
.deal-action-modal-overlay .modal-footer .btn {
    border-radius: 16px !important;
    font-weight: 950 !important;
    min-height: 44px;
}
.deal-action-modal-overlay .modal-footer .btn.primary {
    background: linear-gradient(135deg, #7c3aed, #8b5cf6 55%, #3b82f6) !important;
    color: #fff !important;
    box-shadow: 0 14px 30px rgba(124,58,237,.24) !important;
}
.deal-action-modal-overlay .modal-footer .btn.danger {
    background: linear-gradient(135deg, #dc2626, #f97316) !important;
    color: #fff !important;
    box-shadow: 0 14px 30px rgba(220,38,38,.20) !important;
}
.deal-action-modal-overlay .modal-footer .btn.ghost,
.deal-action-modal-overlay .modal-footer .btn.secondary {
    background: rgba(15,23,42,.06) !important;
    color: #334155 !important;
    border: 1px solid rgba(15,23,42,.06) !important;
}

.deal-action-modal-overlay .delivery-view-section {
    display: grid;
    gap: 12px;
    margin-bottom: 14px;
}
.deal-action-modal-overlay .delivery-view-section h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 950;
    color: #111827;
}
.deal-action-modal-overlay .delivery-view-payload {
    border-radius: 20px;
    background: rgba(255,255,255,.72);
    border: 1px solid rgba(124,58,237,.10);
    color: #0f172a;
    padding: 14px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.deal-action-modal-overlay .delivery-view-warning {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(245,158,11,.15), rgba(249,115,22,.08));
    border: 1px solid rgba(245,158,11,.18);
    color: #92400e;
    padding: 12px 13px;
    font-size: 13px;
    font-weight: 850;
}
.deal-action-modal-overlay .delivery-view-warning-icon {
    width: 20px;
    height: 20px;
    min-width: 20px;
    color: #f59e0b;
}
.deal-action-modal-overlay .delivery-view-warning-icon svg { width: 100%; height: 100%; stroke: currentColor; }

body.dark .deal-action-modal-overlay .deal-action-modal,
[data-theme="dark"] .deal-action-modal-overlay .deal-action-modal,
html[data-theme="dark"] body .deal-action-modal-overlay .deal-action-modal {
    background: linear-gradient(180deg, rgba(17,24,39,.88), rgba(15,23,42,.76)) !important;
    color: #f8fafc !important;
    border-color: rgba(255,255,255,.10) !important;
    box-shadow: 0 30px 90px rgba(0,0,0,.46), 0 12px 36px rgba(124,58,237,.18) !important;
}
body.dark .deal-action-modal-overlay .modal-title,
[data-theme="dark"] .deal-action-modal-overlay .modal-title,
html[data-theme="dark"] body .deal-action-modal-overlay .modal-title,
body.dark .deal-action-modal-overlay .delivery-view-section h4,
[data-theme="dark"] .deal-action-modal-overlay .delivery-view-section h4,
html[data-theme="dark"] body .deal-action-modal-overlay .delivery-view-section h4 { color: #f8fafc !important; }
body.dark .deal-action-modal-overlay .delivery-info-item,
body.dark .deal-action-modal-overlay .dispute-info-item,
body.dark .deal-action-modal-overlay .delivery-view-item,
[data-theme="dark"] .deal-action-modal-overlay .delivery-info-item,
[data-theme="dark"] .deal-action-modal-overlay .dispute-info-item,
[data-theme="dark"] .deal-action-modal-overlay .delivery-view-item,
html[data-theme="dark"] body .deal-action-modal-overlay .delivery-info-item,
html[data-theme="dark"] body .deal-action-modal-overlay .dispute-info-item,
html[data-theme="dark"] body .deal-action-modal-overlay .delivery-view-item {
    background: linear-gradient(135deg, rgba(255,255,255,.07), rgba(255,255,255,.035));
    border-color: rgba(255,255,255,.08);
}
body.dark .deal-action-modal-overlay .delivery-info-label,
body.dark .deal-action-modal-overlay .dispute-info-label,
body.dark .deal-action-modal-overlay .delivery-view-label,
[data-theme="dark"] .deal-action-modal-overlay .delivery-info-label,
[data-theme="dark"] .deal-action-modal-overlay .dispute-info-label,
[data-theme="dark"] .deal-action-modal-overlay .delivery-view-label,
html[data-theme="dark"] body .deal-action-modal-overlay .delivery-info-label,
html[data-theme="dark"] body .deal-action-modal-overlay .dispute-info-label,
html[data-theme="dark"] body .deal-action-modal-overlay .delivery-view-label { color: #c4b5fd; }
body.dark .deal-action-modal-overlay .delivery-info-value,
body.dark .deal-action-modal-overlay .dispute-info-value,
body.dark .deal-action-modal-overlay .delivery-view-value,
[data-theme="dark"] .deal-action-modal-overlay .delivery-info-value,
[data-theme="dark"] .deal-action-modal-overlay .dispute-info-value,
[data-theme="dark"] .deal-action-modal-overlay .delivery-view-value,
html[data-theme="dark"] body .deal-action-modal-overlay .delivery-info-value,
html[data-theme="dark"] body .deal-action-modal-overlay .dispute-info-value,
html[data-theme="dark"] body .deal-action-modal-overlay .delivery-view-value { color: #f8fafc; }
body.dark .deal-action-modal-overlay .input,
body.dark .deal-action-modal-overlay .select,
body.dark .deal-action-modal-overlay .textarea,
body.dark .deal-action-modal-overlay .delivery-view-payload,
[data-theme="dark"] .deal-action-modal-overlay .input,
[data-theme="dark"] .deal-action-modal-overlay .select,
[data-theme="dark"] .deal-action-modal-overlay .textarea,
[data-theme="dark"] .deal-action-modal-overlay .delivery-view-payload,
html[data-theme="dark"] body .deal-action-modal-overlay .input,
html[data-theme="dark"] body .deal-action-modal-overlay .select,
html[data-theme="dark"] body .deal-action-modal-overlay .textarea,
html[data-theme="dark"] body .deal-action-modal-overlay .delivery-view-payload {
    background: rgba(15,23,42,.72) !important;
    color: #f8fafc !important;
    border-color: rgba(255,255,255,.10) !important;
}
body.dark .deal-action-modal-overlay .form-label,
[data-theme="dark"] .deal-action-modal-overlay .form-label,
html[data-theme="dark"] body .deal-action-modal-overlay .form-label { color: #f8fafc !important; }
body.dark .deal-action-modal-overlay .modal-footer .btn.ghost,
body.dark .deal-action-modal-overlay .modal-footer .btn.secondary,
[data-theme="dark"] .deal-action-modal-overlay .modal-footer .btn.ghost,
[data-theme="dark"] .deal-action-modal-overlay .modal-footer .btn.secondary,
html[data-theme="dark"] body .deal-action-modal-overlay .modal-footer .btn.ghost,
html[data-theme="dark"] body .deal-action-modal-overlay .modal-footer .btn.secondary {
    background: rgba(255,255,255,.08) !important;
    color: #e2e8f0 !important;
    border-color: rgba(255,255,255,.08) !important;
}
body.dark .deal-action-modal-overlay .form-hint,
[data-theme="dark"] .deal-action-modal-overlay .form-hint,
html[data-theme="dark"] body .deal-action-modal-overlay .form-hint { color: #94a3b8 !important; }
body.dark .deal-action-modal-overlay .delivery-view-warning,
[data-theme="dark"] .deal-action-modal-overlay .delivery-view-warning,
html[data-theme="dark"] body .deal-action-modal-overlay .delivery-view-warning { color: #fcd34d; }

@keyframes dealActionModalIn {
    from { opacity: 0; transform: translateY(10px) scale(.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 560px) {
    .deal-action-modal-overlay.modal-overlay {
        align-items: flex-end !important;
        padding: 10px !important;
    }
    .deal-action-modal-overlay .deal-action-modal {
        width: 100% !important;
        max-height: 88vh !important;
        border-radius: 26px 26px 20px 20px !important;
    }
    .deal-action-modal-overlay .modal-header {
        padding: 18px 18px 12px !important;
    }
    .deal-action-modal-overlay .modal-body {
        padding: 16px 18px !important;
    }
    .deal-action-modal-overlay .modal-footer {
        display: grid !important;
        grid-template-columns: 1fr !important;
        padding: 12px 18px 18px !important;
    }
    .deal-action-modal-overlay .modal-footer .btn {
        width: 100% !important;
    }
    .deal-action-modal-overlay .delivery-info,
    .deal-action-modal-overlay .dispute-info,
    .deal-action-modal-overlay .delivery-view-info {
        grid-template-columns: 1fr !important;
    }
    .deal-action-modal-overlay .modal-title {
        font-size: 20px !important;
    }
}


/* === Stage A18I: notifications page + incoming notification polish === */
















































.notification-avatar { width: 50px; height: 50px; }
.notification-dropdown-item .notification-avatar { width: 42px; height: 42px; }


.notification-dropdown-item:focus-visible{ outline: 2px solid var(--primary); outline-offset: -2px; }


































.notification-dropdown {
    border-radius: 26px !important;
    border: 1px solid rgba(124,58,237,.14) !important;
    background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(255,255,255,.78)) !important;
    box-shadow: 0 28px 80px rgba(15,23,42,.18), 0 10px 30px rgba(124,58,237,.10) !important;
    backdrop-filter: blur(20px) saturate(1.16) !important;
    -webkit-backdrop-filter: blur(20px) saturate(1.16) !important;
}

.notification-dropdown.visible {
    display: flex !important;
    flex-direction: column !important;
}

.notification-dropdown-header {
    background: linear-gradient(135deg, rgba(124,58,237,.10), rgba(59,130,246,.06)) !important;
}

.notification-dropdown-item {
    display: grid !important;
    grid-template-columns: 42px minmax(0, 1fr) 12px !important;
    border: 1px solid transparent !important;
    border-bottom: 0 !important;
    border-radius: 18px !important;
    margin: 0 0 7px !important;
    background: rgba(255,255,255,.36) !important;
    box-shadow: none !important;
}

.notification-dropdown-item:hover,
.notification-dropdown-item.unread {
    background: linear-gradient(135deg, rgba(124,58,237,.11), rgba(59,130,246,.07)) !important;
    border-color: rgba(124,58,237,.13) !important;
}

.notification-dropdown-meta {
    font-size: .70rem !important;
    font-weight: 850 !important;
    color: #7c3aed !important;
}

.notification-dropdown-text {
    font-size: .90rem !important;
    font-weight: 850 !important;
}

.notification-dropdown-message {
    font-size: .80rem !important;
}

.notification-dropdown-footer {
    background: rgba(255,255,255,.28) !important;
}

.toast-container {
    width: min(430px, calc(100vw - 28px)) !important;
}

.toast.toast-new {
    position: relative;
    overflow: hidden;
    display: grid !important;
    grid-template-columns: 42px minmax(0, 1fr) 30px;
    gap: 12px;
    border-radius: 22px !important;
    border: 1px solid rgba(124,58,237,.14) !important;
    background: linear-gradient(135deg, rgba(255,255,255,.92), rgba(255,255,255,.76)) !important;
    box-shadow: 0 24px 70px rgba(15,23,42,.18), 0 8px 24px rgba(124,58,237,.10) !important;
    backdrop-filter: blur(18px) saturate(1.15) !important;
    -webkit-backdrop-filter: blur(18px) saturate(1.15) !important;
    border-left: 0 !important;
}

.toast.toast-new::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: 5px;
    background: linear-gradient(180deg, #7c3aed, #3b82f6);
}

.toast.toast-new.success::before { background: linear-gradient(180deg, #10b981, #22c55e); }
.toast.toast-new.error::before { background: linear-gradient(180deg, #ef4444, #f97316); }
.toast.toast-new.warning::before { background: linear-gradient(180deg, #f59e0b, #f97316); }

.toast.toast-new .toast-icon {
    width: 42px;
    height: 42px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #7c3aed;
    background: linear-gradient(135deg, rgba(124,58,237,.14), rgba(59,130,246,.10));
}
.toast.toast-new.success .toast-icon { color: #059669; background: rgba(16,185,129,.13); }
.toast.toast-new.error .toast-icon { color: #dc2626; background: rgba(239,68,68,.12); }
.toast.toast-new.warning .toast-icon { color: #d97706; background: rgba(245,158,11,.14); }

.toast.toast-new .toast-icon svg {
    width: 21px;
    height: 21px;
}

.toast.toast-new .toast-title {
    color: var(--text);
    font-size: .95rem;
    font-weight: 950;
    letter-spacing: -.015em;
}

.toast.toast-new .toast-message {
    color: var(--text-secondary);
    font-size: .84rem;
    line-height: 1.38;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.toast.toast-new .toast-close {
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 12px;
    background: rgba(124,58,237,.08);
    color: var(--text-secondary);
}

.toast.toast-new .toast-close:hover {
    background: rgba(124,58,237,.14);
    color: var(--primary);
}

body.dark .notification-dropdown,
[data-theme="dark"] .notification-dropdown,
html[data-theme="dark"] body .notification-dropdown,
body.dark .toast.toast-new,
[data-theme="dark"] .toast.toast-new,
html[data-theme="dark"] body .toast.toast-new{
    background: linear-gradient(135deg, rgba(17,24,39,.88), rgba(15,23,42,.74)) !important;
    border-color: rgba(255,255,255,.08) !important;
    box-shadow: 0 28px 80px rgba(0,0,0,.30), 0 10px 30px rgba(124,58,237,.12) !important;
}

body.dark .notification-dropdown-item,
[data-theme="dark"] .notification-dropdown-item,
html[data-theme="dark"] body .notification-dropdown-item {
    background: rgba(255,255,255,.04) !important;
}



@media (max-width: 720px) {
    

    

    

    

    

    

    

    

    

    
    

    

    

    .toast-container {
        left: 12px !important;
        right: 12px !important;
        bottom: calc(12px + env(safe-area-inset-bottom, 0px)) !important;
        width: auto !important;
        max-width: none !important;
    }

    .toast.toast-new {
        grid-template-columns: 38px minmax(0, 1fr) 28px;
        gap: 10px;
        padding: 12px 12px 12px 14px !important;
        border-radius: 20px !important;
    }

    .toast.toast-new .toast-icon {
        width: 38px;
        height: 38px;
        border-radius: 15px;
    }
}

/* === Stage A18I2: light-theme notification contrast recovery === */
























body.theme-light .notification-dropdown-text,
html[data-theme="light"] body .notification-dropdown-text,
body.theme-light .toast.toast-new .toast-title,
html[data-theme="light"] body .toast.toast-new .toast-title{
    color: #0f172a !important;
}

body.theme-light .notification-dropdown-message,
html[data-theme="light"] body .notification-dropdown-message,
body.theme-light .toast.toast-new .toast-message,
html[data-theme="light"] body .toast.toast-new .toast-message{
    color: #475569 !important;
}





body.theme-light .notification-dropdown,
html[data-theme="light"] body .notification-dropdown {
    background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(248,250,252,.90)) !important;
    color: #0f172a !important;
    border-color: rgba(124,58,237,.16) !important;
    box-shadow: 0 28px 80px rgba(15,23,42,.18), 0 10px 30px rgba(124,58,237,.10) !important;
}

body.theme-light .notification-dropdown-header,
html[data-theme="light"] body .notification-dropdown-header,
body.theme-light .notification-dropdown-footer,
html[data-theme="light"] body .notification-dropdown-footer {
    background: linear-gradient(135deg, rgba(124,58,237,.08), rgba(59,130,246,.04)) !important;
    border-color: rgba(124,58,237,.10) !important;
    color: #0f172a !important;
}

body.theme-light .notification-dropdown-title,
html[data-theme="light"] body .notification-dropdown-title {
    color: #0f172a !important;
}

body.theme-light .notification-dropdown-item,
html[data-theme="light"] body .notification-dropdown-item {
    background: rgba(255,255,255,.72) !important;
    border-color: rgba(15,23,42,.06) !important;
    color: #0f172a !important;
}

body.theme-light .notification-dropdown-item:hover,
body.theme-light .notification-dropdown-item.unread,
html[data-theme="light"] body .notification-dropdown-item:hover,
html[data-theme="light"] body .notification-dropdown-item.unread {
    background: linear-gradient(135deg, rgba(124,58,237,.10), rgba(59,130,246,.06)) !important;
    border-color: rgba(124,58,237,.14) !important;
}

body.theme-light .notification-dropdown-meta,
html[data-theme="light"] body .notification-dropdown-meta {
    color: #7c3aed !important;
}

body.theme-light .notification-dropdown-empty,
html[data-theme="light"] body .notification-dropdown-empty {
    color: #64748b !important;
}

body.theme-light .notification-dropdown-empty b,
html[data-theme="light"] body .notification-dropdown-empty b {
    color: #0f172a !important;
}

body.theme-light .notification-dropdown-close,
html[data-theme="light"] body .notification-dropdown-close,
body.theme-light .toast.toast-new .toast-close,
html[data-theme="light"] body .toast.toast-new .toast-close {
    background: rgba(124,58,237,.08) !important;
    color: #475569 !important;
}

body.theme-light .notification-dropdown-close:hover,
html[data-theme="light"] body .notification-dropdown-close:hover,
body.theme-light .toast.toast-new .toast-close:hover,
html[data-theme="light"] body .toast.toast-new .toast-close:hover {
    background: rgba(124,58,237,.14) !important;
    color: #5b21b6 !important;
}

body.theme-light .toast.toast-new,
html[data-theme="light"] body .toast.toast-new {
    background: linear-gradient(135deg, rgba(255,255,255,.96), rgba(248,250,252,.88)) !important;
    border-color: rgba(124,58,237,.16) !important;
    color: #0f172a !important;
    box-shadow: 0 24px 70px rgba(15,23,42,.18), 0 8px 24px rgba(124,58,237,.10) !important;
}

/* === Stage A18H4: stop browser history-swipe while keeping in-app swipes === */
html,
body,
#app,
.app-shell,
.main-content {
    overscroll-behavior-x: none;
}

.sidebar,
.sidebar-overlay,
#sidebar,
#sidebar-overlay {
    overscroll-behavior: contain;
}

/* === Stage A18I3: notifications light theme hard contrast fix ===
   Fixes light screens where notification page/dropdown inherited dark glass variables.
   Uses default-light selectors only; dark theme rules remain untouched. */




























html:not([data-theme="dark"]) body:not(.dark):not(.theme-dark):not([data-theme="dark"]) .notification-dropdown,
body.theme-light .notification-dropdown,
body.light .notification-dropdown,
html[data-theme="light"] body .notification-dropdown {
    background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(246,248,255,.94)) !important;
    color: #0f172a !important;
    border: 1px solid rgba(124,58,237,.16) !important;
    box-shadow: 0 30px 80px rgba(15,23,42,.18), 0 12px 30px rgba(124,58,237,.10) !important;
    backdrop-filter: blur(20px) saturate(1.12) !important;
    -webkit-backdrop-filter: blur(20px) saturate(1.12) !important;
    opacity: 1 !important;
}

html:not([data-theme="dark"]) body:not(.dark):not(.theme-dark):not([data-theme="dark"]) .notification-dropdown-header,
html:not([data-theme="dark"]) body:not(.dark):not(.theme-dark):not([data-theme="dark"]) .notification-dropdown-footer,
body.theme-light .notification-dropdown-header,
body.theme-light .notification-dropdown-footer,
body.light .notification-dropdown-header,
body.light .notification-dropdown-footer,
html[data-theme="light"] body .notification-dropdown-header,
html[data-theme="light"] body .notification-dropdown-footer {
    background: linear-gradient(135deg, rgba(124,58,237,.08), rgba(59,130,246,.04)) !important;
    color: #0f172a !important;
    border-color: rgba(124,58,237,.11) !important;
    opacity: 1 !important;
}

html:not([data-theme="dark"]) body:not(.dark):not(.theme-dark):not([data-theme="dark"]) .notification-dropdown-title,
body.theme-light .notification-dropdown-title,
body.light .notification-dropdown-title,
html[data-theme="light"] body .notification-dropdown-title {
    color: #0f172a !important;
    opacity: 1 !important;
}

html:not([data-theme="dark"]) body:not(.dark):not(.theme-dark):not([data-theme="dark"]) .notification-dropdown-item,
body.theme-light .notification-dropdown-item,
body.light .notification-dropdown-item,
html[data-theme="light"] body .notification-dropdown-item {
    background: rgba(255,255,255,.78) !important;
    color: #0f172a !important;
    border-color: rgba(15,23,42,.07) !important;
    opacity: 1 !important;
}

html:not([data-theme="dark"]) body:not(.dark):not(.theme-dark):not([data-theme="dark"]) .notification-dropdown-item:hover,
html:not([data-theme="dark"]) body:not(.dark):not(.theme-dark):not([data-theme="dark"]) .notification-dropdown-item.unread,
body.theme-light .notification-dropdown-item:hover,
body.theme-light .notification-dropdown-item.unread,
body.light .notification-dropdown-item:hover,
body.light .notification-dropdown-item.unread,
html[data-theme="light"] body .notification-dropdown-item:hover,
html[data-theme="light"] body .notification-dropdown-item.unread {
    background: linear-gradient(135deg, rgba(124,58,237,.11), rgba(59,130,246,.065)) !important;
    border-color: rgba(124,58,237,.16) !important;
}

html:not([data-theme="dark"]) body:not(.dark):not(.theme-dark):not([data-theme="dark"]) .notification-dropdown-meta,
body.theme-light .notification-dropdown-meta,
body.light .notification-dropdown-meta,
html[data-theme="light"] body .notification-dropdown-meta {
    color: #7c3aed !important;
    opacity: 1 !important;
    text-shadow: none !important;
}

html:not([data-theme="dark"]) body:not(.dark):not(.theme-dark):not([data-theme="dark"]) .notification-dropdown-text,
body.theme-light .notification-dropdown-text,
body.light .notification-dropdown-text,
html[data-theme="light"] body .notification-dropdown-text {
    color: #0f172a !important;
    opacity: 1 !important;
    text-shadow: none !important;
}

html:not([data-theme="dark"]) body:not(.dark):not(.theme-dark):not([data-theme="dark"]) .notification-dropdown-message,
body.theme-light .notification-dropdown-message,
body.light .notification-dropdown-message,
html[data-theme="light"] body .notification-dropdown-message {
    color: #334155 !important;
    opacity: 1 !important;
    text-shadow: none !important;
}

html:not([data-theme="dark"]) body:not(.dark):not(.theme-dark):not([data-theme="dark"]) .notification-dropdown-close,
body.theme-light .notification-dropdown-close,
body.light .notification-dropdown-close,
html[data-theme="light"] body .notification-dropdown-close {
    background: rgba(124,58,237,.08) !important;
    color: #334155 !important;
    border-color: rgba(124,58,237,.12) !important;
}

html:not([data-theme="dark"]) body:not(.dark):not(.theme-dark):not([data-theme="dark"]) .notification-dropdown-footer a,
body.theme-light .notification-dropdown-footer a,
body.light .notification-dropdown-footer a,
html[data-theme="light"] body .notification-dropdown-footer a {
    color: #4f46e5 !important;
    opacity: 1 !important;
}

html:not([data-theme="dark"]) body:not(.dark):not(.theme-dark):not([data-theme="dark"]) .toast.toast-new,
body.theme-light .toast.toast-new,
body.light .toast.toast-new,
html[data-theme="light"] body .toast.toast-new {
    background: linear-gradient(135deg, rgba(255,255,255,.98), rgba(246,248,255,.92)) !important;
    color: #0f172a !important;
    border-color: rgba(124,58,237,.16) !important;
    opacity: 1 !important;
}

html:not([data-theme="dark"]) body:not(.dark):not(.theme-dark):not([data-theme="dark"]) .toast.toast-new .toast-title,
body.theme-light .toast.toast-new .toast-title,
body.light .toast.toast-new .toast-title,
html[data-theme="light"] body .toast.toast-new .toast-title {
    color: #0f172a !important;
}

html:not([data-theme="dark"]) body:not(.dark):not(.theme-dark):not([data-theme="dark"]) .toast.toast-new .toast-message,
body.theme-light .toast.toast-new .toast-message,
body.light .toast.toast-new .toast-message,
html[data-theme="light"] body .toast.toast-new .toast-message {
    color: #334155 !important;
}

@media (max-width: 720px) {
    html:not([data-theme="dark"]) body:not(.dark):not(.theme-dark):not([data-theme="dark"]) .notification-dropdown,
    body.theme-light .notification-dropdown,
    body.light .notification-dropdown,
    html[data-theme="light"] body .notification-dropdown {
        background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(246,248,255,.94)) !important;
        color: #0f172a !important;
    }

    html:not([data-theme="dark"]) body:not(.dark):not(.theme-dark):not([data-theme="dark"]) .notification-dropdown-item,
    body.theme-light .notification-dropdown-item,
    body.light .notification-dropdown-item,
    html[data-theme="light"] body .notification-dropdown-item {
        background: rgba(255,255,255,.80) !important;
        color: #0f172a !important;
    }
}

/* === Stage A18I4: notification surfaces hard light pin ===
   The notification center and bell dropdown must stay readable on light/glass screens.
   This block is intentionally scoped only to notification surfaces and does not touch chats/deals/Web3. */


































/* Bell dropdown: force readable light surface regardless of inherited header/theme glass. */
html body #notification-dropdown.notification-dropdown,
html body .header #notification-dropdown.notification-dropdown,
html body .app-header #notification-dropdown.notification-dropdown,
html body .topbar #notification-dropdown.notification-dropdown,
html body .notification-bell #notification-dropdown.notification-dropdown {
    color-scheme: light !important;
    background:
        radial-gradient(circle at 12% 0%, rgba(124,58,237,.11), transparent 34%),
        linear-gradient(180deg, rgba(255,255,255,.985), rgba(246,248,255,.96)) !important;
    color: #0f172a !important;
    border: 1px solid rgba(124,58,237,.18) !important;
    box-shadow: 0 30px 80px rgba(15,23,42,.20), 0 12px 30px rgba(124,58,237,.12) !important;
    opacity: 1 !important;
    filter: none !important;
    mix-blend-mode: normal !important;
    backdrop-filter: blur(18px) saturate(1.1) !important;
    -webkit-backdrop-filter: blur(18px) saturate(1.1) !important;
}

html body #notification-dropdown.notification-dropdown .notification-dropdown-header,
html body #notification-dropdown.notification-dropdown .notification-dropdown-footer,
html body .notification-dropdown .notification-dropdown-header,
html body .notification-dropdown .notification-dropdown-footer {
    background: linear-gradient(135deg, rgba(124,58,237,.08), rgba(59,130,246,.045)) !important;
    color: #0f172a !important;
    border-color: rgba(124,58,237,.12) !important;
    opacity: 1 !important;
    filter: none !important;
    text-shadow: none !important;
}

html body #notification-dropdown.notification-dropdown .notification-dropdown-title,
html body .notification-dropdown .notification-dropdown-title {
    color: #0f172a !important;
    opacity: 1 !important;
    text-shadow: none !important;
}

html body #notification-dropdown.notification-dropdown .notification-dropdown-list,
html body .notification-dropdown .notification-dropdown-list {
    background: transparent !important;
    opacity: 1 !important;
}

html body #notification-dropdown.notification-dropdown .notification-dropdown-item,
html body .notification-dropdown .notification-dropdown-item {
    background: rgba(255,255,255,.82) !important;
    color: #0f172a !important;
    border: 1px solid rgba(15,23,42,.08) !important;
    opacity: 1 !important;
    filter: none !important;
    mix-blend-mode: normal !important;
    text-shadow: none !important;
}

html body #notification-dropdown.notification-dropdown .notification-dropdown-item.unread,
html body #notification-dropdown.notification-dropdown .notification-dropdown-item:hover,
html body .notification-dropdown .notification-dropdown-item.unread,
html body .notification-dropdown .notification-dropdown-item:hover {
    background: linear-gradient(135deg, rgba(124,58,237,.12), rgba(59,130,246,.07)) !important;
    color: #0f172a !important;
    border-color: rgba(124,58,237,.18) !important;
    opacity: 1 !important;
}

html body #notification-dropdown.notification-dropdown .notification-dropdown-content,
html body .notification-dropdown .notification-dropdown-content {
    color: #0f172a !important;
    opacity: 1 !important;
}

html body #notification-dropdown.notification-dropdown .notification-dropdown-meta,
html body .notification-dropdown .notification-dropdown-meta {
    color: #7c3aed !important;
    opacity: 1 !important;
    text-shadow: none !important;
}

html body #notification-dropdown.notification-dropdown .notification-dropdown-text,
html body .notification-dropdown .notification-dropdown-text {
    color: #0f172a !important;
    opacity: 1 !important;
    text-shadow: none !important;
}

html body #notification-dropdown.notification-dropdown .notification-dropdown-message,
html body .notification-dropdown .notification-dropdown-message {
    color: #334155 !important;
    opacity: 1 !important;
    text-shadow: none !important;
}



html body #notification-dropdown.notification-dropdown .notification-dropdown-dot,
html body .notification-dropdown .notification-dropdown-dot {
    background: #635bff !important;
    box-shadow: 0 0 0 6px rgba(99,91,255,.16) !important;
    opacity: 1 !important;
}

html body #notification-dropdown.notification-dropdown .notification-dropdown-close,
html body .notification-dropdown .notification-dropdown-close {
    background: rgba(124,58,237,.08) !important;
    color: #334155 !important;
    border: 1px solid rgba(124,58,237,.14) !important;
    opacity: 1 !important;
}

html body #notification-dropdown.notification-dropdown .notification-dropdown-footer a,
html body .notification-dropdown .notification-dropdown-footer a,
html body #notification-dropdown.notification-dropdown #all-notifications-link,
html body .notification-dropdown #all-notifications-link {
    color: #4f46e5 !important;
    opacity: 1 !important;
    text-shadow: none !important;
}

html body #notification-dropdown.notification-dropdown .notification-dropdown-empty,
html body .notification-dropdown .notification-dropdown-empty,
html body #notification-dropdown.notification-dropdown .notification-dropdown-empty b,
html body .notification-dropdown .notification-dropdown-empty b,
html body #notification-dropdown.notification-dropdown .notification-dropdown-empty span,
html body .notification-dropdown .notification-dropdown-empty span {
    color: #334155 !important;
    opacity: 1 !important;
    text-shadow: none !important;
}

@media (max-width: 720px) {
    html body #notification-dropdown.notification-dropdown,
    html body .notification-dropdown {
        background: linear-gradient(180deg, rgba(255,255,255,.985), rgba(246,248,255,.96)) !important;
        color: #0f172a !important;
        border-color: rgba(124,58,237,.18) !important;
    }

    html body #notification-dropdown.notification-dropdown .notification-dropdown-item,
    html body .notification-dropdown .notification-dropdown-item {
        background: rgba(255,255,255,.84) !important;
        color: #0f172a !important;
    }
}

/* === Stage A18I5: restore dark-theme notification surfaces after A18I4 light pin ===
   A18I4 intentionally forced readable light notification surfaces, but it also affected dark theme.
   This block only applies when the app is explicitly in dark mode and restores dark glass cards/dropdowns.
   It is scoped to notifications only and does not touch chats/deals/Web3/swipes. */
































/* Dark bell dropdown: override A18I4 force-light surface only in dark theme. */
body.dark #notification-dropdown.notification-dropdown,
body.dark .header #notification-dropdown.notification-dropdown,
body.dark .app-header #notification-dropdown.notification-dropdown,
body.dark .topbar #notification-dropdown.notification-dropdown,
body.dark .notification-bell #notification-dropdown.notification-dropdown,
body.dark .notification-dropdown,
body.theme-dark #notification-dropdown.notification-dropdown,
body.theme-dark .header #notification-dropdown.notification-dropdown,
body.theme-dark .app-header #notification-dropdown.notification-dropdown,
body.theme-dark .topbar #notification-dropdown.notification-dropdown,
body.theme-dark .notification-bell #notification-dropdown.notification-dropdown,
body.theme-dark .notification-dropdown,
body[data-theme="dark"] #notification-dropdown.notification-dropdown,
body[data-theme="dark"] .header #notification-dropdown.notification-dropdown,
body[data-theme="dark"] .app-header #notification-dropdown.notification-dropdown,
body[data-theme="dark"] .topbar #notification-dropdown.notification-dropdown,
body[data-theme="dark"] .notification-bell #notification-dropdown.notification-dropdown,
body[data-theme="dark"] .notification-dropdown,
html[data-theme="dark"] body #notification-dropdown.notification-dropdown,
html[data-theme="dark"] body .header #notification-dropdown.notification-dropdown,
html[data-theme="dark"] body .app-header #notification-dropdown.notification-dropdown,
html[data-theme="dark"] body .topbar #notification-dropdown.notification-dropdown,
html[data-theme="dark"] body .notification-bell #notification-dropdown.notification-dropdown,
html[data-theme="dark"] body .notification-dropdown,
html.dark body #notification-dropdown.notification-dropdown,
html.dark body .header #notification-dropdown.notification-dropdown,
html.dark body .app-header #notification-dropdown.notification-dropdown,
html.dark body .topbar #notification-dropdown.notification-dropdown,
html.dark body .notification-bell #notification-dropdown.notification-dropdown,
html.dark body .notification-dropdown {
    color-scheme: dark !important;
    background:
        radial-gradient(circle at 12% 0%, rgba(124,58,237,.20), transparent 34%),
        linear-gradient(180deg, rgba(15,23,42,.96), rgba(30,41,59,.92)) !important;
    color: #f8fafc !important;
    border-color: rgba(255,255,255,.10) !important;
    box-shadow: 0 30px 80px rgba(0,0,0,.46), 0 12px 30px rgba(124,58,237,.18) !important;
}

body.dark #notification-dropdown.notification-dropdown .notification-dropdown-header,
body.dark #notification-dropdown.notification-dropdown .notification-dropdown-footer,
body.dark .notification-dropdown .notification-dropdown-header,
body.dark .notification-dropdown .notification-dropdown-footer,
body.theme-dark #notification-dropdown.notification-dropdown .notification-dropdown-header,
body.theme-dark #notification-dropdown.notification-dropdown .notification-dropdown-footer,
body.theme-dark .notification-dropdown .notification-dropdown-header,
body.theme-dark .notification-dropdown .notification-dropdown-footer,
body[data-theme="dark"] #notification-dropdown.notification-dropdown .notification-dropdown-header,
body[data-theme="dark"] #notification-dropdown.notification-dropdown .notification-dropdown-footer,
body[data-theme="dark"] .notification-dropdown .notification-dropdown-header,
body[data-theme="dark"] .notification-dropdown .notification-dropdown-footer,
html[data-theme="dark"] body #notification-dropdown.notification-dropdown .notification-dropdown-header,
html[data-theme="dark"] body #notification-dropdown.notification-dropdown .notification-dropdown-footer,
html[data-theme="dark"] body .notification-dropdown .notification-dropdown-header,
html[data-theme="dark"] body .notification-dropdown .notification-dropdown-footer,
html.dark body #notification-dropdown.notification-dropdown .notification-dropdown-header,
html.dark body #notification-dropdown.notification-dropdown .notification-dropdown-footer,
html.dark body .notification-dropdown .notification-dropdown-header,
html.dark body .notification-dropdown .notification-dropdown-footer {
    background: linear-gradient(135deg, rgba(124,58,237,.14), rgba(59,130,246,.08)) !important;
    color: #f8fafc !important;
    border-color: rgba(255,255,255,.08) !important;
}

body.dark #notification-dropdown.notification-dropdown .notification-dropdown-title,
body.dark .notification-dropdown .notification-dropdown-title,
body.theme-dark #notification-dropdown.notification-dropdown .notification-dropdown-title,
body.theme-dark .notification-dropdown .notification-dropdown-title,
body[data-theme="dark"] #notification-dropdown.notification-dropdown .notification-dropdown-title,
body[data-theme="dark"] .notification-dropdown .notification-dropdown-title,
html[data-theme="dark"] body #notification-dropdown.notification-dropdown .notification-dropdown-title,
html[data-theme="dark"] body .notification-dropdown .notification-dropdown-title,
html.dark body #notification-dropdown.notification-dropdown .notification-dropdown-title,
html.dark body .notification-dropdown .notification-dropdown-title {
    color: #f8fafc !important;
}

body.dark #notification-dropdown.notification-dropdown .notification-dropdown-item,
body.dark .notification-dropdown .notification-dropdown-item,
body.theme-dark #notification-dropdown.notification-dropdown .notification-dropdown-item,
body.theme-dark .notification-dropdown .notification-dropdown-item,
body[data-theme="dark"] #notification-dropdown.notification-dropdown .notification-dropdown-item,
body[data-theme="dark"] .notification-dropdown .notification-dropdown-item,
html[data-theme="dark"] body #notification-dropdown.notification-dropdown .notification-dropdown-item,
html[data-theme="dark"] body .notification-dropdown .notification-dropdown-item,
html.dark body #notification-dropdown.notification-dropdown .notification-dropdown-item,
html.dark body .notification-dropdown .notification-dropdown-item {
    background: rgba(30,41,59,.78) !important;
    color: #f8fafc !important;
    border-color: rgba(255,255,255,.08) !important;
}

body.dark #notification-dropdown.notification-dropdown .notification-dropdown-item.unread,
body.dark #notification-dropdown.notification-dropdown .notification-dropdown-item:hover,
body.dark .notification-dropdown .notification-dropdown-item.unread,
body.dark .notification-dropdown .notification-dropdown-item:hover,
body.theme-dark #notification-dropdown.notification-dropdown .notification-dropdown-item.unread,
body.theme-dark #notification-dropdown.notification-dropdown .notification-dropdown-item:hover,
body.theme-dark .notification-dropdown .notification-dropdown-item.unread,
body.theme-dark .notification-dropdown .notification-dropdown-item:hover,
body[data-theme="dark"] #notification-dropdown.notification-dropdown .notification-dropdown-item.unread,
body[data-theme="dark"] #notification-dropdown.notification-dropdown .notification-dropdown-item:hover,
body[data-theme="dark"] .notification-dropdown .notification-dropdown-item.unread,
body[data-theme="dark"] .notification-dropdown .notification-dropdown-item:hover,
html[data-theme="dark"] body #notification-dropdown.notification-dropdown .notification-dropdown-item.unread,
html[data-theme="dark"] body #notification-dropdown.notification-dropdown .notification-dropdown-item:hover,
html[data-theme="dark"] body .notification-dropdown .notification-dropdown-item.unread,
html[data-theme="dark"] body .notification-dropdown .notification-dropdown-item:hover,
html.dark body #notification-dropdown.notification-dropdown .notification-dropdown-item.unread,
html.dark body #notification-dropdown.notification-dropdown .notification-dropdown-item:hover,
html.dark body .notification-dropdown .notification-dropdown-item.unread,
html.dark body .notification-dropdown .notification-dropdown-item:hover {
    background: linear-gradient(135deg, rgba(124,58,237,.20), rgba(59,130,246,.12)) !important;
    color: #f8fafc !important;
    border-color: rgba(167,139,250,.20) !important;
}

body.dark #notification-dropdown.notification-dropdown .notification-dropdown-content,
body.dark .notification-dropdown .notification-dropdown-content,
body.dark #notification-dropdown.notification-dropdown .notification-dropdown-text,
body.dark .notification-dropdown .notification-dropdown-text,
body.theme-dark #notification-dropdown.notification-dropdown .notification-dropdown-content,
body.theme-dark .notification-dropdown .notification-dropdown-content,
body.theme-dark #notification-dropdown.notification-dropdown .notification-dropdown-text,
body.theme-dark .notification-dropdown .notification-dropdown-text,
body[data-theme="dark"] #notification-dropdown.notification-dropdown .notification-dropdown-content,
body[data-theme="dark"] .notification-dropdown .notification-dropdown-content,
body[data-theme="dark"] #notification-dropdown.notification-dropdown .notification-dropdown-text,
body[data-theme="dark"] .notification-dropdown .notification-dropdown-text,
html[data-theme="dark"] body #notification-dropdown.notification-dropdown .notification-dropdown-content,
html[data-theme="dark"] body .notification-dropdown .notification-dropdown-content,
html[data-theme="dark"] body #notification-dropdown.notification-dropdown .notification-dropdown-text,
html[data-theme="dark"] body .notification-dropdown .notification-dropdown-text,
html.dark body #notification-dropdown.notification-dropdown .notification-dropdown-content,
html.dark body .notification-dropdown .notification-dropdown-content,
html.dark body #notification-dropdown.notification-dropdown .notification-dropdown-text,
html.dark body .notification-dropdown .notification-dropdown-text {
    color: #f8fafc !important;
}

body.dark #notification-dropdown.notification-dropdown .notification-dropdown-meta,
body.dark .notification-dropdown .notification-dropdown-meta,
body.theme-dark #notification-dropdown.notification-dropdown .notification-dropdown-meta,
body.theme-dark .notification-dropdown .notification-dropdown-meta,
body[data-theme="dark"] #notification-dropdown.notification-dropdown .notification-dropdown-meta,
body[data-theme="dark"] .notification-dropdown .notification-dropdown-meta,
html[data-theme="dark"] body #notification-dropdown.notification-dropdown .notification-dropdown-meta,
html[data-theme="dark"] body .notification-dropdown .notification-dropdown-meta,
html.dark body #notification-dropdown.notification-dropdown .notification-dropdown-meta,
html.dark body .notification-dropdown .notification-dropdown-meta {
    color: #a78bfa !important;
}

body.dark #notification-dropdown.notification-dropdown .notification-dropdown-message,
body.dark .notification-dropdown .notification-dropdown-message,
body.theme-dark #notification-dropdown.notification-dropdown .notification-dropdown-message,
body.theme-dark .notification-dropdown .notification-dropdown-message,
body[data-theme="dark"] #notification-dropdown.notification-dropdown .notification-dropdown-message,
body[data-theme="dark"] .notification-dropdown .notification-dropdown-message,
html[data-theme="dark"] body #notification-dropdown.notification-dropdown .notification-dropdown-message,
html[data-theme="dark"] body .notification-dropdown .notification-dropdown-message,
html.dark body #notification-dropdown.notification-dropdown .notification-dropdown-message,
html.dark body .notification-dropdown .notification-dropdown-message {
    color: #cbd5e1 !important;
}



body.dark #notification-dropdown.notification-dropdown .notification-dropdown-close,
body.dark .notification-dropdown .notification-dropdown-close,
body.theme-dark #notification-dropdown.notification-dropdown .notification-dropdown-close,
body.theme-dark .notification-dropdown .notification-dropdown-close,
body[data-theme="dark"] #notification-dropdown.notification-dropdown .notification-dropdown-close,
body[data-theme="dark"] .notification-dropdown .notification-dropdown-close,
html[data-theme="dark"] body #notification-dropdown.notification-dropdown .notification-dropdown-close,
html[data-theme="dark"] body .notification-dropdown .notification-dropdown-close,
html.dark body #notification-dropdown.notification-dropdown .notification-dropdown-close,
html.dark body .notification-dropdown .notification-dropdown-close {
    background: rgba(255,255,255,.08) !important;
    color: #e2e8f0 !important;
    border-color: rgba(255,255,255,.10) !important;
}

body.dark #notification-dropdown.notification-dropdown .notification-dropdown-footer a,
body.dark .notification-dropdown .notification-dropdown-footer a,
body.dark #notification-dropdown.notification-dropdown #all-notifications-link,
body.dark .notification-dropdown #all-notifications-link,
body.theme-dark #notification-dropdown.notification-dropdown .notification-dropdown-footer a,
body.theme-dark .notification-dropdown .notification-dropdown-footer a,
body.theme-dark #notification-dropdown.notification-dropdown #all-notifications-link,
body.theme-dark .notification-dropdown #all-notifications-link,
body[data-theme="dark"] #notification-dropdown.notification-dropdown .notification-dropdown-footer a,
body[data-theme="dark"] .notification-dropdown .notification-dropdown-footer a,
body[data-theme="dark"] #notification-dropdown.notification-dropdown #all-notifications-link,
body[data-theme="dark"] .notification-dropdown #all-notifications-link,
html[data-theme="dark"] body #notification-dropdown.notification-dropdown .notification-dropdown-footer a,
html[data-theme="dark"] body .notification-dropdown .notification-dropdown-footer a,
html[data-theme="dark"] body #notification-dropdown.notification-dropdown #all-notifications-link,
html[data-theme="dark"] body .notification-dropdown #all-notifications-link,
html.dark body #notification-dropdown.notification-dropdown .notification-dropdown-footer a,
html.dark body .notification-dropdown .notification-dropdown-footer a,
html.dark body #notification-dropdown.notification-dropdown #all-notifications-link,
html.dark body .notification-dropdown #all-notifications-link {
    color: #a78bfa !important;
}

/* ===== P2P-A1 Web3 exchange skeleton ===== */
.p2p-page {
    display: flex;
    flex-direction: column;
    gap: 18px;
    max-width: 1180px;
    margin: 0 auto;
    padding-bottom: 40px;
}

.p2p-hero,
.p2p-panel {
    border: 1px solid var(--border);
    background: linear-gradient(135deg, rgba(99, 102, 241, .16), rgba(139, 92, 246, .08)), var(--bg-card);
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(18px);
}

.p2p-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 24px;
    overflow: hidden;
    position: relative;
}

.p2p-hero::after {
    content: '';
    position: absolute;
    inset: auto -80px -120px auto;
    width: 240px;
    height: 240px;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(99, 102, 241, .26), transparent 68%);
    pointer-events: none;
}

.p2p-hero-main {
    display: flex;
    align-items: center;
    gap: 18px;
    min-width: 0;
    position: relative;
    z-index: 1;
}

.p2p-hero-icon,
.p2p-kpi-icon {
    width: 62px;
    height: 62px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border-radius: 20px;
    color: #fff;
    background: linear-gradient(135deg, #6366f1, #8b5cf6 60%, #06b6d4);
    box-shadow: 0 18px 45px rgba(99, 102, 241, .28);
}

.p2p-hero-icon svg { width: 30px; height: 30px; }
.p2p-eyebrow {
    color: var(--primary);
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    font-size: 11px;
    margin-bottom: 6px;
}

.p2p-hero h1,
.p2p-panel h2,
.p2p-offer-card h3 {
    color: var(--text);
    margin: 0;
}

.p2p-hero h1 { font-size: clamp(28px, 4vw, 42px); letter-spacing: -.04em; }
.p2p-hero p,
.p2p-section-head p,
.p2p-info-panel p {
    color: var(--text-secondary);
    margin: 8px 0 0;
    line-height: 1.55;
}

.p2p-hero-note {
    position: relative;
    z-index: 1;
    min-width: 142px;
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(99, 102, 241, .13);
    border: 1px solid rgba(99, 102, 241, .2);
    text-align: center;
}
.p2p-hero-note span { display: block; color: var(--text); font-size: 24px; font-weight: 900; }
.p2p-hero-note small { color: var(--text-muted); }

.p2p-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr);
    gap: 18px;
}

.p2p-grid.p2p-create-only {
    grid-template-columns: minmax(0, 1fr);
}

.p2p-panel { padding: 20px; }
.p2p-section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.p2p-form {
    display: flex;
    flex-direction: column;
    gap: 13px;
}
.p2p-form-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.p2p-form label { display: flex; flex-direction: column; gap: 7px; color: var(--text-secondary); font-weight: 700; font-size: 13px; }
.p2p-form input,
.p2p-form select,
.p2p-form textarea,
.p2p-filters input,
.p2p-filters select,
.p2p-order-inline input {
    width: 100%;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text);
    border-radius: 14px;
    padding: 12px 13px;
    outline: none;
    font: inherit;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.p2p-form textarea { resize: vertical; min-height: 86px; }
.p2p-form input:focus,
.p2p-form select:focus,
.p2p-form textarea:focus,
.p2p-filters input:focus,
.p2p-filters select:focus,
.p2p-order-inline input:focus {
    border-color: rgba(99, 102, 241, .65);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, .14);
}
.p2p-submit { width: 100%; justify-content: center; min-height: 46px; }

.p2p-flow-list { display: grid; gap: 12px; }
.p2p-flow-list div {
    display: grid;
    grid-template-columns: 36px 1fr;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,.035);
}
.p2p-flow-list b {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 12px;
    color: #fff;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
}
.p2p-flow-list span { color: var(--text-secondary); line-height: 1.35; }
.p2p-safe-note {
    margin-top: 14px;
    padding: 12px;
    border-radius: 16px;
    color: var(--text-secondary);
    background: rgba(16, 185, 129, .10);
    border: 1px solid rgba(16, 185, 129, .18);
    line-height: 1.45;
}

.p2p-market-head { align-items: center; }
.p2p-filters {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}
.p2p-offers-list,
.p2p-orders-list { display: grid; gap: 12px; }

.p2p-offer-card,
.p2p-order-card,
.p2p-empty {
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    border-radius: 20px;
    padding: 16px;
}
.p2p-offer-card { display: grid; gap: 14px; }
.p2p-offer-top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}
.p2p-offer-action {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
    margin-bottom: 8px;
    color: #fff;
    background: linear-gradient(135deg, #10b981, #06b6d4);
}
.p2p-offer-action.buy { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.p2p-offer-maker { color: var(--text-secondary); margin-top: 6px; }
.p2p-offer-maker span { color: var(--text-muted); margin-left: 5px; }
.p2p-offer-network {
    text-align: right;
    padding: 10px 12px;
    border-radius: 16px;
    background: rgba(99, 102, 241, .10);
    border: 1px solid rgba(99, 102, 241, .16);
    min-width: 132px;
}
.p2p-offer-network b { display: block; color: var(--text); }
.p2p-offer-network span { color: var(--text-muted); font-size: 12px; }
.p2p-offer-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}
.p2p-offer-stats div {
    padding: 10px 12px;
    border-radius: 15px;
    background: rgba(255,255,255,.035);
    border: 1px solid var(--border-light);
}
.p2p-offer-stats span { display: block; color: var(--text-muted); font-size: 12px; margin-bottom: 4px; }
.p2p-offer-stats b { color: var(--text); font-size: 13px; }
.p2p-offer-terms {
    color: var(--text-secondary);
    padding: 11px 12px;
    border-radius: 14px;
    background: rgba(245, 158, 11, .09);
    border: 1px solid rgba(245, 158, 11, .14);
    line-height: 1.4;
}
.p2p-order-inline {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
}
.p2p-order-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.p2p-order-title { color: var(--text); font-weight: 900; }
.p2p-order-meta { color: var(--text-muted); margin-top: 4px; }
.p2p-order-role {
    color: var(--primary);
    font-weight: 800;
    white-space: nowrap;
}
.p2p-empty {
    display: grid;
    gap: 5px;
    text-align: center;
    color: var(--text-secondary);
    padding: 28px 16px;
}
.p2p-empty b { color: var(--text); }

body.theme-light .p2p-hero,
body.theme-light .p2p-panel,
[data-theme="light"] .p2p-hero,
[data-theme="light"] .p2p-panel {
    background: linear-gradient(135deg, rgba(99, 102, 241, .10), rgba(14, 165, 233, .06)), #fff;
    border-color: rgba(15, 23, 42, .08);
    box-shadow: 0 18px 45px rgba(15, 23, 42, .08);
}
body.theme-light .p2p-offer-card,
body.theme-light .p2p-order-card,
body.theme-light .p2p-empty,
body.theme-light .p2p-form input,
body.theme-light .p2p-form select,
body.theme-light .p2p-form textarea,
body.theme-light .p2p-filters input,
body.theme-light .p2p-filters select,
body.theme-light .p2p-order-inline input,
[data-theme="light"] .p2p-offer-card,
[data-theme="light"] .p2p-order-card,
[data-theme="light"] .p2p-empty,
[data-theme="light"] .p2p-form input,
[data-theme="light"] .p2p-form select,
[data-theme="light"] .p2p-form textarea,
[data-theme="light"] .p2p-filters input,
[data-theme="light"] .p2p-filters select,
[data-theme="light"] .p2p-order-inline input {
    background: #fff;
    color: #0f172a;
    border-color: rgba(15, 23, 42, .10);
}
body.theme-light .p2p-offer-stats div,
body.theme-light .p2p-flow-list div,
[data-theme="light"] .p2p-offer-stats div,
[data-theme="light"] .p2p-flow-list div {
    background: #f8fafc;
    border-color: rgba(15, 23, 42, .08);
}

@media (max-width: 900px) {
    .p2p-grid,
    .p2p-filters,
    .p2p-offer-stats { grid-template-columns: 1fr; }
    .p2p-hero { align-items: flex-start; flex-direction: column; }
    .p2p-form-row { grid-template-columns: 1fr; }
    .p2p-order-inline { grid-template-columns: 1fr; }
    .p2p-offer-top,
    .p2p-order-card { flex-direction: column; align-items: stretch; }
    .p2p-offer-network { text-align: left; }
}

/* ===== P2P-A2 on-chain escrow order actions ===== */
.p2p-order-card {
    align-items: stretch;
}
.p2p-order-main {
    display: grid;
    gap: 7px;
    min-width: 0;
    flex: 1 1 auto;
}
.p2p-order-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    min-width: 220px;
}
.p2p-order-route {
    color: var(--text-secondary);
    font-size: 13px;
}
.p2p-order-wallets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 2px;
}
.p2p-order-wallets span,
.p2p-tx-pill,
.p2p-order-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: fit-content;
    max-width: 100%;
    padding: 6px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.1;
    color: var(--text-secondary);
    background: rgba(99, 102, 241, .10);
    border: 1px solid rgba(99, 102, 241, .16);
}
.p2p-order-txs {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    min-height: 0;
}
.p2p-tx-pill {
    color: var(--primary);
    background: rgba(124, 58, 237, .10);
    border-color: rgba(124, 58, 237, .18);
}
.p2p-order-status-pill {
    color: #8b5cf6;
    background: rgba(139, 92, 246, .12);
    border-color: rgba(139, 92, 246, .18);
    text-align: right;
}
.p2p-order-status-escrow_locked .p2p-order-status-pill {
    color: #06b6d4;
    background: rgba(6, 182, 212, .12);
    border-color: rgba(6, 182, 212, .18);
}
.p2p-order-status-payment_marked .p2p-order-status-pill {
    color: #f59e0b;
    background: rgba(245, 158, 11, .12);
    border-color: rgba(245, 158, 11, .2);
}
.p2p-order-status-released .p2p-order-status-pill {
    color: #10b981;
    background: rgba(16, 185, 129, .12);
    border-color: rgba(16, 185, 129, .2);
}
.p2p-order-actions {
    display: grid;
    gap: 8px;
    width: 100%;
}
.p2p-order-actions .btn {
    width: 100%;
    justify-content: center;
    min-height: 40px;
    white-space: normal;
}
.p2p-order-actions .btn.success {
    color: #fff;
    background: linear-gradient(135deg, #10b981, #06b6d4);
    border-color: rgba(16, 185, 129, .36);
    box-shadow: 0 14px 28px rgba(16, 185, 129, .18);
}
body.theme-light .p2p-order-wallets span,
body.theme-light .p2p-tx-pill,
body.theme-light .p2p-order-status-pill,
[data-theme="light"] .p2p-order-wallets span,
[data-theme="light"] .p2p-tx-pill,
[data-theme="light"] .p2p-order-status-pill {
    background: #f8fafc;
    border-color: rgba(15, 23, 42, .08);
}
body.theme-light .p2p-order-route,
[data-theme="light"] .p2p-order-route {
    color: #475569;
}
@media (max-width: 900px) {
    .p2p-order-side {
        align-items: stretch;
        min-width: 0;
        width: 100%;
    }
    .p2p-order-status-pill {
        width: 100%;
        justify-content: center;
        text-align: center;
    }
    .p2p-order-wallets,
    .p2p-order-txs {
        flex-direction: column;
    }
    .p2p-order-wallets span,
    .p2p-tx-pill {
        width: 100%;
    }
}

/* P2P-A3: payment details, receipts, order chat */
.p2p-order-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(210px, 280px);
  gap: 16px;
  align-items: start;
}

.p2p-order-card {
  display: grid;
  gap: 14px;
  align-items: stretch;
}

.p2p-order-extra {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  margin-top: 14px;
}

.p2p-payment-box,
.p2p-receipts,
.p2p-order-chat {
  border: 1px solid rgba(148, 163, 184, .22);
  border-radius: 20px;
  background: rgba(255, 255, 255, .075);
  padding: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07);
}

.p2p-payment-box b,
.p2p-mini-title {
  display: block;
  font-size: .88rem;
  font-weight: 800;
  color: var(--text-primary, #f8fafc);
  margin-bottom: 8px;
}

.p2p-payment-box span,
.p2p-receipt-empty,
.p2p-order-chat-empty,
.p2p-modal-hint {
  color: var(--text-muted, #94a3b8);
  font-size: .86rem;
}

.p2p-payment-box pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 0;
  font: inherit;
  color: var(--text-primary, #f8fafc);
  line-height: 1.45;
}

.p2p-payment-box.is-locked,
.p2p-payment-box.is-missing {
  border-style: dashed;
  background: rgba(148, 163, 184, .08);
}

.p2p-receipt-row {
  display: grid;
  gap: 4px;
  padding: 10px 0;
  border-top: 1px solid rgba(148, 163, 184, .16);
}

.p2p-receipt-row:first-of-type { border-top: 0; padding-top: 0; }
.p2p-receipt-row b { color: var(--text-primary, #f8fafc); font-size: .86rem; }
.p2p-receipt-row a { color: var(--accent, #8b5cf6); font-weight: 800; text-decoration: none; }
.p2p-receipt-row span { color: var(--text-secondary, #cbd5e1); font-size: .86rem; overflow-wrap: anywhere; }

.p2p-order-chat {
  grid-column: 1 / -1;
}

.p2p-order-chat-list {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
  padding-right: 4px;
}

.p2p-order-msg {
  width: min(86%, 560px);
  border-radius: 16px;
  padding: 9px 11px;
  background: rgba(148, 163, 184, .13);
  border: 1px solid rgba(148, 163, 184, .16);
}

.p2p-order-msg.mine {
  margin-left: auto;
  background: linear-gradient(135deg, rgba(139, 92, 246, .28), rgba(59, 130, 246, .18));
  border-color: rgba(139, 92, 246, .28);
}

.p2p-order-msg b {
  display: block;
  margin-bottom: 3px;
  font-size: .78rem;
  color: var(--text-muted, #94a3b8);
}

.p2p-order-msg span {
  display: block;
  color: var(--text-primary, #f8fafc);
  overflow-wrap: anywhere;
  line-height: 1.42;
}

.p2p-order-chat-send {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 12px;
}

.p2p-order-chat-send input,
.p2p-order-inline textarea,
.p2p-modal-card textarea,
.p2p-modal-card input[type="file"] {
  width: 100%;
  border: 1px solid rgba(148, 163, 184, .25);
  border-radius: 14px;
  background: rgba(15, 23, 42, .28);
  color: var(--text-primary, #f8fafc);
  padding: 10px 12px;
  outline: none;
}

.p2p-order-inline.with-details {
  grid-template-columns: minmax(120px, 190px) minmax(220px, 1fr) auto;
}

.p2p-order-inline textarea {
  min-height: 44px;
  resize: vertical;
}

.p2p-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(2, 6, 23, .62);
  backdrop-filter: blur(12px);
}

.p2p-modal-card {
  width: min(560px, 100%);
  border-radius: 26px;
  border: 1px solid rgba(148, 163, 184, .28);
  background: rgba(15, 23, 42, .94);
  color: #f8fafc;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .42);
  padding: 20px;
}

.p2p-modal-card h3 { margin: 0 0 8px; font-size: 1.15rem; }
.p2p-modal-card p { margin: 0 0 14px; color: #cbd5e1; line-height: 1.45; }
.p2p-modal-card textarea { min-height: 120px; resize: vertical; margin-bottom: 10px; }
.p2p-modal-card input[type="file"] { margin-bottom: 8px; }
.p2p-modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }

body.light-theme .p2p-payment-box,
html.light-theme .p2p-payment-box,
[data-theme="light"] .p2p-payment-box,
body.light-theme .p2p-receipts,
html.light-theme .p2p-receipts,
[data-theme="light"] .p2p-receipts,
body.light-theme .p2p-order-chat,
html.light-theme .p2p-order-chat,
[data-theme="light"] .p2p-order-chat {
  background: rgba(255, 255, 255, .88);
  border-color: rgba(124, 58, 237, .13);
  box-shadow: 0 18px 48px rgba(15, 23, 42, .08);
}

body.light-theme .p2p-payment-box b,
html.light-theme .p2p-payment-box b,
[data-theme="light"] .p2p-payment-box b,
body.light-theme .p2p-mini-title,
html.light-theme .p2p-mini-title,
[data-theme="light"] .p2p-mini-title,
body.light-theme .p2p-order-msg span,
html.light-theme .p2p-order-msg span,
[data-theme="light"] .p2p-order-msg span,
body.light-theme .p2p-payment-box pre,
html.light-theme .p2p-payment-box pre,
[data-theme="light"] .p2p-payment-box pre {
  color: #0f172a;
}

body.light-theme .p2p-receipt-row span,
html.light-theme .p2p-receipt-row span,
[data-theme="light"] .p2p-receipt-row span,
body.light-theme .p2p-payment-box span,
html.light-theme .p2p-payment-box span,
[data-theme="light"] .p2p-payment-box span,
body.light-theme .p2p-order-chat-empty,
html.light-theme .p2p-order-chat-empty,
[data-theme="light"] .p2p-order-chat-empty,
body.light-theme .p2p-receipt-empty,
html.light-theme .p2p-receipt-empty,
[data-theme="light"] .p2p-receipt-empty {
  color: #475569;
}

body.light-theme .p2p-order-msg,
html.light-theme .p2p-order-msg,
[data-theme="light"] .p2p-order-msg {
  background: rgba(241, 245, 249, .92);
  border-color: rgba(148, 163, 184, .24);
}

body.light-theme .p2p-order-msg.mine,
html.light-theme .p2p-order-msg.mine,
[data-theme="light"] .p2p-order-msg.mine {
  background: linear-gradient(135deg, rgba(139, 92, 246, .16), rgba(59, 130, 246, .10));
  border-color: rgba(139, 92, 246, .20);
}

body.light-theme .p2p-order-chat-send input,
html.light-theme .p2p-order-chat-send input,
[data-theme="light"] .p2p-order-chat-send input,
body.light-theme .p2p-order-inline textarea,
html.light-theme .p2p-order-inline textarea,
[data-theme="light"] .p2p-order-inline textarea {
  background: #ffffff;
  color: #0f172a;
  border-color: rgba(148, 163, 184, .35);
}

@media (max-width: 760px) {
  .p2p-order-layout,
  .p2p-order-extra,
  .p2p-order-inline.with-details {
    grid-template-columns: 1fr;
  }
  .p2p-order-chat-send {
    grid-template-columns: 1fr;
  }
  .p2p-order-msg { width: 100%; }
}

/* P2P-A4: on-chain dispute state */
.p2p-dispute-box {
  border: 1px solid rgba(239, 68, 68, .28);
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(127, 29, 29, .22), rgba(15, 23, 42, .10));
  padding: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
}

.p2p-dispute-box .p2p-mini-title {
  color: #fecaca;
}

.p2p-dispute-box p {
  margin: 0 0 8px;
  color: var(--text-primary, #f8fafc);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.p2p-dispute-box span {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  border-radius: 999px;
  padding: 5px 8px;
  background: rgba(239, 68, 68, .14);
  color: #fecaca;
  font-size: .78rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.p2p-dispute-box small {
  display: block;
  margin-top: 8px;
  color: var(--text-muted, #94a3b8);
  line-height: 1.4;
}

body.light-theme .p2p-dispute-box,
html.light-theme .p2p-dispute-box,
[data-theme="light"] .p2p-dispute-box {
  background: linear-gradient(135deg, rgba(254, 242, 242, .96), rgba(255, 255, 255, .92));
  border-color: rgba(220, 38, 38, .18);
  box-shadow: 0 18px 48px rgba(127, 29, 29, .08);
}

body.light-theme .p2p-dispute-box .p2p-mini-title,
html.light-theme .p2p-dispute-box .p2p-mini-title,
[data-theme="light"] .p2p-dispute-box .p2p-mini-title,
body.light-theme .p2p-dispute-box p,
html.light-theme .p2p-dispute-box p,
[data-theme="light"] .p2p-dispute-box p {
  color: #7f1d1d;
}

body.light-theme .p2p-dispute-box span,
html.light-theme .p2p-dispute-box span,
[data-theme="light"] .p2p-dispute-box span {
  background: rgba(220, 38, 38, .10);
  color: #991b1b;
}

body.light-theme .p2p-dispute-box small,
html.light-theme .p2p-dispute-box small,
[data-theme="light"] .p2p-dispute-box small {
  color: #64748b;
}

/* P2P-A5: admin P2P arbitration + limits */
.admin-p2p-page {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.admin-p2p-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 20px;
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(125, 92, 255, .18), rgba(49, 208, 255, .10)), rgba(18, 18, 28, .72);
  border: 1px solid rgba(255,255,255,.10);
  box-shadow: 0 18px 60px rgba(0,0,0,.20);
  backdrop-filter: blur(18px);
}
.admin-p2p-header h2 { margin: 4px 0 6px; font-size: 28px; }
.admin-p2p-header p { margin: 0; color: var(--text-secondary); max-width: 720px; }
.admin-p2p-eyebrow { color: var(--accent-color, #8b5cf6); font-weight: 800; letter-spacing: .08em; text-transform: uppercase; font-size: 12px; }
.admin-p2p-header-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.admin-p2p-header-actions select {
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.08);
  color: var(--text-primary);
  border-radius: 12px;
  padding: 10px 12px;
}
.admin-p2p-warning {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(245, 158, 11, .12);
  border: 1px solid rgba(245, 158, 11, .22);
  color: var(--text-primary);
}
.admin-p2p-list { display: flex; flex-direction: column; gap: 14px; }
.admin-p2p-card {
  border-radius: 22px;
  padding: 16px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(18, 18, 28, .72);
  box-shadow: 0 16px 50px rgba(0,0,0,.18);
  backdrop-filter: blur(18px);
}
.admin-p2p-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.admin-p2p-kicker { font-size: 12px; color: var(--accent-color, #8b5cf6); font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.admin-p2p-top h3 { margin: 5px 0 4px; font-size: 20px; }
.admin-p2p-top p { margin: 0; color: var(--text-secondary); }
.admin-p2p-chain { text-align: right; border-radius: 16px; padding: 10px 12px; background: rgba(255,255,255,.07); }
.admin-p2p-chain b, .admin-p2p-chain span { display: block; }
.admin-p2p-chain span { color: var(--text-secondary); font-size: 12px; margin-top: 2px; }
.admin-p2p-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}
.admin-p2p-grid > div {
  padding: 10px;
  border-radius: 14px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.08);
  min-width: 0;
}
.admin-p2p-grid span { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }
.admin-p2p-grid b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-p2p-dispute, .admin-p2p-requisites, .admin-p2p-resolved {
  margin-top: 12px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(239, 68, 68, .10);
  border: 1px solid rgba(239, 68, 68, .20);
}
.admin-p2p-requisites { background: rgba(59,130,246,.10); border-color: rgba(59,130,246,.20); }
.admin-p2p-requisites pre { margin: 8px 0 0; white-space: pre-wrap; font: inherit; color: var(--text-primary); }
.admin-p2p-resolved { background: rgba(34,197,94,.10); border-color: rgba(34,197,94,.20); }
.admin-p2p-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}
.admin-p2p-columns > div {
  border-radius: 16px;
  padding: 12px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
}
.admin-p2p-columns h4 { margin: 0 0 8px; }
.admin-p2p-proof-row, .admin-p2p-message-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 0;
  border-top: 1px solid rgba(255,255,255,.08);
}
.admin-p2p-proof-row:first-child, .admin-p2p-message-row:first-child { border-top: 0; }
.admin-p2p-empty-line { color: var(--text-secondary); font-size: 13px; }
.admin-p2p-txs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.admin-p2p-txs span {
  border-radius: 999px;
  padding: 6px 9px;
  background: rgba(125,92,255,.12);
  border: 1px solid rgba(125,92,255,.18);
  font-size: 12px;
}
.admin-p2p-actions {
  margin-top: 14px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: stretch;
}
.admin-p2p-actions textarea {
  flex: 1 1 280px;
  min-width: 220px;
  border-radius: 14px;
  padding: 10px 12px;
  color: var(--text-primary);
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.10);
  resize: vertical;
}
.admin-p2p-empty {
  padding: 28px;
  border-radius: 20px;
  text-align: center;
  background: rgba(255,255,255,.05);
  border: 1px dashed rgba(255,255,255,.14);
}
.admin-p2p-empty b, .admin-p2p-empty span { display: block; }
.admin-p2p-empty span { margin-top: 6px; color: var(--text-secondary); }

/* Participant map, receipt thumbnails and the receipt viewer: former inline styles (style-src). */
.admin-p2p-card .admin-p2p-role-map { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0; }
.admin-p2p-card .admin-p2p-participant { border: 1px solid var(--border); border-radius: 10px; padding: 10px; background: var(--bg-secondary); min-width: 220px; flex: 1; }
.admin-p2p-card .admin-p2p-participant-name { display: block; margin-top: 4px; }
.admin-p2p-card .admin-p2p-participant-wallet { display: block; color: var(--text-secondary); margin-top: 4px; }
.admin-p2p-card .admin-p2p-receipt-image { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--border); background: var(--bg-primary); border-radius: 8px; padding: 6px 8px; cursor: pointer; text-align: left; max-width: 100%; }
.admin-p2p-card .admin-p2p-receipt-thumb { width: 54px; height: 54px; object-fit: cover; border-radius: 6px; flex: 0 0 auto; }
.admin-p2p-card .admin-p2p-receipt-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-p2p-receipt-viewer .admin-p2p-receipt-viewer-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; color: #fff; background: rgba(15,23,42,.7); }
.admin-p2p-receipt-viewer .admin-p2p-receipt-viewer-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-p2p-receipt-viewer .admin-p2p-receipt-viewer-close { border: 0; background: rgba(255,255,255,.14); color: #fff; border-radius: 8px; width: 36px; height: 36px; font-size: 22px; line-height: 1; cursor: pointer; }
.admin-p2p-receipt-viewer .admin-p2p-receipt-viewer-stage { flex: 1; display: flex; align-items: center; justify-content: center; padding: 16px; overflow: auto; }
.admin-p2p-receipt-viewer .admin-p2p-receipt-viewer-img { max-width: 100%; max-height: 100%; border-radius: 10px; object-fit: contain; box-shadow: 0 18px 60px rgba(0,0,0,.35); }

[data-theme="light"] .admin-p2p-header,
body.light .admin-p2p-header,
.light-theme .admin-p2p-header,
[data-theme="light"] .admin-p2p-card,
body.light .admin-p2p-card,
.light-theme .admin-p2p-card {
  background: rgba(255,255,255,.92);
  border-color: rgba(15,23,42,.10);
  box-shadow: 0 18px 50px rgba(15,23,42,.10);
}
[data-theme="light"] .admin-p2p-chain,
body.light .admin-p2p-chain,
.light-theme .admin-p2p-chain,
[data-theme="light"] .admin-p2p-grid > div,
body.light .admin-p2p-grid > div,
.light-theme .admin-p2p-grid > div,
[data-theme="light"] .admin-p2p-columns > div,
body.light .admin-p2p-columns > div,
.light-theme .admin-p2p-columns > div,
[data-theme="light"] .admin-p2p-actions textarea,
body.light .admin-p2p-actions textarea,
.light-theme .admin-p2p-actions textarea {
  background: rgba(248,250,252,.92);
  border-color: rgba(15,23,42,.10);
}

@media (max-width: 760px) {
  .admin-p2p-page { padding: 12px; }
  .admin-p2p-header, .admin-p2p-top { flex-direction: column; }
  .admin-p2p-chain { text-align: left; width: 100%; }
  .admin-p2p-grid, .admin-p2p-columns { grid-template-columns: 1fr; }
  .admin-p2p-header-actions { justify-content: flex-start; }
}
.p2p-resolution-box {
  border-radius: 18px;
  padding: 12px;
  background: rgba(34, 197, 94, .10);
  border: 1px solid rgba(34, 197, 94, .24);
  margin-top: 10px;
}
.p2p-resolution-box p { margin: 8px 0; color: var(--text-primary); }
.p2p-resolution-box span { color: var(--text-secondary); font-size: 13px; }

/* P2P-A6: exact-payment safety, timers and payer-name proof */
.p2p-safety-box {
  margin: 12px 0;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(124, 92, 255, .18);
  background: linear-gradient(135deg, rgba(124, 92, 255, .10), rgba(26, 188, 156, .07));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
}
.p2p-safety-box.is-expired {
  border-color: rgba(255, 87, 87, .30);
  background: linear-gradient(135deg, rgba(255, 87, 87, .13), rgba(124, 92, 255, .06));
}
.p2p-safety-grid {
  display: grid;
  grid-template-columns: minmax(110px, .8fr) 1.2fr;
  gap: 8px 12px;
  margin-top: 8px;
  align-items: center;
}
.p2p-safety-grid span {
  color: var(--text-secondary, rgba(232, 236, 255, .68));
  font-size: 12px;
}
.p2p-safety-grid b {
  font-size: 13px;
  color: var(--text-primary, #fff);
  word-break: break-word;
}
.p2p-safety-box small {
  display: block;
  margin-top: 10px;
  color: var(--text-secondary, rgba(232, 236, 255, .70));
  line-height: 1.45;
}
.p2p-expired-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 87, 87, .35);
  color: #ffb4b4;
  background: rgba(255, 87, 87, .10);
  font-weight: 800;
  font-size: 13px;
}
.p2p-receipt-row small {
  display: block;
  color: var(--text-secondary, rgba(232, 236, 255, .68));
  font-size: 12px;
  margin-top: 3px;
}
.p2p-modal-card input[data-payer-name] {
  width: 100%;
  min-height: 44px;
  border-radius: 14px;
  border: 1px solid rgba(124, 92, 255, .25);
  background: rgba(255,255,255,.07);
  color: var(--text-primary, #fff);
  padding: 0 13px;
  margin: 8px 0 10px;
  outline: none;
}
html[data-theme="light"] .p2p-safety-box,
body.light .p2p-safety-box,
.theme-light .p2p-safety-box {
  background: linear-gradient(135deg, rgba(124, 92, 255, .08), rgba(14, 165, 233, .06));
  border-color: rgba(124, 92, 255, .18);
}
html[data-theme="light"] .p2p-safety-grid span,
body.light .p2p-safety-grid span,
.theme-light .p2p-safety-grid span,
html[data-theme="light"] .p2p-safety-box small,
body.light .p2p-safety-box small,
.theme-light .p2p-safety-box small,
html[data-theme="light"] .p2p-receipt-row small,
body.light .p2p-receipt-row small,
.theme-light .p2p-receipt-row small {
  color: rgba(36, 45, 70, .68);
}
html[data-theme="light"] .p2p-safety-grid b,
body.light .p2p-safety-grid b,
.theme-light .p2p-safety-grid b {
  color: #141a2d;
}
@media (max-width: 640px) {
  .p2p-safety-grid { grid-template-columns: 1fr; gap: 4px; }
}

/* P2P-A7: reputation / feedback polish */
.p2p-trust-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: max-content;
  max-width: 100%;
  margin-top: 7px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  color: rgba(255, 255, 255, .92);
  background: rgba(255, 255, 255, .10);
  border: 1px solid rgba(255, 255, 255, .14);
  box-shadow: 0 10px 26px rgba(0, 0, 0, .12);
}
.p2p-trust-badge.trusted { background: linear-gradient(135deg, rgba(22, 163, 74, .82), rgba(14, 165, 233, .72)); }
.p2p-trust-badge.verified { background: linear-gradient(135deg, rgba(124, 58, 237, .82), rgba(59, 130, 246, .68)); }
.p2p-trust-badge.basic { background: rgba(124, 58, 237, .52); }
.p2p-trust-badge.risk { background: linear-gradient(135deg, rgba(239, 68, 68, .88), rgba(245, 158, 11, .72)); }
.p2p-trust-card {
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .12);
}
.p2p-trust-card b { display:block; font-size: 13px; margin-bottom: 4px; }
.p2p-trust-card span { display:block; font-size: 12px; opacity: .78; }
.p2p-feedback-box {
  margin-top: 12px;
  padding: 13px;
  border-radius: 18px;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .10);
}
.p2p-feedback-row {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) auto;
  gap: 6px 10px;
  padding: 10px 0;
  border-top: 1px solid rgba(255, 255, 255, .09);
}
.p2p-feedback-row:first-of-type { border-top: 0; }
.p2p-feedback-row b { font-size: 13px; }
.p2p-feedback-row span { font-weight: 800; color: #facc15; letter-spacing: 1px; }
.p2p-feedback-row p {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  opacity: .84;
}
.p2p-feedback-row.mine b::after { content: ' · вы'; opacity: .6; font-weight: 600; }
.p2p-feedback-empty { font-size: 13px; opacity: .72; padding-top: 6px; }
[data-theme="light"] .p2p-trust-badge,
body.light .p2p-trust-badge,
body.theme-light .p2p-trust-badge,
html[data-theme="light"] .p2p-trust-badge {
  color: #172033;
  background: rgba(255, 255, 255, .84);
  border-color: rgba(124, 58, 237, .16);
}
[data-theme="light"] .p2p-trust-badge.trusted,
body.light .p2p-trust-badge.trusted,
body.theme-light .p2p-trust-badge.trusted,
html[data-theme="light"] .p2p-trust-badge.trusted { background: linear-gradient(135deg, rgba(220, 252, 231, .95), rgba(219, 234, 254, .9)); color: #14532d; }
[data-theme="light"] .p2p-trust-badge.verified,
body.light .p2p-trust-badge.verified,
body.theme-light .p2p-trust-badge.verified,
html[data-theme="light"] .p2p-trust-badge.verified { background: linear-gradient(135deg, rgba(237, 233, 254, .95), rgba(219, 234, 254, .9)); color: #4c1d95; }
[data-theme="light"] .p2p-trust-badge.risk,
body.light .p2p-trust-badge.risk,
body.theme-light .p2p-trust-badge.risk,
html[data-theme="light"] .p2p-trust-badge.risk { background: linear-gradient(135deg, rgba(254, 226, 226, .95), rgba(254, 243, 199, .9)); color: #991b1b; }
[data-theme="light"] .p2p-feedback-box,
body.light .p2p-feedback-box,
body.theme-light .p2p-feedback-box,
html[data-theme="light"] .p2p-feedback-box {
  background: rgba(255, 255, 255, .86);
  border-color: rgba(124, 58, 237, .13);
  color: #172033;
}
[data-theme="light"] .p2p-feedback-row,
body.light .p2p-feedback-row,
body.theme-light .p2p-feedback-row,
html[data-theme="light"] .p2p-feedback-row { border-top-color: rgba(17, 24, 39, .08); }
@media (max-width: 640px) {
  .p2p-trust-badge { white-space: normal; width: 100%; justify-content: center; }
  .p2p-feedback-row { grid-template-columns: 1fr; }
}

/* P2P-A8: personal offer/order management */
.p2p-small-select {
  min-width: 160px;
  border: 1px solid rgba(148, 163, 184, .28);
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(15, 23, 42, .38);
  color: var(--text-primary, #f8fafc);
  outline: none;
}

[data-theme="light"] .p2p-small-select,
body.light .p2p-small-select,
.light-theme .p2p-small-select {
  background: rgba(255, 255, 255, .9);
  color: #111827;
  border-color: rgba(99, 102, 241, .18);
}

.p2p-limit-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
  margin: 0 0 14px;
  color: var(--text-secondary, #cbd5e1);
  font-size: .9rem;
}

.p2p-limit-summary span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(99, 102, 241, .11);
  border: 1px solid rgba(129, 140, 248, .16);
}

.p2p-my-offers-list {
  display: grid;
  gap: 12px;
}

.p2p-my-offer-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 16px;
  border-radius: 20px;
  background: rgba(15, 23, 42, .38);
  border: 1px solid rgba(148, 163, 184, .18);
  box-shadow: 0 18px 44px rgba(0, 0, 0, .12);
}

[data-theme="light"] .p2p-my-offer-card,
body.light .p2p-my-offer-card,
.light-theme .p2p-my-offer-card {
  background: rgba(255, 255, 255, .88);
  border-color: rgba(99, 102, 241, .14);
  box-shadow: 0 18px 44px rgba(99, 102, 241, .08);
}

.p2p-my-offer-title {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 4px;
}

.p2p-my-offer-title b {
  color: var(--text-primary, #f8fafc);
}

.p2p-my-offer-title span {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 700;
  color: #c4b5fd;
  background: rgba(124, 58, 237, .13);
}

.p2p-offer-status-active .p2p-my-offer-title span { color: #86efac; background: rgba(34, 197, 94, .14); }
.p2p-offer-status-paused .p2p-my-offer-title span { color: #fcd34d; background: rgba(245, 158, 11, .14); }
.p2p-offer-status-closed .p2p-my-offer-title span { color: #cbd5e1; background: rgba(148, 163, 184, .14); }

[data-theme="light"] .p2p-offer-status-active .p2p-my-offer-title span,
body.light .p2p-offer-status-active .p2p-my-offer-title span,
.light-theme .p2p-offer-status-active .p2p-my-offer-title span { color: #047857; background: rgba(16, 185, 129, .14); }
[data-theme="light"] .p2p-offer-status-paused .p2p-my-offer-title span,
body.light .p2p-offer-status-paused .p2p-my-offer-title span,
.light-theme .p2p-offer-status-paused .p2p-my-offer-title span { color: #92400e; background: rgba(245, 158, 11, .16); }
[data-theme="light"] .p2p-offer-status-closed .p2p-my-offer-title span,
body.light .p2p-offer-status-closed .p2p-my-offer-title span,
.light-theme .p2p-offer-status-closed .p2p-my-offer-title span { color: #475569; background: rgba(100, 116, 139, .12); }

.p2p-my-offer-rate {
  color: var(--text-primary, #f8fafc);
  font-weight: 800;
  margin-bottom: 4px;
}

.p2p-my-offer-meta,
.p2p-my-offer-stats {
  color: var(--text-secondary, #cbd5e1);
  font-size: .9rem;
}

.p2p-my-offer-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 8px;
}

.p2p-my-offer-stats span {
  padding: 6px 8px;
  border-radius: 999px;
  background: rgba(148, 163, 184, .09);
}

.p2p-my-offer-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.p2p-my-offers-panel.is-collapsed {
  padding: 0;
  overflow: hidden;
}

.p2p-my-offers-panel.is-open {
  overflow: hidden;
}

/* === DEALIX-CRYPTO-R3W: unified collapsible P2P market/my listings/orders === */
.p2p-collapsible-panel.is-collapsed {
  padding: 0;
  overflow: hidden;
}

.p2p-collapsible-panel.is-open {
  overflow: hidden;
}

.p2p-collapsible-panel.is-open .p2p-collapse-head {
  padding: 0 0 16px;
}

.p2p-collapsible-panel.is-open .p2p-collapse-arrow {
  transform: rotate(180deg);
}

.p2p-market-toolbar {
  justify-content: flex-end;
}

.p2p-collapse-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.p2p-my-offers-panel.is-open .p2p-collapse-head {
  padding: 0 0 16px;
}

.p2p-collapse-head h2 {
  margin: 0;
}

.p2p-collapse-head p {
  margin: 7px 0 0;
  color: var(--text-secondary);
  line-height: 1.45;
}

.p2p-collapse-action {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  color: var(--primary);
  font-size: .84rem;
  font-weight: 800;
}

.p2p-collapse-arrow {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  box-shadow: 0 12px 30px rgba(99, 102, 241, .22);
  transition: transform .18s ease;
}

.p2p-collapse-arrow::before {
  content: '';
  width: 9px;
  height: 9px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}

.p2p-my-offers-panel.is-open .p2p-collapse-arrow {
  transform: rotate(180deg);
}

.p2p-collapsible-body[hidden] {
  display: none !important;
}

.p2p-collapsible-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

[data-theme="light"] .p2p-collapse-head p,
body.light .p2p-collapse-head p,
body.light-theme .p2p-collapse-head p,
body.theme-light .p2p-collapse-head p,
.light-theme .p2p-collapse-head p {
  color: #64748b;
}

@media (max-width: 720px) {
  .p2p-my-offer-card {
    grid-template-columns: 1fr;
  }
  .p2p-collapse-head {
    align-items: stretch;
    flex-direction: column;
    padding: 16px;
  }
  .p2p-my-offers-panel.is-open .p2p-collapse-head,
  .p2p-collapsible-panel.is-open .p2p-collapse-head {
    padding: 0 0 14px;
  }
  .p2p-collapse-action {
    justify-content: space-between;
    width: 100%;
  }
  .p2p-collapsible-toolbar {
    justify-content: stretch;
  }
  .p2p-my-offer-actions {
    justify-content: stretch;
  }
  .p2p-my-offer-actions .btn,
  .p2p-small-select {
    width: 100%;
  }
}

/* P2P-A9: action confirmations and order timeline */
.p2p-order-timeline,
.p2p-confirm-rows {
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, .16);
  background: rgba(15, 23, 42, .26);
  padding: 12px;
}

.p2p-order-timeline {
  display: grid;
  gap: 10px;
}

.p2p-timeline-row {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  align-items: start;
}

.p2p-timeline-dot {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  color: #ddd6fe;
  background: linear-gradient(135deg, rgba(124, 58, 237, .38), rgba(14, 165, 233, .22));
  border: 1px solid rgba(167, 139, 250, .24);
  box-shadow: 0 10px 24px rgba(79, 70, 229, .14);
}

.p2p-timeline-body {
  min-width: 0;
}

.p2p-timeline-body b {
  display: block;
  color: var(--text-primary, #f8fafc);
  font-size: .92rem;
}

.p2p-timeline-body small {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary, #cbd5e1);
  font-size: .8rem;
  margin-top: 2px;
}

.p2p-timeline-empty {
  color: var(--text-secondary, #cbd5e1);
  font-size: .9rem;
}

.p2p-confirm-card h3 {
  margin-bottom: 8px;
}

.p2p-confirm-rows {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.p2p-confirm-rows div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 14px;
  background: rgba(148, 163, 184, .08);
}

.p2p-confirm-rows span {
  color: var(--text-secondary, #cbd5e1);
  font-size: .86rem;
}

.p2p-confirm-rows b {
  color: var(--text-primary, #f8fafc);
  text-align: right;
  word-break: break-word;
}

[data-theme="light"] .p2p-order-timeline,
[data-theme="light"] .p2p-confirm-rows,
body.light .p2p-order-timeline,
body.light .p2p-confirm-rows,
.light-theme .p2p-order-timeline,
.light-theme .p2p-confirm-rows {
  background: rgba(255, 255, 255, .84);
  border-color: rgba(99, 102, 241, .14);
  box-shadow: 0 14px 34px rgba(99, 102, 241, .06);
}

[data-theme="light"] .p2p-timeline-dot,
body.light .p2p-timeline-dot,
.light-theme .p2p-timeline-dot {
  color: #4c1d95;
  background: linear-gradient(135deg, rgba(139, 92, 246, .20), rgba(14, 165, 233, .12));
  border-color: rgba(124, 58, 237, .18);
}

[data-theme="light"] .p2p-confirm-rows div,
body.light .p2p-confirm-rows div,
.light-theme .p2p-confirm-rows div {
  background: rgba(99, 102, 241, .07);
}

@media (max-width: 720px) {
  .p2p-timeline-row {
    grid-template-columns: 30px 1fr;
  }
  .p2p-timeline-dot {
    width: 26px;
    height: 26px;
  }
  .p2p-confirm-rows div {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }
  .p2p-confirm-rows b {
    text-align: left;
  }
}

/* P2P-A10: SAVECHAT styled modals, SVG icons and security polish */
.p2p-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10080;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: radial-gradient(circle at 50% 0%, rgba(99, 102, 241, .24), transparent 38%), rgba(2, 6, 23, .68);
  backdrop-filter: blur(14px) saturate(1.12);
}

.p2p-modal-card {
  width: min(560px, calc(100vw - 28px));
  max-height: calc(100vh - 34px);
  overflow: auto;
  border-radius: 28px;
  border: 1px solid rgba(167, 139, 250, .22);
  background:
    linear-gradient(135deg, rgba(99, 102, 241, .18), rgba(14, 165, 233, .08)),
    rgba(15, 23, 42, .94);
  box-shadow: 0 30px 80px rgba(2, 6, 23, .42), inset 0 1px 0 rgba(255,255,255,.08);
  padding: 20px;
  color: #f8fafc;
}

.p2p-modal-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.p2p-modal-icon {
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  color: #fff;
  background: linear-gradient(135deg, #6366f1, #8b5cf6 58%, #06b6d4);
  box-shadow: 0 18px 44px rgba(99, 102, 241, .28);
}

.p2p-modal-icon svg,
.p2p-timeline-dot svg { width: 24px; height: 24px; }
.p2p-modal-head.is-danger .p2p-modal-icon { background: linear-gradient(135deg, #ef4444, #f97316); box-shadow: 0 18px 44px rgba(239, 68, 68, .22); }
.p2p-modal-head h3 { margin: 0; color: #f8fafc; font-size: 1.22rem; letter-spacing: -.025em; }
.p2p-modal-head small { display: block; margin-top: 3px; color: #a5b4fc; font-size: .82rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }

.p2p-modal-card p {
  color: #cbd5e1;
  line-height: 1.55;
  margin: 0 0 14px;
}

.p2p-modal-card label {
  display: block;
  color: #e2e8f0;
  font-size: .9rem;
  font-weight: 800;
  margin: 12px 0 7px;
}

.p2p-modal-card input[type="text"],
.p2p-modal-card input[type="file"],
.p2p-modal-card select,
.p2p-modal-card textarea {
  width: 100%;
  border: 1px solid rgba(148, 163, 184, .22);
  background: rgba(2, 6, 23, .34);
  color: #f8fafc;
  border-radius: 16px;
  padding: 12px 13px;
  outline: none;
  font: inherit;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
}

.p2p-modal-card textarea { min-height: 112px; resize: vertical; }
.p2p-modal-card input:focus,
.p2p-modal-card select:focus,
.p2p-modal-card textarea:focus {
  border-color: rgba(129, 140, 248, .62);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, .16), inset 0 1px 0 rgba(255,255,255,.06);
}

.p2p-modal-hint {
  margin-top: 12px;
  padding: 12px 13px;
  border-radius: 16px;
  color: #c7d2fe;
  background: rgba(99, 102, 241, .13);
  border: 1px solid rgba(129, 140, 248, .20);
  line-height: 1.45;
  font-size: .9rem;
}

.p2p-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.p2p-confirm-rows {
  background: rgba(2, 6, 23, .28);
  border-color: rgba(167, 139, 250, .16);
}

.p2p-confirm-rows div {
  background: rgba(255,255,255,.045);
  border: 1px solid rgba(255,255,255,.06);
}

.p2p-timeline-dot {
  font-size: 0;
}

.p2p-timeline-dot svg {
  width: 16px;
  height: 16px;
  stroke-width: 2;
}

[data-theme="light"] .p2p-modal-backdrop,
body.light .p2p-modal-backdrop,
body.theme-light .p2p-modal-backdrop,
.light-theme .p2p-modal-backdrop {
  background: radial-gradient(circle at 50% 0%, rgba(99, 102, 241, .20), transparent 40%), rgba(15, 23, 42, .18);
}

[data-theme="light"] .p2p-modal-card,
body.light .p2p-modal-card,
body.theme-light .p2p-modal-card,
.light-theme .p2p-modal-card {
  background: linear-gradient(135deg, rgba(99, 102, 241, .10), rgba(14, 165, 233, .06)), rgba(255, 255, 255, .96);
  border-color: rgba(99, 102, 241, .16);
  color: #0f172a;
  box-shadow: 0 28px 76px rgba(15, 23, 42, .18), inset 0 1px 0 rgba(255,255,255,.8);
}

[data-theme="light"] .p2p-modal-head h3,
body.light .p2p-modal-head h3,
body.theme-light .p2p-modal-head h3,
.light-theme .p2p-modal-head h3 { color: #0f172a; }

[data-theme="light"] .p2p-modal-card p,
body.light .p2p-modal-card p,
body.theme-light .p2p-modal-card p,
.light-theme .p2p-modal-card p { color: #475569; }

[data-theme="light"] .p2p-modal-card label,
body.light .p2p-modal-card label,
body.theme-light .p2p-modal-card label,
.light-theme .p2p-modal-card label { color: #1e293b; }

[data-theme="light"] .p2p-modal-card input[type="text"],
[data-theme="light"] .p2p-modal-card input[type="file"],
[data-theme="light"] .p2p-modal-card select,
[data-theme="light"] .p2p-modal-card textarea,
body.light .p2p-modal-card input[type="text"],
body.light .p2p-modal-card input[type="file"],
body.light .p2p-modal-card select,
body.light .p2p-modal-card textarea,
body.theme-light .p2p-modal-card input[type="text"],
body.theme-light .p2p-modal-card input[type="file"],
body.theme-light .p2p-modal-card select,
body.theme-light .p2p-modal-card textarea,
.light-theme .p2p-modal-card input[type="text"],
.light-theme .p2p-modal-card input[type="file"],
.light-theme .p2p-modal-card select,
.light-theme .p2p-modal-card textarea {
  background: rgba(248, 250, 252, .95);
  color: #0f172a;
  border-color: rgba(99, 102, 241, .16);
}

[data-theme="light"] .p2p-modal-hint,
body.light .p2p-modal-hint,
body.theme-light .p2p-modal-hint,
.light-theme .p2p-modal-hint {
  color: #3730a3;
  background: rgba(99, 102, 241, .08);
  border-color: rgba(99, 102, 241, .14);
}

@media (max-width: 640px) {
  .p2p-modal-backdrop { align-items: flex-end; padding: 10px; }
  .p2p-modal-card { border-radius: 24px; padding: 16px; width: 100%; }
  .p2p-modal-actions { flex-direction: column-reverse; }
  .p2p-modal-actions .btn { width: 100%; justify-content: center; }
}

/* === A18J: mobile chat fast outgoing message settle === */
@media (max-width: 1024px) {
    #chat-messages,
    .chat-messages {
        scroll-behavior: auto !important;
    }

    body.chat-mobile-send-settling #chat-messages,
    body.chat-mobile-send-settling .chat-messages {
        scroll-behavior: auto !important;
        overflow-anchor: none !important;
    }

    body.chat-mobile-send-settling #chat-messages .message-wrap,
    body.chat-mobile-send-settling #chat-messages .message,
    body.chat-mobile-send-settling #chat-messages .message-content {
        animation: none !important;
        transition: none !important;
    }
}

/* === PROFILE-AVATAR-R1: avatar viewer actions === */
.fullscreen-image-more {
    position: fixed;
    top: max(16px, env(safe-area-inset-top));
    left: max(16px, env(safe-area-inset-left));
    z-index: 100002;
    width: 46px;
    height: 46px;
    padding: 0;
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 50%;
    background: rgba(24,24,28,.72);
    color: #fff;
    font-size: 1.05rem;
    font-weight: 900;
    letter-spacing: -2px;
    display: grid;
    place-items: center;
    cursor: pointer;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.fullscreen-image-menu {
    position: fixed;
    top: calc(max(16px, env(safe-area-inset-top)) + 54px);
    left: max(16px, env(safe-area-inset-left));
    z-index: 100002;
    width: min(300px, calc(100vw - 32px));
    padding: 8px;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 20px;
    background: rgba(24,24,28,.92);
    box-shadow: 0 24px 70px rgba(0,0,0,.48);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
}

.fullscreen-image-menu.hidden {
    display: none;
}

.fullscreen-image-menu button {
    width: 100%;
    min-height: 48px;
    padding: 0 12px;
    border: 0;
    border-radius: 14px;
    background: transparent;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 12px;
    font: inherit;
    font-weight: 800;
    text-align: left;
    cursor: pointer;
}

.fullscreen-image-menu button:hover {
    background: rgba(255,255,255,.09);
}

.fullscreen-image-menu button.danger {
    color: #ff6b6b;
}

.fullscreen-image-menu button:disabled {
    opacity: .55;
    cursor: wait;
}

@media (max-width: 640px) {
    .fullscreen-image-close {
        top: max(16px, env(safe-area-inset-top));
        right: max(16px, env(safe-area-inset-right));
        width: 46px;
        height: 46px;
    }
}

/* === PROFILE-PHOTO-CAPTION-R1: keep descriptions below media without a full-width strip === */
html body .profile-photo-viewer:has(.profile-photo-caption:not(:empty)) .profile-photo-viewer-media {
    bottom: 202px !important;
}

html body .profile-photo-viewer .profile-photo-caption {
    position: fixed !important;
    left: 50% !important;
    right: auto !important;
    bottom: 112px !important;
    width: min(760px, calc(100vw - 40px)) !important;
    max-width: min(760px, calc(100vw - 40px)) !important;
    max-height: 82px !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 8px 2px !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: rgba(255,255,255,.94) !important;
    /* Centred under the centred photo: the column is wider than most photos. */
    text-align: center !important;
    font-size: 1rem !important;
    line-height: 1.4 !important;
    font-weight: 800 !important;
    text-shadow: 0 2px 10px rgba(0,0,0,.7) !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    transform: translateX(-50%) !important;
    overflow: auto !important;
    z-index: 10030 !important;
    box-sizing: border-box !important;
}

html body .profile-photo-viewer .profile-photo-caption:empty {
    display: none !important;
}

@media (max-width: 760px) {
    html body .profile-photo-viewer:has(.profile-photo-caption:not(:empty)) .profile-photo-viewer-media {
        bottom: calc(184px + env(safe-area-inset-bottom)) !important;
    }

    html body .profile-photo-viewer .profile-photo-caption {
        left: 16px !important;
        right: 16px !important;
        bottom: calc(108px + env(safe-area-inset-bottom)) !important;
        width: auto !important;
        max-width: none !important;
        max-height: 68px !important;
        padding: 7px 0 !important;
        font-size: .92rem !important;
        transform: none !important;
    }
}

/* === DEALIX-CRYPTO-R3O: P2P market UX cleanup and local pagination === */
.p2p-market-panel .p2p-offers-list {
    gap: 14px;
}

.p2p-page,
.p2p-panel,
.p2p-market-panel,
.p2p-orders-panel {
    min-width: 0;
}

.p2p-filters {
    grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
}

.p2p-filters > *,
.p2p-small-select {
    min-width: 0;
    max-width: 100%;
}

.p2p-market-panel .p2p-offer-card {
    display: grid;
    gap: 12px;
    border-radius: 18px;
    padding: 14px;
    background: linear-gradient(135deg, rgba(15, 23, 42, .34), rgba(30, 41, 59, .18));
    border-color: rgba(148, 163, 184, .18);
}

.p2p-market-panel .p2p-offer-top {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(128px, auto);
    gap: 14px;
    align-items: start;
}

.p2p-market-panel .p2p-offer-main {
    min-width: 0;
}

.p2p-market-panel .p2p-offer-card h3 {
    font-size: 1.08rem;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.p2p-market-panel .p2p-offer-action {
    margin-bottom: 6px;
}

.p2p-market-panel .p2p-offer-maker {
    font-size: .9rem;
}

.p2p-market-panel .p2p-offer-network {
    border-radius: 14px;
    min-width: 128px;
}

.p2p-market-panel .p2p-offer-stats {
    grid-template-columns: repeat(4, minmax(120px, 1fr));
}

.p2p-market-panel .p2p-offer-stats div {
    min-width: 0;
}

.p2p-market-panel .p2p-offer-stats b {
    display: block;
    overflow-wrap: anywhere;
}

.p2p-market-panel .p2p-order-inline {
    align-items: stretch;
    grid-template-columns: minmax(150px, 1fr) auto auto;
    padding: 10px;
    border-radius: 16px;
    background: rgba(2, 6, 23, .18);
    border: 1px solid rgba(148, 163, 184, .16);
}

.p2p-market-panel .p2p-order-inline.with-details {
    grid-template-columns: minmax(130px, 180px) minmax(220px, 1fr) auto;
}

.p2p-market-panel .p2p-order-inline .btn {
    min-height: 42px;
    justify-content: center;
    white-space: nowrap;
}

.p2p-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(148, 163, 184, .16);
}

.p2p-page-info {
    color: var(--text-secondary);
    font-size: .9rem;
    font-weight: 700;
}

.p2p-page-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 7px;
}

.p2p-page-btn,
.p2p-page-gap {
    min-width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-weight: 850;
    font-size: .9rem;
}

.p2p-page-btn {
    border: 1px solid rgba(148, 163, 184, .24);
    color: var(--text);
    background: rgba(15, 23, 42, .20);
    cursor: pointer;
    transition: transform .16s ease, border-color .16s ease, background .16s ease;
}

.p2p-page-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    border-color: rgba(99, 102, 241, .42);
    background: rgba(99, 102, 241, .14);
}

.p2p-page-btn.active {
    color: #fff;
    border-color: rgba(16, 185, 129, .35);
    background: linear-gradient(135deg, #10b981, #06b6d4);
    box-shadow: 0 12px 26px rgba(16, 185, 129, .18);
}

.p2p-page-btn.nav {
    min-width: 84px;
}

.p2p-page-btn:disabled {
    opacity: .45;
    cursor: default;
}

.p2p-page-gap {
    color: var(--text-muted);
}

.p2p-order-actions .p2p-order-chat-btn {
    color: var(--text);
    background: rgba(99, 102, 241, .12);
    border-color: rgba(99, 102, 241, .22);
}

.p2p-order-actions .p2p-order-chat-btn:hover {
    background: rgba(99, 102, 241, .18);
}

.p2p-order-actions .btn.danger {
    color: #fff;
    background: linear-gradient(135deg, #ef4444, #f97316);
    border-color: rgba(239, 68, 68, .34);
    box-shadow: 0 14px 28px rgba(239, 68, 68, .18);
}

.p2p-order-actions .p2p-order-details-btn {
    color: #fff;
    background: linear-gradient(135deg, #10b981, #22c55e);
    border-color: rgba(16, 185, 129, .36);
    box-shadow: 0 14px 28px rgba(16, 185, 129, .16);
}

.p2p-orders-workspace {
    display: grid;
    grid-template-columns: minmax(230px, .52fr) minmax(0, 1fr);
    gap: 14px;
    align-items: start;
}

.p2p-orders-rail {
    display: grid;
    gap: 9px;
    align-content: start;
    max-height: min(720px, calc(100vh - 220px));
    overflow: auto;
    padding-right: 4px;
}

.p2p-order-summary {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    text-align: left;
    border: 1px solid rgba(148, 163, 184, .18);
    border-radius: 16px;
    padding: 11px 12px;
    color: var(--text);
    background: rgba(15, 23, 42, .18);
    cursor: pointer;
    transition: transform .16s ease, border-color .16s ease, background .16s ease, box-shadow .16s ease;
}

.p2p-order-summary:hover,
.p2p-order-summary.active {
    transform: translateY(-1px);
    border-color: rgba(99, 102, 241, .34);
    background: rgba(99, 102, 241, .12);
}

.p2p-order-summary.active {
    box-shadow: inset 3px 0 0 #10b981, 0 14px 28px rgba(15, 23, 42, .12);
}

.p2p-order-summary-main,
.p2p-order-summary-side {
    min-width: 0;
    display: grid;
    gap: 4px;
}

.p2p-order-summary-main b,
.p2p-order-summary-side strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.p2p-order-summary-main small,
.p2p-order-summary-side em {
    color: var(--text-muted);
    font-size: .78rem;
    font-style: normal;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.p2p-order-summary-side {
    justify-items: end;
    max-width: 138px;
}

.p2p-order-detail-pane {
    min-width: 0;
}

.p2p-order-detail-empty {
    display: grid;
    gap: 6px;
    min-height: 180px;
    place-items: center;
    text-align: center;
    border: 1px dashed rgba(148, 163, 184, .24);
    border-radius: 18px;
    color: var(--text-secondary);
    background: rgba(15, 23, 42, .12);
    padding: 18px;
}

.p2p-order-detail-empty b {
    color: var(--text);
}

body.theme-light .p2p-market-panel .p2p-offer-card,
body.light-theme .p2p-market-panel .p2p-offer-card,
[data-theme="light"] .p2p-market-panel .p2p-offer-card {
    background: #fff;
    border-color: rgba(15, 23, 42, .10);
}

body.theme-light .p2p-market-panel .p2p-order-inline,
body.light-theme .p2p-market-panel .p2p-order-inline,
[data-theme="light"] .p2p-market-panel .p2p-order-inline,
body.theme-light .p2p-order-summary,
body.light-theme .p2p-order-summary,
[data-theme="light"] .p2p-order-summary,
body.theme-light .p2p-order-detail-empty,
body.light-theme .p2p-order-detail-empty,
[data-theme="light"] .p2p-order-detail-empty,
body.theme-light .p2p-page-btn,
body.light-theme .p2p-page-btn,
[data-theme="light"] .p2p-page-btn {
    background: #f8fafc;
    border-color: rgba(15, 23, 42, .10);
}

body.theme-light .p2p-page-btn.active,
body.light-theme .p2p-page-btn.active,
[data-theme="light"] .p2p-page-btn.active {
    color: #fff;
    background: linear-gradient(135deg, #059669, #0891b2);
}

@media (max-width: 980px) {
    .p2p-market-panel .p2p-offer-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .p2p-filters {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 2px 2px 10px;
        margin-bottom: 12px;
        scrollbar-width: thin;
        -webkit-overflow-scrolling: touch;
    }

    .p2p-filters select,
    .p2p-filters input {
        flex: 0 0 min(74vw, 220px);
        width: auto;
    }

    .p2p-section-head {
        flex-direction: column;
        align-items: stretch;
    }

    .p2p-small-select {
        width: 100%;
    }

    .p2p-orders-workspace {
        grid-template-columns: 1fr;
    }

    .p2p-orders-rail {
        display: flex;
        overflow-x: auto;
        overflow-y: hidden;
        max-height: none;
        padding: 2px 2px 10px;
        scroll-snap-type: x proximity;
        -webkit-overflow-scrolling: touch;
    }

    .p2p-order-summary {
        flex: 0 0 min(86vw, 340px);
        scroll-snap-align: start;
    }

    .p2p-market-panel .p2p-offer-top,
    .p2p-market-panel .p2p-order-inline,
    .p2p-market-panel .p2p-order-inline.with-details {
        grid-template-columns: 1fr;
    }

    .p2p-market-panel .p2p-offer-network {
        text-align: left;
        width: 100%;
    }

    .p2p-market-panel .p2p-order-inline .btn,
    .p2p-pagination,
    .p2p-page-info,
    .p2p-page-controls {
        width: 100%;
    }

    .p2p-pagination {
        align-items: stretch;
        flex-direction: column;
    }

    .p2p-page-controls {
        justify-content: center;
    }
}

@media (max-width: 560px) {
    .p2p-market-panel .p2p-offer-stats {
        grid-template-columns: 1fr;
    }

    .p2p-page-btn.nav {
        min-width: calc(50% - 4px);
    }
}

/* === DEALIX-CRYPTO-R3Q: P2P mobile structure, compact orders/listings === */
.p2p-my-offers-list {
    display: grid;
    gap: 10px;
}

.p2p-my-offer-card {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 13px 14px;
}

.p2p-my-offer-stats {
    gap: 7px;
}

.p2p-my-offer-stats span {
    font-size: .84rem;
}

.p2p-orders-rail {
    max-height: min(560px, calc(100vh - 260px));
}

.p2p-order-extra {
    align-items: start;
}

@media (max-width: 760px) {
    .p2p-filters {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 8px !important;
        overflow: visible !important;
        padding: 0 !important;
        margin-bottom: 12px !important;
    }

    .p2p-filters select,
    .p2p-filters input {
        flex: none !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
    }

    #p2p-filter-q {
        grid-column: 1 / -1;
    }

    .p2p-orders-rail {
        display: grid !important;
        gap: 8px !important;
        max-height: 340px !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        padding: 0 2px 4px !important;
        scroll-snap-type: none !important;
    }

    .p2p-order-summary {
        flex: none !important;
        width: 100% !important;
        grid-template-columns: minmax(0, 1fr);
    }

    .p2p-order-summary-side {
        justify-items: start;
        max-width: none;
    }

    .p2p-order-summary-side strong,
    .p2p-order-summary-side em {
        white-space: normal;
    }

    .p2p-my-offer-card {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .p2p-my-offer-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .p2p-my-offer-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .p2p-my-offer-stats {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 430px) {
    .p2p-filters {
        grid-template-columns: 1fr !important;
    }

    .p2p-my-offer-actions,
    .p2p-my-offer-stats {
        grid-template-columns: 1fr;
    }
}

/* === DEALIX-CRYPTO-R3R: P2P order detail block cleanup === */
.p2p-order-extra {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px;
}

.p2p-order-extra > * {
    min-width: 0;
    margin-top: 0 !important;
}

.p2p-order-extra .p2p-order-timeline,
.p2p-order-extra .p2p-dispute-box,
.p2p-order-extra .p2p-resolution-box,
.p2p-order-extra .p2p-receipts,
.p2p-order-extra .p2p-feedback-box {
    grid-column: 1 / -1;
}

.p2p-order-extra .p2p-payment-box,
.p2p-order-extra .p2p-safety-box,
.p2p-order-extra .p2p-order-timeline,
.p2p-order-extra .p2p-receipts,
.p2p-order-extra .p2p-feedback-box {
    border-radius: 16px;
}

.p2p-order-extra .p2p-safety-grid {
    grid-template-columns: minmax(96px, .72fr) minmax(0, 1.28fr);
}

.p2p-order-extra .p2p-timeline-dot {
    overflow: hidden;
}

.p2p-order-extra .p2p-timeline-dot svg {
    width: 17px;
    height: 17px;
    display: block;
}

@media (max-width: 760px) {
    .p2p-order-extra {
        grid-template-columns: 1fr !important;
        gap: 10px;
    }

    .p2p-order-extra .p2p-safety-grid {
        grid-template-columns: minmax(92px, .75fr) minmax(0, 1.25fr);
    }
}

@media (max-width: 430px) {
    .p2p-order-extra .p2p-safety-grid {
        grid-template-columns: 1fr;
        gap: 3px 0;
    }
}

/* === DEALIX-CRYPTO-R3T: P2P order detail readable layout === */
.p2p-order-detail-pane .p2p-order-extra {
    gap: 12px;
    margin-top: 12px;
}

.p2p-order-detail-pane .p2p-payment-box,
.p2p-order-detail-pane .p2p-safety-box,
.p2p-order-detail-pane .p2p-order-timeline,
.p2p-order-detail-pane .p2p-dispute-box,
.p2p-order-detail-pane .p2p-resolution-box,
.p2p-order-detail-pane .p2p-receipts,
.p2p-order-detail-pane .p2p-feedback-box {
    padding: 13px 14px;
    border-radius: 16px;
}

.p2p-order-detail-pane .p2p-order-txs,
.p2p-order-detail-pane .p2p-order-wallets {
    max-width: 100%;
}

.p2p-order-detail-pane .p2p-tx-pill,
.p2p-order-detail-pane .p2p-order-wallets span {
    overflow: hidden;
    text-overflow: ellipsis;
}

.p2p-order-detail-pane .p2p-safety-box {
    margin: 0;
}

.p2p-order-detail-pane .p2p-safety-box small,
.p2p-order-detail-pane .p2p-dispute-box p,
.p2p-order-detail-pane .p2p-dispute-box small {
    line-height: 1.42;
}

.p2p-order-detail-pane .p2p-dispute-box p {
    margin: 7px 0 9px;
    font-size: .95rem;
}

.p2p-order-detail-pane .p2p-dispute-box span {
    line-height: 1.25;
}

.p2p-order-detail-pane .p2p-timeline-row {
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 9px;
}

.p2p-order-detail-pane .p2p-timeline-dot {
    width: 28px;
    height: 28px;
}

.p2p-order-detail-pane .p2p-timeline-body b,
.p2p-order-detail-pane .p2p-timeline-body small {
    opacity: 1;
}

body.light-theme .p2p-order-detail-pane .p2p-order-timeline,
html.light-theme .p2p-order-detail-pane .p2p-order-timeline,
body.theme-light .p2p-order-detail-pane .p2p-order-timeline,
html[data-theme="light"] .p2p-order-detail-pane .p2p-order-timeline,
[data-theme="light"] .p2p-order-detail-pane .p2p-order-timeline {
    background: rgba(255, 255, 255, .92);
    border-color: rgba(99, 102, 241, .14);
    box-shadow: 0 14px 34px rgba(99, 102, 241, .07);
}

body.light-theme .p2p-order-detail-pane .p2p-timeline-body b,
html.light-theme .p2p-order-detail-pane .p2p-timeline-body b,
body.theme-light .p2p-order-detail-pane .p2p-timeline-body b,
html[data-theme="light"] .p2p-order-detail-pane .p2p-timeline-body b,
[data-theme="light"] .p2p-order-detail-pane .p2p-timeline-body b {
    color: #111827;
}

body.light-theme .p2p-order-detail-pane .p2p-timeline-body small,
html.light-theme .p2p-order-detail-pane .p2p-timeline-body small,
body.theme-light .p2p-order-detail-pane .p2p-timeline-body small,
html[data-theme="light"] .p2p-order-detail-pane .p2p-timeline-body small,
[data-theme="light"] .p2p-order-detail-pane .p2p-timeline-body small {
    color: #475569;
}

@media (max-width: 980px) {
    .p2p-order-detail-pane .p2p-order-layout,
    .p2p-order-detail-pane .p2p-order-extra {
        grid-template-columns: 1fr !important;
    }

    .p2p-order-detail-pane .p2p-payment-box,
    .p2p-order-detail-pane .p2p-safety-box,
    .p2p-order-detail-pane .p2p-order-timeline,
    .p2p-order-detail-pane .p2p-dispute-box,
    .p2p-order-detail-pane .p2p-resolution-box,
    .p2p-order-detail-pane .p2p-receipts,
    .p2p-order-detail-pane .p2p-feedback-box {
        grid-column: 1 / -1;
    }
}

@media (max-width: 520px) {
    .p2p-order-detail-pane .p2p-payment-box,
    .p2p-order-detail-pane .p2p-safety-box,
    .p2p-order-detail-pane .p2p-order-timeline,
    .p2p-order-detail-pane .p2p-dispute-box,
    .p2p-order-detail-pane .p2p-resolution-box,
    .p2p-order-detail-pane .p2p-receipts,
    .p2p-order-detail-pane .p2p-feedback-box {
        padding: 12px;
    }

    .p2p-order-detail-pane .p2p-safety-grid {
        grid-template-columns: 1fr !important;
        gap: 3px 0;
    }
}

/* === DEALIX-CRYPTO-R3U: P2P technical data collapsed by default === */
.p2p-tech-details {
    width: min(100%, 520px);
    margin-top: 10px;
    border: 1px solid rgba(148, 163, 184, .16);
    border-radius: 14px;
    background: rgba(15, 23, 42, .12);
    overflow: hidden;
}

.p2p-tech-details summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 42px;
    padding: 9px 12px;
    cursor: pointer;
    list-style: none;
    color: var(--text-secondary);
}

.p2p-tech-details summary::-webkit-details-marker {
    display: none;
}

.p2p-tech-details summary::after {
    content: '+';
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    color: #8b5cf6;
    background: rgba(139, 92, 246, .12);
    border: 1px solid rgba(139, 92, 246, .18);
    font-weight: 900;
}

.p2p-tech-details[open] summary::after {
    content: '-';
}

.p2p-tech-details summary b,
.p2p-tech-details summary small {
    display: block;
}

.p2p-tech-details summary b {
    color: var(--text-primary);
    font-size: .84rem;
    margin-bottom: 2px;
}

.p2p-tech-details summary small {
    color: var(--text-muted);
    font-size: .76rem;
}

.p2p-tech-list {
    display: grid;
    gap: 7px;
    padding: 0 12px 12px;
}

.p2p-tech-row {
    display: grid;
    grid-template-columns: minmax(130px, .85fr) minmax(0, 1.15fr);
    gap: 8px;
    align-items: center;
    font-size: .8rem;
}

.p2p-tech-row span {
    color: var(--text-muted);
}

.p2p-tech-row code {
    justify-self: start;
    max-width: 100%;
    padding: 5px 8px;
    border-radius: 999px;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #8b5cf6;
    background: rgba(139, 92, 246, .10);
    border: 1px solid rgba(139, 92, 246, .16);
    font: 800 .78rem/1.1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

body.light-theme .p2p-tech-details,
html.light-theme .p2p-tech-details,
body.theme-light .p2p-tech-details,
html[data-theme="light"] .p2p-tech-details,
[data-theme="light"] .p2p-tech-details {
    background: #f8fafc;
    border-color: rgba(15, 23, 42, .08);
}

body.light-theme .p2p-tech-details summary b,
html.light-theme .p2p-tech-details summary b,
body.theme-light .p2p-tech-details summary b,
html[data-theme="light"] .p2p-tech-details summary b,
[data-theme="light"] .p2p-tech-details summary b {
    color: #172033;
}

body.light-theme .p2p-tech-details summary small,
html.light-theme .p2p-tech-details summary small,
body.theme-light .p2p-tech-details summary small,
html[data-theme="light"] .p2p-tech-details summary small,
[data-theme="light"] .p2p-tech-details summary small,
body.light-theme .p2p-tech-row span,
html.light-theme .p2p-tech-row span,
body.theme-light .p2p-tech-row span,
html[data-theme="light"] .p2p-tech-row span,
[data-theme="light"] .p2p-tech-row span {
    color: #64748b;
}

@media (max-width: 520px) {
    .p2p-tech-row {
        grid-template-columns: 1fr;
        gap: 4px;
    }
}

/* === DEALIX-CRYPTO-R3V: P2P clean timeline and confirm readability === */
[data-theme="light"] .p2p-confirm-card .p2p-confirm-rows,
body.light .p2p-confirm-card .p2p-confirm-rows,
body.light-theme .p2p-confirm-card .p2p-confirm-rows,
body.theme-light .p2p-confirm-card .p2p-confirm-rows,
.light-theme .p2p-confirm-card .p2p-confirm-rows {
    background: rgba(255, 255, 255, .82);
    border-color: rgba(99, 102, 241, .14);
}

[data-theme="light"] .p2p-confirm-card .p2p-confirm-rows div,
body.light .p2p-confirm-card .p2p-confirm-rows div,
body.light-theme .p2p-confirm-card .p2p-confirm-rows div,
body.theme-light .p2p-confirm-card .p2p-confirm-rows div,
.light-theme .p2p-confirm-card .p2p-confirm-rows div {
    background: rgba(99, 102, 241, .07);
    border-color: rgba(99, 102, 241, .12);
}

[data-theme="light"] .p2p-confirm-card .p2p-confirm-rows span,
body.light .p2p-confirm-card .p2p-confirm-rows span,
body.light-theme .p2p-confirm-card .p2p-confirm-rows span,
body.theme-light .p2p-confirm-card .p2p-confirm-rows span,
.light-theme .p2p-confirm-card .p2p-confirm-rows span {
    color: #475569;
}

[data-theme="light"] .p2p-confirm-card .p2p-confirm-rows b,
body.light .p2p-confirm-card .p2p-confirm-rows b,
body.light-theme .p2p-confirm-card .p2p-confirm-rows b,
body.theme-light .p2p-confirm-card .p2p-confirm-rows b,
.light-theme .p2p-confirm-card .p2p-confirm-rows b {
    color: #111827;
}

/* === DEALIX R3Y — admin mobile layout + support chat polish === */
.admin-panel,
.admin-content,
.admin-content .tab-pane,
.admin-content .card,
.admin-content .card-body,
.admin-feed-section,
.admin-listings-section,
.admin-p2p-page {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.admin-panel {
    overflow-x: hidden;
}

.admin-content {
    width: 100%;
    overflow-x: hidden;
}

.admin-content .card,
.admin-feed-topic-card,
.admin-p2p-card,
.admin-p2p-header {
    overflow: hidden;
}

.admin-content .table-container {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 16px;
}

.admin-content table {
    border-collapse: separate;
    border-spacing: 0;
}

.admin-content td,
.admin-content th,
.admin-p2p-card,
.admin-p2p-card * {
    overflow-wrap: anywhere;
}

/* UI-2: tables scroll inside .table-container, so a cell is never narrower than
   one word ("anywhere" and the .card word-break split IDs, logins and headers). */
.admin-content .table-container th,
.admin-content .table-container td {
    overflow-wrap: break-word;
    word-break: normal;
}

.admin-content .table-container td .select {
    min-width: max-content;
}

.admin-content pre,
.admin-content code,
.admin-p2p-requisites pre {
    white-space: pre-wrap;
    word-break: break-word;
}

.admin-tabs {
    min-width: 0;
}

.admin-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.admin-tab-count {
    flex: 0 0 auto;
}

.admin-search input,
.admin-search select,
.admin-search .input,
.admin-search .select,
.admin-search .btn,
.admin-p2p-header-actions select,
.admin-p2p-header-actions .btn {
    min-width: 0;
}

.admin-support-section {
    width: 100%;
    min-width: 0;
}

.admin-support-container {
    display: grid;
    grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
    gap: 16px;
    height: min(740px, calc(100dvh - 170px));
    min-height: 560px;
    min-width: 0;
    overflow: hidden;
}

.admin-support-sidebar,
.admin-support-chat {
    min-width: 0;
    min-height: 0;
    border: 1px solid var(--border, rgba(148,163,184,.16));
    border-radius: 22px;
    background: color-mix(in srgb, var(--bg-secondary, #111827) 94%, transparent);
    box-shadow: 0 18px 55px rgba(2, 6, 23, .16);
}

.admin-support-sidebar {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.admin-support-sidebar-head {
    flex: 0 0 auto;
    padding: 14px 14px 12px;
    border-bottom: 1px solid var(--border, rgba(148,163,184,.14));
}

.admin-support-sidebar-head h3 {
    margin: 0 0 3px;
    font-size: 18px;
    line-height: 1.2;
}

.admin-support-sidebar-head span {
    display: block;
    color: var(--text-secondary, #9ca3af);
    font-size: 12px;
    line-height: 1.35;
}

.admin-support-ticket-list {
    display: grid;
    gap: 8px;
    padding: 10px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.admin-support-ticket {
    position: relative;
    width: 100%;
    display: grid;
    gap: 4px;
    text-align: left;
    padding: 11px 12px;
    border: 1px solid transparent;
    border-radius: 16px;
    color: var(--text-primary, #f8fafc);
    background: transparent;
    cursor: pointer;
    transition: background .16s ease, border-color .16s ease, transform .16s ease;
}

.admin-support-ticket:hover,
.admin-support-ticket.active {
    background: rgba(139, 92, 246, .12);
    border-color: rgba(167, 139, 250, .24);
}

.admin-support-ticket.active {
    box-shadow: inset 3px 0 0 var(--primary, #8b5cf6);
}

.admin-support-ticket-main {
    display: flex;
    align-items: baseline;
    gap: 7px;
    min-width: 0;
    padding-right: 34px;
}

.admin-support-ticket-main b {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-support-ticket-main small,
.admin-support-ticket-preview {
    color: var(--text-secondary, #9ca3af);
}

.admin-support-ticket-context {
    width: fit-content;
    max-width: 100%;
    padding: 3px 8px;
    border-radius: 999px;
    color: var(--primary-text);
    background: rgba(139, 92, 246, .10);
    font-size: 12px;
    font-weight: 750;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-support-ticket-preview {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
}

.admin-support-unread {
    position: absolute;
    top: 10px;
    right: 10px;
}

.admin-support-empty,
.admin-support-empty-chat,
.admin-support-placeholder {
    color: var(--text-secondary, #9ca3af);
    text-align: center;
}

.admin-support-empty {
    padding: 26px 12px;
}

.admin-support-chat {
    position: relative;
    display: flex !important;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-tertiary, #0f172a);
}

.admin-support-chat-header {
    min-height: 62px;
    padding: 10px 14px !important;
    background: var(--bg-secondary, #111827) !important;
}

.admin-support-peer {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
}

.admin-support-peer-avatar {
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(124,58,237,.95), rgba(59,130,246,.86));
    box-shadow: 0 12px 28px rgba(79, 70, 229, .25);
}

.admin-support-peer-text {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.admin-support-peer-text b {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-support-peer-text small {
    color: var(--text-muted, #94a3b8);
    font-size: 12px;
}

.admin-support-context {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border, rgba(148,163,184,.14));
    background: linear-gradient(135deg, rgba(99,102,241,.12), rgba(139,92,246,.06));
}

.admin-support-context-title {
    flex: 1 1 auto;
    min-width: 0;
    display: grid;
    gap: 2px;
}

.admin-support-context-title strong {
    color: var(--text-primary, #f8fafc);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-support-context-title span {
    color: var(--text-secondary, #9ca3af);
    font-size: 12px;
}

.admin-support-context-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 7px;
    /* UI-1: may shrink, so three P2P buttons wrap instead of hiding the title. */
    flex: 0 1 auto;
    min-width: 0;
}

.admin-support-messages {
    flex: 1 1 auto !important;
    min-height: 0;
    padding: 18px 18px 20px !important;
    overflow-y: auto !important;
    background:
        radial-gradient(circle at 16% 0%, rgba(99,102,241,.08), transparent 30%),
        var(--bg-tertiary, #0f172a) !important;
}

.admin-support-message {
    max-width: min(78%, 640px) !important;
}

.admin-support-message .message-content {
    white-space: pre-wrap;
}

.admin-support-message .admin-support-image-btn img {
    max-width: min(300px, 62vw) !important;
    height: auto;
    object-fit: cover;
}

/* Support image attachment and its viewer: former inline styles (style-src). */
.admin-panel .admin-support-image-btn { border: 0; background: transparent; padding: 0; cursor: pointer; text-align: left; }
.admin-panel .admin-support-image-thumb { max-width: 220px; max-height: 160px; border-radius: 8px; display: block; }
.admin-support-image-viewer .admin-support-image-viewer-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; color: #fff; background: rgba(15,23,42,.72); }
.admin-support-image-viewer .admin-support-image-viewer-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-support-image-viewer .admin-support-image-viewer-close { border: 0; background: rgba(255,255,255,.14); color: #fff; border-radius: 8px; width: 36px; height: 36px; font-size: 22px; line-height: 1; cursor: pointer; }
.admin-support-image-viewer .admin-support-image-viewer-stage { flex: 1; display: flex; align-items: center; justify-content: center; padding: 16px; overflow: auto; }
.admin-support-image-viewer .admin-support-image-viewer-img { max-width: 100%; max-height: 100%; border-radius: 10px; object-fit: contain; box-shadow: 0 18px 60px rgba(0,0,0,.35); }

.admin-support-input {
    flex: 0 0 auto !important;
    align-items: flex-end;
    padding: 12px 14px !important;
}

.admin-support-input textarea {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 44px;
    max-height: 140px;
    resize: none !important;
}

.admin-support-input .btn {
    flex: 0 0 auto;
    min-height: 44px;
}

.admin-support-placeholder {
    flex: 1;
    min-height: 320px;
    display: grid;
    place-content: center;
    gap: 6px;
    padding: 28px;
}

.admin-support-placeholder b {
    color: var(--text-primary, #f8fafc);
    font-size: 18px;
}

body.theme-light .admin-support-sidebar,
body.theme-light .admin-support-chat,
[data-theme="light"] .admin-support-sidebar,
[data-theme="light"] .admin-support-chat,
.light-theme .admin-support-sidebar,
.light-theme .admin-support-chat {
    background: rgba(255,255,255,.94);
    border-color: rgba(15,23,42,.10);
    box-shadow: 0 18px 44px rgba(15,23,42,.08);
}

body.theme-light .admin-support-chat,
[data-theme="light"] .admin-support-chat,
.light-theme .admin-support-chat {
    background: #f3f5fb;
}

body.theme-light .admin-support-ticket:hover,
body.theme-light .admin-support-ticket.active,
[data-theme="light"] .admin-support-ticket:hover,
[data-theme="light"] .admin-support-ticket.active,
.light-theme .admin-support-ticket:hover,
.light-theme .admin-support-ticket.active {
    background: rgba(99,102,241,.09);
    border-color: rgba(99,102,241,.18);
}

@media (max-width: 980px) {
    .admin-support-container {
        grid-template-columns: 1fr;
        height: auto;
        min-height: 0;
        overflow: visible;
    }

    .admin-support-sidebar {
        max-height: 280px;
    }

    .admin-support-chat {
        min-height: min(72dvh, 680px);
    }

    .admin-support-context {
        align-items: stretch;
        flex-direction: column;
    }

    .admin-support-context-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 768px) {
    .admin-panel {
        width: 100%;
        padding-bottom: max(16px, env(safe-area-inset-bottom));
    }

    .admin-header {
        margin-bottom: 12px;
        padding: 14px;
        border: 1px solid var(--border, rgba(148,163,184,.14));
        border-radius: 20px;
        background: color-mix(in srgb, var(--bg-secondary, #111827) 88%, transparent);
    }

    .admin-header h1 {
        margin: 0 0 5px;
        font-size: clamp(22px, 7vw, 30px);
        line-height: 1.15;
    }

    .admin-tabs {
        flex-wrap: nowrap !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 8px;
        margin: 0 0 14px;
        padding: 8px 2px 10px;
        border-bottom: 0;
        scroll-snap-type: x proximity;
    }

    .admin-tabs::-webkit-scrollbar,
    .admin-listings-status-tabs::-webkit-scrollbar,
    .admin-support-ticket-list::-webkit-scrollbar {
        display: none;
    }

    .admin-tab {
        flex: 0 0 auto;
        min-height: 38px;
        padding: 8px 13px;
        border: 1px solid rgba(139,92,246,.18);
        border-radius: 999px;
        background: rgba(139,92,246,.07);
        scroll-snap-align: start;
        white-space: nowrap;
    }

    .admin-tab.active {
        color: #fff;
        border-bottom: 1px solid rgba(167,139,250,.40);
        background: linear-gradient(135deg, rgba(124,58,237,.95), rgba(99,102,241,.88));
        box-shadow: 0 12px 28px rgba(79,70,229,.20);
    }

    .admin-search {
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .admin-search input,
    .admin-search select,
    .admin-search .input,
    .admin-search .select,
    .admin-search .btn {
        width: 100% !important;
        min-height: 42px;
    }

    .admin-listings-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 8px;
    }

    .admin-listings-pending-pill {
        min-width: 0;
        padding: 10px;
    }

    .admin-listings-status-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 8px;
    }

    .admin-listings-status-tab {
        flex: 0 0 auto;
    }

    .admin-listing-actions,
    .admin-feed-topic-card .admin-listing-actions {
        display: grid !important;
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .admin-listing-actions .btn,
    .admin-feed-topic-card .btn {
        width: 100%;
        justify-content: center;
    }

    .admin-p2p-page {
        padding: 10px !important;
        overflow-x: hidden;
    }

    .admin-p2p-header,
    .admin-p2p-top {
        align-items: stretch !important;
        flex-direction: column !important;
    }

    .admin-p2p-header-actions {
        width: 100%;
        display: grid !important;
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .admin-p2p-header-actions select,
    .admin-p2p-header-actions .btn,
    .admin-p2p-chain,
    .admin-p2p-actions .btn,
    .admin-p2p-actions textarea {
        width: 100%;
    }

    .admin-p2p-role-map {
        display: grid !important;
        grid-template-columns: 1fr !important;
    }

    .admin-p2p-grid,
    .admin-p2p-columns {
        grid-template-columns: 1fr !important;
    }

    .admin-p2p-actions {
        display: grid !important;
        grid-template-columns: 1fr;
    }

    .admin-p2p-actions textarea {
        min-width: 0;
        flex-basis: auto;
    }
}

@media (max-width: 560px) {
    .admin-support-container {
        gap: 10px;
    }

    .admin-support-sidebar,
    .admin-support-chat {
        border-radius: 18px;
    }

    .admin-support-sidebar {
        max-height: 240px;
    }

    .admin-support-ticket-list {
        padding: 8px;
        gap: 7px;
    }

    .admin-support-ticket {
        padding: 10px;
        border-radius: 14px;
    }

    .admin-support-chat {
        min-height: calc(100dvh - 170px);
    }

    .admin-support-chat-header {
        min-height: 56px;
        padding: 9px 12px !important;
    }

    .admin-support-context-actions {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
    }

    .admin-support-context-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .admin-support-messages {
        padding: 14px 12px 16px !important;
    }

    .admin-support-message {
        max-width: 88% !important;
    }

    .admin-support-input {
        display: grid !important;
        grid-template-columns: 1fr auto;
        gap: 8px;
        padding: 10px !important;
    }

    .admin-support-input .btn {
        padding-inline: 12px;
    }

    .admin-listings-summary {
        grid-template-columns: 1fr !important;
    }

    .pagination-buttons {
        flex-wrap: wrap;
        justify-content: center;
    }

    .pagination .btn,
    .pagination-buttons .btn {
        min-height: 38px;
    }
}

/* === DEALIX-R4E: admin support chat visibility + P2P dispute switching === */
.admin-support-list-label {
    margin: 8px 4px 4px;
    color: var(--text-muted, #94a3b8);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.admin-support-p2p-ticket {
    border-color: rgba(239, 68, 68, .18) !important;
    background: rgba(239, 68, 68, .07) !important;
}

.admin-support-p2p-ticket.active,
.admin-support-p2p-ticket:hover {
    background: rgba(139, 92, 246, .13) !important;
    border-color: rgba(167, 139, 250, .28) !important;
}

.admin-support-chat {
    isolation: isolate;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
}

.admin-support-chat .admin-support-chat-header {
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border, rgba(148,163,184,.14));
}

.admin-support-messages {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    width: 100% !important;
    min-width: 0 !important;
}

.admin-support-message {
    display: flex !important;
    flex-direction: column !important;
    gap: 4px;
    width: fit-content !important;
    min-width: 0 !important;
    max-width: min(76%, 720px) !important;
    clear: both;
}

.admin-support-message.sent {
    align-self: flex-end !important;
    margin-left: auto !important;
}

.admin-support-message.received {
    align-self: flex-start !important;
    margin-right: auto !important;
}

.admin-support-message .message-content {
    display: block !important;
    min-width: 0;
    max-width: 100%;
    padding: 10px 13px !important;
    border-radius: 18px !important;
    color: #fff !important;
    background: linear-gradient(135deg, rgba(124, 58, 237, .98), rgba(79, 70, 229, .95)) !important;
    box-shadow: 0 10px 28px rgba(79, 70, 229, .18);
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: pre-wrap;
}

.admin-support-message.received .message-content {
    color: var(--text-primary, #f8fafc) !important;
    background: rgba(255, 255, 255, .08) !important;
    border: 1px solid rgba(148, 163, 184, .16);
    box-shadow: none;
}

.admin-support-message .message-time {
    color: var(--text-muted, #94a3b8) !important;
    font-size: 11px !important;
    padding: 0 4px;
}

.admin-support-message.sent .message-time {
    text-align: right;
}

.admin-support-input {
    display: flex !important;
    gap: 10px !important;
    border-top: 1px solid var(--border, rgba(148,163,184,.14));
    background: var(--bg-secondary, #111827) !important;
}

.admin-support-input textarea {
    color: var(--text-primary, #f8fafc) !important;
    background: var(--bg-primary, #0b1220) !important;
    border: 1px solid var(--border, rgba(148,163,184,.18)) !important;
}

.admin-support-p2p-overview {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 12px;
    border-bottom: 1px solid var(--border, rgba(148,163,184,.14));
}

.admin-support-p2p-overview > div {
    min-width: 0;
    padding: 11px 12px;
    border: 1px solid var(--border, rgba(148,163,184,.14));
    border-radius: 16px;
    background: rgba(255,255,255,.06);
}

.admin-support-p2p-overview span,
.admin-support-p2p-overview small {
    display: block;
    color: var(--text-secondary, #9ca3af);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-support-p2p-overview b {
    display: block;
    margin: 4px 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.theme-light .admin-support-message.received .message-content,
[data-theme="light"] .admin-support-message.received .message-content,
.light-theme .admin-support-message.received .message-content {
    color: #0f172a !important;
    background: #fff !important;
    border-color: rgba(15,23,42,.10);
}

body.theme-light .admin-support-input,
[data-theme="light"] .admin-support-input,
.light-theme .admin-support-input {
    background: #fff !important;
    border-color: rgba(15,23,42,.10);
}

body.theme-light .admin-support-input textarea,
[data-theme="light"] .admin-support-input textarea,
.light-theme .admin-support-input textarea {
    color: #0f172a !important;
    background: #f8fafc !important;
    border-color: rgba(15,23,42,.12) !important;
}

body.theme-light .admin-support-p2p-overview > div,
[data-theme="light"] .admin-support-p2p-overview > div,
.light-theme .admin-support-p2p-overview > div {
    background: #fff;
    border-color: rgba(15,23,42,.10);
}

@media (max-width: 760px) {
    .admin-support-container {
        display: flex !important;
        flex-direction: column !important;
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
    }

    .admin-support-sidebar {
        flex: 0 0 auto;
        max-height: 34dvh !important;
    }

    .admin-support-chat {
        flex: 0 0 auto;
        min-height: 62dvh !important;
        max-height: none !important;
    }

    .admin-support-messages {
        min-height: 260px !important;
        max-height: 46dvh !important;
    }

    .admin-support-message {
        max-width: 92% !important;
    }

    .admin-support-p2p-overview {
        grid-template-columns: 1fr;
    }

    .admin-support-input {
        grid-template-columns: 1fr !important;
    }

    .admin-support-input .btn {
        width: 100%;
        justify-content: center;
    }
}

/* === DEALIX-R4F: admin arbitration chat glass, visible controls, time labels === */
.admin-support-section,
.admin-support-section * {
    box-sizing: border-box;
}

.admin-support-container {
    align-items: stretch;
}

.admin-support-sidebar,
.admin-support-chat {
    backdrop-filter: blur(22px) saturate(1.25);
    -webkit-backdrop-filter: blur(22px) saturate(1.25);
    background: linear-gradient(145deg, rgba(15,23,42,.88), rgba(30,41,59,.74)) !important;
    border: 1px solid rgba(148,163,184,.18) !important;
    box-shadow: 0 22px 70px rgba(2,6,23,.28), inset 0 1px 0 rgba(255,255,255,.06) !important;
}

.admin-support-sidebar-head,
.admin-support-chat-header,
.admin-support-context,
.admin-support-input {
    backdrop-filter: blur(18px) saturate(1.2);
    -webkit-backdrop-filter: blur(18px) saturate(1.2);
}

.admin-support-chat-header {
    background: linear-gradient(135deg, rgba(15,23,42,.94), rgba(30,41,59,.86)) !important;
    color: var(--text-primary, #f8fafc) !important;
}

.admin-support-peer-text b,
.admin-support-peer-text small,
.admin-support-context-title strong,
.admin-support-context-title span,
.admin-support-p2p-overview b,
.admin-support-ticket-main b,
.admin-support-ticket-main small,
.admin-support-ticket-preview,
.admin-support-ticket-context,
.admin-support-list-label {
    text-shadow: none;
}

.admin-support-ticket {
    background: rgba(255,255,255,.045) !important;
    border-color: rgba(148,163,184,.13) !important;
}

.admin-support-ticket:hover,
.admin-support-ticket.active {
    background: rgba(124,58,237,.16) !important;
    border-color: rgba(167,139,250,.38) !important;
}

.admin-support-ticket-main {
    align-items: center;
}

.admin-support-ticket-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    min-width: 0;
    color: var(--text-muted, #94a3b8);
    font-size: 11px;
    line-height: 1.25;
}

.admin-support-ticket-meta span {
    max-width: 100%;
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(148,163,184,.10);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-support-p2p-ticket,
.admin-support-p2p-chat-ticket {
    background: linear-gradient(135deg, rgba(239,68,68,.10), rgba(124,58,237,.08)) !important;
}

.admin-support-context {
    align-items: stretch;
    background: linear-gradient(135deg, rgba(124,58,237,.18), rgba(59,130,246,.10)) !important;
}

.admin-support-context-title {
    gap: 5px;
}

.admin-support-dispute-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.admin-support-dispute-meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 24px;
    padding: 3px 8px;
    border: 1px solid rgba(148,163,184,.14);
    border-radius: 999px;
    color: var(--text-secondary, #cbd5e1);
    background: rgba(15,23,42,.22);
    font-size: 11px;
    line-height: 1.2;
}

.admin-support-dispute-meta b {
    color: var(--text-primary, #f8fafc);
    font-weight: 800;
}

.admin-support-chat-actions {
    align-items: center;
}

.admin-support-context-actions .btn,
.admin-support-input .btn,
.admin-support-role-btn,
.admin-support-tool-btn {
    min-height: 38px !important;
    border-radius: 999px !important;
    border: 1px solid rgba(167,139,250,.35) !important;
    color: #fff !important;
    background: linear-gradient(135deg, rgba(124,58,237,.96), rgba(79,70,229,.92)) !important;
    box-shadow: 0 12px 26px rgba(79,70,229,.22) !important;
    opacity: 1 !important;
    visibility: visible !important;
    white-space: normal;
}

.admin-support-context-actions .btn:hover,
.admin-support-input .btn:hover,
.admin-support-role-btn:hover,
.admin-support-tool-btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.05);
}

.admin-support-tool-btn {
    color: var(--text-primary, #f8fafc) !important;
    background: rgba(15,23,42,.36) !important;
    border-color: rgba(148,163,184,.24) !important;
    box-shadow: none !important;
}

.admin-support-role-buyer {
    background: linear-gradient(135deg, rgba(37,99,235,.96), rgba(79,70,229,.92)) !important;
}

.admin-support-role-seller {
    background: linear-gradient(135deg, rgba(124,58,237,.96), rgba(217,70,239,.88)) !important;
}

.admin-support-messages {
    background:
        radial-gradient(circle at 18% 0%, rgba(124,58,237,.12), transparent 32%),
        radial-gradient(circle at 100% 18%, rgba(59,130,246,.08), transparent 28%),
        rgba(2,6,23,.34) !important;
}

.admin-support-message-author {
    padding: 0 6px;
    color: var(--text-muted, #94a3b8);
    font-size: 11px;
    font-weight: 800;
    line-height: 1.2;
}

.admin-support-message.sent .admin-support-message-author {
    text-align: right;
}

.admin-support-message .message-content {
    line-height: 1.42;
}

.admin-support-message.received .message-content {
    color: var(--text-primary, #f8fafc) !important;
    background: rgba(255,255,255,.10) !important;
    border-color: rgba(148,163,184,.18) !important;
}

.admin-support-input {
    background: rgba(15,23,42,.88) !important;
}

.admin-support-input textarea {
    border-radius: 16px !important;
    color: var(--text-primary, #f8fafc) !important;
    background: rgba(2,6,23,.42) !important;
}

.admin-support-p2p-overview > div {
    background: rgba(255,255,255,.075) !important;
    border-color: rgba(148,163,184,.16) !important;
}

.admin-support-placeholder,
.admin-support-empty,
.admin-support-empty-chat {
    color: var(--text-secondary, #cbd5e1) !important;
}

body.theme-light .admin-support-sidebar,
body.theme-light .admin-support-chat,
[data-theme="light"] .admin-support-sidebar,
[data-theme="light"] .admin-support-chat,
.light-theme .admin-support-sidebar,
.light-theme .admin-support-chat {
    background: linear-gradient(145deg, rgba(255,255,255,.86), rgba(248,250,252,.72)) !important;
    border-color: rgba(15,23,42,.10) !important;
    box-shadow: 0 22px 60px rgba(15,23,42,.10), inset 0 1px 0 rgba(255,255,255,.78) !important;
}

body.theme-light .admin-support-chat-header,
[data-theme="light"] .admin-support-chat-header,
.light-theme .admin-support-chat-header {
    background: linear-gradient(135deg, rgba(255,255,255,.92), rgba(241,245,249,.84)) !important;
    color: #0f172a !important;
}

body.theme-light .admin-support-context,
[data-theme="light"] .admin-support-context,
.light-theme .admin-support-context {
    background: linear-gradient(135deg, rgba(124,58,237,.10), rgba(59,130,246,.06)) !important;
}

body.theme-light .admin-support-ticket,
[data-theme="light"] .admin-support-ticket,
.light-theme .admin-support-ticket {
    color: #0f172a !important;
    background: rgba(255,255,255,.68) !important;
    border-color: rgba(15,23,42,.08) !important;
}

body.theme-light .admin-support-ticket:hover,
body.theme-light .admin-support-ticket.active,
[data-theme="light"] .admin-support-ticket:hover,
[data-theme="light"] .admin-support-ticket.active,
.light-theme .admin-support-ticket:hover,
.light-theme .admin-support-ticket.active {
    background: rgba(124,58,237,.10) !important;
    border-color: rgba(124,58,237,.22) !important;
}

body.theme-light .admin-support-ticket-meta span,
[data-theme="light"] .admin-support-ticket-meta span,
.light-theme .admin-support-ticket-meta span,
body.theme-light .admin-support-dispute-meta span,
[data-theme="light"] .admin-support-dispute-meta span,
.light-theme .admin-support-dispute-meta span {
    color: #475569 !important;
    background: rgba(15,23,42,.055) !important;
    border-color: rgba(15,23,42,.08) !important;
}

body.theme-light .admin-support-dispute-meta b,
[data-theme="light"] .admin-support-dispute-meta b,
.light-theme .admin-support-dispute-meta b,
body.theme-light .admin-support-context-title strong,
[data-theme="light"] .admin-support-context-title strong,
.light-theme .admin-support-context-title strong,
body.theme-light .admin-support-peer-text b,
[data-theme="light"] .admin-support-peer-text b,
.light-theme .admin-support-peer-text b {
    color: #0f172a !important;
}

body.theme-light .admin-support-context-title span,
body.theme-light .admin-support-peer-text small,
[data-theme="light"] .admin-support-context-title span,
[data-theme="light"] .admin-support-peer-text small,
.light-theme .admin-support-context-title span,
.light-theme .admin-support-peer-text small {
    color: #475569 !important;
}

body.theme-light .admin-support-messages,
[data-theme="light"] .admin-support-messages,
.light-theme .admin-support-messages {
    background:
        radial-gradient(circle at 18% 0%, rgba(124,58,237,.10), transparent 32%),
        radial-gradient(circle at 100% 18%, rgba(59,130,246,.07), transparent 28%),
        rgba(241,245,249,.72) !important;
}

body.theme-light .admin-support-message-author,
[data-theme="light"] .admin-support-message-author,
.light-theme .admin-support-message-author,
body.theme-light .admin-support-message .message-time,
[data-theme="light"] .admin-support-message .message-time,
.light-theme .admin-support-message .message-time {
    color: #64748b !important;
}

body.theme-light .admin-support-message.received .message-content,
[data-theme="light"] .admin-support-message.received .message-content,
.light-theme .admin-support-message.received .message-content {
    color: #0f172a !important;
    background: rgba(255,255,255,.92) !important;
    border-color: rgba(15,23,42,.10) !important;
}

body.theme-light .admin-support-input,
[data-theme="light"] .admin-support-input,
.light-theme .admin-support-input {
    background: rgba(255,255,255,.86) !important;
}

body.theme-light .admin-support-input textarea,
[data-theme="light"] .admin-support-input textarea,
.light-theme .admin-support-input textarea {
    color: #0f172a !important;
    background: rgba(248,250,252,.92) !important;
    border-color: rgba(15,23,42,.12) !important;
}

body.theme-light .admin-support-tool-btn,
[data-theme="light"] .admin-support-tool-btn,
.light-theme .admin-support-tool-btn {
    color: #0f172a !important;
    background: rgba(255,255,255,.78) !important;
    border-color: rgba(15,23,42,.14) !important;
}

body.theme-light .admin-support-p2p-overview > div,
[data-theme="light"] .admin-support-p2p-overview > div,
.light-theme .admin-support-p2p-overview > div {
    background: rgba(255,255,255,.78) !important;
    border-color: rgba(15,23,42,.10) !important;
}

@media (max-width: 760px) {
    .admin-support-context {
        gap: 10px;
    }
    .admin-support-dispute-meta {
        display: grid;
        grid-template-columns: 1fr;
    }
    .admin-support-ticket-meta {
        display: grid;
        grid-template-columns: 1fr;
    }
    .admin-support-context-actions .btn,
    .admin-support-role-btn,
    .admin-support-tool-btn {
        width: 100% !important;
        justify-content: center !important;
        text-align: center;
    }
    .admin-support-message {
        max-width: 94% !important;
    }
}


/* === DEALIX-R4G: admin support light-theme contrast + P2P card focus === */
.admin-support-sidebar-head h3,
.admin-support-sidebar-head span,
.admin-support-list-label,
.admin-support-ticket-main b,
.admin-support-ticket-main small,
.admin-support-ticket-preview,
.admin-support-ticket-context,
.admin-support-ticket-meta,
.admin-support-empty,
.admin-support-placeholder,
.admin-support-placeholder b,
.admin-support-empty-chat,
.admin-support-peer-text b,
.admin-support-peer-text small,
.admin-support-context-title strong,
.admin-support-context-title span,
.admin-support-dispute-meta span,
.admin-support-dispute-meta b,
.admin-support-p2p-overview span,
.admin-support-p2p-overview small,
.admin-support-p2p-overview b {
    text-shadow: none !important;
}

.admin-support-sidebar-head {
    background: linear-gradient(135deg, rgba(15,23,42,.78), rgba(30,41,59,.58)) !important;
    border-bottom: 1px solid rgba(148,163,184,.18) !important;
}

.admin-support-sidebar-head h3 {
    color: #f8fafc !important;
    font-weight: 900 !important;
    letter-spacing: -.01em;
}

.admin-support-sidebar-head span,
.admin-support-list-label {
    color: #cbd5e1 !important;
    font-weight: 750 !important;
}

.admin-support-tool-btn,
.admin-support-role-btn,
.admin-support-context-actions .btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    min-height: 40px !important;
    padding: 9px 14px !important;
    font-weight: 850 !important;
    line-height: 1.15 !important;
    text-decoration: none !important;
}

.admin-support-tool-btn::before {
    content: '↗';
    font-size: 14px;
    line-height: 1;
}

body.theme-light .admin-support-sidebar,
body.theme-light .admin-support-chat {
    color: #0f172a !important;
}

body.theme-light .admin-support-sidebar-head {
    background: linear-gradient(135deg, rgba(255,255,255,.96), rgba(241,245,249,.90)) !important;
    border-bottom-color: rgba(15,23,42,.12) !important;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.85), 0 10px 28px rgba(15,23,42,.05) !important;
}

body.theme-light .admin-support-sidebar-head h3,
body.theme-light .admin-support-ticket-main b,
body.theme-light .admin-support-placeholder b,
body.theme-light .admin-support-p2p-overview b,
body.theme-light .admin-support-list-label {
    color: #0f172a !important;
}

body.theme-light .admin-support-sidebar-head span,
body.theme-light .admin-support-ticket-main small,
body.theme-light .admin-support-ticket-preview,
body.theme-light .admin-support-ticket-meta,
body.theme-light .admin-support-empty,
body.theme-light .admin-support-empty-chat,
body.theme-light .admin-support-placeholder,
body.theme-light .admin-support-p2p-overview span,
body.theme-light .admin-support-p2p-overview small {
    color: #475569 !important;
}

body.theme-light .admin-support-ticket-context {
    color: #5b21b6 !important;
    background: rgba(124,58,237,.10) !important;
    border: 1px solid rgba(124,58,237,.12) !important;
}

body.theme-light .admin-support-tool-btn,
body.theme-light .admin-support-context-actions .admin-support-tool-btn,
body.theme-light .admin-support-context-actions .btn.admin-support-tool-btn {
    color: #ffffff !important;
    background: linear-gradient(135deg, #4f46e5, #7c3aed) !important;
    border-color: rgba(79,70,229,.55) !important;
    box-shadow: 0 12px 28px rgba(79,70,229,.22) !important;
}

body.theme-light .admin-support-role-btn,
body.theme-light .admin-support-context-actions .admin-support-role-btn {
    color: #ffffff !important;
}

body.theme-light .admin-support-chat-header,
body.theme-light .admin-support-context,
body.theme-light .admin-support-input {
    color: #0f172a !important;
}

.admin-p2p-card.admin-p2p-card-focus {
    outline: 3px solid rgba(124,58,237,.72) !important;
    box-shadow: 0 0 0 6px rgba(124,58,237,.14), 0 24px 70px rgba(79,70,229,.20) !important;
    animation: admin-p2p-focus-pulse 1.6s ease-in-out 1;
}

@keyframes admin-p2p-focus-pulse {
    0% { transform: scale(.995); }
    45% { transform: scale(1.006); }
    100% { transform: scale(1); }
}

/* R4H: admin support context shortcuts */
.admin-focus-row {
  outline: 2px solid rgba(124, 58, 237, .75);
  outline-offset: -2px;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, .12);
}
.admin-support-tool-btn {
  white-space: nowrap;
}

/* ===== STAGE UI P2: deals CTA label + stronger list readability + animated progress coin ===== */
.deals-page .deal-item-title {
    color: rgba(248, 250, 252, 0.98) !important;
    text-shadow: 0 1px 0 rgba(2, 6, 23, 0.28);
}

.deals-page .deal-item-meta {
    color: rgba(226, 232, 240, 0.92) !important;
}


.deals-page .deal-item-amount,
.deals-page .deal-amount {
    color: #f5f3ff !important;
    text-shadow: 0 0 20px rgba(139, 92, 246, 0.18), 0 1px 0 rgba(15, 23, 42, 0.18);
}

.deals-page .deal-open-btn {
    color: #f5f3ff !important;
}

.deals-page .deal-header-right {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.24), rgba(20, 184, 166, 0.10)) !important;
    border-color: rgba(196, 181, 253, 0.24) !important;
}

.deals-page .deal-timeline {
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.52), rgba(15, 23, 42, 0.38)) !important;
    border-color: rgba(148, 163, 184, 0.18) !important;
}

.deals-page .deal-timeline .status-timeline {
    position: relative;
    align-items: flex-start;
    gap: 0;
    isolation: isolate;
}

.deals-page .deal-timeline .status-step {
    gap: 10px;
}

.deals-page .deal-timeline .status-step::before {
    top: 14px;
    height: 3px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.28) !important;
}

.deals-page .deal-timeline .status-step.completed::before {
    background: linear-gradient(90deg, #14b8a6, #22c55e) !important;
}

.deals-page .deal-timeline .status-dot {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(30, 41, 59, 0.92) !important;
    border: 3px solid rgba(148, 163, 184, 0.46) !important;
    box-shadow: 0 8px 18px rgba(2, 6, 23, 0.18);
}

.deals-page .deal-timeline .status-step.upcoming .status-dot {
    background: rgba(51, 65, 85, 0.70) !important;
    border-color: rgba(148, 163, 184, 0.34) !important;
}

.deals-page .deal-timeline .status-step.active .status-dot {
    background: linear-gradient(135deg, #8b5cf6, #6366f1) !important;
    border-color: rgba(221, 214, 254, 0.95) !important;
    box-shadow: 0 0 0 5px rgba(99, 102, 241, 0.16), 0 10px 22px rgba(79, 70, 229, 0.26) !important;
}

.deals-page .deal-timeline .status-step.completed .status-dot {
    background: linear-gradient(135deg, #14b8a6, #22c55e) !important;
    border-color: rgba(209, 250, 229, 0.92) !important;
    box-shadow: 0 10px 20px rgba(16, 185, 129, 0.18) !important;
}

.deals-page .deal-timeline .status-label {
    color: rgba(226, 232, 240, 0.72) !important;
    font-size: 0.74rem !important;
    line-height: 1.15;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.deals-page .deal-timeline .status-step.active .status-label,
.deals-page .deal-timeline .status-step.completed .status-label {
    color: rgba(248, 250, 252, 0.98) !important;
}

.deals-page .deal-timeline .status-progress-coin {
    position: absolute;
    top: -2px;
    left: calc(((100% - 30px) / var(--deal-progress-steps)) * var(--deal-progress-index));
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 4;
    filter: drop-shadow(0 10px 18px rgba(245, 158, 11, 0.25));
}

.deals-page .deal-timeline .status-progress-coin-core {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 900;
    color: #7c2d12;
    background: radial-gradient(circle at 30% 30%, #fde68a, #f59e0b 62%, #d97706 100%);
    border: 1px solid rgba(255, 251, 235, 0.8);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.deals-page .deal-timeline .animate-progress-coin .status-progress-coin {
    animation: deal-progress-coin-move 680ms cubic-bezier(0.22, 1, 0.36, 1) 1 both;
}

.deals-page .deal-timeline .animate-progress-coin .status-progress-coin-core {
    animation: deal-progress-coin-bounce 680ms cubic-bezier(0.22, 1, 0.36, 1) 1 both;
}

@keyframes deal-progress-coin-move {
    from {
        left: calc(((100% - 30px) / var(--deal-progress-steps)) * var(--deal-progress-start));
    }
    to {
        left: calc(((100% - 30px) / var(--deal-progress-steps)) * var(--deal-progress-index));
    }
}

@keyframes deal-progress-coin-bounce {
    0% {
        transform: translateY(0) scale(1);
    }
    32% {
        transform: translateY(-7px) scale(1.06);
    }
    64% {
        transform: translateY(0) scale(0.98);
    }
    100% {
        transform: translateY(0) scale(1);
    }
}

body.theme-light .deals-page .deal-item-title {
    color: #0f172a !important;
    text-shadow: none;
}

body.theme-light .deals-page .deal-item-meta {
    color: #475569 !important;
}


body.theme-light .deals-page .deal-item-amount,
body.theme-light .deals-page .deal-amount {
    color: #5b21b6 !important;
    text-shadow: none !important;
}

body.theme-light .deals-page .deal-open-btn {
    color: #312e81 !important;
}

body.theme-light .deals-page .deal-header-right {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.14), rgba(255, 255, 255, 0.98) 60%, rgba(20, 184, 166, 0.08)) !important;
    border-color: rgba(139, 92, 246, 0.20) !important;
}

body.theme-light .deals-page .deal-timeline {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.96)) !important;
    border-color: rgba(148, 163, 184, 0.22) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 14px 30px rgba(15, 23, 42, 0.05) !important;
}

body.theme-light .deals-page .deal-timeline .status-step::before {
    background: rgba(148, 163, 184, 0.34) !important;
}

body.theme-light .deals-page .deal-timeline .status-dot {
    background: #ffffff !important;
    border-color: rgba(148, 163, 184, 0.58) !important;
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.08) !important;
}

body.theme-light .deals-page .deal-timeline .status-step.upcoming .status-dot {
    background: #ffffff !important;
}

body.theme-light .deals-page .deal-timeline .status-step.active .status-dot {
    border-color: rgba(221, 214, 254, 0.95) !important;
}

body.theme-light .deals-page .deal-timeline .status-step.completed .status-dot {
    border-color: rgba(220, 252, 231, 0.92) !important;
}

body.theme-light .deals-page .deal-timeline .status-label {
    color: #64748b !important;
}

body.theme-light .deals-page .deal-timeline .status-step.active .status-label,
body.theme-light .deals-page .deal-timeline .status-step.completed .status-label {
    color: #0f172a !important;
}

body.theme-glass .deals-page .deal-list-item {
    backdrop-filter: blur(18px);
}


body.theme-glass .deals-page .deal-timeline {
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.34), rgba(15, 23, 42, 0.20)) !important;
    backdrop-filter: blur(18px);
}

@media (max-width: 700px) {
    .deals-page .deal-timeline .status-step {
        gap: 6px;
    }

    .deals-page .deal-timeline .status-step::before {
        top: 8px;
        height: 2px;
    }

    .deals-page .deal-timeline .status-dot,
    .deals-page .deal-timeline .status-progress-coin {
        width: 18px !important;
        height: 18px !important;
    }

    .deals-page .deal-timeline .status-progress-coin {
        top: -1px;
        left: calc(((100% - 18px) / var(--deal-progress-steps)) * var(--deal-progress-index));
    }

    .deals-page .deal-timeline .status-progress-coin-core {
        width: 16px;
        height: 16px;
        font-size: 0.5rem;
    }

    @keyframes deal-progress-coin-move {
        from {
            left: calc(((100% - 18px) / var(--deal-progress-steps)) * var(--deal-progress-start));
        }
        to {
            left: calc(((100% - 18px) / var(--deal-progress-steps)) * var(--deal-progress-index));
        }
    }
}


/* ===== STAGE UI P3: deals page full readability hotfix =====
   Visual-only. Keeps escrow/backend/actions unchanged. */

/* Action buttons: payment must never look faded on light/glass themes. */
.deals-page .deal-actions .btn,
.deals-page .deal-actions .deal-action-chat,
.deals-page .deal-chat-link .btn {
    font-weight: 900 !important;
    letter-spacing: -0.01em !important;
    text-shadow: none !important;
}

.deals-page .deal-actions .btn.success {
    background: linear-gradient(135deg, #059669, #10b981) !important;
    border: 1px solid rgba(4, 120, 87, 0.75) !important;
    color: #ffffff !important;
    box-shadow: 0 18px 42px rgba(16, 185, 129, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.22) !important;
}

.deals-page .deal-actions .btn.success:hover:not(:disabled) {
    background: linear-gradient(135deg, #047857, #059669) !important;
    color: #ffffff !important;
    transform: translateY(-1px) !important;
}

.deals-page .deal-actions .btn.danger,
.deals-page .deal-actions .btn.error {
    color: #ffffff !important;
}

.deals-page .deal-actions .btn:disabled,
.deals-page .deal-actions button:disabled {
    opacity: 0.72 !important;
    filter: saturate(0.92) !important;
    color: rgba(255, 255, 255, 0.96) !important;
}

.deals-page .deal-actions .btn.success:disabled {
    background: linear-gradient(135deg, #0f766e, #14b8a6) !important;
    border-color: rgba(15, 118, 110, 0.72) !important;
    color: rgba(255, 255, 255, 0.98) !important;
}

/* Header chips and Deal ID must stay readable everywhere. */
.deals-page .deal-title {
    color: var(--text) !important;
}

.deals-page .deal-subtitle span,
.deals-page .deal-subtitle .deal-type,
.deals-page .deal-subtitle .deal-role {
    color: rgba(248, 250, 252, 0.96) !important;
    background: rgba(15, 23, 42, 0.42) !important;
    border-color: rgba(148, 163, 184, 0.22) !important;
}

.deals-page .deal-subtitle .deal-id {
    color: #ffffff !important;
    background: linear-gradient(135deg, #4f46e5, #7c3aed) !important;
    border-color: rgba(221, 214, 254, 0.52) !important;
    box-shadow: 0 10px 24px rgba(79, 70, 229, 0.18) !important;
}

/* Strong status badge palette for detail header and deal list. */
.deals-page .deal-item-status,
.deals-page .deal-status {
    color: #ffffff !important;
    text-shadow: none !important;
    border-width: 1px !important;
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.18) !important;
}

.deals-page .deal-item-status.pending_accept,
.deals-page .deal-status.pending_accept {
    background: linear-gradient(135deg, #b45309, #f59e0b) !important;
    border-color: rgba(180, 83, 9, 0.70) !important;
    color: #ffffff !important;
}

.deals-page .deal-item-status.accepted,
.deals-page .deal-status.accepted {
    background: linear-gradient(135deg, #5b21b6, #7c3aed) !important;
    border-color: rgba(91, 33, 182, 0.72) !important;
    color: #ffffff !important;
}

.deals-page .deal-item-status.funded,
.deals-page .deal-status.funded {
    background: linear-gradient(135deg, #1d4ed8, #2563eb) !important;
    border-color: rgba(29, 78, 216, 0.72) !important;
    color: #ffffff !important;
}

.deals-page .deal-item-status.delivered,
.deals-page .deal-status.delivered {
    background: linear-gradient(135deg, #0e7490, #06b6d4) !important;
    border-color: rgba(14, 116, 144, 0.72) !important;
    color: #ffffff !important;
}

.deals-page .deal-item-status.completed,
.deals-page .deal-status.completed {
    background: linear-gradient(135deg, #047857, #10b981) !important;
    border-color: rgba(4, 120, 87, 0.72) !important;
    color: #ffffff !important;
}

.deals-page .deal-item-status.cancelled,
.deals-page .deal-status.cancelled {
    background: linear-gradient(135deg, #475569, #64748b) !important;
    border-color: rgba(71, 85, 105, 0.72) !important;
    color: #ffffff !important;
}

.deals-page .deal-item-status.dispute,
.deals-page .deal-status.dispute {
    background: linear-gradient(135deg, #b91c1c, #ef4444) !important;
    border-color: rgba(185, 28, 28, 0.72) !important;
    color: #ffffff !important;
}

/* List cards: make every piece of text readable on dark/glass/light. */
.deals-page .deal-list-item {
    color: rgba(248, 250, 252, 0.98) !important;
}

.deals-page .deal-item-title {
    color: rgba(255, 255, 255, 0.99) !important;
    text-shadow: 0 1px 0 rgba(2, 6, 23, 0.34) !important;
}

.deals-page .deal-item-meta {
    color: rgba(241, 245, 249, 0.95) !important;
}


.deals-page .deal-item-amount {
    color: #ffffff !important;
    text-shadow: 0 0 18px rgba(139, 92, 246, 0.28), 0 1px 0 rgba(15, 23, 42, 0.30) !important;
}

.deals-page .deals-group-header {
    color: rgba(248, 250, 252, 0.98) !important;
}

.deals-page .deals-group-count {
    color: #ffffff !important;
}

/* Detail sections: prevent pale cards/text from washing out. */
.deals-page .deal-info-section,
.deals-page .deal-actions-section,
.deals-page .deal-history-section,
.deals-page .deal-delivery-section,
.deals-page .delivery-info,
.deals-page .deal-history,
.deals-page .terms-list,
.deals-page .deal-participants,
.deals-page .participant,
.deals-page .history-item {
    color: var(--text) !important;
}

.deals-page .deal-info-section h3,
.deals-page .deal-actions-section h3,
.deals-page .deal-history-section h3,
.deals-page .deal-delivery-section h3,
.deals-page .deal-info-section h4,
.deals-page .deal-description h4,
.deals-page .deal-terms h4 {
    color: var(--text) !important;
}

.deals-page .term-item,
.deals-page .participant-line,
.deals-page .history-line,
.deals-page .deal-description p {
    color: var(--text) !important;
}

.deals-page .term-item span:first-child,
.deals-page .delivery-label,
.deals-page .history-time {
    color: var(--text-secondary) !important;
}

.deals-page .term-item span:last-child,
.deals-page .delivery-value,
.deals-page .participant-name,
.deals-page .history-title {
    color: var(--text) !important;
    font-weight: 800 !important;
}

/* Timeline: visible line/dots/labels. Coin appears only during real status movement animation. */
.deals-page .deal-timeline .status-progress-coin {
    opacity: 0 !important;
    visibility: hidden !important;
}

.deals-page .deal-timeline .animate-progress-coin .status-progress-coin {
    visibility: visible !important;
    animation: deal-progress-coin-move-p3 760ms cubic-bezier(0.22, 1, 0.36, 1) 1 both !important;
}

.deals-page .deal-timeline .animate-progress-coin .status-progress-coin-core {
    animation: deal-progress-coin-bounce-p3 760ms cubic-bezier(0.22, 1, 0.36, 1) 1 both !important;
}

.deals-page .deal-timeline .status-step::before {
    background: rgba(100, 116, 139, 0.45) !important;
}

.deals-page .deal-timeline .status-step.completed::before {
    background: linear-gradient(90deg, #14b8a6, #22c55e) !important;
}

.deals-page .deal-timeline .status-label {
    color: rgba(100, 116, 139, 0.98) !important;
    font-weight: 850 !important;
}

.deals-page .deal-timeline .status-step.active .status-label,
.deals-page .deal-timeline .status-step.completed .status-label {
    color: var(--text) !important;
}

@keyframes deal-progress-coin-move-p3 {
    0% {
        left: calc(((100% - 30px) / var(--deal-progress-steps)) * var(--deal-progress-start));
        opacity: 0;
        visibility: visible;
    }
    12% {
        opacity: 1;
    }
    78% {
        opacity: 1;
    }
    100% {
        left: calc(((100% - 30px) / var(--deal-progress-steps)) * var(--deal-progress-index));
        opacity: 0;
        visibility: hidden;
    }
}

@keyframes deal-progress-coin-bounce-p3 {
    0% { transform: translateY(0) scale(0.96) rotate(0deg); }
    30% { transform: translateY(-8px) scale(1.08) rotate(12deg); }
    64% { transform: translateY(0) scale(1) rotate(28deg); }
    100% { transform: translateY(0) scale(0.98) rotate(36deg); }
}

/* Light theme overrides: readable, not pastel-on-pastel. */
body.theme-light .deals-page .deal-title,
body.theme-light .deals-page .deal-info-section h3,
body.theme-light .deals-page .deal-actions-section h3,
body.theme-light .deals-page .deal-history-section h3,
body.theme-light .deals-page .deal-delivery-section h3,
body.theme-light .deals-page .deal-info-section h4,
body.theme-light .deals-page .deal-description h4,
body.theme-light .deals-page .deal-terms h4 {
    color: #0f172a !important;
}

body.theme-light .deals-page .deal-subtitle span,
body.theme-light .deals-page .deal-subtitle .deal-type,
body.theme-light .deals-page .deal-subtitle .deal-role {
    color: #0f172a !important;
    background: rgba(255, 255, 255, 0.98) !important;
    border-color: rgba(100, 116, 139, 0.22) !important;
}

body.theme-light .deals-page .deal-subtitle .deal-id {
    color: #ffffff !important;
    background: linear-gradient(135deg, #4338ca, #7c3aed) !important;
    border-color: rgba(67, 56, 202, 0.28) !important;
}

body.theme-light .deals-page .deal-list-item {
    color: #0f172a !important;
}

body.theme-light .deals-page .deal-item-title {
    color: #0f172a !important;
    text-shadow: none !important;
}

body.theme-light .deals-page .deal-item-meta,
body.theme-light .deals-page .deals-group-header {
    color: #334155 !important;
}


body.theme-light .deals-page .deal-item-amount,
body.theme-light .deals-page .deal-amount {
    color: #4c1d95 !important;
    text-shadow: none !important;
}

body.theme-light .deals-page .deal-info-section,
body.theme-light .deals-page .deal-actions-section,
body.theme-light .deals-page .deal-history-section,
body.theme-light .deals-page .deal-delivery-section,
body.theme-light .deals-page .delivery-info,
body.theme-light .deals-page .deal-history,
body.theme-light .deals-page .terms-list,
body.theme-light .deals-page .deal-participants,
body.theme-light .deals-page .participant,
body.theme-light .deals-page .history-item,
body.theme-light .deals-page .term-item,
body.theme-light .deals-page .participant-line,
body.theme-light .deals-page .history-line,
body.theme-light .deals-page .deal-description p {
    color: #0f172a !important;
}

body.theme-light .deals-page .term-item span:first-child,
body.theme-light .deals-page .delivery-label,
body.theme-light .deals-page .history-time {
    color: #475569 !important;
}

body.theme-light .deals-page .term-item span:last-child,
body.theme-light .deals-page .delivery-value,
body.theme-light .deals-page .participant-name,
body.theme-light .deals-page .history-title {
    color: #0f172a !important;
}

body.theme-light .deals-page .deal-actions .btn.success {
    background: linear-gradient(135deg, #047857, #10b981) !important;
    color: #ffffff !important;
    border-color: rgba(4, 120, 87, 0.75) !important;
}

body.theme-light .deals-page .deal-actions .btn.success:disabled {
    background: linear-gradient(135deg, #0f766e, #14b8a6) !important;
    color: #ffffff !important;
    opacity: 0.78 !important;
}

body.theme-light .deals-page .deal-timeline .status-step::before {
    background: rgba(100, 116, 139, 0.38) !important;
}

body.theme-light .deals-page .deal-timeline .status-label {
    color: #64748b !important;
}

body.theme-light .deals-page .deal-timeline .status-step.active .status-label,
body.theme-light .deals-page .deal-timeline .status-step.completed .status-label {
    color: #0f172a !important;
}

/* Glass keeps glow but text stays hard-readable. */
body.theme-glass .deals-page .deal-item-title,
body.theme-glass .deals-page .deals-group-header {
    color: rgba(255, 255, 255, 0.98) !important;
}

body.theme-glass .deals-page .deal-subtitle span,
body.theme-glass .deals-page .deal-subtitle .deal-type,
body.theme-glass .deals-page .deal-subtitle .deal-role {
    color: rgba(255, 255, 255, 0.98) !important;
    background: rgba(15, 23, 42, 0.30) !important;
}

@media (max-width: 700px) {
    @keyframes deal-progress-coin-move-p3 {
        0% {
            left: calc(((100% - 18px) / var(--deal-progress-steps)) * var(--deal-progress-start));
            opacity: 0;
            visibility: visible;
        }
        12% { opacity: 1; }
        78% { opacity: 1; }
        100% {
            left: calc(((100% - 18px) / var(--deal-progress-steps)) * var(--deal-progress-index));
            opacity: 0;
            visibility: hidden;
        }
    }
}


/* ===== STAGE UI P4: cancelled status red + deals render flicker fixes ===== */
.deals-page .deal-item-status.cancelled,
.deals-page .deal-status.cancelled {
    background: linear-gradient(135deg, #991b1b, #dc2626) !important;
    border-color: rgba(153, 27, 27, 0.78) !important;
    color: #ffffff !important;
    box-shadow: 0 10px 22px rgba(185, 28, 28, 0.20), inset 0 1px 0 rgba(255, 255, 255, 0.18) !important;
}

body.theme-light .deals-page .deal-item-status.cancelled,
body.theme-light .deals-page .deal-status.cancelled {
    background: linear-gradient(135deg, #b91c1c, #ef4444) !important;
    border-color: rgba(185, 28, 28, 0.70) !important;
    color: #ffffff !important;
}


/* ===== STAGE UI P5: deals section header icons + mobile rounded clipping ===== */

/* The small square before section titles is intentional, but it must not be empty. */
.deals-page .deal-info-section h3::before,
.deals-page .deal-actions-section h3::before,
.deals-page .deal-history-section h3::before,
.deals-page .delivery-section h3::before,
.deals-page .deal-delivery-section h3::before,
.deals-page .dispute-section h3::before,
.deals-page .deal-dispute-section h3::before {
    display: inline-grid !important;
    place-items: center !important;
    color: #ffffff !important;
    font-size: 0.92rem !important;
    font-weight: 950 !important;
    line-height: 1 !important;
    text-shadow: 0 1px 0 rgba(15, 23, 42, 0.24) !important;
    background:
        radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.18), transparent 36%),
        linear-gradient(135deg, rgba(99, 102, 241, 0.82), rgba(20, 184, 166, 0.34)) !important;
    border-color: rgba(196, 181, 253, 0.30) !important;
    box-shadow: 0 10px 24px rgba(79, 70, 229, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.16) !important;
}

.deals-page .deal-info-grid .deal-info-section:nth-child(1) h3::before {
    content: '₮' !important;
}

.deals-page .deal-info-grid .deal-info-section:nth-child(2) h3::before {
    content: '👥' !important;
    font-size: 0.84rem !important;
}

.deals-page .deal-actions-section h3::before {
    content: '⚡' !important;
}

.deals-page .deal-history-section h3::before {
    content: '↻' !important;
}

.deals-page .delivery-section h3::before,
.deals-page .deal-delivery-section h3::before {
    content: '↦' !important;
}

.deals-page .dispute-section h3::before,
.deals-page .deal-dispute-section h3::before {
    content: '⚖' !important;
}

body.theme-light .deals-page .deal-info-section h3::before,
body.theme-light .deals-page .deal-actions-section h3::before,
body.theme-light .deals-page .deal-history-section h3::before,
body.theme-light .deals-page .delivery-section h3::before,
body.theme-light .deals-page .deal-delivery-section h3::before,
body.theme-light .deals-page .dispute-section h3::before,
body.theme-light .deals-page .deal-dispute-section h3::before {
    color: #ffffff !important;
    border-color: rgba(79, 70, 229, 0.24) !important;
    box-shadow: 0 10px 22px rgba(79, 70, 229, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.18) !important;
}

/* Mobile: earlier scroll fixes made the detail card overflow visible, which exposes square gradient corners.
   Keep the scroll containers visible, but clip only the rounded card itself. */
@media (max-width: 900px) {
    .app:has(.deals-page) .deals-container.mobile-deal-open .deal-details-card,
    .deals-page .deal-details-card {
        overflow: hidden !important;
        border-radius: 28px !important;
        background-clip: padding-box !important;
        isolation: isolate !important;
        transform: translateZ(0);
    }

    .deals-page .deal-details-card::before {
        border-top-left-radius: inherit !important;
        border-top-right-radius: inherit !important;
        overflow: hidden !important;
    }

    .deals-page .deal-header,
    .deals-page .deal-header-right,
    .deals-page .deal-timeline,
    .deals-page .deal-info-section,
    .deals-page .deal-actions-section,
    .deals-page .deal-history-section {
        background-clip: padding-box !important;
    }
}

@media (max-width: 560px) {
    .deals-page .deal-details-card {
        border-radius: 24px !important;
    }

    .deals-page .deal-info-section h3::before,
    .deals-page .deal-actions-section h3::before,
    .deals-page .deal-history-section h3::before,
    .deals-page .delivery-section h3::before,
    .deals-page .deal-delivery-section h3::before,
    .deals-page .dispute-section h3::before,
    .deals-page .deal-dispute-section h3::before {
        width: 36px !important;
        height: 36px !important;
        flex-basis: 36px !important;
        border-radius: 14px !important;
    }
}


/* ===== STAGE UI P6: semantic section icons, no title overlap ===== */

/* Replace previous text/emoji pseudo-icons with fixed SVG icons inside stable boxes. */
.deals-page .deal-info-section h3,
.deals-page .deal-actions-section h3,
.deals-page .deal-history-section h3,
.deals-page .delivery-section h3,
.deals-page .deal-delivery-section h3,
.deals-page .dispute-section h3,
.deals-page .deal-dispute-section h3 {
    display: grid !important;
    grid-template-columns: 42px minmax(0, 1fr) !important;
    align-items: center !important;
    column-gap: 12px !important;
    row-gap: 0 !important;
    min-width: 0 !important;
}

.deals-page .deal-info-section h3::before,
.deals-page .deal-actions-section h3::before,
.deals-page .deal-history-section h3::before,
.deals-page .delivery-section h3::before,
.deals-page .deal-delivery-section h3::before,
.deals-page .dispute-section h3::before,
.deals-page .deal-dispute-section h3::before {
    content: '' !important;
    grid-column: 1 !important;
    grid-row: 1 !important;
    width: 42px !important;
    height: 42px !important;
    flex: 0 0 42px !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    border-radius: 15px !important;
    background-color: rgba(99, 102, 241, 0.18) !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    background-size: 21px 21px !important;
    border: 1px solid rgba(196, 181, 253, 0.28) !important;
    box-shadow: 0 10px 24px rgba(79, 70, 229, 0.13), inset 0 1px 0 rgba(255, 255, 255, 0.14) !important;
}

/* Условия сделки — документ/условия */
.deals-page .deal-info-grid .deal-info-section:nth-child(1) h3::before {
    background-image:
        url("data:image/svg+xml,%3Csvg%20width%3D%2221%22%20height%3D%2221%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%3E%3Cpath%20d%3D%22M14%202H7a3%203%200%200%200-3%203v14a3%203%200%200%200%203%203h10a3%203%200%200%200%203-3V8l-6-6Z%22%20stroke%3D%22%23ffffff%22%20stroke-width%3D%222.1%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22/%3E%3Cpath%20d%3D%22M14%202v6h6%22%20stroke%3D%22%23ffffff%22%20stroke-width%3D%222.1%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22/%3E%3Cpath%20d%3D%22M8%2013h8M8%2017h5%22%20stroke%3D%22%23ffffff%22%20stroke-width%3D%222.1%22%20stroke-linecap%3D%22round%22/%3E%3C/svg%3E"),
        radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.18), transparent 36%),
        linear-gradient(135deg, rgba(99, 102, 241, 0.82), rgba(20, 184, 166, 0.34)) !important;
}

/* Участники — пользователи */
.deals-page .deal-info-grid .deal-info-section:nth-child(2) h3::before {
    background-image:
        url("data:image/svg+xml,%3Csvg%20width%3D%2221%22%20height%3D%2221%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%3E%3Cpath%20d%3D%22M16%2021v-2a4%204%200%200%200-4-4H6a4%204%200%200%200-4%204v2%22%20stroke%3D%22%23ffffff%22%20stroke-width%3D%222.1%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22/%3E%3Ccircle%20cx%3D%229%22%20cy%3D%227%22%20r%3D%224%22%20stroke%3D%22%23ffffff%22%20stroke-width%3D%222.1%22/%3E%3Cpath%20d%3D%22M22%2021v-2a4%204%200%200%200-3-3.87M16%203.13a4%204%200%200%201%200%207.75%22%20stroke%3D%22%23ffffff%22%20stroke-width%3D%222.1%22%20stroke-linecap%3D%22round%22/%3E%3C/svg%3E"),
        radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.18), transparent 36%),
        linear-gradient(135deg, rgba(20, 184, 166, 0.72), rgba(99, 102, 241, 0.42)) !important;
}

/* Действия — молния */
.deals-page .deal-actions-section h3::before {
    background-image:
        url("data:image/svg+xml,%3Csvg%20width%3D%2221%22%20height%3D%2221%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%3E%3Cpath%20d%3D%22M13%202%204%2014h7l-1%208%209-12h-7l1-8Z%22%20stroke%3D%22%23ffffff%22%20stroke-width%3D%222.1%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22/%3E%3C/svg%3E"),
        radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.18), transparent 36%),
        linear-gradient(135deg, rgba(124, 58, 237, 0.86), rgba(245, 158, 11, 0.38)) !important;
}

/* История событий — clock/history */
.deals-page .deal-history-section h3::before {
    background-image:
        url("data:image/svg+xml,%3Csvg%20width%3D%2221%22%20height%3D%2221%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%3E%3Cpath%20d%3D%22M3%2012a9%209%200%201%200%203-6.7%22%20stroke%3D%22%23ffffff%22%20stroke-width%3D%222.1%22%20stroke-linecap%3D%22round%22/%3E%3Cpath%20d%3D%22M3%204v5h5%22%20stroke%3D%22%23ffffff%22%20stroke-width%3D%222.1%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22/%3E%3Cpath%20d%3D%22M12%207v5l3%202%22%20stroke%3D%22%23ffffff%22%20stroke-width%3D%222.1%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22/%3E%3C/svg%3E"),
        radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.18), transparent 36%),
        linear-gradient(135deg, rgba(59, 130, 246, 0.78), rgba(99, 102, 241, 0.42)) !important;
}

/* Delivery — package/arrow */
.deals-page .delivery-section h3::before,
.deals-page .deal-delivery-section h3::before {
    background-image:
        url("data:image/svg+xml,%3Csvg%20width%3D%2221%22%20height%3D%2221%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%3E%3Cpath%20d%3D%22M21%208l-9-5-9%205%209%205%209-5Z%22%20stroke%3D%22%23ffffff%22%20stroke-width%3D%222.1%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22/%3E%3Cpath%20d%3D%22M3%208v8l9%205%209-5V8M12%2013v8%22%20stroke%3D%22%23ffffff%22%20stroke-width%3D%222.1%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22/%3E%3C/svg%3E"),
        radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.18), transparent 36%),
        linear-gradient(135deg, rgba(14, 116, 144, 0.82), rgba(20, 184, 166, 0.40)) !important;
}

/* Dispute — scales */
.deals-page .dispute-section h3::before,
.deals-page .deal-dispute-section h3::before {
    background-image:
        url("data:image/svg+xml,%3Csvg%20width%3D%2221%22%20height%3D%2221%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%3E%3Cpath%20d%3D%22M12%203v18M6%207h12M6%207l-4%207h8L6%207ZM18%207l-4%207h8l-4-7ZM5%2021h14%22%20stroke%3D%22%23ffffff%22%20stroke-width%3D%222.1%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22/%3E%3C/svg%3E"),
        radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.18), transparent 36%),
        linear-gradient(135deg, rgba(185, 28, 28, 0.84), rgba(124, 58, 237, 0.34)) !important;
}

@media (max-width: 560px) {
    .deals-page .deal-info-section h3,
    .deals-page .deal-actions-section h3,
    .deals-page .deal-history-section h3,
    .deals-page .delivery-section h3,
    .deals-page .deal-delivery-section h3,
    .deals-page .dispute-section h3,
    .deals-page .deal-dispute-section h3 {
        grid-template-columns: 36px minmax(0, 1fr) !important;
        column-gap: 10px !important;
    }

    .deals-page .deal-info-section h3::before,
    .deals-page .deal-actions-section h3::before,
    .deals-page .deal-history-section h3::before,
    .deals-page .delivery-section h3::before,
    .deals-page .deal-delivery-section h3::before,
    .deals-page .dispute-section h3::before,
    .deals-page .deal-dispute-section h3::before {
        width: 36px !important;
        height: 36px !important;
        flex-basis: 36px !important;
        border-radius: 14px !important;
        background-size: 18px 18px !important;
    }
}


/* ===== STAGE UI P7: clean semantic section header icons =====
   Replaces the previous boxed/emoji-looking section icons with clean SVG-mask icons.
   CSS-only, no deal/backend/action logic changes. */

.deals-page .deal-info-section h3,
.deals-page .deal-actions-section h3,
.deals-page .deal-history-section h3,
.deals-page .delivery-section h3,
.deals-page .deal-delivery-section h3,
.deals-page .dispute-section h3,
.deals-page .deal-dispute-section h3 {
    display: grid !important;
    grid-template-columns: 28px minmax(0, 1fr) !important;
    align-items: center !important;
    column-gap: 12px !important;
    row-gap: 0 !important;
    min-width: 0 !important;
}

.deals-page .deal-info-section h3::before,
.deals-page .deal-actions-section h3::before,
.deals-page .deal-history-section h3::before,
.deals-page .delivery-section h3::before,
.deals-page .deal-delivery-section h3::before,
.deals-page .dispute-section h3::before,
.deals-page .deal-dispute-section h3::before {
    content: '' !important;
    grid-column: 1 !important;
    grid-row: 1 !important;
    width: 24px !important;
    height: 24px !important;
    flex: 0 0 24px !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    overflow: visible !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    outline: none !important;
    background-color: #7c3aed !important;
    background-image: none !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    background-size: contain !important;
    -webkit-mask-repeat: no-repeat !important;
    mask-repeat: no-repeat !important;
    -webkit-mask-position: center !important;
    mask-position: center !important;
    -webkit-mask-size: contain !important;
    mask-size: contain !important;
}

/* Условия сделки — документ */
.deals-page .deal-info-grid .deal-info-section:nth-child(1) h3::before {
    background-color: #6366f1 !important;
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg%20viewBox%3D%220%200%2024%2024%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%3E%3Cpath%20fill%3D%22%23000%22%20d%3D%22M14%202H7a3%203%200%200%200-3%203v14a3%203%200%200%200%203%203h10a3%203%200%200%200%203-3V8l-6-6Zm0%203.2L16.8%208H15a1%201%200%200%201-1-1V5.2ZM7%204h5v3a3%203%200%200%200%203%203h3v9a1%201%200%200%201-1%201H7a1%201%200%200%201-1-1V5a1%201%200%200%201%201-1Zm2%209a1%201%200%201%200%200%202h6a1%201%200%201%200%200-2H9Zm0%204a1%201%200%201%200%200%202h4a1%201%200%201%200%200-2H9Z%22/%3E%3C/svg%3E") !important;
    mask-image: url("data:image/svg+xml,%3Csvg%20viewBox%3D%220%200%2024%2024%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%3E%3Cpath%20fill%3D%22%23000%22%20d%3D%22M14%202H7a3%203%200%200%200-3%203v14a3%203%200%200%200%203%203h10a3%203%200%200%200%203-3V8l-6-6Zm0%203.2L16.8%208H15a1%201%200%200%201-1-1V5.2ZM7%204h5v3a3%203%200%200%200%203%203h3v9a1%201%200%200%201-1%201H7a1%201%200%200%201-1-1V5a1%201%200%200%201%201-1Zm2%209a1%201%200%201%200%200%202h6a1%201%200%201%200%200-2H9Zm0%204a1%201%200%201%200%200%202h4a1%201%200%201%200%200-2H9Z%22/%3E%3C/svg%3E") !important;
}

/* Участники — два пользователя */
.deals-page .deal-info-grid .deal-info-section:nth-child(2) h3::before {
    background-color: #10b981 !important;
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg%20viewBox%3D%220%200%2024%2024%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%3E%3Cpath%20fill%3D%22%23000%22%20d%3D%22M9%2012a5%205%200%201%200%200-10%205%205%200%200%200%200%2010Zm0-8a3%203%200%201%201%200%206%203%203%200%200%201%200-6Zm0%2010c-3.86%200-7%202.69-7%206a1%201%200%201%200%202%200c0-2.17%202.24-4%205-4s5%201.83%205%204a1%201%200%201%200%202%200c0-3.31-3.14-6-7-6Zm8.6-.64a1%201%200%200%200-.7%201.88c1.83.68%203.1%202.14%203.1%203.76a1%201%200%201%200%202%200c0-2.94-1.8-5.06-4.4-6Zm-.85-10.08a1%201%200%200%200-.5%201.94A2.9%202.9%200%200%201%2018.5%208a2.9%202.9%200%200%201-2.25%202.78%201%201%200%200%200%20.5%201.94A4.9%204.9%200%200%200%2020.5%208a4.9%204.9%200%200%200-3.75-4.72Z%22/%3E%3C/svg%3E") !important;
    mask-image: url("data:image/svg+xml,%3Csvg%20viewBox%3D%220%200%2024%2024%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%3E%3Cpath%20fill%3D%22%23000%22%20d%3D%22M9%2012a5%205%200%201%200%200-10%205%205%200%200%200%200%2010Zm0-8a3%203%200%201%201%200%206%203%203%200%200%201%200-6Zm0%2010c-3.86%200-7%202.69-7%206a1%201%200%201%200%202%200c0-2.17%202.24-4%205-4s5%201.83%205%204a1%201%200%201%200%202%200c0-3.31-3.14-6-7-6Zm8.6-.64a1%201%200%200%200-.7%201.88c1.83.68%203.1%202.14%203.1%203.76a1%201%200%201%200%202%200c0-2.94-1.8-5.06-4.4-6Zm-.85-10.08a1%201%200%200%200-.5%201.94A2.9%202.9%200%200%201%2018.5%208a2.9%202.9%200%200%201-2.25%202.78%201%201%200%200%200%20.5%201.94A4.9%204.9%200%200%200%2020.5%208a4.9%204.9%200%200%200-3.75-4.72Z%22/%3E%3C/svg%3E") !important;
}

/* Действия — молния */
.deals-page .deal-actions-section h3::before {
    background-color: #8b5cf6 !important;
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg%20viewBox%3D%220%200%2024%2024%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%3E%3Cpath%20fill%3D%22%23000%22%20d%3D%22M13.6%201.08a1%201%200%200%201%20.36%201.08L12.3%209H19a1%201%200%200%201%20.8%201.6l-9%2012a1%201%200%200%201-1.76-.76L10.7%2015H4a1%201%200%200%201-.8-1.6l9-12a1%201%200%200%201%201.4-.32Z%22/%3E%3C/svg%3E") !important;
    mask-image: url("data:image/svg+xml,%3Csvg%20viewBox%3D%220%200%2024%2024%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%3E%3Cpath%20fill%3D%22%23000%22%20d%3D%22M13.6%201.08a1%201%200%200%201%20.36%201.08L12.3%209H19a1%201%200%200%201%20.8%201.6l-9%2012a1%201%200%200%201-1.76-.76L10.7%2015H4a1%201%200%200%201-.8-1.6l9-12a1%201%200%200%201%201.4-.32Z%22/%3E%3C/svg%3E") !important;
}

/* История событий — история/часы */
.deals-page .deal-history-section h3::before {
    background-color: #3b82f6 !important;
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg%20viewBox%3D%220%200%2024%2024%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%3E%3Cpath%20fill%3D%22%23000%22%20d%3D%22M12%202a10%2010%200%201%201-7.07%2017.07%201%201%200%200%201%201.42-1.42A8%208%200%201%200%204%2012H2.5a1%201%200%200%201-.78-1.63l3-3.7a1%201%200%200%201%201.56%200l3%203.7A1%201%200%200%201%208.5%2012H6a6%206%200%201%200%206-6%201%201%200%201%201%200-2Zm1%206a1%201%200%201%200-2%200v4a1%201%200%200%200%20.45.83l3%202a1%201%200%201%200%201.1-1.66L13%2011.46V8Z%22/%3E%3C/svg%3E") !important;
    mask-image: url("data:image/svg+xml,%3Csvg%20viewBox%3D%220%200%2024%2024%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%3E%3Cpath%20fill%3D%22%23000%22%20d%3D%22M12%202a10%2010%200%201%201-7.07%2017.07%201%201%200%200%201%201.42-1.42A8%208%200%201%200%204%2012H2.5a1%201%200%200%201-.78-1.63l3-3.7a1%201%200%200%201%201.56%200l3%203.7A1%201%200%200%201%208.5%2012H6a6%206%200%201%200%206-6%201%201%200%201%201%200-2Zm1%206a1%201%200%201%200-2%200v4a1%201%200%200%200%20.45.83l3%202a1%201%200%201%200%201.1-1.66L13%2011.46V8Z%22/%3E%3C/svg%3E") !important;
}

/* Delivery — box */
.deals-page .delivery-section h3::before,
.deals-page .deal-delivery-section h3::before {
    background-color: #0891b2 !important;
}

/* Dispute — scales */
.deals-page .dispute-section h3::before,
.deals-page .deal-dispute-section h3::before {
    background-color: #dc2626 !important;
}

body.theme-light .deals-page .deal-info-section h3::before,
body.theme-light .deals-page .deal-actions-section h3::before,
body.theme-light .deals-page .deal-history-section h3::before,
body.theme-light .deals-page .delivery-section h3::before,
body.theme-light .deals-page .deal-delivery-section h3::before,
body.theme-light .deals-page .dispute-section h3::before,
body.theme-light .deals-page .deal-dispute-section h3::before {
    filter: none !important;
}

@media (max-width: 560px) {
    .deals-page .deal-info-section h3,
    .deals-page .deal-actions-section h3,
    .deals-page .deal-history-section h3,
    .deals-page .delivery-section h3,
    .deals-page .deal-delivery-section h3,
    .deals-page .dispute-section h3,
    .deals-page .deal-dispute-section h3 {
        grid-template-columns: 24px minmax(0, 1fr) !important;
        column-gap: 10px !important;
    }

    .deals-page .deal-info-section h3::before,
    .deals-page .deal-actions-section h3::before,
    .deals-page .deal-history-section h3::before,
    .deals-page .delivery-section h3::before,
    .deals-page .deal-delivery-section h3::before,
    .deals-page .dispute-section h3::before,
    .deals-page .deal-dispute-section h3::before {
        width: 22px !important;
        height: 22px !important;
        flex-basis: 22px !important;
    }
}


/* ===== STAGE UI P8: crisp section icons, no blur/no washed masks =====
   Overrides P6/P7 icons with direct SVG background icons. No masks, no emoji, no inner boxes. */

.deals-page .deal-info-section h3,
.deals-page .deal-actions-section h3,
.deals-page .deal-history-section h3,
.deals-page .delivery-section h3,
.deals-page .deal-delivery-section h3,
.deals-page .dispute-section h3,
.deals-page .deal-dispute-section h3 {
    display: grid !important;
    grid-template-columns: 32px minmax(0, 1fr) !important;
    align-items: center !important;
    column-gap: 12px !important;
}

.deals-page .deal-info-section h3::before,
.deals-page .deal-actions-section h3::before,
.deals-page .deal-history-section h3::before,
.deals-page .delivery-section h3::before,
.deals-page .deal-delivery-section h3::before,
.deals-page .dispute-section h3::before,
.deals-page .deal-dispute-section h3::before {
    content: '' !important;
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    flex: 0 0 28px !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
    background-color: transparent !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    background-size: 26px 26px !important;
    -webkit-mask: none !important;
    mask: none !important;
    filter: none !important;
    opacity: 1 !important;
}

/* Условия сделки — crisp document/check */
.deals-page .deal-info-grid .deal-info-section:nth-child(1) h3::before {
    background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2228%22%20height%3D%2228%22%20viewBox%3D%220%200%2028%2028%22%20fill%3D%22none%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%3E%3Cpath%20d%3D%22M17%203.5H8.5A2.5%202.5%200%200%200%206%206v16a2.5%202.5%200%200%200%202.5%202.5h11a2.5%202.5%200%200%200%202.5-2.5V9L17%203.5Z%22%20stroke%3D%22%234F46E5%22%20stroke-width%3D%222.35%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22/%3E%3Cpath%20d%3D%22M17%203.5V9h5%22%20stroke%3D%22%234F46E5%22%20stroke-width%3D%222.35%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22/%3E%3Cpath%20d%3D%22M10%2015h8M10%2019h5%22%20stroke%3D%22%237C3AED%22%20stroke-width%3D%222.35%22%20stroke-linecap%3D%22round%22/%3E%3C/svg%3E") !important;
}

/* Участники — crisp users */
.deals-page .deal-info-grid .deal-info-section:nth-child(2) h3::before {
    background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2228%22%20height%3D%2228%22%20viewBox%3D%220%200%2028%2028%22%20fill%3D%22none%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%3E%3Ccircle%20cx%3D%2211%22%20cy%3D%229%22%20r%3D%224%22%20stroke%3D%22%23059669%22%20stroke-width%3D%222.35%22/%3E%3Cpath%20d%3D%22M4.5%2023c0-3.4%202.9-6%206.5-6s6.5%202.6%206.5%206%22%20stroke%3D%22%23059669%22%20stroke-width%3D%222.35%22%20stroke-linecap%3D%22round%22/%3E%3Cpath%20d%3D%22M19%2013.5c2-.35%203.5-2.05%203.5-4.15%200-1.95-1.25-3.6-3-4.05%22%20stroke%3D%22%2310B981%22%20stroke-width%3D%222.35%22%20stroke-linecap%3D%22round%22/%3E%3Cpath%20d%3D%22M20%2016.8c2.4.8%203.9%202.9%203.9%205.2%22%20stroke%3D%22%2310B981%22%20stroke-width%3D%222.35%22%20stroke-linecap%3D%22round%22/%3E%3C/svg%3E") !important;
}

/* Действия — crisp lightning */
.deals-page .deal-actions-section h3::before {
    background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2228%22%20height%3D%2228%22%20viewBox%3D%220%200%2028%2028%22%20fill%3D%22none%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%3E%3Cpath%20d%3D%22M15.5%202.8%206.5%2015.3h7l-1.1%209.9%209.1-12.9h-7l1-9.5Z%22%20fill%3D%22%237C3AED%22%20stroke%3D%22%237C3AED%22%20stroke-width%3D%221.8%22%20stroke-linejoin%3D%22round%22/%3E%3C/svg%3E") !important;
}

/* История событий — crisp history clock */
.deals-page .deal-history-section h3::before {
    background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2228%22%20height%3D%2228%22%20viewBox%3D%220%200%2028%2028%22%20fill%3D%22none%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%3E%3Cpath%20d%3D%22M5%2012.8A9.2%209.2%200%201%201%207.7%2019%22%20stroke%3D%22%232563EB%22%20stroke-width%3D%222.35%22%20stroke-linecap%3D%22round%22/%3E%3Cpath%20d%3D%22M4.8%206.8v6h6%22%20stroke%3D%22%232563EB%22%20stroke-width%3D%222.35%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22/%3E%3Cpath%20d%3D%22M14%208.5v6l3.7%202.2%22%20stroke%3D%22%233B82F6%22%20stroke-width%3D%222.35%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22/%3E%3C/svg%3E") !important;
}

/* Доставка — crisp package */
.deals-page .delivery-section h3::before,
.deals-page .deal-delivery-section h3::before {
    background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2228%22%20height%3D%2228%22%20viewBox%3D%220%200%2028%2028%22%20fill%3D%22none%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%3E%3Cpath%20d%3D%22M14%203.5%2023%208.5v10L14%2024%205%2018.5v-10L14%203.5Z%22%20stroke%3D%22%230E7490%22%20stroke-width%3D%222.35%22%20stroke-linejoin%3D%22round%22/%3E%3Cpath%20d%3D%22M5.5%208.7%2014%2013.5l8.5-4.8M14%2013.5V24%22%20stroke%3D%22%2306B6D4%22%20stroke-width%3D%222.35%22%20stroke-linecap%3D%22round%22/%3E%3C/svg%3E") !important;
}

/* Спор — crisp scales */
.deals-page .dispute-section h3::before,
.deals-page .deal-dispute-section h3::before {
    background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2228%22%20height%3D%2228%22%20viewBox%3D%220%200%2028%2028%22%20fill%3D%22none%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%3E%3Cpath%20d%3D%22M14%204v19M8%207h12M8%207l-4.5%208h9L8%207ZM20%207l-4.5%208h9L20%207ZM7%2024h14%22%20stroke%3D%22%23DC2626%22%20stroke-width%3D%222.35%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22/%3E%3C/svg%3E") !important;
}

/* Dark/glass themes: slightly brighter strokes by filter, but keep crisp edges. */
body.theme-dark .deals-page .deal-info-section h3::before,
body.theme-dark .deals-page .deal-actions-section h3::before,
body.theme-dark .deals-page .deal-history-section h3::before,
body.theme-dark .deals-page .delivery-section h3::before,
body.theme-dark .deals-page .deal-delivery-section h3::before,
body.theme-dark .deals-page .dispute-section h3::before,
body.theme-dark .deals-page .deal-dispute-section h3::before,
body.theme-glass .deals-page .deal-info-section h3::before,
body.theme-glass .deals-page .deal-actions-section h3::before,
body.theme-glass .deals-page .deal-history-section h3::before,
body.theme-glass .deals-page .delivery-section h3::before,
body.theme-glass .deals-page .deal-delivery-section h3::before,
body.theme-glass .deals-page .dispute-section h3::before,
body.theme-glass .deals-page .deal-dispute-section h3::before {
    filter: saturate(1.15) brightness(1.12) !important;
}

@media (max-width: 560px) {
    .deals-page .deal-info-section h3,
    .deals-page .deal-actions-section h3,
    .deals-page .deal-history-section h3,
    .deals-page .delivery-section h3,
    .deals-page .deal-delivery-section h3,
    .deals-page .dispute-section h3,
    .deals-page .deal-dispute-section h3 {
        grid-template-columns: 28px minmax(0, 1fr) !important;
        column-gap: 10px !important;
    }

    .deals-page .deal-info-section h3::before,
    .deals-page .deal-actions-section h3::before,
    .deals-page .deal-history-section h3::before,
    .deals-page .delivery-section h3::before,
    .deals-page .deal-delivery-section h3::before,
    .deals-page .dispute-section h3::before,
    .deals-page .deal-dispute-section h3::before {
        width: 25px !important;
        height: 25px !important;
        min-width: 25px !important;
        flex-basis: 25px !important;
        background-size: 24px 24px !important;
    }
}


/* ===== STAGE UI P9: real inline section SVG icons, no pseudo-element artifacts =====
   Stop rendering pseudo icons from earlier visual attempts. Use inline SVG from ui/deals.js instead. */

.deals-page .deal-info-section h3::before,
.deals-page .deal-actions-section h3::before,
.deals-page .deal-history-section h3::before,
.deals-page .delivery-section h3::before,
.deals-page .deal-delivery-section h3::before,
.deals-page .dispute-section h3::before,
.deals-page .deal-dispute-section h3::before,
.deals-page .deal-info-grid .deal-info-section:nth-child(1) h3::before,
.deals-page .deal-info-grid .deal-info-section:nth-child(2) h3::before {
    content: none !important;
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    min-width: 0 !important;
    flex: 0 0 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: none !important;
    background-image: none !important;
    box-shadow: none !important;
    -webkit-mask: none !important;
    mask: none !important;
}

.deals-page .deal-section-title {
    display: grid !important;
    grid-template-columns: 42px minmax(0, 1fr) !important;
    align-items: center !important;
    gap: 12px !important;
    margin: 0 0 14px !important;
    color: var(--text) !important;
}

.deals-page .deal-section-title-icon {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #7c3aed;
    background: rgba(124, 58, 237, 0.10);
    border: 1px solid rgba(124, 58, 237, 0.20);
    box-shadow: none !important;
}

.deals-page .deal-section-title-text {
    min-width: 0;
    display: block;
    overflow-wrap: anywhere;
    color: var(--text) !important;
}

.deals-page .deal-section-svg {
    width: 22px;
    height: 22px;
    display: block;
    color: currentColor;
    stroke: currentColor;
}

.deals-page .deal-section-title-terms .deal-section-title-icon {
    color: #4f46e5;
    background: rgba(79, 70, 229, 0.10);
    border-color: rgba(79, 70, 229, 0.20);
}

.deals-page .deal-section-title-participants .deal-section-title-icon {
    color: #059669;
    background: rgba(16, 185, 129, 0.10);
    border-color: rgba(16, 185, 129, 0.20);
}

.deals-page .deal-section-title-actions .deal-section-title-icon {
    color: #7c3aed;
    background: rgba(124, 58, 237, 0.10);
    border-color: rgba(124, 58, 237, 0.20);
}

.deals-page .deal-section-title-history .deal-section-title-icon {
    color: #2563eb;
    background: rgba(37, 99, 235, 0.10);
    border-color: rgba(37, 99, 235, 0.20);
}

.deals-page .deal-section-title-delivery .deal-section-title-icon {
    color: #0891b2;
    background: rgba(8, 145, 178, 0.10);
    border-color: rgba(8, 145, 178, 0.20);
}

.deals-page .deal-section-title-dispute .deal-section-title-icon {
    color: #dc2626;
    background: rgba(220, 38, 38, 0.10);
    border-color: rgba(220, 38, 38, 0.20);
}

body.theme-dark .deals-page .deal-section-title-icon,
body.theme-glass .deals-page .deal-section-title-icon {
    background: rgba(255, 255, 255, 0.055);
    border-color: rgba(148, 163, 184, 0.16);
}

body.theme-light .deals-page .deal-section-title-icon {
    background: rgba(248, 250, 252, 0.90);
    border-color: rgba(148, 163, 184, 0.22);
}

@media (max-width: 560px) {
    .deals-page .deal-section-title {
        grid-template-columns: 36px minmax(0, 1fr) !important;
        gap: 10px !important;
    }

    .deals-page .deal-section-title-icon {
        width: 36px;
        height: 36px;
        min-width: 36px;
        border-radius: 14px;
    }

    .deals-page .deal-section-svg {
        width: 20px;
        height: 20px;
    }
}

/* ===== STAGE UI P10: remove underline from deal chat action ===== */
.deals-page .deal-actions .deal-action-chat,
.deals-page .deal-actions a.deal-action-chat,
.deals-page .deal-chat-link a,
.deals-page .deal-chat-link .btn {
    text-decoration: none !important;
    -webkit-text-decoration: none !important;
    text-decoration-line: none !important;
}

.deals-page .deal-actions .deal-action-chat *,
.deals-page .deal-chat-link .btn * {
    text-decoration: none !important;
    -webkit-text-decoration: none !important;
    text-decoration-line: none !important;
}

.deals-page .deal-actions .deal-action-chat:hover,
.deals-page .deal-actions .deal-action-chat:focus,
.deals-page .deal-actions .deal-action-chat:visited,
.deals-page .deal-chat-link .btn:hover,
.deals-page .deal-chat-link .btn:focus,
.deals-page .deal-chat-link .btn:visited {
    text-decoration: none !important;
    -webkit-text-decoration: none !important;
    text-decoration-line: none !important;
}


/* ===== STAGE UI P2P-1: premium readable P2P order page + filter overflow fix =====
   CSS-only. No P2P/Web3/backend/action logic changes. */

/* Filters: text must never escape select/input boxes. */
.p2p-filters {
    grid-template-columns: repeat(auto-fit, minmax(172px, 1fr)) !important;
    gap: 12px !important;
    align-items: stretch !important;
}

.p2p-filters select,
.p2p-filters input {
    min-width: 0 !important;
    max-width: 100% !important;
    height: 52px !important;
    padding: 0 42px 0 16px !important;
    border-radius: 18px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    font-weight: 800 !important;
    letter-spacing: -0.02em !important;
    line-height: 1.1 !important;
    background-color: rgba(15, 23, 42, 0.74) !important;
    border-color: rgba(148, 163, 184, 0.16) !important;
    color: rgba(248, 250, 252, 0.96) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.055), 0 12px 30px rgba(0, 0, 0, 0.10) !important;
}

.p2p-filters input {
    padding-right: 16px !important;
}

.p2p-filters select option {
    color: #0f172a;
    background: #ffffff;
}

/* P2P order workspace: premium but compact. */
.p2p-orders-workspace {
    gap: 18px !important;
}

.p2p-orders-rail {
    padding-right: 6px !important;
}

.p2p-order-summary {
    border-radius: 20px !important;
    padding: 14px 16px !important;
    min-height: 86px;
    background:
        linear-gradient(135deg, rgba(99, 102, 241, 0.10), rgba(15, 23, 42, 0.24) 58%, rgba(20, 184, 166, 0.06)),
        rgba(15, 23, 42, 0.54) !important;
    border-color: rgba(148, 163, 184, 0.18) !important;
    color: rgba(248, 250, 252, 0.98) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045), 0 12px 30px rgba(0, 0, 0, 0.11) !important;
}

.p2p-order-summary:hover,
.p2p-order-summary.active {
    background:
        linear-gradient(135deg, rgba(124, 58, 237, 0.22), rgba(15, 23, 42, 0.30) 58%, rgba(20, 184, 166, 0.10)),
        rgba(30, 41, 59, 0.62) !important;
    border-color: rgba(167, 139, 250, 0.34) !important;
    box-shadow: inset 4px 0 0 #10b981, 0 18px 42px rgba(79, 70, 229, 0.12) !important;
}

.p2p-order-summary-main b,
.p2p-order-summary-side strong {
    color: rgba(255, 255, 255, 0.99) !important;
    font-weight: 950 !important;
    letter-spacing: -0.025em !important;
}

.p2p-order-summary-main small,
.p2p-order-summary-side em {
    color: rgba(203, 213, 225, 0.92) !important;
    font-weight: 650 !important;
}

/* Main order card and text readability. */
.p2p-order-card {
    border-radius: 28px !important;
    padding: 20px !important;
    background:
        radial-gradient(circle at 16% 0%, rgba(124, 58, 237, 0.12), transparent 36%),
        radial-gradient(circle at 86% 8%, rgba(20, 184, 166, 0.08), transparent 32%),
        rgba(15, 23, 42, 0.62) !important;
    border-color: rgba(148, 163, 184, 0.18) !important;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.055) !important;
}

.p2p-order-title {
    color: rgba(255, 255, 255, 0.99) !important;
    font-size: clamp(1.22rem, 1.5vw, 1.55rem) !important;
    line-height: 1.15 !important;
    font-weight: 950 !important;
    letter-spacing: -0.04em !important;
}

.p2p-order-meta,
.p2p-order-route {
    color: rgba(203, 213, 225, 0.94) !important;
    font-weight: 650 !important;
    line-height: 1.45 !important;
}

.p2p-order-role {
    color: rgba(226, 232, 240, 0.94) !important;
    font-weight: 850 !important;
}

.p2p-order-status-pill,
.p2p-tx-pill {
    color: #ffffff !important;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.70), rgba(124, 58, 237, 0.55)) !important;
    border-color: rgba(221, 214, 254, 0.22) !important;
    font-weight: 850 !important;
}

/* The “Куда оплатить” box: keep it inside the visual mass and push it slightly lower on desktop. */
.p2p-order-detail-pane .p2p-payment-box {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.018)),
        rgba(15, 23, 42, 0.46) !important;
    border-color: rgba(148, 163, 184, 0.18) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.055), 0 14px 36px rgba(0, 0, 0, 0.10) !important;
}

@media (min-width: 981px) {
    .p2p-order-detail-pane .p2p-payment-box {
        margin-top: 18px !important;
    }
}

.p2p-payment-box b,
.p2p-mini-title {
    color: rgba(255, 255, 255, 0.98) !important;
    font-size: 0.98rem !important;
    font-weight: 950 !important;
    letter-spacing: -0.025em !important;
}

.p2p-payment-box pre {
    margin-top: 8px !important;
    padding: 4px 0 0 !important;
    color: rgba(248, 250, 252, 0.98) !important;
    font-size: 1.08rem !important;
    line-height: 1.45 !important;
    font-weight: 800 !important;
    word-break: break-word !important;
}

.p2p-payment-box span,
.p2p-receipt-empty,
.p2p-order-chat-empty,
.p2p-modal-hint {
    color: rgba(203, 213, 225, 0.92) !important;
}

/* Safety/payment protection card. */
.p2p-order-detail-pane .p2p-safety-box {
    background:
        linear-gradient(135deg, rgba(99, 102, 241, 0.13), rgba(20, 184, 166, 0.11)),
        rgba(15, 23, 42, 0.40) !important;
    border-color: rgba(99, 102, 241, 0.24) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 14px 36px rgba(79, 70, 229, 0.10) !important;
}

.p2p-safety-grid {
    gap: 10px 16px !important;
}

.p2p-safety-grid span {
    color: rgba(203, 213, 225, 0.92) !important;
    font-size: 0.82rem !important;
    font-weight: 700 !important;
}

.p2p-safety-grid b {
    color: rgba(248, 250, 252, 0.99) !important;
    font-size: 0.92rem !important;
    font-weight: 900 !important;
}

.p2p-safety-box small {
    color: rgba(203, 213, 225, 0.92) !important;
    font-size: 0.88rem !important;
    line-height: 1.5 !important;
}

/* Timeline / dispute / resolution readability. */
.p2p-order-detail-pane .p2p-order-timeline,
.p2p-order-detail-pane .p2p-dispute-box,
.p2p-order-detail-pane .p2p-resolution-box,
.p2p-order-detail-pane .p2p-receipts,
.p2p-order-detail-pane .p2p-feedback-box {
    border-radius: 22px !important;
    border-color: rgba(148, 163, 184, 0.18) !important;
    background: rgba(15, 23, 42, 0.44) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045) !important;
}

.p2p-order-detail-pane .p2p-order-timeline {
    padding: 18px !important;
}

.p2p-timeline-row {
    grid-template-columns: 38px minmax(0, 1fr) !important;
    gap: 12px !important;
    align-items: start !important;
    padding: 2px 0 !important;
}

.p2p-timeline-dot {
    width: 32px !important;
    height: 32px !important;
    color: #ede9fe !important;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.52), rgba(37, 99, 235, 0.28)) !important;
    border-color: rgba(196, 181, 253, 0.28) !important;
}

.p2p-timeline-body b {
    color: rgba(255, 255, 255, 0.98) !important;
    font-size: 1rem !important;
    font-weight: 900 !important;
    line-height: 1.25 !important;
}

.p2p-timeline-body small {
    color: rgba(203, 213, 225, 0.92) !important;
    font-size: 0.88rem !important;
    font-weight: 650 !important;
}

.p2p-dispute-box {
    background:
        linear-gradient(135deg, rgba(185, 28, 28, 0.16), rgba(15, 23, 42, 0.36)) !important;
    border-color: rgba(248, 113, 113, 0.28) !important;
}

.p2p-dispute-box p,
.p2p-dispute-box span,
.p2p-dispute-box small {
    color: rgba(254, 226, 226, 0.94) !important;
}

.p2p-resolution-box {
    background:
        linear-gradient(135deg, rgba(16, 185, 129, 0.16), rgba(15, 23, 42, 0.34)) !important;
    border-color: rgba(52, 211, 153, 0.28) !important;
}

.p2p-resolution-box p,
.p2p-resolution-box span {
    color: rgba(209, 250, 229, 0.94) !important;
}

/* Buttons inside P2P. */
.p2p-order-actions .btn,
.p2p-my-offer-actions .btn,
.p2p-order-side .btn {
    min-height: 44px !important;
    border-radius: 16px !important;
    font-weight: 900 !important;
    text-decoration: none !important;
}

/* Light theme: not washed out. */
body.theme-light .p2p-filters select,
body.theme-light .p2p-filters input,
body.light-theme .p2p-filters select,
body.light-theme .p2p-filters input,
[data-theme="light"] .p2p-filters select,
[data-theme="light"] .p2p-filters input {
    background: #ffffff !important;
    color: #0f172a !important;
    border-color: rgba(15, 23, 42, 0.12) !important;
    box-shadow: 0 12px 26px rgba(15, 23, 42, 0.06) !important;
}

body.theme-light .p2p-order-summary,
body.light-theme .p2p-order-summary,
[data-theme="light"] .p2p-order-summary {
    background: #ffffff !important;
    border-color: rgba(15, 23, 42, 0.10) !important;
    color: #0f172a !important;
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.07) !important;
}

body.theme-light .p2p-order-summary:hover,
body.theme-light .p2p-order-summary.active,
body.light-theme .p2p-order-summary:hover,
body.light-theme .p2p-order-summary.active,
[data-theme="light"] .p2p-order-summary:hover,
[data-theme="light"] .p2p-order-summary.active {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.10), #ffffff 62%, rgba(20, 184, 166, 0.06)) !important;
    border-color: rgba(139, 92, 246, 0.24) !important;
}

body.theme-light .p2p-order-summary-main b,
body.theme-light .p2p-order-summary-side strong,
body.light-theme .p2p-order-summary-main b,
body.light-theme .p2p-order-summary-side strong,
[data-theme="light"] .p2p-order-summary-main b,
[data-theme="light"] .p2p-order-summary-side strong {
    color: #0f172a !important;
}

body.theme-light .p2p-order-summary-main small,
body.theme-light .p2p-order-summary-side em,
body.light-theme .p2p-order-summary-main small,
body.light-theme .p2p-order-summary-side em,
[data-theme="light"] .p2p-order-summary-main small,
[data-theme="light"] .p2p-order-summary-side em {
    color: #475569 !important;
}

body.theme-light .p2p-order-card,
body.light-theme .p2p-order-card,
[data-theme="light"] .p2p-order-card {
    background: #ffffff !important;
    border-color: rgba(15, 23, 42, 0.10) !important;
    box-shadow: 0 22px 55px rgba(15, 23, 42, 0.08) !important;
}

body.theme-light .p2p-order-title,
body.theme-light .p2p-payment-box b,
body.theme-light .p2p-mini-title,
body.theme-light .p2p-safety-grid b,
body.theme-light .p2p-timeline-body b,
body.light-theme .p2p-order-title,
body.light-theme .p2p-payment-box b,
body.light-theme .p2p-mini-title,
body.light-theme .p2p-safety-grid b,
body.light-theme .p2p-timeline-body b,
[data-theme="light"] .p2p-order-title,
[data-theme="light"] .p2p-payment-box b,
[data-theme="light"] .p2p-mini-title,
[data-theme="light"] .p2p-safety-grid b,
[data-theme="light"] .p2p-timeline-body b {
    color: #0f172a !important;
}

body.theme-light .p2p-order-meta,
body.theme-light .p2p-order-route,
body.theme-light .p2p-payment-box span,
body.theme-light .p2p-safety-grid span,
body.theme-light .p2p-safety-box small,
body.theme-light .p2p-timeline-body small,
body.light-theme .p2p-order-meta,
body.light-theme .p2p-order-route,
body.light-theme .p2p-payment-box span,
body.light-theme .p2p-safety-grid span,
body.light-theme .p2p-safety-box small,
body.light-theme .p2p-timeline-body small,
[data-theme="light"] .p2p-order-meta,
[data-theme="light"] .p2p-order-route,
[data-theme="light"] .p2p-payment-box span,
[data-theme="light"] .p2p-safety-grid span,
[data-theme="light"] .p2p-safety-box small,
[data-theme="light"] .p2p-timeline-body small {
    color: #475569 !important;
}

body.theme-light .p2p-payment-box pre,
body.light-theme .p2p-payment-box pre,
[data-theme="light"] .p2p-payment-box pre {
    color: #0f172a !important;
}

body.theme-light .p2p-order-detail-pane .p2p-payment-box,
body.theme-light .p2p-order-detail-pane .p2p-safety-box,
body.theme-light .p2p-order-detail-pane .p2p-order-timeline,
body.theme-light .p2p-order-detail-pane .p2p-dispute-box,
body.theme-light .p2p-order-detail-pane .p2p-resolution-box,
body.light-theme .p2p-order-detail-pane .p2p-payment-box,
body.light-theme .p2p-order-detail-pane .p2p-safety-box,
body.light-theme .p2p-order-detail-pane .p2p-order-timeline,
body.light-theme .p2p-order-detail-pane .p2p-dispute-box,
body.light-theme .p2p-order-detail-pane .p2p-resolution-box,
[data-theme="light"] .p2p-order-detail-pane .p2p-payment-box,
[data-theme="light"] .p2p-order-detail-pane .p2p-safety-box,
[data-theme="light"] .p2p-order-detail-pane .p2p-order-timeline,
[data-theme="light"] .p2p-order-detail-pane .p2p-dispute-box,
[data-theme="light"] .p2p-order-detail-pane .p2p-resolution-box {
    background: #ffffff !important;
    border-color: rgba(15, 23, 42, 0.10) !important;
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.06) !important;
}

/* Responsive filters/layout. */
@media (max-width: 1100px) {
    .p2p-filters {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 760px) {
    .p2p-filters {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 8px !important;
    }

    .p2p-filters select,
    .p2p-filters input {
        height: 48px !important;
        padding-left: 12px !important;
        padding-right: 34px !important;
        font-size: 0.92rem !important;
    }

    .p2p-order-card {
        padding: 14px !important;
        border-radius: 22px !important;
    }

    .p2p-order-summary {
        min-height: 78px;
    }

    .p2p-order-detail-pane .p2p-payment-box {
        margin-top: 0 !important;
    }
}

@media (max-width: 430px) {
    .p2p-filters {
        grid-template-columns: 1fr !important;
    }
}


/* ===== STAGE UI P2P-2: desktop payment/safety layout alignment =====
   CSS-only. Aligns "Куда оплатить" and "Защита оплаты" into one premium row. */

@media (min-width: 981px) {
    .p2p-order-detail-pane .p2p-order-extra {
        grid-template-columns: minmax(240px, 0.72fr) minmax(430px, 1.28fr) !important;
        gap: 14px !important;
        align-items: start !important;
    }

    .p2p-order-detail-pane .p2p-order-extra > .p2p-order-stage-note {
        grid-column: 1 / -1 !important;
    }

    .p2p-order-detail-pane .p2p-order-extra > .p2p-payment-box:not(.p2p-order-stage-note) {
        grid-column: 1 !important;
        align-self: start !important;
        margin-top: 0 !important;
        min-height: 132px !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
    }

    .p2p-order-detail-pane .p2p-order-extra > .p2p-safety-box {
        grid-column: 2 !important;
        align-self: start !important;
        margin-top: 0 !important;
        min-height: 188px !important;
        padding: 18px 20px !important;
    }

    .p2p-order-detail-pane .p2p-order-extra > .p2p-order-timeline,
    .p2p-order-detail-pane .p2p-order-extra > .p2p-dispute-box,
    .p2p-order-detail-pane .p2p-order-extra > .p2p-resolution-box,
    .p2p-order-detail-pane .p2p-order-extra > .p2p-receipts,
    .p2p-order-detail-pane .p2p-order-extra > .p2p-feedback-box {
        grid-column: 1 / -1 !important;
    }

    .p2p-order-detail-pane .p2p-safety-grid {
        grid-template-columns: minmax(130px, 0.58fr) minmax(0, 1.42fr) !important;
        gap: 11px 18px !important;
    }

    .p2p-order-detail-pane .p2p-safety-box small {
        display: block !important;
        margin-top: 14px !important;
        max-width: 640px !important;
    }
}

/* On medium screens keep two cards balanced without overflow. */
@media (min-width: 761px) and (max-width: 980px) {
    .p2p-order-detail-pane .p2p-order-extra {
        grid-template-columns: 1fr !important;
    }

    .p2p-order-detail-pane .p2p-payment-box,
    .p2p-order-detail-pane .p2p-safety-box {
        grid-column: 1 / -1 !important;
        margin-top: 0 !important;
        min-height: 0 !important;
    }
}


/* ===== STAGE UI P2P-3: light theme readability + modern P2P cards =====
   CSS-only. Fixes overlapping order summaries and invisible "Мои объявления" text. */

/* P2P order rail: prevent text collisions between title/meta and the right amount/role block. */
.p2p-order-summary {
    grid-template-columns: minmax(0, 1fr) minmax(92px, auto) !important;
    align-items: start !important;
    gap: 12px !important;
    min-height: 88px !important;
    padding: 14px 14px !important;
}

.p2p-order-summary-main {
    min-width: 0 !important;
    align-self: start !important;
    gap: 6px !important;
}

.p2p-order-summary-main b {
    display: block !important;
    max-width: 100% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    line-height: 1.2 !important;
}

.p2p-order-summary-main small {
    display: block !important;
    max-width: 100% !important;
    overflow: visible !important;
    text-overflow: clip !important;
    white-space: normal !important;
    line-height: 1.25 !important;
    word-break: normal !important;
    overflow-wrap: anywhere !important;
}

.p2p-order-summary-side {
    max-width: 118px !important;
    min-width: 92px !important;
    justify-items: end !important;
    align-self: start !important;
    text-align: right !important;
    gap: 6px !important;
}

.p2p-order-summary-side strong {
    display: block !important;
    max-width: 118px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    line-height: 1.2 !important;
}

.p2p-order-summary-side em {
    display: block !important;
    max-width: 118px !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    line-height: 1.15 !important;
    font-size: 0.72rem !important;
    opacity: 0.88 !important;
}

/* Main detail top in light theme: hard contrast. */
body.theme-light .p2p-order-title,
body.theme-light .p2p-order-meta,
body.theme-light .p2p-order-route,
body.theme-light .p2p-order-role,
body.theme-light .p2p-my-offers-panel,
body.theme-light .p2p-my-offer-card,
body.theme-light .p2p-my-offer-title,
body.theme-light .p2p-my-offer-rate,
body.theme-light .p2p-my-offer-meta,
body.theme-light .p2p-my-offer-stats,
body.light-theme .p2p-order-title,
body.light-theme .p2p-order-meta,
body.light-theme .p2p-order-route,
body.light-theme .p2p-order-role,
body.light-theme .p2p-my-offers-panel,
body.light-theme .p2p-my-offer-card,
body.light-theme .p2p-my-offer-title,
body.light-theme .p2p-my-offer-rate,
body.light-theme .p2p-my-offer-meta,
body.light-theme .p2p-my-offer-stats,
[data-theme="light"] .p2p-order-title,
[data-theme="light"] .p2p-order-meta,
[data-theme="light"] .p2p-order-route,
[data-theme="light"] .p2p-order-role,
[data-theme="light"] .p2p-my-offers-panel,
[data-theme="light"] .p2p-my-offer-card,
[data-theme="light"] .p2p-my-offer-title,
[data-theme="light"] .p2p-my-offer-rate,
[data-theme="light"] .p2p-my-offer-meta,
[data-theme="light"] .p2p-my-offer-stats {
    text-shadow: none !important;
}

/* Light P2P order summary cards: compact, readable, not "2010". */
body.theme-light .p2p-order-summary,
body.light-theme .p2p-order-summary,
[data-theme="light"] .p2p-order-summary {
    background:
        linear-gradient(135deg, rgba(139, 92, 246, 0.055), rgba(255, 255, 255, 0.98) 62%, rgba(20, 184, 166, 0.04)) !important;
    border: 1px solid rgba(100, 116, 139, 0.14) !important;
    color: #0f172a !important;
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.065) !important;
}

body.theme-light .p2p-order-summary:hover,
body.theme-light .p2p-order-summary.active,
body.light-theme .p2p-order-summary:hover,
body.light-theme .p2p-order-summary.active,
[data-theme="light"] .p2p-order-summary:hover,
[data-theme="light"] .p2p-order-summary.active {
    background:
        linear-gradient(135deg, rgba(124, 58, 237, 0.11), rgba(255, 255, 255, 1) 62%, rgba(16, 185, 129, 0.07)) !important;
    border-color: rgba(124, 58, 237, 0.26) !important;
    box-shadow: inset 4px 0 0 #10b981, 0 18px 44px rgba(99, 102, 241, 0.12) !important;
}

body.theme-light .p2p-order-summary-main b,
body.theme-light .p2p-order-summary-side strong,
body.light-theme .p2p-order-summary-main b,
body.light-theme .p2p-order-summary-side strong,
[data-theme="light"] .p2p-order-summary-main b,
[data-theme="light"] .p2p-order-summary-side strong {
    color: #0f172a !important;
    font-weight: 950 !important;
}

body.theme-light .p2p-order-summary-main small,
body.theme-light .p2p-order-summary-side em,
body.light-theme .p2p-order-summary-main small,
body.light-theme .p2p-order-summary-side em,
[data-theme="light"] .p2p-order-summary-main small,
[data-theme="light"] .p2p-order-summary-side em {
    color: #334155 !important;
    font-weight: 750 !important;
}

/* Detail page light premium contrast. */
body.theme-light .p2p-order-card,
body.light-theme .p2p-order-card,
[data-theme="light"] .p2p-order-card {
    background:
        radial-gradient(circle at 16% 0%, rgba(124, 58, 237, 0.065), transparent 34%),
        radial-gradient(circle at 86% 8%, rgba(20, 184, 166, 0.05), transparent 32%),
        #ffffff !important;
    border: 1px solid rgba(100, 116, 139, 0.13) !important;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.08) !important;
}

body.theme-light .p2p-order-title,
body.light-theme .p2p-order-title,
[data-theme="light"] .p2p-order-title {
    color: #0f172a !important;
}

body.theme-light .p2p-order-meta,
body.theme-light .p2p-order-route,
body.light-theme .p2p-order-meta,
body.light-theme .p2p-order-route,
[data-theme="light"] .p2p-order-meta,
[data-theme="light"] .p2p-order-route {
    color: #334155 !important;
    font-weight: 780 !important;
}

body.theme-light .p2p-order-role,
body.light-theme .p2p-order-role,
[data-theme="light"] .p2p-order-role {
    color: #475569 !important;
}

body.theme-light .p2p-order-status-pill,
body.light-theme .p2p-order-status-pill,
[data-theme="light"] .p2p-order-status-pill {
    background: linear-gradient(135deg, #7c3aed, #6366f1) !important;
    color: #ffffff !important;
    border-color: rgba(79, 70, 229, 0.22) !important;
}

/* "Мои объявления": light theme real product cards, visible titles/rates/meta. */
body.theme-light .p2p-my-offers-panel,
body.light-theme .p2p-my-offers-panel,
[data-theme="light"] .p2p-my-offers-panel {
    background:
        radial-gradient(circle at 18% 0%, rgba(124, 58, 237, 0.07), transparent 36%),
        radial-gradient(circle at 92% 10%, rgba(20, 184, 166, 0.055), transparent 34%),
        rgba(248, 250, 252, 0.96) !important;
    border-color: rgba(100, 116, 139, 0.14) !important;
}

body.theme-light .p2p-my-offer-card,
body.light-theme .p2p-my-offer-card,
[data-theme="light"] .p2p-my-offer-card {
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: start !important;
    min-height: 132px !important;
    padding: 20px 22px !important;
    border-radius: 24px !important;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.98)) !important;
    border: 1px solid rgba(100, 116, 139, 0.14) !important;
    box-shadow: 0 16px 42px rgba(15, 23, 42, 0.065) !important;
}

body.theme-light .p2p-my-offer-card:hover,
body.light-theme .p2p-my-offer-card:hover,
[data-theme="light"] .p2p-my-offer-card:hover {
    transform: translateY(-1px);
    border-color: rgba(124, 58, 237, 0.22) !important;
    box-shadow: 0 20px 52px rgba(99, 102, 241, 0.10) !important;
}

body.theme-light .p2p-my-offer-title,
body.light-theme .p2p-my-offer-title,
[data-theme="light"] .p2p-my-offer-title {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    margin-bottom: 10px !important;
}

body.theme-light .p2p-my-offer-title b,
body.light-theme .p2p-my-offer-title b,
[data-theme="light"] .p2p-my-offer-title b {
    color: #0f172a !important;
    font-weight: 950 !important;
    font-size: 1.05rem !important;
    letter-spacing: -0.025em !important;
}

body.theme-light .p2p-my-offer-title span,
body.light-theme .p2p-my-offer-title span,
[data-theme="light"] .p2p-my-offer-title span {
    color: #334155 !important;
    background: rgba(100, 116, 139, 0.10) !important;
    border: 1px solid rgba(100, 116, 139, 0.12) !important;
    font-weight: 900 !important;
}

body.theme-light .p2p-offer-status-active .p2p-my-offer-title span,
body.light-theme .p2p-offer-status-active .p2p-my-offer-title span,
[data-theme="light"] .p2p-offer-status-active .p2p-my-offer-title span {
    color: #047857 !important;
    background: rgba(16, 185, 129, 0.12) !important;
    border-color: rgba(16, 185, 129, 0.18) !important;
}

body.theme-light .p2p-offer-status-paused .p2p-my-offer-title span,
body.light-theme .p2p-offer-status-paused .p2p-my-offer-title span,
[data-theme="light"] .p2p-offer-status-paused .p2p-my-offer-title span {
    color: #92400e !important;
    background: rgba(245, 158, 11, 0.14) !important;
    border-color: rgba(245, 158, 11, 0.18) !important;
}

body.theme-light .p2p-offer-status-closed .p2p-my-offer-title span,
body.light-theme .p2p-offer-status-closed .p2p-my-offer-title span,
[data-theme="light"] .p2p-offer-status-closed .p2p-my-offer-title span {
    color: #334155 !important;
    background: rgba(100, 116, 139, 0.12) !important;
    border-color: rgba(100, 116, 139, 0.16) !important;
}

body.theme-light .p2p-my-offer-rate,
body.light-theme .p2p-my-offer-rate,
[data-theme="light"] .p2p-my-offer-rate {
    color: #334155 !important;
    font-weight: 900 !important;
    font-size: 1.02rem !important;
    margin-bottom: 14px !important;
}

body.theme-light .p2p-my-offer-meta,
body.light-theme .p2p-my-offer-meta,
[data-theme="light"] .p2p-my-offer-meta {
    color: #334155 !important;
    font-weight: 750 !important;
    margin-bottom: 10px !important;
}

body.theme-light .p2p-my-offer-stats,
body.light-theme .p2p-my-offer-stats,
[data-theme="light"] .p2p-my-offer-stats {
    color: #334155 !important;
    gap: 8px !important;
}

body.theme-light .p2p-my-offer-stats span,
body.light-theme .p2p-my-offer-stats span,
[data-theme="light"] .p2p-my-offer-stats span {
    color: #334155 !important;
    background: rgba(241, 245, 249, 0.95) !important;
    border: 1px solid rgba(100, 116, 139, 0.10) !important;
    font-weight: 760 !important;
}

body.theme-light .p2p-my-offer-stats b,
body.light-theme .p2p-my-offer-stats b,
[data-theme="light"] .p2p-my-offer-stats b {
    color: #0f172a !important;
    font-weight: 950 !important;
}

/* Make actions on my offers not float like old empty right column. */
body.theme-light .p2p-my-offer-actions,
body.light-theme .p2p-my-offer-actions,
[data-theme="light"] .p2p-my-offer-actions {
    align-self: start !important;
    justify-content: flex-end !important;
    min-width: 0 !important;
}

/* My offers panel bottom buttons/pagination keep modern spacing. */
body.theme-light .p2p-my-offers-panel .btn,
body.light-theme .p2p-my-offers-panel .btn,
[data-theme="light"] .p2p-my-offers-panel .btn {
    text-decoration: none !important;
}

/* Mobile/tablet: no collisions. */
@media (max-width: 900px) {
    .p2p-order-summary {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    .p2p-order-summary-side {
        width: 100% !important;
        max-width: none !important;
        min-width: 0 !important;
        grid-template-columns: auto auto !important;
        justify-content: space-between !important;
        justify-items: start !important;
        text-align: left !important;
    }

    .p2p-order-summary-side strong,
    .p2p-order-summary-side em {
        max-width: 100% !important;
    }

    body.theme-light .p2p-my-offer-card,
    body.light-theme .p2p-my-offer-card,
    [data-theme="light"] .p2p-my-offer-card {
        grid-template-columns: 1fr !important;
        min-height: 0 !important;
        padding: 18px !important;
    }
}


/* ===== STAGE UI P2P-4: light action buttons + dispute/resolution contrast + payment/safety alignment =====
   CSS-only. No P2P/Web3/backend/action logic changes. */

/* Right-side action panel should not look like a white empty area on light theme. */
body.theme-light .p2p-order-side,
body.light-theme .p2p-order-side,
[data-theme="light"] .p2p-order-side {
    padding: 14px !important;
    border-radius: 24px !important;
    background:
        linear-gradient(135deg, rgba(99, 102, 241, 0.075), rgba(255, 255, 255, 0.96) 56%, rgba(20, 184, 166, 0.045)) !important;
    border: 1px solid rgba(100, 116, 139, 0.13) !important;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.055), inset 0 1px 0 rgba(255, 255, 255, 0.90) !important;
}

body.theme-light .p2p-order-side .p2p-order-actions,
body.light-theme .p2p-order-side .p2p-order-actions,
[data-theme="light"] .p2p-order-side .p2p-order-actions {
    width: 100% !important;
    display: grid !important;
    gap: 10px !important;
    margin-top: 12px !important;
}

body.theme-light .p2p-order-side .btn,
body.theme-light .p2p-order-actions .btn,
body.light-theme .p2p-order-side .btn,
body.light-theme .p2p-order-actions .btn,
[data-theme="light"] .p2p-order-side .btn,
[data-theme="light"] .p2p-order-actions .btn {
    width: 100% !important;
    min-height: 48px !important;
    border-radius: 18px !important;
    justify-content: center !important;
    text-align: center !important;
    font-weight: 950 !important;
    text-decoration: none !important;
    text-shadow: none !important;
}

body.theme-light .p2p-order-side .btn.primary,
body.theme-light .p2p-order-actions .btn.primary,
body.light-theme .p2p-order-side .btn.primary,
body.light-theme .p2p-order-actions .btn.primary,
[data-theme="light"] .p2p-order-side .btn.primary,
[data-theme="light"] .p2p-order-actions .btn.primary {
    background: linear-gradient(135deg, #4f46e5, #7c3aed) !important;
    border-color: rgba(79, 70, 229, 0.35) !important;
    color: #ffffff !important;
    box-shadow: 0 14px 30px rgba(79, 70, 229, 0.18) !important;
}

body.theme-light .p2p-order-side .btn.secondary,
body.theme-light .p2p-order-actions .btn.secondary,
body.theme-light .p2p-order-side .btn:not(.primary):not(.success):not(.danger):not(.error),
body.theme-light .p2p-order-actions .btn:not(.primary):not(.success):not(.danger):not(.error),
body.light-theme .p2p-order-side .btn.secondary,
body.light-theme .p2p-order-actions .btn.secondary,
body.light-theme .p2p-order-side .btn:not(.primary):not(.success):not(.danger):not(.error),
body.light-theme .p2p-order-actions .btn:not(.primary):not(.success):not(.danger):not(.error),
[data-theme="light"] .p2p-order-side .btn.secondary,
[data-theme="light"] .p2p-order-actions .btn.secondary,
[data-theme="light"] .p2p-order-side .btn:not(.primary):not(.success):not(.danger):not(.error),
[data-theme="light"] .p2p-order-actions .btn:not(.primary):not(.success):not(.danger):not(.error) {
    background: #ffffff !important;
    border: 1px solid rgba(79, 70, 229, 0.18) !important;
    color: #0f172a !important;
    box-shadow: 0 12px 26px rgba(15, 23, 42, 0.06) !important;
}

body.theme-light .p2p-order-side .btn.secondary:hover,
body.theme-light .p2p-order-actions .btn.secondary:hover,
body.light-theme .p2p-order-side .btn.secondary:hover,
body.light-theme .p2p-order-actions .btn.secondary:hover,
[data-theme="light"] .p2p-order-side .btn.secondary:hover,
[data-theme="light"] .p2p-order-actions .btn.secondary:hover {
    background: #f8fafc !important;
    border-color: rgba(79, 70, 229, 0.32) !important;
    color: #312e81 !important;
}

body.theme-light .p2p-order-side .btn.danger,
body.theme-light .p2p-order-actions .btn.danger,
body.light-theme .p2p-order-side .btn.danger,
body.light-theme .p2p-order-actions .btn.danger,
[data-theme="light"] .p2p-order-side .btn.danger,
[data-theme="light"] .p2p-order-actions .btn.danger {
    background: linear-gradient(135deg, #dc2626, #ef4444) !important;
    border-color: rgba(185, 28, 28, 0.38) !important;
    color: #ffffff !important;
    box-shadow: 0 14px 30px rgba(220, 38, 38, 0.18) !important;
}

body.theme-light .p2p-order-side .btn.success,
body.theme-light .p2p-order-actions .btn.success,
body.light-theme .p2p-order-side .btn.success,
body.light-theme .p2p-order-actions .btn.success,
[data-theme="light"] .p2p-order-side .btn.success,
[data-theme="light"] .p2p-order-actions .btn.success {
    background: linear-gradient(135deg, #059669, #10b981) !important;
    border-color: rgba(5, 150, 105, 0.35) !important;
    color: #ffffff !important;
    box-shadow: 0 14px 30px rgba(16, 185, 129, 0.18) !important;
}

/* Desktop: both columns must shrink inside the 620px order screen. */
@media (min-width: 981px) {
    .p2p-order-detail-pane .p2p-order-extra {
        grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr) !important;
        gap: 14px !important;
        align-items: stretch !important;
    }

    .p2p-order-detail-pane .p2p-order-extra > .p2p-payment-box:not(.p2p-order-stage-note),
    .p2p-order-detail-pane .p2p-order-extra > .p2p-safety-box {
        min-height: 172px !important;
        height: 100% !important;
        align-self: stretch !important;
        margin-top: 0 !important;
        border-radius: 22px !important;
    }

    .p2p-order-detail-pane .p2p-order-extra > .p2p-payment-box:not(.p2p-order-stage-note) {
        padding: 20px !important;
        justify-content: flex-start !important;
    }

    .p2p-order-detail-pane .p2p-order-extra > .p2p-safety-box {
        padding: 20px 22px !important;
    }

    .p2p-order-detail-pane .p2p-safety-grid {
        grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr) !important;
    }
}

/* Light payment/safety cards: visible and balanced. */
body.theme-light .p2p-order-detail-pane .p2p-payment-box,
body.light-theme .p2p-order-detail-pane .p2p-payment-box,
[data-theme="light"] .p2p-order-detail-pane .p2p-payment-box {
    background:
        linear-gradient(135deg, rgba(79, 70, 229, 0.045), rgba(255, 255, 255, 0.98)) !important;
    border: 1px solid rgba(100, 116, 139, 0.14) !important;
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.06) !important;
}

body.theme-light .p2p-order-detail-pane .p2p-safety-box,
body.light-theme .p2p-order-detail-pane .p2p-safety-box,
[data-theme="light"] .p2p-order-detail-pane .p2p-safety-box {
    background:
        linear-gradient(135deg, rgba(99, 102, 241, 0.070), rgba(255, 255, 255, 0.98) 58%, rgba(20, 184, 166, 0.055)) !important;
    border: 1px solid rgba(99, 102, 241, 0.16) !important;
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.06) !important;
}

body.theme-light .p2p-order-detail-pane .p2p-payment-box b,
body.theme-light .p2p-order-detail-pane .p2p-payment-box pre,
body.theme-light .p2p-order-detail-pane .p2p-safety-box .p2p-mini-title,
body.theme-light .p2p-order-detail-pane .p2p-safety-grid b,
body.light-theme .p2p-order-detail-pane .p2p-payment-box b,
body.light-theme .p2p-order-detail-pane .p2p-payment-box pre,
body.light-theme .p2p-order-detail-pane .p2p-safety-box .p2p-mini-title,
body.light-theme .p2p-order-detail-pane .p2p-safety-grid b,
[data-theme="light"] .p2p-order-detail-pane .p2p-payment-box b,
[data-theme="light"] .p2p-order-detail-pane .p2p-payment-box pre,
[data-theme="light"] .p2p-order-detail-pane .p2p-safety-box .p2p-mini-title,
[data-theme="light"] .p2p-order-detail-pane .p2p-safety-grid b {
    color: #0f172a !important;
}

body.theme-light .p2p-order-detail-pane .p2p-safety-grid span,
body.theme-light .p2p-order-detail-pane .p2p-safety-box small,
body.light-theme .p2p-order-detail-pane .p2p-safety-grid span,
body.light-theme .p2p-order-detail-pane .p2p-safety-box small,
[data-theme="light"] .p2p-order-detail-pane .p2p-safety-grid span,
[data-theme="light"] .p2p-order-detail-pane .p2p-safety-box small {
    color: #475569 !important;
}

/* Light dispute/resolution cards: never pale/white-on-white. */
body.theme-light .p2p-order-detail-pane .p2p-dispute-box,
body.light-theme .p2p-order-detail-pane .p2p-dispute-box,
[data-theme="light"] .p2p-order-detail-pane .p2p-dispute-box {
    background:
        linear-gradient(135deg, rgba(254, 226, 226, 0.92), rgba(255, 255, 255, 0.98)) !important;
    border: 1px solid rgba(220, 38, 38, 0.22) !important;
    box-shadow: 0 16px 36px rgba(220, 38, 38, 0.065) !important;
}

body.theme-light .p2p-order-detail-pane .p2p-dispute-box .p2p-mini-title,
body.theme-light .p2p-order-detail-pane .p2p-dispute-box b,
body.light-theme .p2p-order-detail-pane .p2p-dispute-box .p2p-mini-title,
body.light-theme .p2p-order-detail-pane .p2p-dispute-box b,
[data-theme="light"] .p2p-order-detail-pane .p2p-dispute-box .p2p-mini-title,
[data-theme="light"] .p2p-order-detail-pane .p2p-dispute-box b {
    color: #7f1d1d !important;
}

body.theme-light .p2p-order-detail-pane .p2p-dispute-box p,
body.theme-light .p2p-order-detail-pane .p2p-dispute-box span,
body.theme-light .p2p-order-detail-pane .p2p-dispute-box small,
body.light-theme .p2p-order-detail-pane .p2p-dispute-box p,
body.light-theme .p2p-order-detail-pane .p2p-dispute-box span,
body.light-theme .p2p-order-detail-pane .p2p-dispute-box small,
[data-theme="light"] .p2p-order-detail-pane .p2p-dispute-box p,
[data-theme="light"] .p2p-order-detail-pane .p2p-dispute-box span,
[data-theme="light"] .p2p-order-detail-pane .p2p-dispute-box small {
    color: #991b1b !important;
}

body.theme-light .p2p-order-detail-pane .p2p-dispute-box .p2p-tx-pill,
body.light-theme .p2p-order-detail-pane .p2p-dispute-box .p2p-tx-pill,
[data-theme="light"] .p2p-order-detail-pane .p2p-dispute-box .p2p-tx-pill {
    background: rgba(220, 38, 38, 0.12) !important;
    border-color: rgba(220, 38, 38, 0.20) !important;
    color: #7f1d1d !important;
}

body.theme-light .p2p-order-detail-pane .p2p-resolution-box,
body.light-theme .p2p-order-detail-pane .p2p-resolution-box,
[data-theme="light"] .p2p-order-detail-pane .p2p-resolution-box {
    background:
        linear-gradient(135deg, rgba(220, 252, 231, 0.92), rgba(255, 255, 255, 0.98)) !important;
    border: 1px solid rgba(16, 185, 129, 0.22) !important;
    box-shadow: 0 16px 36px rgba(16, 185, 129, 0.065) !important;
}

body.theme-light .p2p-order-detail-pane .p2p-resolution-box .p2p-mini-title,
body.theme-light .p2p-order-detail-pane .p2p-resolution-box b,
body.light-theme .p2p-order-detail-pane .p2p-resolution-box .p2p-mini-title,
body.light-theme .p2p-order-detail-pane .p2p-resolution-box b,
[data-theme="light"] .p2p-order-detail-pane .p2p-resolution-box .p2p-mini-title,
[data-theme="light"] .p2p-order-detail-pane .p2p-resolution-box b {
    color: #065f46 !important;
}

body.theme-light .p2p-order-detail-pane .p2p-resolution-box p,
body.theme-light .p2p-order-detail-pane .p2p-resolution-box span,
body.light-theme .p2p-order-detail-pane .p2p-resolution-box p,
body.light-theme .p2p-order-detail-pane .p2p-resolution-box span,
[data-theme="light"] .p2p-order-detail-pane .p2p-resolution-box p,
[data-theme="light"] .p2p-order-detail-pane .p2p-resolution-box span {
    color: #047857 !important;
}


/* ===== STAGE UI P2P-5: colored P2P side action buttons =====
   CSS-only. Makes chat/arbitrator/rating actions look like real product buttons. */

/* Base for P2P side action buttons */
.p2p-order-actions button[data-p2p-order-action="open_chat"],
.p2p-order-actions button[data-p2p-order-action="contact_arbiter"],
.p2p-order-actions button[data-p2p-order-action="feedback"] {
    width: 100% !important;
    min-height: 50px !important;
    border-radius: 18px !important;
    border: 1px solid transparent !important;
    color: #ffffff !important;
    font-weight: 950 !important;
    text-decoration: none !important;
    text-shadow: 0 1px 0 rgba(15, 23, 42, 0.18) !important;
    box-shadow: 0 16px 34px rgba(15, 23, 42, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.20) !important;
}

/* Чат с участником — calm blue/purple */
.p2p-order-actions button[data-p2p-order-action="open_chat"] {
    background: linear-gradient(135deg, #2563eb, #7c3aed) !important;
    border-color: rgba(147, 197, 253, 0.28) !important;
}

/* Связаться с арбитром — stronger violet/red attention */
.p2p-order-actions button[data-p2p-order-action="contact_arbiter"] {
    background: linear-gradient(135deg, #7c3aed, #dc2626) !important;
    border-color: rgba(248, 113, 113, 0.30) !important;
}

/* Оценить участника — premium amber */
.p2p-order-actions button[data-p2p-order-action="feedback"] {
    background: linear-gradient(135deg, #d97706, #f59e0b) !important;
    border-color: rgba(251, 191, 36, 0.36) !important;
    color: #ffffff !important;
}

/* Hover/focus */
.p2p-order-actions button[data-p2p-order-action="open_chat"]:hover,
.p2p-order-actions button[data-p2p-order-action="contact_arbiter"]:hover,
.p2p-order-actions button[data-p2p-order-action="feedback"]:hover {
    transform: translateY(-1px) !important;
    filter: brightness(1.03) saturate(1.04) !important;
    color: #ffffff !important;
    text-decoration: none !important;
}

.p2p-order-actions button[data-p2p-order-action="open_chat"]:focus-visible,
.p2p-order-actions button[data-p2p-order-action="contact_arbiter"]:focus-visible,
.p2p-order-actions button[data-p2p-order-action="feedback"]:focus-visible {
    outline: 3px solid rgba(124, 58, 237, 0.24) !important;
    outline-offset: 3px !important;
}

/* Light theme: override previous white secondary buttons */
body.theme-light .p2p-order-actions button[data-p2p-order-action="open_chat"],
body.light-theme .p2p-order-actions button[data-p2p-order-action="open_chat"],
[data-theme="light"] .p2p-order-actions button[data-p2p-order-action="open_chat"] {
    background: linear-gradient(135deg, #2563eb, #7c3aed) !important;
    border-color: rgba(37, 99, 235, 0.28) !important;
    color: #ffffff !important;
    box-shadow: 0 16px 34px rgba(37, 99, 235, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.22) !important;
}

body.theme-light .p2p-order-actions button[data-p2p-order-action="contact_arbiter"],
body.light-theme .p2p-order-actions button[data-p2p-order-action="contact_arbiter"],
[data-theme="light"] .p2p-order-actions button[data-p2p-order-action="contact_arbiter"] {
    background: linear-gradient(135deg, #7c3aed, #dc2626) !important;
    border-color: rgba(220, 38, 38, 0.28) !important;
    color: #ffffff !important;
    box-shadow: 0 16px 34px rgba(220, 38, 38, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.22) !important;
}

body.theme-light .p2p-order-actions button[data-p2p-order-action="feedback"],
body.light-theme .p2p-order-actions button[data-p2p-order-action="feedback"],
[data-theme="light"] .p2p-order-actions button[data-p2p-order-action="feedback"] {
    background: linear-gradient(135deg, #d97706, #f59e0b) !important;
    border-color: rgba(217, 119, 6, 0.30) !important;
    color: #ffffff !important;
    box-shadow: 0 16px 34px rgba(245, 158, 11, 0.17), inset 0 1px 0 rgba(255, 255, 255, 0.24) !important;
}

/* Disabled state if any of these become disabled later */
.p2p-order-actions button[data-p2p-order-action="open_chat"]:disabled,
.p2p-order-actions button[data-p2p-order-action="contact_arbiter"]:disabled,
.p2p-order-actions button[data-p2p-order-action="feedback"]:disabled {
    opacity: 0.72 !important;
    filter: saturate(0.75) !important;
    cursor: not-allowed !important;
}


/* ===== STAGE UI P2P-6: force colored side buttons with explicit classes =====
   Fixes light theme overrides that kept Chat/Arbiter/Rating buttons white. */

html body .p2p-order-side .p2p-order-actions .btn.p2p-action-chat,
html body .p2p-order-side .p2p-order-actions button.p2p-action-chat,
html body .p2p-order-actions .btn.p2p-action-chat {
    background: linear-gradient(135deg, #2563eb, #7c3aed) !important;
    border: 1px solid rgba(37, 99, 235, 0.32) !important;
    color: #ffffff !important;
    box-shadow: 0 16px 34px rgba(37, 99, 235, 0.20), inset 0 1px 0 rgba(255, 255, 255, 0.22) !important;
    text-decoration: none !important;
    text-shadow: 0 1px 0 rgba(15, 23, 42, 0.18) !important;
}

html body .p2p-order-side .p2p-order-actions .btn.p2p-action-arbiter,
html body .p2p-order-side .p2p-order-actions button.p2p-action-arbiter,
html body .p2p-order-actions .btn.p2p-action-arbiter {
    background: linear-gradient(135deg, #7c3aed, #dc2626) !important;
    border: 1px solid rgba(220, 38, 38, 0.34) !important;
    color: #ffffff !important;
    box-shadow: 0 16px 34px rgba(220, 38, 38, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.22) !important;
    text-decoration: none !important;
    text-shadow: 0 1px 0 rgba(15, 23, 42, 0.18) !important;
}

html body .p2p-order-side .p2p-order-actions .btn.p2p-action-feedback,
html body .p2p-order-side .p2p-order-actions button.p2p-action-feedback,
html body .p2p-order-actions .btn.p2p-action-feedback {
    background: linear-gradient(135deg, #d97706, #f59e0b) !important;
    border: 1px solid rgba(217, 119, 6, 0.34) !important;
    color: #ffffff !important;
    box-shadow: 0 16px 34px rgba(245, 158, 11, 0.19), inset 0 1px 0 rgba(255, 255, 255, 0.24) !important;
    text-decoration: none !important;
    text-shadow: 0 1px 0 rgba(15, 23, 42, 0.16) !important;
}

/* Hard light-theme override, after every previous secondary/white rule. */
html.theme-light body .p2p-order-actions .btn.p2p-action-chat,
html[data-theme="light"] body .p2p-order-actions .btn.p2p-action-chat,
body.theme-light .p2p-order-actions .btn.p2p-action-chat,
body.light-theme .p2p-order-actions .btn.p2p-action-chat,
body.light .p2p-order-actions .btn.p2p-action-chat,
[data-theme="light"] .p2p-order-actions .btn.p2p-action-chat {
    background: linear-gradient(135deg, #2563eb, #7c3aed) !important;
    color: #ffffff !important;
    border-color: rgba(37, 99, 235, 0.32) !important;
}

html.theme-light body .p2p-order-actions .btn.p2p-action-arbiter,
html[data-theme="light"] body .p2p-order-actions .btn.p2p-action-arbiter,
body.theme-light .p2p-order-actions .btn.p2p-action-arbiter,
body.light-theme .p2p-order-actions .btn.p2p-action-arbiter,
body.light .p2p-order-actions .btn.p2p-action-arbiter,
[data-theme="light"] .p2p-order-actions .btn.p2p-action-arbiter {
    background: linear-gradient(135deg, #7c3aed, #dc2626) !important;
    color: #ffffff !important;
    border-color: rgba(220, 38, 38, 0.34) !important;
}

html.theme-light body .p2p-order-actions .btn.p2p-action-feedback,
html[data-theme="light"] body .p2p-order-actions .btn.p2p-action-feedback,
body.theme-light .p2p-order-actions .btn.p2p-action-feedback,
body.light-theme .p2p-order-actions .btn.p2p-action-feedback,
body.light .p2p-order-actions .btn.p2p-action-feedback,
[data-theme="light"] .p2p-order-actions .btn.p2p-action-feedback {
    background: linear-gradient(135deg, #d97706, #f59e0b) !important;
    color: #ffffff !important;
    border-color: rgba(217, 119, 6, 0.34) !important;
}

html body .p2p-order-actions .btn.p2p-action-chat:hover,
html body .p2p-order-actions .btn.p2p-action-arbiter:hover,
html body .p2p-order-actions .btn.p2p-action-feedback:hover {
    transform: translateY(-1px) !important;
    filter: brightness(1.04) saturate(1.05) !important;
    color: #ffffff !important;
}


/* ===== STAGE UI P2P-7: order rail height/scroll fix =====
   Desktop: no clipped inner rail; the list grows with the page.
   Mobile: keeps an inner scroll so the page is not stretched. */

/* Desktop / wide layouts: do not cut the order list with an internal scrollbar. */
@media (min-width: 981px) {
    .p2p-orders-workspace {
        align-items: start !important;
    }

    .p2p-orders-rail {
        max-height: none !important;
        height: auto !important;
        overflow: visible !important;
        padding-right: 0 !important;
        scrollbar-width: auto !important;
    }

    .p2p-order-summary {
        min-height: 96px !important;
    }
}

/* Tablet/mobile: keep the list contained, but use more useful viewport height. */
@media (max-width: 980px) {
    .p2p-orders-workspace {
        grid-template-columns: 1fr !important;
        align-items: start !important;
    }

    .p2p-orders-rail {
        display: grid !important;
        gap: 10px !important;
        max-height: min(54vh, 460px) !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        padding: 0 6px 8px 0 !important;
        scroll-snap-type: none !important;
        -webkit-overflow-scrolling: touch !important;
        overscroll-behavior: contain !important;
    }

    .p2p-order-summary {
        flex: none !important;
        width: 100% !important;
    }
}

@media (max-width: 560px) {
    .p2p-orders-rail {
        max-height: min(48vh, 380px) !important;
        padding-right: 4px !important;
    }
}


/* ===== STAGE UI P2P-8: active orders + archive split =====
   Frontend-only grouping: active P2P orders are shown first, terminal orders move to archive. */

.p2p-order-archive-block {
    display: grid;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(148, 163, 184, 0.16);
}

.p2p-order-archive-toggle {
    width: 100%;
    min-height: 44px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(15, 23, 42, 0.34);
    color: rgba(248, 250, 252, 0.96);
    cursor: pointer;
    text-align: left;
    font-weight: 900;
}

.p2p-order-archive-toggle span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.p2p-order-archive-toggle b {
    min-width: 30px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: rgba(124, 58, 237, 0.20);
    color: rgba(248, 250, 252, 0.98);
}

.p2p-order-archive-toggle em {
    font-style: normal;
    color: rgba(203, 213, 225, 0.90);
}

.p2p-order-archive-list {
    display: grid;
    gap: 9px;
}

.p2p-order-summary.is-archive {
    opacity: 0.88;
    background:
        linear-gradient(135deg, rgba(100, 116, 139, 0.12), rgba(15, 23, 42, 0.20)) !important;
    border-color: rgba(148, 163, 184, 0.14) !important;
}

.p2p-order-summary.is-archive.active {
    opacity: 1;
    box-shadow: inset 4px 0 0 #64748b, 0 14px 30px rgba(15, 23, 42, 0.13) !important;
}

.p2p-order-card.is-archive-order .p2p-order-status-pill {
    background: linear-gradient(135deg, #64748b, #475569) !important;
}

/* Light theme archive. */
body.theme-light .p2p-order-archive-block,
body.light-theme .p2p-order-archive-block,
[data-theme="light"] .p2p-order-archive-block {
    border-top-color: rgba(100, 116, 139, 0.14);
}

body.theme-light .p2p-order-archive-toggle,
body.light-theme .p2p-order-archive-toggle,
[data-theme="light"] .p2p-order-archive-toggle {
    background: rgba(255, 255, 255, 0.92) !important;
    border-color: rgba(100, 116, 139, 0.14) !important;
    color: #0f172a !important;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.045);
}

body.theme-light .p2p-order-archive-toggle b,
body.light-theme .p2p-order-archive-toggle b,
[data-theme="light"] .p2p-order-archive-toggle b {
    background: rgba(100, 116, 139, 0.10);
    color: #334155;
}

body.theme-light .p2p-order-archive-toggle em,
body.light-theme .p2p-order-archive-toggle em,
[data-theme="light"] .p2p-order-archive-toggle em {
    color: #64748b;
}

body.theme-light .p2p-order-summary.is-archive,
body.light-theme .p2p-order-summary.is-archive,
[data-theme="light"] .p2p-order-summary.is-archive {
    background:
        linear-gradient(135deg, rgba(100, 116, 139, 0.055), rgba(255, 255, 255, 0.98)) !important;
    border-color: rgba(100, 116, 139, 0.12) !important;
}

body.theme-light .p2p-order-summary.is-archive.active,
body.light-theme .p2p-order-summary.is-archive.active,
[data-theme="light"] .p2p-order-summary.is-archive.active {
    box-shadow: inset 4px 0 0 #64748b, 0 14px 30px rgba(15, 23, 42, 0.07) !important;
}

/* Mobile: archive stays inside the contained rail scroll. */
@media (max-width: 980px) {
    .p2p-order-archive-block {
        margin-top: 8px;
        padding-top: 8px;
    }

    .p2p-order-archive-toggle {
        min-height: 42px;
    }
}


/* ===== STAGE UI P2P-10: archive collapse hard fix + premium purple triangle =====
   Hard-collapses archive list even if earlier CSS tries to display it as grid. */

.p2p-order-archive-list[hidden],
.p2p-order-archive-block.is-collapsed .p2p-order-archive-list {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    max-height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
}

.p2p-order-archive-block.is-open .p2p-order-archive-list {
    display: grid !important;
    visibility: visible !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
}

.p2p-order-archive-toggle {
    position: relative !important;
    overflow: hidden !important;
}

.p2p-order-archive-toggle em {
    width: 30px !important;
    height: 30px !important;
    min-width: 30px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 12px !important;
    font-size: 0 !important;
    line-height: 1 !important;
    background:
        radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.20), transparent 38%),
        linear-gradient(135deg, #312e81, #7c3aed) !important;
    border: 1px solid rgba(196, 181, 253, 0.30) !important;
    box-shadow: 0 10px 24px rgba(79, 70, 229, 0.20), inset 0 1px 0 rgba(255, 255, 255, 0.16) !important;
    color: #ffffff !important;
    transform: rotate(0deg);
    transition: transform 160ms ease, filter 160ms ease;
}

.p2p-order-archive-toggle em::before {
    content: '' !important;
    width: 0 !important;
    height: 0 !important;
    border-left: 5px solid transparent !important;
    border-right: 5px solid transparent !important;
    border-top: 7px solid #ffffff !important;
    display: block !important;
}

.p2p-order-archive-block.is-open .p2p-order-archive-toggle em {
    transform: rotate(180deg);
}

.p2p-order-archive-toggle:hover em {
    filter: brightness(1.06) saturate(1.05);
}

body.theme-light .p2p-order-archive-toggle em,
body.light-theme .p2p-order-archive-toggle em,
[data-theme="light"] .p2p-order-archive-toggle em {
    background:
        radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.26), transparent 38%),
        linear-gradient(135deg, #312e81, #7c3aed) !important;
    border-color: rgba(79, 70, 229, 0.28) !important;
    box-shadow: 0 10px 24px rgba(79, 70, 229, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.20) !important;
}


/* ===== STAGE UI P2P-11: clean hero exchange icon + collapsible create listing =====
   UI-only. Create listing becomes a collapsible panel like market/my orders. */

.p2p-hero-icon svg path {
    vector-effect: non-scaling-stroke;
}

.p2p-create-panel.p2p-collapsible-panel {
    overflow: hidden !important;
}

.p2p-create-panel.is-collapsed {
    padding: 0 !important;
}

.p2p-create-panel.is-open .p2p-collapse-head {
    padding: 0 0 16px !important;
}

.p2p-create-panel .p2p-collapse-head h2 {
    color: var(--text) !important;
    letter-spacing: -0.035em;
}

.p2p-create-panel .p2p-collapse-head p {
    max-width: 760px;
}

.p2p-create-panel .p2p-collapsible-body {
    border-top: 1px solid rgba(148, 163, 184, 0.13);
    padding-top: 16px;
}

.p2p-create-panel .p2p-form {
    max-width: none;
}

/* Use one unified premium arrow style for create/market/my/orders collapse buttons. */
.p2p-create-panel .p2p-collapse-arrow,
.p2p-market-panel .p2p-collapse-arrow,
.p2p-my-offers-panel .p2p-collapse-arrow,
.p2p-orders-panel .p2p-collapse-arrow {
    background:
        radial-gradient(circle at 30% 20%, rgba(255,255,255,.22), transparent 38%),
        linear-gradient(135deg, #312e81, #7c3aed) !important;
    border: 1px solid rgba(196, 181, 253, 0.28);
    box-shadow: 0 12px 28px rgba(79, 70, 229, 0.20), inset 0 1px 0 rgba(255,255,255,.16) !important;
}

body.theme-light .p2p-create-panel,
body.light-theme .p2p-create-panel,
[data-theme="light"] .p2p-create-panel {
    background:
        radial-gradient(circle at 18% 0%, rgba(124, 58, 237, 0.065), transparent 36%),
        radial-gradient(circle at 92% 10%, rgba(20, 184, 166, 0.05), transparent 34%),
        rgba(248, 250, 252, 0.96) !important;
    border-color: rgba(100, 116, 139, 0.14) !important;
    box-shadow: 0 22px 55px rgba(15, 23, 42, 0.075) !important;
}

body.theme-light .p2p-create-panel .p2p-collapsible-body,
body.light-theme .p2p-create-panel .p2p-collapsible-body,
[data-theme="light"] .p2p-create-panel .p2p-collapsible-body {
    border-top-color: rgba(100, 116, 139, 0.12);
}


/* ===== STAGE UI P2P-12: safe create-collapse toggle fix =====
   Prevents re-render side effects; reinforces collapsed body visibility. */

.p2p-create-panel.is-collapsed #p2p-create-body,
#p2p-create-body[hidden] {
    display: none !important;
}

.p2p-create-panel.is-open #p2p-create-body:not([hidden]) {
    display: block !important;
}


/* ===== STAGE UI-N1: notifications glass readability + dropdown hardening =====
   UI-only. Fixes white notification center/dropdown/toasts on Glass theme and keeps light/dark readable. */

/* Glass theme: notification page should be dark glass, not forced white. */


























/* Glass bell dropdown: override earlier hard-light pin. */
html body.theme-glass #notification-dropdown.notification-dropdown,
html body.theme-glass .header #notification-dropdown.notification-dropdown,
html body.theme-glass .app-header #notification-dropdown.notification-dropdown,
html body.theme-glass .topbar #notification-dropdown.notification-dropdown,
html body.theme-glass .notification-bell #notification-dropdown.notification-dropdown,
html body.theme-glass .notification-dropdown,
html[data-theme="glass"] body #notification-dropdown.notification-dropdown,
html[data-theme="glass"] body .notification-dropdown,
body[data-theme="glass"] #notification-dropdown.notification-dropdown,
body[data-theme="glass"] .notification-dropdown {
    color-scheme: dark !important;
    background:
        radial-gradient(circle at 12% 0%, rgba(124,58,237,.24), transparent 34%),
        linear-gradient(180deg, rgba(15,23,42,.96), rgba(30,41,59,.90)) !important;
    color: #f8fafc !important;
    border-color: rgba(255,255,255,.10) !important;
    box-shadow: 0 30px 80px rgba(0,0,0,.46), 0 12px 30px rgba(124,58,237,.20) !important;
    backdrop-filter: blur(22px) saturate(1.12) !important;
    -webkit-backdrop-filter: blur(22px) saturate(1.12) !important;
}

html body.theme-glass #notification-dropdown.notification-dropdown .notification-dropdown-header,
html body.theme-glass #notification-dropdown.notification-dropdown .notification-dropdown-footer,
html body.theme-glass .notification-dropdown .notification-dropdown-header,
html body.theme-glass .notification-dropdown .notification-dropdown-footer,
html[data-theme="glass"] body #notification-dropdown.notification-dropdown .notification-dropdown-header,
html[data-theme="glass"] body #notification-dropdown.notification-dropdown .notification-dropdown-footer,
body[data-theme="glass"] #notification-dropdown.notification-dropdown .notification-dropdown-header,
body[data-theme="glass"] #notification-dropdown.notification-dropdown .notification-dropdown-footer {
    background: linear-gradient(135deg, rgba(124,58,237,.16), rgba(59,130,246,.08)) !important;
    color: #f8fafc !important;
    border-color: rgba(255,255,255,.08) !important;
}

html body.theme-glass #notification-dropdown.notification-dropdown .notification-dropdown-item,
html body.theme-glass .notification-dropdown .notification-dropdown-item,
html[data-theme="glass"] body #notification-dropdown.notification-dropdown .notification-dropdown-item,
html[data-theme="glass"] body .notification-dropdown .notification-dropdown-item,
body[data-theme="glass"] #notification-dropdown.notification-dropdown .notification-dropdown-item,
body[data-theme="glass"] .notification-dropdown .notification-dropdown-item {
    background: rgba(30,41,59,.78) !important;
    color: #f8fafc !important;
    border-color: rgba(255,255,255,.08) !important;
}

html body.theme-glass #notification-dropdown.notification-dropdown .notification-dropdown-item.unread,
html body.theme-glass #notification-dropdown.notification-dropdown .notification-dropdown-item:hover,
html body.theme-glass .notification-dropdown .notification-dropdown-item.unread,
html body.theme-glass .notification-dropdown .notification-dropdown-item:hover,
html[data-theme="glass"] body #notification-dropdown.notification-dropdown .notification-dropdown-item.unread,
html[data-theme="glass"] body #notification-dropdown.notification-dropdown .notification-dropdown-item:hover,
body[data-theme="glass"] #notification-dropdown.notification-dropdown .notification-dropdown-item.unread,
body[data-theme="glass"] #notification-dropdown.notification-dropdown .notification-dropdown-item:hover {
    background: linear-gradient(135deg, rgba(124,58,237,.22), rgba(59,130,246,.13)) !important;
    color: #f8fafc !important;
    border-color: rgba(167,139,250,.22) !important;
}

html body.theme-glass #notification-dropdown.notification-dropdown .notification-dropdown-title,
html body.theme-glass #notification-dropdown.notification-dropdown .notification-dropdown-text,
html body.theme-glass #notification-dropdown.notification-dropdown .notification-dropdown-content,
html body.theme-glass .notification-dropdown .notification-dropdown-title,
html body.theme-glass .notification-dropdown .notification-dropdown-text,
html body.theme-glass .notification-dropdown .notification-dropdown-content,
html[data-theme="glass"] body #notification-dropdown.notification-dropdown .notification-dropdown-title,
html[data-theme="glass"] body #notification-dropdown.notification-dropdown .notification-dropdown-text,
body[data-theme="glass"] #notification-dropdown.notification-dropdown .notification-dropdown-title,
body[data-theme="glass"] #notification-dropdown.notification-dropdown .notification-dropdown-text {
    color: #f8fafc !important;
}

html body.theme-glass #notification-dropdown.notification-dropdown .notification-dropdown-meta,
html body.theme-glass .notification-dropdown .notification-dropdown-meta,
html[data-theme="glass"] body #notification-dropdown.notification-dropdown .notification-dropdown-meta,
body[data-theme="glass"] #notification-dropdown.notification-dropdown .notification-dropdown-meta {
    color: #a78bfa !important;
}

html body.theme-glass #notification-dropdown.notification-dropdown .notification-dropdown-message,
html body.theme-glass .notification-dropdown .notification-dropdown-message,
html[data-theme="glass"] body #notification-dropdown.notification-dropdown .notification-dropdown-message,
body[data-theme="glass"] #notification-dropdown.notification-dropdown .notification-dropdown-message {
    color: #cbd5e1 !important;
}



html body.theme-glass #notification-dropdown.notification-dropdown .notification-dropdown-close,
html body.theme-glass .notification-dropdown .notification-dropdown-close,
html[data-theme="glass"] body #notification-dropdown.notification-dropdown .notification-dropdown-close,
body[data-theme="glass"] #notification-dropdown.notification-dropdown .notification-dropdown-close {
    background: rgba(255,255,255,.07) !important;
    color: #e2e8f0 !important;
    border-color: rgba(255,255,255,.10) !important;
}

html body.theme-glass #notification-dropdown.notification-dropdown .notification-dropdown-footer a,
html body.theme-glass .notification-dropdown .notification-dropdown-footer a,
html body.theme-glass #notification-dropdown.notification-dropdown #all-notifications-link,
html[data-theme="glass"] body #notification-dropdown.notification-dropdown .notification-dropdown-footer a,
body[data-theme="glass"] #notification-dropdown.notification-dropdown .notification-dropdown-footer a {
    color: #c4b5fd !important;
}

html body.theme-glass #notification-dropdown.notification-dropdown .notification-dropdown-empty,
html body.theme-glass .notification-dropdown .notification-dropdown-empty,
html body.theme-glass #notification-dropdown.notification-dropdown .notification-dropdown-empty b,
html body.theme-glass .notification-dropdown .notification-dropdown-empty b,
html body.theme-glass #notification-dropdown.notification-dropdown .notification-dropdown-empty span,
html body.theme-glass .notification-dropdown .notification-dropdown-empty span,
html[data-theme="glass"] body #notification-dropdown.notification-dropdown .notification-dropdown-empty,
body[data-theme="glass"] #notification-dropdown.notification-dropdown .notification-dropdown-empty {
    color: #cbd5e1 !important;
}

/* Glass notification toasts should not be white either. */
html body.theme-glass .toast.toast-new,
html[data-theme="glass"] body .toast.toast-new,
body[data-theme="glass"] .toast.toast-new {
    color-scheme: dark !important;
    background:
        radial-gradient(circle at 12% 0%, rgba(124,58,237,.20), transparent 34%),
        linear-gradient(135deg, rgba(15,23,42,.94), rgba(30,41,59,.88)) !important;
    color: #f8fafc !important;
    border-color: rgba(255,255,255,.10) !important;
    box-shadow: 0 24px 70px rgba(0,0,0,.36), 0 8px 24px rgba(124,58,237,.18) !important;
}

html body.theme-glass .toast.toast-new .toast-title,
html[data-theme="glass"] body .toast.toast-new .toast-title,
body[data-theme="glass"] .toast.toast-new .toast-title {
    color: #f8fafc !important;
}

html body.theme-glass .toast.toast-new .toast-message,
html[data-theme="glass"] body .toast.toast-new .toast-message,
body[data-theme="glass"] .toast.toast-new .toast-message {
    color: #cbd5e1 !important;
}

html body.theme-glass .toast.toast-new .toast-close,
html[data-theme="glass"] body .toast.toast-new .toast-close,
body[data-theme="glass"] .toast.toast-new .toast-close {
    background: rgba(255,255,255,.07) !important;
    color: #e2e8f0 !important;
}

/* Settings modal on glass: no white cards over glass theme. */







/* ===== STAGE UI-N2: notification visibility restore =====
   Emergency hotfix after N1. Does not change notification API logic.
   Forces notification center/dropdown/toasts to stay visible and readable on glass theme. */

#notifications-list{
    visibility: visible !important;
    opacity: 1 !important;
}

#notifications-list{
    display: grid !important;
}





/* Settings overlay must stay hidden only when it has .hidden. */




/* Bell dropdown: visible class must always win. */
#notification-dropdown.notification-dropdown.visible,
.notification-dropdown.visible {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    transform: translateY(0) !important;
}

/* Glass theme: stop white cards/dropdowns, but do not hide anything. */








html body.theme-glass #notification-dropdown.notification-dropdown,
html body.theme-glass .notification-dropdown,
html[data-theme="glass"] body #notification-dropdown.notification-dropdown,
html[data-theme="glass"] body .notification-dropdown,
body[data-theme="glass"] #notification-dropdown.notification-dropdown,
body[data-theme="glass"] .notification-dropdown {
    background:
        linear-gradient(135deg, rgba(15, 23, 42, 0.92), rgba(30, 41, 59, 0.84)) !important;
    border-color: rgba(148, 163, 184, 0.22) !important;
    color: rgba(248, 250, 252, 0.98) !important;
    box-shadow: 0 22px 60px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
    backdrop-filter: blur(20px);
}

html body.theme-glass .notification-dropdown-header,
html body.theme-glass .notification-dropdown-footer,
html body.theme-glass .notification-dropdown-item,
html[data-theme="glass"] body .notification-dropdown-header,
html[data-theme="glass"] body .notification-dropdown-footer,
html[data-theme="glass"] body .notification-dropdown-item,
body[data-theme="glass"] .notification-dropdown-header,
body[data-theme="glass"] .notification-dropdown-footer,
body[data-theme="glass"] .notification-dropdown-item {
    background: transparent !important;
    color: rgba(248, 250, 252, 0.98) !important;
    border-color: rgba(148, 163, 184, 0.14) !important;
}

html body.theme-glass .notification-dropdown-text,
html body.theme-glass .notification-dropdown-title,
html[data-theme="glass"] body .notification-dropdown-text,
html[data-theme="glass"] body .notification-dropdown-title,
body[data-theme="glass"] .notification-dropdown-text,
body[data-theme="glass"] .notification-dropdown-title {
    color: rgba(248, 250, 252, 0.99) !important;
}

html body.theme-glass .notification-dropdown-meta,
html body.theme-glass .notification-dropdown-message,
html[data-theme="glass"] body .notification-dropdown-meta,
html[data-theme="glass"] body .notification-dropdown-message,
body[data-theme="glass"] .notification-dropdown-meta,
body[data-theme="glass"] .notification-dropdown-message {
    color: rgba(203, 213, 225, 0.94) !important;
}


/* ===== STAGE UI-N4: notifications glass hard override =====
   Fixes the light notification cards leaking into the Glass theme. */


















html[data-theme="glass"] body .setting-description,
body.theme-glass .setting-description{
    color: rgba(203, 213, 225, 0.94) !important;
    opacity: 1 !important;
}



html[data-theme="glass"] body .notification-dropdown,
body.theme-glass .notification-dropdown {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.94), rgba(30, 41, 59, 0.86)) !important;
    color: rgba(248, 250, 252, 0.98) !important;
    border-color: rgba(148, 163, 184, 0.22) !important;
    box-shadow: 0 26px 80px rgba(0, 0, 0, 0.34), 0 10px 28px rgba(124, 58, 237, 0.16) !important;
    backdrop-filter: blur(22px) saturate(1.08) !important;
    -webkit-backdrop-filter: blur(22px) saturate(1.08) !important;
}

html[data-theme="glass"] body .notification-dropdown-item,
body.theme-glass .notification-dropdown-item {
    background: rgba(255, 255, 255, 0.045) !important;
    color: rgba(248, 250, 252, 0.98) !important;
    border-color: rgba(148, 163, 184, 0.12) !important;
}

html[data-theme="glass"] body .notification-dropdown-text,
html[data-theme="glass"] body .notification-dropdown-title,
body.theme-glass .notification-dropdown-text,
body.theme-glass .notification-dropdown-title {
    color: #f8fafc !important;
}

html[data-theme="glass"] body .notification-dropdown-message,
html[data-theme="glass"] body .notification-dropdown-meta,
body.theme-glass .notification-dropdown-message,
body.theme-glass .notification-dropdown-meta {
    color: rgba(203, 213, 225, 0.94) !important;
}



/* ===== STAGE UI-N5: notifications glass/non-light hard override =====
   The notification center may be rendered while body/html theme classes are stale.
   Match both page-local theme class and global non-light theme state. */



















/* ===== STAGE UI-N7: notification glass final root selectors =====
   Real fix: notification surfaces follow actual non-light app theme and cannot fall back to old light cards. */












html:not([data-theme="light"]) body #notification-dropdown.notification-dropdown,
body:not(.theme-light) #notification-dropdown.notification-dropdown {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.96), rgba(30, 41, 59, 0.90)) !important;
    border-color: rgba(148, 163, 184, 0.22) !important;
    color: rgba(248, 250, 252, 0.98) !important;
    box-shadow: 0 22px 60px rgba(0, 0, 0, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.07) !important;
    backdrop-filter: blur(22px) saturate(1.15) !important;
    -webkit-backdrop-filter: blur(22px) saturate(1.15) !important;
}


/* ===== STAGE UI-N10: notifications mobile tabs + swipe delete restore =====
   Mobile only. Keeps desktop notification layout untouched. */

@media (max-width: 760px) {
    

    

    

    

    

    

    

    /* hint that the row is scrollable without clipping the last button */
    

    
}

@media (max-width: 760px), (pointer: coarse) {
    

    

    

    

    

    

    

    
}

@media (max-width: 420px) {
    
}


/* ===== STAGE UI-N12: bell dropdown footer visible on desktop/mobile =====
   Keeps "Все уведомления" pinned inside the dropdown instead of being clipped by the list. */

#notification-dropdown.notification-dropdown,
.notification-dropdown {
    box-sizing: border-box !important;
}

#notification-dropdown.notification-dropdown.visible,
.notification-dropdown.visible {
    display: flex !important;
    flex-direction: column !important;
    max-height: min(620px, calc(100dvh - var(--app-menu-bar-h, 0px) - 92px)) !important;
    overflow: hidden !important;
}

#notification-dropdown.notification-dropdown .notification-dropdown-header,
.notification-dropdown .notification-dropdown-header {
    flex: 0 0 auto !important;
}

#notification-dropdown.notification-dropdown .notification-dropdown-list,
.notification-dropdown .notification-dropdown-list {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow-y: auto !important;
    overscroll-behavior: contain !important;
    padding-bottom: 8px !important;
}

#notification-dropdown.notification-dropdown .notification-dropdown-footer,
.notification-dropdown .notification-dropdown-footer {
    flex: 0 0 auto !important;
    position: sticky !important;
    bottom: 0 !important;
    z-index: 5 !important;
    display: block !important;
    padding: 10px 12px 12px !important;
    border-top: 1px solid rgba(148, 163, 184, 0.16) !important;
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.72), rgba(15, 23, 42, 0.94)) !important;
    backdrop-filter: blur(18px) saturate(1.12) !important;
    -webkit-backdrop-filter: blur(18px) saturate(1.12) !important;
}

#notification-dropdown.notification-dropdown .notification-dropdown-footer .btn,
.notification-dropdown .notification-dropdown-footer .btn,
#notification-dropdown.notification-dropdown .notification-dropdown-footer a,
.notification-dropdown .notification-dropdown-footer a {
    width: 100% !important;
    min-height: 42px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
    white-space: nowrap !important;
    border-radius: 16px !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
}

body.theme-light #notification-dropdown.notification-dropdown .notification-dropdown-footer,
body.light-theme #notification-dropdown.notification-dropdown .notification-dropdown-footer,
[data-theme="light"] #notification-dropdown.notification-dropdown .notification-dropdown-footer {
    background: linear-gradient(180deg, rgba(255,255,255,0.78), rgba(255,255,255,0.98)) !important;
    border-top-color: rgba(15, 23, 42, 0.08) !important;
}

@media (max-width: 760px) {
    #notification-dropdown.notification-dropdown,
    .notification-dropdown {
        width: min(420px, calc(100vw - 24px)) !important;
        max-width: calc(100vw - 24px) !important;
        right: max(-12px, calc(52px - 100vw)) !important;
        left: auto !important;
        max-height: min(620px, calc(100dvh - 78px)) !important;
        border-radius: 22px !important;
    }

    #notification-dropdown.notification-dropdown .notification-dropdown-list,
    .notification-dropdown .notification-dropdown-list {
        padding: 8px 8px 6px !important;
    }

    #notification-dropdown.notification-dropdown .notification-dropdown-footer,
    .notification-dropdown .notification-dropdown-footer {
        padding: 9px 10px calc(10px + env(safe-area-inset-bottom, 0px)) !important;
    }

    #notification-dropdown.notification-dropdown .notification-dropdown-footer .btn,
    .notification-dropdown .notification-dropdown-footer .btn,
    #notification-dropdown.notification-dropdown .notification-dropdown-footer a,
    .notification-dropdown .notification-dropdown-footer a {
        min-height: 44px !important;
        font-size: 0.94rem !important;
    }
}

@media (max-width: 420px) {
    #notification-dropdown.notification-dropdown,
    .notification-dropdown {
        width: calc(100vw - 18px) !important;
        max-width: calc(100vw - 18px) !important;
        right: max(-9px, calc(44px - 100vw)) !important;
    }
}

/* === UI polish: premium listing action buttons (UI-only, no logic changes) === */
.listing-detail-action-stack,
.listing-details-actions {
    gap: 11px;
}

.listing-detail-action-stack .btn,
.listing-details-actions .btn {
    position: relative;
    min-height: 46px;
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    font-weight: 850;
    letter-spacing: -0.01em;
    overflow: hidden;
    isolation: isolate;
    box-shadow: 0 12px 26px rgba(0, 0, 0, 0.16);
}

.listing-detail-action-stack .btn::after,
.listing-details-actions .btn::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: radial-gradient(circle at 16% 0%, rgba(255, 255, 255, 0.24), transparent 38%);
    opacity: 0.72;
    pointer-events: none;
}

.listing-detail-action-stack .btn::before,
.listing-details-actions .btn::before {
    width: 24px;
    height: 24px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 24px;
    font-size: 0.82rem;
    line-height: 1;
    background: rgba(255, 255, 255, 0.16);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.13);
}

.listing-detail-action-stack .btn:hover:not(:disabled),
.listing-details-actions .btn:hover:not(:disabled) {
    transform: translateY(-2px);
    filter: saturate(1.06);
}

.listing-detail-action-stack .btn:active:not(:disabled),
.listing-details-actions .btn:active:not(:disabled) {
    transform: translateY(0);
}

.listing-detail-action-stack .btn.primary:not([data-listing-favorite]),
.listing-details-actions .btn.primary:not([data-listing-favorite]) {
    color: #fff;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 48%, #3b82f6 100%);
    border-color: rgba(147, 197, 253, 0.32);
    box-shadow: 0 16px 34px rgba(99, 102, 241, 0.28);
}

.listing-detail-action-stack .btn.primary:not([data-listing-favorite]):hover:not(:disabled),
.listing-details-actions .btn.primary:not([data-listing-favorite]):hover:not(:disabled) {
    box-shadow: 0 18px 42px rgba(99, 102, 241, 0.36);
}

.listing-detail-action-stack .btn[data-listing-chat]::before,
.listing-details-actions .btn[data-listing-chat]::before {
    content: "💬";
}

.listing-detail-action-stack .btn[data-seller-profile],
.listing-details-actions .btn[data-seller-profile] {
    color: #eef2ff;
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.96), rgba(79, 70, 229, 0.34));
    border-color: rgba(165, 180, 252, 0.22);
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.24);
}

.listing-detail-action-stack .btn[data-seller-profile]::before,
.listing-details-actions .btn[data-seller-profile]::before {
    content: "👤";
}

.listing-detail-action-stack .btn[data-listing-buy-prepare],
.listing-details-actions .btn[data-listing-buy-prepare],
.listing-detail-action-stack .btn.guarant:not(.disabled),
.listing-details-actions .btn.guarant:not(.disabled) {
    color: #fff;
    background: linear-gradient(135deg, #7c3aed 0%, #a855f7 48%, #60a5fa 100%);
    border-color: rgba(216, 180, 254, 0.42);
    box-shadow: 0 18px 42px rgba(124, 58, 237, 0.32);
}

.listing-detail-action-stack .btn[data-listing-buy-prepare]::before,
.listing-details-actions .btn[data-listing-buy-prepare]::before {
    content: "🛡";
}

.listing-detail-action-stack .btn[data-listing-favorite],
.listing-details-actions .btn[data-listing-favorite] {
    color: #fde68a;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.24), rgba(139, 92, 246, 0.18));
    border-color: rgba(251, 191, 36, 0.34);
    box-shadow: 0 14px 32px rgba(245, 158, 11, 0.13);
}

.listing-detail-action-stack .btn.primary[data-listing-favorite],
.listing-details-actions .btn.primary[data-listing-favorite] {
    color: #fff;
    background: linear-gradient(135deg, #f59e0b 0%, #ec4899 52%, #8b5cf6 100%);
    border-color: rgba(253, 186, 116, 0.42);
    box-shadow: 0 16px 36px rgba(236, 72, 153, 0.22);
}

.listing-detail-action-stack .btn[data-listing-favorite]::before,
.listing-details-actions .btn[data-listing-favorite]::before {
    content: "☆";
}

.listing-detail-action-stack .btn.primary[data-listing-favorite]::before,
.listing-details-actions .btn.primary[data-listing-favorite]::before {
    content: "★";
}

.listing-detail-action-stack .btn[data-listing-report],
.listing-details-actions .btn[data-listing-report],
.listing-details-actions .btn.ghost[data-listing-report] {
    color: #fecaca;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.18), rgba(245, 158, 11, 0.10));
    border-color: rgba(248, 113, 113, 0.28);
    box-shadow: 0 12px 28px rgba(239, 68, 68, 0.10);
}

.listing-detail-action-stack .btn[data-listing-report]::before,
.listing-details-actions .btn[data-listing-report]::before {
    content: "⚑";
}

body.theme-light .listing-detail-action-stack .btn,
body.theme-light .listing-details-actions .btn {
    border-color: rgba(79, 70, 229, 0.12);
    box-shadow: 0 12px 26px rgba(15, 23, 42, 0.08);
}

body.theme-light .listing-detail-action-stack .btn[data-seller-profile],
body.theme-light .listing-details-actions .btn[data-seller-profile] {
    color: #312e81;
    background: linear-gradient(135deg, #ffffff 0%, #f4f3ff 52%, #eef2ff 100%);
    border-color: rgba(99, 102, 241, 0.20);
}

body.theme-light .listing-detail-action-stack .btn[data-listing-favorite],
body.theme-light .listing-details-actions .btn[data-listing-favorite] {
    color: #92400e;
    background: linear-gradient(135deg, #fff7ed 0%, #fff1f2 48%, #f5f3ff 100%);
    border-color: rgba(245, 158, 11, 0.28);
}

body.theme-light .listing-detail-action-stack .btn.primary[data-listing-favorite],
body.theme-light .listing-details-actions .btn.primary[data-listing-favorite] {
    color: #fff;
}

body.theme-light .listing-detail-action-stack .btn[data-listing-report],
body.theme-light .listing-details-actions .btn[data-listing-report],
body.theme-light .listing-details-actions .btn.ghost[data-listing-report] {
    color: #991b1b;
    background: linear-gradient(135deg, #fff1f2 0%, #fff7ed 100%);
    border-color: rgba(248, 113, 113, 0.32);
}

@media (max-width: 720px) {
    .listing-detail-action-stack .btn,
    .listing-details-actions .btn {
        min-height: 44px;
        border-radius: 14px;
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    .listing-detail-action-stack .btn::before,
    .listing-details-actions .btn::before {
        width: 22px;
        height: 22px;
        flex-basis: 22px;
        font-size: 0.76rem;
    }
}

.listing-detail-action-stack .btn.secondary:not([data-listing-favorite]):not([data-seller-profile]),
.listing-details-actions .btn.secondary:not([data-seller-profile]) {
    color: #eef2ff;
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.96), rgba(59, 130, 246, 0.22));
    border-color: rgba(147, 197, 253, 0.18);
}

body.theme-light .listing-detail-action-stack .btn.secondary:not([data-listing-favorite]):not([data-seller-profile]),
body.theme-light .listing-details-actions .btn.secondary:not([data-seller-profile]) {
    color: #1e3a8a;
    background: linear-gradient(135deg, #ffffff 0%, #eff6ff 100%);
    border-color: rgba(37, 99, 235, 0.18);
}

/* === UI polish update: replace emoji button icons with SVG mask icons === */
.listing-detail-action-stack .btn::before,
.listing-details-actions .btn::before {
    content: "" !important;
    width: 18px !important;
    height: 18px !important;
    display: inline-block !important;
    flex: 0 0 18px !important;
    opacity: 0.96 !important;
    background-color: currentColor !important;
    -webkit-mask-repeat: no-repeat !important;
    mask-repeat: no-repeat !important;
    -webkit-mask-position: center !important;
    mask-position: center !important;
    -webkit-mask-size: contain !important;
    mask-size: contain !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    font-size: 0 !important;
    line-height: 0 !important;
}

.listing-detail-action-stack .btn[data-listing-chat]::before,
.listing-details-actions .btn[data-listing-chat]::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M4.75 5.5A2.75 2.75 0 0 1 7.5 2.75h9A2.75 2.75 0 0 1 19.25 5.5v6A2.75 2.75 0 0 1 16.5 14.25H10.2l-3.782 3.025A.75.75 0 0 1 5.25 16.69v-2.44A2.75 2.75 0 0 1 2.75 11.5v-6A2.75 2.75 0 0 1 5.5 2.75h2Z'/%3E%3C/svg%3E") !important;
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M4.75 5.5A2.75 2.75 0 0 1 7.5 2.75h9A2.75 2.75 0 0 1 19.25 5.5v6A2.75 2.75 0 0 1 16.5 14.25H10.2l-3.782 3.025A.75.75 0 0 1 5.25 16.69v-2.44A2.75 2.75 0 0 1 2.75 11.5v-6A2.75 2.75 0 0 1 5.5 2.75h2Z'/%3E%3C/svg%3E") !important;
}

.listing-detail-action-stack .btn[data-seller-profile]::before,
.listing-details-actions .btn[data-seller-profile]::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M12 2.75a4.75 4.75 0 1 1 0 9.5a4.75 4.75 0 0 1 0-9.5ZM4.75 19A5.25 5.25 0 0 1 10 13.75h4A5.25 5.25 0 0 1 19.25 19v1.25H4.75V19Z'/%3E%3C/svg%3E") !important;
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M12 2.75a4.75 4.75 0 1 1 0 9.5a4.75 4.75 0 0 1 0-9.5ZM4.75 19A5.25 5.25 0 0 1 10 13.75h4A5.25 5.25 0 0 1 19.25 19v1.25H4.75V19Z'/%3E%3C/svg%3E") !important;
}

.listing-detail-action-stack .btn[data-listing-buy-prepare]::before,
.listing-details-actions .btn[data-listing-buy-prepare]::before,
.listing-detail-action-stack .btn.guarant:not(.disabled)::before,
.listing-details-actions .btn.guarant:not(.disabled)::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M12 2.25c2.223 1.864 4.824 2.821 7.5 3.09v5.399c0 4.907-3.167 8.775-7.118 10.697a.87.87 0 0 1-.764 0C7.667 19.514 4.5 15.646 4.5 10.739V5.34C7.176 5.071 9.777 4.114 12 2.25Zm3.03 6.72L11.1 12.9l-1.63-1.63a.75.75 0 0 0-1.06 1.06l2.16 2.16a.75.75 0 0 0 1.06 0l4.46-4.46a.75.75 0 1 0-1.06-1.06Z'/%3E%3C/svg%3E") !important;
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M12 2.25c2.223 1.864 4.824 2.821 7.5 3.09v5.399c0 4.907-3.167 8.775-7.118 10.697a.87.87 0 0 1-.764 0C7.667 19.514 4.5 15.646 4.5 10.739V5.34C7.176 5.071 9.777 4.114 12 2.25Zm3.03 6.72L11.1 12.9l-1.63-1.63a.75.75 0 0 0-1.06 1.06l2.16 2.16a.75.75 0 0 0 1.06 0l4.46-4.46a.75.75 0 1 0-1.06-1.06Z'/%3E%3C/svg%3E") !important;
}

.listing-detail-action-stack .btn[data-listing-favorite]::before,
.listing-details-actions .btn[data-listing-favorite]::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M11.334 3.52a.75.75 0 0 1 1.332 0l2.037 4.127 4.555.662a.75.75 0 0 1 .416 1.279l-3.296 3.214.778 4.537a.75.75 0 0 1-1.088.79L12 16l-4.068 2.129a.75.75 0 0 1-1.088-.79l.778-4.537-3.296-3.214a.75.75 0 0 1 .416-1.279l4.555-.662 2.037-4.127ZM12 5.546l-1.518 3.077a.75.75 0 0 1-.565.41l-3.396.494 2.457 2.395a.75.75 0 0 1 .216.664l-.58 3.381 3.037-1.596a.75.75 0 0 1 .698 0l3.037 1.596-.58-3.381a.75.75 0 0 1 .216-.664l2.457-2.395-3.396-.494a.75.75 0 0 1-.565-.41L12 5.546Z'/%3E%3C/svg%3E") !important;
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M11.334 3.52a.75.75 0 0 1 1.332 0l2.037 4.127 4.555.662a.75.75 0 0 1 .416 1.279l-3.296 3.214.778 4.537a.75.75 0 0 1-1.088.79L12 16l-4.068 2.129a.75.75 0 0 1-1.088-.79l.778-4.537-3.296-3.214a.75.75 0 0 1 .416-1.279l4.555-.662 2.037-4.127ZM12 5.546l-1.518 3.077a.75.75 0 0 1-.565.41l-3.396.494 2.457 2.395a.75.75 0 0 1 .216.664l-.58 3.381 3.037-1.596a.75.75 0 0 1 .698 0l3.037 1.596-.58-3.381a.75.75 0 0 1 .216-.664l2.457-2.395-3.396-.494a.75.75 0 0 1-.565-.41L12 5.546Z'/%3E%3C/svg%3E") !important;
}

.listing-detail-action-stack .btn.primary[data-listing-favorite]::before,
.listing-details-actions .btn.primary[data-listing-favorite]::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M11.48 3.5a.75.75 0 0 1 1.04 0l2.135 3.11 3.61.934a.75.75 0 0 1 .408 1.226l-2.35 2.742.19 3.696a.75.75 0 0 1-1.093.69L12 14.13l-3.42 1.768a.75.75 0 0 1-1.093-.69l.19-3.696-2.35-2.742a.75.75 0 0 1 .408-1.226l3.61-.934 2.135-3.11Z'/%3E%3C/svg%3E") !important;
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M11.48 3.5a.75.75 0 0 1 1.04 0l2.135 3.11 3.61.934a.75.75 0 0 1 .408 1.226l-2.35 2.742.19 3.696a.75.75 0 0 1-1.093.69L12 14.13l-3.42 1.768a.75.75 0 0 1-1.093-.69l.19-3.696-2.35-2.742a.75.75 0 0 1 .408-1.226l3.61-.934 2.135-3.11Z'/%3E%3C/svg%3E") !important;
}

.listing-detail-action-stack .btn[data-listing-report]::before,
.listing-details-actions .btn[data-listing-report]::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M6 2.75a.75.75 0 0 1 .75.75v17a.75.75 0 0 1-1.5 0v-17A.75.75 0 0 1 6 2.75Zm1.75 1.5h7.2a2.75 2.75 0 0 1 2.128 4.49l-.71.858a1.25 1.25 0 0 0 0 1.594l.71.858a2.75 2.75 0 0 1-2.127 4.49h-7.2V4.25Z'/%3E%3C/svg%3E") !important;
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M6 2.75a.75.75 0 0 1 .75.75v17a.75.75 0 0 1-1.5 0v-17A.75.75 0 0 1 6 2.75Zm1.75 1.5h7.2a2.75 2.75 0 0 1 2.128 4.49l-.71.858a1.25 1.25 0 0 0 0 1.594l.71.858a2.75 2.75 0 0 1-2.127 4.49h-7.2V4.25Z'/%3E%3C/svg%3E") !important;
}

@media (max-width: 720px) {
    .listing-detail-action-stack .btn::before,
    .listing-details-actions .btn::before {
        width: 17px !important;
        height: 17px !important;
        flex-basis: 17px !important;
    }
}

/* === UI polish hotfix: owner listing action SVG icons, no blank squares === */
.listing-detail-action-stack .btn[data-listing-edit]::before,
.listing-details-actions .btn[data-listing-edit]::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M16.862 3.487a2.25 2.25 0 0 1 3.182 3.182L9.91 16.803a3.75 3.75 0 0 1-1.664.963l-3.122.892a.75.75 0 0 1-.927-.927l.892-3.122a3.75 3.75 0 0 1 .963-1.664L16.862 3.487Zm2.121 1.06a.75.75 0 0 0-1.06 0l-.88.88 1.06 1.06.88-.88a.75.75 0 0 0 0-1.06ZM16.043 6.427 7.113 15.356a2.25 2.25 0 0 0-.578.998l-.42 1.47 1.47-.42a2.25 2.25 0 0 0 .998-.578l8.929-8.929-1.47-1.47ZM4.75 20a.75.75 0 0 1 .75-.75h13a.75.75 0 0 1 0 1.5h-13A.75.75 0 0 1 4.75 20Z'/%3E%3C/svg%3E") !important;
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M16.862 3.487a2.25 2.25 0 0 1 3.182 3.182L9.91 16.803a3.75 3.75 0 0 1-1.664.963l-3.122.892a.75.75 0 0 1-.927-.927l.892-3.122a3.75 3.75 0 0 1 .963-1.664L16.862 3.487Zm2.121 1.06a.75.75 0 0 0-1.06 0l-.88.88 1.06 1.06.88-.88a.75.75 0 0 0 0-1.06ZM16.043 6.427 7.113 15.356a2.25 2.25 0 0 0-.578.998l-.42 1.47 1.47-.42a2.25 2.25 0 0 0 .998-.578l8.929-8.929-1.47-1.47ZM4.75 20a.75.75 0 0 1 .75-.75h13a.75.75 0 0 1 0 1.5h-13A.75.75 0 0 1 4.75 20Z'/%3E%3C/svg%3E") !important;
}

.listing-detail-action-stack .btn[data-listing-sold]::before,
.listing-details-actions .btn[data-listing-sold]::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M12 2.75a9.25 9.25 0 1 1 0 18.5 9.25 9.25 0 0 1 0-18.5Zm4.03 6.22a.75.75 0 0 0-1.06 0l-4.095 4.094-1.845-1.844a.75.75 0 1 0-1.06 1.06l2.375 2.375a.75.75 0 0 0 1.06 0l4.625-4.625a.75.75 0 0 0 0-1.06Z'/%3E%3C/svg%3E") !important;
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M12 2.75a9.25 9.25 0 1 1 0 18.5 9.25 9.25 0 0 1 0-18.5Zm4.03 6.22a.75.75 0 0 0-1.06 0l-4.095 4.094-1.845-1.844a.75.75 0 1 0-1.06 1.06l2.375 2.375a.75.75 0 0 0 1.06 0l4.625-4.625a.75.75 0 0 0 0-1.06Z'/%3E%3C/svg%3E") !important;
}

.listing-detail-action-stack .btn[data-listing-archive]::before,
.listing-details-actions .btn[data-listing-archive]::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M4.25 4.5A2.25 2.25 0 0 1 6.5 2.25h11A2.25 2.25 0 0 1 19.75 4.5v2A2.25 2.25 0 0 1 18 8.694V17.5a3.25 3.25 0 0 1-3.25 3.25h-5.5A3.25 3.25 0 0 1 6 17.5V8.694A2.25 2.25 0 0 1 4.25 6.5v-2Zm2.25-.75a.75.75 0 0 0-.75.75v2c0 .414.336.75.75.75h11a.75.75 0 0 0 .75-.75v-2a.75.75 0 0 0-.75-.75h-11Zm1 5v8.75c0 .966.784 1.75 1.75 1.75h5.5a1.75 1.75 0 0 0 1.75-1.75V8.75h-9Zm2.75 3a.75.75 0 0 1 .75-.75h2a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1-.75-.75Z'/%3E%3C/svg%3E") !important;
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M4.25 4.5A2.25 2.25 0 0 1 6.5 2.25h11A2.25 2.25 0 0 1 19.75 4.5v2A2.25 2.25 0 0 1 18 8.694V17.5a3.25 3.25 0 0 1-3.25 3.25h-5.5A3.25 3.25 0 0 1 6 17.5V8.694A2.25 2.25 0 0 1 4.25 6.5v-2Zm2.25-.75a.75.75 0 0 0-.75.75v2c0 .414.336.75.75.75h11a.75.75 0 0 0 .75-.75v-2a.75.75 0 0 0-.75-.75h-11Zm1 5v8.75c0 .966.784 1.75 1.75 1.75h5.5a1.75 1.75 0 0 0 1.75-1.75V8.75h-9Zm2.75 3a.75.75 0 0 1 .75-.75h2a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1-.75-.75Z'/%3E%3C/svg%3E") !important;
}

.listing-detail-action-stack .btn[data-listing-resubmit]::before,
.listing-details-actions .btn[data-listing-resubmit]::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M12 2.75a.75.75 0 0 1 .53.22l4 4a.75.75 0 1 1-1.06 1.06l-2.72-2.72V14a.75.75 0 0 1-1.5 0V5.31L8.53 8.03a.75.75 0 0 1-1.06-1.06l4-4a.75.75 0 0 1 .53-.22ZM4.75 13a.75.75 0 0 1 .75.75v3.75c0 .966.784 1.75 1.75 1.75h9.5a1.75 1.75 0 0 0 1.75-1.75v-3.75a.75.75 0 0 1 1.5 0v3.75a3.25 3.25 0 0 1-3.25 3.25h-9.5A3.25 3.25 0 0 1 4 17.5v-3.75a.75.75 0 0 1 .75-.75Z'/%3E%3C/svg%3E") !important;
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M12 2.75a.75.75 0 0 1 .53.22l4 4a.75.75 0 1 1-1.06 1.06l-2.72-2.72V14a.75.75 0 0 1-1.5 0V5.31L8.53 8.03a.75.75 0 0 1-1.06-1.06l4-4a.75.75 0 0 1 .53-.22ZM4.75 13a.75.75 0 0 1 .75.75v3.75c0 .966.784 1.75 1.75 1.75h9.5a1.75 1.75 0 0 0 1.75-1.75v-3.75a.75.75 0 0 1 1.5 0v3.75a3.25 3.25 0 0 1-3.25 3.25h-9.5A3.25 3.25 0 0 1 4 17.5v-3.75a.75.75 0 0 1 .75-.75Z'/%3E%3C/svg%3E") !important;
}

.listing-detail-action-stack .btn[data-listing-open]::before,
.listing-details-actions .btn[data-listing-open]::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M5.25 5.5A2.25 2.25 0 0 1 7.5 3.25h5a.75.75 0 0 1 0 1.5h-5a.75.75 0 0 0-.75.75v11A.75.75 0 0 0 7.5 17.25h11a.75.75 0 0 0 .75-.75v-5a.75.75 0 0 1 1.5 0v5a2.25 2.25 0 0 1-2.25 2.25h-11a2.25 2.25 0 0 1-2.25-2.25v-11ZM15 3.25h5a.75.75 0 0 1 .75.75v5a.75.75 0 0 1-1.5 0V5.81l-7.22 7.22a.75.75 0 1 1-1.06-1.06l7.22-7.22H15a.75.75 0 0 1 0-1.5Z'/%3E%3C/svg%3E") !important;
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M5.25 5.5A2.25 2.25 0 0 1 7.5 3.25h5a.75.75 0 0 1 0 1.5h-5a.75.75 0 0 0-.75.75v11A.75.75 0 0 0 7.5 17.25h11a.75.75 0 0 0 .75-.75v-5a.75.75 0 0 1 1.5 0v5a2.25 2.25 0 0 1-2.25 2.25h-11a2.25 2.25 0 0 1-2.25-2.25v-11ZM15 3.25h5a.75.75 0 0 1 .75.75v5a.75.75 0 0 1-1.5 0V5.81l-7.22 7.22a.75.75 0 1 1-1.06-1.06l7.22-7.22H15a.75.75 0 0 1 0-1.5Z'/%3E%3C/svg%3E") !important;
}

.listing-detail-action-stack .btn:not([data-listing-chat]):not([data-seller-profile]):not([data-listing-buy-prepare]):not(.guarant):not([data-listing-favorite]):not([data-listing-report]):not([data-listing-edit]):not([data-listing-sold]):not([data-listing-archive]):not([data-listing-resubmit]):not([data-listing-open])::before,
.listing-details-actions .btn:not([data-listing-chat]):not([data-seller-profile]):not([data-listing-buy-prepare]):not(.guarant):not([data-listing-favorite]):not([data-listing-report]):not([data-listing-edit]):not([data-listing-sold]):not([data-listing-archive]):not([data-listing-resubmit]):not([data-listing-open])::before {
    content: none !important;
    display: none !important;
}

/* === UI polish: wallet preflight rows alignment + SVG status icons (UI-only) === */
.wallet-status-box,
#crypto-wallet-status.wallet-status-box {
    text-align: start !important;
}

.wallet-safety-note.wallet-preflight-box {
    display: grid !important;
    grid-template-columns: 42px minmax(0, 1fr) !important;
    align-items: start !important;
    gap: 14px !important;
    width: 100% !important;
    text-align: start !important;
}

.wallet-preflight-main {
    min-width: 0 !important;
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    text-align: start !important;
}

.wallet-preflight-box .wallet-safety-title,
.wallet-preflight-box .wallet-safety-text {
    text-align: start !important;
}

.wallet-preflight-grid {
    display: grid !important;
    gap: 10px !important;
    width: 100% !important;
    justify-items: stretch !important;
    align-items: stretch !important;
}

.wallet-preflight-row {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) 22px !important;
    align-items: center !important;
    gap: 12px !important;
    width: 100% !important;
    min-height: 46px !important;
    padding: 11px 13px !important;
    border-radius: 16px !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    background: rgba(255, 255, 255, 0.04) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045) !important;
    box-sizing: border-box !important;
    text-align: start !important;
}

.wallet-preflight-row.is-ok {
    border-color: rgba(16, 185, 129, 0.22) !important;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.105), rgba(255, 255, 255, 0.032)) !important;
}

.wallet-preflight-row.is-warn {
    border-color: rgba(245, 158, 11, 0.24) !important;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.11), rgba(255, 255, 255, 0.032)) !important;
}

.wallet-preflight-label {
    min-width: 0 !important;
    overflow-wrap: anywhere;
    color: rgba(226, 232, 240, 0.9) !important;
    font-weight: 800 !important;
    line-height: 1.2 !important;
    text-align: start !important;
}

.wallet-preflight-value {
    min-width: 0 !important;
    white-space: normal !important;
    overflow-wrap: anywhere;
    direction: ltr;
    unicode-bidi: isolate;
    color: #ffffff !important;
    font-weight: 900 !important;
    line-height: 1.2 !important;
    text-align: right !important;
}

.wallet-preflight-state {
    width: 22px !important;
    height: 22px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    justify-self: end !important;
    flex: 0 0 22px !important;
    border-radius: 999px !important;
}

.wallet-preflight-state svg {
    width: 19px !important;
    height: 19px !important;
    display: block !important;
}

.wallet-preflight-state.is-ok {
    color: #34d399 !important;
    background: rgba(16, 185, 129, 0.12) !important;
}

.wallet-preflight-state.is-warn {
    color: #fbbf24 !important;
    background: rgba(245, 158, 11, 0.13) !important;
}

.wallet-preflight-loading,
.wallet-preflight-warning {
    width: 100% !important;
    text-align: start !important;
    box-sizing: border-box !important;
}

body.theme-light .wallet-preflight-row {
    border-color: rgba(15, 23, 42, 0.08) !important;
    background: rgba(255, 255, 255, 0.78) !important;
    box-shadow: 0 12px 26px rgba(15, 23, 42, 0.06) !important;
}

body.theme-light .wallet-preflight-row.is-ok {
    border-color: rgba(16, 185, 129, 0.20) !important;
    background: linear-gradient(135deg, rgba(236, 253, 245, 0.98), rgba(255, 255, 255, 0.88)) !important;
}

body.theme-light .wallet-preflight-row.is-warn {
    border-color: rgba(245, 158, 11, 0.24) !important;
    background: linear-gradient(135deg, rgba(255, 251, 235, 0.98), rgba(255, 255, 255, 0.88)) !important;
}

body.theme-light .wallet-preflight-label {
    color: rgba(30, 41, 59, 0.82) !important;
}

body.theme-light .wallet-preflight-value {
    color: #0f172a !important;
}

@media (max-width: 640px) {
    .wallet-safety-note.wallet-preflight-box {
        grid-template-columns: 42px minmax(0, 1fr) !important;
        gap: 12px !important;
        padding: 0 !important;
    }

    .wallet-preflight-row {
        grid-template-columns: minmax(0, 1fr) 20px !important;
        gap: 9px !important;
        min-height: 44px !important;
        padding: 10px 11px !important;
        border-radius: 14px !important;
    }

    .wallet-preflight-value {
        font-size: 14px !important;
        grid-column: 1;
        grid-row: 2;
        text-align: start !important;
    }

    .wallet-preflight-state {
        grid-column: 2;
        grid-row: 1 / span 2;
        width: 20px !important;
        height: 20px !important;
    }

    .wallet-preflight-state svg {
        width: 17px !important;
        height: 17px !important;
    }
}

/* === UI polish: forum topics fixed page size + bottom-right pagination (UI-only) === */
.forum-topics-pagination-host {
    min-height: 0;
}

.forum-topics-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 2px;
    padding-top: 12px;
    border-top: 1px solid rgba(148, 163, 184, .14);
}

.forum-page-info {
    white-space: nowrap;
}

.forum-page-controls {
    margin-left: auto;
    justify-content: flex-end;
}

.forum-page-btn {
    min-width: 34px;
    height: 34px;
    border-radius: 12px;
}

.forum-page-btn.nav {
    min-width: 74px;
}

.forum-page-gap {
    height: 34px;
    min-width: 28px;
}

@media (max-width: 720px) {
    .forum-topics-pagination {
        align-items: flex-end;
        justify-content: flex-end;
        flex-direction: column;
        gap: 9px;
    }

    .forum-page-info {
        width: 100%;
        text-align: right;
        white-space: normal;
    }

    .forum-page-controls {
        width: 100%;
        justify-content: flex-end;
    }

    .forum-page-btn.nav {
        min-width: 64px;
    }
}

/* === UI-only: profile desktop header alignment (name left, actions right) === */
@media (min-width: 1024px) {

    /* Let only the header row use the full desktop width. */

    /* Keep everything below the name row centered as before. */

    /* Own and foreign profiles: name block starts from the left edge under avatar. */

    /* Own profile: no actions, just left-aligned identity. */

    /* Foreign profile: identity on the left, buttons group on the far right. */

    /* Slightly wider desktops: align exactly with the avatar's visual left edge. */
}

/* === UI-only hotfix: own profile desktop name truly under left avatar === */
@media (min-width: 1024px) {
    /* The previous patch moved the topline, but the whole profile page was still capped at 680px.
       Make only the desktop shell full-width; keep content blocks centered below. */

    /* Own profile: identity starts from the same desktop edge as avatar. */

    /* Foreign profile: keep identity left and action buttons on the far right. */

    /* Keep all main profile content centered after the desktop shell became full-width. */
}


/* === UI hotfix: header search user avatar fallback (SVG, no blank circles) === */
.header-search-user-card .header-search-avatar,
.search-result-avatar.header-search-avatar {
    position: relative !important;
    overflow: hidden !important;
    display: grid !important;
    place-items: center !important;
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    border-radius: 999px !important;
    color: rgba(255,255,255,.95) !important;
    background: linear-gradient(135deg, #0f766e 0%, #14b8a6 52%, #6366f1 100%) !important;
    box-shadow: 0 10px 24px rgba(20,184,166,.20), inset 0 0 0 1px rgba(255,255,255,.12) !important;
    isolation: isolate !important;
}

.header-search-user-card .header-search-avatar img,
.search-result-avatar.header-search-avatar img {
    position: absolute !important;
    inset: 0 !important;
    z-index: 2 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
    opacity: 0 !important;
    transition: opacity .14s ease !important;
}

.header-search-user-card .header-search-avatar.is-loaded img,
.search-result-avatar.header-search-avatar.is-loaded img {
    opacity: 1 !important;
}

.header-search-user-card .search-result-avatar-fallback,
.search-result-avatar.header-search-avatar .search-result-avatar-fallback {
    position: absolute !important;
    inset: 0 !important;
    z-index: 1 !important;
    display: grid !important;
    place-items: center !important;
    color: currentColor !important;
    opacity: 1 !important;
    pointer-events: none !important;
}

.header-search-user-card .header-search-avatar.is-loaded .search-result-avatar-fallback,
.search-result-avatar.header-search-avatar.is-loaded .search-result-avatar-fallback {
    opacity: 0 !important;
}

.header-search-user-card .search-result-avatar-fallback svg,
.search-result-avatar.header-search-avatar .search-result-avatar-fallback svg {
    width: 72% !important;
    height: 72% !important;
    display: block !important;
    filter: drop-shadow(0 3px 8px rgba(0,0,0,.18)) !important;
}

body.theme-light .header-search-user-card .header-search-avatar,
body.theme-light .search-result-avatar.header-search-avatar {
    background: linear-gradient(135deg, #2563eb 0%, #3b82f6 48%, #8b5cf6 100%) !important;
    box-shadow: 0 10px 22px rgba(37,99,235,.14), inset 0 0 0 1px rgba(255,255,255,.22) !important;
}

@media (max-width: 768px) {
    .header-search-user-card .header-search-avatar,
    .search-result-avatar.header-search-avatar {
        width: 38px !important;
        height: 38px !important;
        min-width: 38px !important;
    }
}

@media (max-width: 480px) {
    .header-search-user-card .header-search-avatar,
    .search-result-avatar.header-search-avatar {
        width: 34px !important;
        height: 34px !important;
        min-width: 34px !important;
    }
}

/* === UI-only hotfix: profile glass theme readability === */

body.theme-glass .profile-page .profile-tab-menu-icon,
html[data-theme="glass"] body .profile-page .profile-tab-menu-icon,
body[data-theme="glass"] .profile-page .profile-tab-menu-icon {
    color: currentColor !important;
    opacity: 1 !important;
    filter: none !important;
}

body.theme-glass .profile-page .overview-grid.modern-grid .info-card,
body.theme-glass .profile-page .info-card,
html[data-theme="glass"] body .profile-page .overview-grid.modern-grid .info-card,
html[data-theme="glass"] body .profile-page .info-card,
body[data-theme="glass"] .profile-page .overview-grid.modern-grid .info-card,
body[data-theme="glass"] .profile-page .info-card {
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.72), rgba(15, 23, 42, 0.54)) !important;
    color: #f8fafc !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    box-shadow:
        0 18px 44px rgba(0, 0, 0, 0.24),
        inset 0 1px 0 rgba(255, 255, 255, 0.07) !important;
    backdrop-filter: blur(20px) saturate(1.14) !important;
    -webkit-backdrop-filter: blur(20px) saturate(1.14) !important;
}

body.theme-glass .profile-page .info-card h3,
body.theme-glass .profile-page .info-card strong,
body.theme-glass .profile-page .info-card b,
html[data-theme="glass"] body .profile-page .info-card h3,
html[data-theme="glass"] body .profile-page .info-card strong,
html[data-theme="glass"] body .profile-page .info-card b,
body[data-theme="glass"] .profile-page .info-card h3,
body[data-theme="glass"] .profile-page .info-card strong,
body[data-theme="glass"] .profile-page .info-card b {
    color: #ffffff !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.24) !important;
}

body.theme-glass .profile-page .info-card p,
body.theme-glass .profile-page .info-card div,
body.theme-glass .profile-page .info-card span:not(.badge-new):not(.profile-section-title-icon):not(.profile-info-title-icon),
html[data-theme="glass"] body .profile-page .info-card p,
html[data-theme="glass"] body .profile-page .info-card div,
html[data-theme="glass"] body .profile-page .info-card span:not(.badge-new):not(.profile-section-title-icon):not(.profile-info-title-icon),
body[data-theme="glass"] .profile-page .info-card p,
body[data-theme="glass"] .profile-page .info-card div,
body[data-theme="glass"] .profile-page .info-card span:not(.badge-new):not(.profile-section-title-icon):not(.profile-info-title-icon) {
    color: rgba(241, 245, 249, 0.88) !important;
}

body.theme-glass .profile-page .badge-new,
html[data-theme="glass"] body .profile-page .badge-new,
body[data-theme="glass"] .profile-page .badge-new {
    color: #eef2ff !important;
    background: rgba(99, 102, 241, 0.18) !important;
    border-color: rgba(167, 139, 250, 0.24) !important;
}

body.theme-glass .profile-page .info-card h3 .profile-section-title-icon,
body.theme-glass .profile-page .info-card h3 .profile-info-title-icon,
html[data-theme="glass"] body .profile-page .info-card h3 .profile-section-title-icon,
html[data-theme="glass"] body .profile-page .info-card h3 .profile-info-title-icon,
body[data-theme="glass"] .profile-page .info-card h3 .profile-section-title-icon,
body[data-theme="glass"] .profile-page .info-card h3 .profile-info-title-icon {
    color: #c4b5fd !important;
    opacity: 1 !important;
}

/* === UI hotfix: profile wall composer avatar + remove bubble tail === */
.vk-wall-composer.feed-composer .feed-composer-bubble::before {
    content: none !important;
    display: none !important;
}

.vk-wall-composer.feed-composer .feed-composer-bubble {
    border-radius: 22px !important;
}

.vk-wall-composer.feed-composer .feed-composer-row {
    align-items: flex-start !important;
    gap: 14px !important;
}

.vk-wall-composer.feed-composer .feed-composer-avatar {
    position: relative !important;
    z-index: 2 !important;
    padding-top: 2px !important;
}

.feed-avatar {
    position: relative;
    overflow: hidden;
}

.feed-avatar.has-image {
    background: linear-gradient(135deg, #0f766e 0%, #14b8a6 52%, #6366f1 100%) !important;
}

.feed-avatar.has-image img {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    border-radius: inherit;
}

.feed-avatar .feed-avatar-default-icon {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: grid;
    place-items: center;
    color: rgba(255,255,255,0.94);
    background: linear-gradient(135deg, #0f766e 0%, #14b8a6 48%, #6366f1 100%);
}

.feed-avatar .feed-avatar-default-icon svg {
    width: 72%;
    height: 72%;
    display: block;
    filter: drop-shadow(0 6px 12px rgba(2,6,23,.18));
}

.feed-avatar.is-fallback {
    color: transparent !important;
    font-size: 0 !important;
    background: linear-gradient(135deg, #0f766e 0%, #14b8a6 48%, #6366f1 100%) !important;
}

.feed-avatar.is-fallback .feed-avatar-default-icon {
    position: absolute;
}

.feed-avatar.has-image:not(.is-fallback) .feed-avatar-default-icon {
    opacity: 0;
}

.feed-avatar.has-image.is-fallback .feed-avatar-default-icon {
    opacity: 1;
}

.vk-wall-composer.feed-composer .feed-composer-avatar .feed-avatar {
    width: 44px !important;
    height: 44px !important;
    flex-basis: 44px !important;
    box-shadow: 0 0 0 3px rgba(139,92,246,.16), 0 12px 28px rgba(2,6,23,.26) !important;
}

@media (max-width: 720px) {
    .vk-wall-composer.feed-composer .feed-composer-row {
        gap: 10px !important;
    }

    .vk-wall-composer.feed-composer .feed-composer-avatar .feed-avatar {
        width: 38px !important;
        height: 38px !important;
        flex-basis: 38px !important;
    }
}

/* === UI hotfix: profile composer mobile actions near publish button === */
@media (max-width: 720px) {
    .vk-wall-composer.feed-composer .feed-composer-actions {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: flex-end !important;
        gap: 10px !important;
        width: 100% !important;
        margin-top: 14px !important;
        padding: 0 2px !important;
    }

    .vk-wall-composer.feed-composer .feed-composer-tools {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: flex-end !important;
        gap: 8px !important;
        width: auto !important;
        min-width: 0 !important;
        flex: 0 0 auto !important;
        margin-left: auto !important;
    }

    .vk-wall-composer.feed-composer .feed-attach-btn {
        min-height: 44px !important;
        height: 44px !important;
        padding: 0 14px !important;
        border-radius: 999px !important;
        white-space: nowrap !important;
        flex: 0 0 auto !important;
        gap: 8px !important;
    }

    .vk-wall-composer.feed-composer .feed-attach-btn span {
        display: inline !important;
        font-size: 0.92rem !important;
        font-weight: 800 !important;
    }

    .vk-wall-composer.feed-composer #feed-publish-btn {
        min-height: 44px !important;
        height: 44px !important;
        padding: 0 18px !important;
        border-radius: 12px !important;
        flex: 0 0 auto !important;
        white-space: nowrap !important;
    }
}

@media (max-width: 380px) {
    .vk-wall-composer.feed-composer .feed-composer-actions {
        gap: 8px !important;
    }

    .vk-wall-composer.feed-composer .feed-attach-btn {
        padding: 0 12px !important;
    }

    .vk-wall-composer.feed-composer .feed-attach-btn span {
        font-size: 0.86rem !important;
    }

    .vk-wall-composer.feed-composer #feed-publish-btn {
        padding: 0 14px !important;
    }
}

/* === UI hotfix v2: profile composer actions layout rollback/correct === */
/* Desktop: keep Фото/видео directly to the left of Опубликовать, not on the far side. */
.vk-wall-composer.feed-composer .feed-composer-actions {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 10px !important;
    width: 100% !important;
    margin-top: 14px !important;
    padding: 0 2px !important;
}

.vk-wall-composer.feed-composer .feed-composer-tools {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 8px !important;
    width: auto !important;
    min-width: 0 !important;
    flex: 0 0 auto !important;
    margin-left: 0 !important;
}

.vk-wall-composer.feed-composer .feed-attach-btn {
    min-height: 38px !important;
    height: 38px !important;
    padding: 0 14px !important;
    border-radius: 999px !important;
    white-space: nowrap !important;
    flex: 0 0 auto !important;
    gap: 8px !important;
}

.vk-wall-composer.feed-composer .feed-attach-btn span {
    display: inline !important;
    font-size: 0.92rem !important;
    font-weight: 800 !important;
}

.vk-wall-composer.feed-composer #feed-publish-btn {
    min-height: 38px !important;
    height: 38px !important;
    padding: 0 18px !important;
    border-radius: 12px !important;
    flex: 0 0 auto !important;
    white-space: nowrap !important;
}

/* Phone: only the paperclip icon, immediately left of publish. */
@media (max-width: 720px) {
    .vk-wall-composer.feed-composer .feed-composer-actions {
        justify-content: flex-end !important;
        gap: 10px !important;
        margin-top: 14px !important;
        padding: 0 2px !important;
        flex-wrap: nowrap !important;
    }

    .vk-wall-composer.feed-composer .feed-composer-tools {
        margin-left: 0 !important;
        flex: 0 0 auto !important;
    }

    .vk-wall-composer.feed-composer .feed-attach-btn {
        width: 44px !important;
        min-width: 44px !important;
        max-width: 44px !important;
        height: 44px !important;
        min-height: 44px !important;
        padding: 0 !important;
        border-radius: 999px !important;
        gap: 0 !important;
    }

    .vk-wall-composer.feed-composer .feed-attach-btn span {
        display: none !important;
    }

    .vk-wall-composer.feed-composer .feed-attach-btn svg,
.vk-wall-composer.feed-composer .feed-attach-btn .feed-ui-icon {
        width: 22px !important;
        height: 22px !important;
        margin: 0 !important;
        flex: 0 0 auto !important;
    }

    .vk-wall-composer.feed-composer #feed-publish-btn {
        min-height: 44px !important;
        height: 44px !important;
        padding: 0 18px !important;
        border-radius: 12px !important;
        flex: 0 0 auto !important;
    }
}

@media (max-width: 380px) {
    .vk-wall-composer.feed-composer .feed-composer-actions {
        gap: 8px !important;
    }

    .vk-wall-composer.feed-composer .feed-attach-btn {
        width: 42px !important;
        min-width: 42px !important;
        max-width: 42px !important;
        height: 42px !important;
        min-height: 42px !important;
        padding: 0 !important;
    }

    .vk-wall-composer.feed-composer #feed-publish-btn {
        height: 42px !important;
        min-height: 42px !important;
        padding: 0 14px !important;
    }
}

/* === Dashboard UI hotfix: notifications column and SVG notification icons === */
@media (min-width: 981px) {
    .dashboard-v2 .dashboard-main-grid {
        grid-auto-flow: dense;
    }

    .dashboard-v2 .dashboard-panel-actions {
        grid-column: 1;
        grid-row: 1 / span 2;
    }

    .dashboard-v2 .dashboard-panel-attention {
        grid-column: 2;
        grid-row: 1;
    }

    .dashboard-v2 .dashboard-panel-notifications,
    .dashboard-v2 .dashboard-main-grid > .dashboard-panel:has(#notifications-list) {
        grid-column: 2;
        grid-row: 2;
        align-self: start;
    }

    .dashboard-v2 .dashboard-panel-chart {
        grid-column: 1;
        grid-row: 3;
    }

    .dashboard-v2 .dashboard-panel-wide {
        grid-column: 1 / -1;
        grid-row: 4;
    }
}

.dashboard-v2 .dashboard-notification-row .dashboard-row-icon {
    font-size: 0;
}

.dashboard-v2 .dashboard-notification-row .dashboard-row-icon svg {
    width: 22px;
    height: 22px;
    display: block;
    stroke: currentColor;
}

.dashboard-v2 .dashboard-panel-notifications .dashboard-list,
.dashboard-v2 .dashboard-main-grid > .dashboard-panel:has(#notifications-list) .dashboard-list {
    gap: 9px;
}

.dashboard-v2 .dashboard-panel-notifications .dashboard-empty,
.dashboard-v2 .dashboard-main-grid > .dashboard-panel:has(#notifications-list) .dashboard-empty {
    min-height: 94px;
}

@media (max-width: 980px) {
    .dashboard-v2 .dashboard-panel-notifications,
    .dashboard-v2 .dashboard-main-grid > .dashboard-panel:has(#notifications-list) {
        grid-column: auto;
        grid-row: auto;
    }
}

/* === Dashboard UI hotfix v2: move statistics below last activity === */
@media (min-width: 981px) {
    .dashboard-v2 .dashboard-main-grid {
        grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr) !important;
        grid-auto-flow: row !important;
        align-items: start !important;
    }

    .dashboard-v2 .dashboard-panel-actions {
        grid-column: 1 !important;
        grid-row: 1 / span 2 !important;
    }

    .dashboard-v2 .dashboard-panel-attention {
        grid-column: 2 !important;
        grid-row: 1 !important;
    }

    .dashboard-v2 .dashboard-panel-notifications,
    .dashboard-v2 .dashboard-main-grid > .dashboard-panel:has(#notifications-list) {
        grid-column: 2 !important;
        grid-row: 2 !important;
        align-self: start !important;
    }

    .dashboard-v2 .dashboard-panel-wide {
        grid-column: 1 / -1 !important;
        grid-row: 3 !important;
    }

    .dashboard-v2 .dashboard-panel-chart {
        grid-column: 1 / -1 !important;
        grid-row: 4 !important;
        width: 100% !important;
    }

    .dashboard-v2 .dashboard-panel-chart .dashboard-chart-wrap {
        min-height: 300px !important;
        height: clamp(300px, 28vw, 390px) !important;
    }
}

@media (max-width: 980px) {
    .dashboard-v2 .dashboard-panel-actions { order: 1 !important; }
    .dashboard-v2 .dashboard-panel-attention { order: 2 !important; }
    .dashboard-v2 .dashboard-panel-notifications,
    .dashboard-v2 .dashboard-main-grid > .dashboard-panel:has(#notifications-list) { order: 3 !important; }
    .dashboard-v2 .dashboard-panel-wide { order: 4 !important; }
    .dashboard-v2 .dashboard-panel-chart { order: 5 !important; }
}

/* === Dashboard UI hotfix v3: full-width quick actions, attention + notifications side-by-side === */
@media (min-width: 981px) {
    .dashboard-v2 .dashboard-main-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        grid-auto-flow: row !important;
        align-items: start !important;
    }

    .dashboard-v2 .dashboard-panel-actions {
        grid-column: 1 / -1 !important;
        grid-row: 1 !important;
        width: 100% !important;
    }

    .dashboard-v2 .dashboard-panel-notifications,
    .dashboard-v2 .dashboard-main-grid > .dashboard-panel:has(#notifications-list) {
        grid-column: 2 !important;
        grid-row: 2 !important;
        align-self: stretch !important;
    }

    .dashboard-v2 .dashboard-panel-wide {
        grid-column: 1 / -1 !important;
        grid-row: 2 !important;
        width: 100% !important;
    }

    .dashboard-v2 .dashboard-panel-chart {
        grid-column: 1 / -1 !important;
        grid-row: 3 !important;
        width: 100% !important;
    }

    .dashboard-v2 .dashboard-panel-chart .dashboard-chart-wrap {
        min-height: 300px !important;
        height: clamp(300px, 28vw, 390px) !important;
    }
}

@media (max-width: 980px) {
    .dashboard-v2 .dashboard-panel-actions { order: 1 !important; }
    .dashboard-v2 .dashboard-panel-wide { order: 2 !important; }
    .dashboard-v2 .dashboard-panel-chart { order: 3 !important; }
}

/* === Dashboard notifications: direct target navigation polish === */
.dashboard-notification-row.is-clickable {
    cursor: pointer;
    transition: transform .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.dashboard-notification-row.is-clickable:hover,
.dashboard-notification-row.is-clickable:focus-visible {
    transform: translateY(-1px);
    border-color: rgba(124, 92, 255, 0.30);
    background: rgba(124, 92, 255, 0.075);
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.18);
    outline: none;
}

.dashboard-notification-row.is-clickable:active {
    transform: translateY(0);
}

.dashboard-notification-row .dashboard-row-icon svg {
    width: 22px;
    height: 22px;
    display: block;
}

/* === Dashboard cleanup controls (UI-only list clearing, no deal/escrow deletion) === */
.dashboard-v2 .dashboard-panel-head-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex: 0 0 auto;
    min-width: max-content;
}

.dashboard-v2 .dashboard-clear-icon-btn {
    appearance: none;
    width: 34px;
    height: 34px;
    border-radius: 13px;
    border: 1px solid rgba(248, 113, 113, 0.22);
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.12), rgba(124, 58, 237, 0.10));
    color: #fca5a5;
    display: inline-grid;
    place-items: center;
    cursor: pointer;
    transition: transform .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease, color .18s ease, opacity .18s ease;
    box-shadow: 0 10px 22px rgba(239, 68, 68, 0.08);
}

.dashboard-v2 .dashboard-clear-icon-btn svg {
    width: 17px;
    height: 17px;
    display: block;
}

.dashboard-v2 .dashboard-clear-icon-btn:hover:not(:disabled),
.dashboard-v2 .dashboard-clear-icon-btn:focus-visible:not(:disabled) {
    transform: translateY(-1px);
    color: #fff;
    border-color: rgba(248, 113, 113, 0.46);
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.28), rgba(124, 58, 237, 0.16));
    box-shadow: 0 14px 30px rgba(239, 68, 68, 0.15);
    outline: none;
}

.dashboard-v2 .dashboard-clear-icon-btn:active:not(:disabled) {
    transform: translateY(0);
}

.dashboard-v2 .dashboard-clear-icon-btn:disabled {
    cursor: wait;
    opacity: .55;
    transform: none;
}

body.theme-light .dashboard-v2 .dashboard-clear-icon-btn,
body.light-theme .dashboard-v2 .dashboard-clear-icon-btn,
[data-theme="light"] .dashboard-v2 .dashboard-clear-icon-btn {
    color: #dc2626;
    border-color: rgba(220, 38, 38, 0.20);
    background: linear-gradient(135deg, rgba(254, 226, 226, 0.95), rgba(245, 243, 255, 0.85));
    box-shadow: 0 10px 22px rgba(220, 38, 38, 0.08);
}

@media (max-width: 640px) {
    .dashboard-v2 .dashboard-panel-head {
        gap: 10px;
    }

    .dashboard-v2 .dashboard-panel-head-actions {
        gap: 8px;
    }

    .dashboard-v2 .dashboard-clear-icon-btn {
        width: 32px;
        height: 32px;
        border-radius: 12px;
    }
}

/* === Dashboard branded clear confirm modal (replaces native localhost confirm) === */
.dashboard-clear-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: grid;
    place-items: center;
    padding: 22px;
    background: rgba(2, 6, 23, 0.68);
    backdrop-filter: blur(18px) saturate(1.1);
    -webkit-backdrop-filter: blur(18px) saturate(1.1);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.16s ease;
}

.dashboard-clear-modal-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
}

.dashboard-clear-modal {
    width: min(460px, calc(100vw - 28px));
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr);
    gap: 16px;
    padding: 22px;
    border-radius: 28px;
    color: #f8fafc;
    background:
        radial-gradient(circle at 12% 0%, rgba(139, 92, 246, 0.28), transparent 34%),
        linear-gradient(145deg, rgba(15, 23, 42, 0.96), rgba(17, 24, 39, 0.94));
    border: 1px solid rgba(167, 139, 250, 0.22);
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.48), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    transform: translateY(10px) scale(0.985);
    transition: transform 0.18s ease;
}

.dashboard-clear-modal-overlay.is-open .dashboard-clear-modal {
    transform: translateY(0) scale(1);
}

.dashboard-clear-modal-icon {
    width: 54px;
    height: 54px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    color: #fff;
    background: linear-gradient(135deg, #ef4444, #f97316);
    box-shadow: 0 16px 36px rgba(239, 68, 68, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.dashboard-clear-modal-icon svg {
    width: 24px;
    height: 24px;
}

.dashboard-clear-modal-body {
    min-width: 0;
}

.dashboard-clear-modal-body h3 {
    margin: 0 0 8px;
    color: #fff;
    font-size: 1.15rem;
    line-height: 1.25;
    font-weight: 900;
    letter-spacing: -0.02em;
}

.dashboard-clear-modal-body p {
    margin: 0;
    color: rgba(226, 232, 240, 0.76);
    font-size: 0.94rem;
    line-height: 1.5;
}

.dashboard-clear-modal-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 4px;
}

.dashboard-clear-modal-btn {
    min-width: 118px;
    min-height: 44px;
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    padding: 0 18px;
    cursor: pointer;
    font-weight: 850;
    letter-spacing: -0.01em;
    transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.dashboard-clear-modal-btn.cancel {
    color: #e0e7ff;
    background: rgba(255, 255, 255, 0.055);
    border-color: rgba(199, 210, 254, 0.18);
}

.dashboard-clear-modal-btn.delete {
    color: #fff;
    background: linear-gradient(135deg, #ef4444, #f97316);
    border-color: rgba(254, 202, 202, 0.30);
    box-shadow: 0 14px 34px rgba(239, 68, 68, 0.22);
}

.dashboard-clear-modal-btn:hover,
.dashboard-clear-modal-btn:focus-visible {
    transform: translateY(-1px);
    outline: none;
}

.dashboard-clear-modal-btn.cancel:hover,
.dashboard-clear-modal-btn.cancel:focus-visible {
    border-color: rgba(199, 210, 254, 0.34);
    background: rgba(255, 255, 255, 0.085);
}

.dashboard-clear-modal-btn.delete:hover,
.dashboard-clear-modal-btn.delete:focus-visible {
    box-shadow: 0 18px 42px rgba(239, 68, 68, 0.32);
}

.dashboard-clear-modal-btn:active {
    transform: translateY(0);
}

body.theme-light .dashboard-clear-modal-overlay,
body.light-theme .dashboard-clear-modal-overlay,
[data-theme="light"] .dashboard-clear-modal-overlay {
    background: rgba(15, 23, 42, 0.34);
}

body.theme-light .dashboard-clear-modal,
body.light-theme .dashboard-clear-modal,
[data-theme="light"] .dashboard-clear-modal {
    color: #0f172a;
    background:
        radial-gradient(circle at 12% 0%, rgba(124, 58, 237, 0.14), transparent 36%),
        linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.96));
    border-color: rgba(99, 102, 241, 0.18);
    box-shadow: 0 30px 80px rgba(15, 23, 42, 0.20), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

body.theme-light .dashboard-clear-modal-body h3,
body.light-theme .dashboard-clear-modal-body h3,
[data-theme="light"] .dashboard-clear-modal-body h3 {
    color: #0f172a;
}

body.theme-light .dashboard-clear-modal-body p,
body.light-theme .dashboard-clear-modal-body p,
[data-theme="light"] .dashboard-clear-modal-body p {
    color: rgba(51, 65, 85, 0.82);
}

body.theme-light .dashboard-clear-modal-btn.cancel,
body.light-theme .dashboard-clear-modal-btn.cancel,
[data-theme="light"] .dashboard-clear-modal-btn.cancel {
    color: #312e81;
    background: rgba(99, 102, 241, 0.08);
    border-color: rgba(99, 102, 241, 0.18);
}

body.theme-light .dashboard-clear-modal-btn.cancel:hover,
body.theme-light .dashboard-clear-modal-btn.cancel:focus-visible,
body.light-theme .dashboard-clear-modal-btn.cancel:hover,
body.light-theme .dashboard-clear-modal-btn.cancel:focus-visible,
[data-theme="light"] .dashboard-clear-modal-btn.cancel:hover,
[data-theme="light"] .dashboard-clear-modal-btn.cancel:focus-visible {
    background: rgba(99, 102, 241, 0.13);
    border-color: rgba(99, 102, 241, 0.28);
}

body.theme-glass .dashboard-clear-modal,
body.glass-theme .dashboard-clear-modal,
[data-theme="glass"] .dashboard-clear-modal {
    background:
        radial-gradient(circle at 15% 0%, rgba(139, 92, 246, 0.34), transparent 38%),
        linear-gradient(145deg, rgba(17, 24, 39, 0.78), rgba(30, 41, 59, 0.66));
    border-color: rgba(255, 255, 255, 0.18);
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(26px) saturate(1.25);
    -webkit-backdrop-filter: blur(26px) saturate(1.25);
}

@media (max-width: 540px) {
    .dashboard-clear-modal-overlay {
        padding: 14px;
        align-items: end;
    }

    .dashboard-clear-modal {
        width: 100%;
        grid-template-columns: 48px minmax(0, 1fr);
        border-radius: 24px;
        padding: 18px;
        gap: 13px;
    }

    .dashboard-clear-modal-icon {
        width: 48px;
        height: 48px;
        border-radius: 16px;
    }

    .dashboard-clear-modal-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 9px;
    }

    .dashboard-clear-modal-btn {
        width: 100%;
        min-width: 0;
        min-height: 46px;
        padding: 0 12px;
    }
}


/* === UI P2P: archived order swipe delete (UI-only hide, no financial deletion) === */
.p2p-order-swipe {
    position: relative;
    overflow: hidden;
    border-radius: 18px;
    isolation: isolate;
    touch-action: pan-y;
}

.p2p-order-swipe .p2p-order-summary {
    position: relative;
    z-index: 2;
    width: 100% !important;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
    will-change: transform;
}

.p2p-order-delete {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    width: 68px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 0 18px 18px 0;
    color: #fff;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 54%, #991b1b 100%);
    box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.14), 0 14px 30px rgba(239, 68, 68, 0.22);
    cursor: pointer;
    opacity: 1;
}

.p2p-order-delete svg {
    width: 22px;
    height: 22px;
    display: block;
    pointer-events: none;
}

.p2p-order-delete:hover,
.p2p-order-delete:focus-visible {
    filter: brightness(1.06) saturate(1.08);
    outline: none;
}

.p2p-order-swipe.is-revealed .p2p-order-summary {
    transform: translateX(-68px);
}

@media (hover: hover) and (pointer: fine) {
    .p2p-order-swipe:hover .p2p-order-summary,
    .p2p-order-swipe:focus-within .p2p-order-summary {
        transform: translateX(-68px);
    }
}

body.theme-light .p2p-order-delete,
body.light-theme .p2p-order-delete,
[data-theme="light"] .p2p-order-delete {
    background: linear-gradient(135deg, #f43f5e 0%, #ef4444 56%, #b91c1c 100%);
    box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.24), 0 14px 28px rgba(239, 68, 68, 0.18);
}

@media (max-width: 680px) {
    .p2p-order-delete {
        width: 62px;
    }

    .p2p-order-swipe.is-revealed .p2p-order-summary {
        transform: translateX(-62px);
    }
}

/* === HOTFIX: P2P archive delete reveal v2 + restore desktop full-width ===
   CSS-only. Keeps archive hide logic, hides the red trash until swipe/hover,
   and restores wide desktop P2P panels after archive-hide patch. */

/* Restore P2P exchange page full-width on desktop. */
@media (min-width: 1024px) {
    body:has(.p2p-page) .page-content,
    .page-content:has(.p2p-page),
    #page-content:has(.p2p-page),
    .main-content:has(.p2p-page),
    .app-content:has(.p2p-page),
    .content:has(.p2p-page) {
        max-width: none !important;
        width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: clamp(24px, 2.4vw, 44px) !important;
        padding-right: clamp(24px, 2.4vw, 44px) !important;
        box-sizing: border-box !important;
    }

    .p2p-page {
        max-width: none !important;
        width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        align-self: stretch !important;
    }

    .p2p-hero,
    .p2p-panel {
        width: 100% !important;
        max-width: none !important;
        box-sizing: border-box !important;
    }

    .p2p-hero-main,
    .p2p-collapse-head > div:first-child {
        min-width: 0 !important;
        flex: 1 1 auto !important;
    }

    .p2p-hero p,
    .p2p-collapse-head p {
        max-width: min(1080px, 100%) !important;
    }

    .p2p-collapse-action {
        margin-left: auto !important;
    }
}

@media (min-width: 1440px) {
    body:has(.p2p-page) .page-content,
    .page-content:has(.p2p-page),
    #page-content:has(.p2p-page),
    .main-content:has(.p2p-page),
    .app-content:has(.p2p-page),
    .content:has(.p2p-page) {
        padding-left: clamp(28px, 2.8vw, 56px) !important;
        padding-right: clamp(28px, 2.8vw, 56px) !important;
    }
}

/* Hide archive trash by default. Reveal only after mobile swipe or desktop hover/focus. */
.p2p-order-swipe {
    position: relative !important;
    overflow: hidden !important;
    border-radius: 18px !important;
    isolation: isolate !important;
}

.p2p-order-swipe .p2p-order-summary {
    position: relative !important;
    z-index: 2 !important;
    width: 100% !important;
    transform: translateX(0) !important;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease !important;
    will-change: transform !important;
}

.p2p-order-delete {
    z-index: 1 !important;
    right: 0 !important;
    width: 68px !important;
    transform: translateX(100%) !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transition: transform .18s ease, opacity .18s ease, filter .18s ease !important;
}

.p2p-order-swipe.is-revealed .p2p-order-summary {
    transform: translateX(-68px) !important;
}

.p2p-order-swipe.is-revealed .p2p-order-delete {
    transform: translateX(0) !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

@media (hover: hover) and (pointer: fine) {
    .p2p-order-swipe:hover .p2p-order-summary,
    .p2p-order-swipe:focus-within .p2p-order-summary {
        transform: translateX(-68px) !important;
    }

    .p2p-order-swipe:hover .p2p-order-delete,
    .p2p-order-swipe:focus-within .p2p-order-delete {
        transform: translateX(0) !important;
        opacity: 1 !important;
        pointer-events: auto !important;
    }
}

@media (max-width: 680px) {
    .p2p-order-delete {
        width: 62px !important;
    }

    .p2p-order-swipe.is-revealed .p2p-order-summary {
        transform: translateX(-62px) !important;
    }

    .p2p-order-swipe:not(.is-revealed) .p2p-order-delete {
        transform: translateX(100%) !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }
}

/* === HOTFIX: ordinary listings full-width desktop + safe pagination ===
   UI-only for marketplace/listings. Does not touch escrow/P2P/order logic. */
@media (min-width: 1024px) {
    body:has(.listings-page) .page-content,
    .page-content:has(.listings-page),
    #page-content:has(.listings-page),
    .main-content:has(.listings-page),
    .app-content:has(.listings-page),
    .content:has(.listings-page) {
        max-width: none !important;
        width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: clamp(24px, 2.4vw, 44px) !important;
        padding-right: clamp(24px, 2.4vw, 44px) !important;
        box-sizing: border-box !important;
    }

    .listings-page {
        max-width: none !important;
        width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        align-self: stretch !important;
    }

    .listings-stats-strip,
    .listings-page > .listings-toolbar,
    .listings-quick-filters,
    .listings-advanced-filters,
    .listings-active-filters,
    .listings-category-row,
    .listings-section-head,
    .listings-mine-status-row,
    .listings-grid,
    .listings-pagination-host {
        width: 100% !important;
        max-width: none !important;
        box-sizing: border-box !important;
    }

    .listings-section-head > div:first-child,
    .listings-searchbox {
        min-width: 0 !important;
        flex: 1 1 auto !important;
    }

    .listings-grid:not(.is-compact):not(.is-map) {
        grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)) !important;
    }
}

@media (min-width: 1440px) {
    body:has(.listings-page) .page-content,
    .page-content:has(.listings-page),
    #page-content:has(.listings-page),
    .main-content:has(.listings-page),
    .app-content:has(.listings-page),
    .content:has(.listings-page) {
        padding-left: clamp(28px, 2.8vw, 56px) !important;
        padding-right: clamp(28px, 2.8vw, 56px) !important;
    }

    .listings-grid:not(.is-compact):not(.is-map) {
        grid-template-columns: repeat(auto-fill, minmax(292px, 1fr)) !important;
    }
}

.listings-pagination-host {
    width: 100%;
}

.listings-pagination {
    margin-top: 4px;
}

.listings-page-controls {
    margin-left: auto;
}

.listings-page-btn.active {
    color: #fff;
    border-color: rgba(139, 92, 246, .45);
    background: linear-gradient(135deg, #7c3aed, #60a5fa);
    box-shadow: 0 12px 26px rgba(124, 58, 237, .22);
}

body.theme-light .listings-pagination,
body.light-theme .listings-pagination,
[data-theme="light"] .listings-pagination {
    border-top-color: rgba(15, 23, 42, .10);
}

body.theme-light .listings-page-btn,
body.light-theme .listings-page-btn,
[data-theme="light"] .listings-page-btn {
    color: #1f2937;
    background: rgba(255, 255, 255, .82);
    border-color: rgba(79, 70, 229, .16);
}

body.theme-light .listings-page-btn.active,
body.light-theme .listings-page-btn.active,
[data-theme="light"] .listings-page-btn.active {
    color: #fff;
    background: linear-gradient(135deg, #7c3aed, #3b82f6);
}

@media (max-width: 720px) {
    .listings-pagination {
        align-items: flex-end;
        justify-content: flex-end;
        flex-direction: column;
        gap: 9px;
        padding-top: 10px;
    }

    .listings-page-info {
        width: 100%;
        text-align: right;
        font-size: .84rem;
    }

    .listings-page-controls {
        width: 100%;
        justify-content: flex-end;
        gap: 6px;
    }

    .listings-page-btn,
    .listings-page-gap {
        min-width: 34px;
        height: 34px;
        border-radius: 11px;
    }

    .listings-page-btn.nav {
        min-width: 72px;
    }
}


/* === HOTFIX: ordinary listings mobile tabs + seller reputation/ranking badges === */
.listing-seller {
    min-width: 0;
}

.listing-seller-identity {
    min-width: 0;
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    line-height: 1.1;
}

.listing-seller-identity > span:first-child,
.listing-seller-identity > b {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.listing-seller-reputation {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
    max-width: 100%;
    color: rgba(226, 232, 240, .72);
    font-size: .72rem;
    font-weight: 850;
}

.listing-seller-reputation-detail {
    margin-top: 2px;
    font-size: .78rem;
}

.listing-seller-badge,
.listing-seller-sales,
.listing-seller-rating {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    min-height: 20px;
    padding: 3px 7px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, .16);
    background: rgba(255, 255, 255, .055);
    color: rgba(226, 232, 240, .78);
    white-space: nowrap;
}

.listing-seller-badge.top {
    color: #fff;
    border-color: rgba(251, 191, 36, .42);
    background: linear-gradient(135deg, rgba(245, 158, 11, .34), rgba(139, 92, 246, .24));
    box-shadow: 0 10px 24px rgba(245, 158, 11, .10);
}

.listing-seller-badge.trusted {
    color: #e0f2fe;
    border-color: rgba(56, 189, 248, .32);
    background: linear-gradient(135deg, rgba(14, 165, 233, .22), rgba(139, 92, 246, .16));
}

.listing-seller-rating svg {
    width: 13px;
    height: 13px;
    color: #fbbf24;
    fill: currentColor;
}

.listing-seller-rating em {
    font-style: normal;
    opacity: .7;
    font-size: .68rem;
}

body.theme-light .listing-seller-reputation,
body.light-theme .listing-seller-reputation,
[data-theme="light"] .listing-seller-reputation {
    color: rgba(30, 41, 59, .74);
}

body.theme-light .listing-seller-badge,
body.theme-light .listing-seller-sales,
body.theme-light .listing-seller-rating,
body.light-theme .listing-seller-badge,
body.light-theme .listing-seller-sales,
body.light-theme .listing-seller-rating,
[data-theme="light"] .listing-seller-badge,
[data-theme="light"] .listing-seller-sales,
[data-theme="light"] .listing-seller-rating {
    background: rgba(255, 255, 255, .78);
    border-color: rgba(79, 70, 229, .13);
    color: #334155;
}

body.theme-light .listing-seller-badge.top,
body.light-theme .listing-seller-badge.top,
[data-theme="light"] .listing-seller-badge.top {
    color: #7c2d12;
    border-color: rgba(245, 158, 11, .30);
    background: linear-gradient(135deg, #fff7ed, #f5f3ff);
}

@media (max-width: 720px) {
    .listings-mode-tabs {
        display: grid !important;
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        width: 100% !important;
        gap: 4px !important;
    }

    .listings-mode-tab {
        min-width: 0 !important;
        width: 100% !important;
        padding-inline: 6px !important;
        white-space: nowrap !important;
        word-break: keep-all !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        font-size: clamp(.78rem, 3.35vw, .9rem) !important;
        line-height: 1.1 !important;
    }

    .listing-seller-reputation-card {
        gap: 4px;
        font-size: .68rem;
    }

    .listing-seller-badge,
    .listing-seller-sales,
    .listing-seller-rating {
        min-height: 18px;
        padding: 2px 6px;
    }
}

@media (max-width: 380px) {
    .listings-mode-tab {
        font-size: .76rem !important;
        padding-inline: 4px !important;
    }
}

/* === HOTFIX: listings mobile mode tabs must show full labels === */
@media (max-width: 720px) {
    .listings-mode-tabs {
        grid-template-columns: minmax(54px, .68fr) minmax(132px, 1.65fr) minmax(50px, .58fr) !important;
        overflow: visible !important;
    }

    .listings-mode-tab {
        overflow: visible !important;
        text-overflow: clip !important;
        white-space: nowrap !important;
        word-break: normal !important;
        overflow-wrap: normal !important;
        hyphens: none !important;
        min-width: 0 !important;
        padding-inline: 5px !important;
        font-size: clamp(.72rem, 3.05vw, .86rem) !important;
        line-height: 1.05 !important;
        letter-spacing: -0.02em !important;
    }

    .listings-mode-tab[data-listings-mode="saved"] {
        letter-spacing: -0.035em !important;
    }
}

@media (max-width: 360px) {
    .listings-mode-tabs {
        grid-template-columns: minmax(46px, .62fr) minmax(122px, 1.78fr) minmax(42px, .52fr) !important;
        gap: 3px !important;
    }

    .listings-mode-tab {
        padding-inline: 3px !important;
        font-size: .72rem !important;
    }

}


/* === HOTFIX v3: full mobile labels + stricter seller reputation copy === */
@media (max-width: 720px) {
    .listings-mode-tabs {
        display: flex !important;
        align-items: stretch !important;
        justify-content: space-between !important;
        gap: 4px !important;
        overflow: visible !important;
        min-width: 0 !important;
    }

    .listings-mode-tab {
        flex: 0 0 auto !important;
        min-width: 0 !important;
        max-width: none !important;
        overflow: visible !important;
        text-overflow: clip !important;
        white-space: nowrap !important;
        word-break: keep-all !important;
        overflow-wrap: normal !important;
        hyphens: none !important;
        letter-spacing: -0.025em !important;
    }

    .listings-mode-tab[data-listings-mode="all"] {
        width: 72px !important;
    }

    .listings-mode-tab[data-listings-mode="saved"] {
        width: 148px !important;
        letter-spacing: -0.04em !important;
    }

    /* One size for «Все», «Сохранённые» and «Мои»: the global mobile button rule
       (16px !important, 0-1-1) out-ranked .listings-mode-tab, so only «Сохранённые»
       (with its attribute) was small. 0-2-0 here wins for all three. */
    .listings-mode-tabs .listings-mode-tab {
        font-size: clamp(.76rem, 3.2vw, .9rem) !important;
    }

    .listings-mode-tab[data-listings-mode="mine"] {
        width: 64px !important;
    }
}

@media (max-width: 380px) {
    .listings-mode-tabs {
        gap: 3px !important;
    }

    .listings-mode-tab[data-listings-mode="all"] {
        width: 62px !important;
    }

    .listings-mode-tab[data-listings-mode="saved"] {
        width: 136px !important;
        letter-spacing: -0.05em !important;
    }

    .listings-mode-tabs .listings-mode-tab {
        font-size: .74rem !important;
    }

    .listings-mode-tab[data-listings-mode="mine"] {
        width: 56px !important;
    }
}

.listing-seller-sales:empty {
    display: none !important;
}


/* === UI profile sales stat + sold listings modal (UI-only + safe public list) === */

.profile-sales-hero {
    background: linear-gradient(135deg, rgba(34, 197, 94, .18), rgba(109, 93, 252, .14)) !important;
    border-color: rgba(52, 211, 153, .22) !important;
}

.profile-recent-sales-list { gap: 11px !important; }
.profile-recent-sale-row { align-items: center !important; }
.profile-recent-sale-mainwrap {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    min-width: 0 !important;
}
.profile-recent-sale-thumb {
    width: 52px !important;
    height: 52px !important;
    min-width: 52px !important;
    border-radius: 16px !important;
    display: grid !important;
    place-items: center !important;
    background-size: cover !important;
    background-position: center !important;
    color: #fff !important;
    background-color: rgba(139, 92, 246, .22) !important;
    border: 1px solid rgba(255, 255, 255, .12) !important;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.04) !important;
    overflow: hidden !important;
}
.profile-recent-sale-thumb.is-empty {
    background: linear-gradient(135deg, rgba(139, 92, 246, .35), rgba(96, 165, 250, .20)) !important;
}
.profile-recent-sale-side b { white-space: nowrap !important; }
body.theme-light .profile-stats-modal .profile-recent-sale-thumb,
body.light-theme .profile-stats-modal .profile-recent-sale-thumb,
[data-theme="light"] .profile-stats-modal .profile-recent-sale-thumb {
    border-color: rgba(79, 70, 229, .16) !important;
    background-color: rgba(99, 102, 241, .12) !important;
}
@media (max-width: 640px) {
    .profile-recent-sale-row { align-items: flex-start !important; gap: 10px !important; }
    .profile-recent-sale-thumb { width: 46px !important; height: 46px !important; min-width: 46px !important; border-radius: 14px !important; }
    .profile-recent-sale-mainwrap { gap: 10px !important; }
    .profile-recent-sale-side { min-width: 96px !important; max-width: 42% !important; }
}


/* === UI hotfix: profile sales stat stays in one desktop row + basket SVG === */

/* DEALIX UI hotfix — wider global feed panels on desktop only.
   Keeps profile wall/mobile layout unchanged. */
@media (min-width: 1024px) {
    .vk-feed-page:not(.feed-page) {
        width: 100%;
        max-width: 1180px;
        margin-left: auto;
        margin-right: auto;
    }

    .vk-feed-page:not(.feed-page) > .feed-forum-panel,
    .vk-feed-page:not(.feed-page) > .vk-feed-header,
    .vk-feed-page:not(.feed-page) > .vk-feed-wrap,
    .vk-feed-page:not(.feed-page) > .feed-list-wrap {
        width: 100%;
        max-width: 100%;
    }

    .vk-feed-page:not(.feed-page) .feed-list,
    .vk-feed-page:not(.feed-page) .feed-empty,
    .vk-feed-page:not(.feed-page) .vk-feed-card {
        width: 100%;
        max-width: 100%;
    }
}

/* DEALIX chat hotfix — contain long unbroken text in composer and dialog list.
   CSS-only: does not touch textarea autosize/voice recording/send logic. */
.chats-page .chat-active .chat-input-wrapper {
    min-width: 0 !important;
    max-width: 100% !important;
    overflow: hidden !important;
}

.chats-page .chat-active .chat-input-wrapper textarea,
.chats-page .chat-active #message-input {
    box-sizing: border-box !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
    white-space: pre-wrap !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
}

.chats-page .chat-item {
    min-width: 0 !important;
    max-width: 100% !important;
    overflow: hidden !important;
}

.chats-page .chat-item-left {
    min-width: 0 !important;
    max-width: 100% !important;
    flex: 1 1 auto !important;
    overflow: hidden !important;
}

.chats-page .chat-item-left > div:not(.avatar) {
    min-width: 0 !important;
    max-width: 100% !important;
    flex: 1 1 auto !important;
    overflow: hidden !important;
}

.chats-page .chat-item-preview {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    overflow-wrap: normal !important;
    word-break: normal !important;
}

.chats-page .chat-item-right {
    flex: 0 0 auto !important;
    max-width: 116px !important;
}


/* === CHAT-27AB: mobile send keyboard stability / no under-keyboard jump === */
@media (max-width: 1024px) {
    body.chat-mobile-send-settling #chat-messages,
    body.chat-mobile-send-settling .chat-messages {
        scroll-behavior: auto !important;
        overflow-anchor: none !important;
        overscroll-behavior: contain !important;
        -webkit-overflow-scrolling: touch !important;
    }

    body.chat-mobile-send-settling .chat-input-area,
    body.chat-mobile-send-settling .chat-input-wrapper,
    body.chat-mobile-send-settling #message-input {
        transition: none !important;
    }

    body.chat-keyboard-shift.chat-mobile-send-settling .chat-input-area {
        will-change: transform !important;
    }
}


/* ===== Stage 27AD: stable mobile chat keyboard/send layout ===== */
@media (max-width: 1024px) {
    /* During active mobile keyboard mode, the messages list owns the bottom spacer.
       JS scrolls to maxScroll; this spacer keeps the last bubble above the lifted composer. */
    body.chat-keyboard-shift .app[data-page="chats"] .chat-messages {
        padding-bottom: calc(var(--chat-keyboard-shift, 0px) + 18px) !important;
        scroll-padding-bottom: calc(var(--chat-keyboard-shift, 0px) + var(--chat-composer-h, 72px) + 18px) !important;
        scroll-behavior: auto !important;
    }

    body.chat-mobile-send-settling .app[data-page="chats"] .chat-messages,
    body.chat-keyboard-shift.chat-mobile-send-settling .app[data-page="chats"] .chat-messages {
        scroll-behavior: auto !important;
        overscroll-behavior: contain !important;
    }

    body.chat-keyboard-shift .app[data-page="chats"] .chat-input-area,
    body.chat-keyboard-closing .app[data-page="chats"] .chat-input-area {
        transition: none !important;
        animation: none !important;
    }
}

/* === CHAT-MOBILE-R2: messenger-style keyboard bottom spacer ===
   The composer remains in normal flex flow and is visually translated upward by
   --chat-keyboard-shift. The messages list therefore needs only the keyboard
   overlap + a small air gap as its bottom spacer. Adding composer height here
   makes new messages jump too high above the input. */
@media (max-width: 1024px) {
    body.chat-keyboard-shift .app[data-page="chats"] .chat-messages {
        padding-bottom: calc(var(--chat-keyboard-shift, 0px) + 22px + var(--chat-composer-safe-extra, 0px)) !important;
        scroll-padding-bottom: calc(var(--chat-keyboard-shift, 0px) + 22px + var(--chat-composer-safe-extra, 0px)) !important;
        scroll-behavior: auto !important;
    }

    body.chat-keyboard-shift.chat-mobile-send-settling .app[data-page="chats"] .chat-messages {
        padding-bottom: calc(var(--chat-keyboard-shift, 0px) + 22px + var(--chat-composer-safe-extra, 0px)) !important;
        scroll-padding-bottom: calc(var(--chat-keyboard-shift, 0px) + 22px + var(--chat-composer-safe-extra, 0px)) !important;
    }
}

/* === CHAT-DESKTOP-BOTTOM-GUARD: never let newest message hide under floating composer ===
   Desktop composer is absolute/floating over #chat-messages, so raw scrollHeight bottom can
   visually place the last bubble behind the input/send button. Reserve composer height plus
   a hard safety gap. Mobile keyboard-specific rules below/above remain unchanged. */
@media (min-width: 1025px) {
    .chats-page .chat-active .chat-messages,
    body[data-page="chats"] .chat-active .chat-messages {
        /* Stage 27Z: stronger desktop-only bottom reserve. The right send button
           is a floating round control, so reserve more than composer height. */
        padding-bottom: max(190px, calc(var(--chat-composer-h, 82px) + 96px)) !important;
        scroll-padding-bottom: max(198px, calc(var(--chat-composer-h, 82px) + 104px)) !important;
        overflow-anchor: none !important;
    }
}

/* === DEALIX UI hotfix: dialog avatar clean circle + mobile profile stats 4-in-row ===
   UI-only. Keeps mobile chat keyboard fixes and desktop bottom guard untouched. */

/* Dialog list avatars: remove the square/transparent image canvas under default avatars. */
.chats-page .chat-item-left .avatar.small,
#chats-list .chat-item-left .avatar.small,
.chats-list .chat-item-left .avatar.small {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    max-width: 36px !important;
    flex: 0 0 36px !important;
    border-radius: 50% !important;
    overflow: hidden !important;
    clip-path: circle(50% at 50% 50%) !important;
    position: relative !important;
    display: grid !important;
    place-items: center !important;
    background: linear-gradient(135deg, #4f8cff 0%, #2563eb 100%) !important;
    box-shadow: none !important;
    line-height: 1 !important;
}

.chats-page .chat-item-left .avatar.small::before,
.chats-page .chat-item-left .avatar.small::after,
#chats-list .chat-item-left .avatar.small::before,
#chats-list .chat-item-left .avatar.small::after,
.chats-list .chat-item-left .avatar.small::before,
.chats-list .chat-item-left .avatar.small::after {
    content: none !important;
    display: none !important;
}

.chats-page .chat-item-left .avatar.small img,
#chats-list .chat-item-left .avatar.small img,
.chats-list .chat-item-left .avatar.small img {
    width: 100% !important;
    height: 100% !important;
    min-width: 100% !important;
    min-height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
    display: block !important;
    border-radius: 50% !important;
    clip-path: circle(50% at 50% 50%) !important;
    background: transparent !important;
    box-shadow: none !important;
}

/* Desktop/tablet dialog portraits: a grid item's intrinsic image ratio must
   not shrink the auto column. Mobile already enforces a square image box. */
@media (min-width: 769px) {
    .chats-page #chats-list .chat-item-left > .avatar.small.has-image:not(.group-avatar) > img {
        aspect-ratio: 1 / 1 !important;
    }
}

/* Mobile profile stats: 4 counters must stay in one row after adding "sales". */

/* === Hotfix: video circles must not inherit ordinary message card background ===
   Кружок — это самостоятельное круглое видео, а не текстовый bubble.
   Оставляем клики/открытие кружка как в JS, убираем только лишнюю подложку. */
#chat-messages .message-wrap.video-circle-wrap {
    width: max-content !important;
    max-width: min(78vw, 440px) !important;
    align-items: flex-end !important;
}

#chat-messages .message-wrap.video-circle-wrap.received {
    align-self: flex-start !important;
}

#chat-messages .message-wrap.video-circle-wrap.sent {
    align-self: flex-end !important;
}

#chat-messages .message.video-circle-bubble,
#chat-messages .message.sent.video-circle-bubble,
#chat-messages .message.received.video-circle-bubble,
#chat-messages .message.group-message.video-circle-bubble,
#chat-messages .message:has(.video-circle-message),
#chat-messages .message.sent:has(.video-circle-message),
#chat-messages .message.received:has(.video-circle-message) {
    width: max-content !important;
    max-width: max-content !important;
    min-width: 0 !important;
    padding: 0 !important;
    margin: 3px 0 !important;
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    border: 0 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    overflow: visible !important;
    color: var(--text) !important;
}

#chat-messages .message.video-circle-bubble .message-content,
#chat-messages .message:has(.video-circle-message) .message-content {
    display: block !important;
    width: max-content !important;
    max-width: max-content !important;
    min-width: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    border: 0 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    overflow: visible !important;
    line-height: 0 !important;
}

#chat-messages .message.video-circle-bubble .video-circle-message,
#chat-messages .message:has(.video-circle-message) .video-circle-message {
    display: block !important;
    width: clamp(172px, 24vw, 220px) !important;
    height: clamp(172px, 24vw, 220px) !important;
    min-width: clamp(172px, 24vw, 220px) !important;
    min-height: clamp(172px, 24vw, 220px) !important;
    max-width: clamp(172px, 24vw, 220px) !important;
    max-height: clamp(172px, 24vw, 220px) !important;
    aspect-ratio: 1 / 1 !important;
    border-radius: 999px !important;
    overflow: hidden !important;
    padding: 0 !important;
    margin: 0 !important;
    background: #020617 !important;
    border: 0 !important;
    box-shadow: 0 18px 42px rgba(15,23,42,.24) !important;
}

#chat-messages .message.video-circle-bubble .video-circle-message video,
#chat-messages .message:has(.video-circle-message) .video-circle-message video {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 999px !important;
    background: #020617 !important;
}

#chat-messages .message.video-circle-bubble .message-time,
#chat-messages .message:has(.video-circle-message) .message-time {
    display: block !important;
    width: fit-content !important;
    margin: 5px 8px 0 auto !important;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    color: var(--text-muted) !important;
    line-height: 1 !important;
    opacity: .78 !important;
}

body.theme-light #chat-messages .message.video-circle-bubble,
body.theme-light #chat-messages .message.sent.video-circle-bubble,
body.theme-light #chat-messages .message.received.video-circle-bubble,
body.theme-light #chat-messages .message:has(.video-circle-message) {
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    border: 0 !important;
    box-shadow: none !important;
}

@media (max-width: 768px) {
    #chat-messages .message.video-circle-bubble .video-circle-message,
    #chat-messages .message:has(.video-circle-message) .video-circle-message {
        width: min(58vw, 220px) !important;
        height: min(58vw, 220px) !important;
        min-width: min(58vw, 220px) !important;
        min-height: min(58vw, 220px) !important;
        max-width: min(58vw, 220px) !important;
        max-height: min(58vw, 220px) !important;
    }
}

/* === Hotfix: restore video-circle opening and remove only the ordinary bubble shell ===
   Previous wrapper-class patch changed the circle message shell too aggressively.
   Keep the original JS/DOM behavior, make the ordinary message bubble transparent,
   and hide the inner duration badge that looked like a strange timer. */
#chat-messages .message-wrap:has(.video-circle-message) {
    align-items: flex-end !important;
    max-width: min(78vw, 440px) !important;
    width: max-content !important;
}

#chat-messages .message-wrap.sent:has(.video-circle-message) {
    align-self: flex-end !important;
    margin-left: auto !important;
}

#chat-messages .message-wrap.received:has(.video-circle-message) {
    align-self: flex-start !important;
    margin-right: auto !important;
}

#chat-messages .message:has(.video-circle-message),
#chat-messages .message.sent:has(.video-circle-message),
#chat-messages .message.received:has(.video-circle-message),
#chat-messages .message.group-message:has(.video-circle-message) {
    width: max-content !important;
    max-width: max-content !important;
    min-width: 0 !important;
    padding: 0 !important;
    margin: 3px 0 !important;
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    border: 0 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    overflow: visible !important;
    pointer-events: auto !important;
}

#chat-messages .message:has(.video-circle-message) .message-content {
    display: block !important;
    width: max-content !important;
    max-width: max-content !important;
    min-width: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    border: 0 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    overflow: visible !important;
    line-height: normal !important;
    pointer-events: auto !important;
}

#chat-messages .video-circle-message,
#chat-messages .message .video-circle-message,
#chat-messages .chat-message .video-circle-message {
    display: block !important;
    position: relative !important;
    width: clamp(172px, 24vw, 220px) !important;
    height: clamp(172px, 24vw, 220px) !important;
    min-width: clamp(172px, 24vw, 220px) !important;
    min-height: clamp(172px, 24vw, 220px) !important;
    max-width: clamp(172px, 24vw, 220px) !important;
    max-height: clamp(172px, 24vw, 220px) !important;
    aspect-ratio: 1 / 1 !important;
    border-radius: 999px !important;
    overflow: hidden !important;
    padding: 0 !important;
    margin: 0 !important;
    background: #020617 !important;
    border: 0 !important;
    box-shadow: 0 18px 42px rgba(15,23,42,.24) !important;
    pointer-events: auto !important;
    cursor: pointer !important;
    touch-action: manipulation !important;
    -webkit-tap-highlight-color: transparent !important;
}

#chat-messages .video-circle-message video {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 999px !important;
    background: #020617 !important;
    pointer-events: none !important;
}

#chat-messages .video-circle-message .video-circle-play {
    pointer-events: none !important;
    border-radius: 999px !important;
}

#chat-messages .video-circle-message .video-circle-duration {
    display: none !important;
}

#chat-messages .message:has(.video-circle-message) .message-time {
    position: static !important;
    display: block !important;
    width: fit-content !important;
    margin: 5px 8px 0 auto !important;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    color: var(--text-muted) !important;
    line-height: 1 !important;
    opacity: .78 !important;
    pointer-events: none !important;
}

body.theme-light #chat-messages .message:has(.video-circle-message),
body.theme-light #chat-messages .message:has(.video-circle-message) .message-content,
[data-theme="light"] #chat-messages .message:has(.video-circle-message),
[data-theme="light"] #chat-messages .message:has(.video-circle-message) .message-content {
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    border: 0 !important;
    box-shadow: none !important;
}

@media (max-width: 768px) {
    #chat-messages .video-circle-message,
    #chat-messages .message .video-circle-message,
    #chat-messages .chat-message .video-circle-message {
        width: min(58vw, 220px) !important;
        height: min(58vw, 220px) !important;
        min-width: min(58vw, 220px) !important;
        min-height: min(58vw, 220px) !important;
        max-width: min(58vw, 220px) !important;
        max-height: min(58vw, 220px) !important;
    }
}

/* === Hotfix: video circle expanded state must override clean-bubble rules ===
   The previous clean-bubble CSS made the circle wrapper transparent, but its
   normal-size rule was appended after the old .expanded rules. As a result,
   the JS still added .expanded, but visually the circle did not open.
   Keep JS untouched; only restore the final expanded sizing/stacking. */
#chat-messages .message:has(.video-circle-message.expanded),
#chat-messages .message.sent:has(.video-circle-message.expanded),
#chat-messages .message.received:has(.video-circle-message.expanded),
#chat-messages .message.group-message:has(.video-circle-message.expanded) {
    position: relative !important;
    z-index: 72 !important;
    overflow: visible !important;
    pointer-events: auto !important;
}

#chat-messages .video-circle-message.expanded,
#chat-messages .message .video-circle-message.expanded,
#chat-messages .chat-message .video-circle-message.expanded {
    width: min(72vmin, 420px) !important;
    height: min(72vmin, 420px) !important;
    min-width: min(72vmin, 420px) !important;
    min-height: min(72vmin, 420px) !important;
    max-width: calc(100vw - 40px) !important;
    max-height: calc(100dvh - 180px) !important;
    aspect-ratio: 1 / 1 !important;
    border-radius: 999px !important;
    overflow: hidden !important;
    box-shadow: 0 28px 80px rgba(15, 23, 42, .34) !important;
    transform: translateZ(0) !important;
    z-index: 73 !important;
    pointer-events: auto !important;
    cursor: pointer !important;
}

#chat-messages .video-circle-message.expanded video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 999px !important;
    pointer-events: none !important;
}

#chat-messages .video-circle-message.playing .video-circle-play {
    opacity: 0 !important;
    pointer-events: none !important;
}

#chat-messages .video-circle-message.expanded:not(.playing) .video-circle-play {
    opacity: .9 !important;
    pointer-events: none !important;
}

#chat-messages .video-circle-message .video-circle-duration {
    display: none !important;
}

@media (max-width: 768px) {
    #chat-messages .video-circle-message.expanded,
    #chat-messages .message .video-circle-message.expanded,
    #chat-messages .chat-message .video-circle-message.expanded {
        width: min(86vmin, 390px) !important;
        height: min(86vmin, 390px) !important;
        min-width: min(86vmin, 390px) !important;
        min-height: min(86vmin, 390px) !important;
        max-width: calc(100vw - 24px) !important;
        max-height: calc(100dvh - 160px) !important;
    }
}

/* === DEALIX header wordmark: rounded 3D graffiti text, CSS-only ===
   Safe UI-only patch: keeps the existing header markup and brand colors.
   No backend/API/chat/financial logic is touched. */
.logo-text {
    position: relative;
    display: inline-flex;
    align-items: center;
    line-height: 1;
    padding: 2px 3px 5px 1px;
    font-family: "Arial Rounded MT Bold", "Trebuchet MS", "Nunito", "Segoe UI", system-ui, sans-serif;
    font-size: 1.32rem;
    font-weight: 950;
    letter-spacing: 0.045em;
    text-transform: uppercase;
    transform: skewX(-6deg);
    background: var(--primary-grad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-stroke: 0.45px rgba(255, 255, 255, 0.62);
    text-shadow:
        1px 1px 0 rgba(64, 45, 143, 0.95),
        2px 2px 0 rgba(49, 38, 118, 0.82),
        3px 3px 0 rgba(25, 20, 74, 0.72),
        0 0 8px rgba(124, 92, 255, 0.42),
        0 0 18px rgba(139, 92, 246, 0.24);
    filter: drop-shadow(0 0 5px rgba(124, 92, 255, 0.28));
    white-space: nowrap;
    isolation: isolate;
}

.logo-text::before {
    content: "DEALIX";
    position: absolute;
    inset: 0;
    z-index: -2;
    color: rgba(30, 22, 82, 0.92);
    -webkit-text-stroke: 0;
    transform: translate(3px, 4px);
    opacity: 0.82;
    pointer-events: none;
}

.logo-text::after {
    content: "DEALIX";
    position: absolute;
    inset: 0;
    z-index: -1;
    color: transparent;
    -webkit-text-stroke: 2px rgba(139, 92, 246, 0.22);
    transform: translate(1px, 1px);
    filter: blur(0.35px);
    opacity: 0.9;
    pointer-events: none;
}

.theme-light .logo-text {
    -webkit-text-stroke-color: rgba(255, 255, 255, 0.72);
    text-shadow:
        1px 1px 0 rgba(99, 102, 241, 0.62),
        2px 2px 0 rgba(79, 70, 229, 0.38),
        0 0 10px rgba(99, 102, 241, 0.22);
    filter: drop-shadow(0 3px 7px rgba(79, 70, 229, 0.18));
}

.theme-light .logo-text::before {
    color: rgba(79, 70, 229, 0.28);
    opacity: 0.78;
}

.theme-light .logo-text::after {
    -webkit-text-stroke-color: rgba(99, 102, 241, 0.22);
}

@media (max-width: 768px) {
    .logo-text {
        font-size: 1.12rem;
        letter-spacing: 0.035em;
        text-shadow:
            1px 1px 0 rgba(64, 45, 143, 0.8),
            2px 2px 0 rgba(25, 20, 74, 0.55),
            0 0 7px rgba(124, 92, 255, 0.32);
    }
}

/* === DEALIX header wordmark mobile + remove old S icon ===
   UI-only patch: keeps header markup, removes only the header S badge, and
   shows the rounded 3D DEALIX wordmark on mobile without touching JS/API. */
.header-left .logo-icon,
.header .logo .logo-icon {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    width: 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
    height: 0 !important;
    min-height: 0 !important;
    max-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
    pointer-events: none !important;
}

.header-left .logo,
.header .logo {
    gap: 0 !important;
}

@media (max-width: 768px) {
    .header-left {
        display: flex !important;
        align-items: center !important;
        flex: 0 0 auto !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
        gap: 6px !important;
        overflow: visible !important;
    }

    .header-left .logo {
        display: flex !important;
        align-items: center !important;
        justify-content: flex-start !important;
        flex: 0 0 auto !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: 96px !important;
        margin-left: 1px !important;
        overflow: visible !important;
        pointer-events: auto !important;
    }

    .header-left .logo-text,
    .header .logo-text {
        display: inline-flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        font-size: .86rem !important;
        letter-spacing: .024em !important;
        line-height: 1 !important;
        padding: 1px 2px 4px 0 !important;
        transform: skewX(-6deg) scaleX(.98) !important;
        white-space: nowrap !important;
        max-width: none !important;
        overflow: visible !important;
        flex: 0 0 auto !important;
        text-shadow:
            1px 1px 0 rgba(64, 45, 143, 0.78),
            2px 2px 0 rgba(25, 20, 74, 0.48),
            0 0 6px rgba(124, 92, 255, 0.28) !important;
        filter: drop-shadow(0 0 4px rgba(124, 92, 255, 0.22)) !important;
    }

    .header-left .logo-text::before,
    .header .logo-text::before {
        transform: translate(2px, 3px) !important;
    }

    .header-left .logo-text::after,
    .header .logo-text::after {
        -webkit-text-stroke-width: 1.55px !important;
        transform: translate(.8px, .8px) !important;
        opacity: .78 !important;
    }

    
}

@media (max-width: 420px) {
    .header {
        gap: 5px !important;
    }

    .header-left {
        gap: 4px !important;
    }

    .header-left .logo {
        max-width: 82px !important;
    }

    .header-left .logo-text,
    .header .logo-text {
        font-size: .76rem !important;
        letter-spacing: .018em !important;
        transform: skewX(-6deg) scaleX(.95) !important;
        text-shadow:
            1px 1px 0 rgba(64, 45, 143, 0.72),
            0 0 5px rgba(124, 92, 255, 0.24) !important;
    }
}

@media (max-width: 360px) {
    .header-left .logo-text,
    .header .logo-text {
        font-size: .68rem !important;
        letter-spacing: .012em !important;
        transform: skewX(-6deg) scaleX(.92) !important;
    }
}

/* === Mobile bottom navigation: menu/deals/wallet/chats/profile ===
   One shared selection surface follows the existing active route in CSS only.
   No new listeners, wallet calls or route state. Keep the chat/keyboard guards. */
.mobile-bottom-nav {
    display: none;
}

/* A dragged route creates a temporary containing block. Hide its floating
   scroll control until the route returns to rest so it cannot jump over content. */
body[data-route-swipe-dragging="true"] #page-content .feed-scroll-nav {
    visibility: hidden;
}

/* Shared route swipe destination: feedback only; never intercepts a touch. */
.mobile-route-swipe-hint,
.mobile-route-swipe-hint[hidden] {
    display: none;
}

@media (max-width: 1024px) {
    .mobile-route-swipe-hint:not([hidden]) {
        position: fixed;
        z-index: 90;
        top: 50%;
        inset-inline-start: max(12px, env(safe-area-inset-left, 0px));
        display: inline-flex;
        align-items: center;
        gap: 8px;
        min-height: 44px;
        max-width: min(68vw, 280px);
        padding: 10px 14px;
        border: 1px solid var(--border-dark);
        border-radius: var(--radius-full);
        color: var(--text);
        background: var(--bg-modal);
        box-shadow: var(--shadow-lg);
        pointer-events: none;
        user-select: none;
        transform: translateY(-50%);
    }
    .mobile-route-swipe-hint[data-direction="forward"] {
        inset-inline-start: auto;
        inset-inline-end: max(12px, env(safe-area-inset-right, 0px));
    }
    .mobile-route-swipe-chevron {
        color: var(--primary-text);
        font-size: 25px;
        line-height: 1;
    }
    .mobile-route-swipe-label {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 13px;
        font-weight: 600;
    }
}

@media (max-width: 768px) {
    :root {
        --mobile-bottom-nav-h: 64px;
    }

    .mobile-bottom-nav {
        --mobile-bottom-nav-padding: 7px;
        --mobile-bottom-nav-gap: 4px;
        --mobile-bottom-selection-radius: 16px;
        --mobile-bottom-active-index: 0;
        --mobile-bottom-direction: 1;
        position: fixed;
        left: 10px;
        right: 10px;
        bottom: max(8px, env(safe-area-inset-bottom, 0px));
        height: var(--mobile-bottom-nav-h);
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        align-items: stretch;
        gap: var(--mobile-bottom-nav-gap);
        padding: var(--mobile-bottom-nav-padding);
        border-radius: 22px;
        border: 1px solid var(--border-dark);
        background: color-mix(in srgb, var(--bg-secondary) 94%, transparent);
        box-shadow: 0 6px 24px rgba(15, 23, 42, .12);
        backdrop-filter: blur(14px) saturate(1.1);
        -webkit-backdrop-filter: blur(14px) saturate(1.1);
        z-index: 860;
        pointer-events: auto;
    }

    /* The absolute surface and the grid share their padding/gap at every size.
       Logical inset + direction also keep the selection aligned in RTL shells. */
    .mobile-bottom-nav::before {
        content: "";
        position: absolute;
        inset-block: var(--mobile-bottom-nav-padding);
        inset-inline-start: var(--mobile-bottom-nav-padding);
        width: calc((100% - 2 * var(--mobile-bottom-nav-padding) - 4 * var(--mobile-bottom-nav-gap)) / 5);
        box-sizing: border-box;
        border: 1px solid color-mix(in srgb, var(--primary) 18%, transparent);
        border-radius: var(--mobile-bottom-selection-radius);
        background: color-mix(in srgb, var(--primary) 11%, transparent);
        box-shadow: none;
        opacity: 0;
        transform: translateX(calc(var(--mobile-bottom-active-index) * var(--mobile-bottom-direction) * (100% + var(--mobile-bottom-nav-gap))));
        transition: transform .32s cubic-bezier(.22, .8, .25, 1), opacity .16s ease;
        pointer-events: none;
        z-index: 0;
    }

    .mobile-bottom-nav:dir(rtl) {
        --mobile-bottom-direction: -1;
    }

    .mobile-bottom-nav:has(> [data-bottom-page="deals"].active) {
        --mobile-bottom-active-index: 1;
    }

    .mobile-bottom-nav:has(> [data-bottom-page="wallet"].active) {
        --mobile-bottom-active-index: 2;
    }

    .mobile-bottom-nav:has(> [data-bottom-page="chats"].active) {
        --mobile-bottom-active-index: 3;
    }

    .mobile-bottom-nav:has(> [data-bottom-page="profile"].active) {
        --mobile-bottom-active-index: 4;
    }

    .mobile-bottom-nav:has(> [data-bottom-page].active)::before {
        opacity: 1;
    }

    .mobile-bottom-item {
        position: relative;
        z-index: 1;
        min-width: 0;
        height: 100%;
        border: 0;
        outline: none;
        text-decoration: none;
        cursor: pointer;
        color: var(--text-muted);
        background: transparent;
        border-radius: 16px;
        display: inline-flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        font: inherit;
        -webkit-tap-highlight-color: transparent;
        transition: transform .16s ease, color .18s ease;
    }

    .mobile-bottom-item:focus-visible {
        outline: 2px solid var(--primary);
        outline-offset: -2px;
    }

    .mobile-bottom-item:active {
        transform: translateY(1px) scale(.98);
    }

    .mobile-bottom-item.active,
    .mobile-bottom-item[aria-current="page"] {
        color: var(--primary);
    }

    .mobile-bottom-icon {
        position: relative;
        width: 22px;
        height: 22px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 auto;
        transition: transform .26s cubic-bezier(.22, .8, .25, 1);
    }

    .mobile-bottom-item.active .mobile-bottom-icon {
        transform: translateY(-1px) scale(1.04);
    }

    .mobile-bottom-icon .mobile-profile-avatar,
    .mobile-bottom-icon .mobile-profile-avatar .person-avatar {
        display: inline-grid;
        place-items: center;
        width: 100%;
        height: 100%;
        border-radius: 50%;
        font-size: 12px;
        line-height: 1;
    }

    .mobile-bottom-item.active .mobile-profile-avatar {
        outline: 1.5px solid currentColor;
        outline-offset: 2px;
    }

    .mobile-bottom-icon svg {
        width: 21px;
        height: 21px;
        display: block;
    }

    .mobile-bottom-label {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 11px;
        line-height: 1.05;
        font-weight: 650;
        letter-spacing: -.01em;
    }

    .mobile-bottom-badge {
        position: absolute;
        top: -7px;
        right: -10px;
        min-width: 17px;
        height: 17px;
        padding: 0 4px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 999px;
        background: #ef4444;
        color: #fff;
        font-size: 10px;
        font-weight: 900;
        line-height: 1;
        box-shadow: 0 0 0 2px var(--bg-secondary);
    }

    .mobile-bottom-badge.hidden {
        display: none !important;
    }

    .app[data-page="auth"] .mobile-bottom-nav,
    .app[data-page="admin"] .mobile-bottom-nav,
    .app[data-page="admin/login"] .mobile-bottom-nav,
    .app[data-page="admin/withdrawals"] .mobile-bottom-nav,
    .app[data-page="admin/p2p"] .mobile-bottom-nav,
    .app[data-page="chats"].mobile-chat-open-app .mobile-bottom-nav,
    body.chat-keyboard-shift .app[data-page="chats"] .mobile-bottom-nav,
    body.chat-input-focused .app[data-page="chats"] .mobile-bottom-nav,
    body.chat-keyboard-closing .app[data-page="chats"] .mobile-bottom-nav {
        display: none !important;
        pointer-events: none !important;
    }

    .app:not([data-page="chats"]):not([data-page="auth"]):not([data-page^="admin"]) .page-content {
        padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)) !important;
    }

    .app[data-page="chats"]:not(.mobile-chat-open-app) .chats-sidebar,
    .app[data-page="chats"]:not(.mobile-chat-open-app) .page-content {
        padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px)) !important;
    }

    .app[data-page="chats"].mobile-chat-open-app .page-content,
    .app[data-page="chats"].mobile-chat-open-app .chats-sidebar {
        padding-bottom: 0 !important;
    }
}

@media (max-width: 360px) {
    .mobile-bottom-nav {
        left: 7px;
        right: 7px;
        height: 60px;
        border-radius: 20px;
        padding: 6px;
    }

    .mobile-bottom-label {
        font-size: 10px;
    }

    .mobile-bottom-icon,
    .mobile-bottom-icon svg {
        width: 20px;
        height: 20px;
    }
}


@media (prefers-reduced-motion: reduce) {
    .mobile-bottom-nav::before,
    .mobile-bottom-item,
    .mobile-bottom-icon {
        transition: none;
    }
}


/* === DEALIX mobile full-bleed + glass bottom nav hardfix ===
   Fixes the extra outer gutter around mobile pages and keeps the bottom nav
   from creating a dead scroll zone under the chat/dialog list. UI/CSS only. */
@media (max-width: 768px) {
    html,
    body {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow-x: hidden !important;
        background: var(--bg) !important;
    }

    #app,
    .app,
    .main-content {
        width: 100% !important;
        max-width: 100vw !important;
        min-width: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding: 0 !important;
        border-left: 0 !important;
        border-right: 0 !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
    }

    .page-content {
        width: 100% !important;
        max-width: none !important;
        min-width: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
    }

    /* Non-chat pages keep only the useful bottom breathing room for the nav. */
    .app:not([data-page="chats"]):not([data-page="auth"]):not([data-page^="admin"]) .page-content {
        padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)) !important;
    }

    /* Chat/dialog list: no fake bottom area on the container; only the list scrolls above nav. */
    .app[data-page="chats"]:not(.mobile-chat-open-app) .page-content,
    .app[data-page="chats"]:not(.mobile-chat-open-app) .chats-page,
    .app[data-page="chats"]:not(.mobile-chat-open-app) .chats-container,
    .app[data-page="chats"]:not(.mobile-chat-open-app) .chats-sidebar {
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        padding-bottom: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .app[data-page="chats"]:not(.mobile-chat-open-app) .chats-list {
        padding-left: 8px !important;
        padding-right: 8px !important;
        padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)) !important;
        scroll-padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)) !important;
    }

    :root {
        --mobile-bottom-nav-h: 58px;
    }

    .mobile-bottom-nav {
        left: max(5px, env(safe-area-inset-left, 0px)) !important;
        right: max(5px, env(safe-area-inset-right, 0px)) !important;
        bottom: max(3px, env(safe-area-inset-bottom, 0px)) !important;
        height: var(--mobile-bottom-nav-h) !important;
        padding: 5px !important;
        border-radius: 20px !important;
        gap: 3px !important;
    }

    body.theme-light .mobile-bottom-nav,
    html[data-theme="light"] body .mobile-bottom-nav {
        background: rgba(255, 255, 255, .94) !important;
        border-color: var(--border-dark) !important;
        box-shadow: 0 6px 24px rgba(15, 23, 42, .08) !important;
    }

    .mobile-bottom-item {
        border-radius: 16px !important;
        gap: 2px !important;
    }

    /* Selection is drawn once by ::before, not separately on each button. */
    body.theme-light .mobile-bottom-nav::before,
    html[data-theme="light"] body .mobile-bottom-nav::before {
        border-color: color-mix(in srgb, var(--primary) 18%, transparent);
        background: color-mix(in srgb, var(--primary) 9%, transparent);
        box-shadow: none;
    }

    .mobile-bottom-icon,
    .mobile-bottom-icon svg {
        width: 21px !important;
        height: 21px !important;
    }

    .mobile-bottom-label {
        font-size: 10.5px !important;
        line-height: 1 !important;
    }
}

@media (max-width: 360px) {
    .mobile-bottom-nav {
        left: 4px !important;
        right: 4px !important;
        height: 56px !important;
        border-radius: 18px !important;
    }
}

/* === Mobile gutters for pages without their own (2026-10-11) ===
   The full-bleed rule above removes the .page-content gutter on phones and
   leaves the side padding to each page. Listings and the feed never set one,
   so their rounded cards and the "Разместить" / "Публикация" buttons touched
   or were clipped by the screen edges. Same 10px gutter as the P2P shell. */
@media (max-width: 768px) {
    .listings-page,
    .feed-page.vk-feed-page {
        padding-left: 10px;
        padding-right: 10px;
    }
}

/* === DEALIX mobile chat composer compact-left + wider input fix ===
   CSS-only: slightly shifts attach/voice controls left and gives the text field more width.
   Does not touch chat JS, voice recording, file upload, send logic, keyboard handlers or backend. */
@media (max-width: 1024px) {
    .chats-page .chat-active .chat-input-area,
    body[data-page="chats"] .chat-active .chat-input-area {
        grid-template-columns: 40px 40px minmax(0, 1fr) 48px !important;
        gap: 6px !important;
        padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px)) 4px !important;
    }

    .chats-page .chat-active #attach-file-btn,
    .chats-page .chat-active #voice-record-btn,
    .chats-page .chat-active .chat-input-area > .btn.icon:not(#send-message-btn),
    .chats-page .chat-active .chat-input-actions .btn.icon:not(#send-message-btn) {
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
        min-height: 40px !important;
        flex-basis: 40px !important;
        transform: translateX(-2px) !important;
    }

    .chats-page .chat-active .chat-input-wrapper,
    body[data-page="chats"] .chat-active .chat-input-wrapper {
        min-width: 0 !important;
        min-height: 50px !important;
        padding: 0 14px !important;
    }

    .chats-page .chat-active .chat-input-wrapper textarea,
    .chats-page .chat-active #message-input {
        min-height: 48px !important;
        padding: 13px 34px 11px 0 !important;
    }

    .chats-page .chat-active #send-message-btn,
    .chats-page .chat-active .send-btn,
    .chats-page .chat-active .record-send-btn {
        width: 48px !important;
        height: 48px !important;
        min-width: 48px !important;
        min-height: 48px !important;
        flex-basis: 48px !important;
    }
}

/* === DEALIX mobile composer 14J: real tighter layout + wider first input ===
   Strong final override. Moves attach/voice controls a little closer to the left edge
   and gives the empty input capsule more width. CSS only: no JS, no upload/voice/send logic touched. */
@media (max-width: 1024px) {
    html body[data-page="chats"] .chat-active .chat-input-area,
    html body:not(.theme-light)[data-page="chats"] .chat-active .chat-input-area,
    html body.theme-light[data-page="chats"] .chat-active .chat-input-area,
    html body .chats-page .chat-active .chat-input-area {
        display: grid !important;
        grid-template-columns: 38px 38px minmax(0, 1fr) 46px !important;
        gap: 5px !important;
        padding: 7px 6px calc(7px + env(safe-area-inset-bottom, 0px)) 1px !important;
        align-items: end !important;
        box-sizing: border-box !important;
    }

    html body[data-page="chats"] .chat-active .chat-input-actions,
    html body .chats-page .chat-active .chat-input-actions {
        display: contents !important;
        gap: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    html body[data-page="chats"] .chat-active #attach-file-btn,
    html body[data-page="chats"] .chat-active #voice-record-btn,
    html body[data-page="chats"] .chat-active .chat-input-area > .btn.icon:not(#send-message-btn),
    html body[data-page="chats"] .chat-active .chat-input-actions .btn.icon:not(#send-message-btn),
    html body .chats-page .chat-active #attach-file-btn,
    html body .chats-page .chat-active #voice-record-btn,
    html body .chats-page .chat-active .chat-input-area > .btn.icon:not(#send-message-btn),
    html body .chats-page .chat-active .chat-input-actions .btn.icon:not(#send-message-btn) {
        width: 38px !important;
        height: 38px !important;
        min-width: 38px !important;
        min-height: 38px !important;
        flex: 0 0 38px !important;
        flex-basis: 38px !important;
        margin: 0 !important;
        transform: translateX(-1px) !important;
    }

    html body[data-page="chats"] .chat-active .chat-input-wrapper,
    html body:not(.theme-light)[data-page="chats"] .chat-active .chat-input-wrapper,
    html body.theme-light[data-page="chats"] .chat-active .chat-input-wrapper,
    html body .chats-page .chat-active .chat-input-wrapper {
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
        min-height: 48px !important;
        padding: 0 11px !important;
        margin: 0 !important;
        box-sizing: border-box !important;
    }

    html body[data-page="chats"] .chat-active .chat-input-wrapper textarea,
    html body[data-page="chats"] .chat-active #message-input,
    html body .chats-page .chat-active .chat-input-wrapper textarea,
    html body .chats-page .chat-active #message-input {
        width: 100% !important;
        min-width: 0 !important;
        min-height: 46px !important;
        padding: 13px 36px 11px 0 !important;
        box-sizing: border-box !important;
    }

    html body[data-page="chats"] .chat-active #send-message-btn,
    html body[data-page="chats"] .chat-active .send-btn,
    html body[data-page="chats"] .chat-active .record-send-btn,
    html body .chats-page .chat-active #send-message-btn,
    html body .chats-page .chat-active .send-btn,
    html body .chats-page .chat-active .record-send-btn {
        width: 46px !important;
        height: 46px !important;
        min-width: 46px !important;
        min-height: 46px !important;
        flex: 0 0 46px !important;
        flex-basis: 46px !important;
        margin: 0 !important;
    }
}

@media (max-width: 380px) {
    html body[data-page="chats"] .chat-active .chat-input-area,
    html body .chats-page .chat-active .chat-input-area {
        grid-template-columns: 36px 36px minmax(0, 1fr) 44px !important;
        gap: 4px !important;
        padding-left: 0 !important;
        padding-right: 5px !important;
    }

    html body[data-page="chats"] .chat-active #attach-file-btn,
    html body[data-page="chats"] .chat-active #voice-record-btn,
    html body[data-page="chats"] .chat-active .chat-input-area > .btn.icon:not(#send-message-btn),
    html body[data-page="chats"] .chat-active .chat-input-actions .btn.icon:not(#send-message-btn),
    html body .chats-page .chat-active #attach-file-btn,
    html body .chats-page .chat-active #voice-record-btn,
    html body .chats-page .chat-active .chat-input-area > .btn.icon:not(#send-message-btn),
    html body .chats-page .chat-active .chat-input-actions .btn.icon:not(#send-message-btn) {
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        min-height: 36px !important;
        flex-basis: 36px !important;
    }

    html body[data-page="chats"] .chat-active #send-message-btn,
    html body .chats-page .chat-active #send-message-btn {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        min-height: 44px !important;
        flex-basis: 44px !important;
    }
}

/* === DEALIX mobile composer 14K: rollback to stable flex + slightly wider input ===
   Fixes 14J grid regression: input was shrinking/janking on focus.
   CSS only: stable flex row, no display:contents/grid, no JS/voice/upload/send logic touched. */
@media (max-width: 1024px) {
    html body[data-page="chats"] .chat-active .chat-input-area,
    html body:not(.theme-light)[data-page="chats"] .chat-active .chat-input-area,
    html body.theme-light[data-page="chats"] .chat-active .chat-input-area,
    html body .chats-page .chat-active .chat-input-area {
        display: flex !important;
        grid-template-columns: none !important;
        align-items: center !important;
        justify-content: stretch !important;
        gap: 6px !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        min-height: 58px !important;
        padding: 7px 8px calc(7px + env(safe-area-inset-bottom, 0px)) 4px !important;
        box-sizing: border-box !important;
        contain: layout paint !important;
    }

    html body[data-page="chats"] .chat-active .chat-input-actions,
    html body .chats-page .chat-active .chat-input-actions {
        display: flex !important;
        flex: 0 0 auto !important;
        width: auto !important;
        min-width: 0 !important;
        gap: 4px !important;
        padding: 0 !important;
        margin: 0 !important;
        transform: translateX(-2px) !important;
        align-items: center !important;
        box-sizing: border-box !important;
    }

    html body[data-page="chats"] .chat-active #attach-file-btn,
    html body[data-page="chats"] .chat-active #voice-record-btn,
    html body[data-page="chats"] .chat-active .chat-input-actions .btn.icon:not(#send-message-btn),
    html body .chats-page .chat-active #attach-file-btn,
    html body .chats-page .chat-active #voice-record-btn,
    html body .chats-page .chat-active .chat-input-actions .btn.icon:not(#send-message-btn) {
        width: 42px !important;
        height: 42px !important;
        min-width: 42px !important;
        min-height: 42px !important;
        flex: 0 0 42px !important;
        flex-basis: 42px !important;
        margin: 0 !important;
        transform: none !important;
        box-sizing: border-box !important;
    }

    html body[data-page="chats"] .chat-active .chat-input-wrapper,
    html body:not(.theme-light)[data-page="chats"] .chat-active .chat-input-wrapper,
    html body.theme-light[data-page="chats"] .chat-active .chat-input-wrapper,
    html body .chats-page .chat-active .chat-input-wrapper {
        display: block !important;
        flex: 1 1 auto !important;
        flex-basis: auto !important;
        justify-self: auto !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
        min-height: 46px !important;
        margin: 0 !important;
        padding: 0 !important;
        box-sizing: border-box !important;
        border-width: 1px !important;
        transition: background .18s ease, box-shadow .18s ease, border-color .18s ease !important;
    }

    html body[data-page="chats"] .chat-active .chat-input-wrapper:focus-within,
    html body .chats-page .chat-active .chat-input-wrapper:focus-within {
        min-height: 46px !important;
        width: auto !important;
        flex: 1 1 auto !important;
    }

    html body[data-page="chats"] .chat-active .chat-input-wrapper textarea,
    html body[data-page="chats"] .chat-active #message-input,
    html body .chats-page .chat-active .chat-input-wrapper textarea,
    html body .chats-page .chat-active #message-input {
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        min-height: 44px !important;
        max-height: 96px !important;
        padding: 12px 34px 10px 14px !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        overflow-y: auto !important;
    }

    html body[data-page="chats"] .chat-active #send-message-btn,
    html body[data-page="chats"] .chat-active .send-btn,
    html body[data-page="chats"] .chat-active .record-send-btn,
    html body .chats-page .chat-active #send-message-btn,
    html body .chats-page .chat-active .send-btn,
    html body .chats-page .chat-active .record-send-btn {
        width: 46px !important;
        height: 46px !important;
        min-width: 46px !important;
        min-height: 46px !important;
        flex: 0 0 46px !important;
        flex-basis: 46px !important;
        margin: 0 !important;
        transform: none !important;
        box-sizing: border-box !important;
    }
}

@media (max-width: 380px) {
    html body[data-page="chats"] .chat-active .chat-input-area,
    html body .chats-page .chat-active .chat-input-area {
        display: flex !important;
        grid-template-columns: none !important;
        gap: 5px !important;
        padding-left: 3px !important;
        padding-right: 7px !important;
    }

    html body[data-page="chats"] .chat-active .chat-input-actions,
    html body .chats-page .chat-active .chat-input-actions {
        display: flex !important;
        gap: 3px !important;
        transform: translateX(-1px) !important;
    }

    html body[data-page="chats"] .chat-active #attach-file-btn,
    html body[data-page="chats"] .chat-active #voice-record-btn,
    html body .chats-page .chat-active #attach-file-btn,
    html body .chats-page .chat-active #voice-record-btn {
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
        min-height: 40px !important;
        flex-basis: 40px !important;
    }

    html body[data-page="chats"] .chat-active #send-message-btn,
    html body .chats-page .chat-active #send-message-btn {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        min-height: 44px !important;
        flex-basis: 44px !important;
    }
}

/* === DEALIX mobile composer 14L: no focus jump / no tiny bottom gap ===
   Fixes the regression where tapping the empty message field made the input,
   attach, voice and send buttons jump/reflow. CSS-only geometry stabilization;
   JS also keeps mobile-composer-expanded disabled on focus. */
@media (max-width: 1024px) {
    html body .app[data-page="chats"] .chat-active .chat-input-area,
    html body .chats-page .chat-active .chat-input-area,
    html body .app[data-page="chats"] .chat-active .chat-input-area.mobile-composer-expanded,
    html body .chats-page .chat-active .chat-input-area.mobile-composer-expanded {
        display: flex !important;
        grid-template-columns: none !important;
        align-items: center !important;
        justify-content: stretch !important;
        gap: 6px !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        height: 62px !important;
        min-height: 62px !important;
        max-height: 62px !important;
        padding: 8px 8px 8px 4px !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        overflow: visible !important;
        contain: none !important;
    }

    html body .app[data-page="chats"] .chat-active .chat-input-actions,
    html body .chats-page .chat-active .chat-input-actions,
    html body .app[data-page="chats"] .chat-active .chat-input-area.mobile-composer-expanded .chat-input-actions,
    html body .chats-page .chat-active .chat-input-area.mobile-composer-expanded .chat-input-actions {
        display: flex !important;
        flex: 0 0 auto !important;
        width: auto !important;
        min-width: 0 !important;
        gap: 4px !important;
        padding: 0 !important;
        margin: 0 !important;
        transform: translateX(-2px) !important;
        align-items: center !important;
        box-sizing: border-box !important;
    }

    html body .app[data-page="chats"] .chat-active #attach-file-btn,
    html body .app[data-page="chats"] .chat-active #voice-record-btn,
    html body .chats-page .chat-active #attach-file-btn,
    html body .chats-page .chat-active #voice-record-btn,
    html body .app[data-page="chats"] .chat-active .chat-input-actions .btn.icon:not(#send-message-btn),
    html body .chats-page .chat-active .chat-input-actions .btn.icon:not(#send-message-btn),
    html body .app[data-page="chats"] .chat-active .chat-input-area.mobile-composer-expanded #voice-record-btn:not(.recording),
    html body .chats-page .chat-active .chat-input-area.mobile-composer-expanded #voice-record-btn:not(.recording) {
        display: inline-flex !important;
        width: 42px !important;
        height: 42px !important;
        min-width: 42px !important;
        min-height: 42px !important;
        max-width: 42px !important;
        max-height: 42px !important;
        flex: 0 0 42px !important;
        flex-basis: 42px !important;
        margin: 0 !important;
        padding: 0 !important;
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
        overflow: visible !important;
        transform: none !important;
        box-sizing: border-box !important;
    }

    html body .app[data-page="chats"] .chat-active .chat-input-wrapper,
    html body .chats-page .chat-active .chat-input-wrapper,
    html body .app[data-page="chats"] .chat-active .chat-input-area.mobile-composer-expanded .chat-input-wrapper,
    html body .chats-page .chat-active .chat-input-area.mobile-composer-expanded .chat-input-wrapper,
    html body .app[data-page="chats"] .chat-active .chat-input-wrapper:focus-within,
    html body .chats-page .chat-active .chat-input-wrapper:focus-within {
        display: block !important;
        flex: 1 1 auto !important;
        flex-basis: auto !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
        height: 46px !important;
        min-height: 46px !important;
        max-height: 46px !important;
        margin: 0 !important;
        padding: 0 !important;
        box-sizing: border-box !important;
        border-radius: 999px !important;
        transition: background .18s ease, box-shadow .18s ease, border-color .18s ease !important;
        transform: none !important;
    }

    html body .app[data-page="chats"] .chat-active .chat-input-wrapper textarea,
    html body .app[data-page="chats"] .chat-active #message-input,
    html body .chats-page .chat-active .chat-input-wrapper textarea,
    html body .chats-page .chat-active #message-input,
    html body .app[data-page="chats"] .chat-active .chat-input-area.mobile-composer-expanded #message-input,
    html body .chats-page .chat-active .chat-input-area.mobile-composer-expanded #message-input {
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        height: 44px !important;
        min-height: 44px !important;
        max-height: 44px !important;
        padding: 12px 34px 10px 14px !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        overflow-y: auto !important;
        resize: none !important;
        transform: none !important;
    }

    html body .app[data-page="chats"] .chat-active #send-message-btn,
    html body .app[data-page="chats"] .chat-active .send-btn,
    html body .app[data-page="chats"] .chat-active .record-send-btn,
    html body .chats-page .chat-active #send-message-btn,
    html body .chats-page .chat-active .send-btn,
    html body .chats-page .chat-active .record-send-btn,
    html body .app[data-page="chats"] .chat-active .chat-input-area.mobile-composer-expanded #send-message-btn,
    html body .chats-page .chat-active .chat-input-area.mobile-composer-expanded #send-message-btn {
        width: 46px !important;
        height: 46px !important;
        min-width: 46px !important;
        min-height: 46px !important;
        max-width: 46px !important;
        max-height: 46px !important;
        flex: 0 0 46px !important;
        flex-basis: 46px !important;
        margin: 0 !important;
        transform: none !important;
        box-sizing: border-box !important;
    }

    /* Only the whole composer may move with the keyboard. Its internal geometry must stay fixed. */
    body.chat-input-focused .app[data-page="chats"] .chat-active .chat-input-area,
    body.chat-keyboard-shift .app[data-page="chats"] .chat-active .chat-input-area {
        height: 62px !important;
        min-height: 62px !important;
        max-height: 62px !important;
        padding-bottom: 8px !important;
    }

    body.chat-keyboard-shift .app[data-page="chats"] .chat-messages,
    body.chat-input-focused .app[data-page="chats"] .chat-messages {
        scroll-behavior: auto !important;
        overflow-anchor: none !important;
    }
}

/* === DEALIX mobile composer 14M: intentional expand, zero vertical jump ===
   Mobile behaviour restored: tapping the input expands it and hides the mic;
   blur/cancel returns the mic. The fix only freezes vertical geometry so the
   composer, icons and dialog do not jump, and removes the tiny bottom gap. */
@media (max-width: 1024px) {
    html body .app[data-page="chats"] .chat-active .chat-input-area,
    html body .chats-page .chat-active .chat-input-area,
    html body .app[data-page="chats"] .chat-active .chat-input-area.mobile-composer-expanded,
    html body .chats-page .chat-active .chat-input-area.mobile-composer-expanded {
        display: flex !important;
        align-items: center !important;
        justify-content: stretch !important;
        gap: 6px !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        height: 62px !important;
        min-height: 62px !important;
        max-height: 62px !important;
        padding: 8px 8px 8px 4px !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        overflow: visible !important;
        contain: none !important;
        transition: none !important;
    }

    /* Keyboard may lift the whole composer, but focus/expanded state must not
       add safe-area padding or a second strip under the input. */
    html body.chat-input-focused .app[data-page="chats"] .chat-active .chat-input-area,
    html body.chat-keyboard-shift .app[data-page="chats"] .chat-active .chat-input-area,
    html body.chat-input-focused .chats-page .chat-active .chat-input-area,
    html body.chat-keyboard-shift .chats-page .chat-active .chat-input-area {
        height: 62px !important;
        min-height: 62px !important;
        max-height: 62px !important;
        padding-top: 8px !important;
        padding-bottom: 8px !important;
        margin-bottom: 0 !important;
    }

    html body .app[data-page="chats"] .chat-active .chat-input-actions,
    html body .chats-page .chat-active .chat-input-actions,
    html body .app[data-page="chats"] .chat-active .chat-input-area.mobile-composer-expanded .chat-input-actions,
    html body .chats-page .chat-active .chat-input-area.mobile-composer-expanded .chat-input-actions {
        display: flex !important;
        flex: 0 0 auto !important;
        width: auto !important;
        min-width: 0 !important;
        gap: 4px !important;
        padding: 0 !important;
        margin: 0 !important;
        transform: translateX(-2px) !important;
        align-items: center !important;
        box-sizing: border-box !important;
        transition: none !important;
    }

    html body .app[data-page="chats"] .chat-active #attach-file-btn,
    html body .chats-page .chat-active #attach-file-btn,
    html body .app[data-page="chats"] .chat-active #voice-record-btn,
    html body .chats-page .chat-active #voice-record-btn {
        width: 42px !important;
        height: 42px !important;
        min-width: 42px !important;
        min-height: 42px !important;
        max-width: 42px !important;
        max-height: 42px !important;
        flex: 0 0 42px !important;
        margin: 0 !important;
        padding: 0 !important;
        transform: none !important;
        box-sizing: border-box !important;
    }

    /* Expanded/focused mobile state: hide the mic horizontally only. Do not
       change composer height, vertical alignment, padding, send size or textarea height. */
    html body .app[data-page="chats"] .chat-active .chat-input-area.mobile-composer-expanded #voice-record-btn:not(.recording),
    html body .chats-page .chat-active .chat-input-area.mobile-composer-expanded #voice-record-btn:not(.recording) {
        display: inline-flex !important;
        width: 0 !important;
        min-width: 0 !important;
        max-width: 0 !important;
        height: 42px !important;
        min-height: 42px !important;
        max-height: 42px !important;
        flex: 0 0 0 !important;
        flex-basis: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
        overflow: hidden !important;
        transform: none !important;
    }

    html body .app[data-page="chats"] .chat-active .chat-input-area.mobile-composer-expanded .chat-input-actions,
    html body .chats-page .chat-active .chat-input-area.mobile-composer-expanded .chat-input-actions {
        gap: 0 !important;
    }

    html body .app[data-page="chats"] .chat-active .chat-input-wrapper,
    html body .chats-page .chat-active .chat-input-wrapper,
    html body .app[data-page="chats"] .chat-active .chat-input-area.mobile-composer-expanded .chat-input-wrapper,
    html body .chats-page .chat-active .chat-input-area.mobile-composer-expanded .chat-input-wrapper,
    html body .app[data-page="chats"] .chat-active .chat-input-wrapper:focus-within,
    html body .chats-page .chat-active .chat-input-wrapper:focus-within {
        display: block !important;
        flex: 1 1 auto !important;
        flex-basis: auto !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
        height: 46px !important;
        min-height: 46px !important;
        max-height: 46px !important;
        margin: 0 !important;
        padding: 0 !important;
        box-sizing: border-box !important;
        border-radius: 999px !important;
        transform: none !important;
        transition: background .18s ease, box-shadow .18s ease, border-color .18s ease !important;
    }

    html body .app[data-page="chats"] .chat-active #message-input,
    html body .chats-page .chat-active #message-input,
    html body .app[data-page="chats"] .chat-active .chat-input-area.mobile-composer-expanded #message-input,
    html body .chats-page .chat-active .chat-input-area.mobile-composer-expanded #message-input {
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        height: 44px !important;
        min-height: 44px !important;
        max-height: 44px !important;
        padding: 12px 34px 10px 14px !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        overflow-y: auto !important;
        resize: none !important;
        transform: none !important;
        font-size: 16px !important;
    }

    html body .app[data-page="chats"] .chat-active #send-message-btn,
    html body .chats-page .chat-active #send-message-btn,
    html body .app[data-page="chats"] .chat-active .chat-input-area.mobile-composer-expanded #send-message-btn,
    html body .chats-page .chat-active .chat-input-area.mobile-composer-expanded #send-message-btn {
        width: 46px !important;
        height: 46px !important;
        min-width: 46px !important;
        min-height: 46px !important;
        max-width: 46px !important;
        max-height: 46px !important;
        flex: 0 0 46px !important;
        margin: 0 !important;
        transform: none !important;
        box-sizing: border-box !important;
        transition: background .18s ease, box-shadow .18s ease, opacity .18s ease !important;
    }

    html body .app[data-page="chats"] .chat-messages,
    html body .chats-page .chat-messages {
        overflow-anchor: none !important;
        scroll-behavior: auto !important;
    }
}

/* === DEALIX mobile composer 14N: first-tap no vertical jump / instant mic return ===
   Keep the intended UX: focus expands the input and hides the mic. The first
   focus frame must not lift the composer before the real keyboard gap exists. */
@media (max-width: 1024px) {
    html body.chat-input-focused:not(.chat-keyboard-shift) .app[data-page="chats"] .chat-active .chat-input-area,
    html body.chat-input-focused:not(.chat-keyboard-shift) .chats-page .chat-active .chat-input-area {
        transform: translate3d(0, 0, 0) !important;
        bottom: 0 !important;
        margin-bottom: 0 !important;
        padding-bottom: 8px !important;
    }

    html body .app[data-page="chats"] .chat-active #voice-record-btn,
    html body .chats-page .chat-active #voice-record-btn,
    html body .app[data-page="chats"] .chat-active .chat-input-actions,
    html body .chats-page .chat-active .chat-input-actions {
        transition: none !important;
    }

    html body .app[data-page="chats"] .chat-active .chat-input-area.mobile-composer-expanded #voice-record-btn:not(.recording),
    html body .chats-page .chat-active .chat-input-area.mobile-composer-expanded #voice-record-btn:not(.recording) {
        transition: none !important;
    }
}

/* === DEALIX mobile chat 14P: bottom anchor after manual keyboard close ===
   The mobile composer floats over the messages. When the user taps the dialog
   to close the keyboard, the browser restores viewport height before JS can
   re-anchor the last bubble. Keep a permanent mobile bottom reserve for the
   composer when the keyboard is not actively shifted, so the newest message
   cannot slide under the input/send button. */
@media (max-width: 1024px) {
    html body:not(.chat-keyboard-shift) .app[data-page="chats"] .chat-active .chat-messages,
    html body:not(.chat-keyboard-shift) .chats-page .chat-active .chat-messages {
        padding-bottom: max(104px, calc(var(--chat-composer-h, 62px) + 42px)) !important;
        scroll-padding-bottom: max(112px, calc(var(--chat-composer-h, 62px) + 50px)) !important;
        overflow-anchor: none !important;
        scroll-behavior: auto !important;
    }

    html body.chat-input-focused:not(.chat-keyboard-shift) .app[data-page="chats"] .chat-active .chat-messages,
    html body.chat-input-focused:not(.chat-keyboard-shift) .chats-page .chat-active .chat-messages,
    html body.chat-keyboard-closing:not(.chat-keyboard-shift) .app[data-page="chats"] .chat-active .chat-messages,
    html body.chat-keyboard-closing:not(.chat-keyboard-shift) .chats-page .chat-active .chat-messages {
        padding-bottom: max(104px, calc(var(--chat-composer-h, 62px) + 42px)) !important;
        scroll-padding-bottom: max(112px, calc(var(--chat-composer-h, 62px) + 50px)) !important;
    }
}


/* === DEALIX mobile chat 14Q: bottom-scroll ceiling ===
   Keep the manual blur bottom guard, but cap the natural scroll end so the
   newest message cannot be pulled far above the floating composer/send button. */
@media (max-width: 1024px) {
    html body:not(.chat-keyboard-shift) .app[data-page="chats"] .chat-active .chat-messages,
    html body:not(.chat-keyboard-shift) .chats-page .chat-active .chat-messages {
        padding-bottom: calc(max(76px, calc(var(--chat-composer-h, 62px) + 10px)) + var(--chat-composer-safe-extra, 0px)) !important;
        scroll-padding-bottom: calc(max(82px, calc(var(--chat-composer-h, 62px) + 16px)) + var(--chat-composer-safe-extra, 0px)) !important;
    }

    html body.chat-input-focused:not(.chat-keyboard-shift) .app[data-page="chats"] .chat-active .chat-messages,
    html body.chat-input-focused:not(.chat-keyboard-shift) .chats-page .chat-active .chat-messages,
    html body.chat-keyboard-closing:not(.chat-keyboard-shift) .app[data-page="chats"] .chat-active .chat-messages,
    html body.chat-keyboard-closing:not(.chat-keyboard-shift) .chats-page .chat-active .chat-messages {
        padding-bottom: calc(max(76px, calc(var(--chat-composer-h, 62px) + 10px)) + var(--chat-composer-safe-extra, 0px)) !important;
        scroll-padding-bottom: calc(max(82px, calc(var(--chat-composer-h, 62px) + 16px)) + var(--chat-composer-safe-extra, 0px)) !important;
    }

    html body:not(.chat-keyboard-shift) .app[data-page="chats"] .chat-active.reply-mode-active .chat-messages,
    html body:not(.chat-keyboard-shift) .chats-page .chat-active.reply-mode-active .chat-messages,
    html body.chat-input-focused:not(.chat-keyboard-shift) .app[data-page="chats"] .chat-active.reply-mode-active .chat-messages,
    html body.chat-input-focused:not(.chat-keyboard-shift) .chats-page .chat-active.reply-mode-active .chat-messages,
    html body.chat-keyboard-closing:not(.chat-keyboard-shift) .app[data-page="chats"] .chat-active.reply-mode-active .chat-messages,
    html body.chat-keyboard-closing:not(.chat-keyboard-shift) .chats-page .chat-active.reply-mode-active .chat-messages {
        padding-bottom: calc(max(130px, calc(var(--chat-composer-h, 62px) + var(--chat-reply-inline-h, 52px) + 16px)) + var(--chat-composer-safe-extra, 0px)) !important;
        scroll-padding-bottom: calc(max(136px, calc(var(--chat-composer-h, 62px) + var(--chat-reply-inline-h, 52px) + 22px)) + var(--chat-composer-safe-extra, 0px)) !important;
    }

    html body.chat-keyboard-shift .app[data-page="chats"] .chat-active.reply-mode-active .chat-messages,
    html body.chat-keyboard-shift .chats-page .chat-active.reply-mode-active .chat-messages,
    html body.chat-keyboard-shift.chat-mobile-send-settling .app[data-page="chats"] .chat-active.reply-mode-active .chat-messages,
    html body.chat-keyboard-shift.chat-mobile-send-settling .chats-page .chat-active.reply-mode-active .chat-messages {
        padding-bottom: calc(max(146px, calc(var(--chat-keyboard-shift, 0px) + var(--chat-reply-inline-h, 52px) + 28px)) + var(--chat-composer-safe-extra, 0px)) !important;
        scroll-padding-bottom: calc(max(154px, calc(var(--chat-keyboard-shift, 0px) + var(--chat-reply-inline-h, 52px) + 36px)) + var(--chat-composer-safe-extra, 0px)) !important;
    }
}

/* === DEALIX chat 14R: desktop bottom scroll ceiling ===
   The previous desktop guard reserved too much space under #chat-messages, so
   on wide screens the newest bubbles could be scrolled far above the composer.
   Keep only the real composer/send-button clearance: the last bubble stops near
   the top edge of the input/send button instead of floating high in the chat. */
@media (min-width: 1025px) {
    html body .app[data-page="chats"] .chat-active .chat-messages,
    html body .chats-page .chat-active .chat-messages,
    html body[data-page="chats"] .chat-active .chat-messages {
        padding-bottom: max(92px, calc(var(--chat-composer-h, 82px) + 10px)) !important;
        scroll-padding-bottom: max(100px, calc(var(--chat-composer-h, 82px) + 18px)) !important;
        overflow-anchor: none !important;
        scroll-behavior: auto !important;
    }
}

/* === DEALIX mobile bottom nav 14S: flush bottom / no extra strip ===
   The bottom tab bar was still floating a few pixels above the viewport and
   some page containers kept an extra safe-area/padding strip. Keep the nav in
   place, but pin it to the real bottom edge and reduce scroll-only reserve so
   the page no longer shows a second dead area under the menu at the end. */
@media (max-width: 768px) {
    :root {
        --mobile-bottom-nav-h: 58px;
    }

    html,
    body,
    #app,
    .app {
        padding-bottom: 0 !important;
        margin-bottom: 0 !important;
        min-height: 100dvh !important;
        overflow-x: hidden !important;
    }

    .mobile-bottom-nav {
        left: max(5px, env(safe-area-inset-left, 0px)) !important;
        right: max(5px, env(safe-area-inset-right, 0px)) !important;
        bottom: 0 !important;
        height: calc(var(--mobile-bottom-nav-h) + env(safe-area-inset-bottom, 0px)) !important;
        min-height: calc(var(--mobile-bottom-nav-h) + env(safe-area-inset-bottom, 0px)) !important;
        max-height: calc(var(--mobile-bottom-nav-h) + env(safe-area-inset-bottom, 0px)) !important;
        padding: 5px 5px max(5px, env(safe-area-inset-bottom, 0px)) !important;
        margin: 0 !important;
        border-bottom-left-radius: max(18px, env(safe-area-inset-bottom, 0px)) !important;
        border-bottom-right-radius: max(18px, env(safe-area-inset-bottom, 0px)) !important;
        transform: translateZ(0) !important;
        box-sizing: border-box !important;
    }

    /* Normal mobile pages: keep only enough scroll reserve for the fixed nav,
       not an extra blank strip below it. */
    .app:not([data-page="chats"]):not([data-page="auth"]):not([data-page^="admin"]) .page-content,
    .app:not([data-page="chats"]):not([data-page="auth"]):not([data-page^="admin"]) #page-content {
        padding-bottom: calc(var(--mobile-bottom-nav-h) + 8px + env(safe-area-inset-bottom, 0px)) !important;
        margin-bottom: 0 !important;
    }

    /* Dialog list page: reserve belongs only to the actual scrolling list. */
    .app[data-page="chats"]:not(.mobile-chat-open-app) .page-content,
    .app[data-page="chats"]:not(.mobile-chat-open-app) #page-content,
    .app[data-page="chats"]:not(.mobile-chat-open-app) .chats-page,
    .app[data-page="chats"]:not(.mobile-chat-open-app) .chats-container,
    .app[data-page="chats"]:not(.mobile-chat-open-app) .chats-sidebar {
        padding-bottom: 0 !important;
        margin-bottom: 0 !important;
    }

    .app[data-page="chats"]:not(.mobile-chat-open-app) .chats-list {
        padding-bottom: calc(var(--mobile-bottom-nav-h) + 8px + env(safe-area-inset-bottom, 0px)) !important;
        scroll-padding-bottom: calc(var(--mobile-bottom-nav-h) + 8px + env(safe-area-inset-bottom, 0px)) !important;
        margin-bottom: 0 !important;
    }

    /* When a real chat is opened the tab bar is hidden, so it must not leave
       any body/page reserve behind. */
    .app[data-page="chats"].mobile-chat-open-app .page-content,
    .app[data-page="chats"].mobile-chat-open-app #page-content,
    .app[data-page="chats"].mobile-chat-open-app .chats-page,
    .app[data-page="chats"].mobile-chat-open-app .chats-container,
    .app[data-page="chats"].mobile-chat-open-app .chats-sidebar {
        padding-bottom: 0 !important;
        margin-bottom: 0 !important;
    }
}

@media (max-width: 360px) {
    .mobile-bottom-nav {
        left: max(4px, env(safe-area-inset-left, 0px)) !important;
        right: max(4px, env(safe-area-inset-right, 0px)) !important;
        bottom: 0 !important;
        height: calc(56px + env(safe-area-inset-bottom, 0px)) !important;
        min-height: calc(56px + env(safe-area-inset-bottom, 0px)) !important;
        max-height: calc(56px + env(safe-area-inset-bottom, 0px)) !important;
    }
}

/* ===== DEALIX HOTFIX: disputes empty-state go-deals button underline cleanup ===== */
.disputes-empty-state a.btn,
.disputes-empty-state a.btn:link,
.disputes-empty-state a.btn:visited,
.disputes-empty-state a.btn:hover,
.disputes-empty-state a.btn:focus,
.disputes-empty-state a.btn:active {
    text-decoration: none !important;
    border-bottom: 0 !important;
    box-shadow: none;
}

.disputes-empty-state a.btn.primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 11px 18px;
    border-radius: 999px;
    background: linear-gradient(135deg, #7c3aed 0%, #5b7cfa 100%) !important;
    color: #fff !important;
    border: 1px solid rgba(255,255,255,.18) !important;
    box-shadow: 0 14px 30px rgba(124,58,237,.28), inset 0 1px 0 rgba(255,255,255,.22) !important;
}

.disputes-empty-state a.btn.primary:hover,
.disputes-empty-state a.btn.primary:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 18px 36px rgba(124,58,237,.34), inset 0 1px 0 rgba(255,255,255,.25) !important;
}

.disputes-empty-state a.btn.primary::before,
.disputes-empty-state a.btn.primary::after {
    display: none !important;
    content: none !important;
}

/* === DEALIX deals group count visibility fix ===
   Light theme override: a late generic deals text rule makes the counter white,
   so the number becomes washed out on the pale lavender badge. Keep dark theme
   untouched, but restore strong purple text/background for light pages. */
html body.theme-light .deals-page .deals-group-count,
html body.theme-light .deals-page .deals-group-header .deals-group-count,
html body.theme-light .deals-page .deals-group-header.toggle .deals-group-count {
    color: #4c1d95 !important;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.22), rgba(139, 92, 246, 0.14)) !important;
    border-color: rgba(109, 40, 217, 0.32) !important;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.72), 0 6px 16px rgba(109,40,217,0.13) !important;
    text-shadow: none !important;
    opacity: 1 !important;
    font-weight: 900 !important;
}

html body.theme-light .deals-page .deals-group-header.toggle:hover .deals-group-count,
html body.theme-light .deals-page .deals-group-header.toggle:focus-visible .deals-group-count {
    color: #ffffff !important;
    background: linear-gradient(135deg, #7c3aed, #8b5cf6) !important;
    border-color: rgba(124, 58, 237, 0.58) !important;
}

/* === DEALIX HOTFIX: compact mobile notification toasts ===
   Mobile-only: make the bottom-right toast smaller without touching desktop
   notification cards or the notifications page layout. */
@media (max-width: 720px) {
    html body .toast-container {
        left: auto !important;
        right: 12px !important;
        bottom: calc(14px + env(safe-area-inset-bottom, 0px)) !important;
        width: min(340px, calc(100vw - 32px)) !important;
        max-width: min(340px, calc(100vw - 32px)) !important;
        gap: 8px !important;
    }

    html body .toast-container .toast,
    html body .toast-container .toast.toast-new {
        width: 100% !important;
        min-height: 0 !important;
        grid-template-columns: 34px minmax(0, 1fr) 26px !important;
        gap: 8px !important;
        padding: 10px 10px 10px 12px !important;
        border-radius: 18px !important;
        box-shadow: 0 16px 42px rgba(15,23,42,.16), 0 6px 16px rgba(124,58,237,.09) !important;
    }

    html body .toast.toast-new::before {
        width: 4px !important;
    }

    html body .toast.toast-new .toast-icon {
        width: 34px !important;
        height: 34px !important;
        border-radius: 13px !important;
    }

    html body .toast.toast-new .toast-icon svg {
        width: 18px !important;
        height: 18px !important;
    }

    html body .toast.toast-new .toast-title {
        font-size: .84rem !important;
        line-height: 1.15 !important;
        margin-bottom: 2px !important;
    }

    html body .toast.toast-new .toast-message {
        font-size: .74rem !important;
        line-height: 1.25 !important;
        -webkit-line-clamp: 2 !important;
    }

    html body .toast.toast-new .toast-close {
        width: 26px !important;
        height: 26px !important;
        border-radius: 10px !important;
        padding: 0 !important;
        font-size: 14px !important;
    }
}

@media (max-width: 380px) {
    html body .toast-container {
        right: 10px !important;
        width: min(318px, calc(100vw - 24px)) !important;
        max-width: min(318px, calc(100vw - 24px)) !important;
    }
}

/* === DEALIX mobile profile: lift "Профиль / Инфо" closer to stats v2 ===
   UI-only: the section switcher still had too much vertical air under the four
   profile stats. Move the rounded switcher higher without changing its size or JS. */

/* === DEALIX mobile profile: lift stats row slightly ===
   UI-only: keep the Profile/Info switcher position, but raise the four stats
   buttons a little so there is a small breathing gap between stats and switcher. */


/* === DEALIX auth screens: Telegram-style layout (v3, replaces v1/v2) ===
   UI-only. Markup hooks come from ui/auth.js: .auth-page[data-auth-view]
   (qr | password | two-factor | register | register-code | recovery |
   two-factor-recovery), .auth-links/.auth-link, .auth-qr-*, and the existing
   form ids. Sign-in, registration, recovery, 2FA, QR and session logic are
   untouched. Older auth layers above (base, mobile zoom lock, system theme)
   still apply; rules here are scoped to .auth-page and use !important only
   where those layers already do. */
.auth-page {
    --auth-field-border: color-mix(in srgb, var(--text) 16%, transparent);
    --auth-field-border-hover: color-mix(in srgb, var(--text) 28%, transparent);
    --auth-field-bg: color-mix(in srgb, var(--bg-card) 70%, transparent);
    --auth-muted: var(--text-muted);
    --auth-link: var(--primary-text);
    --auth-pattern-color: linear-gradient(140deg,
        color-mix(in srgb, var(--primary) 70%, #ec4899) 0%,
        var(--primary) 48%,
        color-mix(in srgb, var(--primary) 62%, #22d3ee) 100%);
    /* The chat wallpaper image (same cached WebP files), used as a mask. */
    --auth-pattern-image: url('./assets/chat-pattern-premium.webp');
    position: relative !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    min-height: 100vh !important;
    min-height: 100dvh !important;
    padding: clamp(16px, 4vh, 40px) 16px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    isolation: isolate;
    background: var(--bg) !important;
}

/* Doodle wallpaper: the DEALIX deal/safety pattern used in chats, painted as a
   mask so it takes the accent colour of the current theme. */
.auth-page::before,
.auth-page::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
}

.auth-page::before {
    z-index: -2;
    display: block !important;
    background:
        radial-gradient(ellipse 70% 55% at 50% 0%, color-mix(in srgb, var(--primary) 14%, transparent), transparent 70%),
        radial-gradient(ellipse 60% 50% at 100% 100%, color-mix(in srgb, var(--primary) 10%, transparent), transparent 70%);
}

.auth-page::after {
    z-index: -1;
    width: auto;
    height: auto;
    border-radius: 0;
    filter: none;
    transform: none;
    opacity: .6;
    background: var(--auth-pattern-color);
    -webkit-mask: var(--auth-pattern-image) center top / 920px 920px repeat;
    mask: var(--auth-pattern-image) center top / 920px 920px repeat;
}

.auth-container {
    position: relative !important;
    width: min(420px, 100%) !important;
    max-width: 420px !important;
    min-height: 0 !important;
    display: block !important;
    margin: auto !important;
    padding: 36px 28px 20px !important;
    overflow: hidden !important;
    border: 1px solid var(--border) !important;
    border-radius: 28px !important;
    background: var(--bg-card) !important;
    box-shadow: 0 30px 80px rgba(0, 0, 0, .38), inset 0 1px 0 rgba(255, 255, 255, .05) !important;
    backdrop-filter: blur(18px) saturate(120%) !important;
    -webkit-backdrop-filter: blur(18px) saturate(120%) !important;
}

.auth-page .auth-tabs[hidden] {
    display: none !important;
}

/* Return to the app for a signed-in user who opened #auth?tab=register. */
.auth-back-app {
    position: absolute;
    inset-block-start: 14px;
    inset-inline-start: 14px;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background .16s ease, color .16s ease;
}

.auth-back-app:hover {
    background: color-mix(in srgb, var(--text) 8%, transparent);
    color: var(--text);
}

.auth-back-app:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

html[data-text-dir="rtl"] .auth-back-app svg,
html[data-text-dir="rtl"] .auth-link-chevron {
    transform: scaleX(-1);
}

/* ----- Header: logo, title, subtitle ----- */
.auth-page .auth-container .auth-header {
    position: relative !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;
    min-height: 0 !important;
    margin: 0 0 22px !important;
    padding: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    text-align: center !important;
}

.auth-page .auth-header::before,
.auth-page .auth-header::after {
    display: none !important;
    content: none !important;
}

.auth-page[data-auth-view="qr"] .auth-container .auth-header {
    display: none !important;
}

.auth-page .auth-header .logo {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 0 !important;
    margin: 0 0 8px !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

.auth-page .auth-header .logo-text {
    display: none !important;
}

.auth-page .auth-header .logo-icon {
    display: grid !important;
    place-items: center !important;
    width: 104px !important;
    height: 104px !important;
    overflow: hidden !important;
    border: 0 !important;
    border-radius: 50% !important;
    background: #0d0b16 !important;
    color: transparent !important;
    font-size: 0 !important;
    box-shadow: 0 16px 40px color-mix(in srgb, var(--primary) 32%, transparent), 0 0 0 1px color-mix(in srgb, var(--primary) 30%, transparent) !important;
}

.auth-page .auth-header .logo-icon[data-brand-mark-slot] > img,
.account-add-brand-mark[data-brand-mark-slot] > img,
.auth-qr-badge > img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scale(1.1);
    user-select: none;
    -webkit-user-drag: none;
}

.auth-page .auth-title {
    max-width: 340px;
    margin: 0 !important;
    color: var(--text) !important;
    background: none !important;
    -webkit-text-fill-color: currentColor !important;
    text-shadow: none !important;
    font-size: 1.6rem !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
    letter-spacing: -.02em !important;
    overflow-wrap: anywhere;
    text-wrap: balance;
}

.auth-page .auth-subtitle {
    max-width: 320px;
    margin: 0 !important;
    color: var(--auth-muted) !important;
    font-size: .95rem !important;
    font-weight: 450 !important;
    line-height: 1.45 !important;
    letter-spacing: 0 !important;
    text-align: center !important;
    text-wrap: balance;
}

.auth-page .auth-subtitle[hidden] {
    display: none !important;
}

.auth-page .auth-content {
    padding: 0 !important;
    overflow: visible !important;
}

/* ----- Forms and fields (label inside the outlined box) ----- */
.auth-page .auth-form {
    display: grid !important;
    gap: 14px !important;
    margin: 0 !important;
}

.auth-page .auth-form.hidden,
.auth-page .auth-form .hidden {
    display: none !important;
}

.auth-page .auth-form .form-group {
    position: relative;
    margin: 0 !important;
}

/* Wrappers that hold several fields of one recovery step. */
.auth-page :is(#recovery-password-group, #two-factor-recovery-credentials-group, #two-factor-recovery-password-group) {
    display: grid;
    gap: 14px;
}

.auth-page .auth-form .form-group > .form-label {
    position: absolute;
    inset-block-start: 8px;
    inset-inline-start: 17px;
    z-index: 1;
    display: block !important;
    max-width: calc(100% - 34px);
    margin: 0 !important;
    overflow: hidden;
    color: var(--auth-muted) !important;
    font-size: .74rem !important;
    font-weight: 600 !important;
    line-height: 1.1 !important;
    letter-spacing: 0 !important;
    white-space: nowrap;
    text-overflow: ellipsis;
    pointer-events: none;
    transition: color .16s ease;
}

.auth-page .auth-form .form-group > .input {
    display: block;
    width: 100%;
    height: 58px !important;
    min-height: 58px !important;
    padding: 24px 16px 8px !important;
    border: 1px solid var(--auth-field-border) !important;
    border-radius: 14px !important;
    background: var(--auth-field-bg) !important;
    color: var(--text) !important;
    box-shadow: none !important;
    font-size: 1rem !important;
    line-height: 1.3 !important;
    transition: border-color .16s ease, box-shadow .16s ease;
}

.auth-page .auth-form .form-group > .input::placeholder {
    color: color-mix(in srgb, var(--text-muted) 70%, transparent) !important;
}

.auth-page .auth-form .form-group > .input:hover {
    border-color: var(--auth-field-border-hover) !important;
}

.auth-page .auth-form .form-group > .input:focus {
    outline: none;
    border-color: var(--primary) !important;
    box-shadow: inset 0 0 0 1px var(--primary) !important;
}

.auth-page .auth-form .form-group:focus-within > .form-label {
    color: var(--auth-link) !important;
}

.auth-page .auth-form .form-group.is-invalid > .input {
    border-color: var(--danger) !important;
    box-shadow: inset 0 0 0 1px var(--danger) !important;
    animation: auth-field-shake .32s ease;
}

.auth-page .auth-form .form-group.is-invalid > .form-label {
    color: var(--danger) !important;
}

@keyframes auth-field-shake {
    20%, 60% { transform: translateX(-4px); }
    40%, 80% { transform: translateX(4px); }
}

.auth-page .auth-form .form-hint,
.auth-page .auth-remember-hint {
    margin: 6px 4px 0 !important;
    color: var(--auth-muted) !important;
    font-size: .8rem !important;
    font-weight: 450 !important;
    line-height: 1.4 !important;
}

.auth-page .auth-code-input {
    text-align: center !important;
    padding-inline: 16px !important;
    font-size: 1.4rem !important;
    font-weight: 700 !important;
    letter-spacing: .42em !important;
    font-variant-numeric: tabular-nums;
}

.auth-page .auth-code-input::placeholder {
    letter-spacing: .42em !important;
}

.auth-page .auth-remember-row,
.auth-page .auth-form .checkbox {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    margin: 0 !important;
    padding: 4px 4px !important;
    border: 0 !important;
    border-radius: 10px !important;
    background: transparent !important;
    color: var(--text) !important;
    font-size: .92rem !important;
    font-weight: 500 !important;
    line-height: 1.35 !important;
    cursor: pointer;
}

.auth-page .auth-remember-checkbox,
.auth-page .auth-form .checkbox input[type="checkbox"] {
    width: 20px !important;
    height: 20px !important;
    margin: 0 !important;
    flex: 0 0 auto !important;
    accent-color: var(--primary) !important;
}

.auth-page .auth-remember-hint {
    margin-top: -8px !important;
    padding-inline-start: 36px;
    text-align: start;
}

.auth-page .auth-form .text-link {
    color: var(--auth-link) !important;
    font-weight: 600 !important;
    text-decoration: none !important;
}

.auth-page .auth-form .text-link:hover {
    text-decoration: underline !important;
}

/* ----- Buttons ----- */
.auth-page .auth-form .btn.primary.fullwidth {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px;
    width: 100%;
    min-height: 54px !important;
    margin-top: 4px;
    border: 0 !important;
    border-radius: 14px !important;
    background: var(--primary-grad) !important;
    color: #fff !important;
    box-shadow: 0 10px 26px color-mix(in srgb, var(--primary) 26%, transparent) !important;
    font-size: .98rem !important;
    font-weight: 700 !important;
    letter-spacing: .04em !important;
    text-transform: uppercase;
    transition: filter .16s ease, transform .16s ease, box-shadow .16s ease !important;
}

.auth-page .auth-form .btn.primary.fullwidth:hover:not(:disabled) {
    transform: none !important;
    filter: brightness(1.08);
    box-shadow: 0 14px 32px color-mix(in srgb, var(--primary) 34%, transparent) !important;
}

.auth-page .auth-form .btn.primary.fullwidth:active:not(:disabled) {
    transform: scale(.99) !important;
}

.auth-page .auth-form .btn.primary.fullwidth:disabled {
    opacity: .78;
    cursor: progress;
}

/* Request in flight: the button is disabled by the existing handler. */
.auth-page .auth-form .btn.primary.fullwidth:disabled::after,
.account-add-body .btn.primary:disabled::after {
    content: '';
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    border: 2px solid rgba(255, 255, 255, .45);
    border-top-color: #fff;
    border-radius: 50%;
    animation: auth-spin .75s linear infinite;
}

.auth-page .auth-form .btn.secondary.fullwidth,
.auth-page .auth-form .btn.ghost.fullwidth,
.auth-page .qr-signin-panel .btn.fullwidth {
    width: auto !important;
    min-height: 42px !important;
    margin: 4px auto 0 !important;
    padding: 8px 16px !important;
    border: 0 !important;
    border-radius: 12px !important;
    background: transparent !important;
    color: var(--auth-link) !important;
    box-shadow: none !important;
    font-size: .88rem !important;
    font-weight: 600 !important;
    transform: none !important;
}

.auth-page .auth-form .btn.secondary.fullwidth:hover:not(:disabled),
.auth-page .auth-form .btn.ghost.fullwidth:hover:not(:disabled),
.auth-page .qr-signin-panel .btn.fullwidth:hover:not(:disabled) {
    background: color-mix(in srgb, var(--primary) 12%, transparent) !important;
}

.auth-page .auth-form .btn.secondary.fullwidth:disabled {
    color: var(--auth-muted) !important;
    opacity: 1;
}

.auth-page .form-group > .btn.secondary.fullwidth:not(.hidden),
.auth-page .form-group > .btn.ghost.fullwidth:not(.hidden) {
    display: flex !important;
}

/* Telegram-style text actions under the main button. */
.auth-page .auth-links {
    display: grid;
    justify-items: center;
    gap: 2px;
    margin-top: 6px;
}

.auth-page .auth-links-inline,
.auth-page .auth-2fa-links {
    margin-top: 0;
}

.auth-page .auth-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    max-width: 100%;
    min-height: 44px;
    padding: 8px 14px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--auth-link);
    font: inherit;
    font-size: .88rem;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: .035em;
    text-align: center;
    text-transform: uppercase;
    cursor: pointer;
    transition: background .16s ease, color .16s ease;
}

.auth-page .auth-link:hover {
    background: color-mix(in srgb, var(--primary) 12%, transparent);
}

.auth-page .auth-link:focus-visible,
.auth-page .auth-form .btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.auth-link-chevron {
    flex: 0 0 auto;
    margin-inline-start: 2px;
}

/* ----- QR view ----- */
.auth-page .auth-qr-view {
    display: grid !important;
    justify-items: center;
    gap: 0;
    text-align: center;
}

.auth-page .auth-qr-view.hidden {
    display: none !important;
}

.auth-page .auth-qr-view .qr-signin-panel {
    display: grid;
    justify-items: center;
    gap: 10px;
    width: 100%;
    margin: 0;
}

.auth-qr-frame {
    position: relative;
    width: min(248px, 100%);
    aspect-ratio: 1;
}

.auth-page .qr-signin-code {
    display: grid !important;
    place-items: center;
    width: 100% !important;
    height: 100% !important;
    padding: 12px !important;
    border: 0;
    border-radius: 26px !important;
    background: #fff !important;
    box-shadow: 0 18px 44px rgba(0, 0, 0, .26);
    transition: background .2s ease;
}

.auth-page .qr-signin-code:empty {
    background: color-mix(in srgb, var(--text) 7%, transparent) !important;
    box-shadow: inset 0 0 0 1px var(--border);
}

.auth-page .qr-signin-code.is-loading:empty::before {
    content: '';
    width: 36px;
    height: 36px;
    border: 3px solid color-mix(in srgb, var(--text) 18%, transparent);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: auth-spin .8s linear infinite;
}

/* DEALIX mark in the middle of the code (error correction level Q). */
.auth-qr-badge {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 21%;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 50%;
    background: #0d0b16;
    box-shadow: 0 0 0 4px #fff;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.auth-page .qr-signin-code:empty + .auth-qr-badge {
    display: none;
}

.auth-page .auth-qr-view .qr-signin-status {
    min-height: 0;
    margin-top: 2px;
    color: var(--auth-muted);
    font-size: .84rem;
    line-height: 1.4;
}

.auth-page .auth-qr-view .qr-signin-status:empty {
    display: none;
}

.auth-page .auth-qr-view .qr-signin-status.is-error { color: var(--danger); }
.auth-page .auth-qr-view .qr-signin-status.is-warn { color: #f59e0b; }
.auth-page .auth-qr-view .qr-signin-status.is-ok { color: var(--success); }

.auth-page .auth-qr-copy {
    max-width: 340px;
    margin-top: 22px;
}

.auth-page .auth-qr-copy h2 {
    margin: 0 0 8px;
    color: var(--text);
    font-size: 1.45rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -.02em;
}

.auth-page .auth-qr-copy p {
    margin: 0;
    color: var(--auth-muted);
    font-size: .95rem;
    line-height: 1.45;
}

.auth-qr-steps {
    display: grid;
    gap: 12px;
    width: 100%;
    max-width: 340px;
    margin: 20px 0 8px;
    padding: 0;
    list-style: none;
    counter-reset: auth-qr-step;
    text-align: start;
}

.auth-qr-steps li {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    color: var(--text);
    font-size: .95rem;
    line-height: 1.4;
    counter-increment: auth-qr-step;
}

.auth-qr-steps li::before {
    content: counter(auth-qr-step);
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    margin-top: -1px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--primary) 22%, transparent);
    color: var(--auth-link);
    font-size: .78rem;
    font-weight: 700;
}

/* ----- Per-view composition ----- */
.auth-page:not([data-auth-view="qr"]):not([data-auth-view="password"]) .auth-recent {
    display: none !important;
}

.auth-page[data-auth-view="two-factor"] :is(.auth-credential-group, .auth-remember-row, .auth-remember-hint, .auth-login-links) {
    display: none !important;
}

.auth-page:not([data-auth-view="two-factor"]) .auth-2fa-links {
    display: none !important;
}

.auth-page[data-auth-view="register-code"] :is(.auth-register-fields, #register-code-hint) {
    display: none !important;
}

.auth-page:not([data-auth-view="register-code"]) #register-edit-btn {
    display: none !important;
}

.auth-page .auth-security-note {
    display: block !important;
    margin: -8px 0 2px !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: none !important;
    box-shadow: none !important;
    text-align: center;
}

.auth-page .auth-security-note::before,
.auth-page .auth-security-note strong {
    display: none !important;
}

.auth-page .auth-security-note span {
    color: var(--auth-muted) !important;
    font-size: .95rem !important;
    line-height: 1.45 !important;
}

/* ----- Recent accounts (login prefill only) ----- */
.auth-page .auth-recent.has-items {
    margin: 0 0 18px;
}

.auth-page[data-auth-view="qr"] .auth-recent.has-items {
    margin: 18px 0 0;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.auth-page .auth-recent-title {
    margin: 0 4px 8px;
    color: var(--auth-muted);
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .04em;
}

.auth-page .auth-recent-item {
    padding: 8px 10px;
    border: 0;
    border-radius: 12px;
    background: transparent;
}

.auth-page .auth-recent-item:hover,
.auth-page .auth-recent-item:focus-visible {
    border: 0;
    background: color-mix(in srgb, var(--text) 7%, transparent);
}

.auth-page .auth-recent-avatar {
    background-color: color-mix(in srgb, var(--primary) 30%, transparent);
    color: #fff;
}

.auth-page .auth-recent-hint {
    margin: 6px 4px 0;
}

/* ----- Footer ----- */
.auth-page .auth-footer {
    margin-top: 18px !important;
    padding: 0 !important;
    text-align: center !important;
}

.auth-page .auth-footer p {
    margin: 0 !important;
    color: color-mix(in srgb, var(--text-muted) 80%, transparent) !important;
    font-size: .76rem !important;
}

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

/* ----- Light theme ----- */
body.theme-light .auth-page,
html[data-theme="light"] body .auth-page {
    --auth-field-border: rgba(15, 23, 42, .16);
    --auth-field-border-hover: rgba(15, 23, 42, .3);
    --auth-field-bg: #fff;
    background: linear-gradient(160deg, #eef0ff 0%, #f6f3ff 46%, #eaf6ff 100%) !important;
}

body.theme-light .auth-page::after,
html[data-theme="light"] body .auth-page::after {
    opacity: .5;
}

body.theme-light .auth-container,
html[data-theme="light"] body .auth-container {
    border-color: rgba(15, 23, 42, .06) !important;
    background: rgba(255, 255, 255, .94) !important;
    box-shadow: 0 24px 64px rgba(30, 27, 75, .14) !important;
}

body.theme-light .auth-page .auth-header .logo-icon,
html[data-theme="light"] body .auth-page .auth-header .logo-icon {
    box-shadow: 0 16px 36px rgba(79, 70, 229, .26) !important;
}

body.theme-light .auth-page .qr-signin-code,
html[data-theme="light"] body .auth-page .qr-signin-code {
    box-shadow: 0 0 0 1px rgba(15, 23, 42, .08), 0 14px 34px rgba(30, 27, 75, .12);
}

/* ----- Responsive ----- */
@media (max-width: 768px) {
    .auth-page {
        --auth-pattern-image: url('./assets/chat-pattern-premium-mobile.webp');
    }

    .auth-page::after {
        -webkit-mask-size: 620px 620px;
        mask-size: 620px 620px;
    }
}

@media (max-width: 480px) {
    /* Top inset leaves room for the floating theme button above the card. */
    .auth-page {
        padding: max(70px, calc(env(safe-area-inset-top) + 64px)) max(10px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)) !important;
    }

    .auth-page .auth-container {
        width: 100% !important;
        max-width: 100% !important;
        padding: 30px 18px 16px !important;
        border-radius: 24px !important;
    }

    .auth-page .auth-header .logo-icon {
        width: 88px !important;
        height: 88px !important;
    }

    .auth-page .auth-title {
        font-size: 1.42rem !important;
    }

    .auth-qr-frame {
        width: min(224px, 100%);
    }

    .auth-page .auth-qr-copy h2 {
        font-size: 1.3rem;
    }

    .auth-page .auth-link {
        font-size: .84rem;
        padding-inline: 10px;
    }
}

@media (max-width: 360px) {
    .auth-page .auth-container {
        padding: 26px 14px 14px !important;
    }

    .auth-page .auth-header .logo-icon {
        width: 76px !important;
        height: 76px !important;
    }

    .auth-qr-frame {
        width: min(204px, 100%);
    }
}

/* Short landscape screens: the card scrolls inside the page, never clipped. */
@media (max-height: 560px) and (orientation: landscape) {
    .auth-page .auth-header .logo-icon {
        width: 64px !important;
        height: 64px !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-page .qr-signin-code.is-loading:empty::before,
    .auth-page .auth-form .btn.primary.fullwidth:disabled::after,
    .account-add-body .btn.primary:disabled::after {
        animation-duration: 2.4s;
    }

    .auth-page .auth-form .form-group.is-invalid > .input {
        animation: none;
    }

    .auth-page .auth-link,
    .auth-page .auth-form .btn,
    .auth-page .auth-form .form-group > .input {
        transition: none !important;
    }
}

/* Treat the sign-in route as a focused screen: retain the current theme
   control, while removing unrelated app chrome only during authentication. */
#app:has(#page-content .auth-page) {
    position: relative;
    display: grid !important;
    grid-template-areas: "main" !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: minmax(0, 1fr) !important;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    min-height: 100vh;
    min-height: 100dvh;
}

#app:has(#page-content .auth-page) > #header-access-btn,
#app:has(#page-content .auth-page) > #desktop-shell-nav,
#app:has(#page-content .auth-page) > #mobile-bottom-nav {
    display: none !important;
}

#app:has(#page-content .auth-page) > #global-header {
    position: absolute !important;
    inset-block-start: max(14px, env(safe-area-inset-top)) !important;
    inset-inline-end: max(14px, env(safe-area-inset-right)) !important;
    z-index: 1000 !important;
    display: flex !important;
    width: auto !important;
    height: auto !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

#app:has(#page-content .auth-page) > #global-header :is(.header-search, .header-center),
#app:has(#page-content .auth-page) > #global-header .header-right > :not(#theme-toggle) {
    display: none !important;
}

#app:has(#page-content .auth-page) > #global-header .header-right {
    gap: 0 !important;
    margin: 0 !important;
}

#app:has(#page-content .auth-page) > #global-header #theme-toggle {
    display: grid !important;
    width: 44px !important;
    height: 44px !important;
    padding: 0 !important;
    place-items: center !important;
    border: 0 !important;
    border-radius: 50% !important;
    background: color-mix(in srgb, var(--primary) 26%, var(--bg-card)) !important;
    color: var(--text) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .22) !important;
}

#app:has(#page-content .auth-page) #main-content {
    grid-area: main !important;
    width: 100% !important;
    height: 100vh !important;
    height: 100dvh !important;
    min-height: 0 !important;
    padding: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
}

#app:has(#page-content .auth-page) #page-content {
    width: 100% !important;
    max-width: none !important;
    min-height: 100vh !important;
    min-height: 100dvh !important;
    margin: 0 !important;
    padding: 0 !important;
}


/* === DEALIX precise patch: typography + blacklist icon only ===
   Scope: fonts/typographic rhythm and the blacklist settings icon.
   No layout, no effects, no chat/deals/mobile geometry changes. */
:root {
    --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
}

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

body,
button,
input,
textarea,
select {
    font-family: var(--font-sans) !important;
    font-feature-settings: 'kern' 1, 'liga' 1, 'calt' 1;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-weight: 400;
    letter-spacing: -0.011em;
}

h1,
h2,
h3,
h4,
h5,
h6,
.auth-title,
.card-title,
.modal-title,
.profile-name,
.profile-settings-section summary b,
.info-card h3,
.chats-sidebar-header h2,
.chat-peer-name,
.deal-item-title,
.dispute-title h3 {
    font-family: var(--font-sans) !important;
    font-weight: 700;
    letter-spacing: -0.028em;
    line-height: 1.12;
}

p,
small,
.form-hint,
.auth-subtitle,
.profile-bio,
.profile-settings-section summary small,
.profile-toggle-row small,
.chat-item-preview,
.message-content,
.toast-message,
.payment-desc {
    font-family: var(--font-sans) !important;
    letter-spacing: -0.006em;
    line-height: 1.45;
}

.btn,
.badge,
.sidebar-item,
.profile-tab,
.security-tab,
.admin-tab,
.auth-tab,
.filter-tab,
.dropdown-item,
.deal-open-btn,
.chat-item-name,
.payment-title,
.toast-title,
.form-label,
.user-mini-name {
    font-family: var(--font-sans) !important;
    font-weight: 600;
    letter-spacing: -0.012em;
}

.input,
.textarea,
.select,
textarea,
input,
select {
    font-family: var(--font-sans) !important;
    font-weight: 400;
    letter-spacing: -0.009em;
    line-height: 1.35;
}

.input::placeholder,
.textarea::placeholder,
textarea::placeholder,
input::placeholder {
    font-family: var(--font-sans) !important;
    font-weight: 400;
    letter-spacing: -0.006em;
}

.stat-value,
.stat-value-new,
.balance-value,
.deal-item-amount,
.user-mini-balance,
.wallet-balance,
.amount,
.price,
.crypto-amount {
    font-family: var(--font-sans) !important;
    font-variant-numeric: tabular-nums;
    font-feature-settings: 'tnum' 1, 'kern' 1;
    letter-spacing: -0.024em;
}

/* Blacklist settings icon: clean blocked/ban mark, CSS-only. */
.profile-settings-section[data-profile-settings-section="blocklist"] .profile-settings-summary-icon,
details[data-profile-settings-section="blocklist"] .profile-settings-summary-icon {
    position: relative;
    color: var(--danger);
}

.profile-settings-section[data-profile-settings-section="blocklist"] .profile-settings-summary-icon svg,
details[data-profile-settings-section="blocklist"] .profile-settings-summary-icon svg {
    display: none !important;
}

.profile-settings-section[data-profile-settings-section="blocklist"] .profile-settings-summary-icon::before,
details[data-profile-settings-section="blocklist"] .profile-settings-summary-icon::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 19px;
    height: 19px;
    border: 2px solid currentColor;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-sizing: border-box;
}

.profile-settings-section[data-profile-settings-section="blocklist"] .profile-settings-summary-icon::after,
details[data-profile-settings-section="blocklist"] .profile-settings-summary-icon::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
    transform: translate(-50%, -50%) rotate(-45deg);
}

/* === DEALIX typography + button text pass only ===
   Scope: fonts, font weights, line-height, letter spacing and button text rhythm only.
   No layout, no card/header/chat geometry, no shadows, no gradients, no effects. */
:root {
    --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    --font-mono: 'SF Mono', 'Cascadia Mono', 'Roboto Mono', Consolas, monospace;
}

html,
body,
button,
input,
select,
textarea {
    font-family: var(--font-sans) !important;
    font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
    text-rendering: optimizeLegibility;
}

body {
    font-weight: 450;
    letter-spacing: -0.011em;
}

h1,
h2,
h3,
h4,
h5,
h6,
.page-title,
.card-title,
.modal-title,
.auth-title,
.profile-name,
.chat-peer-name,
.deal-item-title,
.feed-composer-title b,
.post-author,
.user-mini-name {
    font-weight: 720 !important;
    letter-spacing: -0.026em;
    line-height: 1.12;
}

h1,
.page-title {
    font-weight: 760 !important;
    letter-spacing: -0.034em;
}

h2,
.section-title {
    letter-spacing: -0.030em;
}

h3,
.card-title,
.modal-title {
    letter-spacing: -0.024em;
}

p,
small,
.form-hint,
.text-muted,
.text-secondary,
.auth-subtitle,
.profile-bio,
.chat-item-preview,
.message-content,
.toast-message,
.payment-desc,
.balance-label,
.stat-label,
.status-label{
    letter-spacing: -0.006em;
    line-height: 1.48;
}

small,
.form-hint,
.text-muted,
.chat-item-time,
.message-time,
.badge,
.sidebar-label,
.payment-desc,
.balance-label,
.stat-label,
.status-label {
    font-weight: 500;
}

.btn,
button,
.auth-tab,
.profile-tab,
.security-tab,
.admin-tab,
.filter-tab,
.deal-open-btn,
.dropdown-item,
.sidebar-item,
.payment-title,
.badge,
.toast-title,
.input,
.textarea,
.select,
input,
textarea,
select {
    font-family: var(--font-sans) !important;
}

.btn,
.auth-tab,
.profile-tab,
.security-tab,
.admin-tab,
.filter-tab,
.deal-open-btn,
.dropdown-item,
.sidebar-item {
    font-weight: 620 !important;
    letter-spacing: -0.012em;
    line-height: 1.15;
}

.btn.small,
.badge,
.deal-open-btn,
.chat-item-badge,
.dispute-status,
.sidebar-badge {
    font-weight: 650 !important;
    letter-spacing: -0.004em;
    line-height: 1.1;
}

.input,
.textarea,
.select,
input,
textarea,
select {
    font-weight: 480;
    letter-spacing: -0.010em;
    line-height: 1.35;
}

.input::placeholder,
.textarea::placeholder,
textarea::placeholder,
input::placeholder {
    font-weight: 430;
    letter-spacing: -0.006em;
}

.balance-value,
.stat-value,
.stat-value-new,
.deal-item-amount,
.user-mini-balance,
.amount,
.price,
.crypto-amount,
.wallet-balance,
code,
.mono {
    font-variant-numeric: tabular-nums lining-nums;
    font-feature-settings: "tnum" 1, "lnum" 1, "kern" 1;
}

.balance-value,
.stat-value,
.stat-value-new,
.deal-item-amount {
    font-weight: 730 !important;
    letter-spacing: -0.030em;
    line-height: 1.05;
}

.message-content,
.post-content,
.feed-post-text,
.profile-about,
.review-text {
    font-weight: 450;
    letter-spacing: -0.009em;
    line-height: 1.55;
}

.chat-peer-status,
.chat-item-preview,
.profile-bio,
.form-hint,
.auth-subtitle,
.toast-message {
    font-weight: 470;
}

@media (max-width: 768px) {
    body {
        letter-spacing: -0.008em;
    }

    .btn,
    .auth-tab,
    .profile-tab,
    .security-tab,
    .admin-tab,
    .filter-tab,
    .deal-open-btn,
    .dropdown-item,
    .sidebar-item {
        letter-spacing: -0.008em;
    }
}

/* === DEALIX typography pass 2: fonts only, no layout/effects ===
   Только шрифты: font-family, font-size, font-weight, line-height, letter-spacing,
   font-feature-settings. Без padding/margin/height/width/background/border/shadow/transform. */
:root {
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    --font-mono: 'SF Mono', 'Cascadia Mono', Consolas, Monaco, monospace;
}

html,
body,
button,
input,
textarea,
select {
    font-family: var(--font-ui);
    font-optical-sizing: auto;
    text-rendering: optimizeLegibility;
}

body {
    font-weight: 430;
    letter-spacing: -0.011em;
}

h1,
h2,
h3,
h4,
h5,
h6,
.page-title,
.section-title,
.card-title,
.modal-title,
.auth-title,
.profile-name,
.profile-display-name,
.chat-peer-name,
.deal-title,
.deal-item-title,
.dispute-title h3,
.admin-header h1,
.dashboard-title {
    font-family: var(--font-ui);
    font-weight: 760;
    letter-spacing: -0.034em;
    line-height: 1.08;
}

h1,
.page-title,
.auth-title {
    font-weight: 790;
    letter-spacing: -0.045em;
}

h2,
.section-title {
    font-weight: 740;
    letter-spacing: -0.037em;
}

h3,
.card-title,
.modal-title {
    font-weight: 720;
    letter-spacing: -0.029em;
}

p,
.text-muted,
.form-hint,
.profile-bio,
.auth-subtitle,
.empty-state p,
.toast-message,
.chat-item-preview,
.deal-item-meta,
.balance-label,
.stat-label,
.stat-label-new,
.status-label,
.payment-desc,
small{
    font-weight: 430;
    letter-spacing: -0.012em;
    line-height: 1.52;
}

.btn,
button,
.auth-tab,
.profile-tab,
.security-tab,
.admin-tab,
.filter-tab,
.sidebar-item,
.dropdown-item,
.deal-open-btn,
.feed-action,
.feed-icon-btn,
.chat-header-actions .btn.icon,
.chat-input-actions .btn.icon,
#send-message-btn {
    font-family: var(--font-ui);
    font-weight: 650;
    letter-spacing: -0.018em;
    line-height: 1.16;
    font-feature-settings: 'kern' 1, 'liga' 1, 'calt' 1;
}

.btn.small,
.badge,
.badge-primary,
.badge-success,
.badge-warning,
.badge-danger,
.badge-info,
.sidebar-badge,
.chat-item-badge,
.dispute-status,
.status-pill,
.crypto-badge,
.p2p-badge {
    font-family: var(--font-ui);
    font-weight: 680;
    letter-spacing: -0.008em;
    line-height: 1.1;
}

.input,
.textarea,
.select,
input,
textarea,
select,
.chat-input-wrapper textarea,
.feed-composer-input,
.vk-wall-composer textarea.feed-composer-input,
.search-box .input {
    font-family: var(--font-ui);
    font-weight: 450;
    letter-spacing: -0.012em;
    line-height: 1.42;
    font-feature-settings: 'kern' 1, 'liga' 1, 'calt' 1;
}

.input::placeholder,
.textarea::placeholder,
textarea::placeholder,
input::placeholder,
.chat-input-wrapper textarea::placeholder,
.feed-composer-input::placeholder,
.search-box .input::placeholder {
    font-weight: 430;
    letter-spacing: -0.012em;
}

.form-label,
.sidebar-label,
.table th,
.admin-table th,
.field-label,
.setting-label,
.profile-settings-section summary small,
.profile-settings-section summary b,
.profile-toggle-row b,
.profile-toggle-row small,
.feed-composer-title b,
.feed-composer-title span {
    font-family: var(--font-ui);
    letter-spacing: -0.014em;
    line-height: 1.22;
}

.form-label,
.sidebar-label,
.table th,
.admin-table th,
.field-label,
.setting-label {
    font-weight: 670;
}

.profile-settings-section summary b,
.profile-toggle-row b,
.feed-composer-title b {
    font-weight: 720;
    letter-spacing: -0.024em;
}

.profile-settings-section summary small,
.profile-toggle-row small,
.feed-composer-title span {
    font-weight: 450;
    letter-spacing: -0.012em;
}

.chat-item-name,
.user-mini-name,
.post-author,
.feed-author,
.feed-author-name,
.review-author,
.toast-title,
.payment-title{
    font-family: var(--font-ui);
    font-weight: 690;
    letter-spacing: -0.024em;
    line-height: 1.16;
}

.message-content,
.post-content,
.feed-post-text,
.review-text,
.dispute-message,
.delivery-content {
    font-family: var(--font-ui);
    font-weight: 430;
    letter-spacing: -0.01em;
    line-height: 1.48;
}

.message-time,
.chat-item-time,
.post-time,
.feed-time,
.timeline-time,
.meta-text{
    font-family: var(--font-ui);
    font-weight: 520;
    letter-spacing: -0.004em;
    line-height: 1.1;
}

.logo-text,
.header-title {
    font-family: var(--font-ui);
    font-weight: 780;
    letter-spacing: -0.04em;
    line-height: 1;
}

.balance-value,
.stat-value,
.stat-value-new,
.deal-item-amount,
.deal-amount,
.wallet-balance,
.crypto-amount,
.p2p-amount,
.amount,
.price,
.number,
code,
.mono {
    font-variant-numeric: tabular-nums lining-nums;
    font-feature-settings: 'tnum' 1, 'lnum' 1, 'kern' 1;
}

.balance-value,
.stat-value,
.stat-value-new,
.deal-item-amount,
.deal-amount,
.wallet-balance,
.crypto-amount,
.p2p-amount,
.amount,
.price {
    font-family: var(--font-ui);
    font-weight: 760;
    letter-spacing: -0.034em;
    line-height: 1.05;
}

code,
.mono,
.wallet-address,
.tx-hash,
.address,
.hash {
    font-family: var(--font-mono);
    font-weight: 500;
    letter-spacing: -0.02em;
}



/* === DEALIX typography pass 3: fonts only, no layout/effects ===
   Strict scope: font-family, font-weight, line-height, letter-spacing, numeric/font features only. */
:root {
    --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    --font-title: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    --font-mono: 'SF Mono', 'Cascadia Mono', 'JetBrains Mono', ui-monospace, Menlo, Monaco, Consolas, monospace;
}

html,
body,
button,
input,
textarea,
select {
    font-family: var(--font-ui);
    font-synthesis: none;
    text-rendering: optimizeLegibility;
    font-kerning: normal;
}

h1,
h2,
h3,
h4,
h5,
h6,
.page-title,
.section-title,
.card-title,
.modal-title,
.auth-title,
.profile-name,
.chat-peer-name,
.deal-title,
.dispute-title h3,
.admin-header h1,
.admin-header h2 {
    font-family: var(--font-title);
    font-weight: 760;
    letter-spacing: -0.035em;
    line-height: 1.08;
    font-feature-settings: 'kern' 1, 'liga' 1, 'calt' 1;
}

h4, h5, h6,
.card-title,
.modal-title,
.chat-peer-name,
.deal-title,
.dispute-title h3 {
    font-weight: 720;
    letter-spacing: -0.028em;
    line-height: 1.12;
}

p,
.text,
.description,
.auth-subtitle,
.profile-bio,
.form-hint,
.payment-desc,
.empty-state p,
.toast-message,
.chat-item-preview,
.deal-description,
.dispute-info,
.security-card p,
.wallet-card p{
    font-family: var(--font-ui);
    font-weight: 430;
    letter-spacing: -0.012em;
    line-height: 1.5;
    font-feature-settings: 'kern' 1, 'liga' 1, 'calt' 1;
}

small,
.text-muted,
.profile-meta,
.chat-peer-status,
.chat-item-time,
.message-time,
.post-time,
.feed-time,
.badge,
.dispute-status,
.status-label,
.sidebar-label,
.table th,
.admin-table th{
    font-family: var(--font-ui);
    letter-spacing: -0.006em;
    line-height: 1.18;
    font-feature-settings: 'kern' 1, 'liga' 1, 'calt' 1, 'tnum' 1;
}

.sidebar-label,
.table th,
.admin-table th,
.form-label,
.field-label,
.setting-label {
    font-weight: 650;
    letter-spacing: .018em;
}

button,
.btn,
.auth-tab,
.profile-tab,
.security-tab,
.admin-tab,
.filter-tab,
.sidebar-item,
.mobile-bottom-nav .nav-item,
.bottom-nav .nav-item,
.deal-open-btn,
.feed-action,
.tab-btn,
.toggle-btn {
    font-family: var(--font-ui);
    font-weight: 660;
    letter-spacing: -0.018em;
    line-height: 1.08;
    font-feature-settings: 'kern' 1, 'liga' 1, 'calt' 1;
}

.btn.small,
.badge,
.dispute-status,
.chat-item-badge,
.sidebar-badge,
.status-pill,
.label-pill,
.count-badge {
    font-weight: 680;
    letter-spacing: -0.01em;
    line-height: 1.05;
}

.input,
.textarea,
.select,
input,
textarea,
select,
.chat-input-wrapper textarea,
.feed-composer-input,
.vk-wall-composer textarea.feed-composer-input,
.search-box .input,
.auth-form .input {
    font-family: var(--font-ui);
    font-weight: 440;
    letter-spacing: -0.014em;
    line-height: 1.44;
    font-feature-settings: 'kern' 1, 'liga' 1, 'calt' 1, 'tnum' 1;
}

.input::placeholder,
.textarea::placeholder,
textarea::placeholder,
input::placeholder,
.chat-input-wrapper textarea::placeholder,
.feed-composer-input::placeholder,
.search-box .input::placeholder,
.auth-form .input::placeholder {
    font-family: var(--font-ui);
    font-weight: 420;
    letter-spacing: -0.012em;
}

.logo-text,
.header-title,
.brand-text,
.wordmark,
.auth-brand,
.profile-display-name,
.feed-composer-title b,
.profile-settings-section summary b,
.profile-toggle-row b,
.chat-item-name,
.user-mini-name,
.post-author,
.feed-author,
.feed-author-name,
.review-author,
.toast-title,
.payment-title,
.deal-item-title{
    font-family: var(--font-title);
    font-weight: 720;
    letter-spacing: -0.032em;
    line-height: 1.1;
    font-feature-settings: 'kern' 1, 'liga' 1, 'calt' 1;
}

.profile-settings-section summary small,
.profile-toggle-row small,
.feed-composer-title span,
.user-mini-balance,
.balance-label,
.stat-label,
.stat-label-new,
.payment-desc,
.deal-item-meta,
.wallet-meta,
.crypto-meta,
.p2p-meta {
    font-family: var(--font-ui);
    font-weight: 450;
    letter-spacing: -0.01em;
    line-height: 1.28;
}

.message-content,
.post-content,
.feed-post-text,
.review-text,
.dispute-message,
.delivery-content,
.support-message-content,
.admin-message-content {
    font-family: var(--font-ui);
    font-weight: 430;
    letter-spacing: -0.012em;
    line-height: 1.5;
    font-feature-settings: 'kern' 1, 'liga' 1, 'calt' 1;
}

.balance-value,
.stat-value,
.stat-value-new,
.deal-item-amount,
.deal-amount,
.wallet-balance,
.crypto-amount,
.p2p-amount,
.amount,
.price,
.total,
.fee,
.rate,
.percent,
.counter,
.number {
    font-family: var(--font-ui);
    font-weight: 740;
    letter-spacing: -0.035em;
    line-height: 1.05;
    font-variant-numeric: tabular-nums lining-nums;
    font-feature-settings: 'tnum' 1, 'lnum' 1, 'kern' 1;
}

code,
pre,
.mono,
.wallet-address,
.tx-hash,
.address,
.hash,
.contract-address,
.chain-id,
.crypto-address,
.payment-reference {
    font-family: var(--font-mono);
    font-weight: 500;
    letter-spacing: -0.018em;
    font-variant-numeric: tabular-nums lining-nums;
    font-feature-settings: 'tnum' 1, 'lnum' 1, 'zero' 1, 'kern' 1;
}

/* === DEALIX typography pass 4: primary actions and full UI font cleanup only ===
   Strict scope: only font-family, font-weight, line-height, letter-spacing and font features.
   No layout, no sizes, no padding, no margins, no colors, no shadows, no hover/effects. */
:root {
    --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    --font-title: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    --font-mono: 'SF Mono', 'Cascadia Mono', 'JetBrains Mono', ui-monospace, Menlo, Monaco, Consolas, monospace;
}

body,
button,
input,
textarea,
select {
    font-family: var(--font-ui) !important;
    font-kerning: normal;
    font-synthesis: none;
    text-rendering: optimizeLegibility;
}

body {
    font-weight: 435;
    letter-spacing: -0.009em;
    line-height: 1.5;
}

h1,
h2,
h3,
h4,
h5,
h6,
.page-title,
.section-title,
.card-title,
.modal-title,
.auth-title,
.profile-name,
.dashboard-title,
.deal-title,
.listing-detail-title,
.listing-form-head h2,
.p2p-section-title,
.admin-header h1,
.admin-header h2 {
    font-family: var(--font-title) !important;
    font-weight: 735 !important;
    letter-spacing: -0.018em !important;
    line-height: 1.1 !important;
    font-feature-settings: 'kern' 1, 'liga' 1, 'calt' 1;
}

h1,
.page-title,
.auth-title {
    font-weight: 760 !important;
    letter-spacing: -0.022em !important;
}

h2,
.section-title,
.listing-form-head h2 {
    font-weight: 735 !important;
    letter-spacing: -0.019em !important;
}

h3,
.card-title,
.modal-title,
.p2p-section-title {
    font-weight: 705 !important;
    letter-spacing: -0.015em !important;
}

.btn,
button.btn,
button,
[role="button"],
.auth-tab,
.profile-tab,
.security-tab,
.admin-tab,
.filter-tab,
.tab-btn,
.sidebar-item,
.deal-open-btn,
.feed-action,
.dashboard-action-card,
.listing-action,
.listing-card-action,
.listing-toolbar .btn,
.listing-form-actions .btn,
.listing-detail-actions .btn,
.p2p-actions .btn,
.wallet-actions .btn,
.deal-actions .btn,
.modal-footer .btn,
.form-actions .btn,
#new-deal-btn,
#new-deal-action,
#create-new-deal-btn,
#create-deal-btn,
#create-deal-from-profile-btn,
#listing-create-btn,
[data-listing-create] {
    font-family: var(--font-ui) !important;
    font-weight: 645 !important;
    letter-spacing: -0.006em !important;
    line-height: 1.08 !important;
    font-feature-settings: 'kern' 1, 'liga' 1, 'calt' 1, 'tnum' 1;
}

.btn.primary,
.dashboard-action-card.primary,
#new-deal-btn,
#new-deal-action,
#create-new-deal-btn,
#create-deal-btn,
#create-deal-from-profile-btn,
#listing-create-btn,
[data-listing-create] {
    font-weight: 665 !important;
    letter-spacing: -0.006em !important;
}

.btn.small,
.badge,
.status-pill,
.label-pill,
.count-badge,
.chat-item-badge,
.sidebar-badge,
.dispute-status,
.filter-chip,
.listing-status,
.p2p-status {
    font-family: var(--font-ui) !important;
    font-weight: 650 !important;
    letter-spacing: -0.004em !important;
    line-height: 1.05 !important;
    font-feature-settings: 'kern' 1, 'liga' 1, 'calt' 1, 'tnum' 1;
}

.input,
.textarea,
.select,
input,
textarea,
select,
.form-control,
.search-input,
.search-box .input,
.chat-input-wrapper textarea,
.feed-composer-input,
.vk-wall-composer textarea.feed-composer-input,
.auth-form .input,
.listing-form-grid .input,
.p2p-form .input,
.deal-action-modal-overlay .input {
    font-family: var(--font-ui) !important;
    font-weight: 430 !important;
    letter-spacing: -0.009em !important;
    line-height: 1.44 !important;
    font-feature-settings: 'kern' 1, 'liga' 1, 'calt' 1, 'tnum' 1;
}

.input::placeholder,
.textarea::placeholder,
input::placeholder,
textarea::placeholder,
select::placeholder,
.search-box .input::placeholder,
.chat-input-wrapper textarea::placeholder,
.feed-composer-input::placeholder,
.auth-form .input::placeholder {
    font-family: var(--font-ui) !important;
    font-weight: 410 !important;
    letter-spacing: -0.006em !important;
    line-height: 1.38 !important;
}

.form-label,
.field-label,
.setting-label,
.profile-settings-section summary b,
.profile-toggle-row b,
.feed-composer-title b,
.chat-item-name,
.deal-item-title,
.listing-card-title,
.listing-title,
.p2p-offer-title,
.payment-title,
.toast-title,
.user-mini-name,
.post-author,
.feed-author,
.feed-author-name,
.review-author{
    font-family: var(--font-title) !important;
    font-weight: 680 !important;
    letter-spacing: -0.021em !important;
    line-height: 1.12 !important;
    font-feature-settings: 'kern' 1, 'liga' 1, 'calt' 1;
}

small,
.form-hint,
.text-muted,
.profile-meta,
.profile-settings-section summary small,
.profile-toggle-row small,
.feed-composer-title span,
.chat-peer-status,
.chat-item-preview,
.chat-item-time,
.message-time,
.post-time,
.feed-time,
.payment-desc,
.balance-label,
.stat-label,
.stat-label-new,
.status-label,
.sidebar-label,
.deal-item-meta,
.wallet-meta,
.crypto-meta,
.p2p-meta,
.listing-card-meta,
.listing-meta,
.table th,
.admin-table th{
    font-family: var(--font-ui) !important;
    font-weight: 465 !important;
    letter-spacing: -0.004em !important;
    line-height: 1.24 !important;
    font-feature-settings: 'kern' 1, 'liga' 1, 'calt' 1, 'tnum' 1;
}

p,
.text,
.description,
.auth-subtitle,
.profile-bio,
.empty-state p,
.toast-message,
.message-content,
.post-content,
.feed-post-text,
.review-text,
.dispute-message,
.delivery-content,
.support-message-content,
.admin-message-content,
.listing-card-desc,
.listing-description,
.p2p-description{
    font-family: var(--font-ui) !important;
    font-weight: 425 !important;
    letter-spacing: -0.008em !important;
    line-height: 1.52 !important;
    font-feature-settings: 'kern' 1, 'liga' 1, 'calt' 1;
}

.balance-value,
.stat-value,
.stat-value-new,
.deal-item-amount,
.deal-amount,
.wallet-balance,
.crypto-amount,
.p2p-amount,
.listing-price,
.listing-card-price,
.amount,
.price,
.total,
.fee,
.rate,
.percent,
.counter,
.number {
    font-family: var(--font-ui) !important;
    font-weight: 705 !important;
    letter-spacing: -0.025em !important;
    line-height: 1.04 !important;
    font-variant-numeric: tabular-nums lining-nums;
    font-feature-settings: 'tnum' 1, 'lnum' 1, 'kern' 1;
}

code,
pre,
.mono,
.wallet-address,
.tx-hash,
.address,
.hash,
.contract-address,
.chain-id,
.crypto-address,
.payment-reference,
.admin-log-hash {
    font-family: var(--font-mono) !important;
    font-weight: 500 !important;
    letter-spacing: -0.012em !important;
    font-variant-numeric: tabular-nums lining-nums;
    font-feature-settings: 'tnum' 1, 'lnum' 1, 'zero' 1, 'kern' 1;
}

/* === DEALIX typography-only pass 5: professional UI text coverage ===
   Only font-related rules: no layout, no sizes, no padding, no shadows, no effects. */
.nav-item,
.nav-link,
.sidebar-item,
.mobile-nav-item,
.mobile-bottom-nav a,
.bottom-nav-item,
.app-tab,
.tab-btn,
.profile-tab,
.security-tab,
.admin-tab,
.auth-tab,
.filter-tab,
.filter-btn,
.deals-filter,
.listing-filter,
.segmented-control button,
.profile-theme-choice button {
    font-family: var(--font-ui) !important;
    font-weight: 615 !important;
    letter-spacing: -0.005em !important;
    line-height: 1.12 !important;
    font-feature-settings: 'kern' 1, 'liga' 1, 'calt' 1;
}

.quick-action-card,
.quick-action-card b,
.action-card,
.action-card b,
.dashboard-action-card,
.dashboard-action-card b,
.create-deal-card,
.create-listing-card,
.listing-action-card,
.wallet-action-card,
.security-action-card {
    font-family: var(--font-title) !important;
    font-weight: 670 !important;
    letter-spacing: -0.012em !important;
    line-height: 1.12 !important;
    font-feature-settings: 'kern' 1, 'liga' 1, 'calt' 1;
}

.quick-action-card span,
.quick-action-card small,
.action-card span,
.action-card small,
.dashboard-action-card span,
.dashboard-action-card small,
.create-deal-card span,
.create-listing-card span,
.wallet-action-card span,
.security-action-card span {
    font-family: var(--font-ui) !important;
    font-weight: 455 !important;
    letter-spacing: -0.006em !important;
    line-height: 1.32 !important;
    font-feature-settings: 'kern' 1, 'liga' 1, 'calt' 1;
}

.btn,
button,
[role="button"],
.action-btn,
.deal-open-btn,
.call-btn,
.create-btn,
.submit-btn,
.save-btn,
.cancel-btn,
.delete-btn,
.release-btn,
.dispute-btn,
.resolve-btn,
.pay-btn,
.buy-btn,
.sell-btn,
.publish-btn,
.upload-btn,
.attach-btn,
#send-message-btn,
#load-more-posts,
#load-blocklist-btn {
    font-family: var(--font-ui) !important;
    font-weight: 640 !important;
    letter-spacing: -0.006em !important;
    line-height: 1.08 !important;
    text-rendering: optimizeLegibility;
    font-feature-settings: 'kern' 1, 'liga' 1, 'calt' 1, 'tnum' 1;
}

.btn.primary,
.btn.success,
.btn.danger,
.action-btn.primary,
.create-btn,
.submit-btn,
.pay-btn,
.buy-btn,
.publish-btn,
#new-deal-btn,
#create-deal-btn,
#create-new-deal-btn,
#listing-create-btn {
    font-weight: 665 !important;
    letter-spacing: -0.006em !important;
}

.btn.ghost,
.btn.secondary,
.cancel-btn,
.back-btn,
.close-btn,
.modal-close,
.dropdown-item,
.menu-item,
.context-menu-item {
    font-weight: 585 !important;
    letter-spacing: -0.005em !important;
}

.modal-title,
.dialog-title,
.confirm-title,
.sheet-title,
.drawer-title,
.panel-title,
.card-title,
.section-title,
.page-title,
.block-title,
.info-card h3,
.profile-section-title-row h3,
.disputes-page h2,
.wallet-page h2,
.listings-page h2,
.deals-page h2,
.chats-sidebar-header h2,
.admin-header h2 {
    font-family: var(--font-title) !important;
    font-weight: 705 !important;
    letter-spacing: -0.015em !important;
    line-height: 1.08 !important;
    text-rendering: optimizeLegibility;
    font-feature-settings: 'kern' 1, 'liga' 1, 'calt' 1;
}

.modal-body,
.dialog-body,
.confirm-body,
.sheet-body,
.drawer-body,
.panel-body,
.card-body,
.info-card,
.details-card,
.deal-details,
.wallet-details,
.listing-detail,
.dispute-details {
    font-family: var(--font-ui) !important;
    font-weight: 425 !important;
    letter-spacing: -0.007em !important;
    line-height: 1.5 !important;
    font-feature-settings: 'kern' 1, 'liga' 1, 'calt' 1;
}

.table td,
.admin-table td,
.ledger-table td,
.crypto-table td,
.deal-table td,
.history-table td,
.audit-table td,
.session-card,
.device-card,
.wallet-row,
.ledger-row,
.p2p-row,
.listing-row{
    font-family: var(--font-ui) !important;
    font-weight: 430 !important;
    letter-spacing: -0.007em !important;
    line-height: 1.36 !important;
    font-feature-settings: 'kern' 1, 'liga' 1, 'calt' 1, 'tnum' 1;
}

.table th,
.admin-table th,
.ledger-table th,
.crypto-table th,
.deal-table th,
.history-table th,
.audit-table th,
.column-label,
.kicker,
.eyebrow,
.overline {
    font-family: var(--font-ui) !important;
    font-weight: 650 !important;
    letter-spacing: .015em !important;
    line-height: 1.05 !important;
    font-feature-settings: 'kern' 1, 'liga' 1, 'calt' 1, 'tnum' 1;
}

/* === Hotfix: desktop chat sent-message jitter fix ===
   Only removes re-render animation/transform from desktop chat messages.
   Does not touch layout, composer, mobile keyboard, message logic, JS, backend or crypto. */
@media (min-width: 769px) {
    .app[data-page="chats"] .chat-messages .message,
    .chats-page .chat-messages .message {
        animation: none !important;
        transform: none !important;
    }

    .app[data-page="chats"] .chat-messages .message.sent,
    .chats-page .chat-messages .message.sent,
    .app[data-page="chats"] .chat-messages .message.received,
    .chats-page .chat-messages .message.received {
        will-change: auto !important;
    }
}

/* === DEALIX security swipe actions (sessions/history only) ===
   Chat-style reveal, same geometry and colours as the dialog list swipe and the
   statistics rows (.dashboard-swipe-*): the row follows the finger and uncovers
   one 78px action with the red pill glyph and a caption. */
.security-swipe-row {
    position: relative;
    overflow: hidden;
    border-radius: 19px;
    isolation: isolate;
    touch-action: pan-y;
}

.security-swipe-row .security-swipe-content {
    position: relative;
    z-index: 2;
    width: 100%;
    user-select: none;
    -webkit-user-select: none;
    transition: transform .2s cubic-bezier(.2, .8, .2, 1);
}

.security-swipe-row.is-swiping .security-swipe-content {
    transition: none;
    will-change: transform;
}

.security-swipe-actions {
    position: absolute;
    z-index: 1;
    inset-block: 0;
    inset-inline-end: 0;
    width: var(--security-swipe-reveal, 0px);
    display: flex;
    justify-content: flex-end;
    overflow: hidden;
}

.security-swipe-delete {
    flex: 0 0 78px;
    min-width: 78px;
    padding: 6px 4px;
    border: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    color: var(--text-secondary);
    background: transparent;
    font: inherit;
    font-size: .6875rem;
    line-height: 1.2;
    font-weight: 600;
    letter-spacing: -.01em;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.security-swipe-delete:disabled {
    cursor: default;
    opacity: .6;
}

.security-swipe-icon {
    width: 64px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    color: #fff;
    background: #e2232c;
    opacity: 0;
    transform: scale(.82);
    transition: opacity .16s ease, transform .18s cubic-bezier(.2, .8, .2, 1);
}

.security-swipe-icon svg {
    width: 25px;
    height: 25px;
    display: block;
    pointer-events: none;
}

.security-swipe-label {
    width: 100%;
    overflow: hidden;
    /* Set on the caption itself: the mobile anti-zoom rule forces 16px on buttons. */
    font-size: .6875rem;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.security-swipe-row:is(.is-swiping, .is-revealed) .security-swipe-icon {
    opacity: 1;
    transform: scale(1);
}

/* Keyboard: tabbing to the hidden action opens the rail without a pointer. */
.security-swipe-row:has(.security-swipe-delete:focus-visible) .security-swipe-actions { width: 78px; }
.security-swipe-row:has(.security-swipe-delete:focus-visible) .security-swipe-content { transform: translate3d(-78px, 0, 0); }
html[data-text-dir="rtl"] .security-swipe-row:has(.security-swipe-delete:focus-visible) .security-swipe-content { transform: translate3d(78px, 0, 0); }
.security-swipe-row:has(.security-swipe-delete:focus-visible) .security-swipe-icon {
    opacity: 1;
    transform: scale(1);
    outline: 2px solid var(--text);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .security-swipe-row .security-swipe-content,
    .security-swipe-icon {
        transition: none;
    }
}


/* === DEALIX security compact lists (sessions/history only) ===
   UI-only layer: keeps the full data loaded, but avoids long security panels. */
.security-compact-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 44px;
    padding: 10px 12px;
    border-radius: 17px;
    border: 1px solid rgba(148,163,184,.14);
    background: rgba(255,255,255,.045);
    color: var(--text);
    cursor: pointer;
    font: inherit;
    text-align: left;
}

.security-compact-toggle span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .88rem;
    font-weight: 850;
}

.security-compact-toggle small {
    flex: 0 0 auto;
    color: var(--text-muted);
    font-size: .74rem;
    font-weight: 750;
    white-space: nowrap;
}

.security-compact-toggle:hover,
.security-compact-toggle:focus-visible {
    border-color: rgba(109,93,252,.32);
    outline: none;
}

body.theme-light .security-compact-toggle,
body.light-theme .security-compact-toggle,
[data-theme="light"] .security-compact-toggle {
    background: rgba(248,250,252,.92);
    border-color: rgba(15,23,42,.08);
    color: #0f172a;
}

body.theme-light .security-compact-toggle small,
body.light-theme .security-compact-toggle small,
[data-theme="light"] .security-compact-toggle small {
    color: #64748b;
}

@media (max-width: 680px) {
    .security-compact-toggle {
        min-height: 42px;
        padding: 9px 11px;
    }

    .security-compact-toggle span {
        font-size: .84rem;
    }

    .security-compact-toggle small {
        font-size: .7rem;
    }
}

/* DEALIX PWA session lock 32A — idle re-auth overlay. Isolated styles only. */
.reauth-lock-active {
  overflow: hidden;
}

.reauth-lock-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(3, 7, 18, 0.72);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.reauth-lock-card {
  width: min(420px, 100%);
  border: 1px solid var(--border-color, rgba(255,255,255,.12));
  border-radius: 28px;
  background: var(--card-bg, rgba(15, 23, 42, .96));
  color: var(--text-primary, #fff);
  box-shadow: 0 28px 90px rgba(0,0,0,.42);
  padding: 28px;
}

.reauth-lock-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  margin-bottom: 18px;
  background: rgba(59,130,246,.14);
  border: 1px solid rgba(59,130,246,.22);
  font-size: 24px;
}

.reauth-lock-card h2 {
  margin: 0 0 8px;
  font-size: 24px;
  line-height: 1.12;
  letter-spacing: -0.03em;
}

.reauth-lock-card p {
  margin: 0 0 22px;
  color: var(--text-secondary, rgba(255,255,255,.72));
  line-height: 1.5;
}

.reauth-lock-form {
  display: grid;
  gap: 12px;
}

.reauth-lock-error {
  min-height: 18px;
  color: var(--danger-color, #ef4444);
  font-size: 13px;
  line-height: 1.35;
}

[data-theme="light"] .reauth-lock-overlay,
.light-theme .reauth-lock-overlay {
  background: rgba(248, 250, 252, 0.78);
}

[data-theme="light"] .reauth-lock-card,
.light-theme .reauth-lock-card {
  background: rgba(255,255,255,.96);
  box-shadow: 0 28px 90px rgba(15,23,42,.18);
}

@media (max-width: 640px) {
  .reauth-lock-overlay {
    align-items: flex-end;
    padding: 14px;
  }

  .reauth-lock-card {
    border-radius: 24px;
    padding: 22px;
  }

  .reauth-lock-card h2 {
    font-size: 21px;
  }
}

/* DEALIX main feed — scoped layout; profile wall and shell keep their styles. */
.feed-page.vk-feed-page {
    --feed-surface: rgba(12, 20, 38, .90);
    --feed-border: rgba(148, 163, 184, .14);
    --feed-accent: #b8a0ff;
    --feed-soft: rgba(139, 92, 246, .12);
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin-inline: auto;
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
}
body.theme-glass .feed-page {
    --feed-surface: rgba(12, 20, 38, .76);
}
:is(body.theme-light, body.light-theme, [data-theme="light"]) .feed-page {
    --feed-surface: rgba(255, 255, 255, .94);
    --feed-border: rgba(79, 70, 110, .14);
    --feed-accent: #6d28d9;
    --feed-soft: rgba(109, 40, 217, .07);
}
.feed-page .vk-feed-header {
    min-width: 0;
    flex-direction: row;
    padding: 8px 2px 0;
    gap: 16px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}
.feed-page .vk-feed-header > div { min-width: 0; }
.feed-page .vk-feed-header h1 {
    margin: 0 0 6px;
    font-size: clamp(26px, 3vw, 34px);
    font-weight: 750;
    letter-spacing: -.035em;
    color: var(--text);
}
.feed-page .vk-feed-header p {
    max-width: 520px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-secondary);
}
.feed-page .feed-my-wall-btn {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 14px;
    gap: 8px;
    border: 1px solid var(--feed-border);
    border-radius: 12px;
    color: var(--feed-accent);
    background: var(--feed-surface);
    box-shadow: none;
    white-space: nowrap;
}
.feed-page .vk-feed-wrap,
.feed-page .feed-list {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    gap: 20px;
}
.feed-page .vk-feed-card,
.feed-page .feed-empty {
    min-width: 0;
    padding: 20px;
    gap: 15px;
    border: 1px solid var(--feed-border);
    border-radius: 20px;
    background: var(--feed-surface);
    box-shadow: 0 14px 36px rgba(2, 6, 23, .16);
    backdrop-filter: blur(16px) saturate(120%);
    -webkit-backdrop-filter: blur(16px) saturate(120%);
}
.feed-page .vk-feed-card.status-pending { border-color: var(--warning); }
.feed-page .vk-feed-card.status-rejected { border-color: var(--danger); }
.feed-page .feed-post-head {
    min-width: 0;
    align-items: flex-start;
    gap: 12px;
    padding-bottom: 0;
}
.feed-page .feed-author { flex: 1; gap: 12px; }
.feed-page .feed-author > span:last-child { gap: 4px; }
.feed-page .feed-author-meta { display: flex; min-width: 0; flex-direction: column; align-items: flex-start; }
.feed-page .feed-author-identity { display: flex; min-width: 0; max-width: 100%; align-items: baseline; flex-wrap: wrap; gap: 5px 8px; }
.feed-page .feed-author-handle { max-width: 100%; color: var(--text-muted); font-size: 12px; font-weight: 550; overflow-wrap: anywhere; }
.feed-page .feed-author-reputation { display: flex; min-width: 0; margin-top: 1px; }
.feed-page .feed-author-reputation .feed-trust-badge { justify-content: flex-start; padding: 0; }
.feed-page .feed-author b {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.35;
    overflow-wrap: anywhere;
}
.feed-page .feed-author small {
    font-size: 12px;
    line-height: 1.4;
    color: var(--text-muted);
    overflow-wrap: anywhere;
}
.feed-page .feed-post-head .feed-avatar {
    width: 48px;
    height: 48px;
    flex-basis: 48px;
    box-shadow: none;
}
.feed-page .feed-post-head-actions {
    flex: 0 0 auto;
    flex-wrap: wrap;
    justify-content: flex-end;
    max-width: 32%;
    gap: 4px;
}
.feed-page .feed-trust-badge {
    max-width: 100%;
    padding: 4px 6px;
    border: 0;
    background: transparent;
    color: var(--text-muted);
    font-size: 11px;
    white-space: normal;
}
.feed-page .feed-post-head-actions .feed-icon-btn {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text-muted);
    box-shadow: none;
}
.feed-page .vk-feed-card .feed-post-text {
    max-width: 80ch;
    min-width: 0;
    font-size: 15.5px;
    line-height: 1.58;
    overflow-wrap: anywhere;
}
.feed-page .feed-media-grid {
    min-width: 0;
    gap: 4px;
    border-radius: 12px;
    aspect-ratio: 16 / 10;
    grid-auto-rows: minmax(0, 1fr);
}
.feed-page .feed-media-grid.count-1 { aspect-ratio: 16 / 9; }
.feed-page .feed-media-grid .feed-media-item {
    min-width: 0;
    min-height: 0;
    max-height: none;
    height: 100%;
    background: var(--bg-tertiary);
}
.feed-page .feed-media-grid img,
.feed-page .feed-media-grid video {
    width: 100%;
    height: 100%;
    min-height: 0;
    max-height: none;
    object-fit: cover;
}
.feed-page .feed-media-grid video { object-fit: contain; }
.feed-page .feed-media-overflow {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(6, 10, 20, .56);
    color: #fff;
    font-size: clamp(24px, 4vw, 42px);
    font-weight: 700;
    pointer-events: none;
}
.feed-page .feed-media-open-btn.has-overflow {
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}
/* Main feed inline media carousel. The existing fullscreen viewer remains authoritative. */
.feed-page .feed-media-carousel {
    position: relative;
    width: 100%;
    min-width: 0;
    max-height: min(70dvh, 720px);
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, .12);
    border-radius: 14px;
    background: #080d1a;
    isolation: isolate;
    touch-action: pan-y pinch-zoom;
}
.feed-page .feed-media-carousel.is-single { aspect-ratio: 16 / 9; }
.feed-page .feed-media-carousel-stage,
.feed-page .feed-carousel-media {
    width: 100%;
    height: 100%;
    max-height: none;
    min-width: 0;
    min-height: 0;
}
.feed-page .feed-media-carousel-stage {
    position: absolute;
    inset: 0;
    display: block;
    touch-action: pan-y pinch-zoom;
}
.feed-page .feed-carousel-media img {
    user-select: none;
    -webkit-user-select: none;
}
.feed-page .feed-carousel-media {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 0;
    background: #080d1a;
    overflow: hidden;
}
.feed-page button.feed-carousel-media { padding: 0; cursor: zoom-in; }
.feed-page .feed-carousel-media img,
.feed-page .feed-carousel-media video {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 0;
    max-height: none;
    object-fit: cover;
    background: #080d1a;
}
.feed-page .feed-carousel-media video { object-fit: contain; }
.feed-page .feed-carousel-open { top: 12px; right: 12px; }
.feed-page .feed-carousel-nav {
    position: absolute;
    z-index: 3;
    top: 50%;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid rgba(255,255,255,.20);
    border-radius: 50%;
    color: #fff;
    background: rgba(5, 10, 24, .68);
    box-shadow: 0 10px 28px rgba(0,0,0,.24);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transform: translateY(-50%);
    cursor: pointer;
    transition: opacity .16s ease, background .16s ease, transform .16s ease;
}
.feed-page .feed-carousel-nav.prev { left: 12px; }
.feed-page .feed-carousel-nav.next { right: 12px; }
.feed-page .feed-carousel-nav:hover,
.feed-page .feed-carousel-nav:focus-visible { background: rgba(109,93,252,.86); }
.feed-page .feed-carousel-nav:disabled { opacity: .28; cursor: default; }
.feed-page .feed-carousel-nav .feed-ui-icon { width: 24px; height: 24px; }
.feed-page .feed-carousel-counter {
    position: absolute;
    z-index: 3;
    left: 12px;
    bottom: 12px;
    padding: 5px 9px;
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 999px;
    color: #fff;
    background: rgba(5,10,24,.66);
    font-size: 12px;
    font-weight: 750;
    line-height: 1;
    backdrop-filter: blur(9px);
    -webkit-backdrop-filter: blur(9px);
}
.feed-page .feed-carousel-dots {
    position: absolute;
    z-index: 3;
    left: 50%;
    bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    max-width: 55%;
    transform: translateX(-50%);
}
.feed-page .feed-carousel-dot {
    width: 7px;
    height: 7px;
    min-width: 7px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: rgba(255,255,255,.48);
    cursor: pointer;
    transition: width .16s ease, background .16s ease, opacity .16s ease;
}
.feed-page .feed-carousel-dot.active { width: 19px; background: #a78bfa; }
.feed-page .feed-media-carousel.is-single .feed-carousel-counter,
.feed-page .feed-media-carousel.is-single .feed-carousel-dots,
.feed-page .feed-media-carousel.is-single .feed-carousel-nav { display: none; }

.feed-page .feed-trust-badge {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
}
.feed-page .feed-trust-score,
.feed-page .feed-trust-deals { display: inline-flex; align-items: center; gap: 4px; }
.feed-page .feed-trust-score .feed-ui-icon { width: 14px; height: 14px; color: #fbbf24; }
.feed-page .feed-trust-score .feed-ui-icon path { fill: currentColor; stroke: currentColor; }
.feed-page .feed-trust-score b { color: var(--text-secondary); font-size: 11px; }
.feed-page .feed-trust-separator { opacity: .55; }

/* Feed galleries retain their existing touch navigation after preview truncation. */
body:has(.feed-page) .feed-post-media-viewer .profile-photo-nav {
    width: 44px;
    min-height: 44px;
    opacity: 1;
}
body:has(.feed-page) .feed-post-media-viewer .profile-photo-nav:focus-visible {
    outline: 2px solid #b8a0ff;
    outline-offset: 3px;
}
.feed-page .vk-feed-card .feed-actions {
    gap: 4px;
    margin: 0;
    padding-top: 10px;
    border-top: 1px solid var(--feed-border);
}
.feed-page .vk-feed-card .feed-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 8px 9px;
    gap: 7px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text-secondary);
    box-shadow: none;
}
.feed-page .vk-feed-card .feed-action:hover,
.feed-page .vk-feed-card .feed-action.active,
.feed-page .feed-post-head-actions .feed-icon-btn:hover {
    color: var(--feed-accent);
    background: var(--feed-soft);
    box-shadow: none;
}
.feed-page .feed-post-head-actions .feed-icon-btn.danger:hover { color: var(--danger); }
.feed-page .feed-hide-author-action { color: var(--text-muted); }
.feed-page .feed-hide-author-action:hover,
.feed-page .feed-hide-author-action:focus-visible { color: var(--feed-accent); }
.feed-page .feed-hide-author {
    justify-self: start;
    max-width: 100%;
    margin: 0;
    padding-inline: 0;
    overflow-wrap: anywhere;
    color: var(--text-muted);
}
.feed-page .feed-comments { min-width: 0; padding-top: 0; gap: 8px; }
.feed-page .feed-comments-heading { display: none; align-items: center; gap: 8px; padding: 0 0 2px; color: var(--text); }
.feed-page .feed-comments-heading b { font-size: 14px; font-weight: 750; }
.feed-page .feed-comments-heading span { color: var(--text-muted); font-size: 12px; }
.feed-page .feed-comments.is-open .feed-comments-heading { display: flex; }
.feed-page .feed-comments:not(.is-open) .feed-comment-form,
.feed-page .feed-comments:not(.is-open) .feed-comments-pagination { display: none; }
.feed-page .feed-comments.is-open {
    padding: 10px 0 0;
    border: 0;
    border-top: 1px solid var(--feed-border);
    border-radius: 0;
    background: transparent;
}
.feed-page .feed-comment {
    min-width: 0;
    padding: 10px 0;
    border: 0;
    border-bottom: 1px solid var(--feed-border);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}
.feed-page .feed-comment-body { padding: 10px 12px; border: 1px solid var(--feed-border); border-radius: 4px 16px 16px; background: var(--bg-hover); }
.feed-page .feed-comment-text { margin-top: 5px; color: var(--text-secondary); font-size: 14px; line-height: 1.55; }
.feed-page .feed-comment-head { flex-wrap: wrap; gap: 4px 8px; }
.feed-page .feed-comment-head a { display: inline-flex; min-width: 0; align-items: baseline; flex-wrap: wrap; gap: 4px 7px; }
.feed-page .feed-comment-head a small { color: var(--text-muted); font-size: 11px; font-weight: 500; }
.feed-page .feed-comment-avatar-link { margin-left: 0; }
.feed-page .feed-comment.is-reply { margin-left: 28px; padding-left: 12px; border-inline-start: 2px solid var(--feed-border); }
.feed-page .feed-comment.is-reply .feed-comment-avatar-link { margin-left: 0; }
.feed-page .feed-comment.is-reply .feed-avatar { width: 34px; height: 34px; flex-basis: 34px; }
/* Owner 2026-10-19 (Twitter threads): a reply to a reply goes one step further in. */
.feed-page .feed-comment.thread-depth-2 { margin-left: 56px; }
.profile-wall-block .feed-comment.is-reply { margin-inline-start: 28px; padding-inline-start: 12px; border-inline-start: 2px solid var(--border); }
.profile-wall-block .feed-comment.thread-depth-2 { margin-inline-start: 56px; }
.feed-page .feed-comment-head a,
.feed-page .feed-comment-text { overflow-wrap: anywhere; }
.feed-page .feed-comment-form { min-width: 0; }
.feed-page .feed-comment-form-rich {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) 44px;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
    padding: 8px 0 0;
}
.feed-page .feed-comment-form-rich .feed-reply-selection { grid-column: 2 / -1; }
.feed-page .feed-comment-me-avatar { width: 40px; height: 40px; }
.feed-page .feed-comment-me-avatar .feed-avatar { width: 40px; height: 40px; flex-basis: 40px; }
.feed-page .feed-comment-form-rich .input {
    width: 100%;
    border-radius: 14px;
    border-color: var(--feed-border);
    background: rgba(255,255,255,.035);
}
.feed-page .feed-comment-form-rich .feed-comment-send { width: 44px; height: 44px; min-width: 44px; border-radius: 14px; }
.feed-page .feed-comment-form input { min-width: 0; min-height: 44px; font-size: 16px; }
.feed-page :is(a, button, input):focus-visible {
    outline: 2px solid var(--feed-accent);
    outline-offset: 3px;
}
.feed-page .feed-stories-wrap { min-width: 0; max-width: 100%; }
.feed-page .stories-rail { min-width: 0; max-width: 100%; gap: 16px; padding-block: 7px; }
.feed-page .stories-rail__name { color: var(--text-secondary); font-weight: 600; }
.feed-page .stories-rail__owner:hover .stories-rail__avatar,
.feed-page .stories-rail__owner:focus-visible .stories-rail__avatar { box-shadow: none; }
@media (max-width: 720px) {
    .feed-page.vk-feed-page { gap: 14px; }
    .feed-page .vk-feed-header { align-items: flex-start; gap: 10px; }
    .feed-page .vk-feed-header h1 { font-size: 26px; }
    .feed-page .vk-feed-header p { font-size: 12px; }
    .feed-page .feed-my-wall-btn { padding: 8px 10px; font-size: 12px; gap: 6px; }
    .feed-page .vk-feed-wrap,
    .feed-page .feed-list { gap: 14px; }
    .feed-page .vk-feed-card,
    .feed-page .feed-empty { padding: 12px; gap: 12px; border-radius: 16px; box-shadow: 0 10px 28px rgba(2,6,23,.14); }
    .feed-page .feed-post-head { gap: 6px; }
    .feed-page .feed-author { gap: 8px; }
    .feed-page .feed-post-head .feed-avatar { width: 42px; height: 42px; flex-basis: 42px; }
    .feed-page .feed-author b { font-size: 14px; }
    .feed-page .feed-author small { font-size: 11px; }
    .feed-page .feed-author-handle { font-size: 11px; }
    .feed-page .feed-author-reputation { margin-top: 0; }
    .feed-page .feed-author-reputation .feed-trust-badge { max-width: 100%; font-size: 10.5px; }
    .feed-page .feed-trust-badge { flex: 1; min-width: 0; max-width: 100%; text-align: start; }
    .feed-page .vk-feed-card .feed-actions { gap: 2px; flex-wrap: nowrap; }
    .feed-page .feed-media-grid { aspect-ratio: 1; border-radius: 10px; }
    .feed-page .feed-media-grid.count-1 { aspect-ratio: 4 / 3; }
    .feed-page .feed-media-carousel,
    .feed-page .feed-media-carousel.is-single { aspect-ratio: 4 / 3; border-radius: 12px; }
    .feed-page .feed-carousel-nav { width: 42px; height: 42px; }
    .feed-page .feed-carousel-nav.prev { left: 8px; }
    .feed-page .feed-carousel-nav.next { right: 8px; }
    .feed-page .feed-carousel-counter { left: 8px; bottom: 9px; }
    .feed-page .feed-carousel-dots { bottom: 12px; max-width: 52%; gap: 5px; }
    .feed-page .feed-comment { padding-left: 0; }
    .feed-page .feed-comment-avatar-link { margin-left: 0; }
    .feed-page .feed-comment.is-reply { margin-left: 12px; padding-left: 8px; }
    .feed-page .feed-comment.thread-depth-2 { margin-left: 24px; }
    .profile-wall-block .feed-comment.thread-depth-2 { margin-inline-start: 24px; }
    .profile-wall-block .feed-comment.is-reply:not(.thread-depth-2) { margin-inline-start: 12px; padding-inline-start: 8px; }
    .feed-page .feed-comment.is-reply .feed-comment-avatar-link { margin-left: 0; }
    .feed-page .feed-comment-form-rich { grid-template-columns: 36px minmax(0,1fr) 44px; gap: 8px; }
    .feed-page .feed-comment-me-avatar,
    .feed-page .feed-comment-me-avatar .feed-avatar { width: 36px; height: 36px; flex-basis: 36px; }
    .feed-page .stories-rail { gap: 10px; }
}


@media (prefers-reduced-motion: reduce) {
    .feed-page .feed-carousel-nav,
    .feed-page .feed-carousel-dot { transition: none; }
}

/* DEALIX forum visual polish — retained separately from the main feed. */

.feed-page .vk-forum-panel.compact {
    border-color: rgba(148, 163, 184, .14);
    background:
        linear-gradient(180deg, rgba(255,255,255,.065), rgba(255,255,255,.032));
    box-shadow: 0 18px 48px rgba(2, 6, 23, .18);
}

.feed-page .vk-forum-panel.compact {
    border-radius: 22px;
}

.feed-page .vk-forum-panel.compact {
    position: relative;
    overflow: hidden;
    padding: 16px 18px;
    gap: 12px;
}

.feed-page .vk-forum-panel.compact::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
    background:
        radial-gradient(circle at 0% 0%, rgba(139,92,246,.15), transparent 34%),
        radial-gradient(circle at 100% 0%, rgba(59,130,246,.09), transparent 34%);
}

.feed-page .vk-forum-panel.compact > * {
    position: relative;
    z-index: 1;
}

.feed-page .forum-panel-head {
    align-items: center;
    padding-bottom: 2px;
}

.feed-page .forum-panel-title {
    gap: 12px;
}

.feed-page .forum-panel-icon {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    background: rgba(139, 92, 246, .15);
    border-color: rgba(167, 139, 250, .26);
    color: #d8b4fe;
}

.feed-page .vk-forum-panel.compact .forum-panel-head h2 {
    font-size: 18px;
    letter-spacing: -0.025em;
}

.feed-page .vk-forum-panel.compact .forum-panel-head p {
    margin-top: 2px;
    font-size: 13px;
    color: var(--text-secondary, #cbd5e1);
}

.feed-page .forum-create-topic-btn {
    min-height: 42px;
    padding: 0 16px;
    border-radius: 999px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
}

.feed-page .forum-create-topic-plus {
    display: inline-grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    background: linear-gradient(135deg, #6366f1, #22d3ee);
    color: #fff;
    line-height: 1;
}

.feed-page .forum-topics-list.compact {
    gap: 6px;
    overflow: visible;
}

.feed-page .vk-forum-panel.compact .forum-topic-row {
    min-height: 54px;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-top: 0;
    border-radius: 16px;
    background: rgba(15, 23, 42, .16);
}

.feed-page .vk-forum-panel.compact .forum-topic-row:hover,
.feed-page .vk-forum-panel.compact .forum-topic-row:focus-visible {
    background: rgba(139, 92, 246, .10);
    border-color: rgba(167, 139, 250, .20);
}

.feed-page .vk-forum-panel.compact .forum-topic-main {
    gap: 5px;
}

.feed-page .vk-forum-panel.compact .forum-topic-main b {
    font-size: 14px;
    letter-spacing: -0.01em;
}

.feed-page .vk-forum-panel.compact .forum-topic-main span,
.feed-page .vk-forum-panel.compact .forum-topic-meta span {
    font-size: 12px;
}

.feed-page .vk-forum-panel.compact .forum-topic-meta {
    min-width: 76px;
    align-self: stretch;
    justify-content: center;
    padding-left: 14px;
    border-left: 1px solid rgba(148, 163, 184, .12);
}

.feed-page .vk-forum-panel.compact .forum-topic-meta strong {
    font-size: 18px;
    letter-spacing: -0.03em;
}

.feed-page .forum-topics-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 2px;
    padding-top: 8px;
    border-top: 1px solid rgba(148, 163, 184, .10);
}

body.theme-light .feed-page .vk-forum-panel.compact {
    background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,250,252,.94));
    border-color: rgba(15, 23, 42, .08);
    box-shadow: 0 18px 48px rgba(15, 23, 42, .08);
}

body.theme-light .feed-page .vk-forum-panel.compact .forum-topic-row {
    background: rgba(241, 245, 249, .72);
    border-color: rgba(15, 23, 42, .05);
}

body.theme-light .feed-page .vk-forum-panel.compact .forum-topic-row:hover,
body.theme-light .feed-page .vk-forum-panel.compact .forum-topic-row:focus-visible {
    background: rgba(99, 102, 241, .075);
    border-color: rgba(99, 102, 241, .16);
}

body.theme-light .feed-page .vk-forum-panel.compact .forum-panel-head p {
    color: var(--text-secondary, #334155);
}

@media (max-width: 720px) {

    .feed-page .vk-forum-panel.compact {
        border-radius: 20px;
    }

    .feed-page .vk-forum-panel.compact {
        padding: 14px;
    }

    .feed-page .forum-panel-head {
        align-items: stretch;
    }

    .feed-page .forum-create-topic-btn {
        width: 100%;
        justify-content: center;
    }

    .feed-page .vk-forum-panel.compact .forum-topic-row {
        padding: 11px 12px;
    }

    .feed-page .vk-forum-panel.compact .forum-topic-meta {
        min-width: 0;
        align-self: auto;
        justify-content: flex-start;
        padding-left: 0;
        border-left: 0;
    }

    .feed-page .forum-topics-pagination {
        align-items: stretch;
        flex-direction: column;
    }
}

/* DEALIX forum topic button hotfix — CSS only, no JS/API changes */
.feed-page .vk-forum-panel.compact .forum-panel-head {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 14px !important;
    min-width: 0 !important;
}

.feed-page .vk-forum-panel.compact .forum-panel-title {
    flex: 1 1 auto !important;
    min-width: 0 !important;
}

.feed-page .forum-create-topic-btn {
    position: relative !important;
    isolation: isolate !important;
    flex: 0 0 auto !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 9px !important;
    min-width: 104px !important;
    min-height: 44px !important;
    padding: 0 18px !important;
    border-radius: 999px !important;
    border: 1px solid rgba(148, 163, 184, .16) !important;
    background:
        linear-gradient(135deg, rgba(255,255,255,.13), rgba(255,255,255,.055)),
        rgba(15, 23, 42, .30) !important;
    color: #f8fafc !important;
    font-size: 14px !important;
    font-weight: 850 !important;
    letter-spacing: -0.015em !important;
    line-height: 1 !important;
    text-decoration: none !important;
    white-space: nowrap !important;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.10),
        0 14px 32px rgba(2, 6, 23, .18) !important;
    transform: translateZ(0) !important;
}

.feed-page .forum-create-topic-btn::before {
    content: '';
    position: absolute;
    inset: -1px;
    z-index: -1;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(124,58,237,.28), rgba(32,198,255,.16));
    opacity: .78;
    pointer-events: none;
}

.feed-page .forum-create-topic-btn:hover,
.feed-page .forum-create-topic-btn:focus-visible {
    border-color: rgba(167, 139, 250, .34) !important;
    background:
        linear-gradient(135deg, rgba(124,58,237,.22), rgba(32,198,255,.12)),
        rgba(15, 23, 42, .38) !important;
    color: #fff !important;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.13),
        0 16px 36px rgba(79, 70, 229, .18) !important;
}

.feed-page .forum-create-topic-plus {
    display: inline-grid !important;
    place-items: center !important;
    flex: 0 0 24px !important;
    width: 24px !important;
    height: 24px !important;
    border-radius: 999px !important;
    background: linear-gradient(135deg, #6d5dfc 0%, #22c7ff 100%) !important;
    color: #fff !important;
    font-size: 16px !important;
    font-weight: 900 !important;
    line-height: 1 !important;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.26),
        0 8px 18px rgba(34, 199, 255, .18) !important;
}

body.theme-light .feed-page .forum-create-topic-btn,
[data-theme="light"] .feed-page .forum-create-topic-btn {
    border-color: rgba(79, 70, 229, .16) !important;
    background:
        linear-gradient(135deg, rgba(255,255,255,.98), rgba(248,250,252,.92)),
        #fff !important;
    color: #312e81 !important;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.85),
        0 14px 30px rgba(79, 70, 229, .12) !important;
}

body.theme-light .feed-page .forum-create-topic-btn:hover,
body.theme-light .feed-page .forum-create-topic-btn:focus-visible,
[data-theme="light"] .feed-page .forum-create-topic-btn:hover,
[data-theme="light"] .feed-page .forum-create-topic-btn:focus-visible {
    border-color: rgba(79, 70, 229, .25) !important;
    background:
        linear-gradient(135deg, rgba(238,242,255,.98), rgba(240,249,255,.94)),
        #fff !important;
    color: #1e1b4b !important;
}

@media (max-width: 720px) {
    .feed-page .vk-forum-panel.compact .forum-panel-head {
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 10px !important;
    }

    .feed-page .vk-forum-panel.compact .forum-panel-title {
        flex: 1 1 auto !important;
        min-width: 0 !important;
        max-width: calc(100% - 96px) !important;
    }

    .feed-page .vk-forum-panel.compact .forum-panel-title > div,
    .feed-page .vk-forum-panel.compact .forum-panel-title h2,
    .feed-page .vk-forum-panel.compact .forum-panel-title p {
        min-width: 0 !important;
    }

    .feed-page .vk-forum-panel.compact .forum-panel-head h2 {
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }

    .feed-page .vk-forum-panel.compact .forum-panel-head p {
        max-width: 100% !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }

    .feed-page .forum-create-topic-btn {
        width: auto !important;
        min-width: 86px !important;
        min-height: 40px !important;
        padding: 0 12px !important;
        gap: 7px !important;
        font-size: 13px !important;
        align-self: center !important;
        justify-self: end !important;
    }

    .feed-page .forum-create-topic-plus {
        flex-basis: 22px !important;
        width: 22px !important;
        height: 22px !important;
        font-size: 15px !important;
    }
}

@media (max-width: 390px) {
    .feed-page .vk-forum-panel.compact .forum-panel-title {
        max-width: calc(100% - 78px) !important;
    }

    .feed-page .forum-create-topic-btn {
        min-width: 68px !important;
        padding: 0 10px !important;
        gap: 5px !important;
    }

    .feed-page .forum-create-topic-plus {
        flex-basis: 21px !important;
        width: 21px !important;
        height: 21px !important;
    }
}

/* DEALIX forum discussion reply polish — isolated feed/forum styles only. */
.forum-topic-page .forum-back-link {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    width: fit-content;
    max-width: 100%;
    min-height: 38px;
    padding: 7px 13px 7px 8px;
    border: 1px solid rgba(148, 163, 184, .14);
    border-radius: 999px;
    background:
        linear-gradient(135deg, rgba(255,255,255,.09), rgba(255,255,255,.035)),
        rgba(15, 23, 42, .30);
    color: rgba(226, 232, 240, .90);
    font-size: 13px;
    font-weight: 750;
    letter-spacing: -.01em;
    text-decoration: none;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 12px 26px rgba(2, 6, 23, .15);
    transition: border-color .16s ease, background .16s ease, color .16s ease, transform .16s ease;
}

.forum-topic-page .forum-back-link:hover,
.forum-topic-page .forum-back-link:focus-visible {
    border-color: rgba(167, 139, 250, .32);
    background:
        linear-gradient(135deg, rgba(124, 58, 237, .18), rgba(34, 199, 255, .08)),
        rgba(15, 23, 42, .38);
    color: #fff;
    transform: translateY(-1px);
}

.forum-back-icon {
    display: inline-grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(124, 58, 237, .95), rgba(34, 199, 255, .82));
    color: #fff;
    line-height: 1;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.22), 0 8px 18px rgba(79, 70, 229, .16);
}

.forum-reply.has-parent {
    position: relative;
}

.forum-reply.has-parent::before {
    content: '';
    position: absolute;
    left: 27px;
    top: -8px;
    bottom: calc(100% - 18px);
    width: 1px;
    background: linear-gradient(180deg, transparent, rgba(139, 92, 246, .36));
    pointer-events: none;
}

.forum-reply-parent {
    display: grid;
    gap: 3px;
    margin: 5px 0 8px;
    padding: 8px 10px;
    border: 1px solid rgba(139, 92, 246, .20);
    border-left: 3px solid rgba(124, 58, 237, .70);
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(124, 58, 237, .10), rgba(34, 199, 255, .045));
    color: rgba(226, 232, 240, .88);
}

.forum-reply-parent span {
    font-size: 12px;
    font-weight: 820;
    letter-spacing: -.01em;
    color: rgba(196, 181, 253, .98);
}

.forum-reply-parent small {
    display: -webkit-box;
    overflow: hidden;
    color: rgba(203, 213, 225, .82);
    font-size: 12px;
    line-height: 1.38;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    word-break: break-word;
}

.forum-reply-to-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 0 10px;
    border: 1px solid rgba(148, 163, 184, .14);
    border-radius: 999px;
    background: rgba(255,255,255,.045);
    color: rgba(226, 232, 240, .84);
    font: inherit;
    font-size: 12px;
    font-weight: 780;
    cursor: pointer;
    transition: border-color .16s ease, background .16s ease, color .16s ease;
}

.forum-reply-to-btn:hover,
.forum-reply-to-btn:focus-visible {
    border-color: rgba(167, 139, 250, .28);
    background: rgba(124, 58, 237, .14);
    color: #fff;
}

.forum-reply-target {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 38px;
    padding: 7px 8px 7px 12px;
    border: 1px solid rgba(139, 92, 246, .22);
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(124, 58, 237, .12), rgba(34, 199, 255, .055));
    color: rgba(226, 232, 240, .92);
    font-size: 13px;
    font-weight: 760;
}

.forum-reply-target.hidden {
    display: none !important;
}

.forum-reply-target-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.forum-reply-target-clear {
    display: inline-grid;
    place-items: center;
    flex: 0 0 26px;
    width: 26px;
    height: 26px;
    border: 1px solid rgba(148, 163, 184, .14);
    border-radius: 999px;
    background: rgba(255,255,255,.06);
    color: rgba(226, 232, 240, .86);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

.forum-reply-target-clear:hover,
.forum-reply-target-clear:focus-visible {
    border-color: rgba(248, 113, 113, .35);
    background: rgba(248, 113, 113, .12);
    color: #fff;
}

body.theme-light .forum-topic-page .forum-back-link,
[data-theme="light"] .forum-topic-page .forum-back-link {
    border-color: rgba(79, 70, 229, .14);
    background: linear-gradient(135deg, rgba(255,255,255,.98), rgba(248,250,252,.92));
    color: #334155;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.86), 0 12px 26px rgba(79, 70, 229, .10);
}

body.theme-light .forum-topic-page .forum-back-link:hover,
body.theme-light .forum-topic-page .forum-back-link:focus-visible,
[data-theme="light"] .forum-topic-page .forum-back-link:hover,
[data-theme="light"] .forum-topic-page .forum-back-link:focus-visible {
    border-color: rgba(79, 70, 229, .24);
    background: linear-gradient(135deg, rgba(238,242,255,.98), rgba(240,249,255,.94));
    color: #1e1b4b;
}

body.theme-light .forum-reply-parent,
[data-theme="light"] .forum-reply-parent,
body.theme-light .forum-reply-target,
[data-theme="light"] .forum-reply-target {
    border-color: rgba(79, 70, 229, .15);
    background: linear-gradient(135deg, rgba(238, 242, 255, .96), rgba(240, 249, 255, .80));
    color: #334155;
}

body.theme-light .forum-reply-parent span,
[data-theme="light"] .forum-reply-parent span {
    color: #4f46e5;
}

body.theme-light .forum-reply-parent small,
[data-theme="light"] .forum-reply-parent small {
    color: #64748b;
}

body.theme-light .forum-reply-to-btn,
[data-theme="light"] .forum-reply-to-btn,
body.theme-light .forum-reply-target-clear,
[data-theme="light"] .forum-reply-target-clear {
    border-color: rgba(79, 70, 229, .12);
    background: rgba(79, 70, 229, .055);
    color: #4338ca;
}

body.theme-light .forum-reply-to-btn:hover,
body.theme-light .forum-reply-to-btn:focus-visible,
[data-theme="light"] .forum-reply-to-btn:hover,
[data-theme="light"] .forum-reply-to-btn:focus-visible {
    border-color: rgba(79, 70, 229, .22);
    background: rgba(79, 70, 229, .10);
    color: #312e81;
}

@media (max-width: 720px) {
    .forum-topic-page .forum-back-link {
        min-height: 36px;
        padding: 6px 11px 6px 7px;
        font-size: 12px;
    }

    .forum-back-icon {
        width: 23px;
        height: 23px;
    }

    .forum-reply.has-parent::before {
        left: 24px;
    }

    .forum-reply-parent {
        margin-top: 6px;
        padding: 7px 9px;
    }

    .forum-reply-to-btn {
        min-height: 30px;
        padding: 0 11px;
    }

    .forum-reply-target {
        min-height: 36px;
        padding: 7px 8px 7px 10px;
    }
}

/* DEALIX forum anti-spam/pagination UI — isolated discussion/replies styles only. */
.forum-replies-pagination-host {
    margin: 12px 0 6px;
}

.forum-replies-pagination {
    margin-top: 0;
    padding: 12px 0 10px;
    border-top: 1px solid rgba(148, 163, 184, .12);
    border-bottom: 1px solid rgba(148, 163, 184, .08);
}

.forum-replies-pagination .forum-page-info {
    color: rgba(203, 213, 225, .78);
    font-size: 12px;
    font-weight: 720;
}

.forum-replies-pagination .forum-page-btn {
    min-width: 32px;
    height: 32px;
    border-radius: 11px;
}

.forum-replies-pagination .forum-page-btn.nav {
    min-width: 70px;
}

body.theme-light .forum-replies-pagination,
[data-theme="light"] .forum-replies-pagination {
    border-top-color: rgba(79, 70, 229, .10);
    border-bottom-color: rgba(79, 70, 229, .07);
}

body.theme-light .forum-replies-pagination .forum-page-info,
[data-theme="light"] .forum-replies-pagination .forum-page-info {
    color: #64748b;
}

@media (max-width: 720px) {
    .forum-replies-pagination-host {
        margin: 10px 0 5px;
    }

    .forum-replies-pagination {
        padding: 10px 0 9px;
    }

    .forum-replies-pagination .forum-page-controls {
        overflow-x: auto;
        justify-content: flex-start;
        padding-bottom: 1px;
        scrollbar-width: none;
    }

    .forum-replies-pagination .forum-page-controls::-webkit-scrollbar {
        display: none;
    }

    .forum-replies-pagination .forum-page-btn {
        flex: 0 0 auto;
    }
}

/* Stage 32B — safe external-link warning for feed/forum user content (CSS only) */
.feed-safe-link {
    display: inline;
    color: #7dd3fc;
    font-weight: 750;
    text-decoration: none;
    border-bottom: 1px solid rgba(125, 211, 252, .42);
    word-break: break-word;
    overflow-wrap: anywhere;
}
.feed-safe-link:hover,
.feed-safe-link:focus-visible {
    color: #bfdbfe;
    border-bottom-color: rgba(191, 219, 254, .72);
    outline: none;
}
.feed-external-link-dialog {
    width: min(540px, 100%);
    gap: 13px;
    overflow: hidden;
}
.feed-external-link-dialog::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 3px;
    background: linear-gradient(90deg, rgba(96, 165, 250, .92), rgba(139, 92, 246, .92), rgba(245, 158, 11, .88));
}
.feed-external-link-icon {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    color: #fef3c7;
    font-size: 22px;
    font-weight: 900;
    line-height: 1;
    background: linear-gradient(135deg, rgba(245, 158, 11, .26), rgba(239, 68, 68, .16));
    border: 1px solid rgba(245, 158, 11, .28);
    box-shadow: 0 14px 34px rgba(245, 158, 11, .12);
}
.feed-external-link-dialog h3 {
    padding-right: 38px;
    letter-spacing: -.02em;
}
.feed-external-link-dialog p {
    font-size: 14.5px;
    line-height: 1.62;
}
.feed-external-link-preview {
    display: grid;
    gap: 5px;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(15, 23, 42, .34);
    border: 1px solid rgba(148, 163, 184, .14);
}
.feed-external-link-preview span {
    color: var(--text-secondary, #9ca3af);
    font-size: 12px;
    font-weight: 750;
    text-transform: uppercase;
    letter-spacing: .055em;
}
.feed-external-link-preview b {
    color: var(--text-primary, #fff);
    font-size: 14px;
    overflow-wrap: anywhere;
}
.feed-external-link-actions .feed-external-link-go {
    box-shadow: 0 14px 32px rgba(79, 70, 229, .22);
}
body.theme-light .feed-safe-link,
html[data-theme="light"] body .feed-safe-link,
[data-theme="light"] .feed-safe-link {
    color: #2563eb;
    border-bottom-color: rgba(37, 99, 235, .34);
}
body.theme-light .feed-safe-link:hover,
html[data-theme="light"] body .feed-safe-link:hover,
[data-theme="light"] .feed-safe-link:hover,
body.theme-light .feed-safe-link:focus-visible,
html[data-theme="light"] body .feed-safe-link:focus-visible,
[data-theme="light"] .feed-safe-link:focus-visible {
    color: #4f46e5;
    border-bottom-color: rgba(79, 70, 229, .55);
}
body.theme-light .feed-external-link-icon,
html[data-theme="light"] body .feed-external-link-icon,
[data-theme="light"] .feed-external-link-icon {
    color: #92400e;
    background: linear-gradient(135deg, rgba(245, 158, 11, .18), rgba(239, 68, 68, .08));
    border-color: rgba(245, 158, 11, .24);
    box-shadow: 0 14px 30px rgba(245, 158, 11, .11);
}
body.theme-light .feed-external-link-preview,
html[data-theme="light"] body .feed-external-link-preview,
[data-theme="light"] .feed-external-link-preview {
    background: #f8fafc;
    border-color: rgba(15, 23, 42, .08);
}
body.theme-light .feed-external-link-preview b,
html[data-theme="light"] body .feed-external-link-preview b,
[data-theme="light"] .feed-external-link-preview b {
    color: #0f172a;
}
@media (max-width: 560px) {
    .feed-external-link-dialog {
        border-radius: 22px;
    }
    .feed-external-link-icon {
        width: 38px;
        height: 38px;
        border-radius: 14px;
        font-size: 20px;
    }
    .feed-external-link-dialog p {
        font-size: 13.5px;
    }
    .feed-external-link-actions {
        gap: 8px;
    }
}


/* DEALIX feed comments pagination — scoped UI only, no moderation/API action changes */
.feed-page .feed-comments-pagebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 10px 0 12px;
    padding-top: 10px;
    border-top: 1px solid rgba(148, 163, 184, .10);
}

.feed-page .feed-comment-page-info {
    font-size: 12px;
    font-weight: 650;
    color: var(--text-secondary, #94a3b8);
    white-space: nowrap;
}

.feed-page .feed-comment-page-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
    flex-wrap: wrap;
}

.feed-page .feed-comment-page-btn {
    min-width: 30px;
    height: 30px;
    padding: 0 9px;
    border-radius: 999px;
    font-size: 12px;
    line-height: 1;
}

.feed-page .feed-comment-page-btn.nav {
    min-width: 70px;
}

.feed-page .feed-comment-page-gap {
    min-width: 18px;
    text-align: center;
    color: var(--text-secondary, #94a3b8);
}

.feed-page .feed-comments-loading {
    opacity: .82;
}

@media (max-width: 640px) {
    .feed-page .feed-comments-pagebar {
        align-items: stretch;
        flex-direction: column;
        gap: 8px;
    }

    .feed-page .feed-comment-page-info {
        text-align: center;
        white-space: normal;
    }

    .feed-page .feed-comment-page-controls {
        justify-content: center;
    }

    .feed-page .feed-comment-page-btn.nav {
        min-width: 62px;
    }
}

/* DEALIX profile photo comments: external links + pagination (isolated UI only) */
.profile-photo-comment .profile-safe-link {
    color: #7dd3fc;
    font-weight: 750;
    text-decoration: none;
    border-bottom: 1px solid rgba(125, 211, 252, .42);
    overflow-wrap: anywhere;
    word-break: break-word;
}

.profile-photo-comment .profile-safe-link:hover {
    color: #bae6fd;
    border-bottom-color: rgba(186, 230, 253, .78);
}

body.theme-light .profile-photo-comment .profile-safe-link,
[data-theme="light"] .profile-photo-comment .profile-safe-link {
    color: #2563eb;
    border-bottom-color: rgba(37, 99, 235, .34);
}

body.theme-light .profile-photo-comment .profile-safe-link:hover,
[data-theme="light"] .profile-photo-comment .profile-safe-link:hover {
    color: #1d4ed8;
    border-bottom-color: rgba(29, 78, 216, .62);
}

.profile-photo-comments-pagebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 10px 0 4px;
    padding: 10px 0 2px;
    border-top: 1px solid rgba(148, 163, 184, .12);
}

.profile-photo-comment-page-info {
    font-size: 12px;
    font-weight: 650;
    color: var(--text-secondary, #94a3b8);
    white-space: nowrap;
}

.profile-photo-comment-page-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
    flex-wrap: wrap;
}

.profile-photo-comment-page-btn {
    min-width: 30px;
    height: 30px;
    padding: 0 9px;
    border: 1px solid rgba(148, 163, 184, .18);
    border-radius: 999px;
    background: rgba(15, 23, 42, .36);
    color: var(--text-primary, #e5e7eb);
    font-size: 12px;
    font-weight: 760;
    line-height: 1;
    cursor: pointer;
    transition: transform .16s ease, background .16s ease, border-color .16s ease, opacity .16s ease;
}

.profile-photo-comment-page-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    border-color: rgba(125, 211, 252, .42);
    background: rgba(37, 99, 235, .20);
}

.profile-photo-comment-page-btn.active {
    border-color: rgba(96, 165, 250, .62);
    background: linear-gradient(135deg, rgba(37, 99, 235, .92), rgba(14, 165, 233, .76));
    color: #fff;
}

.profile-photo-comment-page-btn:disabled {
    opacity: .42;
    cursor: default;
}

.profile-photo-comment-page-btn.nav {
    min-width: 68px;
}

.profile-photo-comment-page-gap {
    min-width: 18px;
    text-align: center;
    color: var(--text-secondary, #94a3b8);
}

body.theme-light .profile-photo-comments-pagebar,
[data-theme="light"] .profile-photo-comments-pagebar {
    border-top-color: rgba(37, 99, 235, .10);
}

body.theme-light .profile-photo-comment-page-btn,
[data-theme="light"] .profile-photo-comment-page-btn {
    background: rgba(255, 255, 255, .82);
    color: #334155;
    border-color: rgba(148, 163, 184, .28);
}

body.theme-light .profile-photo-comment-page-btn:hover:not(:disabled),
[data-theme="light"] .profile-photo-comment-page-btn:hover:not(:disabled) {
    background: rgba(239, 246, 255, .96);
    border-color: rgba(37, 99, 235, .30);
}

body.theme-light .profile-photo-comment-page-btn.active,
[data-theme="light"] .profile-photo-comment-page-btn.active {
    background: linear-gradient(135deg, #2563eb, #0ea5e9);
    border-color: rgba(37, 99, 235, .42);
    color: #fff;
}

@media (max-width: 640px) {
    .profile-photo-comments-pagebar {
        align-items: stretch;
        flex-direction: column;
        gap: 8px;
    }

    .profile-photo-comment-page-info {
        text-align: center;
        white-space: normal;
    }

    .profile-photo-comment-page-controls {
        justify-content: center;
    }

    .profile-photo-comment-page-btn.nav {
        min-width: 62px;
    }
}

/* Stage chat external link warning — chat text links only, no chat logic changes */
.chat-safe-link {
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
    border-bottom: 1px solid color-mix(in srgb, var(--primary) 42%, transparent);
    word-break: break-word;
    overflow-wrap: anywhere;
}
.chat-safe-link:hover {
    border-bottom-color: var(--primary);
    filter: brightness(1.08);
}
.chat-external-link-modal {
    width: min(520px, calc(100vw - 24px));
    gap: 14px;
    padding: 18px;
}
.chat-external-link-icon {
    width: 46px;
    height: 46px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    font-size: 1.15rem;
    font-weight: 900;
    color: #fef3c7;
    background: linear-gradient(135deg, rgba(245, 158, 11, .95), rgba(239, 68, 68, .86));
    box-shadow: 0 14px 34px rgba(245, 158, 11, .22);
}
.chat-external-link-head {
    display: block;
}
.chat-external-link-head b {
    font-size: 1.08rem;
    letter-spacing: -0.02em;
}
.chat-external-link-head small {
    font-size: .9rem;
    line-height: 1.55;
}
.chat-external-link-preview {
    display: grid;
    gap: 4px;
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: color-mix(in srgb, var(--bg-secondary) 78%, transparent);
}
.chat-external-link-preview span {
    color: var(--text-muted);
    font-size: .76rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
}
.chat-external-link-preview b {
    color: var(--text);
    font-size: .92rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}
.chat-external-link-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}
.chat-external-link-actions .btn {
    min-height: 40px;
    border-radius: 14px;
}
.chat-external-link-actions .chat-external-link-go {
    box-shadow: 0 12px 30px color-mix(in srgb, var(--primary) 22%, transparent);
}
body.theme-light .chat-external-link-preview,
html[data-theme="light"] body .chat-external-link-preview,
[data-theme="light"] .chat-external-link-preview {
    background: rgba(248, 250, 252, .86);
}
body.theme-light .chat-safe-link,
html[data-theme="light"] body .chat-safe-link,
[data-theme="light"] .chat-safe-link {
    color: color-mix(in srgb, var(--primary) 86%, #0f172a);
}
@media (max-width: 640px) {
    .chat-external-link-overlay {
        align-items: flex-end;
        padding: 12px;
    }
    .chat-external-link-modal {
        width: 100%;
        border-radius: 22px;
        padding: 16px;
    }
    .chat-external-link-icon {
        width: 40px;
        height: 40px;
        border-radius: 14px;
    }
    .chat-external-link-head small {
        font-size: .84rem;
    }
    .chat-external-link-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
    .chat-external-link-actions .btn {
        width: 100%;
        padding-inline: 10px;
    }
}

/* Stage chat link visibility hotfix v2 — plain readable links, no white pill/background */
.message .chat-safe-link,
.chat-message .chat-safe-link {
    display: inline;
    max-width: 100%;
    padding: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    line-height: inherit;
    font-weight: 800;
    text-decoration: underline;
    text-decoration-thickness: 1.5px;
    text-underline-offset: 3px;
    border-bottom: 0 !important;
    box-shadow: none !important;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.message.sent .chat-safe-link,
.message.outgoing .chat-safe-link,
.chat-message.sent .chat-safe-link,
.chat-message.outgoing .chat-safe-link {
    color: #ffffff !important;
    text-decoration-color: rgba(255, 255, 255, .86);
    text-shadow: 0 1px 2px rgba(15, 23, 42, .28);
}

.message.sent .chat-safe-link:hover,
.message.outgoing .chat-safe-link:hover,
.chat-message.sent .chat-safe-link:hover,
.chat-message.outgoing .chat-safe-link:hover {
    color: #ffffff !important;
    text-decoration-color: #ffffff;
    filter: brightness(1.06);
}

.message.received .chat-safe-link,
.message.incoming .chat-safe-link,
.chat-message.received .chat-safe-link,
.chat-message.incoming .chat-safe-link {
    color: color-mix(in srgb, var(--primary) 86%, #ffffff) !important;
    text-decoration-color: color-mix(in srgb, var(--primary) 72%, transparent);
}

body.theme-light .message.received .chat-safe-link,
html[data-theme="light"] body .message.received .chat-safe-link,
[data-theme="light"] .message.received .chat-safe-link,
body.theme-light .message.incoming .chat-safe-link,
html[data-theme="light"] body .message.incoming .chat-safe-link,
[data-theme="light"] .message.incoming .chat-safe-link,
body.theme-light .chat-message.received .chat-safe-link,
html[data-theme="light"] body .chat-message.received .chat-safe-link,
[data-theme="light"] .chat-message.received .chat-safe-link,
body.theme-light .chat-message.incoming .chat-safe-link,
html[data-theme="light"] body .chat-message.incoming .chat-safe-link,
[data-theme="light"] .chat-message.incoming .chat-safe-link {
    color: color-mix(in srgb, var(--primary) 82%, #0f172a) !important;
    text-decoration-color: color-mix(in srgb, var(--primary) 70%, transparent);
}


/* PWA Stage-2.2: installed app update banner */
.dealix-pwa-update-banner {
    position: fixed;
    left: max(16px, env(safe-area-inset-left));
    right: max(16px, env(safe-area-inset-right));
    bottom: calc(18px + env(safe-area-inset-bottom));
    z-index: 99999;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    width: min(760px, calc(100vw - 32px));
    margin: 0 auto;
    padding: 14px;
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 24px;
    color: #f8fafc;
    background: linear-gradient(135deg, rgba(30, 41, 59, .94), rgba(17, 24, 39, .94));
    box-shadow: 0 22px 70px rgba(0,0,0,.38), inset 0 1px 0 rgba(255,255,255,.08);
    backdrop-filter: blur(20px);
    transform: translateY(calc(100% + 32px));
    opacity: 0;
    pointer-events: none;
    transition: transform .26s ease, opacity .26s ease;
}

.dealix-pwa-update-banner.visible {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.dealix-pwa-update-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    font-weight: 900;
    font-size: 22px;
    color: #fff;
    background: linear-gradient(135deg, #7c3aed, #2563eb);
    box-shadow: 0 12px 34px rgba(124, 58, 237, .32);
}

.dealix-pwa-update-text {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.dealix-pwa-update-text strong {
    font-size: 15px;
    line-height: 1.25;
    letter-spacing: -.01em;
}

.dealix-pwa-update-text span {
    color: rgba(226,232,240,.78);
    font-size: 13px;
    line-height: 1.35;
}

.dealix-pwa-update-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.dealix-pwa-update-btn {
    min-height: 40px;
    border: 0;
    border-radius: 999px;
    padding: 0 15px;
    cursor: pointer;
    font: 800 13px/1 Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    white-space: nowrap;
}

.dealix-pwa-update-btn.primary {
    color: #fff;
    background: linear-gradient(135deg, #7c3aed, #2563eb);
    box-shadow: 0 12px 28px rgba(37,99,235,.28);
}

.dealix-pwa-update-btn.ghost {
    color: #dbeafe;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.12);
}

@media (max-width: 640px) {
    .dealix-pwa-update-banner {
        grid-template-columns: auto minmax(0, 1fr);
        align-items: start;
        bottom: calc(12px + env(safe-area-inset-bottom));
        border-radius: 22px;
    }

    .dealix-pwa-update-actions {
        grid-column: 1 / -1;
        width: 100%;
    }

    .dealix-pwa-update-btn {
        flex: 1;
    }
}

@media (max-width: 380px) {
    .dealix-pwa-update-banner {
        left: max(10px, env(safe-area-inset-left));
        right: max(10px, env(safe-area-inset-right));
        width: min(760px, calc(100vw - 20px));
        padding: 12px;
        gap: 10px;
    }

    .dealix-pwa-update-icon {
        width: 38px;
        height: 38px;
        border-radius: 14px;
        font-size: 20px;
    }

    .dealix-pwa-update-text strong {
        font-size: 14px;
    }

    .dealix-pwa-update-text span {
        font-size: 12px;
    }
}

/* === Stage chat voice mobile hotfix: recorder replaces composer, iOS chunks === */
/* Match the focused-composer owner's specificity: stale focus must not reveal
   the old wrapper and move Cancel between pointer-down and pointer-up. */
html body .app[data-page="chats"] .chats-page .chat-active .chat-input-area.voice-recording-active,
.chats-page .chat-active .chat-input-area.voice-recording-active,
body[data-page="chats"] .chat-active .chat-input-area.voice-recording-active,
body.theme-light[data-page="chats"] .chat-active .chat-input-area.voice-recording-active {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 0 !important;
    pointer-events: none !important;
}

html body .app[data-page="chats"] .chats-page .chat-active .chat-input-area.voice-recording-active .chat-input-actions,
html body .app[data-page="chats"] .chats-page .chat-active .chat-input-area.voice-recording-active .chat-input-wrapper,
html body .app[data-page="chats"] .chats-page .chat-active .chat-input-area.voice-recording-active #send-message-btn,
.chats-page .chat-active .chat-input-area.voice-recording-active .chat-input-actions,
.chats-page .chat-active .chat-input-area.voice-recording-active .chat-input-wrapper,
.chats-page .chat-active .chat-input-area.voice-recording-active #send-message-btn,
body[data-page="chats"] .chat-active .chat-input-area.voice-recording-active .chat-input-actions,
body[data-page="chats"] .chat-active .chat-input-area.voice-recording-active .chat-input-wrapper,
body[data-page="chats"] .chat-active .chat-input-area.voice-recording-active #send-message-btn {
    display: none !important;
    width: 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
    height: 0 !important;
    min-height: 0 !important;
    flex: 0 0 0 !important;
    grid-column: auto !important;
    padding: 0 !important;
    margin: 0 !important;
    opacity: 0 !important;
    overflow: hidden !important;
    pointer-events: none !important;
}

.chats-page .chat-active .chat-input-area.voice-recording-active #voice-recording-bar,
body[data-page="chats"] .chat-active .chat-input-area.voice-recording-active #voice-recording-bar {
    grid-column: 1 / -1 !important;
    width: 100% !important;
    max-width: min(560px, calc(100vw - 20px)) !important;
    justify-self: center !important;
    display: flex !important;
    pointer-events: auto !important;
    box-sizing: border-box !important;
}

@media (max-width: 520px) {
    .chats-page .chat-active .chat-input-area.voice-recording-active,
    body[data-page="chats"] .chat-active .chat-input-area.voice-recording-active {
        padding-left: 8px !important;
        padding-right: 8px !important;
    }

    .chats-page .chat-active .chat-input-area.voice-recording-active #voice-recording-bar,
    body[data-page="chats"] .chat-active .chat-input-area.voice-recording-active #voice-recording-bar {
        min-height: 50px !important;
        padding: 7px 8px !important;
        gap: 8px !important;
        border-radius: 24px !important;
    }

    .chats-page .chat-active .chat-input-area.voice-recording-active .voice-rec-left,
    body[data-page="chats"] .chat-active .chat-input-area.voice-recording-active .voice-rec-left {
        gap: 7px !important;
    }

    .chats-page .chat-active .chat-input-area.voice-recording-active .voice-rec-actions,
    body[data-page="chats"] .chat-active .chat-input-area.voice-recording-active .voice-rec-actions {
        gap: 6px !important;
    }

    .chats-page .chat-active .chat-input-area.voice-recording-active .voice-rec-btn,
    body[data-page="chats"] .chat-active .chat-input-area.voice-recording-active .voice-rec-btn {
        min-height: 44px !important;
        padding: 0 !important;
        font-size: .78rem !important;
        white-space: nowrap !important;
    }
}

@media (max-width: 380px) {
    .chats-page .chat-active .chat-input-area.voice-recording-active .voice-rec-wave,
    body[data-page="chats"] .chat-active .chat-input-area.voice-recording-active .voice-rec-wave {
        display: flex !important;
    }

    .chats-page .chat-active .chat-input-area.voice-recording-active .voice-rec-btn,
    body[data-page="chats"] .chat-active .chat-input-area.voice-recording-active .voice-rec-btn {
        padding: 0 !important;
    }
}

/* DEALIX hotfix: stable mobile video-circle recorder
   - swipe DOWN changes the inline voice control to circle mode (JS)
   - recording is tap-to-start / tap-screen-to-send
   - timer lives near controls, not inside the video circle */
.video-circle-recorder {
    touch-action: none !important;
    overscroll-behavior: contain !important;
    -webkit-user-select: none !important;
    user-select: none !important;
}
.video-circle-preview-wrap .video-circle-rec-timer {
    display: none !important;
}
.video-circle-rec-controls .video-circle-rec-timer {
    position: static !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    min-width: 74px !important;
    height: 48px !important;
    padding: 0 14px !important;
    border-radius: 999px !important;
    background: rgba(15, 23, 42, .34) !important;
    border: 1px solid rgba(255,255,255,.10) !important;
    color: #fff !important;
    font-size: .92rem !important;
    font-weight: 900 !important;
    font-variant-numeric: tabular-nums !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
}
.video-circle-rec-controls {
    gap: 10px !important;
    padding: 8px 10px !important;
}
.video-circle-rec-hint {
    bottom: max(96px, calc(80px + env(safe-area-inset-bottom))) !important;
}
#voice-record-btn.video-circle-mode {
    touch-action: none !important;
}
@media (max-width: 768px) {
    .video-circle-preview-wrap {
        width: min(74vw, 390px) !important;
        height: min(74vw, 390px) !important;
        max-width: calc(100vw - 34px) !important;
        max-height: calc(100dvh - 230px) !important;
    }
    .video-circle-rec-controls {
        bottom: max(22px, env(safe-area-inset-bottom)) !important;
        max-width: calc(100vw - 22px) !important;
    }
    .video-circle-rec-controls .video-circle-rec-timer {
        min-width: 68px !important;
        height: 46px !important;
        padding: 0 12px !important;
        font-size: .86rem !important;
    }
    .video-circle-control,
    .video-circle-cancel {
        width: 46px !important;
        height: 46px !important;
        min-width: 46px !important;
    }
}
@media (max-width: 380px) {
    .video-circle-rec-controls {
        gap: 8px !important;
        padding: 7px 8px !important;
    }
    .video-circle-rec-controls .video-circle-rec-timer {
        min-width: 62px !important;
        padding: 0 10px !important;
    }
    .video-circle-control,
    .video-circle-cancel {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
    }
}

/* === DEALIX mobile chat composer bounds hotfix ===
   Fixes iPhone/PWA bottom composer clipping: attach/send buttons and text field
   stay inside the viewport, lifted above the home indicator. CSS-only: no chat
   logic, no media recorder, no API/backend changes. */
@media (max-width: 768px) {
    /* Reserve only the extra lift of the composer above its existing 8px gap. */
    .chats-page .chat-active,
    body[data-page="chats"] .chat-active {
        --chat-composer-safe-extra: max(0px, calc(env(safe-area-inset-bottom, 0px) - 8px));
    }

    .chats-page .chat-active .chat-input-area:not(.voice-recording-active):not(.video-circle-recording-active),
    body[data-page="chats"] .chat-active .chat-input-area:not(.voice-recording-active):not(.video-circle-recording-active) {
        left: 0 !important;
        right: 0 !important;
        bottom: max(8px, env(safe-area-inset-bottom, 0px)) !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        display: grid !important;
        grid-template-columns: auto minmax(0, 1fr) !important;
        grid-auto-rows: auto !important;
        align-items: center !important;
        column-gap: 8px !important;
        row-gap: 8px !important;
        padding: 0 max(8px, env(safe-area-inset-right, 0px)) 0 max(8px, env(safe-area-inset-left, 0px)) !important;
        overflow: visible !important;
        transform: translate3d(0, calc(-1 * var(--chat-keyboard-shift, 0px)), 0) !important;
    }

    .chats-page .chat-active .chat-input-area:not(.voice-recording-active):not(.video-circle-recording-active) .chat-forward-inline:not(.hidden),
    .chats-page .chat-active .chat-input-area:not(.voice-recording-active):not(.video-circle-recording-active) .chat-edit-inline:not(.hidden),
    body[data-page="chats"] .chat-active .chat-input-area:not(.voice-recording-active):not(.video-circle-recording-active) .chat-forward-inline:not(.hidden),
    body[data-page="chats"] .chat-active .chat-input-area:not(.voice-recording-active):not(.video-circle-recording-active) .chat-edit-inline:not(.hidden) {
        grid-column: 1 / -1 !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .chats-page .chat-active .chat-input-area:not(.voice-recording-active):not(.video-circle-recording-active) .chat-input-actions,
    body[data-page="chats"] .chat-active .chat-input-area:not(.voice-recording-active):not(.video-circle-recording-active) .chat-input-actions {
        display: flex !important;
        grid-column: 1 !important;
        grid-row: auto !important;
        align-items: center !important;
        justify-content: flex-start !important;
        gap: 8px !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: max-content !important;
        padding: 0 !important;
        margin: 0 !important;
        overflow: visible !important;
        pointer-events: auto !important;
        background: transparent !important;
        border: 0 !important;
        box-shadow: none !important;
        transform: none !important;
    }

    .chats-page .chat-active .chat-input-area:not(.voice-recording-active):not(.video-circle-recording-active) .chat-input-wrapper,
    body[data-page="chats"] .chat-active .chat-input-area:not(.voice-recording-active):not(.video-circle-recording-active) .chat-input-wrapper {
        grid-column: 2 !important;
        grid-row: auto !important;
        justify-self: stretch !important;
        align-self: center !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        margin: 0 !important;
        transform: none !important;
    }

    .chats-page .chat-active .chat-input-area:not(.voice-recording-active):not(.video-circle-recording-active) .chat-input-wrapper textarea,
    .chats-page .chat-active .chat-input-area:not(.voice-recording-active):not(.video-circle-recording-active) #message-input,
    body[data-page="chats"] .chat-active .chat-input-area:not(.voice-recording-active):not(.video-circle-recording-active) .chat-input-wrapper textarea,
    body[data-page="chats"] .chat-active .chat-input-area:not(.voice-recording-active):not(.video-circle-recording-active) #message-input {
        width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        transform: none !important;
    }

    .chats-page .chat-active .chat-input-area:not(.voice-recording-active):not(.video-circle-recording-active) #attach-file-btn,
    .chats-page .chat-active .chat-input-area:not(.voice-recording-active):not(.video-circle-recording-active) #voice-record-btn,
    body[data-page="chats"] .chat-active .chat-input-area:not(.voice-recording-active):not(.video-circle-recording-active) #attach-file-btn,
    body[data-page="chats"] .chat-active .chat-input-area:not(.voice-recording-active):not(.video-circle-recording-active) #voice-record-btn,
    .chats-page .chat-active .chat-input-area:not(.voice-recording-active):not(.video-circle-recording-active) #send-message-btn,
    body[data-page="chats"] .chat-active .chat-input-area:not(.voice-recording-active):not(.video-circle-recording-active) #send-message-btn {
        flex-shrink: 0 !important;
        box-sizing: border-box !important;
    }

    .chats-page .chat-active .chat-messages,
    body[data-page="chats"] .chat-active .chat-messages {
        padding-bottom: max(104px, calc(var(--chat-composer-h, 62px) + 42px + env(safe-area-inset-bottom, 0px))) !important;
        scroll-padding-bottom: max(112px, calc(var(--chat-composer-h, 62px) + 50px + env(safe-area-inset-bottom, 0px))) !important;
    }
}

@media (max-width: 390px) {
    .chats-page .chat-active .chat-input-area:not(.voice-recording-active):not(.video-circle-recording-active),
    body[data-page="chats"] .chat-active .chat-input-area:not(.voice-recording-active):not(.video-circle-recording-active) {
        column-gap: 6px !important;
        padding-left: max(6px, env(safe-area-inset-left, 0px)) !important;
        padding-right: max(6px, env(safe-area-inset-right, 0px)) !important;
    }

    .chats-page .chat-active .chat-input-area:not(.voice-recording-active):not(.video-circle-recording-active) .chat-input-actions,
    body[data-page="chats"] .chat-active .chat-input-area:not(.voice-recording-active):not(.video-circle-recording-active) .chat-input-actions {
        gap: 6px !important;
    }

    .chats-page .chat-active .chat-input-area:not(.voice-recording-active):not(.video-circle-recording-active) #attach-file-btn,
    .chats-page .chat-active .chat-input-area:not(.voice-recording-active):not(.video-circle-recording-active) #voice-record-btn,
    body[data-page="chats"] .chat-active .chat-input-area:not(.voice-recording-active):not(.video-circle-recording-active) #attach-file-btn,
    body[data-page="chats"] .chat-active .chat-input-area:not(.voice-recording-active):not(.video-circle-recording-active) #voice-record-btn {
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
        min-height: 40px !important;
        flex-basis: 40px !important;
    }

    .chats-page .chat-active .chat-input-area:not(.voice-recording-active):not(.video-circle-recording-active) #send-message-btn,
    body[data-page="chats"] .chat-active .chat-input-area:not(.voice-recording-active):not(.video-circle-recording-active) #send-message-btn {
        width: 46px !important;
        height: 46px !important;
        min-width: 46px !important;
        min-height: 46px !important;
        flex-basis: 46px !important;
    }

    .chats-page .chat-active .chat-input-area:not(.voice-recording-active):not(.video-circle-recording-active) .chat-input-wrapper,
    body[data-page="chats"] .chat-active .chat-input-area:not(.voice-recording-active):not(.video-circle-recording-active) .chat-input-wrapper {
        min-height: 46px !important;
        padding-left: 11px !important;
        padding-right: 11px !important;
    }

    .chats-page .chat-active .chat-input-area:not(.voice-recording-active):not(.video-circle-recording-active) .chat-input-wrapper textarea,
    .chats-page .chat-active .chat-input-area:not(.voice-recording-active):not(.video-circle-recording-active) #message-input,
    body[data-page="chats"] .chat-active .chat-input-area:not(.voice-recording-active):not(.video-circle-recording-active) .chat-input-wrapper textarea,
    body[data-page="chats"] .chat-active .chat-input-area:not(.voice-recording-active):not(.video-circle-recording-active) #message-input {
        min-height: 44px !important;
        padding-top: 12px !important;
        padding-bottom: 10px !important;
    }
}

/* === DEALIX integrated chat composer controls ===
   Paperclip, media, emoji and shield controls remain mounted inside the capsule.
   44px targets and explicit text insets keep both gestures and typing stable. */
html body .app[data-page="chats"] .chats-page .chat-active .chat-input-area:not(.voice-recording-active):not(.video-circle-recording-active),
body[data-page="chats"] .chat-active .chat-input-area:not(.voice-recording-active):not(.video-circle-recording-active) {
    grid-template-columns: minmax(0, 1fr) !important;
}

html body .app[data-page="chats"] .chats-page .chat-active .chat-input-area:not(.voice-recording-active):not(.video-circle-recording-active) .chat-input-wrapper,
body[data-page="chats"] .chat-active .chat-input-area:not(.voice-recording-active):not(.video-circle-recording-active) .chat-input-wrapper {
    position: relative !important;
    min-height: 52px !important;
    display: block !important;
    flex: 1 1 auto !important;
    flex-basis: auto !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    padding: 0 !important;
    overflow: visible !important;
}

html body .app[data-page="chats"] .chats-page .chat-active .chat-input-wrapper > .chat-composer-attach-slot,
body[data-page="chats"] .chat-active .chat-input-wrapper > .chat-composer-attach-slot,
html body .app[data-page="chats"] .chats-page .chat-active .chat-input-wrapper > .chat-composer-action-slot,
body[data-page="chats"] .chat-active .chat-input-wrapper > .chat-composer-action-slot,
html body .app[data-page="chats"] .chats-page .chat-active .chat-input-wrapper > .chat-composer-emoji-slot,
body[data-page="chats"] .chat-active .chat-input-wrapper > .chat-composer-emoji-slot,
html body .app[data-page="chats"] .chats-page .chat-active .chat-input-wrapper > .chat-composer-send-slot,
body[data-page="chats"] .chat-active .chat-input-wrapper > .chat-composer-send-slot {
    position: absolute !important;
    z-index: 4 !important;
    top: 50% !important;
    bottom: auto !important;
    width: 44px;
    height: 44px !important;
    min-width: 0 !important;
    min-height: 44px !important;
    max-width: 44px !important;
    max-height: 44px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    transform: translateY(-50%) !important;
    pointer-events: none !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
}

html body .app[data-page="chats"] .chats-page .chat-active .chat-input-wrapper > .chat-composer-attach-slot,
body[data-page="chats"] .chat-active .chat-input-wrapper > .chat-composer-attach-slot {
    left: 4px !important;
}

/* Voice/circle shares the send position (owner, 2026-10-08): the composer state
   shows one of them through aria-hidden, like Telegram. */
html body .app[data-page="chats"] .chats-page .chat-active .chat-input-wrapper > .chat-composer-action-slot,
body[data-page="chats"] .chat-active .chat-input-wrapper > .chat-composer-action-slot {
    left: auto !important;
    right: 4px !important;
}

html body .app[data-page="chats"] .chats-page .chat-active .chat-input-wrapper > .chat-composer-send-slot,
body[data-page="chats"] .chat-active .chat-input-wrapper > .chat-composer-send-slot {
    left: auto !important;
    right: 4px !important;
}

html body .app[data-page="chats"] .chats-page .chat-active .chat-input-area .chat-input-wrapper .chat-composer-attach-slot > #attach-file-btn,
html body .app[data-page="chats"] .chats-page .chat-active .chat-input-area .chat-input-wrapper .chat-composer-action-slot > #voice-record-btn,
html body .app[data-page="chats"] .chats-page .chat-active .chat-input-area .chat-input-wrapper .chat-composer-emoji-slot > #chat-composer-emoji-btn,
html body .app[data-page="chats"] .chats-page .chat-active .chat-input-area .chat-input-wrapper .chat-composer-send-slot > #send-message-btn,
body[data-page="chats"] .chat-active .chat-input-wrapper .chat-composer-attach-slot > #attach-file-btn,
body[data-page="chats"] .chat-active .chat-input-wrapper .chat-composer-action-slot > #voice-record-btn,
body[data-page="chats"] .chat-active .chat-input-wrapper .chat-composer-emoji-slot > #chat-composer-emoji-btn,
body[data-page="chats"] .chat-active .chat-input-wrapper .chat-composer-send-slot > #send-message-btn {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    max-width: 44px !important;
    max-height: 44px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 0 0 44px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 50% !important;
    transform-origin: center !important;
    transition: opacity .17s ease, transform .22s cubic-bezier(.2,.8,.2,1), visibility 0s linear .22s, background .18s ease, color .18s ease, box-shadow .18s ease !important;
    -webkit-tap-highlight-color: transparent;
}

html body .app[data-page="chats"] .chats-page .chat-active .chat-input-area .chat-input-wrapper .chat-composer-attach-slot > #attach-file-btn,
body[data-page="chats"] .chat-active .chat-input-wrapper .chat-composer-attach-slot > #attach-file-btn {
    position: relative !important;
    touch-action: manipulation !important;
}

#chat-file-input.chat-file-input-native {
    position: fixed !important;
    left: 0 !important;
    bottom: 0 !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    border: 0 !important;
    opacity: 0 !important;
    overflow: hidden !important;
    pointer-events: none !important;
    clip-path: inset(50%) !important;
}

html body .app[data-page="chats"] .chats-page .chat-active .chat-input-area .chat-input-wrapper .chat-composer-action-slot > #voice-record-btn,
html body .app[data-page="chats"] .chats-page .chat-active .chat-input-area .chat-input-wrapper .chat-composer-emoji-slot > #chat-composer-emoji-btn,
html body .app[data-page="chats"] .chats-page .chat-active .chat-input-area .chat-input-wrapper .chat-composer-send-slot > #send-message-btn,
body[data-page="chats"] .chat-active .chat-input-wrapper .chat-composer-action-slot > #voice-record-btn,
body[data-page="chats"] .chat-active .chat-input-wrapper .chat-composer-emoji-slot > #chat-composer-emoji-btn,
body[data-page="chats"] .chat-active .chat-input-wrapper .chat-composer-send-slot > #send-message-btn {
    position: absolute !important;
    inset: 0 !important;
}

html body .app[data-page="chats"] .chats-page .chat-active .chat-input-area .chat-input-wrapper #attach-file-btn,
html body .app[data-page="chats"] .chats-page .chat-active .chat-input-area .chat-input-wrapper #voice-record-btn,
html body .app[data-page="chats"] .chats-page .chat-active .chat-input-area .chat-input-wrapper #chat-composer-emoji-btn,
body[data-page="chats"] .chat-active .chat-input-wrapper #attach-file-btn,
body[data-page="chats"] .chat-active .chat-input-wrapper #voice-record-btn,
body[data-page="chats"] .chat-active .chat-input-wrapper #chat-composer-emoji-btn {
    color: var(--text-muted) !important;
    background: transparent !important;
    box-shadow: none !important;
}

html body .app[data-page="chats"] .chats-page .chat-active .chat-input-area .chat-input-wrapper #voice-record-btn {
    touch-action: none !important;
}

html body .app[data-page="chats"] .chats-page .chat-active .chat-input-wrapper :is(#attach-file-btn, #voice-record-btn) {
    color: var(--text-secondary) !important;
}

html body .app[data-page="chats"] .chats-page .chat-active .chat-input-wrapper :is(#attach-file-btn, #voice-record-btn):is(:hover, :focus-visible):not(:disabled) {
    color: var(--text) !important;
    background: var(--bg-hover) !important;
}

html body .app[data-page="chats"] .chats-page .chat-active .chat-input-wrapper :is(#attach-file-btn, #voice-record-btn):focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

html body .app[data-page="chats"] .chats-page .chat-active .chat-input-wrapper #chat-composer-emoji-btn svg,
body[data-page="chats"] .chat-active .chat-input-wrapper #chat-composer-emoji-btn svg {
    width: 24px !important;
    height: 24px !important;
    min-width: 24px !important;
    min-height: 24px !important;
    stroke: currentColor !important;
    stroke-width: 2.1 !important;
    fill: none !important;
}

html body .app[data-page="chats"] .chats-page .chat-active .chat-input-area .chat-input-wrapper #attach-file-btn svg,
html body .app[data-page="chats"] .chats-page .chat-active .chat-input-area .chat-input-wrapper #voice-record-btn svg,
body[data-page="chats"] .chat-active .chat-input-wrapper #attach-file-btn svg,
body[data-page="chats"] .chat-active .chat-input-wrapper #voice-record-btn svg {
    width: 30px !important;
    height: 30px !important;
    min-width: 30px !important;
    min-height: 30px !important;
    stroke: currentColor !important;
    stroke-width: 1.85 !important;
    fill: none !important;
}

html body .app[data-page="chats"] .chats-page .chat-active .chat-input-area .chat-input-wrapper #send-message-btn svg,
body[data-page="chats"] .chat-active .chat-input-wrapper #send-message-btn svg {
    width: 24px !important;
    height: 24px !important;
    min-width: 24px !important;
    min-height: 24px !important;
}

html body .app[data-page="chats"] .chats-page .chat-active .chat-input-area .chat-input-wrapper #voice-record-btn .chat-composer-media-glyph,
body[data-page="chats"] .chat-active .chat-input-wrapper #voice-record-btn .chat-composer-media-glyph {
    position: absolute;
    width: 30px !important;
    height: 30px !important;
    min-width: 30px !important;
    min-height: 30px !important;
    stroke-width: 1.85 !important;
    opacity: 1;
    transform: rotate(0deg) scale(1);
    transform-origin: center;
    transition: opacity .16s ease, transform .22s cubic-bezier(.2,.8,.2,1) !important;
}

html body .app[data-page="chats"] .chats-page .chat-active .chat-input-area .chat-input-wrapper #voice-record-btn .chat-composer-media-glyph-circle,
body[data-page="chats"] .chat-active .chat-input-wrapper #voice-record-btn .chat-composer-media-glyph-circle,
html body .app[data-page="chats"] .chats-page .chat-active .chat-input-area .chat-input-wrapper #voice-record-btn.video-circle-mode .chat-composer-media-glyph-voice,
body[data-page="chats"] .chat-active .chat-input-wrapper #voice-record-btn.video-circle-mode .chat-composer-media-glyph-voice {
    opacity: 0;
    transform: rotate(-14deg) scale(.58);
}

html body .app[data-page="chats"] .chats-page .chat-active .chat-input-area .chat-input-wrapper #voice-record-btn.video-circle-mode .chat-composer-media-glyph-circle,
body[data-page="chats"] .chat-active .chat-input-wrapper #voice-record-btn.video-circle-mode .chat-composer-media-glyph-circle {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

html body .app[data-page="chats"] .chats-page .chat-active .chat-input-area .chat-input-wrapper #voice-record-btn.video-circle-mode,
body[data-page="chats"] .chat-active .chat-input-wrapper #voice-record-btn.video-circle-mode {
    color: var(--primary) !important;
    background: color-mix(in srgb, var(--primary-light) 78%, var(--bg-hover)) !important;
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 28%, transparent) !important;
}

html body .app[data-page="chats"] .chats-page .chat-active .chat-input-area .chat-input-wrapper #send-message-btn,
body[data-page="chats"] .chat-active .chat-input-wrapper #send-message-btn {
    color: #fff !important;
    background: var(--primary-grad) !important;
    box-shadow: 0 7px 18px rgba(80, 74, 220, .28) !important;
    touch-action: manipulation !important;
}

html body .app[data-page="chats"] .chats-page .chat-active .chat-input-area .chat-input-wrapper #attach-file-btn[aria-hidden="false"],
html body .app[data-page="chats"] .chats-page .chat-active .chat-input-area .chat-input-wrapper #voice-record-btn[aria-hidden="false"],
html body .app[data-page="chats"] .chats-page .chat-active .chat-input-area .chat-input-wrapper #chat-composer-emoji-btn[aria-hidden="false"],
html body .app[data-page="chats"] .chats-page .chat-active .chat-input-area .chat-input-wrapper #send-message-btn[aria-hidden="false"],
body[data-page="chats"] .chat-active .chat-input-wrapper #attach-file-btn[aria-hidden="false"],
body[data-page="chats"] .chat-active .chat-input-wrapper #voice-record-btn[aria-hidden="false"],
body[data-page="chats"] .chat-active .chat-input-wrapper #chat-composer-emoji-btn[aria-hidden="false"],
body[data-page="chats"] .chat-active .chat-input-wrapper #send-message-btn[aria-hidden="false"] {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    transform: translate3d(0, 0, 0) scale(1) !important;
    transition-delay: 0s !important;
}

html body .app[data-page="chats"] .chats-page .chat-active .chat-input-area .chat-input-wrapper #attach-file-btn[aria-hidden="true"],
html body .app[data-page="chats"] .chats-page .chat-active .chat-input-area .chat-input-wrapper #voice-record-btn[aria-hidden="true"],
html body .app[data-page="chats"] .chats-page .chat-active .chat-input-area .chat-input-wrapper #chat-composer-emoji-btn[aria-hidden="true"],
html body .app[data-page="chats"] .chats-page .chat-active .chat-input-area .chat-input-wrapper #send-message-btn[aria-hidden="true"],
body[data-page="chats"] .chat-active .chat-input-wrapper #attach-file-btn[aria-hidden="true"],
body[data-page="chats"] .chat-active .chat-input-wrapper #voice-record-btn[aria-hidden="true"],
body[data-page="chats"] .chat-active .chat-input-wrapper #chat-composer-emoji-btn[aria-hidden="true"],
body[data-page="chats"] .chat-active .chat-input-wrapper #send-message-btn[aria-hidden="true"] {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    transform: translate3d(-7px, 0, 0) scale(.68) !important;
}

html body .app[data-page="chats"] .chats-page .chat-active .chat-input-area .chat-input-wrapper #send-message-btn[aria-hidden="true"],
body[data-page="chats"] .chat-active .chat-input-wrapper #send-message-btn[aria-hidden="true"] {
    transform: translate3d(7px, 0, 0) scale(.68) !important;
}

html body .app[data-page="chats"] .chats-page .chat-active .chat-input-area .chat-input-wrapper #send-message-btn.send-disabled[aria-hidden="false"],
body[data-page="chats"] .chat-active .chat-input-area .chat-input-wrapper #send-message-btn.send-disabled[aria-hidden="false"] {
    opacity: .48 !important;
    pointer-events: none !important;
}

html body .app[data-page="chats"] .chats-page .chat-active .chat-input-area:not(.voice-recording-active):not(.video-circle-recording-active) #message-input,
body[data-page="chats"] .chat-active .chat-input-area:not(.voice-recording-active):not(.video-circle-recording-active) #message-input {
    width: 100% !important;
    min-width: 0 !important;
    padding-left: 56px !important;
    padding-right: 102px !important;
    box-sizing: border-box !important;
    transition: padding-left .22s cubic-bezier(.2,.8,.2,1), padding-right .22s cubic-bezier(.2,.8,.2,1) !important;
}

html body .app[data-page="chats"] .chats-page #chat-active.support-chat-active .chat-input-area #message-input,
html body .app[data-page="chats"] .chats-page #chat-active[data-chat-type="support"] .chat-input-area #message-input {
    padding-left: 56px !important;
    padding-right: 56px !important;
}

html body .app[data-page="chats"] .chats-page .chat-active .chat-input-area.composer-is-typing #message-input,
body[data-page="chats"] .chat-active .chat-input-area.composer-is-typing #message-input {
    padding-left: 56px !important;
    padding-right: 102px !important;
}

@media (max-width: 768px) {
    html body .app[data-page="chats"] .chats-page .chat-active .chat-input-area:not(.voice-recording-active):not(.video-circle-recording-active),
    body[data-page="chats"] .chat-active .chat-input-area:not(.voice-recording-active):not(.video-circle-recording-active) {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    html body .app[data-page="chats"] .chats-page .chat-active .chat-input-area:not(.voice-recording-active):not(.video-circle-recording-active) .chat-input-wrapper,
    body[data-page="chats"] .chat-active .chat-input-area:not(.voice-recording-active):not(.video-circle-recording-active) .chat-input-wrapper {
        grid-column: 1 !important;
        width: 100% !important;
        padding: 0 !important;
    }

    html body .app[data-page="chats"] .chats-page .chat-active .chat-input-area .chat-input-wrapper #attach-file-btn svg,
    html body .app[data-page="chats"] .chats-page .chat-active .chat-input-area .chat-input-wrapper #voice-record-btn svg,
    body[data-page="chats"] .chat-active .chat-input-wrapper #attach-file-btn svg,
    body[data-page="chats"] .chat-active .chat-input-wrapper #voice-record-btn svg {
        width: 30px !important;
        height: 30px !important;
        min-width: 30px !important;
        min-height: 30px !important;
    }
}

/* Only renderer-classified standalone emoji lose their bubble. Important
   declarations match existing base/saved skins; quotes/media stay unchanged.
   The long-press dialog preview renders the same messages, so it follows. */
#chat-active #chat-messages .message.single-emoji-message,
#chat-dialog-preview-body .message.single-emoji-message {
    background: transparent !important;
    border-color: transparent !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    padding: 5px 9px !important;
    color: var(--text) !important;
}

#chat-active #chat-messages .message.single-emoji-message .message-content,
#chat-dialog-preview-body .message.single-emoji-message .message-content {
    overflow: visible !important;
}

#chat-active #chat-messages .message.single-emoji-message .message-time,
#chat-dialog-preview-body .message.single-emoji-message .message-time {
    width: fit-content;
    margin-inline-start: auto;
    padding: 2px 6px;
    border-radius: 10px;
    color: var(--text-secondary) !important;
    background: var(--bg-secondary);
}

/* DEALIX composer emoji picker */
.chat-input-wrapper > .chat-composer-emoji-slot {
    left: auto !important;
    right: auto !important;
    inset-inline-end: 50px !important;
}

#chat-composer-emoji-btn.chat-composer-emoji-btn {
    min-width: 44px !important;
    min-height: 44px !important;
    color: var(--text-muted) !important;
    background: transparent !important;
    touch-action: manipulation;
}

#chat-composer-emoji-btn.chat-composer-emoji-btn:hover,
#chat-composer-emoji-btn.chat-composer-emoji-btn[aria-expanded="true"] {
    color: var(--primary) !important;
    background: color-mix(in srgb, var(--primary) 12%, transparent) !important;
}

#chat-composer-emoji-btn.chat-composer-emoji-btn:disabled,
#chat-composer-emoji-btn.chat-composer-emoji-btn.disabled {
    opacity: .42 !important;
    cursor: default;
}

.chat-composer-emoji-picker {
    position: absolute;
    z-index: 8;
    inset-inline-end: 4px;
    bottom: calc(100% + 8px);
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: min(352px, calc(100vw - 20px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
    max-width: calc(100vw - 20px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px));
    max-height: min(380px, calc(var(--chat-vh, 100dvh) - 140px));
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--bg-modal, var(--bg-card));
    box-shadow: 0 14px 34px rgba(0, 0, 0, .24);
    animation: chatComposerEmojiIn .14s ease-out;
}

.chat-composer-emoji-picker.hidden {
    display: none !important;
}

.chat-composer-emoji-option {
    width: 100%;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    border: 0;
    border-radius: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    background: transparent;
    font-size: 1.875rem;
    line-height: 1;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background .14s ease, transform .14s ease;
}

.dealix-emoji-search {
    box-sizing: border-box;
    flex: 0 0 auto;
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-input, var(--bg-card));
    color: var(--text);
    font: inherit;
    font-size: 16px;
}

.dealix-emoji-categories {
    display: flex;
    flex: 0 0 auto;
    gap: 2px;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border-dark) transparent;
    overscroll-behavior-inline: contain;
}

.dealix-emoji-category {
    display: grid;
    place-items: center;
    flex: 0 0 44px;
    height: 44px;
    border: 0;
    border-radius: 10px;
    padding: 0;
    color: var(--text-muted);
    background: transparent;
    cursor: pointer;
}

.dealix-emoji-category[aria-pressed="true"],
.dealix-emoji-category:hover {
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 12%, transparent);
}

.dealix-emoji-heading {
    flex: 0 0 auto;
    padding-inline: 4px;
    color: var(--text-muted);
    font-size: .76rem;
    font-weight: 600;
}

.dealix-emoji-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(44px, 1fr));
    gap: 4px;
    min-height: 44px;
    overflow-y: auto;
    overscroll-behavior: contain;
    align-content: start;
}

.dealix-emoji-status {
    color: var(--text-muted);
    font-size: .84rem;
    padding: 14px 6px;
    text-align: center;
}

.chat-single-emoji {
    display: inline-block;
    font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
    font-size: 4rem;
    line-height: 1.18;
    vertical-align: middle;
}

.emoji-artwork {
    position: relative;
    display: inline-grid;
    place-items: center;
    width: 1.12em;
    height: 1.12em;
    vertical-align: middle;
    line-height: 1;
}

.emoji-artwork-fallback { grid-area: 1 / 1; }
.emoji-artwork.is-emoji-art-ready > .emoji-artwork-fallback { opacity: 0; }
.emoji-artwork-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    user-select: none;
    opacity: 0;
}
.emoji-artwork.is-emoji-art-ready > .emoji-artwork-image { opacity: 1; }
/* Owner 2026-10-19: a chat reaction that was just put or has just arrived plays
   once (playEmojiArtworkOnce): the animation covers the static art for its run;
   artwork without an animation gets a short pop. */
.emoji-artwork-animation {
    position: absolute;
    inset: -18%;
    width: 136%;
    height: 136%;
    object-fit: contain;
    pointer-events: none;
    user-select: none;
    opacity: 0;
}
.emoji-artwork.is-emoji-art-playing > .emoji-artwork-animation { opacity: 1; }
.emoji-artwork.is-emoji-art-playing > :is(.emoji-artwork-image, .emoji-artwork-fallback) { opacity: 0; }
.emoji-artwork.is-emoji-art-pop {
    transform-origin: 50% 70%;
    animation: emojiArtworkPop .6s cubic-bezier(.22, .8, .24, 1) both;
}
@keyframes emojiArtworkPop {
    0% { transform: scale(.6); }
    45% { transform: scale(1.3) rotate(-6deg); }
    75% { transform: scale(.95) rotate(2deg); }
    100% { transform: scale(1) rotate(0); }
}

#chat-messages > .message:last-child .chat-single-emoji:not(.chat-emoji-animatable),
#chat-messages > .message-wrap:last-child .chat-single-emoji:not(.chat-emoji-animatable),
.chat-single-emoji:not(.chat-emoji-animatable):active {
    animation: chatSingleEmojiGreeting .6s ease-out;
    transform-origin: 50% 75%;
}

@keyframes chatSingleEmojiGreeting {
    0% { transform: scale(.85) rotate(-8deg); }
    45% { transform: scale(1.12) rotate(6deg); }
    75% { transform: scale(.98) rotate(-3deg); }
    100% { transform: scale(1) rotate(0); }
}

.chat-single-emoji.chat-emoji-animatable {
    position: relative;
    cursor: pointer;
    border-radius: 12px;
}

.chat-single-emoji-animation {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}

.chat-single-emoji-animation[hidden] { display: none; }
.is-emoji-animating > .chat-single-emoji-glyph {
    animation: chatEmojiGlyphReturn var(--chat-emoji-duration, 1600ms) linear both;
}
.chat-single-emoji-animation:not([hidden]) {
    animation: chatEmojiArtFinish var(--chat-emoji-duration, 1600ms) linear both;
}
.is-emoji-glyph-animating > .chat-single-emoji-glyph {
    display: inline-block;
    transform-origin: 50% 75%;
    animation: chatEmojiGlyphMotion var(--chat-emoji-duration, 900ms) cubic-bezier(.22, .8, .24, 1) both;
}
@keyframes chatEmojiArtFinish {
    0%, 87% { opacity: 1; }
    100% { opacity: 0; }
}
@keyframes chatEmojiGlyphReturn {
    0%, 87% { opacity: 0; }
    100% { opacity: 1; }
}
@keyframes chatEmojiGlyphMotion {
    0% { opacity: .6; transform: translate3d(var(--chat-emoji-drift, 0px), var(--chat-emoji-lift, 12px), 0) rotate(var(--chat-emoji-tilt, 8deg)) scale(.78); }
    44% { opacity: 1; transform: translate3d(0, -4px, 0) rotate(0) scale(var(--chat-emoji-overshoot, 1.12)); }
    72% { transform: translate3d(0, 2px, 0) rotate(var(--chat-emoji-return-tilt, -1deg)) scale(.96); }
    100% { opacity: 1; transform: translate3d(0, 0, 0) rotate(0) scale(1); }
}
.chat-emoji-animatable:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
}

.chat-composer-emoji-option:hover,
.chat-composer-emoji-option:active {
    background: var(--bg-hover);
    transform: scale(.96);
}

#chat-composer-emoji-btn.chat-composer-emoji-btn:focus-visible,
.chat-composer-emoji-option:focus-visible,
.dealix-emoji-category:focus-visible,
.dealix-emoji-search:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--primary) 78%, white 22%);
    outline-offset: 2px;
}

@keyframes chatComposerEmojiIn {
    from { opacity: .55; transform: translateY(4px) scale(.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 340px) {
    .dealix-emoji-grid {
        grid-template-columns: repeat(5, minmax(44px, 1fr));
    }
}
/* DEALIX composer emoji picker end */

@media (prefers-reduced-motion: reduce) {
    .is-emoji-animating > .chat-single-emoji-glyph,
    .is-emoji-glyph-animating > .chat-single-emoji-glyph,
    .chat-single-emoji-animation:not([hidden]),
    .emoji-artwork.is-emoji-art-pop {
        animation: none;
    }
    .chat-input-wrapper > .chat-composer-send-slot,
    .chat-single-emoji,
    .chat-input-wrapper > .chat-composer-emoji-slot,
    .chat-input-wrapper .chat-composer-attach-slot > #attach-file-btn,
    .chat-input-wrapper .chat-composer-action-slot > #voice-record-btn,
    .chat-input-wrapper .chat-composer-emoji-slot > #chat-composer-emoji-btn,
    .chat-input-wrapper .chat-composer-send-slot > #send-message-btn,
    .chat-input-wrapper #voice-record-btn .chat-composer-media-glyph,
    .chat-composer-emoji-picker,
    .chat-composer-emoji-option,
    .chat-input-wrapper #message-input {
        animation: none !important;
        transition-duration: .01ms !important;
    }
}


/* === DEALIX mobile bottom nav 14T: PWA compact + larger taps ===
   CSS-only: fixes iPhone/PWA bottom menu ballooning from safe-area height.
   The nav keeps a fixed visual height, stays inside the viewport, and tap
   targets/icons/labels are larger. Does not touch chat JS, composer, API or wallet logic. */
@media (max-width: 768px) {
    :root {
        --mobile-bottom-nav-h: 72px;
    }

    html body .mobile-bottom-nav {
        --mobile-bottom-nav-padding: 8px;
        --mobile-bottom-nav-gap: 5px;
        --mobile-bottom-selection-radius: 18px;
        left: max(8px, env(safe-area-inset-left, 0px)) !important;
        right: max(8px, env(safe-area-inset-right, 0px)) !important;
        bottom: max(8px, env(safe-area-inset-bottom, 0px)) !important;
        height: var(--mobile-bottom-nav-h) !important;
        min-height: var(--mobile-bottom-nav-h) !important;
        max-height: var(--mobile-bottom-nav-h) !important;
        padding: var(--mobile-bottom-nav-padding) !important;
        gap: var(--mobile-bottom-nav-gap) !important;
        border-radius: 24px !important;
        border-bottom-left-radius: 24px !important;
        border-bottom-right-radius: 24px !important;
        box-sizing: border-box !important;
        overflow: visible !important;
        transform: translate3d(0, 0, 0) !important;
    }

    html body .mobile-bottom-item {
        min-height: 54px !important;
        height: 100% !important;
        padding: 4px 2px !important;
        gap: 4px !important;
        border-radius: 18px !important;
        align-items: center !important;
        justify-content: center !important;
        box-sizing: border-box !important;
    }

    html body .mobile-bottom-icon,
    html body .mobile-bottom-icon svg {
        width: 27px !important;
        height: 27px !important;
        min-width: 27px !important;
        min-height: 27px !important;
    }

    html body .mobile-bottom-label {
        font-size: 12px !important;
        line-height: 1.08 !important;
        font-weight: 650 !important;
        max-width: 100% !important;
    }

    html body .mobile-bottom-badge {
        top: -8px !important;
        right: -10px !important;
        min-width: 19px !important;
        height: 19px !important;
        font-size: 11px !important;
    }

    /* Reserve only the real compact nav height + its bottom offset.
       This prevents the dialog list from showing a huge dead strip above the nav. */
    html body .app:not([data-page="chats"]):not([data-page="auth"]):not([data-page^="admin"]) .page-content,
    html body .app:not([data-page="chats"]):not([data-page="auth"]):not([data-page^="admin"]) #page-content {
        padding-bottom: calc(var(--mobile-bottom-nav-h) + 18px + env(safe-area-inset-bottom, 0px)) !important;
        margin-bottom: 0 !important;
    }

    html body .app[data-page="chats"]:not(.mobile-chat-open-app) .chats-list {
        padding-bottom: calc(var(--mobile-bottom-nav-h) + 18px + env(safe-area-inset-bottom, 0px)) !important;
        scroll-padding-bottom: calc(var(--mobile-bottom-nav-h) + 18px + env(safe-area-inset-bottom, 0px)) !important;
        margin-bottom: 0 !important;
    }
}

@media (max-width: 390px) {
    :root {
        --mobile-bottom-nav-h: 68px;
    }

    html body .mobile-bottom-nav {
        --mobile-bottom-nav-padding: 7px;
        --mobile-bottom-nav-gap: 4px;
        --mobile-bottom-selection-radius: 17px;
        left: max(7px, env(safe-area-inset-left, 0px)) !important;
        right: max(7px, env(safe-area-inset-right, 0px)) !important;
        bottom: max(7px, env(safe-area-inset-bottom, 0px)) !important;
        padding: var(--mobile-bottom-nav-padding) !important;
        gap: var(--mobile-bottom-nav-gap) !important;
        border-radius: 22px !important;
        border-bottom-left-radius: 22px !important;
        border-bottom-right-radius: 22px !important;
    }

    html body .mobile-bottom-item {
        min-height: 50px !important;
        border-radius: 17px !important;
    }

    html body .mobile-bottom-icon,
    html body .mobile-bottom-icon svg {
        width: 25px !important;
        height: 25px !important;
        min-width: 25px !important;
        min-height: 25px !important;
    }

    html body .mobile-bottom-label {
        font-size: 11.5px !important;
    }
}

@media (max-width: 360px) {
    :root {
        --mobile-bottom-nav-h: 66px;
    }

    html body .mobile-bottom-nav {
        --mobile-bottom-nav-padding: 6px;
        left: max(6px, env(safe-area-inset-left, 0px)) !important;
        right: max(6px, env(safe-area-inset-right, 0px)) !important;
        bottom: max(6px, env(safe-area-inset-bottom, 0px)) !important;
        padding: var(--mobile-bottom-nav-padding) !important;
        border-radius: 20px !important;
        border-bottom-left-radius: 20px !important;
        border-bottom-right-radius: 20px !important;
    }

    html body .mobile-bottom-icon,
    html body .mobile-bottom-icon svg {
        width: 24px !important;
        height: 24px !important;
        min-width: 24px !important;
        min-height: 24px !important;
    }

    html body .mobile-bottom-label {
        font-size: 11px !important;
    }
}


/* DEALIX mobile bottom nav flush-bottom hotfix
   CSS-only: keep the PWA/mobile bottom nav visually attached to the bottom edge
   above the home indicator without increasing its height. Does not change chat logic. */
@media (max-width: 768px) {
    html body .mobile-bottom-nav {
        bottom: env(safe-area-inset-bottom, 0px) !important;
        transform: translateY(0) !important;
        margin-bottom: 0 !important;
    }
}

@media (display-mode: standalone) and (max-width: 768px) {
    html body .mobile-bottom-nav {
        bottom: env(safe-area-inset-bottom, 0px) !important;
        transform: translateY(0) !important;
        margin-bottom: 0 !important;
    }
}

@media (max-width: 430px) {
    html body .mobile-bottom-nav {
        bottom: env(safe-area-inset-bottom, 0px) !important;
    }
}

/* DEALIX mobile PWA: reliable left-swipe reveal for archive/security rows.
   The root cause was passive touchend-only handlers: iOS could convert the
   gesture into page scroll/navigation before the row received a usable end event. */
@media (hover: none) and (pointer: coarse) {
    .p2p-order-swipe,
    .deal-archive-swipe,
    .security-swipe-row {
        touch-action: pan-y;
        overscroll-behavior: contain;
        -webkit-user-select: none;
        user-select: none;
    }

    .p2p-order-swipe .p2p-order-summary,
    .deal-archive-swipe .deal-list-item,
    .security-swipe-row .security-session-row,
    .security-swipe-row .security-history-row {
        will-change: transform;
    }
}

/* === PWA mobile route gesture guard: keep iOS history swipe from fighting side menu === */
@media (max-width: 1024px) {
  html,
  body,
  #app,
  .app,
  .main-content,
  .page-content {
    overscroll-behavior-x: none;
  }

  #sidebar,
  #sidebar-overlay,
  .sidebar,
  .main-content,
  .page-content {
    -webkit-user-select: none;
    user-select: none;
  }

  input,
  textarea,
  [contenteditable="true"] {
    -webkit-user-select: text;
    user-select: text;
  }
}

/* === DEALIX mobile/PWA dialogs list visual scale hotfix ===
   Bigger and more readable dialog rows on phones without changing chat logic. */
@media (max-width: 768px) {
    #chats-list,
    .chats-list {
        padding: 10px 9px 16px !important;
        gap: 5px !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    #chats-list .chat-item,
    .chats-list .chat-item {
        width: 100% !important;
        max-width: 100% !important;
        min-height: 72px !important;
        padding: 13px 12px !important;
        margin: 0 0 5px !important;
        border-radius: 18px !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
        align-items: center !important;
    }

    #chats-list .chat-item-left,
    .chats-list .chat-item-left {
        gap: 12px !important;
        min-width: 0 !important;
        flex: 1 1 auto !important;
    }

    #chats-list .chat-item .avatar,
    #chats-list .chat-item-avatar,
    #chats-list .chat-item .group-avatar,
    .chats-list .chat-item .avatar,
    .chats-list .chat-item-avatar,
    .chats-list .chat-item .group-avatar {
        width: 50px !important;
        height: 50px !important;
        min-width: 50px !important;
        min-height: 50px !important;
        font-size: 18px !important;
        flex: 0 0 50px !important;
    }

    #chats-list .chat-item-title,
    #chats-list .chat-item-name,
    .chats-list .chat-item-title,
    .chats-list .chat-item-name {
        font-size: 0.96875rem !important;
        line-height: 1.18 !important;
        margin-bottom: 4px !important;
        max-width: 100% !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }

    #chats-list .chat-item-preview,
    .chats-list .chat-item-preview {
        font-size: 0.828125rem !important;
        line-height: 1.25 !important;
        max-width: 100% !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }

    #chats-list .chat-item-right,
    .chats-list .chat-item-right {
        margin-left: 8px !important;
        flex: 0 0 auto !important;
        max-width: 76px !important;
    }

    #chats-list .chat-item-time,
    .chats-list .chat-item-time {
        font-size: 11.5px !important;
        line-height: 1.1 !important;
    }

    #chats-list .chat-item-badge,
    .chats-list .chat-item-badge {
        min-width: 21px !important;
        height: 21px !important;
        padding: 0 6px !important;
        font-size: 11px !important;
        line-height: 21px !important;
    }
}

@media (display-mode: standalone) and (max-width: 768px) {
    #chats-list .chat-item,
    .chats-list .chat-item {
        min-height: 74px !important;
        padding-block: 14px !important;
    }
}

@media (max-width: 390px) {
    #chats-list,
    .chats-list {
        padding-inline: 8px !important;
    }

    #chats-list .chat-item,
    .chats-list .chat-item {
        min-height: 70px !important;
        padding: 12px 10px !important;
    }

    #chats-list .chat-item .avatar,
    #chats-list .chat-item-avatar,
    #chats-list .chat-item .group-avatar,
    .chats-list .chat-item .avatar,
    .chats-list .chat-item-avatar,
    .chats-list .chat-item .group-avatar {
        width: 48px !important;
        height: 48px !important;
        min-width: 48px !important;
        min-height: 48px !important;
        flex-basis: 48px !important;
    }

    #chats-list .chat-item-title,
    #chats-list .chat-item-name,
    .chats-list .chat-item-title,
    .chats-list .chat-item-name {
        font-size: 0.9375rem !important;
    }

    #chats-list .chat-item-preview,
    .chats-list .chat-item-preview {
        font-size: 0.8125rem !important;
    }
}

/* === DEALIX mobile/PWA dialog list avatar + scroll root correction ===
   Fixes the real conflict: older .avatar.small rule capped max-width at 36px,
   while the mobile scale rule raised width/height to 48-50px. That made avatars
   render oval. Also reserves real scroll space above fixed bottom nav. */
@media (max-width: 768px) {
    .app[data-page="chats"]:not(.mobile-chat-open-app) .chats-page,
    .app[data-page="chats"]:not(.mobile-chat-open-app) .chats-container,
    .app[data-page="chats"]:not(.mobile-chat-open-app) .chats-sidebar {
        min-height: 0 !important;
        overflow: hidden !important;
    }

    .app[data-page="chats"]:not(.mobile-chat-open-app) #chats-list,
    .app[data-page="chats"]:not(.mobile-chat-open-app) .chats-list {
        min-height: 0 !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        padding-bottom: calc(var(--mobile-bottom-nav-h, 58px) + 34px + env(safe-area-inset-bottom, 0px)) !important;
        scroll-padding-bottom: calc(var(--mobile-bottom-nav-h, 58px) + 34px + env(safe-area-inset-bottom, 0px)) !important;
        box-sizing: border-box !important;
    }

    .app[data-page="chats"]:not(.mobile-chat-open-app) #chats-list .chat-item .avatar,
    .app[data-page="chats"]:not(.mobile-chat-open-app) #chats-list .chat-item .avatar.small,
    .app[data-page="chats"]:not(.mobile-chat-open-app) #chats-list .chat-item-avatar,
    .app[data-page="chats"]:not(.mobile-chat-open-app) #chats-list .chat-item .group-avatar,
    .app[data-page="chats"]:not(.mobile-chat-open-app) .chats-list .chat-item .avatar,
    .app[data-page="chats"]:not(.mobile-chat-open-app) .chats-list .chat-item .avatar.small,
    .app[data-page="chats"]:not(.mobile-chat-open-app) .chats-list .chat-item-avatar,
    .app[data-page="chats"]:not(.mobile-chat-open-app) .chats-list .chat-item .group-avatar {
        width: 50px !important;
        height: 50px !important;
        min-width: 50px !important;
        min-height: 50px !important;
        max-width: 50px !important;
        max-height: 50px !important;
        flex: 0 0 50px !important;
        aspect-ratio: 1 / 1 !important;
        border-radius: 50% !important;
        overflow: hidden !important;
        clip-path: circle(50% at 50% 50%) !important;
        align-self: center !important;
        box-sizing: border-box !important;
    }

    .app[data-page="chats"]:not(.mobile-chat-open-app) #chats-list .chat-item .avatar img,
    .app[data-page="chats"]:not(.mobile-chat-open-app) #chats-list .chat-item .avatar.small img,
    .app[data-page="chats"]:not(.mobile-chat-open-app) #chats-list .chat-item .group-avatar img,
    .app[data-page="chats"]:not(.mobile-chat-open-app) .chats-list .chat-item .avatar img,
    .app[data-page="chats"]:not(.mobile-chat-open-app) .chats-list .chat-item .avatar.small img,
    .app[data-page="chats"]:not(.mobile-chat-open-app) .chats-list .chat-item .group-avatar img {
        width: 100% !important;
        height: 100% !important;
        min-width: 100% !important;
        min-height: 100% !important;
        max-width: 100% !important;
        max-height: 100% !important;
        object-fit: cover !important;
        object-position: center !important;
        aspect-ratio: 1 / 1 !important;
        border-radius: 50% !important;
        display: block !important;
    }
}

@media (max-width: 390px) {
    .app[data-page="chats"]:not(.mobile-chat-open-app) #chats-list .chat-item .avatar,
    .app[data-page="chats"]:not(.mobile-chat-open-app) #chats-list .chat-item .avatar.small,
    .app[data-page="chats"]:not(.mobile-chat-open-app) #chats-list .chat-item-avatar,
    .app[data-page="chats"]:not(.mobile-chat-open-app) #chats-list .chat-item .group-avatar,
    .app[data-page="chats"]:not(.mobile-chat-open-app) .chats-list .chat-item .avatar,
    .app[data-page="chats"]:not(.mobile-chat-open-app) .chats-list .chat-item .avatar.small,
    .app[data-page="chats"]:not(.mobile-chat-open-app) .chats-list .chat-item-avatar,
    .app[data-page="chats"]:not(.mobile-chat-open-app) .chats-list .chat-item .group-avatar {
        width: 48px !important;
        height: 48px !important;
        min-width: 48px !important;
        min-height: 48px !important;
        max-width: 48px !important;
        max-height: 48px !important;
        flex-basis: 48px !important;
    }

    .app[data-page="chats"]:not(.mobile-chat-open-app) #chats-list,
    .app[data-page="chats"]:not(.mobile-chat-open-app) .chats-list {
        padding-bottom: calc(var(--mobile-bottom-nav-h, 58px) + 38px + env(safe-area-inset-bottom, 0px)) !important;
        scroll-padding-bottom: calc(var(--mobile-bottom-nav-h, 58px) + 38px + env(safe-area-inset-bottom, 0px)) !important;
    }
}

/* === DEALIX mobile/PWA chat composer focus anchor correction ===
   Root cause: old high-specificity focus rule set chat-input-area bottom:0 on
   chat-input-focused, while the current normal mobile composer is lifted by the
   same bottom safe gap. On iPhone/PWA that made the whole composer row drop a
   few pixels on tap/focus and return on blur. Keep the normal and focused
   non-keyboard states anchored to the exact same bottom/padding geometry.
   CSS-only: no chat JS, send, upload, voice, circles, API or routing changes. */
@media (max-width: 768px) {
    html body.chat-input-focused:not(.chat-keyboard-shift) .app[data-page="chats"] .chat-active .chat-input-area:not(.voice-recording-active):not(.video-circle-recording-active),
    html body.chat-input-focused:not(.chat-keyboard-shift) .chats-page .chat-active .chat-input-area:not(.voice-recording-active):not(.video-circle-recording-active),
    html body.chat-keyboard-closing:not(.chat-keyboard-shift) .app[data-page="chats"] .chat-active .chat-input-area:not(.voice-recording-active):not(.video-circle-recording-active),
    html body.chat-keyboard-closing:not(.chat-keyboard-shift) .chats-page .chat-active .chat-input-area:not(.voice-recording-active):not(.video-circle-recording-active),
    html body:not(.chat-keyboard-shift) .app[data-page="chats"] .chat-active .chat-input-area.mobile-composer-expanded:not(.voice-recording-active):not(.video-circle-recording-active),
    html body:not(.chat-keyboard-shift) .chats-page .chat-active .chat-input-area.mobile-composer-expanded:not(.voice-recording-active):not(.video-circle-recording-active) {
        left: 0 !important;
        right: 0 !important;
        bottom: max(8px, env(safe-area-inset-bottom, 0px)) !important;
        width: 100% !important;
        max-width: 100% !important;
        height: 62px !important;
        min-height: 62px !important;
        max-height: 62px !important;
        padding-top: 0 !important;
        padding-right: max(8px, env(safe-area-inset-right, 0px)) !important;
        padding-bottom: 0 !important;
        padding-left: max(8px, env(safe-area-inset-left, 0px)) !important;
        margin: 0 !important;
        margin-bottom: 0 !important;
        align-items: center !important;
        box-sizing: border-box !important;
        transform: translate3d(0, 0, 0) !important;
        transition: none !important;
        animation: none !important;
    }

    html body.chat-input-focused:not(.chat-keyboard-shift) .app[data-page="chats"] .chat-active .chat-input-wrapper,
    html body.chat-input-focused:not(.chat-keyboard-shift) .chats-page .chat-active .chat-input-wrapper,
    html body .app[data-page="chats"] .chat-active .chat-input-area.mobile-composer-expanded .chat-input-wrapper,
    html body .chats-page .chat-active .chat-input-area.mobile-composer-expanded .chat-input-wrapper,
    html body.chat-input-focused:not(.chat-keyboard-shift) .app[data-page="chats"] .chat-active #message-input,
    html body.chat-input-focused:not(.chat-keyboard-shift) .chats-page .chat-active #message-input,
    html body .app[data-page="chats"] .chat-active .chat-input-area.mobile-composer-expanded #message-input,
    html body .chats-page .chat-active .chat-input-area.mobile-composer-expanded #message-input,
    html body.chat-input-focused:not(.chat-keyboard-shift) .app[data-page="chats"] .chat-active #attach-file-btn,
    html body.chat-input-focused:not(.chat-keyboard-shift) .chats-page .chat-active #attach-file-btn {
        margin-top: 0 !important;
        margin-bottom: 0 !important;
        transform: none !important;
        transition-property: background, border-color, box-shadow, opacity !important;
    }

    /* The focus anchor above may freeze geometry, but the intentional
       typing/idle width change inside the capsule still needs to stay smooth. */
    html body .app[data-page="chats"] .chat-active #message-input,
    html body .chats-page .chat-active #message-input {
        transition: padding-left .22s cubic-bezier(.2,.8,.2,1), padding-right .22s cubic-bezier(.2,.8,.2,1) !important;
    }

    html body .app[data-page="chats"] .chat-active #attach-file-btn,
    html body .chats-page .chat-active #attach-file-btn {
        transition: opacity .17s ease, visibility 0s linear .22s, background .18s ease, color .18s ease !important;
    }

    html body .app[data-page="chats"] .chat-active #attach-file-btn[aria-hidden="false"],
    html body .chats-page .chat-active #attach-file-btn[aria-hidden="false"] {
        transition-delay: 0s !important;
    }
}

@media (max-width: 390px) {
    html body.chat-input-focused:not(.chat-keyboard-shift) .app[data-page="chats"] .chat-active .chat-input-area:not(.voice-recording-active):not(.video-circle-recording-active),
    html body.chat-input-focused:not(.chat-keyboard-shift) .chats-page .chat-active .chat-input-area:not(.voice-recording-active):not(.video-circle-recording-active),
    html body.chat-keyboard-closing:not(.chat-keyboard-shift) .app[data-page="chats"] .chat-active .chat-input-area:not(.voice-recording-active):not(.video-circle-recording-active),
    html body.chat-keyboard-closing:not(.chat-keyboard-shift) .chats-page .chat-active .chat-input-area:not(.voice-recording-active):not(.video-circle-recording-active),
    html body:not(.chat-keyboard-shift) .app[data-page="chats"] .chat-active .chat-input-area.mobile-composer-expanded:not(.voice-recording-active):not(.video-circle-recording-active),
    html body:not(.chat-keyboard-shift) .chats-page .chat-active .chat-input-area.mobile-composer-expanded:not(.voice-recording-active):not(.video-circle-recording-active) {
        padding-left: max(6px, env(safe-area-inset-left, 0px)) !important;
        padding-right: max(6px, env(safe-area-inset-right, 0px)) !important;
    }
}


/* === DEALIX stable mobile sidebar counters + video-circle body layer fix === */
.sidebar-badge.hidden,
.sidebar .sidebar-badge.hidden,
#sidebar .sidebar-badge.hidden,
.sidebar-badge:empty,
.sidebar .sidebar-badge:empty,
#sidebar .sidebar-badge:empty {
    display: none !important;
}
.sidebar .sidebar-badge:not(.hidden),
#sidebar .sidebar-badge:not(.hidden) {
    min-width: 22px !important;
    height: 22px !important;
    padding: 0 7px !important;
    border-radius: 999px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 0.76rem !important;
    line-height: 1 !important;
    font-weight: 900 !important;
    background: linear-gradient(135deg, #ef4444, #f97316) !important;
    color: #fff !important;
    box-shadow: 0 8px 20px rgba(239, 68, 68, .28), 0 0 0 1px rgba(255,255,255,.12) inset !important;
    margin-left: auto !important;
}
body > #video-circle-recorder.video-circle-recorder {
    left: 0 !important;
    right: 0 !important;
    top: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100dvh !important;
    transform: none !important;
}
@supports (height: 100svh) {
    body > #video-circle-recorder.video-circle-recorder {
        height: 100svh !important;
    }
}
@media (max-width: 768px) {
    body > #video-circle-recorder.video-circle-recorder {
        box-sizing: border-box !important;
        padding: 0 !important;
    }
    body > #video-circle-recorder.video-circle-recorder.hidden {
        display: none !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }
    body > #video-circle-recorder.video-circle-recorder:not(.hidden) {
        display: grid !important;
    }
    body > #video-circle-recorder.video-circle-recorder > .video-circle-preview-wrap {
        position: fixed !important;
        left: 50vw !important;
        top: 50dvh !important;
        transform: translate3d(-50%, -54%, 0) !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        justify-self: auto !important;
        align-self: auto !important;
    }
}
@supports (height: 100svh) {
    @media (max-width: 768px) {
        body > #video-circle-recorder.video-circle-recorder > .video-circle-preview-wrap {
            top: 50svh !important;
        }
    }
}

/* DEALIX mobile/PWA chat header action buttons visual size polish
   Scope: only active chat top action buttons on phone/PWA. */
@media (max-width: 768px) {
    .chat-header .chat-header-actions {
        gap: 6px !important;
        align-items: center !important;
        flex-shrink: 0 !important;
    }

    .chat-header .chat-header-actions #call-voice-btn,
    .chat-header .chat-header-actions #call-video-btn,
    .chat-header .chat-header-actions #chat-mobile-create-deal-btn,
    .chat-header .chat-header-actions #chat-search-msg-btn {
        width: 42px !important;
        height: 42px !important;
        min-width: 42px !important;
        min-height: 42px !important;
        flex: 0 0 42px !important;
        border-radius: 999px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        box-sizing: border-box !important;
    }

    .chat-header .chat-header-actions #call-voice-btn svg,
    .chat-header .chat-header-actions #call-video-btn svg,
    .chat-header .chat-header-actions #chat-mobile-create-deal-btn svg,
    .chat-header .chat-header-actions #chat-search-msg-btn svg {
        width: 21px !important;
        height: 21px !important;
        stroke-width: 2.05 !important;
        flex: 0 0 auto !important;
    }
}

@media (max-width: 380px) {
    .chat-header .chat-header-actions {
        gap: 5px !important;
    }

    .chat-header .chat-header-actions #call-voice-btn,
    .chat-header .chat-header-actions #call-video-btn,
    .chat-header .chat-header-actions #chat-mobile-create-deal-btn,
    .chat-header .chat-header-actions #chat-search-msg-btn {
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
        min-height: 40px !important;
        flex-basis: 40px !important;
    }

    .chat-header .chat-header-actions #call-voice-btn svg,
    .chat-header .chat-header-actions #call-video-btn svg,
    .chat-header .chat-header-actions #chat-mobile-create-deal-btn svg,
    .chat-header .chat-header-actions #chat-search-msg-btn svg {
        width: 20px !important;
        height: 20px !important;
    }
}

/* DEALIX mobile/PWA chat header action buttons +1 size polish
   Scope: only active chat top action buttons on phone/PWA. */
@media (max-width: 768px) {
    .chat-header .chat-header-actions {
        gap: 5px !important;
    }

    .chat-header .chat-header-actions #call-voice-btn,
    .chat-header .chat-header-actions #call-video-btn,
    .chat-header .chat-header-actions #chat-mobile-create-deal-btn,
    .chat-header .chat-header-actions #chat-search-msg-btn {
        width: 45px !important;
        height: 45px !important;
        min-width: 45px !important;
        min-height: 45px !important;
        flex: 0 0 45px !important;
    }

    .chat-header .chat-header-actions #call-voice-btn svg,
    .chat-header .chat-header-actions #call-video-btn svg,
    .chat-header .chat-header-actions #chat-mobile-create-deal-btn svg,
    .chat-header .chat-header-actions #chat-search-msg-btn svg {
        width: 22.5px !important;
        height: 22.5px !important;
        stroke-width: 2.12 !important;
    }
}

@media (max-width: 380px) {
    .chat-header .chat-header-actions {
        gap: 4px !important;
    }

    .chat-header .chat-header-actions #call-voice-btn,
    .chat-header .chat-header-actions #call-video-btn,
    .chat-header .chat-header-actions #chat-mobile-create-deal-btn,
    .chat-header .chat-header-actions #chat-search-msg-btn {
        width: 42px !important;
        height: 42px !important;
        min-width: 42px !important;
        min-height: 42px !important;
        flex-basis: 42px !important;
    }

    .chat-header .chat-header-actions #call-voice-btn svg,
    .chat-header .chat-header-actions #call-video-btn svg,
    .chat-header .chat-header-actions #chat-mobile-create-deal-btn svg,
    .chat-header .chat-header-actions #chat-search-msg-btn svg {
        width: 21px !important;
        height: 21px !important;
    }
}

/* ===== DEALIX HOTFIX: create-new-deal button style like disputes go-deals CTA ===== */
#deal-placeholder #create-new-deal-btn,
.deal-placeholder #create-new-deal-btn,
button#create-new-deal-btn.btn.primary {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: auto !important;
    max-width: 100% !important;
    min-height: 42px !important;
    padding: 11px 18px !important;
    border-radius: 999px !important;
    background: linear-gradient(135deg, #7c3aed 0%, #5b7cfa 100%) !important;
    color: #fff !important;
    border: 1px solid rgba(255,255,255,.18) !important;
    box-shadow: 0 14px 30px rgba(124,58,237,.28), inset 0 1px 0 rgba(255,255,255,.22) !important;
    text-decoration: none !important;
    white-space: nowrap !important;
    transform: translateZ(0);
}

#deal-placeholder #create-new-deal-btn:hover,
#deal-placeholder #create-new-deal-btn:focus-visible,
.deal-placeholder #create-new-deal-btn:hover,
.deal-placeholder #create-new-deal-btn:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 18px 36px rgba(124,58,237,.34), inset 0 1px 0 rgba(255,255,255,.25) !important;
}

#deal-placeholder #create-new-deal-btn::before,
#deal-placeholder #create-new-deal-btn::after,
.deal-placeholder #create-new-deal-btn::before,
.deal-placeholder #create-new-deal-btn::after {
    display: none !important;
    content: none !important;
}

@media (max-width: 900px) {
    .deals-container:not(.mobile-deal-open) .deal-placeholder #create-new-deal-btn {
        min-height: 40px !important;
        padding: 9px 16px !important;
        border-radius: 999px !important;
        font-size: 0.86rem !important;
    }
}

@media (max-width: 390px) {
    .deals-container:not(.mobile-deal-open) .deal-placeholder #create-new-deal-btn {
        min-height: 38px !important;
        padding: 8px 14px !important;
        font-size: 0.82rem !important;
        white-space: normal !important;
        text-align: center !important;
    }
}


/* ===== DEALIX HOTFIX: profile publish button style like go-deals CTA ===== */

/* ===== DEALIX HOTFIX: listings "Разместить" button style like go-deals CTA ===== */
.listings-page #listing-create-btn:not(.listings-create-inline),
.listings-page .listings-page-actions #listing-create-btn:not(.listings-create-inline),
.listings-page button[data-listing-create].btn.primary {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: auto !important;
    max-width: 100% !important;
    min-height: 42px !important;
    height: 42px !important;
    padding: 10px 18px !important;
    border-radius: 999px !important;
    background: linear-gradient(135deg, #7c3aed 0%, #5b7cfa 100%) !important;
    color: #fff !important;
    border: 1px solid rgba(255,255,255,.18) !important;
    box-shadow: 0 14px 30px rgba(124,58,237,.28), inset 0 1px 0 rgba(255,255,255,.22) !important;
    text-decoration: none !important;
    white-space: nowrap !important;
    font-weight: 720 !important;
    letter-spacing: -0.014em !important;
    transform: translateZ(0);
}

.listings-page #listing-create-btn:not(.listings-create-inline):hover,
.listings-page #listing-create-btn:not(.listings-create-inline):focus-visible,
.listings-page .listings-page-actions #listing-create-btn:not(.listings-create-inline):hover,
.listings-page .listings-page-actions #listing-create-btn:not(.listings-create-inline):focus-visible,
.listings-page button[data-listing-create].btn.primary:hover,
.listings-page button[data-listing-create].btn.primary:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 18px 36px rgba(124,58,237,.34), inset 0 1px 0 rgba(255,255,255,.25) !important;
}

.listings-page #listing-create-btn:not(.listings-create-inline)::before,
.listings-page #listing-create-btn:not(.listings-create-inline)::after,
.listings-page .listings-page-actions #listing-create-btn:not(.listings-create-inline)::before,
.listings-page .listings-page-actions #listing-create-btn:not(.listings-create-inline)::after,
.listings-page button[data-listing-create].btn.primary::before,
.listings-page button[data-listing-create].btn.primary::after {
    display: none !important;
    content: none !important;
}

@media (max-width: 720px) {
    .listings-page #listing-create-btn:not(.listings-create-inline),
    .listings-page .listings-page-actions #listing-create-btn:not(.listings-create-inline),
    .listings-page button[data-listing-create].btn.primary {
        min-height: 44px !important;
        height: 44px !important;
        padding: 0 18px !important;
        border-radius: 999px !important;
        font-size: 0.92rem !important;
        flex: 0 0 auto !important;
    }
}

@media (max-width: 380px) {
    .listings-page #listing-create-btn:not(.listings-create-inline),
    .listings-page .listings-page-actions #listing-create-btn:not(.listings-create-inline),
    .listings-page button[data-listing-create].btn.primary {
        min-height: 42px !important;
        height: 42px !important;
        padding: 0 15px !important;
        font-size: 0.88rem !important;
    }
}

/* DEALIX mobile/PWA archive swipe delete root fix.
   Cause: P2P archive row is itself a button, but touchstart ignored all buttons;
   ordinary deal archive reused p2p swipe wrapper but its moving element is .deal-list-item,
   not .p2p-order-summary. Keep vertical scroll, allow horizontal reveal only on archive rows. */
.deal-archive-swipe .deal-list-item {
    position: relative !important;
    z-index: 2 !important;
    width: 100% !important;
    transform: translateX(0) !important;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease !important;
    will-change: transform !important;
}

.deal-archive-swipe.is-revealed .deal-list-item {
    transform: translateX(-68px) !important;
}

.deal-archive-swipe.is-revealed .p2p-order-delete {
    transform: translateX(0) !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

@media (hover: hover) and (pointer: fine) {
    .deal-archive-swipe:hover .deal-list-item,
    .deal-archive-swipe:focus-within .deal-list-item {
        transform: translateX(-68px) !important;
    }

    .deal-archive-swipe:hover .p2p-order-delete,
    .deal-archive-swipe:focus-within .p2p-order-delete {
        transform: translateX(0) !important;
        opacity: 1 !important;
        pointer-events: auto !important;
    }
}

@media (max-width: 680px) {
    .deal-archive-swipe.is-revealed .deal-list-item {
        transform: translateX(-62px) !important;
    }
}

@media (hover: none) and (pointer: coarse) {
    .p2p-order-swipe,
    .deal-archive-swipe,
    .p2p-order-swipe .p2p-order-summary,
    .deal-archive-swipe .deal-list-item {
        touch-action: pan-y;
        -webkit-user-select: none;
        user-select: none;
    }
}

/* === DEALIX mobile bell notifications bounds + footer button polish (CSS-only) ===
   Root fix: mobile notification dropdown must be viewport-bound, not aligned by bell right offset.
   Keeps all themes readable and styles the "Все уведомления" action like the main premium pills. */
#notification-dropdown.notification-dropdown,
.notification-dropdown {
    box-sizing: border-box !important;
}

#notification-dropdown.notification-dropdown .notification-dropdown-footer .btn,
.notification-dropdown .notification-dropdown-footer .btn,
#notification-dropdown.notification-dropdown .notification-dropdown-footer a,
.notification-dropdown .notification-dropdown-footer a {
    position: relative !important;
    isolation: isolate !important;
    min-height: 46px !important;
    padding: 0 18px !important;
    border-radius: 999px !important;
    border: 1px solid rgba(196, 181, 253, 0.28) !important;
    background: linear-gradient(135deg, #7c3aed 0%, #6366f1 48%, #0ea5e9 100%) !important;
    color: #ffffff !important;
    font-weight: 850 !important;
    letter-spacing: -0.01em !important;
    text-decoration: none !important;
    box-shadow: 0 16px 34px rgba(99, 102, 241, 0.28), inset 0 1px 0 rgba(255,255,255,0.22) !important;
}

#notification-dropdown.notification-dropdown .notification-dropdown-footer .btn:hover,
.notification-dropdown .notification-dropdown-footer .btn:hover,
#notification-dropdown.notification-dropdown .notification-dropdown-footer a:hover,
.notification-dropdown .notification-dropdown-footer a:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 20px 42px rgba(99, 102, 241, 0.34), inset 0 1px 0 rgba(255,255,255,0.24) !important;
}

#notification-dropdown.notification-dropdown .notification-dropdown-footer .btn:active,
.notification-dropdown .notification-dropdown-footer .btn:active,
#notification-dropdown.notification-dropdown .notification-dropdown-footer a:active,
.notification-dropdown .notification-dropdown-footer a:active {
    transform: translateY(0) scale(0.99) !important;
}

body.theme-light #notification-dropdown.notification-dropdown .notification-dropdown-footer,
body.light-theme #notification-dropdown.notification-dropdown .notification-dropdown-footer,
[data-theme="light"] #notification-dropdown.notification-dropdown .notification-dropdown-footer,
body.theme-light .notification-dropdown .notification-dropdown-footer,
body.light-theme .notification-dropdown .notification-dropdown-footer,
[data-theme="light"] .notification-dropdown .notification-dropdown-footer {
    background: linear-gradient(180deg, rgba(255,255,255,0.72), rgba(255,255,255,0.98)) !important;
    border-top-color: rgba(15, 23, 42, 0.08) !important;
}

html[data-theme="glass"] body #notification-dropdown.notification-dropdown .notification-dropdown-footer,
body.theme-glass #notification-dropdown.notification-dropdown .notification-dropdown-footer,
html[data-theme="glass"] body .notification-dropdown .notification-dropdown-footer,
body.theme-glass .notification-dropdown .notification-dropdown-footer {
    background: linear-gradient(180deg, rgba(15,23,42,0.50), rgba(15,23,42,0.88)) !important;
    border-top-color: rgba(196, 181, 253, 0.16) !important;
}

@media (max-width: 760px), (pointer: coarse) {
    #notification-dropdown.notification-dropdown,
    .notification-dropdown {
        position: fixed !important;
        left: max(10px, calc(env(safe-area-inset-left, 0px) + 10px)) !important;
        right: max(10px, calc(env(safe-area-inset-right, 0px) + 10px)) !important;
        top: calc(62px + env(safe-area-inset-top, 0px)) !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
        max-height: calc(100dvh - 78px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) !important;
        margin: 0 !important;
        transform: none !important;
        border-radius: 22px !important;
        overflow: hidden !important;
    }

    #notification-dropdown.notification-dropdown.visible,
    .notification-dropdown.visible {
        display: flex !important;
        flex-direction: column !important;
    }

    #notification-dropdown.notification-dropdown .notification-dropdown-header,
    .notification-dropdown .notification-dropdown-header {
        padding: 14px 14px 12px !important;
    }

    #notification-dropdown.notification-dropdown .notification-dropdown-list,
    .notification-dropdown .notification-dropdown-list {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        overflow-y: auto !important;
        padding: 8px 8px 6px !important;
        overscroll-behavior: contain !important;
    }

    #notification-dropdown.notification-dropdown .notification-dropdown-footer,
    .notification-dropdown .notification-dropdown-footer {
        flex: 0 0 auto !important;
        padding: 10px 10px calc(10px + env(safe-area-inset-bottom, 0px)) !important;
    }

    #notification-dropdown.notification-dropdown .notification-dropdown-footer .btn,
    .notification-dropdown .notification-dropdown-footer .btn,
    #notification-dropdown.notification-dropdown .notification-dropdown-footer a,
    .notification-dropdown .notification-dropdown-footer a {
        width: 100% !important;
        min-height: 46px !important;
        font-size: 0.96rem !important;
    }
}

@media (max-width: 380px) {
    #notification-dropdown.notification-dropdown,
    .notification-dropdown {
        left: max(8px, calc(env(safe-area-inset-left, 0px) + 8px)) !important;
        right: max(8px, calc(env(safe-area-inset-right, 0px) + 8px)) !important;
        top: calc(58px + env(safe-area-inset-top, 0px)) !important;
        max-height: calc(100dvh - 72px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) !important;
        border-radius: 20px !important;
    }
}

/* === DEALIX P2P premium visual polish from 112 — CSS-only, scoped to .p2p-page === */
.p2p-page {
    gap: 20px;
    padding-bottom: max(44px, calc(env(safe-area-inset-bottom, 0px) + 34px));
}

.p2p-page .p2p-hero,
.p2p-page .p2p-panel {
    border-radius: 28px;
    border-color: rgba(148, 163, 184, .18);
    background:
        radial-gradient(circle at 10% 0%, rgba(99, 102, 241, .18), transparent 34%),
        radial-gradient(circle at 92% 12%, rgba(6, 182, 212, .12), transparent 30%),
        linear-gradient(145deg, rgba(15, 23, 42, .78), rgba(15, 23, 42, .50));
    box-shadow: 0 24px 70px rgba(2, 6, 23, .26), inset 0 1px 0 rgba(255,255,255,.08);
    backdrop-filter: blur(22px) saturate(1.18);
    -webkit-backdrop-filter: blur(22px) saturate(1.18);
}

.p2p-page .p2p-hero {
    padding: clamp(18px, 3vw, 28px);
    min-height: 138px;
}

.p2p-page .p2p-hero::after {
    opacity: .9;
    filter: blur(2px);
}

.p2p-page .p2p-hero-main {
    gap: 16px;
}

.p2p-page .p2p-hero-icon {
    width: 64px;
    height: 64px;
    border-radius: 22px;
    background: linear-gradient(135deg, #7c3aed 0%, #2563eb 50%, #06b6d4 100%);
    box-shadow: 0 18px 44px rgba(79, 70, 229, .34), inset 0 1px 0 rgba(255,255,255,.22);
}

.p2p-page .p2p-eyebrow {
    color: #a78bfa;
    font-size: 11.5px;
    letter-spacing: .11em;
}

.p2p-page .p2p-hero h1 {
    font-weight: 950;
    line-height: 1.02;
    letter-spacing: -.045em;
}

.p2p-page .p2p-hero p {
    max-width: 820px;
    font-size: .98rem;
    color: rgba(226, 232, 240, .78);
}

.p2p-page .p2p-panel {
    padding: clamp(16px, 2.4vw, 22px);
}

.p2p-page .p2p-collapsible-panel {
    overflow: hidden;
}

.p2p-page .p2p-collapse-head {
    width: 100%;
    min-height: 74px;
    padding: 2px 2px 14px;
    border: 0;
    background: transparent;
    color: var(--text);
}

.p2p-page .p2p-collapse-head h2 {
    font-size: clamp(20px, 2.4vw, 26px);
    font-weight: 950;
    letter-spacing: -.035em;
}

.p2p-page .p2p-collapse-head p {
    max-width: 850px;
    color: rgba(226, 232, 240, .70);
    line-height: 1.5;
}

.p2p-page .p2p-collapse-action {
    min-height: 40px;
    padding: 8px 11px 8px 14px;
    border-radius: 999px;
    color: #e0e7ff;
    background: rgba(99, 102, 241, .16);
    border: 1px solid rgba(129, 140, 248, .24);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
}

.p2p-page .p2p-collapse-label {
    font-weight: 900;
}

.p2p-page .p2p-collapsible-body {
    padding-top: 4px;
}

.p2p-page .p2p-form {
    gap: 14px;
}

.p2p-page .p2p-form label,
.p2p-page .p2p-filters select,
.p2p-page .p2p-filters input,
.p2p-page .p2p-small-select {
    font-weight: 800;
}

.p2p-page .p2p-form input,
.p2p-page .p2p-form select,
.p2p-page .p2p-form textarea,
.p2p-page .p2p-filters input,
.p2p-page .p2p-filters select,
.p2p-page .p2p-small-select,
.p2p-page .p2p-order-inline input {
    min-height: 46px;
    border-radius: 16px;
    background: rgba(2, 6, 23, .24);
    border-color: rgba(148, 163, 184, .18);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.045);
}

.p2p-page .p2p-form textarea {
    min-height: 92px;
}

.p2p-page .p2p-form input:focus,
.p2p-page .p2p-form select:focus,
.p2p-page .p2p-form textarea:focus,
.p2p-page .p2p-filters input:focus,
.p2p-page .p2p-filters select:focus,
.p2p-page .p2p-small-select:focus,
.p2p-page .p2p-order-inline input:focus {
    border-color: rgba(129, 140, 248, .70);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, .15), inset 0 1px 0 rgba(255,255,255,.08);
}

.p2p-page .p2p-submit,
.p2p-page .p2p-market-toolbar .btn,
.p2p-page .p2p-order-inline .btn,
.p2p-page .p2p-order-actions .btn {
    border-radius: 999px;
    font-weight: 950;
    letter-spacing: -.01em;
}

.p2p-page .p2p-submit {
    min-height: 50px;
    color: #fff;
    background: linear-gradient(135deg, #7c3aed, #2563eb 52%, #06b6d4);
    border: 1px solid rgba(129, 140, 248, .36);
    box-shadow: 0 18px 42px rgba(37, 99, 235, .26), inset 0 1px 0 rgba(255,255,255,.18);
}

.p2p-page .p2p-market-toolbar {
    margin-bottom: 12px;
}

.p2p-page .p2p-market-toolbar .btn.secondary {
    min-height: 42px;
    color: #e0e7ff;
    background: rgba(99, 102, 241, .14);
    border-color: rgba(129, 140, 248, .24);
}

.p2p-page .p2p-filters {
    gap: 9px;
    margin-bottom: 18px;
    padding: 10px;
    border-radius: 20px;
    background: rgba(2, 6, 23, .16);
    border: 1px solid rgba(148, 163, 184, .12);
}

.p2p-page .p2p-offers-list,
.p2p-page .p2p-orders-list,
.p2p-page .p2p-my-offers-list {
    gap: 14px;
}

.p2p-page .p2p-offer-card,
.p2p-page .p2p-order-card,
.p2p-page .p2p-empty,
.p2p-page .p2p-my-offer-card,
.p2p-page .p2p-order-summary,
.p2p-page .p2p-order-detail-empty {
    border-radius: 22px;
    border-color: rgba(148, 163, 184, .16);
    background:
        linear-gradient(145deg, rgba(15, 23, 42, .58), rgba(15, 23, 42, .36)),
        rgba(15, 23, 42, .22);
    box-shadow: 0 14px 34px rgba(2, 6, 23, .16), inset 0 1px 0 rgba(255,255,255,.055);
}

.p2p-page .p2p-offer-card {
    padding: 17px;
    gap: 15px;
}

.p2p-page .p2p-offer-action {
    padding: 7px 12px;
    font-size: 12.5px;
    box-shadow: 0 10px 20px rgba(16, 185, 129, .15);
}

.p2p-page .p2p-offer-action.buy {
    box-shadow: 0 10px 20px rgba(99, 102, 241, .16);
}

.p2p-page .p2p-offer-card h3,
.p2p-page .p2p-order-title,
.p2p-page .p2p-order-summary-main b,
.p2p-page .p2p-my-offer-title b {
    font-weight: 950;
    letter-spacing: -.025em;
}

.p2p-page .p2p-offer-maker,
.p2p-page .p2p-order-meta,
.p2p-page .p2p-order-summary-main small,
.p2p-page .p2p-order-summary-side em {
    color: rgba(203, 213, 225, .72);
}

.p2p-page .p2p-offer-network {
    background: linear-gradient(135deg, rgba(99, 102, 241, .16), rgba(6, 182, 212, .08));
    border-color: rgba(129, 140, 248, .20);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.055);
}

.p2p-page .p2p-offer-stats {
    gap: 9px;
}

.p2p-page .p2p-offer-stats div {
    border-radius: 17px;
    background: rgba(2, 6, 23, .18);
    border-color: rgba(148, 163, 184, .14);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
}

.p2p-page .p2p-offer-stats b {
    font-size: 14px;
    font-weight: 950;
}

.p2p-page .p2p-offer-terms {
    border-radius: 16px;
    color: rgba(226, 232, 240, .80);
    background: rgba(245, 158, 11, .10);
    border-color: rgba(245, 158, 11, .18);
}

.p2p-page .p2p-order-inline,
.p2p-page .p2p-market-panel .p2p-order-inline {
    border-radius: 18px;
    background: rgba(2, 6, 23, .18);
    border-color: rgba(148, 163, 184, .14);
}

.p2p-page .p2p-orders-workspace {
    gap: 16px;
}

.p2p-page .p2p-orders-rail {
    gap: 10px;
    padding-right: 6px;
}

.p2p-page .p2p-order-summary {
    padding: 13px 14px;
    border-radius: 18px;
}

.p2p-page .p2p-order-summary:hover,
.p2p-page .p2p-order-summary.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, .16), rgba(6, 182, 212, .08));
    border-color: rgba(129, 140, 248, .30);
}

.p2p-page .p2p-order-summary.active {
    box-shadow: inset 4px 0 0 #22c55e, 0 16px 34px rgba(2, 6, 23, .20);
}

.p2p-page .p2p-pagination {
    border-top-color: rgba(148, 163, 184, .14);
}

.p2p-page .p2p-page-btn {
    border-radius: 999px;
    background: rgba(2, 6, 23, .20);
    border-color: rgba(148, 163, 184, .18);
}

.p2p-page .p2p-page-btn.active {
    background: linear-gradient(135deg, #22c55e, #06b6d4);
    box-shadow: 0 14px 30px rgba(6, 182, 212, .18);
}

body.theme-light .p2p-page .p2p-hero,
body.theme-light .p2p-page .p2p-panel,
body.light-theme .p2p-page .p2p-hero,
body.light-theme .p2p-page .p2p-panel,
[data-theme="light"] .p2p-page .p2p-hero,
[data-theme="light"] .p2p-page .p2p-panel {
    background:
        radial-gradient(circle at 8% 0%, rgba(99, 102, 241, .11), transparent 34%),
        radial-gradient(circle at 92% 8%, rgba(14, 165, 233, .10), transparent 30%),
        linear-gradient(145deg, rgba(255,255,255,.98), rgba(248,250,252,.94));
    border-color: rgba(15, 23, 42, .09);
    box-shadow: 0 22px 56px rgba(15, 23, 42, .09), inset 0 1px 0 rgba(255,255,255,.9);
}

body.theme-light .p2p-page .p2p-hero p,
body.theme-light .p2p-page .p2p-collapse-head p,
body.light-theme .p2p-page .p2p-hero p,
body.light-theme .p2p-page .p2p-collapse-head p,
[data-theme="light"] .p2p-page .p2p-hero p,
[data-theme="light"] .p2p-page .p2p-collapse-head p {
    color: #64748b;
}

body.theme-light .p2p-page .p2p-collapse-action,
body.light-theme .p2p-page .p2p-collapse-action,
[data-theme="light"] .p2p-page .p2p-collapse-action {
    color: #3730a3;
    background: rgba(99, 102, 241, .10);
    border-color: rgba(99, 102, 241, .16);
}

body.theme-light .p2p-page .p2p-form input,
body.theme-light .p2p-page .p2p-form select,
body.theme-light .p2p-page .p2p-form textarea,
body.theme-light .p2p-page .p2p-filters input,
body.theme-light .p2p-page .p2p-filters select,
body.theme-light .p2p-page .p2p-small-select,
body.theme-light .p2p-page .p2p-order-inline input,
body.light-theme .p2p-page .p2p-form input,
body.light-theme .p2p-page .p2p-form select,
body.light-theme .p2p-page .p2p-form textarea,
body.light-theme .p2p-page .p2p-filters input,
body.light-theme .p2p-page .p2p-filters select,
body.light-theme .p2p-page .p2p-small-select,
body.light-theme .p2p-page .p2p-order-inline input,
[data-theme="light"] .p2p-page .p2p-form input,
[data-theme="light"] .p2p-page .p2p-form select,
[data-theme="light"] .p2p-page .p2p-form textarea,
[data-theme="light"] .p2p-page .p2p-filters input,
[data-theme="light"] .p2p-page .p2p-filters select,
[data-theme="light"] .p2p-page .p2p-small-select,
[data-theme="light"] .p2p-page .p2p-order-inline input {
    background: rgba(248, 250, 252, .96);
    color: #0f172a;
    border-color: rgba(15, 23, 42, .10);
}

body.theme-light .p2p-page .p2p-filters,
body.light-theme .p2p-page .p2p-filters,
[data-theme="light"] .p2p-page .p2p-filters {
    background: rgba(241, 245, 249, .70);
    border-color: rgba(15, 23, 42, .08);
}

body.theme-light .p2p-page .p2p-offer-card,
body.theme-light .p2p-page .p2p-order-card,
body.theme-light .p2p-page .p2p-empty,
body.theme-light .p2p-page .p2p-my-offer-card,
body.theme-light .p2p-page .p2p-order-summary,
body.theme-light .p2p-page .p2p-order-detail-empty,
body.light-theme .p2p-page .p2p-offer-card,
body.light-theme .p2p-page .p2p-order-card,
body.light-theme .p2p-page .p2p-empty,
body.light-theme .p2p-page .p2p-my-offer-card,
body.light-theme .p2p-page .p2p-order-summary,
body.light-theme .p2p-page .p2p-order-detail-empty,
[data-theme="light"] .p2p-page .p2p-offer-card,
[data-theme="light"] .p2p-page .p2p-order-card,
[data-theme="light"] .p2p-page .p2p-empty,
[data-theme="light"] .p2p-page .p2p-my-offer-card,
[data-theme="light"] .p2p-page .p2p-order-summary,
[data-theme="light"] .p2p-page .p2p-order-detail-empty {
    background: #fff;
    border-color: rgba(15, 23, 42, .09);
    box-shadow: 0 14px 34px rgba(15, 23, 42, .07), inset 0 1px 0 rgba(255,255,255,.9);
}

body.theme-light .p2p-page .p2p-offer-maker,
body.theme-light .p2p-page .p2p-order-meta,
body.theme-light .p2p-page .p2p-order-summary-main small,
body.theme-light .p2p-page .p2p-order-summary-side em,
body.light-theme .p2p-page .p2p-offer-maker,
body.light-theme .p2p-page .p2p-order-meta,
body.light-theme .p2p-page .p2p-order-summary-main small,
body.light-theme .p2p-page .p2p-order-summary-side em,
[data-theme="light"] .p2p-page .p2p-offer-maker,
[data-theme="light"] .p2p-page .p2p-order-meta,
[data-theme="light"] .p2p-page .p2p-order-summary-main small,
[data-theme="light"] .p2p-page .p2p-order-summary-side em {
    color: #64748b;
}

body.theme-light .p2p-page .p2p-offer-stats div,
body.light-theme .p2p-page .p2p-offer-stats div,
[data-theme="light"] .p2p-page .p2p-offer-stats div {
    background: #f8fafc;
    border-color: rgba(15, 23, 42, .08);
}

@media (max-width: 760px) {
    .p2p-page {
        gap: 14px;
        padding-left: 0;
        padding-right: 0;
    }

    .p2p-page .p2p-hero,
    .p2p-page .p2p-panel {
        border-radius: 24px;
    }

    .p2p-page .p2p-hero {
        padding: 18px;
        min-height: auto;
    }

    .p2p-page .p2p-hero-main {
        align-items: flex-start;
    }

    .p2p-page .p2p-hero-icon {
        width: 54px;
        height: 54px;
        border-radius: 19px;
    }

    .p2p-page .p2p-hero h1 {
        font-size: 25px;
    }

    .p2p-page .p2p-hero p {
        font-size: .93rem;
        line-height: 1.45;
    }

    .p2p-page .p2p-panel {
        padding: 14px;
    }

    .p2p-page .p2p-collapse-head {
        min-height: 64px;
        align-items: center;
        gap: 12px;
        padding: 0 0 12px;
    }

    .p2p-page .p2p-collapse-head h2 {
        font-size: 20px;
    }

    .p2p-page .p2p-collapse-head p {
        font-size: .86rem;
        line-height: 1.4;
    }

    .p2p-page .p2p-collapse-action {
        flex: 0 0 auto;
        min-height: 38px;
        padding: 7px 10px;
    }

    .p2p-page .p2p-collapse-label {
        display: none;
    }

    .p2p-page .p2p-filters {
        margin-left: -2px;
        margin-right: -2px;
        padding: 9px;
        border-radius: 18px;
    }

    .p2p-page .p2p-filters select,
    .p2p-page .p2p-filters input {
        flex-basis: min(72vw, 235px);
        min-height: 44px;
        border-radius: 999px;
    }

    .p2p-page .p2p-offer-card {
        padding: 14px;
        border-radius: 20px;
    }

    .p2p-page .p2p-offer-top {
        gap: 10px;
    }

    .p2p-page .p2p-offer-card h3 {
        font-size: 17px;
    }

    .p2p-page .p2p-offer-network {
        border-radius: 16px;
        padding: 10px;
    }

    .p2p-page .p2p-offer-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .p2p-page .p2p-offer-stats div {
        padding: 10px;
    }

    .p2p-page .p2p-submit {
        min-height: 52px;
    }

    .p2p-page .p2p-orders-rail {
        gap: 10px;
        padding: 2px 2px 12px;
    }

    .p2p-page .p2p-order-summary {
        flex-basis: min(88vw, 360px);
        min-height: 72px;
    }
}

@media (max-width: 390px) {
    .p2p-page .p2p-hero-main {
        gap: 12px;
    }

    .p2p-page .p2p-hero-icon {
        width: 50px;
        height: 50px;
    }

    .p2p-page .p2p-hero h1 {
        font-size: 23px;
    }

    .p2p-page .p2p-panel {
        padding: 12px;
    }

    .p2p-page .p2p-collapse-head h2 {
        font-size: 19px;
    }

    .p2p-page .p2p-offer-stats {
        grid-template-columns: 1fr;
    }
}

/* === DEALIX P2P layout correction + premium polish v2 — CSS-only, scoped === */
.p2p-page .p2p-collapsible-panel {
    position: relative;
    isolation: isolate;
}

.p2p-page .p2p-collapsible-panel::before {
    content: '';
    position: absolute;
    inset: 1px;
    border-radius: inherit;
    pointer-events: none;
    background:
        linear-gradient(135deg, rgba(167, 139, 250, .10), transparent 38%),
        radial-gradient(circle at 92% 52%, rgba(6, 182, 212, .08), transparent 34%);
    opacity: .78;
    z-index: -1;
}

.p2p-page .p2p-collapsible-panel.is-collapsed {
    padding: 0;
}

.p2p-page .p2p-collapsible-panel.is-collapsed .p2p-collapse-head {
    min-height: 92px;
    padding: 20px 26px;
    align-items: center;
}

.p2p-page .p2p-collapsible-panel.is-open .p2p-collapse-head,
.p2p-page .p2p-my-offers-panel.is-open .p2p-collapse-head {
    padding: 2px 2px 16px;
}

.p2p-page .p2p-collapse-head > div:first-child {
    min-width: 0;
    padding-right: 18px;
}

.p2p-page .p2p-collapse-head h2 {
    margin: 0;
    text-wrap: balance;
}

.p2p-page .p2p-collapse-head p {
    margin: 8px 0 0;
    text-wrap: pretty;
}

.p2p-page .p2p-collapse-action {
    min-width: 220px;
    min-height: 48px;
    padding: 7px 8px 7px 18px;
    justify-content: space-between;
    align-self: center;
    background:
        linear-gradient(135deg, rgba(129, 140, 248, .22), rgba(37, 99, 235, .14)),
        rgba(15, 23, 42, .30);
    border: 1px solid rgba(167, 139, 250, .28);
    box-shadow: 0 14px 34px rgba(37, 99, 235, .14), inset 0 1px 0 rgba(255,255,255,.10);
}

.p2p-page .p2p-collapse-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: .88rem;
}

.p2p-page .p2p-collapse-arrow {
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    box-shadow: 0 12px 28px rgba(124, 58, 237, .30), inset 0 1px 0 rgba(255,255,255,.18);
}

.p2p-page .p2p-panel:hover {
    border-color: rgba(167, 139, 250, .24);
    box-shadow: 0 26px 72px rgba(2, 6, 23, .30), 0 0 0 1px rgba(167, 139, 250, .04), inset 0 1px 0 rgba(255,255,255,.09);
}

.p2p-page .p2p-hero {
    overflow: hidden;
}

.p2p-page .p2p-hero::before {
    content: '';
    position: absolute;
    inset: auto 24px 0 auto;
    width: 220px;
    height: 130px;
    pointer-events: none;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(34, 211, 238, .16), transparent 68%);
    filter: blur(20px);
    opacity: .85;
}

body.theme-light .p2p-page .p2p-collapse-action,
body.light-theme .p2p-page .p2p-collapse-action,
[data-theme="light"] .p2p-page .p2p-collapse-action {
    color: #312e81;
    background:
        linear-gradient(135deg, rgba(129, 140, 248, .18), rgba(14, 165, 233, .08)),
        rgba(255, 255, 255, .86);
    border-color: rgba(99, 102, 241, .18);
    box-shadow: 0 14px 30px rgba(99, 102, 241, .10), inset 0 1px 0 rgba(255,255,255,.92);
}

body.theme-light .p2p-page .p2p-collapsible-panel::before,
body.light-theme .p2p-page .p2p-collapsible-panel::before,
[data-theme="light"] .p2p-page .p2p-collapsible-panel::before {
    background:
        linear-gradient(135deg, rgba(99, 102, 241, .08), transparent 38%),
        radial-gradient(circle at 92% 52%, rgba(14, 165, 233, .08), transparent 34%);
    opacity: 1;
}

@media (max-width: 760px) {
    .p2p-page .p2p-collapsible-panel.is-collapsed .p2p-collapse-head {
        position: relative;
        display: block;
        min-height: 82px;
        padding: 16px 82px 16px 16px;
        gap: 0;
        text-align: left;
    }

    .p2p-page .p2p-collapse-head > div:first-child {
        width: 100%;
        min-width: 0;
        padding-right: 0;
        text-align: left;
    }

    .p2p-page .p2p-collapse-action {
        width: auto;
        min-width: 46px;
        max-width: 46px;
        min-height: 46px;
        padding: 4px;
        border-radius: 999px;
        flex: 0 0 46px;
        justify-content: center;
        margin-left: auto;
    }

    .p2p-page .p2p-collapsible-panel.is-collapsed .p2p-collapse-action {
        position: absolute;
        top: 50%;
        right: 16px;
        transform: translateY(-50%);
        margin-left: 0;
    }

    .p2p-page .p2p-collapse-label {
        display: none;
    }

    .p2p-page .p2p-collapse-arrow {
        width: 38px;
        height: 38px;
        flex-basis: 38px;
    }
}

@media (max-width: 390px) {
    .p2p-page .p2p-collapsible-panel.is-collapsed .p2p-collapse-head {
        padding: 15px 14px;
    }
}

/* ===== DEALIX deals crypto escrow panel premium polish ===== */
.deals-page .deal-details-card > div.deal-crypto-panel,
#deal-details-content .deal-details-card > div.deal-crypto-panel {
    position: relative !important;
    overflow: hidden !important;
    padding: 18px 20px !important;
    border-radius: 22px !important;
    border: 1px solid rgba(124, 92, 255, 0.30) !important;
    background:
        radial-gradient(circle at 12% 0%, rgba(124, 92, 255, 0.20), transparent 34%),
        radial-gradient(circle at 92% 12%, rgba(16, 185, 129, 0.16), transparent 38%),
        linear-gradient(135deg, rgba(31, 38, 78, 0.78), rgba(8, 27, 42, 0.84)) !important;
    box-shadow:
        0 22px 54px rgba(0, 0, 0, 0.26),
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 0 0 1px rgba(255, 255, 255, 0.03) !important;
    color: rgba(248, 250, 252, 0.96) !important;
    backdrop-filter: blur(18px) saturate(1.14) !important;
    -webkit-backdrop-filter: blur(18px) saturate(1.14) !important;
}

.deals-page .deal-details-card > div.deal-crypto-panel::before,
#deal-details-content .deal-details-card > div.deal-crypto-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(90deg, rgba(124, 92, 255, 0.20), transparent 34%, rgba(16, 185, 129, 0.12)),
        linear-gradient(180deg, rgba(255, 255, 255, 0.07), transparent 46%);
    opacity: 0.72;
}

.deals-page .deal-details-card > div.deal-crypto-panel > *,
#deal-details-content .deal-details-card > div.deal-crypto-panel > * {
    position: relative;
    z-index: 1;
}

.deals-page .deal-details-card > div.deal-crypto-panel > div:first-child,
#deal-details-content .deal-details-card > div.deal-crypto-panel > div:first-child {
    margin-bottom: 13px !important;
    color: #ffffff !important;
    font-size: 1.02rem !important;
    letter-spacing: -0.015em;
    text-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
}

.deals-page .deal-details-card > div.deal-crypto-panel .deal-inline-svg-icon-success,
#deal-details-content .deal-details-card > div.deal-crypto-panel .deal-inline-svg-icon-success {
    width: 22px;
    height: 22px;
    color: #34f5a3 !important;
    filter: drop-shadow(0 0 12px rgba(52, 245, 163, 0.34));
}

.deals-page .deal-details-card > div.deal-crypto-panel > div.deal-crypto-panel-grid,
#deal-details-content .deal-details-card > div.deal-crypto-panel > div.deal-crypto-panel-grid {
    grid-template-columns: minmax(140px, 180px) minmax(0, 1fr) !important;
    gap: 8px 16px !important;
    color: rgba(226, 232, 240, 0.82) !important;
    font-size: 0.88rem !important;
    line-height: 1.42 !important;
    align-items: center !important;
}

.deals-page .deal-details-card > div.deal-crypto-panel > div.deal-crypto-panel-grid > span,
#deal-details-content .deal-details-card > div.deal-crypto-panel > div.deal-crypto-panel-grid > span {
    color: rgba(203, 213, 225, 0.86) !important;
    font-weight: 650;
}

.deals-page .deal-details-card > div.deal-crypto-panel > div.deal-crypto-panel-grid > b,
#deal-details-content .deal-details-card > div.deal-crypto-panel > div.deal-crypto-panel-grid > b {
    min-width: 0;
    color: rgba(248, 250, 252, 0.96) !important;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.deals-page .deal-details-card > div.deal-crypto-panel > div.deal-crypto-panel-warning,
#deal-details-content .deal-details-card > div.deal-crypto-panel > div.deal-crypto-panel-warning {
    margin-top: 14px !important;
    padding: 10px 12px !important;
    border-radius: 14px !important;
    background: rgba(7, 12, 24, 0.24) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: rgba(226, 232, 240, 0.86) !important;
    line-height: 1.45 !important;
}

.deals-page .deal-details-card > div.deal-crypto-panel > div.deal-crypto-panel-warning,
#deal-details-content .deal-details-card > div.deal-crypto-panel > div.deal-crypto-panel-warning {
    color: #ffd36a !important;
    background: rgba(245, 158, 11, 0.12) !important;
    border-color: rgba(245, 158, 11, 0.24) !important;
}

body.theme-light .deals-page .deal-details-card > div.deal-crypto-panel,
body.theme-light #deal-details-content .deal-details-card > div.deal-crypto-panel {
    border-color: rgba(124, 92, 255, 0.22) !important;
    background:
        radial-gradient(circle at 10% 0%, rgba(124, 92, 255, 0.13), transparent 34%),
        radial-gradient(circle at 90% 8%, rgba(16, 185, 129, 0.11), transparent 36%),
        linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(241, 246, 255, 0.90)) !important;
    box-shadow:
        0 18px 48px rgba(54, 68, 114, 0.13),
        inset 0 1px 0 rgba(255, 255, 255, 0.92) !important;
    color: #111827 !important;
}

body.theme-light .deals-page .deal-details-card > div.deal-crypto-panel > div:first-child,
body.theme-light #deal-details-content .deal-details-card > div.deal-crypto-panel > div:first-child {
    color: #111827 !important;
    text-shadow: none;
}

body.theme-light .deals-page .deal-details-card > div.deal-crypto-panel > div.deal-crypto-panel-grid,
body.theme-light #deal-details-content .deal-details-card > div.deal-crypto-panel > div.deal-crypto-panel-grid {
    color: rgba(51, 65, 85, 0.82) !important;
}

body.theme-light .deals-page .deal-details-card > div.deal-crypto-panel > div.deal-crypto-panel-grid > span,
body.theme-light #deal-details-content .deal-details-card > div.deal-crypto-panel > div.deal-crypto-panel-grid > span {
    color: rgba(71, 85, 105, 0.86) !important;
}

body.theme-light .deals-page .deal-details-card > div.deal-crypto-panel > div.deal-crypto-panel-grid > b,
body.theme-light #deal-details-content .deal-details-card > div.deal-crypto-panel > div.deal-crypto-panel-grid > b {
    color: #111827 !important;
}

body.theme-light .deals-page .deal-details-card > div.deal-crypto-panel > div.deal-crypto-panel-warning,
body.theme-light #deal-details-content .deal-details-card > div.deal-crypto-panel > div.deal-crypto-panel-warning {
    background: rgba(255, 255, 255, 0.62) !important;
    border-color: rgba(99, 102, 241, 0.16) !important;
    color: rgba(51, 65, 85, 0.88) !important;
}

@media (max-width: 720px) {
    .deals-page .deal-details-card > div.deal-crypto-panel,
    #deal-details-content .deal-details-card > div.deal-crypto-panel {
        padding: 15px 14px !important;
        border-radius: 19px !important;
    }

    .deals-page .deal-details-card > div.deal-crypto-panel > div.deal-crypto-panel-grid,
    #deal-details-content .deal-details-card > div.deal-crypto-panel > div.deal-crypto-panel-grid {
        grid-template-columns: minmax(116px, 40%) minmax(0, 1fr) !important;
        gap: 7px 10px !important;
        font-size: 0.81rem !important;
    }
}

@media (max-width: 390px) {
    .deals-page .deal-details-card > div.deal-crypto-panel > div.deal-crypto-panel-grid,
    #deal-details-content .deal-details-card > div.deal-crypto-panel > div.deal-crypto-panel-grid {
        grid-template-columns: 1fr !important;
        gap: 3px !important;
    }

    .deals-page .deal-details-card > div.deal-crypto-panel > div.deal-crypto-panel-grid > span,
    #deal-details-content .deal-details-card > div.deal-crypto-panel > div.deal-crypto-panel-grid > span {
        margin-top: 5px;
        font-size: 0.76rem;
        letter-spacing: 0.01em;
        text-transform: none;
    }
}

/* The crypto status timeline belongs to the escrow panel, below its metadata. */
.deals-page .deal-crypto-panel > .deal-timeline {
    margin: 16px 0 0 !important;
    padding: 16px 0 2px;
    border: 0 !important;
    border-top: 1px solid rgba(255, 255, 255, 0.14) !important;
    border-radius: 0;
    background: none !important;
    box-shadow: none !important;
}

body.theme-light .deals-page .deal-crypto-panel > .deal-timeline {
    border-top-color: rgba(15, 23, 42, 0.14) !important;
}

/* === DEALIX dashboard links polish: compact plain CTA, CSS-only layout-safe === */
.dashboard-v2 .dashboard-panel-head-actions .dashboard-link,
.dashboard-v2 .dashboard-panel-head > .dashboard-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 34px;
    padding: 8px 12px 8px 14px;
    border-radius: 999px;
    border: 1px solid rgba(139, 92, 246, .35);
    background:
        radial-gradient(circle at 28% 0%, rgba(168, 85, 247, .24), transparent 54%),
        linear-gradient(135deg, rgba(37, 99, 235, .16), rgba(124, 58, 237, .18));
    color: #c4b5fd;
    box-shadow: 0 10px 28px rgba(79, 70, 229, .16), inset 0 1px 0 rgba(255,255,255,.12);
    font-size: .84rem;
    line-height: 1;
    letter-spacing: .01em;
    text-decoration: none;
    transition: transform .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease, color .18s ease;
}

.dashboard-v2 .dashboard-panel-head-actions .dashboard-link:hover,
.dashboard-v2 .dashboard-panel-head > .dashboard-link:hover {
    transform: translateY(-1px);
    border-color: rgba(167, 139, 250, .62);
    color: #ede9fe;
    box-shadow: 0 14px 34px rgba(79, 70, 229, .24), inset 0 1px 0 rgba(255,255,255,.16);
}

.dashboard-v2 .dashboard-panel-head-actions .dashboard-link:active,
.dashboard-v2 .dashboard-panel-head > .dashboard-link:active {
    transform: translateY(0) scale(.985);
}

body.theme-light .dashboard-v2 .dashboard-panel-head-actions .dashboard-link,
body.theme-light .dashboard-v2 .dashboard-panel-head > .dashboard-link {
    color: #5b21b6;
    border-color: rgba(124, 58, 237, .25);
    background:
        radial-gradient(circle at 25% 0%, rgba(139, 92, 246, .16), transparent 56%),
        linear-gradient(135deg, rgba(255,255,255,.94), rgba(245, 243, 255, .90));
    box-shadow: 0 10px 28px rgba(99, 102, 241, .12), inset 0 1px 0 rgba(255,255,255,.84);
}

body.theme-light .dashboard-v2 .dashboard-panel-head-actions .dashboard-link:hover,
body.theme-light .dashboard-v2 .dashboard-panel-head > .dashboard-link:hover {
    color: #4c1d95;
    border-color: rgba(124, 58, 237, .44);
    box-shadow: 0 14px 34px rgba(99, 102, 241, .18), inset 0 1px 0 rgba(255,255,255,.92);
}

@media (max-width: 560px) {
    .dashboard-v2 .dashboard-panel-head-actions .dashboard-link,
    .dashboard-v2 .dashboard-panel-head > .dashboard-link {
        min-height: 32px;
        padding: 7px 10px 7px 12px;
        gap: 7px;
        font-size: .8rem;
    }
}

/* === DEALIX header account pill polish: only user area near notification bell === */
@media (min-width: 769px) {
    .header-right .user-menu {
        position: relative !important;
        overflow: visible !important;
        border-radius: 18px !important;
        isolation: isolate;
    }

    .header-right #user-menu-btn {
        min-height: 48px !important;
        height: 48px !important;
        padding: 6px 13px 6px 8px !important;
        gap: 10px !important;
        border-radius: 16px !important;
        border: 1px solid rgba(167, 139, 250, .24) !important;
        background:
            radial-gradient(circle at 18% 0%, rgba(167, 139, 250, .22), transparent 52%),
            radial-gradient(circle at 92% 100%, rgba(14, 165, 233, .12), transparent 58%),
            linear-gradient(135deg, rgba(255,255,255,.075), rgba(255,255,255,.035)) !important;
        color: var(--text) !important;
        box-shadow:
            0 12px 28px rgba(15, 23, 42, .18),
            inset 0 1px 0 rgba(255,255,255,.14) !important;
        backdrop-filter: blur(16px) saturate(1.18) !important;
        -webkit-backdrop-filter: blur(16px) saturate(1.18) !important;
        transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease, background .18s ease !important;
    }

    .header-right #user-menu-btn:hover {
        transform: translateY(-1px) !important;
        border-color: rgba(167, 139, 250, .48) !important;
        box-shadow:
            0 16px 36px rgba(99, 102, 241, .18),
            inset 0 1px 0 rgba(255,255,255,.18) !important;
    }

    .header-right #user-menu-btn:active {
        transform: translateY(0) scale(.985) !important;
    }

    .header-right #user-menu-btn .user-avatar,
    .header-right #user-menu-btn .avatar,
    .header-right .user-menu .user-avatar,
    .header-right .user-menu .avatar {
        width: 38px !important;
        min-width: 38px !important;
        max-width: 38px !important;
        height: 38px !important;
        min-height: 38px !important;
        max-height: 38px !important;
        border-radius: 50% !important;
        border: 2px solid rgba(255,255,255,.42) !important;
        box-shadow:
            0 8px 18px rgba(59, 130, 246, .16),
            0 0 0 1px rgba(167, 139, 250, .18) !important;
        overflow: hidden !important;
        object-fit: cover !important;
        flex: 0 0 38px !important;
    }

    .header-right #user-menu-btn .username,
    .header-right #user-menu-btn .user-name,
    .header-right #user-menu-btn .user-display-name,
    .header-right .user-menu .username,
    .header-right .user-menu .user-name,
    .header-right .user-menu .user-display-name {
        color: var(--text) !important;
        font-weight: 800 !important;
        font-size: .93rem !important;
        letter-spacing: -.015em !important;
        line-height: 1 !important;
        max-width: 128px !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }

    .header-right #user-menu-btn svg,
    .header-right .user-menu #user-menu-btn > svg {
        width: 16px !important;
        height: 16px !important;
        min-width: 16px !important;
        color: var(--text-secondary) !important;
        stroke: currentColor !important;
        filter: drop-shadow(0 1px 3px rgba(0,0,0,.18));
        transition: color .18s ease, transform .18s ease !important;
    }

    .header-right #user-menu-btn:hover svg {
        color: var(--primary) !important;
        transform: translateY(1px) !important;
    }

    body.theme-light .header-right #user-menu-btn,
    [data-theme="light"] .header-right #user-menu-btn {
        border-color: rgba(79, 70, 229, .13) !important;
        background:
            radial-gradient(circle at 20% 0%, rgba(139, 92, 246, .13), transparent 54%),
            linear-gradient(135deg, rgba(255,255,255,.98), rgba(248,250,252,.92)) !important;
        color: #0f172a !important;
        box-shadow:
            0 12px 28px rgba(15, 23, 42, .08),
            inset 0 1px 0 rgba(255,255,255,.9) !important;
    }

    body.theme-light .header-right #user-menu-btn:hover,
    [data-theme="light"] .header-right #user-menu-btn:hover {
        border-color: rgba(124, 58, 237, .28) !important;
        box-shadow:
            0 16px 34px rgba(99, 102, 241, .13),
            inset 0 1px 0 rgba(255,255,255,.96) !important;
    }

    body.theme-light .header-right #user-menu-btn .user-avatar,
    body.theme-light .header-right #user-menu-btn .avatar,
    [data-theme="light"] .header-right #user-menu-btn .user-avatar,
    [data-theme="light"] .header-right #user-menu-btn .avatar {
        border-color: rgba(255,255,255,.88) !important;
        box-shadow:
            0 8px 18px rgba(15, 23, 42, .10),
            0 0 0 1px rgba(124, 58, 237, .14) !important;
    }

    body.theme-light .header-right #user-menu-btn .username,
    body.theme-light .header-right #user-menu-btn .user-name,
    body.theme-light .header-right #user-menu-btn .user-display-name,
    [data-theme="light"] .header-right #user-menu-btn .username,
    [data-theme="light"] .header-right #user-menu-btn .user-name,
    [data-theme="light"] .header-right #user-menu-btn .user-display-name {
        color: #0f172a !important;
    }
}


/* === DEALIX mobile CTA tap root-fix: create deal / place listing ===
   Cause: the premium CTA CSS added transform layers to the exact mobile buttons.
   In iPhone/PWA those transformed controls can lose the final synthetic click inside
   scroll/ordered mobile panels. Keep the visual style, but make the real button the
   hit target and do not create a separate transform layer on coarse touch screens. */
@media (hover: none) and (pointer: coarse), (max-width: 900px) {
    #deal-placeholder #create-new-deal-btn,
    .deal-placeholder #create-new-deal-btn,
    button#create-new-deal-btn.btn.primary,
    .listings-page #listing-create-btn,
    .listings-page .listings-page-actions #listing-create-btn,
    .listings-page button[data-listing-create].btn.primary {
        position: relative !important;
        z-index: 30 !important;
        pointer-events: auto !important;
        touch-action: manipulation !important;
        cursor: pointer !important;
        transform: none !important;
        -webkit-transform: none !important;
        -webkit-tap-highlight-color: transparent;
    }

    #deal-placeholder #create-new-deal-btn > *,
    .deal-placeholder #create-new-deal-btn > *,
    button#create-new-deal-btn.btn.primary > *,
    .listings-page #listing-create-btn > *,
    .listings-page .listings-page-actions #listing-create-btn > *,
    .listings-page button[data-listing-create].btn.primary > * {
        pointer-events: none !important;
    }

    .deals-container:not(.mobile-deal-open) .deal-details,
    .deals-container:not(.mobile-deal-open) .deal-placeholder,
    .deals-container:not(.mobile-deal-open) .deal-placeholder .placeholder-content,
    .listings-page .listings-page-actions {
        pointer-events: auto !important;
    }
}

/* === DEALIX 115: mobile deals page-scroll root-fix ===
   Root cause: previous mobile deals fixes kept the deals screen as a fixed-height
   overflow-hidden viewport and made .deals-list/.deal-details the only scroll roots.
   In iPhone/PWA this turns both the list and an opened deal into a clipped inner
   window above the fixed bottom nav. On mobile the deals page must scroll like a
   normal page; the bottom nav is only an overlay. Desktop layout is untouched. */
@media (max-width: 900px) {
    html body .app[data-page="deals"] .main-content {
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        overscroll-behavior-y: auto !important;
        min-height: 0 !important;
        height: auto !important;
        max-height: none !important;
    }

    html body .app[data-page="deals"] .page-content:has(.deals-page),
    html body .app[data-page="deals"] #page-content:has(.deals-page) {
        height: auto !important;
        min-height: calc(100dvh - 10px) !important;
        max-height: none !important;
        overflow: visible !important;
        padding: 8px 8px calc(var(--mobile-bottom-nav-h, 72px) + 28px + env(safe-area-inset-bottom, 0px)) !important;
        margin: 0 auto !important;
        box-sizing: border-box !important;
    }

    html body .app[data-page="deals"] .deals-page,
    html body .app[data-page="deals"] .deals-container,
    html body .app[data-page="deals"] .deals-container:not(.mobile-deal-open),
    html body .app[data-page="deals"] .deals-container.mobile-deal-open {
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow: visible !important;
    }

    html body .app[data-page="deals"] .deals-container:not(.mobile-deal-open) {
        display: flex !important;
        flex-direction: column !important;
    }

    html body .app[data-page="deals"] .deals-container:not(.mobile-deal-open) .deal-details {
        order: -1 !important;
        display: block !important;
        flex: 0 0 auto !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow: visible !important;
        padding: 0 0 10px !important;
    }

    html body .app[data-page="deals"] .deals-container:not(.mobile-deal-open) .deals-sidebar {
        order: 1 !important;
        display: flex !important;
        flex: 0 0 auto !important;
        height: auto !important;
        min-height: calc(100dvh - 210px) !important;
        max-height: none !important;
        overflow: visible !important;
        margin: 0 !important;
    }

    html body .app[data-page="deals"] .deals-container.mobile-deal-open {
        display: block !important;
    }

    html body .app[data-page="deals"] .deals-container.mobile-deal-open .deals-sidebar {
        display: none !important;
    }

    html body .app[data-page="deals"] .deals-container.mobile-deal-open .deal-details {
        display: block !important;
        width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow: visible !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    html body .app[data-page="deals"] .deals-list,
    html body .app[data-page="deals"] .deals-container.mobile-deal-open #deal-details-content,
    html body .app[data-page="deals"] .deals-container.mobile-deal-open .deal-details-content,
    html body .app[data-page="deals"] .deals-container.mobile-deal-open .deal-details-card {
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow: visible !important;
        -webkit-overflow-scrolling: auto !important;
        overscroll-behavior: auto !important;
    }

    html body .app[data-page="deals"] .deals-list {
        flex: 0 0 auto !important;
        padding-bottom: 16px !important;
        scroll-padding-bottom: calc(var(--mobile-bottom-nav-h, 72px) + 28px + env(safe-area-inset-bottom, 0px)) !important;
        box-sizing: border-box !important;
    }

    html body .app[data-page="deals"] .deal-details-card {
        margin-bottom: 0 !important;
    }
}

@media (max-width: 390px) {
    html body .app[data-page="deals"] .page-content:has(.deals-page),
    html body .app[data-page="deals"] #page-content:has(.deals-page) {
        padding-bottom: calc(var(--mobile-bottom-nav-h, 68px) + 30px + env(safe-area-inset-bottom, 0px)) !important;
    }

    html body .app[data-page="deals"] .deals-container:not(.mobile-deal-open) .deals-sidebar {
        min-height: calc(100dvh - 200px) !important;
    }
}

/* === DEALIX 114: mobile bottom nav tap reliability root-fix ===
   Root cause: recent full-height mobile page fixes let scroll layers extend under
   the fixed bottom nav, while the nav still relied on native anchor hash clicks.
   Keep the nav as the top app control below sidebar/overlays and make its tap
   targets deterministic. UI-only: no route/API/deals/chat logic changes. */
@media (max-width: 768px) {
    html body .mobile-bottom-nav {
        z-index: 998 !important;
        pointer-events: auto !important;
        touch-action: manipulation !important;
        -webkit-user-select: none !important;
        user-select: none !important;
        isolation: isolate !important;
    }

    html body .mobile-bottom-item {
        pointer-events: auto !important;
        touch-action: manipulation !important;
        -webkit-user-select: none !important;
        user-select: none !important;
    }

    html body .mobile-bottom-item > * {
        pointer-events: none !important;
    }
}

/* === DEALIX 115: mobile profile action tap root-fix ===
   Root cause: on iPhone/PWA some profile actions still relied on synthesized
   click after a moving page/overlay. Make these controls deterministic touch
   targets without changing layout or profile APIs. */
@media (hover: none) and (pointer: coarse), (max-width: 768px) {
    html body #profile-followers-btn,
html body #profile-more-actions-btn,
html body .fullscreen-image-more,
html body .fullscreen-image-close,
html body .fullscreen-image-menu button {
        touch-action: manipulation !important;
        -webkit-tap-highlight-color: transparent !important;
        pointer-events: auto !important;
        cursor: pointer !important;
    }

    html body #profile-followers-btn > *,
html body #profile-more-actions-btn > *,
html body .fullscreen-image-more > *,
html body .fullscreen-image-close > * {
        pointer-events: none !important;
    }

    html body .fullscreen-image-more,
    html body .fullscreen-image-close,
    html body .fullscreen-image-menu {
        z-index: 100010 !important;
    }
}


/* DEALIX feed/forum mobile topic replies alignment — CSS only, no JS/API changes */
@media (max-width: 720px) {
    .feed-page .vk-forum-panel.compact .forum-topic-row {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 10px !important;
    }

    .feed-page .vk-forum-panel.compact .forum-topic-main {
        flex: 1 1 auto !important;
        min-width: 0 !important;
    }

    .feed-page .vk-forum-panel.compact .forum-topic-meta {
        flex: 0 0 64px !important;
        min-width: 64px !important;
        align-self: center !important;
        display: grid !important;
        justify-items: center !important;
        align-content: center !important;
        gap: 0 !important;
        padding-left: 10px !important;
        border-left: 1px solid rgba(148, 163, 184, .12) !important;
        text-align: center !important;
    }

    .feed-page .vk-forum-panel.compact .forum-topic-meta strong,
    .feed-page .vk-forum-panel.compact .forum-topic-meta span {
        display: block !important;
        width: 100% !important;
        white-space: nowrap !important;
    }
}

/* === DEALIX 118: group-call mobile grid true viewport bounds root-fix v2 ===
   Root cause: the group call reused the 1:1 video-call area rule with width:100vw.
   On iPhone/PWA/WebView, 100vw + nested padding/safe-area math can make the grid
   slightly wider than the visible call viewport. Force the group-call video area to
   use the parent viewport width (100%), not raw 100vw, and keep the participant grid
   inside that content box. CSS-only: no WebRTC, participants, camera/mic or call JS changes. */
@media (max-width: 768px) {
    .call-fullscreen.call-reference-ui.group-call.video-call:not(.incoming-call):not(.call-minimized) #call-video-area.call-video-area {
        position: absolute !important;
        inset: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        box-sizing: border-box !important;
        padding: calc(86px + env(safe-area-inset-top, 0px)) max(18px, env(safe-area-inset-right, 0px)) calc(108px + env(safe-area-inset-bottom, 0px)) max(18px, env(safe-area-inset-left, 0px)) !important;
        overflow: hidden !important;
    }

    .call-fullscreen.call-reference-ui.group-call.video-call:not(.incoming-call):not(.call-minimized) #group-call-grid.group-call-grid {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        height: 100% !important;
        max-height: 100% !important;
        box-sizing: border-box !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        overscroll-behavior: contain !important;
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        grid-auto-rows: minmax(132px, 1fr) !important;
        gap: 8px !important;
        margin: 0 auto !important;
    }

    .call-fullscreen.call-reference-ui.group-call.video-call:not(.incoming-call):not(.call-minimized) #group-call-grid.group-call-grid > .group-call-tile {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        height: auto !important;
        min-height: 132px !important;
        max-height: none !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
    }

    .call-fullscreen.call-reference-ui.group-call.video-call:not(.incoming-call):not(.call-minimized) #group-call-grid.group-call-grid.has-pinned-participant > .group-call-tile.pinned {
        grid-column: 1 / -1 !important;
        min-height: clamp(240px, 44dvh, 420px) !important;
        order: -1 !important;
    }
}

@supports (height: 100svh) {
    @media (max-width: 768px) {
        .call-fullscreen.call-reference-ui.group-call.video-call:not(.incoming-call):not(.call-minimized) #call-video-area.call-video-area {
            height: 100svh !important;
            max-height: 100svh !important;
        }
    }
}

/* DEALIX: clean circular call camera-switch icon alignment (mobile/PWA safe) */
.call-fullscreen.call-reference-ui #call-switch-camera-btn:is(.hidden, [hidden], [aria-hidden="true"]) { display: none !important; }
.call-fullscreen.call-reference-ui #call-switch-camera-btn:not(.hidden):not([hidden]):not([aria-hidden="true"]) {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
}
.call-fullscreen.call-reference-ui #call-switch-camera-btn .call-switch-camera-icon,
.call-fullscreen.call-reference-ui #call-switch-camera-btn svg.call-switch-camera-icon {
    width: 34px !important;
    height: 34px !important;
    display: block !important;
    flex: 0 0 34px !important;
    margin: 0 !important;
    transform: none !important;
    stroke-linecap: round !important;
    stroke-linejoin: round !important;
}
.call-fullscreen.call-reference-ui #call-switch-camera-btn.is-switching .call-switch-camera-icon {
    opacity: .72 !important;
}

/* ===== DEALIX 120: reliable draggable mini call preview ===== */
/* Root cause: mini call was forced to a fixed inset by older !important rules and
   private video mini always hid the local preview/header, so it could become an
   empty square. Keep the existing WebRTC logic; only make the mini preview select
   the focused stream/avatar and allow JS drag position to win via inline !important. */
#call-modal.call-fullscreen.call-reference-ui.call-minimized.video-call:not(.group-call)[data-call-mini-focus="local"] .call-video-area {
    display: block !important;
    visibility: visible !important;
}
#call-modal.call-fullscreen.call-reference-ui.call-minimized.video-call:not(.group-call)[data-call-mini-focus="local"] #call-local-video {
    display: block !important;
    visibility: visible !important;
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    opacity: 1 !important;
    transform: none !important;
    z-index: 4 !important;
}
#call-modal.call-fullscreen.call-reference-ui.call-minimized.video-call:not(.group-call)[data-call-mini-focus="local"] #call-remote-video,
#call-modal.call-fullscreen.call-reference-ui.call-minimized.video-call:not(.group-call)[data-call-mini-focus="local"] .call-video-placeholder {
    display: none !important;
    visibility: hidden !important;
}
#call-modal.call-fullscreen.call-reference-ui.call-minimized.video-call:not(.group-call)[data-call-mini-focus="peer-avatar"] .call-video-placeholder.peer-camera-off-placeholder:not(.hidden) {
    display: grid !important;
    visibility: visible !important;
    place-items: center !important;
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: radial-gradient(circle at 50% 35%, rgba(99,102,241,.24), #020617 74%) !important;
    z-index: 5 !important;
}
#call-modal.call-fullscreen.call-reference-ui.call-minimized.video-call:not(.group-call)[data-call-mini-focus="peer-avatar"] #call-remote-video,
#call-modal.call-fullscreen.call-reference-ui.call-minimized.video-call:not(.group-call)[data-call-mini-focus="peer-avatar"] #call-local-video {
    display: none !important;
    visibility: hidden !important;
}
#call-modal.call-fullscreen.call-reference-ui.call-minimized.video-call:not(.group-call)[data-call-mini-focus="peer-avatar"] .call-video-avatar-ring {
    width: 82px !important;
    height: 82px !important;
    padding: 4px !important;
}
#call-modal.call-fullscreen.call-reference-ui.call-minimized.video-call:not(.group-call)[data-call-mini-focus="peer-avatar"] .call-video-avatar-img {
    font-size: 2.1rem !important;
}
#call-modal.call-fullscreen.call-reference-ui.call-minimized.video-call:not(.group-call)[data-call-mini-focus="remote"] #call-remote-video {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* ===== DEALIX 120: mini-call compact name badge, no left ghost overlay ===== */
.call-fullscreen.call-reference-ui.call-minimized:not(.group-call) .call-mini-label:not(.hidden) {
    position: absolute !important;
    left: auto !important;
    right: 14px !important;
    bottom: 14px !important;
    z-index: 9 !important;
    width: auto !important;
    min-width: 54px !important;
    max-width: calc(100% - 112px) !important;
    min-height: 34px !important;
    padding: 7px 12px !important;
    border-radius: 17px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    text-align: left !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    font-size: .98rem !important;
    line-height: 1.05 !important;
    font-weight: 900 !important;
    color: #fff !important;
    background: linear-gradient(135deg, rgba(15,23,42,.82), rgba(15,23,42,.52)) !important;
    border: 1px solid rgba(255,255,255,.14) !important;
    box-shadow: 0 12px 30px rgba(2,6,23,.32) !important;
    backdrop-filter: blur(14px) saturate(140%) !important;
    -webkit-backdrop-filter: blur(14px) saturate(140%) !important;
    pointer-events: none !important;
}

.call-fullscreen.call-reference-ui.call-minimized.audio-call .call-name,
.call-fullscreen.call-reference-ui.call-minimized.audio-call .call-status {
    display: none !important;
}

.call-fullscreen.call-reference-ui.call-minimized.audio-call .call-header-info {
    padding-bottom: 48px !important;
}

.call-fullscreen.call-reference-ui.call-minimized.video-call .call-video-placeholder.peer-camera-off-placeholder:not(.hidden) {
    padding-bottom: 44px !important;
}

@media (max-width: 420px) {
    .call-fullscreen.call-reference-ui.call-minimized:not(.group-call) .call-mini-label:not(.hidden) {
        right: 12px !important;
        bottom: 12px !important;
        min-width: 48px !important;
        max-width: calc(100% - 96px) !important;
        min-height: 32px !important;
        padding: 6px 10px !important;
        font-size: .94rem !important;
        border-radius: 16px !important;
    }
}

/* ===== DEALIX 120: mini-call single visible name source ===== */
/* Root cause: after adding the draggable mini badge, the legacy private video
   header/status layer could still leak inside the minimized preview on some
   desktop/mobile layouts. Keep the working drag/video logic; hide only the old
   private-video mini labels so the new moving badge is the single source. */
#call-modal.call-fullscreen.call-reference-ui.call-minimized.video-call:not(.group-call) #call-header-info,
#call-modal.call-fullscreen.call-reference-ui.call-minimized.video-call:not(.group-call) .call-header-info,
#call-modal.call-fullscreen.call-reference-ui.call-minimized.video-call:not(.group-call) #call-name,
#call-modal.call-fullscreen.call-reference-ui.call-minimized.video-call:not(.group-call) .call-name,
#call-modal.call-fullscreen.call-reference-ui.call-minimized.video-call:not(.group-call) #call-status,
#call-modal.call-fullscreen.call-reference-ui.call-minimized.video-call:not(.group-call) .call-status,
#call-modal.call-fullscreen.call-reference-ui.call-minimized.video-call:not(.group-call) #call-peer-state,
#call-modal.call-fullscreen.call-reference-ui.call-minimized.video-call:not(.group-call) .call-peer-state {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

#call-modal.call-fullscreen.call-reference-ui.call-minimized.video-call:not(.group-call) .call-video-placeholder.peer-camera-off-placeholder:not(.hidden) {
    padding: 0 !important;
    overflow: hidden !important;
}

#call-modal.call-fullscreen.call-reference-ui.call-minimized.video-call:not(.group-call) .call-video-avatar-fallback {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    display: grid !important;
    place-items: center !important;
    z-index: 6 !important;
    pointer-events: none !important;
}

#call-modal.call-fullscreen.call-reference-ui.call-minimized.video-call:not(.group-call) .call-video-avatar-ring {
    position: relative !important;
    z-index: 7 !important;
}

/* ===== DEALIX 120: private video mini avatar single-layer root fix ===== */
/* Root cause: private minimized video fallback still used the video-placeholder
   plane while legacy call/video layers could leak text/strips inside the mini
   card. For the peer-avatar fallback state use exactly one visual source: the
   existing call header avatar. Keep remote/local video mini states untouched. */
#call-modal.call-fullscreen.call-reference-ui.call-minimized.video-call:not(.group-call)[data-call-mini-focus="peer-avatar"] .call-video-area,
#call-modal.call-fullscreen.call-reference-ui.call-minimized.video-call:not(.group-call)[data-call-mini-focus="peer-avatar"] #call-remote-video,
#call-modal.call-fullscreen.call-reference-ui.call-minimized.video-call:not(.group-call)[data-call-mini-focus="peer-avatar"] #call-local-video,
#call-modal.call-fullscreen.call-reference-ui.call-minimized.video-call:not(.group-call)[data-call-mini-focus="peer-avatar"] .call-video-placeholder,
#call-modal.call-fullscreen.call-reference-ui.call-minimized.video-call:not(.group-call)[data-call-mini-focus="peer-avatar"] .call-video-avatar-fallback,
#call-modal.call-fullscreen.call-reference-ui.call-minimized.video-call:not(.group-call)[data-call-mini-focus="peer-avatar"] #call-peer-state,
#call-modal.call-fullscreen.call-reference-ui.call-minimized.video-call:not(.group-call)[data-call-mini-focus="peer-avatar"] .call-peer-state {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

#call-modal.call-fullscreen.call-reference-ui.call-minimized.video-call:not(.group-call)[data-call-mini-focus="peer-avatar"] #call-header-info,
#call-modal.call-fullscreen.call-reference-ui.call-minimized.video-call:not(.group-call)[data-call-mini-focus="peer-avatar"] .call-header-info {
    display: grid !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: inherit !important;
    background: radial-gradient(circle at 50% 36%, rgba(99,102,241,.24), rgba(2,6,23,.98) 74%) !important;
    box-shadow: none !important;
    grid-template-columns: 1fr !important;
    grid-template-rows: 1fr !important;
    place-items: center !important;
    overflow: hidden !important;
    text-align: center !important;
    z-index: 4 !important;
    pointer-events: none !important;
}

#call-modal.call-fullscreen.call-reference-ui.call-minimized.video-call:not(.group-call)[data-call-mini-focus="peer-avatar"] .call-avatar-ring {
    display: grid !important;
    visibility: visible !important;
    opacity: 1 !important;
    grid-row: auto !important;
    grid-column: auto !important;
    position: relative !important;
    width: 82px !important;
    height: 82px !important;
    min-width: 82px !important;
    min-height: 82px !important;
    padding: 4px !important;
    margin: 0 !important;
    border-radius: 50% !important;
    place-items: center !important;
    transform: none !important;
    z-index: 5 !important;
}

#call-modal.call-fullscreen.call-reference-ui.call-minimized.video-call:not(.group-call)[data-call-mini-focus="peer-avatar"] .call-avatar-img {
    display: grid !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    border-radius: 50% !important;
    place-items: center !important;
    font-size: 2.1rem !important;
    line-height: 1 !important;
    transform: none !important;
}

#call-modal.call-fullscreen.call-reference-ui.call-minimized.video-call:not(.group-call)[data-call-mini-focus="peer-avatar"] .call-name,
#call-modal.call-fullscreen.call-reference-ui.call-minimized.video-call:not(.group-call)[data-call-mini-focus="peer-avatar"] .call-status {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

#call-modal.call-fullscreen.call-reference-ui.call-minimized.video-call:not(.group-call)[data-call-mini-focus="peer-avatar"] .call-mini-label:not(.hidden) {
    z-index: 9 !important;
    right: 14px !important;
    bottom: 14px !important;
    left: auto !important;
}


/* ===== DEALIX 121: call mini label single-layer root fix ===== */
/* Do not use call-wrapper::before for the mini-call name: the base call UI already
   uses that pseudo-element for the animated glow, which caused the ghost strip and
   duplicated labels over the avatar. The real label is #call-mini-label now. */
.call-fullscreen.call-reference-ui.call-minimized .call-wrapper::before {
    content: none !important;
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}
.call-fullscreen.call-reference-ui .call-mini-label {
    display: none !important;
}
.call-fullscreen.call-reference-ui.call-minimized:not(.group-call) .call-mini-label:not(.hidden) {
    position: absolute !important;
    left: auto !important;
    right: 14px !important;
    bottom: 14px !important;
    z-index: 40 !important;
    display: inline-flex !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: min(112px, calc(100% - 28px)) !important;
    min-height: 32px !important;
    padding: 6px 11px !important;
    border-radius: 999px !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    font-size: .94rem !important;
    line-height: 1 !important;
    font-weight: 900 !important;
    color: #fff !important;
    background: rgba(2, 6, 23, .42) !important;
    border: 1px solid rgba(255,255,255,.14) !important;
    box-shadow: 0 10px 24px rgba(2,6,23,.28) !important;
    backdrop-filter: blur(12px) saturate(135%) !important;
    -webkit-backdrop-filter: blur(12px) saturate(135%) !important;
    pointer-events: none !important;
}
#call-modal.call-fullscreen.call-reference-ui.call-minimized.video-call:not(.group-call)[data-call-mini-focus="peer-avatar"] .call-video-area,
#call-modal.call-fullscreen.call-reference-ui.call-minimized.video-call:not(.group-call)[data-call-mini-focus="peer-avatar"] .call-video-placeholder,
#call-modal.call-fullscreen.call-reference-ui.call-minimized.video-call:not(.group-call)[data-call-mini-focus="peer-avatar"] .call-peer-state,
#call-modal.call-fullscreen.call-reference-ui.call-minimized.video-call:not(.group-call)[data-call-mini-focus="peer-avatar"] #call-peer-state {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}
#call-modal.call-fullscreen.call-reference-ui.call-minimized:not(.group-call) .call-name,
#call-modal.call-fullscreen.call-reference-ui.call-minimized:not(.group-call) .call-status,
#call-modal.call-fullscreen.call-reference-ui.call-minimized:not(.group-call) .call-peer-state,
#call-modal.call-fullscreen.call-reference-ui.call-minimized:not(.group-call) #call-peer-state {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}
@media (max-width: 420px) {
    .call-fullscreen.call-reference-ui.call-minimized:not(.group-call) .call-mini-label:not(.hidden) {
        right: 12px !important;
        bottom: 12px !important;
        max-width: min(96px, calc(100% - 24px)) !important;
        min-height: 30px !important;
        padding: 6px 10px !important;
        font-size: .9rem !important;
    }
}

/* === DEALIX chat info media/links/voice/favorites collections === */
.chat-info-collections {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 2px 0 8px;
}
.chat-info-tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    padding: 5px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--bg-card) 82%, transparent);
    border: 1px solid color-mix(in srgb, var(--border) 62%, transparent);
    overflow: hidden;
}
.chat-info-tab {
    min-width: 0;
    height: 40px;
    border: 0;
    border-radius: 999px;
    padding: 0 10px;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 850;
    font-size: .92rem;
    cursor: pointer;
    transition: background .16s ease, color .16s ease, box-shadow .16s ease;
}
.chat-info-tab.active {
    color: color-mix(in srgb, var(--primary) 82%, #fff 18%);
    background: linear-gradient(135deg, rgba(109,93,252,.28), rgba(32,198,255,.14));
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.06), 0 8px 22px rgba(109,93,252,.16);
}
.chat-info-collection-body {
    min-height: 92px;
    border-radius: 24px;
    background: color-mix(in srgb, var(--bg-card) 72%, transparent);
    border: 1px solid color-mix(in srgb, var(--border) 62%, transparent);
    padding: 14px;
    overflow: hidden;
}
.chat-info-collection-empty {
    min-height: 74px;
    display: grid;
    place-items: center;
    text-align: center;
    color: var(--text-secondary);
    font-weight: 760;
    padding: 16px;
}
.chat-info-collection-empty.error { color: var(--danger); }
.chat-info-media-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}
.chat-info-media-card {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    border: 0;
    border-radius: 18px;
    padding: 0;
    overflow: hidden;
    cursor: pointer;
    background: rgba(120,132,170,.12);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}
.chat-info-media-card img,
.chat-info-media-card video {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}
.chat-info-media-card.is-video::after,
.chat-info-media-card.is-image:hover::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 45%, rgba(0,0,0,.38));
    pointer-events: none;
}
.chat-info-media-play {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    color: #fff;
    background: rgba(15,23,42,.58);
    box-shadow: 0 8px 22px rgba(0,0,0,.24);
    z-index: 2;
}
.chat-info-media-duration {
    position: absolute;
    left: 8px;
    bottom: 7px;
    z-index: 2;
    padding: 3px 7px;
    border-radius: 999px;
    font-size: .76rem;
    font-weight: 850;
    color: #fff;
    background: rgba(15,23,42,.68);
}
.chat-info-voice-list,
.chat-info-link-list,
.chat-info-favorite-list {
    display: grid;
    gap: 10px;
}
.chat-info-voice-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
}
.chat-info-voice-row .voice-message {
    min-width: 0;
    max-width: 100%;
    width: 100%;
    background: linear-gradient(135deg, rgba(139,92,246,.70), rgba(32,198,255,.30));
    border-radius: 20px;
    padding: 9px 10px;
}
.chat-info-row-date {
    color: var(--text-muted);
    font-size: .78rem;
    font-weight: 850;
    white-space: nowrap;
}
.chat-info-link-card {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    min-height: 66px;
    padding: 10px;
    border-radius: 20px;
    background: color-mix(in srgb, var(--bg-secondary) 76%, transparent);
    color: var(--text);
    text-decoration: none;
    border: 1px solid color-mix(in srgb, var(--border) 58%, transparent);
}
.chat-info-link-icon {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    color: #fff;
    font-weight: 950;
    font-size: 1.2rem;
    background: var(--primary-grad);
}
.chat-info-link-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.chat-info-link-main b,
.chat-info-link-main span,
.chat-info-link-main small {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chat-info-link-main b {
    color: var(--text);
    font-size: .98rem;
    font-weight: 900;
    white-space: nowrap;
}
.chat-info-link-main small,
.chat-info-link-main span {
    color: var(--text-secondary);
    font-size: .86rem;
    line-height: 1.25;
}
.chat-info-favorite-row.media-favorite {
    display: grid;
    grid-template-columns: 74px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    padding: 10px;
    border-radius: 20px;
    background: color-mix(in srgb, var(--bg-secondary) 76%, transparent);
    border: 1px solid color-mix(in srgb, var(--border) 58%, transparent);
}
.chat-info-favorite-row.media-favorite .chat-info-media-card {
    width: 74px;
    height: 74px;
    aspect-ratio: auto;
    border-radius: 18px;
}
.chat-info-favorite-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.chat-info-favorite-text b { font-size: 1rem; font-weight: 900; color: var(--text); }
.chat-info-favorite-text small { color: var(--text-muted); font-weight: 760; }
.chat-info-favorite-label {
    display: inline-flex;
    width: max-content;
    margin: 0 0 6px 4px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 900;
    color: color-mix(in srgb, var(--primary) 86%, #fff 14%);
    background: rgba(109,93,252,.14);
}
.group-members-panel.group-info-panel .chat-info-collections {
    padding: 10px;
    margin: 0;
    border-bottom: 1px solid color-mix(in srgb, var(--border) 76%, transparent);
}
.group-members-panel.group-info-panel .chat-info-collection-body {
    max-height: min(42vh, 340px);
    overflow-y: auto;
}
body.theme-light .chat-info-tabs,
body.theme-light .chat-info-collection-body,
body.theme-light .chat-info-link-card,
body.theme-light .chat-info-favorite-row.media-favorite {
    background: rgba(255,255,255,.78);
    border-color: rgba(15,23,42,.10);
}
@media (max-width: 768px) {
    .chat-info-tabs { gap: 3px; padding: 4px; }
    .chat-info-tab { height: 38px; padding: 0 8px; font-size: .86rem; }
    .chat-info-collection-body { padding: 12px; border-radius: 22px; }
    .chat-info-media-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
    .chat-info-media-card { border-radius: 16px; }
    .chat-info-link-card { grid-template-columns: 42px minmax(0, 1fr) auto; gap: 10px; padding: 9px; border-radius: 18px; }
    .chat-info-link-icon { width: 42px; height: 42px; border-radius: 13px; }
    .chat-info-voice-row { gap: 8px; }
    .group-members-panel.group-info-panel .chat-info-collection-body { max-height: 32vh; }
}

/* === DEALIX chat info collections stage 1B: compact group info + saved jump === */
.group-members-panel.group-info-panel .chat-info-collections {
    width: min(100%, 430px) !important;
    max-width: 430px !important;
    margin: 0 auto 14px !important;
    padding: 10px 0 16px !important;
}
.group-members-panel.group-info-panel .chat-info-tabs {
    width: 100% !important;
}
.group-members-panel.group-info-panel .chat-info-collection-body {
    width: 100% !important;
    max-height: min(36vh, 320px) !important;
}
.group-members-panel.group-info-panel .chat-info-media-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    justify-content: stretch !important;
    align-items: start !important;
}
.group-members-panel.group-info-panel .chat-info-media-card {
    max-width: none !important;
}
.group-members-panel.group-info-panel .chat-info-voice-row .voice-message,
.group-members-panel.group-info-panel .chat-info-link-card,
.group-members-panel.group-info-panel .chat-info-favorite-row {
    max-width: 100% !important;
}
.group-members-panel.group-info-panel .chat-info-voice-row {
    grid-template-columns: minmax(0, 1fr) auto !important;
}
.chat-info-saved-jump {
    cursor: pointer;
    transition: transform .16s ease, border-color .16s ease, background .16s ease;
}
.chat-info-saved-jump:hover {
    transform: translateY(-1px);
    border-color: color-mix(in srgb, var(--primary) 44%, var(--border) 56%);
}
.chat-info-favorite-text em {
    display: inline-flex;
    width: max-content;
    max-width: 100%;
    margin-top: 2px;
    padding: 2px 7px;
    border-radius: 999px;
    font-size: .72rem;
    line-height: 1.15;
    font-style: normal;
    font-weight: 850;
    color: color-mix(in srgb, var(--primary) 84%, #fff 16%);
    background: rgba(109,93,252,.14);
}
.message.chat-info-jump-highlight {
    animation: chatInfoJumpPulse 1.65s ease both;
}
@keyframes chatInfoJumpPulse {
    0%, 100% { filter: none; }
    20%, 70% { filter: drop-shadow(0 0 16px rgba(151,112,255,.58)); }
}
@media (max-width: 768px) {
    .group-members-panel.group-info-panel .chat-info-collections {
        width: 100% !important;
        max-width: none !important;
        margin: 0 0 12px !important;
        padding: 8px 0 12px !important;
    }
    .group-members-panel.group-info-panel .chat-info-collection-body {
        max-height: 30vh !important;
    }
    .group-members-panel.group-info-panel .chat-info-media-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }
    .group-members-panel.group-info-panel .chat-info-media-card {
        max-width: none !important;
    }
}

/* === DEALIX chat info group panel width root-fix === */
/* Group info collections must align with the group action rows like "Добавить участников".
   Do not stretch to the full viewport on desktop; use the same centered 720px lane as group actions. */
.group-members-panel.group-info-panel .chat-info-collections {
    width: min(720px, calc(100% - 40px)) !important;
    max-width: 720px !important;
    margin: 0 auto 16px !important;
    padding: 10px 0 16px !important;
    box-sizing: border-box !important;
}
.group-members-panel.group-info-panel .chat-info-tabs,
.group-members-panel.group-info-panel .chat-info-collection-body {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}
.group-members-panel.group-info-panel .chat-info-collection-body {
    max-height: min(42vh, 360px) !important;
}
.group-members-panel.group-info-panel .chat-info-media-grid {
    grid-template-columns: repeat(auto-fill, minmax(118px, 118px)) !important;
    justify-content: start !important;
    align-items: start !important;
    gap: 10px !important;
}
.group-members-panel.group-info-panel .chat-info-media-card {
    width: 118px !important;
    max-width: 118px !important;
}
.group-members-panel.group-info-panel .chat-info-voice-row {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    width: 100% !important;
}
.group-members-panel.group-info-panel .chat-info-voice-row .voice-message {
    width: min(520px, 100%) !important;
    max-width: 520px !important;
    flex: 0 1 520px !important;
}
.group-members-panel.group-info-panel .chat-info-voice-row .chat-info-row-date {
    margin-left: auto !important;
}
@media (max-width: 768px) {
    .group-members-panel.group-info-panel .chat-info-collections {
        width: 100% !important;
        max-width: none !important;
        margin: 0 0 12px !important;
        padding: 8px 0 12px !important;
    }
    .group-members-panel.group-info-panel .chat-info-collection-body {
        max-height: 34vh !important;
    }
    .group-members-panel.group-info-panel .chat-info-media-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 6px !important;
    }
    .group-members-panel.group-info-panel .chat-info-media-card {
        width: 100% !important;
        max-width: none !important;
    }
    .group-members-panel.group-info-panel .chat-info-voice-row {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) auto !important;
        align-items: center !important;
    }
    .group-members-panel.group-info-panel .chat-info-voice-row .voice-message {
        width: 100% !important;
        max-width: 100% !important;
    }
    .group-members-panel.group-info-panel .chat-info-voice-row .chat-info-row-date {
        margin-left: 0 !important;
    }
}

/* === DEALIX group chat info voice row: stretch player to date === */
/* Keep the group info lane width, but let the voice bubble fill all available space up to the date. */
.group-members-panel.group-info-panel .chat-info-voice-row {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: center !important;
    gap: 10px !important;
    width: 100% !important;
}
.group-members-panel.group-info-panel .chat-info-voice-row .voice-message {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    flex: none !important;
}
.group-members-panel.group-info-panel .chat-info-voice-row .chat-info-row-date {
    justify-self: end !important;
    margin-left: 0 !important;
}

/* === DEALIX 123: native SVG close buttons for chat group/media windows ===
   Root cause: the close buttons still used a raw text × and a pseudo-element overlay.
   That made the cross thick and, in the media viewer, could leave a separate text glyph
   drifting under the three-dot action button. Use the same thin SVG close shape as the
   personal chat info close button and keep the media viewer close fixed in the right corner. */
html body .group-chat-card .group-chat-close,
html body .group-members-panel .group-members-close,
html body #chat-media-viewer .chat-media-viewer-close,
html body .chat-media-viewer .chat-media-viewer-close {
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    min-height: 42px !important;
    max-width: 42px !important;
    max-height: 42px !important;
    padding: 0 !important;
    border-radius: 999px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
    font-size: 0 !important;
    font-weight: 400 !important;
    color: #fff !important;
    background: rgba(15, 23, 42, .30) !important;
    border: 1px solid rgba(255, 255, 255, .16) !important;
    box-shadow: 0 12px 30px rgba(0, 0, 0, .18), inset 0 1px 0 rgba(255,255,255,.08) !important;
    backdrop-filter: blur(12px) saturate(1.14) !important;
    -webkit-backdrop-filter: blur(12px) saturate(1.14) !important;
    cursor: pointer !important;
    -webkit-tap-highlight-color: transparent !important;
    touch-action: manipulation !important;
    transform: none !important;
    overflow: hidden !important;
}

/* Kill legacy raw-× pseudo/text overrides if an older patch is still cached. */
html body .group-chat-card .group-chat-close::before,
html body .group-chat-card .group-chat-close::after,
html body .group-members-panel .group-members-close::before,
html body .group-members-panel .group-members-close::after,
html body #chat-media-viewer .chat-media-viewer-close::before,
html body #chat-media-viewer .chat-media-viewer-close::after,
html body .chat-media-viewer .chat-media-viewer-close::before,
html body .chat-media-viewer .chat-media-viewer-close::after {
    content: none !important;
    display: none !important;
}

html body .group-chat-card .group-chat-close svg,
html body .group-members-panel .group-members-close svg,
html body #chat-media-viewer .chat-media-viewer-close svg,
html body .chat-media-viewer .chat-media-viewer-close svg {
    width: 18px !important;
    height: 18px !important;
    display: block !important;
    flex: 0 0 18px !important;
    margin: 0 !important;
    transform: none !important;
    stroke-width: 2.35 !important;
    stroke-linecap: round !important;
    stroke-linejoin: round !important;
    pointer-events: none !important;
}

html body .group-chat-card .group-chat-close:hover,
html body .group-chat-card .group-chat-close:focus-visible,
html body .group-members-panel .group-members-close:hover,
html body .group-members-panel .group-members-close:focus-visible,
html body #chat-media-viewer .chat-media-viewer-close:hover,
html body #chat-media-viewer .chat-media-viewer-close:focus-visible,
html body .chat-media-viewer .chat-media-viewer-close:hover,
html body .chat-media-viewer .chat-media-viewer-close:focus-visible {
    background: rgba(30, 41, 59, .46) !important;
    border-color: rgba(167, 139, 250, .26) !important;
    color: #fff !important;
    transform: none !important;
}

/* Media viewer: close must stay in the top-right corner; the three-dot menu sits to its left. */
html body .chat-media-viewer:not(.hidden) .chat-media-viewer-close,
html body #chat-media-viewer:not(.hidden) .chat-media-viewer-close {
    position: fixed !important;
    top: max(12px, env(safe-area-inset-top)) !important;
    right: max(12px, env(safe-area-inset-right)) !important;
    left: auto !important;
    bottom: auto !important;
    z-index: 6 !important;
}

html body .chat-media-viewer:not(.hidden) .chat-media-viewer-more,
html body #chat-media-viewer:not(.hidden) .chat-media-viewer-more {
    position: fixed !important;
    top: max(12px, env(safe-area-inset-top)) !important;
    left: max(12px, env(safe-area-inset-left)) !important;
    right: auto !important;
    bottom: auto !important;
    z-index: 6 !important;
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    min-height: 42px !important;
    padding: 0 !important;
    border-radius: 999px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(15, 23, 42, .30) !important;
    border: 1px solid rgba(255,255,255,.16) !important;
    color: #fff !important;
    box-shadow: 0 12px 30px rgba(0,0,0,.18), inset 0 1px 0 rgba(255,255,255,.08) !important;
    backdrop-filter: blur(12px) saturate(1.14) !important;
    -webkit-backdrop-filter: blur(12px) saturate(1.14) !important;
    transform: none !important;
}

html body .chat-media-viewer:not(.hidden) .chat-media-viewer-more svg,
html body #chat-media-viewer:not(.hidden) .chat-media-viewer-more svg {
    width: 20px !important;
    height: 20px !important;
    display: block !important;
    pointer-events: none !important;
}

html body .chat-media-viewer-more-menu:not(.hidden),
html body #chat-media-viewer-more-menu:not(.hidden) {
    position: fixed !important;
    top: calc(max(12px, env(safe-area-inset-top)) + 54px) !important;
    left: max(12px, env(safe-area-inset-left)) !important;
    right: auto !important;
}

body.theme-light .group-chat-card .group-chat-close,
html[data-theme="light"] body .group-chat-card .group-chat-close,
body.theme-light .group-members-panel .group-members-close,
html[data-theme="light"] body .group-members-panel .group-members-close,
body.theme-light #chat-media-viewer .chat-media-viewer-close,
html[data-theme="light"] body #chat-media-viewer .chat-media-viewer-close,
body.theme-light .chat-media-viewer .chat-media-viewer-close,
html[data-theme="light"] body .chat-media-viewer .chat-media-viewer-close,
body.theme-light #chat-media-viewer .chat-media-viewer-more,
html[data-theme="light"] body #chat-media-viewer .chat-media-viewer-more {
    color: #111827 !important;
    background: rgba(255, 255, 255, .82) !important;
    border-color: rgba(15, 23, 42, .12) !important;
    box-shadow: 0 12px 28px rgba(15, 23, 42, .12), inset 0 1px 0 rgba(255,255,255,.70) !important;
}

body.theme-glass .group-chat-card .group-chat-close,
html[data-theme="glass"] body .group-chat-card .group-chat-close,
body.theme-glass .group-members-panel .group-members-close,
html[data-theme="glass"] body .group-members-panel .group-members-close,
body.theme-glass #chat-media-viewer .chat-media-viewer-close,
html[data-theme="glass"] body #chat-media-viewer .chat-media-viewer-close,
body.theme-glass .chat-media-viewer .chat-media-viewer-close,
html[data-theme="glass"] body .chat-media-viewer .chat-media-viewer-close,
body.theme-glass #chat-media-viewer .chat-media-viewer-more,
html[data-theme="glass"] body #chat-media-viewer .chat-media-viewer-more {
    background: rgba(17, 24, 39, .26) !important;
    border-color: rgba(255,255,255,.18) !important;
}

@media (max-width: 640px) {
    html body .group-chat-card .group-chat-close,
    html body .group-members-panel .group-members-close,
    html body #chat-media-viewer .chat-media-viewer-close,
    html body .chat-media-viewer .chat-media-viewer-close,
    html body #chat-media-viewer .chat-media-viewer-more {
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
        min-height: 40px !important;
        max-width: 40px !important;
        max-height: 40px !important;
    }

    html body .group-chat-card .group-chat-close svg,
    html body .group-members-panel .group-members-close svg,
    html body #chat-media-viewer .chat-media-viewer-close svg,
    html body .chat-media-viewer .chat-media-viewer-close svg {
        width: 17px !important;
        height: 17px !important;
        flex-basis: 17px !important;
    }

    html body .chat-media-viewer:not(.hidden) .chat-media-viewer-more,
    html body #chat-media-viewer:not(.hidden) .chat-media-viewer-more {
        left: max(12px, env(safe-area-inset-left)) !important;
        right: auto !important;
    }
}

/* === DEALIX 124: group chat info favorites media layout root-fix ===
   Root cause: group info media sizing forced every .chat-info-media-card to 118px,
   including the media preview inside .chat-info-favorite-row.media-favorite, while the
   favorite row itself still reserved only the old 74px column. The preview then covered
   the favorite title/date text. Keep the group media preview and the reserved grid
   column in sync instead of layering another visual patch. */
.group-members-panel.group-info-panel .chat-info-favorite-row.media-favorite {
    display: grid !important;
    grid-template-columns: 118px minmax(0, 1fr) !important;
    align-items: center !important;
    gap: 14px !important;
    min-width: 0 !important;
    overflow: hidden !important;
}
.group-members-panel.group-info-panel .chat-info-favorite-row.media-favorite .chat-info-media-card {
    width: 118px !important;
    height: 118px !important;
    max-width: 118px !important;
    min-width: 118px !important;
    aspect-ratio: 1 / 1 !important;
    grid-column: 1 !important;
    justify-self: start !important;
}
.group-members-panel.group-info-panel .chat-info-favorite-row.media-favorite .chat-info-favorite-text {
    grid-column: 2 !important;
    min-width: 0 !important;
    overflow: hidden !important;
    padding: 0 !important;
    margin: 0 !important;
    align-self: center !important;
}
.group-members-panel.group-info-panel .chat-info-favorite-row.media-favorite .chat-info-favorite-text b,
.group-members-panel.group-info-panel .chat-info-favorite-row.media-favorite .chat-info-favorite-text small,
.group-members-panel.group-info-panel .chat-info-favorite-row.media-favorite .chat-info-favorite-text em {
    max-width: 100% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}
.group-members-panel.group-info-panel .chat-info-favorite-row.media-favorite .chat-info-favorite-text b,
.group-members-panel.group-info-panel .chat-info-favorite-row.media-favorite .chat-info-favorite-text small {
    white-space: nowrap !important;
}
@media (max-width: 768px) {
    .group-members-panel.group-info-panel .chat-info-favorite-row.media-favorite {
        grid-template-columns: 76px minmax(0, 1fr) !important;
        gap: 10px !important;
        padding: 9px !important;
    }
    .group-members-panel.group-info-panel .chat-info-favorite-row.media-favorite .chat-info-media-card {
        width: 76px !important;
        height: 76px !important;
        max-width: 76px !important;
        min-width: 76px !important;
        border-radius: 17px !important;
    }
}

/* === DEALIX 124: mobile chat info tabs + saved jump keyboard root-fix ===
   Root cause #1: four equal mobile tabs plus Russian long labels allowed the last letter
   of "Голосовые" / "Избранное" to wrap. Keep labels single-line and scale the tab font
   only on narrow phones.
   Root cause #2 is fixed in ui/chats.js: saved-message navigation now blurs the composer
   and suppresses keyboard shift instead of refocusing the textarea during openChat(). */
@media (max-width: 768px) {
    .chat-info-tabs,
    .group-members-panel.group-info-panel .chat-info-tabs {
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
        gap: 2px !important;
        padding: 4px !important;
        overflow: hidden !important;
    }
    .chat-info-tab,
    .group-members-panel.group-info-panel .chat-info-tab {
        min-width: 0 !important;
        height: 38px !important;
        padding: 0 3px !important;
        font-size: clamp(.66rem, 2.9vw, .82rem) !important;
        line-height: 1 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: clip !important;
        word-break: keep-all !important;
        overflow-wrap: normal !important;
        hyphens: none !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
    }
}
@media (max-width: 380px) {
    .chat-info-tab,
    .group-members-panel.group-info-panel .chat-info-tab {
        font-size: clamp(.6rem, 2.72vw, .74rem) !important;
        padding-left: 2px !important;
        padding-right: 2px !important;
        letter-spacing: -.02em !important;
    }
}

/* === DEALIX 125: chat/group avatar viewer + dialog avatar contain rootfix === */
.user-info-avatar-open {
    appearance: none !important;
    -webkit-appearance: none !important;
    border: 0 !important;
    padding: 0 !important;
    margin: 0 auto !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    line-height: 1 !important;
    color: inherit !important;
    background: transparent !important;
}
.user-info-avatar-open:focus-visible,
.group-info-avatar[data-avatar-url]:focus-visible {
    outline: 2px solid var(--primary) !important;
    outline-offset: 4px !important;
}
.user-info-avatar-open img,
.group-info-avatar.has-image img {
    width: 100% !important;
    height: 100% !important;
    display: block !important;
    object-fit: cover !important;
    object-position: center !important;
    border-radius: inherit !important;
}
.group-info-avatar.has-image {
    cursor: zoom-in !important;
}
.group-info-avatar.has-image:not(:disabled):hover,
.user-info-avatar-open:hover {
    filter: brightness(1.04) !important;
}
/* Avatar disclosure shares the existing identity header and media viewer. */
.user-info-cover {
    position: relative;
    display: grid;
    gap: 14px;
    min-width: 0;
}
.chat-info-avatar-collapse,
.chat-info-avatar-edit {
    position: absolute;
    z-index: 4;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    min-width: 44px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--text);
    background: var(--bg-card);
    box-shadow: 0 4px 14px rgba(0,0,0,.16);
    cursor: pointer;
    touch-action: manipulation;
}
.chat-info-avatar-collapse.hidden,
.chat-info-avatar-edit.hidden { display: none; }
.chat-info-avatar-edit { top: 68px; left: calc(50% + 18px); }
.chat-info-avatar-collapse { top: 12px; right: 12px; }
.chat-info-avatar-collapse svg,
.chat-info-avatar-edit svg { width: 21px; height: 21px; }
.chat-info-avatar-collapse:hover,
.chat-info-avatar-edit:hover { background: var(--bg-hover); }
.chat-info-avatar-collapse:active,
.chat-info-avatar-edit:active { transform: scale(.96); }
.chat-info-avatar-collapse:focus-visible,
.chat-info-avatar-edit:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.group-info-avatar:disabled { cursor: default; }
/* The old avatar dimensions are !important. Disclosure overrides only that
   existing geometry; no other avatar or panel receives a new positioning rule. */
.group-members-panel.group-info-panel .group-info-cover.is-avatar-expanded,
.chat-info-content .user-info-cover.is-avatar-expanded {
    position: relative;
    isolation: isolate;
    box-sizing: border-box;
    width: min(720px, 100%);
    min-height: clamp(340px, 45vw, 460px);
    margin-inline: auto;
    padding: 200px 18px 18px !important;
    overflow: hidden;
    border-radius: 22px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-end;
    gap: 7px;
    background: var(--bg-secondary);
}
.group-info-cover.is-avatar-expanded::after,
.user-info-cover.is-avatar-expanded::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(0,0,0,.08) 30%, rgba(0,0,0,.72) 100%);
}
.group-members-panel.group-info-panel .group-info-cover.is-avatar-expanded .group-info-avatar,
.chat-info-content .user-info-cover.is-avatar-expanded .user-info-avatar-open {
    position: absolute !important;
    inset: 0;
    z-index: 0;
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    border-radius: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    cursor: zoom-in !important;
}
.user-info-cover.is-avatar-expanded .user-info-avatar { padding: 0 !important; }
.group-info-cover.is-avatar-expanded .group-members-title,
.group-info-cover.is-avatar-expanded .group-members-subtitle,
.group-info-cover.is-avatar-expanded .group-info-quick-actions,
.user-info-cover.is-avatar-expanded .user-info-name,
.user-info-cover.is-avatar-expanded .chat-info-quick-actions { position: relative; z-index: 2; }
.group-members-panel.group-info-panel .group-info-cover.is-avatar-expanded .group-members-title,
.group-members-panel.group-info-panel .group-info-cover.is-avatar-expanded .group-members-subtitle,
.chat-info-content .user-info-cover.is-avatar-expanded .user-info-name,
.chat-info-content .user-info-cover.is-avatar-expanded .chat-peer-status { color: #fff !important; text-align: start !important; text-shadow: 0 1px 8px rgba(0,0,0,.25); }
.group-info-cover.is-avatar-expanded .group-info-quick-actions { margin: 8px 0 0; max-width: none; }
.group-info-cover.is-avatar-expanded .chat-info-quick-action,
.user-info-cover.is-avatar-expanded .chat-info-quick-action {
    color: #fff;
    background: rgba(20,26,32,.52);
    border-color: rgba(255,255,255,.2);
    box-shadow: none;
}
.group-info-cover.is-avatar-expanded .chat-info-avatar-collapse { left: calc(50% - 22px); right: auto; }
.group-info-cover.is-avatar-expanded .chat-info-avatar-edit { top: 66px; left: auto; right: 14px; }
.is-avatar-expanded .chat-info-avatar-collapse,
.is-avatar-expanded .chat-info-avatar-edit { color: #fff; background: rgba(20,26,32,.72); border-color: rgba(255,255,255,.3); }
.is-avatar-expanded .chat-info-avatar-collapse:hover,
.is-avatar-expanded .chat-info-avatar-edit:hover { background: rgba(20,26,32,.92); }
@media (max-width: 640px) {
    .chat-info-avatar-edit { top: 40px; }
    .group-members-panel.group-info-panel .group-info-cover.is-avatar-expanded,
    .chat-info-content .user-info-cover.is-avatar-expanded {
        min-height: clamp(330px, 105vw, 430px);
        padding: 180px 12px 12px !important;
        border-radius: 0 0 22px 22px;
    }
}
@media (prefers-reduced-motion: reduce) {
    .chat-info-avatar-collapse,
    .chat-info-avatar-edit { transition: none; }
}
/* In the dialog list group avatars should not crop user-uploaded square/portrait images. */
#chats-list .chat-item.group-dialog .avatar.group-avatar.has-image,
.chats-list .chat-item.group-dialog .avatar.group-avatar.has-image {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: color-mix(in srgb, var(--bg-tertiary, #111827) 84%, var(--accent, #8b5cf6) 16%) !important;
}
#chats-list .chat-item.group-dialog .avatar.group-avatar.has-image img,
.chats-list .chat-item.group-dialog .avatar.group-avatar.has-image img,
.app[data-page="chats"]:not(.mobile-chat-open-app) #chats-list .chat-item.group-dialog .avatar.group-avatar.has-image img,
.app[data-page="chats"]:not(.mobile-chat-open-app) .chats-list .chat-item.group-dialog .avatar.group-avatar.has-image img {
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    object-fit: contain !important;
    object-position: center !important;
    padding: 3px !important;
    box-sizing: border-box !important;
    border-radius: 50% !important;
    background: transparent !important;
}

/* === DEALIX 125: group dialog avatar fill rootfix ===
   In the dialogs list a previously-added contain/padding rule preserved the
   whole uploaded group image, but made landscape avatars render as a tiny
   rectangle inside the circle. Dialog avatars must visually fill the circle;
   only this list thumbnail is affected. */
#chats-list .chat-item.group-dialog .avatar.group-avatar.has-image img,
.chats-list .chat-item.group-dialog .avatar.group-avatar.has-image img,
.app[data-page="chats"]:not(.mobile-chat-open-app) #chats-list .chat-item.group-dialog .avatar.group-avatar.has-image img,
.app[data-page="chats"]:not(.mobile-chat-open-app) .chats-list .chat-item.group-dialog .avatar.group-avatar.has-image img {
    width: 100% !important;
    height: 100% !important;
    min-width: 100% !important;
    min-height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    padding: 0 !important;
    object-fit: cover !important;
    object-position: center center !important;
    border-radius: 50% !important;
    display: block !important;
}

/* === Stage 130B: listings map fullscreen toggle === */
body.listings-map-fullscreen-open {
    overflow: hidden;
}

.listings-map-fullscreen-toggle {
    position: absolute;
    z-index: 760;
    top: 50%;
    right: 18px;
    transform: translateY(-50%);
    width: 46px;
    height: 46px;
    border: 1px solid rgba(255, 255, 255, .34);
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: rgba(15, 23, 42, .34);
    box-shadow: 0 18px 48px rgba(15, 23, 42, .24), 0 0 0 1px rgba(139, 92, 246, .16) inset;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    cursor: pointer;
    transition: transform .16s ease, background .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.listings-map-fullscreen-toggle:hover {
    transform: translateY(-50%) scale(1.04);
    background: rgba(79, 70, 229, .46);
    border-color: rgba(255, 255, 255, .52);
    box-shadow: 0 20px 54px rgba(79, 70, 229, .32), 0 0 0 1px rgba(255, 255, 255, .18) inset;
}

.listings-map-fullscreen-toggle:active {
    transform: translateY(-50%) scale(.98);
}

.listings-map-fullscreen-toggle svg {
    width: 19px;
    height: 19px;
    flex: 0 0 auto;
}

.listings-map-fullscreen-toggle span {
    position: absolute;
    right: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    max-width: 210px;
    padding: 8px 10px;
    border-radius: 999px;
    color: #fff;
    background: rgba(15, 23, 42, .72);
    box-shadow: 0 14px 34px rgba(15, 23, 42, .24);
    font-size: .78rem;
    font-weight: 900;
    line-height: 1;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity .14s ease, transform .14s ease;
}

.listings-map-fullscreen-toggle:hover span,
.listings-map-fullscreen-toggle:focus-visible span {
    opacity: 1;
    transform: translateY(-50%) translateX(-2px);
}

body.theme-light .listings-map-fullscreen-toggle {
    color: var(--text-primary);
    background: rgba(255, 255, 255, .52);
    border-color: rgba(139, 92, 246, .24);
}

body.theme-light .listings-map-fullscreen-toggle span {
    color: var(--text-primary);
    background: rgba(255, 255, 255, .86);
}

.listings-map-view.is-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 8600;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    padding: 14px;
    background: rgba(2, 6, 23, .72);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

body.theme-light .listings-map-view.is-fullscreen {
    background: rgba(248, 250, 252, .74);
}

.listings-map-view.is-fullscreen .listings-map-list {
    display: none;
}

.listings-map-view.is-fullscreen .listings-map-panel {
    min-height: 0;
    height: calc(100dvh - 28px);
    padding: 10px;
    border-radius: 26px;
}

.listings-map-view.is-fullscreen .listings-leaflet-panel {
    display: grid;
    grid-template-rows: minmax(0, 1fr);
}

.listings-map-view.is-fullscreen .listings-leaflet-map,
.listings-map-view.is-fullscreen .listings-map-bg {
    min-height: 0;
    height: 100%;
    border-radius: 22px;
}

.listings-map-view.is-fullscreen .listings-map-fullscreen-toggle {
    right: 24px;
}

@media (max-width: 720px) {
    .listings-map-fullscreen-toggle {
        right: 12px;
        width: 42px;
        height: 42px;
        border-radius: 16px;
    }

    .listings-map-fullscreen-toggle span {
        display: none;
    }

    .listings-map-view.is-fullscreen {
        padding: 8px;
    }

    .listings-map-view.is-fullscreen .listings-map-panel {
        height: calc(100dvh - 16px);
        padding: 7px;
        border-radius: 20px;
    }

    .listings-map-view.is-fullscreen .listings-leaflet-map,
    .listings-map-view.is-fullscreen .listings-map-bg {
        border-radius: 16px;
    }

    .listings-map-view.is-fullscreen .listings-map-topbar {
        top: 14px;
        left: 14px;
        right: 62px;
    }

    .listings-map-view.is-fullscreen .listings-map-hint {
        left: 14px;
        right: 14px;
        bottom: 14px;
    }
}

/* === HOTFIX Stage 130B: listings quick filter chips layout ===
   UI-only. Makes quick chips centered/bigger on desktop and wrapped on mobile.
   Does not touch listing filters logic, API, deals, wallet, chats or calls. */
.listings-page .listings-quick-filters {
    justify-content: center;
    flex-wrap: wrap;
    overflow-x: visible;
    gap: 10px;
    padding: 12px 14px;
}

.listings-page .listings-quick-chip {
    min-height: 40px;
    padding: 9px 15px;
    font-size: .94rem;
    line-height: 1.15;
}

.listings-page .listings-quick-icon {
    width: 24px;
    height: 24px;
}

@media (min-width: 1024px) {
    .listings-page .listings-quick-filters {
        gap: 12px;
        padding-inline: 18px;
    }

    .listings-page .listings-quick-chip {
        min-width: 112px;
    }
}

@media (max-width: 720px) {
    .listings-page .listings-quick-filters {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        padding: 10px;
        overflow: visible;
        margin-inline: 0;
    }

    .listings-page .listings-quick-chip {
        width: 100%;
        min-width: 0;
        min-height: 40px;
        padding: 8px 10px;
        font-size: .86rem;
    }
}

@media (max-width: 380px) {
    .listings-page .listings-quick-chip {
        gap: 6px;
        padding-inline: 8px;
        font-size: .82rem;
    }

    .listings-page .listings-quick-icon {
        width: 22px;
        height: 22px;
    }
}

/* === HOTFIX Stage 130D: desktop quick filters fill their row ===
   Desktop-only UI change. Mobile layout from Stage 130B remains untouched. */
@media (min-width: 921px) {
    .listings-page .listings-quick-filters {
        justify-content: stretch;
        align-items: stretch;
        gap: 12px;
        padding: 12px 14px;
    }

    .listings-page .listings-quick-chip {
        flex: 1 1 0;
        min-width: 0;
        min-height: 46px;
        padding: 11px 16px;
        font-size: 1rem;
    }
}

/* === Stage 130: listings reset button visibility hotfix === */
.listings-head-actions #listings-reset-filters {
    min-height: 42px;
    padding: 10px 18px;
    border: 1px solid rgba(124, 58, 237, 0.26);
    border-radius: 999px;
    background: rgba(124, 58, 237, 0.10);
    color: var(--primary);
    font-weight: 900 !important;
    box-shadow: 0 10px 24px rgba(124, 58, 237, 0.10);
}

.listings-head-actions #listings-reset-filters:hover:not(:disabled),
.listings-head-actions #listings-reset-filters:focus-visible {
    background: var(--primary-grad);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 12px 28px rgba(124, 58, 237, 0.22);
    transform: translateY(-1px);
}

body.theme-light .listings-head-actions #listings-reset-filters,
html[data-theme="light"] body .listings-head-actions #listings-reset-filters,
[data-theme="light"] .listings-head-actions #listings-reset-filters {
    background: rgba(124, 58, 237, 0.08);
    color: #5b21b6;
    border-color: rgba(124, 58, 237, 0.24);
}

/* === Stage 130: my listings status active chip visibility on light theme ===
   UI-only. Fixes active status tab contrast in "Мои объявления" on light theme.
   Does not touch filters logic, listings API, chats, calls, wallet, deals or admin. */
body.theme-light .listings-mine-tab.active,
html[data-theme="light"] body .listings-mine-tab.active,
[data-theme="light"] .listings-mine-tab.active {
    background: linear-gradient(135deg, #6d28d9 0%, #7c3aed 52%, #4f46e5 100%) !important;
    color: #fff !important;
    border-color: rgba(124, 58, 237, 0.72) !important;
    box-shadow: 0 14px 30px rgba(124, 58, 237, 0.24) !important;
}

body.theme-light .listings-mine-tab.active span,
html[data-theme="light"] body .listings-mine-tab.active span,
[data-theme="light"] .listings-mine-tab.active span {
    color: #fff !important;
}

body.theme-light .listings-mine-tab.active b,
html[data-theme="light"] body .listings-mine-tab.active b,
[data-theme="light"] .listings-mine-tab.active b {
    background: rgba(255, 255, 255, 0.92) !important;
    color: #5b21b6 !important;
}

/* === HOTFIX Stage 131B: profile avatar/photo viewer close icon thin ===
   UI-only. The profile avatar/photo viewer close button used a visible text ×,
   inherited large font-size, and looked too thick. Keep the same button/click
   logic, hide only the glyph, and draw a thin close icon with CSS lines. */
html body .profile-photo-viewer .profile-photo-viewer-top .profile-photo-close,
body .profile-photo-viewer .profile-photo-viewer-top .profile-photo-close,
.profile-photo-viewer .profile-photo-viewer-top .profile-photo-close {
    position: relative !important;
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    min-height: 42px !important;
    padding: 0 !important;
    font-size: 0 !important;
    line-height: 0 !important;
    color: transparent !important;
    text-indent: -9999px !important;
    overflow: hidden !important;
}

html body .profile-photo-viewer .profile-photo-viewer-top .profile-photo-close::before,
html body .profile-photo-viewer .profile-photo-viewer-top .profile-photo-close::after,
body .profile-photo-viewer .profile-photo-viewer-top .profile-photo-close::before,
body .profile-photo-viewer .profile-photo-viewer-top .profile-photo-close::after,
.profile-photo-viewer .profile-photo-viewer-top .profile-photo-close::before,
.profile-photo-viewer .profile-photo-viewer-top .profile-photo-close::after {
    content: '' !important;
    position: absolute !important;
    left: 50% !important;
    top: 50% !important;
    width: 18px !important;
    height: 2px !important;
    border-radius: 999px !important;
    background: rgba(255, 255, 255, 0.96) !important;
    transform-origin: center !important;
    pointer-events: none !important;
    text-indent: 0 !important;
}

html body .profile-photo-viewer .profile-photo-viewer-top .profile-photo-close::before,
body .profile-photo-viewer .profile-photo-viewer-top .profile-photo-close::before,
.profile-photo-viewer .profile-photo-viewer-top .profile-photo-close::before {
    transform: translate(-50%, -50%) rotate(45deg) !important;
}

html body .profile-photo-viewer .profile-photo-viewer-top .profile-photo-close::after,
body .profile-photo-viewer .profile-photo-viewer-top .profile-photo-close::after,
.profile-photo-viewer .profile-photo-viewer-top .profile-photo-close::after {
    transform: translate(-50%, -50%) rotate(-45deg) !important;
}

html body .profile-photo-viewer .profile-photo-viewer-top .profile-photo-close:hover::before,
html body .profile-photo-viewer .profile-photo-viewer-top .profile-photo-close:hover::after,
body .profile-photo-viewer .profile-photo-viewer-top .profile-photo-close:hover::before,
body .profile-photo-viewer .profile-photo-viewer-top .profile-photo-close:hover::after,
.profile-photo-viewer .profile-photo-viewer-top .profile-photo-close:hover::before,
.profile-photo-viewer .profile-photo-viewer-top .profile-photo-close:hover::after {
    background: #fff !important;
}

/* === HOTFIX Stage 131C: profile avatar fullscreen close icon thin ===
   UI-only. This is the fullscreen avatar viewer opened from the profile avatar:
   .fullscreen-image-overlay / .fullscreen-image-close.
   Keep the earlier .profile-photo-viewer .profile-photo-close fix for wall photos
   and albums; this block only hides the fat text × in the avatar viewer and draws
   a thin CSS close icon. No JS/API/profile upload logic changes. */
html body .fullscreen-image-overlay .fullscreen-image-close,
body .fullscreen-image-overlay .fullscreen-image-close,
.fullscreen-image-overlay .fullscreen-image-close {
    position: absolute !important;
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    min-height: 42px !important;
    padding: 0 !important;
    font-size: 0 !important;
    line-height: 0 !important;
    color: transparent !important;
    text-indent: -9999px !important;
    overflow: hidden !important;
    display: grid !important;
    place-items: center !important;
}

html body .fullscreen-image-overlay .fullscreen-image-close::before,
html body .fullscreen-image-overlay .fullscreen-image-close::after,
body .fullscreen-image-overlay .fullscreen-image-close::before,
body .fullscreen-image-overlay .fullscreen-image-close::after,
.fullscreen-image-overlay .fullscreen-image-close::before,
.fullscreen-image-overlay .fullscreen-image-close::after {
    content: '' !important;
    position: absolute !important;
    left: 50% !important;
    top: 50% !important;
    width: 18px !important;
    height: 2px !important;
    border-radius: 999px !important;
    background: rgba(255, 255, 255, 0.96) !important;
    transform-origin: center !important;
    pointer-events: none !important;
    text-indent: 0 !important;
}

html body .fullscreen-image-overlay .fullscreen-image-close::before,
body .fullscreen-image-overlay .fullscreen-image-close::before,
.fullscreen-image-overlay .fullscreen-image-close::before {
    transform: translate(-50%, -50%) rotate(45deg) !important;
}

html body .fullscreen-image-overlay .fullscreen-image-close::after,
body .fullscreen-image-overlay .fullscreen-image-close::after,
.fullscreen-image-overlay .fullscreen-image-close::after {
    transform: translate(-50%, -50%) rotate(-45deg) !important;
}

html body .fullscreen-image-overlay .fullscreen-image-close:hover::before,
html body .fullscreen-image-overlay .fullscreen-image-close:hover::after,
body .fullscreen-image-overlay .fullscreen-image-close:hover::before,
body .fullscreen-image-overlay .fullscreen-image-close:hover::after,
.fullscreen-image-overlay .fullscreen-image-close:hover::before,
.fullscreen-image-overlay .fullscreen-image-close:hover::after {
    background: #fff !important;
}

@media (max-width: 768px) {
    html body .fullscreen-image-overlay .fullscreen-image-close,
    body .fullscreen-image-overlay .fullscreen-image-close,
    .fullscreen-image-overlay .fullscreen-image-close {
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
        min-height: 40px !important;
    }

    html body .fullscreen-image-overlay .fullscreen-image-close::before,
    html body .fullscreen-image-overlay .fullscreen-image-close::after,
    body .fullscreen-image-overlay .fullscreen-image-close::before,
    body .fullscreen-image-overlay .fullscreen-image-close::after,
    .fullscreen-image-overlay .fullscreen-image-close::before,
    .fullscreen-image-overlay .fullscreen-image-close::after {
        width: 17px !important;
        height: 2px !important;
    }
}

/* DEALIX 131 hotfix: readable idle re-auth card on light theme only. */
body.theme-light .reauth-lock-overlay {
  background:
    radial-gradient(circle at 50% 50%, rgba(99, 102, 241, .08), transparent 42%),
    rgba(248, 250, 252, .84);
}

body.theme-light .reauth-lock-card {
  background: rgba(255, 255, 255, .98);
  color: var(--text);
  border-color: rgba(148, 163, 184, .18);
  box-shadow: 0 28px 90px rgba(15, 23, 42, .18);
}

body.theme-light .reauth-lock-card h2 {
  color: var(--text) !important;
}

body.theme-light .reauth-lock-card p,
body.theme-light .reauth-lock-card .form-label {
  color: var(--text-secondary) !important;
}

body.theme-light .reauth-lock-card .input {
  background: rgba(255, 255, 255, .96);
  color: var(--text);
  border-color: rgba(148, 163, 184, .32);
}

body.theme-light .reauth-lock-card .input::placeholder {
  color: rgba(100, 116, 139, .72);
}

body.theme-light .reauth-lock-card .btn.ghost {
  color: var(--text-secondary);
}

body.theme-light .reauth-lock-card .btn.ghost:hover {
  color: var(--text);
  background: rgba(79, 70, 229, .08);
}

/* ===== Stage 132B: compact header as overlay, never reflow pages ===== */
/* The auto-hide header must slide over the current page instead of changing
   grid row height. This prevents chats/composer and other pages from jumping. */
.app.header-compact-mode,
.app.header-compact-mode.header-collapsed,
.app.header-compact-mode.header-revealed {
    grid-template-rows: 0 var(--app-menu-bar-h, 0px) minmax(0, 1fr) !important;
}

.app.header-compact-mode .header {
    position: fixed !important;
    top: var(--app-menu-bar-h, 0px) !important;
    left: 0 !important;
    right: 0 !important;
    width: auto !important;
    max-width: 100vw !important;
    z-index: 1200 !important;
    will-change: transform, opacity !important;
}

.app.header-compact-mode.header-revealed .header {
    transform: translate3d(0, 0, 0) !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    overflow: visible !important;
}

.app.header-compact-mode.header-collapsed .header {
    transform: translate3d(0, -115%, 0) !important;
    opacity: 0 !important;
    pointer-events: none !important;
    visibility: hidden;
    overflow: hidden !important;
}

/* ===== Stage 132C: chats viewport must ignore compact-header reveal/collapse =====
   Root cause: older chat viewport rules set .main-content to calc(100dvh - headerH)
   while newer compact header is only a sliding overlay. When header-revealed was set,
   chat height changed by one header height, so the composer moved and a blank browser
   area appeared under it. Keep the full chat viewport stable for both states. */
body[data-page="chats"] .app[data-page="chats"].header-compact-mode,
body[data-page="chats"] .app[data-page="chats"].header-compact-mode.header-revealed,
body[data-page="chats"] .app[data-page="chats"].header-compact-mode.header-collapsed {
    grid-template-rows: 0 var(--app-menu-bar-h, 0px) minmax(0, 1fr) !important;
    height: 100dvh !important;
    min-height: 100dvh !important;
    max-height: 100dvh !important;
    overflow: hidden !important;
}

body[data-page="chats"] .app[data-page="chats"].header-compact-mode .main-content,
body[data-page="chats"] .app[data-page="chats"].header-compact-mode.header-revealed .main-content,
body[data-page="chats"] .app[data-page="chats"].header-compact-mode.header-collapsed .main-content {
    height: calc(100dvh - var(--app-menu-bar-h, 0px)) !important;
    min-height: 0 !important;
    max-height: calc(100dvh - var(--app-menu-bar-h, 0px)) !important;
    overflow: hidden !important;
}

body[data-page="chats"] .app[data-page="chats"].header-compact-mode .page-content,
body[data-page="chats"] .app[data-page="chats"].header-compact-mode .chats-page,
body[data-page="chats"] .app[data-page="chats"].header-compact-mode .chats-container,
body[data-page="chats"] .app[data-page="chats"].header-compact-mode .chat-main,
body[data-page="chats"] .app[data-page="chats"].header-compact-mode .chat-active {
    height: 100% !important;
    min-height: 0 !important;
    max-height: 100% !important;
    overflow: hidden !important;
}


/* ===== Stage 133: mobile app-like root overscroll guard =====
   Keep native scrolling inside real scroll containers, but stop the root page
   rubber-band pull at the top/bottom on mobile. JS guard in app.js handles iOS;
   these CSS rules cover Chromium/Android and reduce scroll chaining.
   The document (html) is the page scroller on most routes. body, .app,
   .main-content and .page-content are overflow:auto boxes without a range there,
   so a vertical "none"/"contain" on them stopped every swipe and wheel before it
   reached html (OBS-DASHBOARD-SCROLL-CHAIN). Only html blocks the vertical
   pull; the wrappers keep their horizontal guards from the rules above.
   .listings-page is such a wrapper too (overflow-x:hidden at <=720px makes it
   an overflow box with no height limit), so it is not contained either. */
@media (max-width: 1024px) {
    html {
        overscroll-behavior: none;
    }

    body {
        overscroll-behavior-x: none;
    }

    .sidebar,
.modal,
.modal-body,
.chats-page,
.chat-messages,
.deals-list,
.deal-details {
        overscroll-behavior: contain;
    }
}

/* Stage 136A — On-ramp placeholder: UI only, no payment gateway/provider calls. */
.wallet-onramp-status,
.onramp-hero-badge,
.onramp-network-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border-radius: 999px;
    border: 1px solid rgba(139, 92, 246, 0.28);
    background: rgba(139, 92, 246, 0.12);
    color: var(--primary, #8b5cf6);
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
    padding: 5px 8px;
    white-space: nowrap;
}

.sidebar .onramp-soon-badge {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 20px;
    padding: 0 8px;
    border-radius: 999px;
    border: 1px solid var(--border, rgba(255,255,255,0.10));
    background: var(--bg-tertiary, rgba(255,255,255,0.06));
    color: var(--text-muted, #94a3b8);
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: .01em;
    white-space: nowrap;
}

/* Keep the unfinished provider integration out of public navigation while its
   deep-link page remains available as a truthful P2P/wallet fallback. */
.sidebar .sidebar-item[data-release-gated="onramp"][hidden],
.wallet-onramp-card[data-release-gated="onramp"][hidden] {
    display: none !important;
}

.sidebar-item-onramp.active .onramp-soon-badge {
    border-color: rgba(38, 161, 123, 0.32);
    background: rgba(38, 161, 123, 0.11);
    color: #26a17b;
}

.onramp-page {
    display: grid;
    gap: 18px;
}

.onramp-hero,
.onramp-disclaimer-card,
.onramp-actions-card,
.onramp-network-card,
.wallet-onramp-card {
    border: 1px solid var(--line, rgba(255,255,255,0.12));
    background: var(--card-bg, var(--bg-card));
    border-radius: 22px;
    box-shadow: var(--shadow-sm, 0 12px 30px rgba(0,0,0,0.16));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.onramp-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 22px;
}

.onramp-hero-main,
.wallet-onramp-header {
    display: flex;
    align-items: center;
    gap: 14px;
}

.onramp-hero-main {
    min-width: 0;
}

.onramp-hero-icon {
    width: 54px;
    height: 54px;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(38, 161, 123, 0.24), rgba(38, 161, 123, 0.10));
    color: #26a17b;
    border: 1px solid rgba(38, 161, 123, 0.36);
}

.onramp-hero-icon svg {
    width: 28px;
    height: 28px;
}

.onramp-usdt-mark {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #26a17b;
    color: #fff;
    font-size: 20px;
    font-weight: 950;
    line-height: 1;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.24);
}

.onramp-eyebrow,
.wallet-onramp-eyebrow {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted, #94a3b8);
    margin-bottom: 5px;
}

.onramp-hero h1 {
    margin: 0 0 6px;
    font-size: clamp(26px, 4vw, 42px);
    line-height: 1.06;
}

.onramp-hero p,
.onramp-disclaimer-card p,
.onramp-actions-card p,
.wallet-onramp-note {
    margin: 0;
    color: var(--muted, #94a3b8);
    line-height: 1.55;
}

.onramp-disclaimer-card,
.onramp-actions-card {
    padding: 18px;
}

.onramp-disclaimer-card h3,
.onramp-actions-card h3 {
    margin: 0 0 8px;
}

.onramp-disclaimer-card p + p {
    margin-top: 10px;
}

.onramp-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.onramp-network-card {
    padding: 16px;
    display: grid;
    gap: 14px;
}

.onramp-network-top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}

.onramp-network-name {
    font-size: 17px;
    font-weight: 900;
}

.onramp-network-token {
    margin-top: 3px;
    color: var(--muted, #94a3b8);
    font-size: 13px;
}

.onramp-network-wallet,
.onramp-gas-hint {
    border-radius: 16px;
    background: rgba(148, 163, 184, 0.10);
    padding: 12px;
}

.onramp-network-wallet span,
.onramp-gas-hint {
    display: block;
    color: var(--muted, #94a3b8);
    font-size: 12px;
}

.onramp-network-wallet code {
    display: block;
    margin-top: 4px;
    color: var(--text, #e5e7eb);
    font-size: 14px;
    word-break: break-all;
}

.onramp-network-card.is-linked .onramp-network-wallet {
    background: rgba(34, 197, 94, 0.11);
}

.onramp-network-link {
    justify-self: flex-start;
}

.onramp-actions-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.onramp-actions-row,
.wallet-onramp-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.wallet-onramp-header {
    justify-content: space-between;
    align-items: flex-start;
}

.wallet-onramp-body {
    display: grid;
    gap: 14px;
}

.wallet-onramp-networks {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.wallet-onramp-networks span {
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.10);
    color: var(--text, #e5e7eb);
    font-size: 12px;
    font-weight: 800;
    padding: 8px 10px;
}

.wallet-onramp-actions .btn,
.onramp-actions-row .btn,
.onramp-network-link {
    min-height: 42px;
    border-radius: 14px;
    box-shadow: none;
    text-decoration: none !important;
}

.wallet-onramp-actions .btn.primary,
.onramp-actions-row .btn.primary {
    color: #fff !important;
    border: 1px solid rgba(139, 92, 246, 0.42);
    background: linear-gradient(135deg, var(--primary, #6366f1), var(--primary-dark, #4f46e5));
}

.wallet-onramp-actions .btn.secondary,
.onramp-actions-row .btn.secondary,
.onramp-network-link {
    color: var(--text, #e5e7eb) !important;
    border: 1px solid var(--border, rgba(255,255,255,0.10));
    background: rgba(148, 163, 184, 0.12);
}

.wallet-onramp-actions .btn.secondary:hover,
.onramp-actions-row .btn.secondary:hover,
.onramp-network-link:hover {
    background: rgba(148, 163, 184, 0.18);
}

body.theme-light .wallet-onramp-actions .btn.secondary,
body.theme-light .onramp-actions-row .btn.secondary,
body.theme-light .onramp-network-link {
    color: #0f172a !important;
    border-color: rgba(15, 23, 42, 0.14);
    background: rgba(15, 23, 42, 0.05);
}

body.theme-light .wallet-onramp-actions .btn.secondary:hover,
body.theme-light .onramp-actions-row .btn.secondary:hover,
body.theme-light .onramp-network-link:hover {
    background: rgba(15, 23, 42, 0.08);
}

@media (max-width: 768px) {
    .onramp-page {
        gap: 14px;
    }

    .onramp-hero,
    .onramp-actions-card,
    .wallet-onramp-header {
        flex-direction: column;
        align-items: stretch;
    }

    .onramp-grid {
        grid-template-columns: 1fr;
    }

    .onramp-actions-row .btn,
    .wallet-onramp-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .onramp-hero-badge {
        align-self: flex-start;
    }

    .onramp-hero-icon {
        width: 48px;
        height: 48px;
        border-radius: 16px;
    }

    .onramp-usdt-mark {
        width: 28px;
        height: 28px;
        font-size: 18px;
    }

    .sidebar .onramp-soon-badge {
        font-size: 9px;
        padding: 4px 6px;
    }
}

/* Stage 139: confirmation-code controls for high-risk security actions */
.security-code-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.security-code-actions .btn {
    min-width: 148px;
    text-decoration: none !important;
}

.security-code-actions small {
    color: var(--text-secondary);
    font-size: .78rem;
    line-height: 1.35;
    flex: 1 1 220px;
}

body.theme-light .security-code-actions small {
    color: #64748b;
}

@media (max-width: 520px) {
    .security-code-actions {
        align-items: stretch;
    }
    .security-code-actions .btn {
        width: 100%;
    }
    .security-code-actions small {
        flex-basis: 100%;
    }
}


/* === DEALIX security access panel merge — UI-only, sessions + login history ===
   Keeps existing API/security logic intact. Active sessions stay compact; login
   history remains the only expandable archive. */
.security-panel-access {
    grid-column: span 1;
    display: grid;
    gap: 16px;
}

.security-panel-access .security-panel-head {
    margin-bottom: 0;
}

.security-access-section {
    display: grid;
    gap: 12px;
    min-width: 0;
}

.security-access-divider {
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(148,163,184,.20), transparent);
}

body.theme-light .security-access-divider,
body.light-theme .security-access-divider,
[data-theme="light"] .security-access-divider {
    background: linear-gradient(90deg, transparent, rgba(15,23,42,.10), transparent);
}

@media (max-width: 760px) {
    .security-panel-access {
        gap: 14px;
    }

    .security-access-section {
        gap: 10px;
    }
}

/* Stage 140A — Help Center / Safety Center */
.help-center-page {
  display: grid;
  gap: 16px;
  padding-bottom: 32px;
}
.help-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px;
  border-radius: 24px;
}
.help-hero-main {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}
.help-hero-icon,
.help-section-icon,
.help-quick-card span,
.help-news-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(124,58,237,.18), rgba(16,185,129,.12));
  color: var(--primary);
}
.help-hero-icon svg,
.help-section-icon svg,
.help-quick-card svg,
.help-news-dot svg { width: 25px; height: 25px; }
.help-eyebrow {
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 4px;
}
.help-hero h1,
.help-section-head h2,
.help-danger-card h2,
.help-block-title h2 { margin: 0; }
.help-hero p,
.help-section-head p,
.help-danger-card p,
.help-block-title p { margin: 6px 0 0; color: var(--text-muted); }
.help-support-link { white-space: nowrap; text-decoration: none !important; }
.help-danger-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-radius: 22px;
  border: 1px solid rgba(239,68,68,.30);
  background: radial-gradient(circle at top left, rgba(239,68,68,.16), transparent 34%), linear-gradient(135deg, rgba(239,68,68,.12), rgba(245,158,11,.08)), var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.help-danger-copy { min-width: 0; }
.help-danger-support {
  flex: 0 0 auto;
  text-decoration: none !important;
  white-space: nowrap;
  box-shadow: 0 14px 30px rgba(239,68,68,.14);
}
.help-danger-support span,
.help-danger-support svg {
  width: 18px;
  height: 18px;
}
.help-updates-feed {
  display: grid;
  gap: 12px;
  padding: 18px;
  border-radius: 24px;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  scroll-margin-top: 86px;
}
.help-block-title {
  display: flex;
  align-items: center;
  gap: 14px;
}
.help-news-list {
  display: grid;
  gap: 10px;
  position: relative;
}
.help-news-card {
  border: 1px solid var(--border-color);
  border-radius: 18px;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(124,58,237,.08), rgba(16,185,129,.04)), var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.help-news-card.is-critical { border-color: rgba(239,68,68,.28); background: linear-gradient(135deg, rgba(239,68,68,.10), rgba(245,158,11,.07)), var(--bg-card); }
.help-news-card summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  cursor: pointer;
  list-style: none;
}
.help-news-card summary::-webkit-details-marker { display: none; }
.help-news-main { display: grid; gap: 4px; min-width: 0; }
.help-news-main b { color: var(--text-primary); }
.help-news-main small { color: var(--text-muted); }
.help-news-meta { display: flex; align-items: center; gap: 8px; min-height: 18px; }
.help-news-meta i,
.help-news-meta em {
  font-style: normal;
  font-size: .72rem;
  font-weight: 800;
  border-radius: 999px;
  padding: 3px 8px;
}
.help-news-meta i { color: var(--text-muted); background: rgba(148,163,184,.10); }
.help-news-meta em { color: #ef4444; background: rgba(239,68,68,.12); }
.help-news-dot { width: 38px; height: 38px; border-radius: 14px; }
.help-news-dot svg { width: 20px; height: 20px; }
.help-news-body {
  padding: 0 14px 14px 64px;
  color: var(--text-secondary);
  line-height: 1.55;
}
.help-news-body p { margin: 10px 0 0; }
.help-news-body ul { margin: 10px 0 0; padding-left: 20px; }
.help-quick-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.help-quick-card {
  display: grid;
  gap: 8px;
  padding: 16px;
  border-radius: 20px;
  color: var(--text-primary);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  text-decoration: none !important;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.help-quick-card:hover { transform: translateY(-1px); border-color: rgba(124,58,237,.35); }
.help-quick-card span { width: 38px; height: 38px; border-radius: 14px; }
.help-quick-card.is-updates span { background: linear-gradient(135deg, rgba(16,185,129,.18), rgba(124,58,237,.12)); }
.help-quick-card svg { width: 21px; height: 21px; }
.help-quick-card b { font-size: .95rem; }
.help-quick-card small { color: var(--text-muted); }
.help-critical-strip {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 20px;
  background: rgba(245,158,11,.08);
  border: 1px solid rgba(245,158,11,.22);
}
.help-critical-strip h3 { margin: 0; }
.help-critical-strip div { display: flex; flex-wrap: wrap; gap: 8px; }
.help-critical-strip span {
  display: inline-flex;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(245,158,11,.12);
  color: var(--text-primary);
  font-size: .85rem;
  font-weight: 700;
}
.help-sections-stack { display: grid; gap: 14px; }
.help-section-card {
  padding: 18px;
  border-radius: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  scroll-margin-top: 86px;
}
.help-section-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}
.help-section-icon.tone-warning {
  background: linear-gradient(135deg, rgba(239,68,68,.14), rgba(245,158,11,.12));
  color: #ef4444;
}
.help-article-list { display: grid; gap: 10px; }
.help-article {
  border: 1px solid var(--border-color);
  border-radius: 18px;
  overflow: hidden;
  background: var(--bg-secondary);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.help-article.is-critical { border-color: rgba(239,68,68,.25); }
.help-article summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
}
.help-article summary::-webkit-details-marker { display: none; }
.help-article summary span { display: grid; gap: 4px; min-width: 0; }
.help-article summary b { color: var(--text-primary); }
.help-article summary small { color: var(--text-muted); }
.help-article summary em {
  font-style: normal;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(239,68,68,.12);
  color: #ef4444;
  font-size: .72rem;
  font-weight: 800;
}
.help-article-body {
  padding: 0 16px 16px;
  color: var(--text-secondary);
  line-height: 1.55;
}
.help-article-body p { margin: 10px 0 0; }
.help-article-body ul { margin: 10px 0 0; padding-left: 20px; }
.help-empty { color: var(--text-muted); padding: 14px; }

@media (max-width: 900px) {
  .help-hero { align-items: flex-start; flex-direction: column; }
  .help-support-link { width: 100%; justify-content: center; }
  .help-danger-card { align-items: flex-start; flex-direction: column; }
  .help-danger-support { width: 100%; justify-content: center; }
  .help-quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .help-center-page { gap: 10px; padding-bottom: 20px; }
  .help-hero,
  .help-danger-card,
  .help-updates-feed,
  .help-section-card { border-radius: 18px; padding: 13px; }
  .help-hero-main,
  .help-section-head,
  .help-block-title { align-items: flex-start; gap: 10px; }
  .help-hero-icon,
  .help-section-icon { width: 38px; height: 38px; border-radius: 14px; }
  .help-hero-icon svg,
  .help-section-icon svg { width: 21px; height: 21px; }
  .help-eyebrow { font-size: .68rem; margin-bottom: 2px; }
  .help-hero h1 { font-size: 1.45rem; line-height: 1.05; }
  .help-hero p,
  .help-danger-card p,
  .help-section-head p,
  .help-block-title p { font-size: .88rem; line-height: 1.35; }
  .help-danger-card h2,
  .help-block-title h2,
  .help-section-head h2 { font-size: 1.06rem; }
  .help-support-link,
  .help-danger-support { min-height: 40px; }
  .help-news-card summary { padding: 11px; gap: 9px; }
  .help-news-dot { width: 34px; height: 34px; border-radius: 12px; }
  .help-news-dot svg { width: 18px; height: 18px; }
  .help-news-main b { font-size: .94rem; }
  .help-news-main small { font-size: .82rem; }
  .help-news-body { padding: 0 11px 12px 54px; font-size: .9rem; }
  .help-quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .help-quick-card { padding: 11px; border-radius: 16px; gap: 6px; }
  .help-quick-card span { width: 32px; height: 32px; border-radius: 12px; }
  .help-quick-card svg { width: 18px; height: 18px; }
  .help-quick-card b { font-size: .86rem; line-height: 1.15; }
  .help-quick-card small { font-size: .74rem; }
  .help-critical-strip { padding: 12px; border-radius: 16px; }
  .help-critical-strip span { font-size: .78rem; padding: 7px 9px; }
  .help-section-head { margin-bottom: 10px; }
  .help-article-list { gap: 8px; }
  .help-article { border-radius: 15px; }
  .help-article summary { align-items: flex-start; padding: 11px 12px; gap: 8px; }
  .help-article summary b { font-size: .92rem; }
  .help-article summary small { font-size: .8rem; }
  .help-article summary em { padding: 4px 7px; font-size: .68rem; }
  .help-article-body { padding: 0 12px 12px; font-size: .9rem; line-height: 1.45; }
}
@media (max-width: 380px) {
  .help-quick-grid { grid-template-columns: 1fr; }
}

/* Stage 140A — Admin Help Center */
.admin-help-panel { display: grid; gap: 18px; }
.admin-help-grid {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) minmax(150px, .8fr) minmax(120px, .55fr) minmax(190px, .9fr);
  gap: 12px;
  align-items: end;
}
.admin-help-critical-row {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  margin-bottom: 0;
}
.admin-help-critical-row input { width: 18px; height: 18px; }
.admin-help-textarea { min-height: 180px; resize: vertical; }
.admin-help-actions,
.admin-help-row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.admin-help-table td { vertical-align: top; }

@media (max-width: 900px) {
  .help-hero { align-items: flex-start; flex-direction: column; }
  .help-support-link { width: 100%; justify-content: center; }
  .help-quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-help-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .help-center-page { gap: 14px; }
  .help-hero,
  .help-section-card { border-radius: 20px; padding: 16px; }
  .help-hero-main,
  .help-section-head { align-items: flex-start; }
  .help-hero-icon,
  .help-section-icon { width: 42px; height: 42px; border-radius: 16px; }
  .help-quick-grid { grid-template-columns: 1fr; }
  .help-article summary { align-items: flex-start; }
  .admin-help-grid { grid-template-columns: 1fr; }
  .admin-help-actions .btn,
  .admin-help-row-actions .btn { width: 100%; justify-content: center; }
}


/* Stage 140C — Help Center section pages + news feed below categories */
.help-section-page {
  gap: 14px;
}
.help-section-top {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 24px;
}
.help-back-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: max-content;
  max-width: 100%;
  padding: 8px 11px;
  border-radius: 999px;
  color: var(--text-primary);
  background: rgba(148,163,184,.10);
  border: 1px solid var(--border-color);
  text-decoration: none !important;
  font-weight: 800;
  font-size: .9rem;
}
.help-back-link:hover {
  border-color: rgba(124,58,237,.34);
  background: rgba(124,58,237,.10);
}
.help-section-top-main {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.help-section-top-main h1 {
  margin: 0;
  font-size: clamp(1.45rem, 2.5vw, 2.1rem);
  line-height: 1.06;
}
.help-section-top-main p {
  margin: 6px 0 0;
  color: var(--text-muted);
}
.help-section-top-main small {
  display: inline-flex;
  margin-top: 8px;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(124,58,237,.10);
  color: var(--primary);
  font-weight: 800;
}
.help-section-warning {
  margin: 0;
}
.help-section-page .help-section-card {
  scroll-margin-top: 12px;
}
.help-updates-page {
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}
.help-updates-page .help-news-list {
  gap: 12px;
}
.help-quick-card {
  position: relative;
  overflow: hidden;
}
.help-quick-card::after {
  content: "›";
  position: absolute;
  right: 14px;
  top: 14px;
  opacity: .45;
  font-size: 1.45rem;
  line-height: 1;
}
.help-updates-feed {
  order: 5;
}
.help-updates-feed .help-block-title h2::after {
  content: "";
  display: block;
  width: 42px;
  height: 3px;
  border-radius: 999px;
  margin-top: 8px;
  background: linear-gradient(90deg, var(--primary), rgba(16,185,129,.85));
}

@media (max-width: 900px) {
  .help-section-top {
    border-radius: 20px;
  }
  .help-section-top-main {
    align-items: flex-start;
  }
}

@media (max-width: 640px) {
  .help-center-page {
    gap: 10px !important;
    padding-bottom: 18px;
  }
  .help-hero,
  .help-danger-card,
  .help-updates-feed,
  .help-section-card,
  .help-section-top {
    border-radius: 17px !important;
    padding: 12px !important;
  }
  .help-hero {
    gap: 10px;
  }
  .help-hero-main,
  .help-section-top-main,
  .help-section-head,
  .help-block-title {
    gap: 9px !important;
  }
  .help-section-top-main {
    align-items: flex-start;
  }
  .help-section-top-main h1 {
    font-size: 1.32rem;
  }
  .help-section-top-main p {
    font-size: .86rem;
    line-height: 1.34;
  }
  .help-back-link {
    padding: 7px 10px;
    font-size: .84rem;
  }
  .help-danger-card {
    gap: 10px;
  }
  .help-danger-card h2 {
    font-size: 1rem !important;
  }
  .help-danger-card p {
    font-size: .84rem !important;
    line-height: 1.34 !important;
  }
  .help-danger-support,
  .help-support-link {
    min-height: 38px !important;
    font-size: .88rem;
  }
  .help-quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }
  .help-quick-card {
    min-height: 112px;
    padding: 10px !important;
    border-radius: 15px !important;
    gap: 6px !important;
  }
  .help-quick-card::after {
    right: 10px;
    top: 8px;
    font-size: 1.2rem;
  }
  .help-quick-card span {
    width: 31px !important;
    height: 31px !important;
    border-radius: 11px !important;
  }
  .help-quick-card svg {
    width: 17px !important;
    height: 17px !important;
  }
  .help-quick-card b {
    max-width: calc(100% - 10px);
    font-size: .84rem !important;
    line-height: 1.12 !important;
  }
  .help-quick-card small {
    font-size: .72rem !important;
  }
  .help-news-card {
    border-radius: 15px;
  }
  .help-news-card summary {
    padding: 10px !important;
    gap: 8px !important;
  }
  .help-news-dot {
    width: 31px !important;
    height: 31px !important;
    border-radius: 11px !important;
  }
  .help-news-dot svg {
    width: 17px !important;
    height: 17px !important;
  }
  .help-news-main b {
    font-size: .9rem !important;
    line-height: 1.18;
  }
  .help-news-main small {
    font-size: .78rem !important;
    line-height: 1.28;
  }
  .help-news-body {
    padding: 0 10px 11px 49px !important;
    font-size: .86rem !important;
    line-height: 1.42 !important;
  }
  .help-article {
    border-radius: 14px !important;
  }
  .help-article summary {
    padding: 10px 11px !important;
  }
  .help-article summary b {
    font-size: .9rem !important;
  }
  .help-article summary small {
    font-size: .78rem !important;
    line-height: 1.25;
  }
  .help-article-body {
    padding: 0 11px 11px !important;
    font-size: .86rem !important;
    line-height: 1.42 !important;
  }
  .help-article-body ul,
  .help-news-body ul {
    padding-left: 18px;
  }
}

@media (max-width: 360px) {
  .help-quick-grid {
    grid-template-columns: 1fr !important;
  }
  .help-quick-card {
    min-height: auto;
  }
}


/* === Stage 148: chat-info media/voice safe playback layout ===
   Info tabs must not reuse full chat bubble sizing for video circles. The normal
   chat bubble remains untouched under #chat-messages; this only scopes the media
   grid inside the avatar/group info panel. */
.chat-info-media-grid .video-circle-message.chat-info-circle-card,
.chat-info-collection-body .video-circle-message.chat-info-circle-card {
    display: block !important;
    position: relative !important;
    width: 100% !important;
    height: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: 100% !important;
    max-height: none !important;
    aspect-ratio: 1 / 1 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 999px !important;
    overflow: hidden !important;
    background: #020617 !important;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.08) !important;
    touch-action: manipulation !important;
}
.chat-info-media-grid .video-circle-message.chat-info-circle-card video,
.chat-info-collection-body .video-circle-message.chat-info-circle-card video {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 999px !important;
    background: #020617 !important;
    pointer-events: none !important;
}
.chat-info-media-grid .video-circle-message.chat-info-circle-card .video-circle-play,
.chat-info-collection-body .video-circle-message.chat-info-circle-card .video-circle-play,
.chat-info-media-grid .video-circle-message.chat-info-circle-card .video-circle-duration,
.chat-info-collection-body .video-circle-message.chat-info-circle-card .video-circle-duration {
    pointer-events: none !important;
}
.chat-info-media-grid .video-circle-message.chat-info-circle-card.expanded,
.chat-info-collection-body .video-circle-message.chat-info-circle-card.expanded {
    position: fixed !important;
    left: 50% !important;
    top: 50% !important;
    width: min(78vmin, 420px) !important;
    height: min(78vmin, 420px) !important;
    min-width: min(78vmin, 420px) !important;
    min-height: min(78vmin, 420px) !important;
    max-width: calc(100vw - 34px) !important;
    max-height: calc(100dvh - 120px) !important;
    transform: translate(-50%, -50%) translateZ(0) !important;
    z-index: 10040 !important;
    box-shadow: 0 32px 90px rgba(0,0,0,.48) !important;
}
.chat-info-media-grid .video-circle-message.chat-info-circle-card.playing .video-circle-play,
.chat-info-collection-body .video-circle-message.chat-info-circle-card.playing .video-circle-play {
    opacity: 0 !important;
}
.chat-info-voice-row .voice-message audio {
    width: 0 !important;
    height: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* === Stage 148.2: normal chat text bubbles use premium Dealix style ===
   Root cause: Saved Notes had its own Stage 18F bubble skin, while regular chats kept older base bubble colors.
   CSS-only. Does not touch media thumbnails, video circles, voice messages, files, calls, JS or APIs. */
#chat-dialog-preview-body .message.sent:not(:has(.chat-media-thumb)):not(:has(.chat-media-album)):not(:has(.video-circle-message)):not(:has(.voice-message)):not(:has(.chat-file-card)):not(.group-post-message):not(:has(.story-share-card[data-story-kind="share"])):not(.single-emoji-message),
#chat-active:not([data-chat-type="saved"]):not(.saved-notes-chat-active):not([data-chat-type="support"]) #chat-messages .message.sent:not(:has(.chat-media-thumb)):not(:has(.chat-media-album)):not(:has(.video-circle-message)):not(:has(.voice-message)):not(:has(.chat-file-card)):not(.group-post-message):not(:has(.story-share-card[data-story-kind="share"])):not(.single-emoji-message),
#chat-dialog-preview-body .message.received:not(:has(.chat-media-thumb)):not(:has(.chat-media-album)):not(:has(.video-circle-message)):not(:has(.voice-message)):not(:has(.chat-file-card)):not(.group-post-message):not(:has(.story-share-card[data-story-kind="share"])):not(.single-emoji-message),
#chat-active:not([data-chat-type="saved"]):not(.saved-notes-chat-active):not([data-chat-type="support"]) #chat-messages .message.received:not(:has(.chat-media-thumb)):not(:has(.chat-media-album)):not(:has(.video-circle-message)):not(:has(.voice-message)):not(:has(.chat-file-card)):not(.group-post-message):not(:has(.story-share-card[data-story-kind="share"])):not(.single-emoji-message) {
    padding: 10px 13px !important;
    border-radius: 21px !important;
    overflow: visible !important;
    border: 1px solid rgba(255, 255, 255, .11) !important;
    backdrop-filter: var(--chat-message-surface-filter, blur(14px) saturate(1.12)) !important;
    -webkit-backdrop-filter: var(--chat-message-surface-filter, blur(14px) saturate(1.12)) !important;
}

#chat-dialog-preview-body .message.sent:not(:has(.chat-media-thumb)):not(:has(.chat-media-album)):not(:has(.video-circle-message)):not(:has(.voice-message)):not(:has(.chat-file-card)):not(.group-post-message):not(:has(.story-share-card[data-story-kind="share"])):not(.single-emoji-message),
#chat-active:not([data-chat-type="saved"]):not(.saved-notes-chat-active):not([data-chat-type="support"]) #chat-messages .message.sent:not(:has(.chat-media-thumb)):not(:has(.chat-media-album)):not(:has(.video-circle-message)):not(:has(.voice-message)):not(:has(.chat-file-card)):not(.group-post-message):not(:has(.story-share-card[data-story-kind="share"])):not(.single-emoji-message) {
    background: linear-gradient(135deg, #8b5cf6 0%, #6d5dfc 58%, #a879ff 100%) !important;
    color: #fff !important;
    border-color: rgba(255, 255, 255, .16) !important;
    box-shadow: 0 12px 28px rgba(109, 93, 252, .22), inset 0 1px 0 rgba(255,255,255,.12) !important;
    border-bottom-right-radius: 8px !important;
}

#chat-dialog-preview-body .message.received:not(:has(.chat-media-thumb)):not(:has(.chat-media-album)):not(:has(.video-circle-message)):not(:has(.voice-message)):not(:has(.chat-file-card)):not(.group-post-message):not(:has(.story-share-card[data-story-kind="share"])):not(.single-emoji-message),
#chat-active:not([data-chat-type="saved"]):not(.saved-notes-chat-active):not([data-chat-type="support"]) #chat-messages .message.received:not(:has(.chat-media-thumb)):not(:has(.chat-media-album)):not(:has(.video-circle-message)):not(:has(.voice-message)):not(:has(.chat-file-card)):not(.group-post-message):not(:has(.story-share-card[data-story-kind="share"])):not(.single-emoji-message) {
    background:
        radial-gradient(circle at 14% 0%, rgba(139, 92, 246, .13), transparent 46%),
        linear-gradient(135deg, rgba(30, 41, 59, .78), rgba(15, 23, 42, .70)) !important;
    color: rgba(241, 245, 249, .96) !important;
    border-color: rgba(255, 255, 255, .075) !important;
    box-shadow: 0 12px 28px rgba(0, 0, 0, .16), inset 0 1px 0 rgba(255,255,255,.05) !important;
    border-bottom-left-radius: 8px !important;
}

#chat-dialog-preview-body .message:not(:has(.chat-media-thumb)):not(:has(.chat-media-album)):not(:has(.video-circle-message)):not(:has(.voice-message)):not(:has(.chat-file-card)):not(.group-post-message):not(:has(.story-share-card[data-story-kind="share"])):not(.single-emoji-message) .message-content,
#chat-active:not([data-chat-type="saved"]):not(.saved-notes-chat-active):not([data-chat-type="support"]) #chat-messages .message:not(:has(.chat-media-thumb)):not(:has(.chat-media-album)):not(:has(.video-circle-message)):not(:has(.voice-message)):not(:has(.chat-file-card)):not(.group-post-message):not(:has(.story-share-card[data-story-kind="share"])):not(.single-emoji-message) .message-content {
    color: inherit !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
}

#chat-dialog-preview-body .message.sent:not(:has(.chat-media-thumb)):not(:has(.chat-media-album)):not(:has(.video-circle-message)):not(:has(.voice-message)):not(:has(.chat-file-card)):not(.group-post-message):not(:has(.story-share-card[data-story-kind="share"])):not(.single-emoji-message) .message-time,
#chat-active:not([data-chat-type="saved"]):not(.saved-notes-chat-active):not([data-chat-type="support"]) #chat-messages .message.sent:not(:has(.chat-media-thumb)):not(:has(.chat-media-album)):not(:has(.video-circle-message)):not(:has(.voice-message)):not(:has(.chat-file-card)):not(.group-post-message):not(:has(.story-share-card[data-story-kind="share"])):not(.single-emoji-message) .message-time {
    color: rgba(255,255,255,.78) !important;
    opacity: 1 !important;
}

#chat-dialog-preview-body .message.received:not(:has(.chat-media-thumb)):not(:has(.chat-media-album)):not(:has(.video-circle-message)):not(:has(.voice-message)):not(:has(.chat-file-card)):not(.group-post-message):not(:has(.story-share-card[data-story-kind="share"])):not(.single-emoji-message) .message-time,
#chat-active:not([data-chat-type="saved"]):not(.saved-notes-chat-active):not([data-chat-type="support"]) #chat-messages .message.received:not(:has(.chat-media-thumb)):not(:has(.chat-media-album)):not(:has(.video-circle-message)):not(:has(.voice-message)):not(:has(.chat-file-card)):not(.group-post-message):not(:has(.story-share-card[data-story-kind="share"])):not(.single-emoji-message) .message-time {
    color: rgba(203, 213, 225, .76) !important;
    opacity: 1 !important;
}

body.theme-light #chat-dialog-preview-body .message.received:not(:has(.chat-media-thumb)):not(:has(.chat-media-album)):not(:has(.video-circle-message)):not(:has(.voice-message)):not(:has(.chat-file-card)):not(.group-post-message):not(:has(.story-share-card[data-story-kind="share"])):not(.single-emoji-message),
body.theme-light #chat-active:not([data-chat-type="saved"]):not(.saved-notes-chat-active):not([data-chat-type="support"]) #chat-messages .message.received:not(:has(.chat-media-thumb)):not(:has(.chat-media-album)):not(:has(.video-circle-message)):not(:has(.voice-message)):not(:has(.chat-file-card)):not(.group-post-message):not(:has(.story-share-card[data-story-kind="share"])):not(.single-emoji-message) {
    background:
        radial-gradient(circle at 14% 0%, rgba(139, 92, 246, .09), transparent 46%),
        linear-gradient(135deg, rgba(255,255,255,.94), rgba(248,250,252,.88)) !important;
    color: rgba(15, 23, 42, .92) !important;
    border-color: rgba(15, 23, 42, .07) !important;
    box-shadow: 0 12px 28px rgba(15, 23, 42, .08), inset 0 1px 0 rgba(255,255,255,.72) !important;
}

body.theme-light #chat-dialog-preview-body .message.received:not(:has(.chat-media-thumb)):not(:has(.chat-media-album)):not(:has(.video-circle-message)):not(:has(.voice-message)):not(:has(.chat-file-card)):not(.group-post-message):not(:has(.story-share-card[data-story-kind="share"])):not(.single-emoji-message) .message-time,
body.theme-light #chat-active:not([data-chat-type="saved"]):not(.saved-notes-chat-active):not([data-chat-type="support"]) #chat-messages .message.received:not(:has(.chat-media-thumb)):not(:has(.chat-media-album)):not(:has(.video-circle-message)):not(:has(.voice-message)):not(:has(.chat-file-card)):not(.group-post-message):not(:has(.story-share-card[data-story-kind="share"])):not(.single-emoji-message) .message-time {
    color: rgba(71, 85, 105, .76) !important;
}


/* === Stage 149: premium chat wallpaper background ===
   CSS/assets-only. The wallpaper lives on the NON-SCROLLING .chat-main column,
   not on the scrollable #chat-messages: iOS Safari paints
   background-attachment:local only up to the content height, which left a
   black band under short (fresh group) chats until enough messages arrived.
   .chat-main spans the full chat viewport, so the pattern always covers it;
   header/composer draw their own backgrounds on top, the scroller stays
   transparent, and nothing scrolls or flickers with the content.
   An opened forum topic is a chat under the topic: same wallpaper per theme. */
.chats-page .chat-main,
.forum-community-page[data-forum-topic-view="true"] .forum-discussion-card {
    background-color: #0b1020 !important;
    background-image:
        linear-gradient(180deg, rgba(7, 10, 22, .10), rgba(7, 10, 22, .18)),
        url('./assets/chat-pattern-premium.webp') !important;
    background-repeat: repeat !important;
    background-size: 920px 920px !important;
    background-position: center top !important;
}

.chats-page .chat-main #chat-messages,
.chats-page .chat-main #chat-placeholder {
    background: transparent !important;
}

body.theme-light .chats-page .chat-main,
html[data-theme="light"] body .chats-page .chat-main,
[data-theme="light"] .chats-page .chat-main,
body.theme-light .forum-community-page[data-forum-topic-view="true"] .forum-discussion-card,
html[data-theme="light"] body .forum-community-page[data-forum-topic-view="true"] .forum-discussion-card,
[data-theme="light"] .forum-community-page[data-forum-topic-view="true"] .forum-discussion-card {
    background-color: #dfe7fb !important;
    background-image:
        linear-gradient(180deg, rgba(255, 255, 255, .22), rgba(255, 255, 255, .12)),
        url('./assets/chat-pattern-premium.webp') !important;
}

/* Keep the empty “select dialog / start chat” card readable on desktop,
   while the wallpaper stays behind it. */
.chats-page .chat-main #chat-placeholder .placeholder-content {
    position: relative !important;
    z-index: 1 !important;
    padding: 28px 24px !important;
    border-radius: 28px !important;
    border: 1px solid rgba(255, 255, 255, .10) !important;
    background: rgba(10, 15, 30, .58) !important;
    box-shadow: 0 22px 62px rgba(0, 0, 0, .24) !important;
    backdrop-filter: blur(18px) saturate(1.12) !important;
    -webkit-backdrop-filter: blur(18px) saturate(1.12) !important;
}

body.theme-light .chats-page .chat-main #chat-placeholder .placeholder-content,
html[data-theme="light"] body .chats-page .chat-main #chat-placeholder .placeholder-content,
[data-theme="light"] .chats-page .chat-main #chat-placeholder .placeholder-content {
    background: rgba(255, 255, 255, .68) !important;
    border-color: rgba(99, 102, 241, .14) !important;
    box-shadow: 0 22px 56px rgba(99, 102, 241, .14) !important;
}

@media (max-width: 1024px) {
    .chats-page .chat-main,
    .forum-community-page[data-forum-topic-view="true"] .forum-discussion-card {
        background-image:
            linear-gradient(180deg, rgba(7, 10, 22, .08), rgba(7, 10, 22, .16)),
            url('./assets/chat-pattern-premium-mobile.webp') !important;
        background-size: min(720px, 118vw) min(720px, 118vw) !important;
        background-position: center top !important;
        background-repeat: repeat !important;
    }

    body.theme-light .chats-page .chat-main,
    html[data-theme="light"] body .chats-page .chat-main,
    [data-theme="light"] .chats-page .chat-main,
    body.theme-light .forum-community-page[data-forum-topic-view="true"] .forum-discussion-card,
    html[data-theme="light"] body .forum-community-page[data-forum-topic-view="true"] .forum-discussion-card,
    [data-theme="light"] .forum-community-page[data-forum-topic-view="true"] .forum-discussion-card {
        background-image:
            linear-gradient(180deg, rgba(255, 255, 255, .18), rgba(255, 255, 255, .10)),
            url('./assets/chat-pattern-premium-mobile.webp') !important;
    }
}

/* === Stage 150: premium deals page wallpaper background ===
   CSS/assets-only. Uses the same premium pattern as chat, but only as a passive
   background on the deals screen surfaces. No JS, no overlays, no pointer layer,
   no modal/button/action changes. */
.page-content:has(.deals-page) {
    background-color: #0b1020 !important;
    background-image:
        linear-gradient(180deg, rgba(7, 10, 22, .18), rgba(7, 10, 22, .24)),
        url('./assets/chat-pattern-premium.webp') !important;
    background-repeat: repeat !important;
    background-size: 980px 980px !important;
    background-position: center top !important;
    background-attachment: local !important;
}

/* Keep the wallpaper under the two real deals columns, without creating any overlay. */
.deals-page .deals-container,
.deals-page .deals-sidebar,
.deals-page .deal-details,
.deals-page .deal-placeholder {
    background-image:
        linear-gradient(180deg, rgba(11, 16, 32, .18), rgba(11, 16, 32, .22)),
        url('./assets/chat-pattern-premium.webp') !important;
    background-repeat: repeat !important;
    background-size: 980px 980px !important;
    background-position: center top !important;
    background-attachment: local !important;
}

.deals-page .deals-container {
    background-color: rgba(10, 15, 30, .38) !important;
    border-radius: var(--radius-lg, 18px);
}
.deals-page .deals-sidebar {
    background-color: rgba(10, 15, 30, .72) !important;
    backdrop-filter: blur(16px) saturate(1.08);
    -webkit-backdrop-filter: blur(16px) saturate(1.08);
}
.deals-page .deal-details {
    background-color: rgba(10, 15, 30, .32) !important;
}

/* Important: content cards/buttons stay above the background by normal document flow. */
.deals-page .deals-sidebar-header,
.deals-page .deals-newbar,
.deals-page .deals-list,
.deals-page .deal-details-card,
.deals-page #deal-details-content,
.deals-page .deal-placeholder .placeholder-content,
.deals-page .deal-list-item,
.deals-page .deal-actions,
.deals-page .deal-chat-link,
.deals-page .deal-info-section,
.deals-page .deal-events-section,
.deals-page .deal-history-section,
.deals-page .deals-filters {
    position: relative;
    z-index: 1;
}

/* Keep deal cards readable on top of the wallpaper. */
.deals-page .deal-list-item {
    background-clip: padding-box;
}
.deals-page .deal-list-item:not(.active):not(:hover) {
    background-color: rgba(15, 23, 42, .46);
    border-color: rgba(255, 255, 255, .055);
}
.deals-page .deal-details-card,
.deals-page .deal-info-section,
.deals-page .deal-events-section,
.deals-page .deal-history-section,
.deals-page .deal-chat-link,
.deals-page .deal-placeholder .placeholder-content {
    background-color: rgba(15, 23, 42, .74) !important;
    backdrop-filter: blur(18px) saturate(1.08);
    -webkit-backdrop-filter: blur(18px) saturate(1.08);
}

body.theme-light .page-content:has(.deals-page),
html[data-theme="light"] body .page-content:has(.deals-page),
[data-theme="light"] .page-content:has(.deals-page) {
    background-color: #dfe7fb !important;
    background-image:
        linear-gradient(180deg, rgba(255, 255, 255, .20), rgba(255, 255, 255, .13)),
        url('./assets/chat-pattern-premium.webp') !important;
}
body.theme-light .deals-page .deals-container,
body.theme-light .deals-page .deals-sidebar,
body.theme-light .deals-page .deal-details,
body.theme-light .deals-page .deal-placeholder,
html[data-theme="light"] body .deals-page .deals-container,
html[data-theme="light"] body .deals-page .deals-sidebar,
html[data-theme="light"] body .deals-page .deal-details,
html[data-theme="light"] body .deals-page .deal-placeholder,
[data-theme="light"] .deals-page .deals-container,
[data-theme="light"] .deals-page .deals-sidebar,
[data-theme="light"] .deals-page .deal-details,
[data-theme="light"] .deals-page .deal-placeholder {
    background-color: rgba(239, 244, 255, .48) !important;
    background-image:
        linear-gradient(180deg, rgba(255, 255, 255, .18), rgba(255, 255, 255, .10)),
        url('./assets/chat-pattern-premium.webp') !important;
}
body.theme-light .deals-page .deals-sidebar,
html[data-theme="light"] body .deals-page .deals-sidebar,
[data-theme="light"] .deals-page .deals-sidebar {
    background-color: rgba(255, 255, 255, .72) !important;
}
body.theme-light .deals-page .deal-list-item:not(.active):not(:hover),
html[data-theme="light"] body .deals-page .deal-list-item:not(.active):not(:hover),
[data-theme="light"] .deals-page .deal-list-item:not(.active):not(:hover) {
    background-color: rgba(255, 255, 255, .64);
    border-color: rgba(99, 102, 241, .09);
}
body.theme-light .deals-page .deal-details-card,
body.theme-light .deals-page .deal-info-section,
body.theme-light .deals-page .deal-events-section,
body.theme-light .deals-page .deal-history-section,
body.theme-light .deals-page .deal-chat-link,
body.theme-light .deals-page .deal-placeholder .placeholder-content,
html[data-theme="light"] body .deals-page .deal-details-card,
html[data-theme="light"] body .deals-page .deal-info-section,
html[data-theme="light"] body .deals-page .deal-events-section,
html[data-theme="light"] body .deals-page .deal-history-section,
html[data-theme="light"] body .deals-page .deal-chat-link,
html[data-theme="light"] body .deals-page .deal-placeholder .placeholder-content,
[data-theme="light"] .deals-page .deal-details-card,
[data-theme="light"] .deals-page .deal-info-section,
[data-theme="light"] .deals-page .deal-events-section,
[data-theme="light"] .deals-page .deal-history-section,
[data-theme="light"] .deals-page .deal-chat-link,
[data-theme="light"] .deals-page .deal-placeholder .placeholder-content {
    background-color: rgba(255, 255, 255, .76) !important;
}

@media (max-width: 1024px) {
    .page-content:has(.deals-page),
    .deals-page .deals-container,
    .deals-page .deals-sidebar,
    .deals-page .deal-details,
    .deals-page .deal-placeholder {
        background-image:
            linear-gradient(180deg, rgba(7, 10, 22, .08), rgba(7, 10, 22, .18)),
            url('./assets/chat-pattern-premium-mobile.webp') !important;
        background-size: min(720px, 118vw) min(720px, 118vw) !important;
        background-position: center top !important;
        background-repeat: repeat !important;
    }

    body.theme-light .page-content:has(.deals-page),
    body.theme-light .deals-page .deals-container,
    body.theme-light .deals-page .deals-sidebar,
    body.theme-light .deals-page .deal-details,
    body.theme-light .deals-page .deal-placeholder,
    html[data-theme="light"] body .page-content:has(.deals-page),
    html[data-theme="light"] body .deals-page .deals-container,
    html[data-theme="light"] body .deals-page .deals-sidebar,
    html[data-theme="light"] body .deals-page .deal-details,
    html[data-theme="light"] body .deals-page .deal-placeholder,
    [data-theme="light"] .page-content:has(.deals-page),
    [data-theme="light"] .deals-page .deals-container,
    [data-theme="light"] .deals-page .deals-sidebar,
    [data-theme="light"] .deals-page .deal-details,
    [data-theme="light"] .deals-page .deal-placeholder {
        background-image:
            linear-gradient(180deg, rgba(255, 255, 255, .18), rgba(255, 255, 255, .10)),
            url('./assets/chat-pattern-premium-mobile.webp') !important;
    }
}


/* === Stage 150.1: deals wallpaper de-dup / keep list panel clean ===
   Fix: wallpaper must exist once on the page background, not again inside the
   deals list/details panels. This prevents double pattern, keeps cards readable,
   and does not create overlays or touch buttons/modals/JS. */
.deals-page .deals-container,
.deals-page .deals-sidebar,
.deals-page .deal-details,
.deals-page .deal-placeholder {
    background-image: none !important;
    background-repeat: initial !important;
    background-size: auto !important;
    background-position: initial !important;
    background-attachment: initial !important;
}

.deals-page .deals-container,
.deals-page .deal-details,
.deals-page .deal-placeholder {
    background-color: transparent !important;
}

.deals-page .deals-sidebar {
    background-color: rgba(10, 15, 30, .92) !important;
    border-color: rgba(255, 255, 255, .08) !important;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .26) !important;
    backdrop-filter: blur(18px) saturate(1.10) !important;
    -webkit-backdrop-filter: blur(18px) saturate(1.10) !important;
}

body.theme-glass .deals-page .deals-sidebar,
html[data-theme="glass"] body .deals-page .deals-sidebar,
[data-theme="glass"] .deals-page .deals-sidebar {
    background-color: rgba(15, 23, 42, .70) !important;
    border-color: rgba(148, 163, 184, .16) !important;
    box-shadow: 0 24px 64px rgba(0, 0, 0, .22), inset 0 1px 0 rgba(255, 255, 255, .05) !important;
    backdrop-filter: blur(20px) saturate(1.12) !important;
    -webkit-backdrop-filter: blur(20px) saturate(1.12) !important;
}

.deals-page .deals-sidebar-header,
.deals-page .deals-list,
.deals-page .deals-filters,
.deals-page .deals-archive-block,
.deals-page .deals-archive-header {
    background-image: none !important;
}

body.theme-light .deals-page .deals-container,
body.theme-light .deals-page .deal-details,
body.theme-light .deals-page .deal-placeholder,
html[data-theme="light"] body .deals-page .deals-container,
html[data-theme="light"] body .deals-page .deal-details,
html[data-theme="light"] body .deals-page .deal-placeholder,
[data-theme="light"] .deals-page .deals-container,
[data-theme="light"] .deals-page .deal-details,
[data-theme="light"] .deals-page .deal-placeholder {
    background-color: transparent !important;
    background-image: none !important;
}

body.theme-light .deals-page .deals-sidebar,
html[data-theme="light"] body .deals-page .deals-sidebar,
[data-theme="light"] .deals-page .deals-sidebar {
    background-color: rgba(255, 255, 255, .88) !important;
    background-image: none !important;
    border-color: rgba(99, 102, 241, .12) !important;
    box-shadow: 0 24px 58px rgba(99, 102, 241, .13) !important;
}

@media (max-width: 1024px) {
    .deals-page .deals-container,
    .deals-page .deals-sidebar,
    .deals-page .deal-details,
    .deals-page .deal-placeholder,
    body.theme-light .deals-page .deals-container,
    body.theme-light .deals-page .deals-sidebar,
    body.theme-light .deals-page .deal-details,
    body.theme-light .deals-page .deal-placeholder,
    html[data-theme="light"] body .deals-page .deals-container,
    html[data-theme="light"] body .deals-page .deals-sidebar,
    html[data-theme="light"] body .deals-page .deal-details,
    html[data-theme="light"] body .deals-page .deal-placeholder,
    [data-theme="light"] .deals-page .deals-container,
    [data-theme="light"] .deals-page .deals-sidebar,
    [data-theme="light"] .deals-page .deal-details,
    [data-theme="light"] .deals-page .deal-placeholder {
        background-image: none !important;
    }
}

/* === Stage 151: premium feed wallpaper background ===
   CSS/assets-only. Wallpaper is applied only to the feed page background, not to
   feed cards, forum rows, composer, buttons, modals, or clickable controls. */
.page-content:has(.feed-page.vk-feed-page) {
    background-color: #0b1020 !important;
    background-image:
        linear-gradient(180deg, rgba(7, 10, 22, .16), rgba(7, 10, 22, .24)),
        url('./assets/chat-pattern-premium.webp') !important;
    background-repeat: repeat !important;
    background-size: 980px 980px !important;
    background-position: center top !important;
    background-attachment: local !important;
}

.feed-page.vk-feed-page {
    position: relative;
    background: transparent !important;
    background-image: none !important;
}

/* Keep the wallpaper passive and below existing feed surfaces. */
.feed-page .vk-forum-panel.compact,
.feed-page .vk-feed-header,
.feed-page .vk-feed-wrap,
.feed-page .feed-list-wrap,
.feed-page .feed-list,
.feed-page .vk-feed-card,
.feed-page .feed-empty,
.feed-page .feed-comment,
.feed-page .forum-topic-row,
.feed-page .feed-composer,
.feed-page .vk-feed-composer {
    position: relative;
    z-index: 1;
}

/* Do not duplicate the wallpaper inside cards/panels. */
.feed-page .vk-forum-panel.compact,
.feed-page .vk-feed-header,
.feed-page .vk-feed-card,
.feed-page .feed-empty,
.feed-page .feed-comment,
.feed-page .forum-topic-row,
.feed-page .feed-composer,
.feed-page .vk-feed-composer {
    background-image: none !important;
}

body.theme-light .page-content:has(.feed-page.vk-feed-page),
html[data-theme="light"] body .page-content:has(.feed-page.vk-feed-page),
[data-theme="light"] .page-content:has(.feed-page.vk-feed-page) {
    background-color: #dfe7fb !important;
    background-image:
        linear-gradient(180deg, rgba(255, 255, 255, .20), rgba(255, 255, 255, .13)),
        url('./assets/chat-pattern-premium.webp') !important;
}

@media (max-width: 1024px) {
    .page-content:has(.feed-page.vk-feed-page) {
        background-image:
            linear-gradient(180deg, rgba(7, 10, 22, .08), rgba(7, 10, 22, .18)),
            url('./assets/chat-pattern-premium-mobile.webp') !important;
        background-size: min(720px, 118vw) min(720px, 118vw) !important;
        background-position: center top !important;
        background-repeat: repeat !important;
    }

    body.theme-light .page-content:has(.feed-page.vk-feed-page),
    html[data-theme="light"] body .page-content:has(.feed-page.vk-feed-page),
    [data-theme="light"] .page-content:has(.feed-page.vk-feed-page) {
        background-image:
            linear-gradient(180deg, rgba(255, 255, 255, .18), rgba(255, 255, 255, .10)),
            url('./assets/chat-pattern-premium-mobile.webp') !important;
    }
}


/* === Stage 151.1: feed wallpaper coverage + forum topic page fix ===
   CSS-only corrective override. Keeps wallpaper behind feed/topic pages only,
   restores readable glass surfaces, and prevents the black empty area below short feeds. */
.page-content:has(.feed-page.vk-feed-page),
.page-content:has(.forum-topic-page.vk-feed-page) {
    min-height: 100dvh !important;
    background-color: #0b1020 !important;
    background-image:
        linear-gradient(180deg, rgba(7, 10, 22, .18), rgba(7, 10, 22, .28)),
        url('./assets/chat-pattern-premium.webp') !important;
    background-repeat: repeat !important;
    background-size: 980px 980px !important;
    background-position: center top !important;
    background-attachment: local !important;
}

.feed-page.vk-feed-page,
.forum-topic-page.vk-feed-page {
    min-height: calc(100dvh - 24px) !important;
    padding-bottom: max(96px, env(safe-area-inset-bottom)) !important;
    background: transparent !important;
    background-image: none !important;
}

/* Keep the topic detail page on the same premium wallpaper as the main feed. */
.forum-topic-page.vk-feed-page {
    position: relative;
    width: 100%;
    max-width: min(1180px, 100%);
    margin: 0 auto;
}

/* Restore solid/readable glass surfaces above the wallpaper. */
.feed-page .vk-forum-panel.compact,
.feed-page .forum-topic-row,
.forum-topic-page .forum-topic-card,
.forum-topic-page .forum-replies-card,
.forum-topic-page .vk-feed-card,
.forum-topic-page .forum-reply,
.forum-topic-page .forum-reply-form,
.forum-topic-page .error-state {
    background-image: none !important;
    background-color: rgba(15, 23, 42, .78) !important;
    border-color: rgba(148, 163, 184, .16) !important;
    box-shadow: 0 18px 48px rgba(2, 6, 23, .22) !important;
    backdrop-filter: blur(18px) saturate(135%);
    -webkit-backdrop-filter: blur(18px) saturate(135%);
}

.feed-page .vk-forum-panel.compact,
.forum-topic-page .forum-topic-card,
.forum-topic-page .forum-replies-card {
    background:
        radial-gradient(circle at 0% 0%, rgba(139,92,246,.11), transparent 38%),
        linear-gradient(180deg, rgba(22, 31, 53, .88), rgba(13, 19, 34, .78)) !important;
}

.feed-page .forum-topic-row,
.forum-topic-page .forum-reply {
    background-color: rgba(22, 31, 49, .78) !important;
}

body.theme-light .page-content:has(.feed-page.vk-feed-page),
html[data-theme="light"] body .page-content:has(.feed-page.vk-feed-page),
[data-theme="light"] .page-content:has(.feed-page.vk-feed-page),
body.theme-light .page-content:has(.forum-topic-page.vk-feed-page),
html[data-theme="light"] body .page-content:has(.forum-topic-page.vk-feed-page),
[data-theme="light"] .page-content:has(.forum-topic-page.vk-feed-page) {
    min-height: 100dvh !important;
    background-color: #dfe7fb !important;
    background-image:
        linear-gradient(180deg, rgba(255, 255, 255, .22), rgba(255, 255, 255, .12)),
        url('./assets/chat-pattern-premium.webp') !important;
    background-repeat: repeat !important;
    background-size: 980px 980px !important;
    background-position: center top !important;
}

body.theme-light .feed-page .vk-forum-panel.compact,
body.theme-light .feed-page .forum-topic-row,
body.theme-light .forum-topic-page .forum-topic-card,
body.theme-light .forum-topic-page .forum-replies-card,
body.theme-light .forum-topic-page .vk-feed-card,
body.theme-light .forum-topic-page .forum-reply,
html[data-theme="light"] body .feed-page .vk-forum-panel.compact,
html[data-theme="light"] body .feed-page .forum-topic-row,
html[data-theme="light"] body .forum-topic-page .forum-topic-card,
html[data-theme="light"] body .forum-topic-page .forum-replies-card,
html[data-theme="light"] body .forum-topic-page .vk-feed-card,
html[data-theme="light"] body .forum-topic-page .forum-reply,
[data-theme="light"] .feed-page .vk-forum-panel.compact,
[data-theme="light"] .feed-page .forum-topic-row,
[data-theme="light"] .forum-topic-page .forum-topic-card,
[data-theme="light"] .forum-topic-page .forum-replies-card,
[data-theme="light"] .forum-topic-page .vk-feed-card,
[data-theme="light"] .forum-topic-page .forum-reply {
    background-color: rgba(255, 255, 255, .78) !important;
    border-color: rgba(99, 102, 241, .14) !important;
    box-shadow: 0 18px 44px rgba(79, 70, 229, .10) !important;
}

@media (max-width: 1024px) {
    .page-content:has(.feed-page.vk-feed-page),
    .page-content:has(.forum-topic-page.vk-feed-page) {
        min-height: 100dvh !important;
        background-image:
            linear-gradient(180deg, rgba(7, 10, 22, .10), rgba(7, 10, 22, .20)),
            url('./assets/chat-pattern-premium-mobile.webp') !important;
        background-size: min(720px, 118vw) min(720px, 118vw) !important;
        background-position: center top !important;
        background-repeat: repeat !important;
    }

    .feed-page.vk-feed-page,
    .forum-topic-page.vk-feed-page {
        min-height: calc(100dvh - 12px) !important;
        padding-bottom: max(104px, calc(env(safe-area-inset-bottom) + 86px)) !important;
    }

    body.theme-light .page-content:has(.feed-page.vk-feed-page),
    html[data-theme="light"] body .page-content:has(.feed-page.vk-feed-page),
    [data-theme="light"] .page-content:has(.feed-page.vk-feed-page),
    body.theme-light .page-content:has(.forum-topic-page.vk-feed-page),
    html[data-theme="light"] body .page-content:has(.forum-topic-page.vk-feed-page),
    [data-theme="light"] .page-content:has(.forum-topic-page.vk-feed-page) {
        background-image:
            linear-gradient(180deg, rgba(255, 255, 255, .18), rgba(255, 255, 255, .10)),
            url('./assets/chat-pattern-premium-mobile.webp') !important;
    }
}

/* === Stage 152: dashboard premium wallpaper, CSS-only background layer ===
   Statistics retain their existing wallpaper. Account home uses plain themed
   surfaces; neither layout adds overlays or changes the page scroll owner. */
.page-content:has(.dashboard-home) {
    background: var(--bg);
}

.page-content:has(.dashboard-v2:not(.dashboard-home)) {
    min-height: 100dvh !important;
    background-color: #0b1020 !important;
    background-image:
        linear-gradient(180deg, rgba(7, 10, 22, .16), rgba(7, 10, 22, .26)),
        url('./assets/chat-pattern-premium.webp') !important;
    background-repeat: repeat !important;
    background-size: 980px 980px !important;
    background-position: center top !important;
    background-attachment: local !important;
}

.dashboard-v2 {
    position: relative;
    z-index: 0;
    min-height: calc(100dvh - 24px) !important;
    background: transparent !important;
    background-image: none !important;
}

/* Put existing dashboard surfaces above the passive wallpaper without adding any clickable overlay. */
.dashboard-v2 > *,
.dashboard-v2 .dashboard-hero,
.dashboard-v2 .dashboard-kpi-card,
.dashboard-v2 .dashboard-panel,
.dashboard-v2 .dashboard-action-card,
.dashboard-v2 .dashboard-deal-row,
.dashboard-v2 .dashboard-notification-row,
.dashboard-v2 .dashboard-activity-row,
.dashboard-v2 .dashboard-empty,
.dashboard-v2 .dashboard-empty-chart {
    position: relative;
    z-index: 1;
}

/* Do not duplicate the wallpaper inside dashboard cards/panels. */
.dashboard-v2 .dashboard-hero,
.dashboard-v2 .dashboard-kpi-card,
.dashboard-v2 .dashboard-panel,
.dashboard-v2 .dashboard-action-card,
.dashboard-v2 .dashboard-deal-row,
.dashboard-v2 .dashboard-notification-row,
.dashboard-v2 .dashboard-activity-row,
.dashboard-v2 .dashboard-empty,
.dashboard-v2 .dashboard-empty-chart {
    background-repeat: no-repeat;
}

body.theme-light .page-content:has(.dashboard-v2:not(.dashboard-home)),
html[data-theme="light"] body .page-content:has(.dashboard-v2:not(.dashboard-home)),
[data-theme="light"] .page-content:has(.dashboard-v2:not(.dashboard-home)) {
    background-color: #dfe7fb !important;
    background-image:
        linear-gradient(180deg, rgba(255, 255, 255, .22), rgba(255, 255, 255, .12)),
        url('./assets/chat-pattern-premium.webp') !important;
    background-repeat: repeat !important;
    background-size: 980px 980px !important;
    background-position: center top !important;
}

html[data-ui-theme="system"] body.theme-system .page-content:has(.dashboard-v2:not(.dashboard-home)) {
    background-color: var(--bg) !important;
    background-image: none !important;
}

@media (max-width: 1024px) {
    .page-content:has(.dashboard-v2:not(.dashboard-home)) {
        min-height: 100dvh !important;
        background-image:
            linear-gradient(180deg, rgba(7, 10, 22, .10), rgba(7, 10, 22, .20)),
            url('./assets/chat-pattern-premium-mobile.webp') !important;
        background-repeat: repeat !important;
        background-size: min(720px, 118vw) min(720px, 118vw) !important;
        background-position: center top !important;
    }

    .dashboard-v2 {
        min-height: calc(100dvh - 12px) !important;
    }

    /* Account home already receives the bottom navigation reserve from page-content. */
    .dashboard-home {
        padding-bottom: 0;
    }

    .dashboard-v2:not(.dashboard-home) {
        padding-bottom: max(104px, calc(env(safe-area-inset-bottom) + 86px)) !important;
    }

    body.theme-light .page-content:has(.dashboard-v2:not(.dashboard-home)),
    html[data-theme="light"] body .page-content:has(.dashboard-v2:not(.dashboard-home)),
    [data-theme="light"] .page-content:has(.dashboard-v2:not(.dashboard-home)) {
        background-image:
            linear-gradient(180deg, rgba(255, 255, 255, .18), rgba(255, 255, 255, .10)),
            url('./assets/chat-pattern-premium-mobile.webp') !important;
    }
}

/* === Stage 153: wallet premium wallpaper, CSS-only background layer ===
   Passive page background only. No overlays, no JS, no wallet button/modal interception. */
.page-content:has(.wallet-page-polished),
.page-content:has(.wallet-page) {
    min-height: 100dvh !important;
    background-color: #0b1020 !important;
    background-image:
        linear-gradient(180deg, rgba(7, 10, 22, .15), rgba(7, 10, 22, .25)),
        url('./assets/chat-pattern-premium.webp') !important;
    background-repeat: repeat !important;
    background-size: 980px 980px !important;
    background-position: center top !important;
    background-attachment: local !important;
}

.wallet-page-polished,
.wallet-page {
    position: relative;
    z-index: 0;
    min-height: calc(100dvh - 24px) !important;
    background: transparent !important;
    background-image: none !important;
}

/* Keep all existing wallet surfaces above the passive wallpaper. */
.wallet-page-polished > *,
.wallet-page-polished .wallet-hero,
.wallet-page-polished .wallet-kpi-card,
.wallet-page-polished .wallet-glass-panel,
.wallet-page-polished .wallet-connect-card,
.wallet-page-polished .wallet-linked-card,
.wallet-page-polished .wallet-faq-card,
.wallet-page-polished .card,
.wallet-page-polished button,
.wallet-page-polished a,
.wallet-page-polished input,
.wallet-page-polished select,
.wallet-page-polished textarea {
    position: relative;
    z-index: 1;
}

/* Do not duplicate the wallpaper inside wallet cards/panels; their own glass/gradient backgrounds stay unchanged. */
.wallet-page-polished .wallet-hero,
.wallet-page-polished .wallet-kpi-card,
.wallet-page-polished .wallet-glass-panel,
.wallet-page-polished .wallet-connect-card,
.wallet-page-polished .wallet-linked-card,
.wallet-page-polished .wallet-faq-card,
.wallet-page-polished .card {
    background-repeat: no-repeat;
}

body.theme-light .page-content:has(.wallet-page-polished),
html[data-theme="light"] body .page-content:has(.wallet-page-polished),
[data-theme="light"] .page-content:has(.wallet-page-polished),
body.theme-light .page-content:has(.wallet-page),
html[data-theme="light"] body .page-content:has(.wallet-page),
[data-theme="light"] .page-content:has(.wallet-page) {
    background-color: #dfe7fb !important;
    background-image:
        linear-gradient(180deg, rgba(255, 255, 255, .22), rgba(255, 255, 255, .12)),
        url('./assets/chat-pattern-premium.webp') !important;
    background-repeat: repeat !important;
    background-size: 980px 980px !important;
    background-position: center top !important;
}

@media (max-width: 1024px) {
    .page-content:has(.wallet-page-polished),
    .page-content:has(.wallet-page) {
        min-height: 100dvh !important;
        background-image:
            linear-gradient(180deg, rgba(7, 10, 22, .10), rgba(7, 10, 22, .20)),
            url('./assets/chat-pattern-premium-mobile.webp') !important;
        background-repeat: repeat !important;
        background-size: min(720px, 118vw) min(720px, 118vw) !important;
        background-position: center top !important;
    }

    .wallet-page-polished,
    .wallet-page {
        min-height: calc(100dvh - 12px) !important;
        padding-bottom: max(104px, calc(env(safe-area-inset-bottom) + 86px)) !important;
    }

    body.theme-light .page-content:has(.wallet-page-polished),
    html[data-theme="light"] body .page-content:has(.wallet-page-polished),
    [data-theme="light"] .page-content:has(.wallet-page-polished),
    body.theme-light .page-content:has(.wallet-page),
    html[data-theme="light"] body .page-content:has(.wallet-page),
    [data-theme="light"] .page-content:has(.wallet-page) {
        background-image:
            linear-gradient(180deg, rgba(255, 255, 255, .18), rgba(255, 255, 255, .10)),
            url('./assets/chat-pattern-premium-mobile.webp') !important;
    }
}

/* === Stage 154: P2P premium wallpaper, CSS-only background layer ===
   Passive page background only. No overlays, no JS, no P2P buttons/modals/Web3 interception. */
.page-content:has(.p2p-page) {
    min-height: 100dvh !important;
    background-color: #0b1020 !important;
    background-image:
        linear-gradient(180deg, rgba(7, 10, 22, .14), rgba(7, 10, 22, .24)),
        url('./assets/chat-pattern-premium.webp') !important;
    background-repeat: repeat !important;
    background-size: 980px 980px !important;
    background-position: center top !important;
    background-attachment: local !important;
}

.p2p-page {
    position: relative;
    z-index: 0;
    min-height: calc(100dvh - 24px) !important;
    background: transparent !important;
    background-image: none !important;
}

/* Keep all P2P surfaces and controls above the passive wallpaper. */
.p2p-page > *,
.p2p-page .p2p-hero,
.p2p-page .p2p-panel,
.p2p-page .p2p-offer-card,
.p2p-page .p2p-order-card,
.p2p-page .p2p-empty,
.p2p-page .p2p-flow-list div,
.p2p-page .p2p-offer-stats div,
.p2p-page .p2p-payment-box,
.p2p-page .p2p-receipts,
.p2p-page .p2p-order-chat,
.p2p-page button,
.p2p-page a,
.p2p-page input,
.p2p-page select,
.p2p-page textarea {
    position: relative;
    z-index: 1;
}

/* Do not duplicate the wallpaper inside P2P cards/panels. Their existing glass backgrounds stay unchanged. */
.p2p-page .p2p-hero,
.p2p-page .p2p-panel,
.p2p-page .p2p-offer-card,
.p2p-page .p2p-order-card,
.p2p-page .p2p-empty,
.p2p-page .p2p-payment-box,
.p2p-page .p2p-receipts,
.p2p-page .p2p-order-chat {
    background-repeat: no-repeat;
}

.p2p-modal-backdrop,
.p2p-modal-card {
    z-index: 1200;
}

body.theme-light .page-content:has(.p2p-page),
html[data-theme="light"] body .page-content:has(.p2p-page),
[data-theme="light"] .page-content:has(.p2p-page) {
    background-color: #dfe7fb !important;
    background-image:
        linear-gradient(180deg, rgba(255, 255, 255, .22), rgba(255, 255, 255, .12)),
        url('./assets/chat-pattern-premium.webp') !important;
    background-repeat: repeat !important;
    background-size: 980px 980px !important;
    background-position: center top !important;
}

@media (max-width: 1024px) {
    .page-content:has(.p2p-page) {
        min-height: 100dvh !important;
        background-image:
            linear-gradient(180deg, rgba(7, 10, 22, .10), rgba(7, 10, 22, .20)),
            url('./assets/chat-pattern-premium-mobile.webp') !important;
        background-repeat: repeat !important;
        background-size: min(720px, 118vw) min(720px, 118vw) !important;
        background-position: center top !important;
    }

    .p2p-page {
        min-height: calc(100dvh - 12px) !important;
        padding-bottom: max(104px, calc(env(safe-area-inset-bottom) + 86px)) !important;
    }

    body.theme-light .page-content:has(.p2p-page),
    html[data-theme="light"] body .page-content:has(.p2p-page),
    [data-theme="light"] .page-content:has(.p2p-page) {
        background-image:
            linear-gradient(180deg, rgba(255, 255, 255, .18), rgba(255, 255, 255, .10)),
            url('./assets/chat-pattern-premium-mobile.webp') !important;
    }
}


/* === Stage 154.1: P2P wallpaper full-scroll coverage fix ===
   Fixes the cropped P2P wallpaper by moving the passive background to the scroll container.
   CSS-only. No overlays, no JS, no P2P buttons/modals/API/Web3 changes. */
body:has(.p2p-page) .main-content,
.app:has(.p2p-page) .main-content,
#main-content:has(.p2p-page) {
    background-color: #0b1020 !important;
    background-image:
        linear-gradient(180deg, rgba(7, 10, 22, .14), rgba(7, 10, 22, .24)),
        url('./assets/chat-pattern-premium.webp') !important;
    background-repeat: repeat !important;
    background-size: 980px 980px !important;
    background-position: center top !important;
    background-attachment: local !important;
}

body:has(.p2p-page) .page-content,
.page-content:has(.p2p-page),
#page-content:has(.p2p-page) {
    min-height: 100dvh !important;
    background: transparent !important;
    background-image: none !important;
    background-color: transparent !important;
}

.p2p-page {
    min-height: 100dvh !important;
}

/* Keep P2P cards/panels as real surfaces above the passive page wallpaper. */
.p2p-page .p2p-hero,
.p2p-page .p2p-panel,
.p2p-page .p2p-offer-card,
.p2p-page .p2p-order-card,
.p2p-page .p2p-empty,
.p2p-page .p2p-payment-box,
.p2p-page .p2p-receipts,
.p2p-page .p2p-order-chat {
    background-image: var(--surface-gradient, none) !important;
    background-repeat: no-repeat !important;
}

body.theme-light:has(.p2p-page) .main-content,
html[data-theme="light"] body:has(.p2p-page) .main-content,
[data-theme="light"] body:has(.p2p-page) .main-content,
body.light-theme:has(.p2p-page) .main-content {
    background-color: #dfe7fb !important;
    background-image:
        linear-gradient(180deg, rgba(255, 255, 255, .22), rgba(255, 255, 255, .12)),
        url('./assets/chat-pattern-premium.webp') !important;
    background-repeat: repeat !important;
    background-size: 980px 980px !important;
    background-position: center top !important;
}

@media (max-width: 1024px) {
    body:has(.p2p-page) .main-content,
    .app:has(.p2p-page) .main-content,
    #main-content:has(.p2p-page) {
        background-image:
            linear-gradient(180deg, rgba(7, 10, 22, .10), rgba(7, 10, 22, .20)),
            url('./assets/chat-pattern-premium-mobile.webp') !important;
        background-repeat: repeat !important;
        background-size: min(720px, 118vw) min(720px, 118vw) !important;
        background-position: center top !important;
    }

    body.theme-light:has(.p2p-page) .main-content,
    html[data-theme="light"] body:has(.p2p-page) .main-content,
    [data-theme="light"] body:has(.p2p-page) .main-content,
    body.light-theme:has(.p2p-page) .main-content {
        background-image:
            linear-gradient(180deg, rgba(255, 255, 255, .18), rgba(255, 255, 255, .10)),
            url('./assets/chat-pattern-premium-mobile.webp') !important;
    }
}

/* === Stage 155: listings premium wallpaper, CSS-only background layer ===
   Passive page background for marketplace/listings only. No overlays, no JS,
   no filters/map/cards/modal/create-listing logic changes. */
body:has(.listings-page) .main-content,
.app:has(.listings-page) .main-content,
#main-content:has(.listings-page) {
    background-color: #0b1020 !important;
    background-image:
        linear-gradient(180deg, rgba(7, 10, 22, .14), rgba(7, 10, 22, .24)),
        url('./assets/chat-pattern-premium.webp') !important;
    background-repeat: repeat !important;
    background-size: 980px 980px !important;
    background-position: center top !important;
    background-attachment: local !important;
}

body:has(.listings-page) .page-content,
.page-content:has(.listings-page),
#page-content:has(.listings-page) {
    min-height: 100dvh !important;
    background: transparent !important;
    background-image: none !important;
    background-color: transparent !important;
}

.listings-page {
    min-height: 100dvh !important;
}

/* Keep listings UI as real glass/cards above the passive page wallpaper. */
.listings-page .glass,
.listings-page .listings-toolbar,
.listings-page .listings-advanced-filters,
.listings-page .listings-active-filters,
.listings-page .listings-section-head,
.listings-page .listings-mine-status-row,
.listings-page .listing-card,
.listings-page .listing-card-new,
.listings-page .listing-details-panel,
.listings-page .listing-detail,
.listings-page .listings-empty,
.listings-page .empty-state,
.listings-page .listings-pagination-host,
.listings-page .listings-map-panel,
.listings-page .listings-map-list,
.listings-page .listings-leaflet-panel {
    position: relative;
    z-index: 1;
}

/* Do not duplicate the wallpaper inside listings cards/panels; their existing glass backgrounds stay intact. */
.listings-page .glass,
.listings-page .listings-toolbar,
.listings-page .listings-advanced-filters,
.listings-page .listings-active-filters,
.listings-page .listings-section-head,
.listings-page .listings-mine-status-row,
.listings-page .listing-card,
.listings-page .listing-card-new,
.listings-page .listing-details-panel,
.listings-page .listing-detail,
.listings-page .listings-empty,
.listings-page .empty-state,
.listings-page .listings-pagination,
.listings-page .listings-map-panel,
.listings-page .listings-map-list,
.listings-page .listings-leaflet-panel {
    background-repeat: no-repeat !important;
}

body.theme-light:has(.listings-page) .main-content,
html[data-theme="light"] body:has(.listings-page) .main-content,
[data-theme="light"] body:has(.listings-page) .main-content,
body.light-theme:has(.listings-page) .main-content {
    background-color: #dfe7fb !important;
    background-image:
        linear-gradient(180deg, rgba(255, 255, 255, .22), rgba(255, 255, 255, .12)),
        url('./assets/chat-pattern-premium.webp') !important;
    background-repeat: repeat !important;
    background-size: 980px 980px !important;
    background-position: center top !important;
}

@media (max-width: 1024px) {
    body:has(.listings-page) .main-content,
    .app:has(.listings-page) .main-content,
    #main-content:has(.listings-page) {
        background-image:
            linear-gradient(180deg, rgba(7, 10, 22, .10), rgba(7, 10, 22, .20)),
            url('./assets/chat-pattern-premium-mobile.webp') !important;
        background-repeat: repeat !important;
        background-size: min(720px, 118vw) min(720px, 118vw) !important;
        background-position: center top !important;
    }

    body.theme-light:has(.listings-page) .main-content,
    html[data-theme="light"] body:has(.listings-page) .main-content,
    [data-theme="light"] body:has(.listings-page) .main-content,
    body.light-theme:has(.listings-page) .main-content {
        background-image:
            linear-gradient(180deg, rgba(255, 255, 255, .18), rgba(255, 255, 255, .10)),
            url('./assets/chat-pattern-premium-mobile.webp') !important;
    }
}

/* === Stage 155.1: listings active reset button contrast over wallpaper ===
   CSS-only. Keeps listings filters/actions logic untouched.
   Fixes "Сбросить всё" being too transparent on premium wallpaper. */
.listings-page .listings-active-filter-reset {
    background: linear-gradient(135deg, rgba(124, 58, 237, .92), rgba(37, 99, 235, .84)) !important;
    color: #ffffff !important;
    border-color: rgba(196, 181, 253, .44) !important;
    box-shadow: 0 12px 30px rgba(17, 24, 39, .28), 0 0 0 1px rgba(255, 255, 255, .08) inset !important;
    text-shadow: 0 1px 1px rgba(15, 23, 42, .28);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.listings-page .listings-active-filter-reset:hover,
.listings-page .listings-active-filter-reset:focus-visible {
    background: linear-gradient(135deg, rgba(139, 92, 246, 1), rgba(59, 130, 246, .96)) !important;
    color: #ffffff !important;
    border-color: rgba(221, 214, 254, .68) !important;
    box-shadow: 0 16px 34px rgba(79, 70, 229, .30), 0 0 0 1px rgba(255, 255, 255, .16) inset !important;
    transform: translateY(-1px);
}

body.theme-light .listings-page .listings-active-filter-reset,
html[data-theme="light"] body .listings-page .listings-active-filter-reset,
[data-theme="light"] .listings-page .listings-active-filter-reset,
body.light-theme .listings-page .listings-active-filter-reset {
    background: linear-gradient(135deg, #6d28d9 0%, #2563eb 100%) !important;
    color: #ffffff !important;
    border-color: rgba(124, 58, 237, .36) !important;
    box-shadow: 0 12px 28px rgba(79, 70, 229, .22), 0 0 0 1px rgba(255, 255, 255, .32) inset !important;
}

/* === Stage 156: disputes premium wallpaper, CSS-only background layer ===
   Passive background for the disputes page only. No overlays, no JS,
   no dispute cards/buttons/modals/API/arbitration logic changes. */
body:has(.disputes-v2) .main-content,
.app:has(.disputes-v2) .main-content,
#main-content:has(.disputes-v2),
body:has(.disputes-page) .main-content,
.app:has(.disputes-page) .main-content,
#main-content:has(.disputes-page) {
    background-color: #0b1020 !important;
    background-image:
        linear-gradient(180deg, rgba(7, 10, 22, .14), rgba(7, 10, 22, .24)),
        url('./assets/chat-pattern-premium.webp') !important;
    background-repeat: repeat !important;
    background-size: 980px 980px !important;
    background-position: center top !important;
    background-attachment: local !important;
}

body:has(.disputes-v2) .page-content,
.page-content:has(.disputes-v2),
#page-content:has(.disputes-v2),
body:has(.disputes-page) .page-content,
.page-content:has(.disputes-page),
#page-content:has(.disputes-page) {
    min-height: 100dvh !important;
    background: transparent !important;
    background-image: none !important;
    background-color: transparent !important;
}

.disputes-v2,
.disputes-page {
    min-height: 100dvh !important;
    position: relative;
    z-index: 0;
}

/* Keep dispute UI surfaces above the passive page wallpaper. */
.disputes-v2 .glass,
.disputes-v2 .disputes-hero,
.disputes-v2 .disputes-kpi-card,
.disputes-v2 .disputes-shell,
.disputes-v2 .dispute-card-v2,
.disputes-v2 .dispute-details-card,
.disputes-v2 .dispute-details-empty,
.disputes-v2 .disputes-empty-state,
.disputes-v2 .disputes-search,
.disputes-v2 .dispute-detail-grid div,
.disputes-v2 .dispute-detail-message,
.disputes-page .dispute-card {
    position: relative;
    z-index: 1;
}

/* Do not duplicate the wallpaper inside dispute cards/panels. */
.disputes-v2 .glass,
.disputes-v2 .disputes-hero,
.disputes-v2 .disputes-kpi-card,
.disputes-v2 .disputes-shell,
.disputes-v2 .dispute-card-v2,
.disputes-v2 .dispute-details-card,
.disputes-v2 .dispute-details-empty,
.disputes-v2 .disputes-empty-state,
.disputes-v2 .disputes-search,
.disputes-v2 .dispute-detail-grid div,
.disputes-v2 .dispute-detail-message,
.disputes-page .dispute-card {
    background-repeat: no-repeat !important;
}

body.theme-light:has(.disputes-v2) .main-content,
html[data-theme="light"] body:has(.disputes-v2) .main-content,
[data-theme="light"] body:has(.disputes-v2) .main-content,
body.light-theme:has(.disputes-v2) .main-content,
body.theme-light:has(.disputes-page) .main-content,
html[data-theme="light"] body:has(.disputes-page) .main-content,
[data-theme="light"] body:has(.disputes-page) .main-content,
body.light-theme:has(.disputes-page) .main-content {
    background-color: #dfe7fb !important;
    background-image:
        linear-gradient(180deg, rgba(255, 255, 255, .22), rgba(255, 255, 255, .12)),
        url('./assets/chat-pattern-premium.webp') !important;
    background-repeat: repeat !important;
    background-size: 980px 980px !important;
    background-position: center top !important;
}

@media (max-width: 1024px) {
    body:has(.disputes-v2) .main-content,
    .app:has(.disputes-v2) .main-content,
    #main-content:has(.disputes-v2),
    body:has(.disputes-page) .main-content,
    .app:has(.disputes-page) .main-content,
    #main-content:has(.disputes-page) {
        background-image:
            linear-gradient(180deg, rgba(7, 10, 22, .10), rgba(7, 10, 22, .20)),
            url('./assets/chat-pattern-premium-mobile.webp') !important;
        background-repeat: repeat !important;
        background-size: min(720px, 118vw) min(720px, 118vw) !important;
        background-position: center top !important;
    }

    body.theme-light:has(.disputes-v2) .main-content,
    html[data-theme="light"] body:has(.disputes-v2) .main-content,
    [data-theme="light"] body:has(.disputes-v2) .main-content,
    body.light-theme:has(.disputes-v2) .main-content,
    body.theme-light:has(.disputes-page) .main-content,
    html[data-theme="light"] body:has(.disputes-page) .main-content,
    [data-theme="light"] body:has(.disputes-page) .main-content,
    body.light-theme:has(.disputes-page) .main-content {
        background-image:
            linear-gradient(180deg, rgba(255, 255, 255, .18), rgba(255, 255, 255, .10)),
            url('./assets/chat-pattern-premium-mobile.webp') !important;
    }
}


/* === Stage 157: light-theme wallpaper normalization + page card contrast fix ===
   CSS-only corrective layer.
   Goals:
   - keep the premium wallpaper on light theme, but much lighter/softer like chats/deals;
   - fix dark/black cards left on light theme in P2P / wallet on-ramp / feed hero;
   - do not touch JS, API, modals or page logic. */

/* 1) Normalize the wallpaper on light theme so it matches the softer light look
   already expected on chats/deals. */
body.theme-light:has(.wallet-page-polished) .main-content,
body.theme-light:has(.wallet-page) .main-content,
body.theme-light:has(.p2p-page) .main-content,
body.theme-light:has(.listings-page) .main-content,
body.theme-light:has(.disputes-v2) .main-content,
body.theme-light:has(.feed-page) .main-content,
body.theme-light:has(.vk-feed-page) .main-content,
body.theme-light:has(.forum-topic-page) .main-content,
body.light-theme:has(.wallet-page-polished) .main-content,
body.light-theme:has(.wallet-page) .main-content,
body.light-theme:has(.p2p-page) .main-content,
body.light-theme:has(.listings-page) .main-content,
body.light-theme:has(.disputes-v2) .main-content,
body.light-theme:has(.feed-page) .main-content,
body.light-theme:has(.vk-feed-page) .main-content,
body.light-theme:has(.forum-topic-page) .main-content,
[data-theme="light"] body:has(.wallet-page-polished) .main-content,
[data-theme="light"] body:has(.wallet-page) .main-content,
[data-theme="light"] body:has(.p2p-page) .main-content,
[data-theme="light"] body:has(.listings-page) .main-content,
[data-theme="light"] body:has(.disputes-v2) .main-content,
[data-theme="light"] body:has(.feed-page) .main-content,
[data-theme="light"] body:has(.vk-feed-page) .main-content,
[data-theme="light"] body:has(.forum-topic-page) .main-content {
    background-color: #eef3ff !important;
    background-image:
        linear-gradient(180deg, rgba(255,255,255,.84), rgba(255,255,255,.74)),
        url('./assets/chat-pattern-premium.webp') !important;
    background-repeat: repeat !important;
    background-size: 980px 980px !important;
    background-position: center top !important;
}

@media (max-width: 1024px) {
    body.theme-light:has(.wallet-page-polished) .main-content,
    body.theme-light:has(.wallet-page) .main-content,
    body.theme-light:has(.p2p-page) .main-content,
    body.theme-light:has(.listings-page) .main-content,
    body.theme-light:has(.disputes-v2) .main-content,
    body.theme-light:has(.feed-page) .main-content,
    body.theme-light:has(.vk-feed-page) .main-content,
    body.theme-light:has(.forum-topic-page) .main-content,
    body.light-theme:has(.wallet-page-polished) .main-content,
    body.light-theme:has(.wallet-page) .main-content,
    body.light-theme:has(.p2p-page) .main-content,
    body.light-theme:has(.listings-page) .main-content,
    body.light-theme:has(.disputes-v2) .main-content,
    body.light-theme:has(.feed-page) .main-content,
    body.light-theme:has(.vk-feed-page) .main-content,
    body.light-theme:has(.forum-topic-page) .main-content,
    [data-theme="light"] body:has(.wallet-page-polished) .main-content,
    [data-theme="light"] body:has(.wallet-page) .main-content,
    [data-theme="light"] body:has(.p2p-page) .main-content,
    [data-theme="light"] body:has(.listings-page) .main-content,
    [data-theme="light"] body:has(.disputes-v2) .main-content,
    [data-theme="light"] body:has(.feed-page) .main-content,
    [data-theme="light"] body:has(.vk-feed-page) .main-content,
    [data-theme="light"] body:has(.forum-topic-page) .main-content {
        background-color: #eef3ff !important;
        background-image:
            linear-gradient(180deg, rgba(255,255,255,.86), rgba(255,255,255,.76)),
            url('./assets/chat-pattern-premium-mobile.webp') !important;
        background-size: min(720px, 118vw) min(720px, 118vw) !important;
    }
}

/* 2) Wallet / on-ramp cards on light theme: keep them as normal light cards. */
body.theme-light .onramp-hero,
body.theme-light .onramp-disclaimer-card,
body.theme-light .onramp-actions-card,
body.theme-light .onramp-network-card,
body.theme-light .wallet-onramp-card,
body.light-theme .onramp-hero,
body.light-theme .onramp-disclaimer-card,
body.light-theme .onramp-actions-card,
body.light-theme .onramp-network-card,
body.light-theme .wallet-onramp-card,
[data-theme="light"] .onramp-hero,
[data-theme="light"] .onramp-disclaimer-card,
[data-theme="light"] .onramp-actions-card,
[data-theme="light"] .onramp-network-card,
[data-theme="light"] .wallet-onramp-card {
    background: rgba(255,255,255,.92) !important;
    border-color: rgba(148,163,184,.22) !important;
    box-shadow: 0 18px 48px rgba(15,23,42,.08) !important;
}

body.theme-light .wallet-onramp-note,
body.theme-light .onramp-hero p,
body.theme-light .onramp-disclaimer-card p,
body.theme-light .onramp-actions-card p,
body.theme-light .onramp-network-token,
body.theme-light .onramp-network-wallet span,
body.theme-light .onramp-gas-hint,
body.light-theme .wallet-onramp-note,
body.light-theme .onramp-hero p,
body.light-theme .onramp-disclaimer-card p,
body.light-theme .onramp-actions-card p,
body.light-theme .onramp-network-token,
body.light-theme .onramp-network-wallet span,
body.light-theme .onramp-gas-hint,
[data-theme="light"] .wallet-onramp-note,
[data-theme="light"] .onramp-hero p,
[data-theme="light"] .onramp-disclaimer-card p,
[data-theme="light"] .onramp-actions-card p,
[data-theme="light"] .onramp-network-token,
[data-theme="light"] .onramp-network-wallet span,
[data-theme="light"] .onramp-gas-hint {
    color: #64748b !important;
}

body.theme-light .wallet-onramp-networks span,
body.theme-light .onramp-network-wallet,
body.theme-light .onramp-gas-hint,
body.light-theme .wallet-onramp-networks span,
body.light-theme .onramp-network-wallet,
body.light-theme .onramp-gas-hint,
[data-theme="light"] .wallet-onramp-networks span,
[data-theme="light"] .onramp-network-wallet,
[data-theme="light"] .onramp-gas-hint {
    background: rgba(148,163,184,.10) !important;
    color: #0f172a !important;
}

body.theme-light .onramp-network-wallet code,
body.light-theme .onramp-network-wallet code,
[data-theme="light"] .onramp-network-wallet code {
    color: #0f172a !important;
}

/* 3) P2P on light theme: fix dark hero text + dark/black order/payment/chat cards. */
body.theme-light .p2p-hero,
body.theme-light .p2p-panel,
body.light-theme .p2p-hero,
body.light-theme .p2p-panel,
[data-theme="light"] .p2p-hero,
[data-theme="light"] .p2p-panel {
    background: rgba(255,255,255,.92) !important;
    border-color: rgba(148,163,184,.22) !important;
    box-shadow: 0 18px 48px rgba(15,23,42,.08) !important;
}

body.theme-light .p2p-hero h1,
body.theme-light .p2p-panel h2,
body.theme-light .p2p-offer-card h3,
body.light-theme .p2p-hero h1,
body.light-theme .p2p-panel h2,
body.light-theme .p2p-offer-card h3,
[data-theme="light"] .p2p-hero h1,
[data-theme="light"] .p2p-panel h2,
[data-theme="light"] .p2p-offer-card h3 {
    color: #0f172a !important;
}

body.theme-light .p2p-hero p,
body.theme-light .p2p-section-head p,
body.theme-light .p2p-info-panel p,
body.theme-light .p2p-hero-note small,
body.light-theme .p2p-hero p,
body.light-theme .p2p-section-head p,
body.light-theme .p2p-info-panel p,
body.light-theme .p2p-hero-note small,
[data-theme="light"] .p2p-hero p,
[data-theme="light"] .p2p-section-head p,
[data-theme="light"] .p2p-info-panel p,
[data-theme="light"] .p2p-hero-note small {
    color: #64748b !important;
}

body.theme-light .p2p-payment-box,
body.theme-light .p2p-receipts,
body.theme-light .p2p-order-chat,
body.theme-light .p2p-dispute-box,
body.theme-light .p2p-order-msg,
body.theme-light .p2p-order-msg.mine,
body.light-theme .p2p-payment-box,
body.light-theme .p2p-receipts,
body.light-theme .p2p-order-chat,
body.light-theme .p2p-dispute-box,
body.light-theme .p2p-order-msg,
body.light-theme .p2p-order-msg.mine,
[data-theme="light"] .p2p-payment-box,
[data-theme="light"] .p2p-receipts,
[data-theme="light"] .p2p-order-chat,
[data-theme="light"] .p2p-dispute-box,
[data-theme="light"] .p2p-order-msg,
[data-theme="light"] .p2p-order-msg.mine {
    box-shadow: 0 18px 48px rgba(15,23,42,.08) !important;
}

body.theme-light .p2p-payment-box,
body.theme-light .p2p-receipts,
body.theme-light .p2p-order-chat,
body.theme-light .p2p-dispute-box,
body.light-theme .p2p-payment-box,
body.light-theme .p2p-receipts,
body.light-theme .p2p-order-chat,
body.light-theme .p2p-dispute-box,
[data-theme="light"] .p2p-payment-box,
[data-theme="light"] .p2p-receipts,
[data-theme="light"] .p2p-order-chat,
[data-theme="light"] .p2p-dispute-box {
    background: rgba(255,255,255,.90) !important;
    border-color: rgba(124,58,237,.13) !important;
}

body.theme-light .p2p-order-msg,
body.light-theme .p2p-order-msg,
[data-theme="light"] .p2p-order-msg {
    background: rgba(241,245,249,.92) !important;
    border-color: rgba(148,163,184,.24) !important;
}

body.theme-light .p2p-order-msg.mine,
body.light-theme .p2p-order-msg.mine,
[data-theme="light"] .p2p-order-msg.mine {
    background: linear-gradient(135deg, rgba(139,92,246,.16), rgba(59,130,246,.10)) !important;
    border-color: rgba(139,92,246,.20) !important;
}

body.theme-light .p2p-payment-box b,
body.theme-light .p2p-mini-title,
body.theme-light .p2p-dispute-box .p2p-mini-title,
body.theme-light .p2p-payment-box pre,
body.theme-light .p2p-order-msg span,
body.light-theme .p2p-payment-box b,
body.light-theme .p2p-mini-title,
body.light-theme .p2p-dispute-box .p2p-mini-title,
body.light-theme .p2p-payment-box pre,
body.light-theme .p2p-order-msg span,
[data-theme="light"] .p2p-payment-box b,
[data-theme="light"] .p2p-mini-title,
[data-theme="light"] .p2p-dispute-box .p2p-mini-title,
[data-theme="light"] .p2p-payment-box pre,
[data-theme="light"] .p2p-order-msg span {
    color: #0f172a !important;
}

body.theme-light .p2p-payment-box span,
body.theme-light .p2p-receipt-row span,
body.theme-light .p2p-order-chat-empty,
body.theme-light .p2p-receipt-empty,
body.theme-light .p2p-dispute-box p,
body.theme-light .p2p-dispute-box span,
body.theme-light .p2p-dispute-box small,
body.light-theme .p2p-payment-box span,
body.light-theme .p2p-receipt-row span,
body.light-theme .p2p-order-chat-empty,
body.light-theme .p2p-receipt-empty,
body.light-theme .p2p-dispute-box p,
body.light-theme .p2p-dispute-box span,
body.light-theme .p2p-dispute-box small,
[data-theme="light"] .p2p-payment-box span,
[data-theme="light"] .p2p-receipt-row span,
[data-theme="light"] .p2p-order-chat-empty,
[data-theme="light"] .p2p-receipt-empty,
[data-theme="light"] .p2p-dispute-box p,
[data-theme="light"] .p2p-dispute-box span,
[data-theme="light"] .p2p-dispute-box small {
    color: #475569 !important;
}

/* 4) Feed/forum light theme: keep the hero/header surfaces light, not dark. */
body.theme-light .feed-hero:not(.feed-page .feed-hero),
body.theme-light .vk-forum-panel,
body.theme-light .forum-topic-view,
body.theme-light .forum-replies-list,
body.theme-light .forum-reply,
body.theme-light .feed-empty:not(.feed-page .feed-empty),
body.light-theme .feed-hero:not(.feed-page .feed-hero),
body.light-theme .vk-forum-panel,
body.light-theme .forum-topic-view,
body.light-theme .forum-replies-list,
body.light-theme .forum-reply,
body.light-theme .feed-empty:not(.feed-page .feed-empty),
[data-theme="light"] .feed-hero:not(.feed-page .feed-hero),
[data-theme="light"] .vk-forum-panel,
[data-theme="light"] .forum-topic-view,
[data-theme="light"] .forum-replies-list,
[data-theme="light"] .forum-reply,
[data-theme="light"] .feed-empty:not(.feed-page .feed-empty) {
    background: rgba(255,255,255,.92) !important;
    border-color: rgba(148,163,184,.22) !important;
    box-shadow: 0 18px 48px rgba(15,23,42,.08) !important;
}

body.theme-light .feed-hero p,
body.theme-light .forum-panel-head p,
body.theme-light .forum-topic-main span,
body.theme-light .forum-topic-meta span,
body.theme-light .feed-empty,
body.light-theme .feed-hero p,
body.light-theme .forum-panel-head p,
body.light-theme .forum-topic-main span,
body.light-theme .forum-topic-meta span,
body.light-theme .feed-empty,
[data-theme="light"] .feed-hero p,
[data-theme="light"] .forum-panel-head p,
[data-theme="light"] .forum-topic-main span,
[data-theme="light"] .forum-topic-meta span,
[data-theme="light"] .feed-empty {
    color: #64748b !important;
}

body.theme-light .feed-hero h1,
body.theme-light .feed-empty b,
body.theme-light .forum-panel-head h2,
body.theme-light .forum-topic-card h1,
body.light-theme .feed-hero h1,
body.light-theme .feed-empty b,
body.light-theme .forum-panel-head h2,
body.light-theme .forum-topic-card h1,
[data-theme="light"] .feed-hero h1,
[data-theme="light"] .feed-empty b,
[data-theme="light"] .forum-panel-head h2,
[data-theme="light"] .forum-topic-card h1 {
    color: #0f172a !important;
}

body.theme-light .feed-hero .btn,
body.theme-light .feed-hero .button,
body.light-theme .feed-hero .btn,
body.light-theme .feed-hero .button,
[data-theme="light"] .feed-hero .btn,
[data-theme="light"] .feed-hero .button {
    box-shadow: none !important;
}

/* 5) Listings/disputes on light theme: keep active/filter bars readable above the softer wallpaper. */
body.theme-light .listings-page .glass,
body.theme-light .listings-page .listings-toolbar,
body.theme-light .listings-page .listings-advanced-filters,
body.theme-light .listings-page .listings-active-filters,
body.theme-light .listings-page .listings-section-head,
body.theme-light .listings-page .listings-empty,
body.light-theme .listings-page .glass,
body.light-theme .listings-page .listings-toolbar,
body.light-theme .listings-page .listings-advanced-filters,
body.light-theme .listings-page .listings-active-filters,
body.light-theme .listings-page .listings-section-head,
body.light-theme .listings-page .listings-empty,
[data-theme="light"] .listings-page .glass,
[data-theme="light"] .listings-page .listings-toolbar,
[data-theme="light"] .listings-page .listings-advanced-filters,
[data-theme="light"] .listings-page .listings-active-filters,
[data-theme="light"] .listings-page .listings-section-head,
[data-theme="light"] .listings-page .listings-empty,
body.theme-light .disputes-v2 .glass,
body.theme-light .disputes-hero,
body.theme-light .disputes-kpi-card,
body.theme-light .dispute-details-card,
body.theme-light .dispute-details-empty,
body.light-theme .disputes-v2 .glass,
body.light-theme .disputes-hero,
body.light-theme .disputes-kpi-card,
body.light-theme .dispute-details-card,
body.light-theme .dispute-details-empty,
[data-theme="light"] .disputes-v2 .glass,
[data-theme="light"] .disputes-hero,
[data-theme="light"] .disputes-kpi-card,
[data-theme="light"] .dispute-details-card,
[data-theme="light"] .dispute-details-empty {
    box-shadow: 0 18px 48px rgba(15,23,42,.08) !important;
}


/* === Stage 158: real light-theme wallpaper selector fix ===
   CSS-only. Fixes pages where the old dark wallpaper rule still wins on light theme:
   P2P, Listings, Disputes, plus the opened forum topic card.
   No JS/API/modals/buttons changes. */

/* Light wallpaper must override BOTH .main-content and #main-content dark rules. */
html.theme-light body:has(.p2p-page) .main-content,
html.theme-light body:has(.p2p-page) #main-content,
body.theme-light:has(.p2p-page) .main-content,
body.theme-light:has(.p2p-page) #main-content,
body.light-theme:has(.p2p-page) .main-content,
body.light-theme:has(.p2p-page) #main-content,
.theme-light body:has(.p2p-page) .main-content,
.theme-light body:has(.p2p-page) #main-content,
[data-theme="light"] body:has(.p2p-page) .main-content,
[data-theme="light"] body:has(.p2p-page) #main-content,
html.theme-light body:has(.listings-page) .main-content,
html.theme-light body:has(.listings-page) #main-content,
body.theme-light:has(.listings-page) .main-content,
body.theme-light:has(.listings-page) #main-content,
body.light-theme:has(.listings-page) .main-content,
body.light-theme:has(.listings-page) #main-content,
.theme-light body:has(.listings-page) .main-content,
.theme-light body:has(.listings-page) #main-content,
[data-theme="light"] body:has(.listings-page) .main-content,
[data-theme="light"] body:has(.listings-page) #main-content,
html.theme-light body:has(.disputes-v2) .main-content,
html.theme-light body:has(.disputes-v2) #main-content,
body.theme-light:has(.disputes-v2) .main-content,
body.theme-light:has(.disputes-v2) #main-content,
body.light-theme:has(.disputes-v2) .main-content,
body.light-theme:has(.disputes-v2) #main-content,
.theme-light body:has(.disputes-v2) .main-content,
.theme-light body:has(.disputes-v2) #main-content,
[data-theme="light"] body:has(.disputes-v2) .main-content,
[data-theme="light"] body:has(.disputes-v2) #main-content,
html.theme-light body:has(.feed-page) .main-content,
html.theme-light body:has(.feed-page) #main-content,
body.theme-light:has(.feed-page) .main-content,
body.theme-light:has(.feed-page) #main-content,
body.light-theme:has(.feed-page) .main-content,
body.light-theme:has(.feed-page) #main-content,
.theme-light body:has(.feed-page) .main-content,
.theme-light body:has(.feed-page) #main-content,
[data-theme="light"] body:has(.feed-page) .main-content,
[data-theme="light"] body:has(.feed-page) #main-content,
html.theme-light body:has(.vk-feed-page) .main-content,
html.theme-light body:has(.vk-feed-page) #main-content,
body.theme-light:has(.vk-feed-page) .main-content,
body.theme-light:has(.vk-feed-page) #main-content,
body.light-theme:has(.vk-feed-page) .main-content,
body.light-theme:has(.vk-feed-page) #main-content,
.theme-light body:has(.vk-feed-page) .main-content,
.theme-light body:has(.vk-feed-page) #main-content,
[data-theme="light"] body:has(.vk-feed-page) .main-content,
[data-theme="light"] body:has(.vk-feed-page) #main-content,
html.theme-light body:has(.forum-topic-page) .main-content,
html.theme-light body:has(.forum-topic-page) #main-content,
body.theme-light:has(.forum-topic-page) .main-content,
body.theme-light:has(.forum-topic-page) #main-content,
body.light-theme:has(.forum-topic-page) .main-content,
body.light-theme:has(.forum-topic-page) #main-content,
.theme-light body:has(.forum-topic-page) .main-content,
.theme-light body:has(.forum-topic-page) #main-content,
[data-theme="light"] body:has(.forum-topic-page) .main-content,
[data-theme="light"] body:has(.forum-topic-page) #main-content {
    background-color: #eef3ff !important;
    background-image:
        linear-gradient(180deg, rgba(255,255,255,.86), rgba(255,255,255,.76)),
        url('./assets/chat-pattern-premium.webp') !important;
    background-repeat: repeat !important;
    background-size: 980px 980px !important;
    background-position: center top !important;
}

/* Also cover projects where the route body is inside .page-content only. */
html.theme-light .page-content:has(.p2p-page),
body.theme-light .page-content:has(.p2p-page),
body.light-theme .page-content:has(.p2p-page),
.theme-light .page-content:has(.p2p-page),
[data-theme="light"] .page-content:has(.p2p-page),
html.theme-light .page-content:has(.listings-page),
body.theme-light .page-content:has(.listings-page),
body.light-theme .page-content:has(.listings-page),
.theme-light .page-content:has(.listings-page),
[data-theme="light"] .page-content:has(.listings-page),
html.theme-light .page-content:has(.disputes-v2),
body.theme-light .page-content:has(.disputes-v2),
body.light-theme .page-content:has(.disputes-v2),
.theme-light .page-content:has(.disputes-v2),
[data-theme="light"] .page-content:has(.disputes-v2),
html.theme-light .page-content:has(.feed-page),
body.theme-light .page-content:has(.feed-page),
body.light-theme .page-content:has(.feed-page),
.theme-light .page-content:has(.feed-page),
[data-theme="light"] .page-content:has(.feed-page),
html.theme-light .page-content:has(.vk-feed-page),
body.theme-light .page-content:has(.vk-feed-page),
body.light-theme .page-content:has(.vk-feed-page),
.theme-light .page-content:has(.vk-feed-page),
[data-theme="light"] .page-content:has(.vk-feed-page),
html.theme-light .page-content:has(.forum-topic-page),
body.theme-light .page-content:has(.forum-topic-page),
body.light-theme .page-content:has(.forum-topic-page),
.theme-light .page-content:has(.forum-topic-page),
[data-theme="light"] .page-content:has(.forum-topic-page) {
    background: transparent !important;
    background-image: none !important;
    background-color: transparent !important;
}

/* Mobile light wallpaper override. */
@media (max-width: 1024px) {
    html.theme-light body:has(.p2p-page) .main-content,
    html.theme-light body:has(.p2p-page) #main-content,
    body.theme-light:has(.p2p-page) .main-content,
    body.theme-light:has(.p2p-page) #main-content,
    body.light-theme:has(.p2p-page) .main-content,
    body.light-theme:has(.p2p-page) #main-content,
    .theme-light body:has(.p2p-page) .main-content,
    .theme-light body:has(.p2p-page) #main-content,
    [data-theme="light"] body:has(.p2p-page) .main-content,
    [data-theme="light"] body:has(.p2p-page) #main-content,
    html.theme-light body:has(.listings-page) .main-content,
    html.theme-light body:has(.listings-page) #main-content,
    body.theme-light:has(.listings-page) .main-content,
    body.theme-light:has(.listings-page) #main-content,
    body.light-theme:has(.listings-page) .main-content,
    body.light-theme:has(.listings-page) #main-content,
    .theme-light body:has(.listings-page) .main-content,
    .theme-light body:has(.listings-page) #main-content,
    [data-theme="light"] body:has(.listings-page) .main-content,
    [data-theme="light"] body:has(.listings-page) #main-content,
    html.theme-light body:has(.disputes-v2) .main-content,
    html.theme-light body:has(.disputes-v2) #main-content,
    body.theme-light:has(.disputes-v2) .main-content,
    body.theme-light:has(.disputes-v2) #main-content,
    body.light-theme:has(.disputes-v2) .main-content,
    body.light-theme:has(.disputes-v2) #main-content,
    .theme-light body:has(.disputes-v2) .main-content,
    .theme-light body:has(.disputes-v2) #main-content,
    [data-theme="light"] body:has(.disputes-v2) .main-content,
    [data-theme="light"] body:has(.disputes-v2) #main-content,
    html.theme-light body:has(.feed-page) .main-content,
    html.theme-light body:has(.feed-page) #main-content,
    body.theme-light:has(.feed-page) .main-content,
    body.theme-light:has(.feed-page) #main-content,
    body.light-theme:has(.feed-page) .main-content,
    body.light-theme:has(.feed-page) #main-content,
    .theme-light body:has(.feed-page) .main-content,
    .theme-light body:has(.feed-page) #main-content,
    [data-theme="light"] body:has(.feed-page) .main-content,
    [data-theme="light"] body:has(.feed-page) #main-content,
    html.theme-light body:has(.vk-feed-page) .main-content,
    html.theme-light body:has(.vk-feed-page) #main-content,
    body.theme-light:has(.vk-feed-page) .main-content,
    body.theme-light:has(.vk-feed-page) #main-content,
    body.light-theme:has(.vk-feed-page) .main-content,
    body.light-theme:has(.vk-feed-page) #main-content,
    .theme-light body:has(.vk-feed-page) .main-content,
    .theme-light body:has(.vk-feed-page) #main-content,
    [data-theme="light"] body:has(.vk-feed-page) .main-content,
    [data-theme="light"] body:has(.vk-feed-page) #main-content,
    html.theme-light body:has(.forum-topic-page) .main-content,
    html.theme-light body:has(.forum-topic-page) #main-content,
    body.theme-light:has(.forum-topic-page) .main-content,
    body.theme-light:has(.forum-topic-page) #main-content,
    body.light-theme:has(.forum-topic-page) .main-content,
    body.light-theme:has(.forum-topic-page) #main-content,
    .theme-light body:has(.forum-topic-page) .main-content,
    .theme-light body:has(.forum-topic-page) #main-content,
    [data-theme="light"] body:has(.forum-topic-page) .main-content,
    [data-theme="light"] body:has(.forum-topic-page) #main-content {
        background-color: #eef3ff !important;
        background-image:
            linear-gradient(180deg, rgba(255,255,255,.88), rgba(255,255,255,.78)),
            url('./assets/chat-pattern-premium-mobile.webp') !important;
        background-repeat: repeat !important;
        background-size: min(720px, 118vw) min(720px, 118vw) !important;
        background-position: center top !important;
    }
}

/* Forum opened topic: the old dark card came from generic forum/feed dark surfaces.
   Force only these topic surfaces light on light theme. */
html.theme-light .forum-topic-card,
html.theme-light .forum-topic-view,
html.theme-light .forum-replies-list,
html.theme-light .forum-reply,
html.theme-light .vk-forum-panel,
body.theme-light .forum-topic-card,
body.theme-light .forum-topic-view,
body.theme-light .forum-replies-list,
body.theme-light .forum-reply,
body.theme-light .vk-forum-panel,
body.light-theme .forum-topic-card,
body.light-theme .forum-topic-view,
body.light-theme .forum-replies-list,
body.light-theme .forum-reply,
body.light-theme .vk-forum-panel,
.theme-light .forum-topic-card,
.theme-light .forum-topic-view,
.theme-light .forum-replies-list,
.theme-light .forum-reply,
.theme-light .vk-forum-panel,
[data-theme="light"] .forum-topic-card,
[data-theme="light"] .forum-topic-view,
[data-theme="light"] .forum-replies-list,
[data-theme="light"] .forum-reply,
[data-theme="light"] .vk-forum-panel {
    background: rgba(255,255,255,.94) !important;
    border-color: rgba(148,163,184,.24) !important;
    box-shadow: 0 18px 48px rgba(15,23,42,.08) !important;
    color: #0f172a !important;
}

html.theme-light .forum-topic-card *,
html.theme-light .forum-topic-view *,
body.theme-light .forum-topic-card *,
body.theme-light .forum-topic-view *,
body.light-theme .forum-topic-card *,
body.light-theme .forum-topic-view *,
.theme-light .forum-topic-card *,
.theme-light .forum-topic-view *,
[data-theme="light"] .forum-topic-card *,
[data-theme="light"] .forum-topic-view * {
    color: inherit;
}

html.theme-light .forum-topic-card p,
html.theme-light .forum-topic-card small,
html.theme-light .forum-reply-text,
html.theme-light .forum-reply-head span,
body.theme-light .forum-topic-card p,
body.theme-light .forum-topic-card small,
body.theme-light .forum-reply-text,
body.theme-light .forum-reply-head span,
body.light-theme .forum-topic-card p,
body.light-theme .forum-topic-card small,
body.light-theme .forum-reply-text,
body.light-theme .forum-reply-head span,
.theme-light .forum-topic-card p,
.theme-light .forum-topic-card small,
.theme-light .forum-reply-text,
.theme-light .forum-reply-head span,
[data-theme="light"] .forum-topic-card p,
[data-theme="light"] .forum-topic-card small,
[data-theme="light"] .forum-reply-text,
[data-theme="light"] .forum-reply-head span {
    color: #475569 !important;
}

/* Legacy heroes outside the main feed keep their light surface. */
html.theme-light .feed-hero:not(.feed-page .feed-hero),
body.theme-light .feed-hero:not(.feed-page .feed-hero),
body.light-theme .feed-hero:not(.feed-page .feed-hero),
.theme-light .feed-hero:not(.feed-page .feed-hero),
[data-theme="light"] .feed-hero:not(.feed-page .feed-hero) {
    background: rgba(255,255,255,.94) !important;
    border-color: rgba(148,163,184,.24) !important;
    color: #0f172a !important;
}

/* Stronger light fix for P2P/Wallet surfaces that remained dark. */
html.theme-light .p2p-page .p2p-hero,
html.theme-light .p2p-page .p2p-panel,
html.theme-light .p2p-page .p2p-payment-box,
html.theme-light .p2p-page .p2p-receipts,
html.theme-light .p2p-page .p2p-order-chat,
html.theme-light .p2p-page .p2p-dispute-box,
body.theme-light .p2p-page .p2p-hero,
body.theme-light .p2p-page .p2p-panel,
body.theme-light .p2p-page .p2p-payment-box,
body.theme-light .p2p-page .p2p-receipts,
body.theme-light .p2p-page .p2p-order-chat,
body.theme-light .p2p-page .p2p-dispute-box,
body.light-theme .p2p-page .p2p-hero,
body.light-theme .p2p-page .p2p-panel,
body.light-theme .p2p-page .p2p-payment-box,
body.light-theme .p2p-page .p2p-receipts,
body.light-theme .p2p-page .p2p-order-chat,
body.light-theme .p2p-page .p2p-dispute-box,
.theme-light .p2p-page .p2p-hero,
.theme-light .p2p-page .p2p-panel,
.theme-light .p2p-page .p2p-payment-box,
.theme-light .p2p-page .p2p-receipts,
.theme-light .p2p-page .p2p-order-chat,
.theme-light .p2p-page .p2p-dispute-box,
[data-theme="light"] .p2p-page .p2p-hero,
[data-theme="light"] .p2p-page .p2p-panel,
[data-theme="light"] .p2p-page .p2p-payment-box,
[data-theme="light"] .p2p-page .p2p-receipts,
[data-theme="light"] .p2p-page .p2p-order-chat,
[data-theme="light"] .p2p-page .p2p-dispute-box,
html.theme-light .wallet-onramp-card,
body.theme-light .wallet-onramp-card,
body.light-theme .wallet-onramp-card,
.theme-light .wallet-onramp-card,
[data-theme="light"] .wallet-onramp-card {
    background: rgba(255,255,255,.94) !important;
    border-color: rgba(148,163,184,.24) !important;
    color: #0f172a !important;
}

html.theme-light .p2p-page .p2p-hero *,
html.theme-light .p2p-page .p2p-panel *,
html.theme-light .wallet-onramp-card *,
body.theme-light .p2p-page .p2p-hero *,
body.theme-light .p2p-page .p2p-panel *,
body.theme-light .wallet-onramp-card *,
body.light-theme .p2p-page .p2p-hero *,
body.light-theme .p2p-page .p2p-panel *,
body.light-theme .wallet-onramp-card *,
.theme-light .p2p-page .p2p-hero *,
.theme-light .p2p-page .p2p-panel *,
.theme-light .wallet-onramp-card *,
[data-theme="light"] .p2p-page .p2p-hero *,
[data-theme="light"] .p2p-page .p2p-panel *,
[data-theme="light"] .wallet-onramp-card * {
    color: inherit;
}

html.theme-light .p2p-page p,
html.theme-light .p2p-page small,
html.theme-light .wallet-onramp-note,
body.theme-light .p2p-page p,
body.theme-light .p2p-page small,
body.theme-light .wallet-onramp-note,
body.light-theme .p2p-page p,
body.light-theme .p2p-page small,
body.light-theme .wallet-onramp-note,
.theme-light .p2p-page p,
.theme-light .p2p-page small,
.theme-light .wallet-onramp-note,
[data-theme="light"] .p2p-page p,
[data-theme="light"] .p2p-page small,
[data-theme="light"] .wallet-onramp-note {
    color: #64748b !important;
}


/* === Stage 159: light wallpaper tone + forum topic border fix ===
   CSS-only corrective layer.
   - Do not touch JS/API/modals/buttons.
   - Make light wallpaper match chats/deals/wallet: soft bluish, not dark and not flat-white.
   - Remove the dark outer frame/border left on opened forum topics. */

/* Softer bluish wallpaper for light theme pages that were too white after Stage 158. */
html.theme-light body:has(.p2p-page) .main-content,
html.theme-light body:has(.p2p-page) #main-content,
body.theme-light:has(.p2p-page) .main-content,
body.theme-light:has(.p2p-page) #main-content,
body.light-theme:has(.p2p-page) .main-content,
body.light-theme:has(.p2p-page) #main-content,
.theme-light body:has(.p2p-page) .main-content,
.theme-light body:has(.p2p-page) #main-content,
[data-theme="light"] body:has(.p2p-page) .main-content,
[data-theme="light"] body:has(.p2p-page) #main-content,
html.theme-light body:has(.listings-page) .main-content,
html.theme-light body:has(.listings-page) #main-content,
body.theme-light:has(.listings-page) .main-content,
body.theme-light:has(.listings-page) #main-content,
body.light-theme:has(.listings-page) .main-content,
body.light-theme:has(.listings-page) #main-content,
.theme-light body:has(.listings-page) .main-content,
.theme-light body:has(.listings-page) #main-content,
[data-theme="light"] body:has(.listings-page) .main-content,
[data-theme="light"] body:has(.listings-page) #main-content,
html.theme-light body:has(.disputes-v2) .main-content,
html.theme-light body:has(.disputes-v2) #main-content,
body.theme-light:has(.disputes-v2) .main-content,
body.theme-light:has(.disputes-v2) #main-content,
body.light-theme:has(.disputes-v2) .main-content,
body.light-theme:has(.disputes-v2) #main-content,
.theme-light body:has(.disputes-v2) .main-content,
.theme-light body:has(.disputes-v2) #main-content,
[data-theme="light"] body:has(.disputes-v2) .main-content,
[data-theme="light"] body:has(.disputes-v2) #main-content,
html.theme-light body:has(.feed-page) .main-content,
html.theme-light body:has(.feed-page) #main-content,
body.theme-light:has(.feed-page) .main-content,
body.theme-light:has(.feed-page) #main-content,
body.light-theme:has(.feed-page) .main-content,
body.light-theme:has(.feed-page) #main-content,
.theme-light body:has(.feed-page) .main-content,
.theme-light body:has(.feed-page) #main-content,
[data-theme="light"] body:has(.feed-page) .main-content,
[data-theme="light"] body:has(.feed-page) #main-content,
html.theme-light body:has(.vk-feed-page) .main-content,
html.theme-light body:has(.vk-feed-page) #main-content,
body.theme-light:has(.vk-feed-page) .main-content,
body.theme-light:has(.vk-feed-page) #main-content,
body.light-theme:has(.vk-feed-page) .main-content,
body.light-theme:has(.vk-feed-page) #main-content,
.theme-light body:has(.vk-feed-page) .main-content,
.theme-light body:has(.vk-feed-page) #main-content,
[data-theme="light"] body:has(.vk-feed-page) .main-content,
[data-theme="light"] body:has(.vk-feed-page) #main-content,
html.theme-light body:has(.forum-topic-page) .main-content,
html.theme-light body:has(.forum-topic-page) #main-content,
body.theme-light:has(.forum-topic-page) .main-content,
body.theme-light:has(.forum-topic-page) #main-content,
body.light-theme:has(.forum-topic-page) .main-content,
body.light-theme:has(.forum-topic-page) #main-content,
.theme-light body:has(.forum-topic-page) .main-content,
.theme-light body:has(.forum-topic-page) #main-content,
[data-theme="light"] body:has(.forum-topic-page) .main-content,
[data-theme="light"] body:has(.forum-topic-page) #main-content {
    background-color: #dfe7fb !important;
    background-image:
        linear-gradient(180deg, rgba(255,255,255,.42), rgba(255,255,255,.22)),
        url('./assets/chat-pattern-premium.webp') !important;
    background-repeat: repeat !important;
    background-size: 980px 980px !important;
    background-position: center top !important;
}

@media (max-width: 1024px) {
    html.theme-light body:has(.p2p-page) .main-content,
    html.theme-light body:has(.p2p-page) #main-content,
    body.theme-light:has(.p2p-page) .main-content,
    body.theme-light:has(.p2p-page) #main-content,
    body.light-theme:has(.p2p-page) .main-content,
    body.light-theme:has(.p2p-page) #main-content,
    .theme-light body:has(.p2p-page) .main-content,
    .theme-light body:has(.p2p-page) #main-content,
    [data-theme="light"] body:has(.p2p-page) .main-content,
    [data-theme="light"] body:has(.p2p-page) #main-content,
    html.theme-light body:has(.listings-page) .main-content,
    html.theme-light body:has(.listings-page) #main-content,
    body.theme-light:has(.listings-page) .main-content,
    body.theme-light:has(.listings-page) #main-content,
    body.light-theme:has(.listings-page) .main-content,
    body.light-theme:has(.listings-page) #main-content,
    .theme-light body:has(.listings-page) .main-content,
    .theme-light body:has(.listings-page) #main-content,
    [data-theme="light"] body:has(.listings-page) .main-content,
    [data-theme="light"] body:has(.listings-page) #main-content,
    html.theme-light body:has(.disputes-v2) .main-content,
    html.theme-light body:has(.disputes-v2) #main-content,
    body.theme-light:has(.disputes-v2) .main-content,
    body.theme-light:has(.disputes-v2) #main-content,
    body.light-theme:has(.disputes-v2) .main-content,
    body.light-theme:has(.disputes-v2) #main-content,
    .theme-light body:has(.disputes-v2) .main-content,
    .theme-light body:has(.disputes-v2) #main-content,
    [data-theme="light"] body:has(.disputes-v2) .main-content,
    [data-theme="light"] body:has(.disputes-v2) #main-content,
    html.theme-light body:has(.feed-page) .main-content,
    html.theme-light body:has(.feed-page) #main-content,
    body.theme-light:has(.feed-page) .main-content,
    body.theme-light:has(.feed-page) #main-content,
    body.light-theme:has(.feed-page) .main-content,
    body.light-theme:has(.feed-page) #main-content,
    .theme-light body:has(.feed-page) .main-content,
    .theme-light body:has(.feed-page) #main-content,
    [data-theme="light"] body:has(.feed-page) .main-content,
    [data-theme="light"] body:has(.feed-page) #main-content,
    html.theme-light body:has(.vk-feed-page) .main-content,
    html.theme-light body:has(.vk-feed-page) #main-content,
    body.theme-light:has(.vk-feed-page) .main-content,
    body.theme-light:has(.vk-feed-page) #main-content,
    body.light-theme:has(.vk-feed-page) .main-content,
    body.light-theme:has(.vk-feed-page) #main-content,
    .theme-light body:has(.vk-feed-page) .main-content,
    .theme-light body:has(.vk-feed-page) #main-content,
    [data-theme="light"] body:has(.vk-feed-page) .main-content,
    [data-theme="light"] body:has(.vk-feed-page) #main-content,
    html.theme-light body:has(.forum-topic-page) .main-content,
    html.theme-light body:has(.forum-topic-page) #main-content,
    body.theme-light:has(.forum-topic-page) .main-content,
    body.theme-light:has(.forum-topic-page) #main-content,
    body.light-theme:has(.forum-topic-page) .main-content,
    body.light-theme:has(.forum-topic-page) #main-content,
    .theme-light body:has(.forum-topic-page) .main-content,
    .theme-light body:has(.forum-topic-page) #main-content,
    [data-theme="light"] body:has(.forum-topic-page) .main-content,
    [data-theme="light"] body:has(.forum-topic-page) #main-content {
        background-color: #dfe7fb !important;
        background-image:
            linear-gradient(180deg, rgba(255,255,255,.46), rgba(255,255,255,.26)),
            url('./assets/chat-pattern-premium-mobile.webp') !important;
        background-repeat: repeat !important;
        background-size: min(720px, 118vw) min(720px, 118vw) !important;
        background-position: center top !important;
    }
}

/* Opened forum topic: remove the dark outer frame/stripe while keeping cards readable. */
html.theme-light .forum-topic-page,
body.theme-light .forum-topic-page,
body.light-theme .forum-topic-page,
.theme-light .forum-topic-page,
[data-theme="light"] .forum-topic-page {
    background: transparent !important;
    border-color: transparent !important;
    box-shadow: none !important;
}

html.theme-light .forum-topic-card,
html.theme-light .forum-topic-view,
html.theme-light .forum-replies-list,
html.theme-light .forum-reply,
html.theme-light .forum-reply-form,
body.theme-light .forum-topic-card,
body.theme-light .forum-topic-view,
body.theme-light .forum-replies-list,
body.theme-light .forum-reply,
body.theme-light .forum-reply-form,
body.light-theme .forum-topic-card,
body.light-theme .forum-topic-view,
body.light-theme .forum-replies-list,
body.light-theme .forum-reply,
body.light-theme .forum-reply-form,
.theme-light .forum-topic-card,
.theme-light .forum-topic-view,
.theme-light .forum-replies-list,
.theme-light .forum-reply,
.theme-light .forum-reply-form,
[data-theme="light"] .forum-topic-card,
[data-theme="light"] .forum-topic-view,
[data-theme="light"] .forum-replies-list,
[data-theme="light"] .forum-reply,
[data-theme="light"] .forum-reply-form {
    background: rgba(255,255,255,.93) !important;
    border: 1px solid rgba(148,163,184,.22) !important;
    box-shadow: 0 18px 48px rgba(15,23,42,.08) !important;
    color: #0f172a !important;
}

/* The reply textarea was the remaining dark block on the topic screen. */
html.theme-light .forum-reply-form textarea,
body.theme-light .forum-reply-form textarea,
body.light-theme .forum-reply-form textarea,
.theme-light .forum-reply-form textarea,
[data-theme="light"] .forum-reply-form textarea {
    background: rgba(255,255,255,.96) !important;
    border: 1px solid rgba(148,163,184,.26) !important;
    color: #0f172a !important;
}

html.theme-light .forum-reply-form textarea::placeholder,
body.theme-light .forum-reply-form textarea::placeholder,
body.light-theme .forum-reply-form textarea::placeholder,
.theme-light .forum-reply-form textarea::placeholder,
[data-theme="light"] .forum-reply-form textarea::placeholder {
    color: #64748b !important;
}

/* Keep moderation warning readable and intentionally tinted, not dark. */
html.theme-light .feed-moderation-note,
body.theme-light .feed-moderation-note,
body.light-theme .feed-moderation-note,
.theme-light .feed-moderation-note,
[data-theme="light"] .feed-moderation-note {
    background: rgba(245,158,11,.12) !important;
    border-color: rgba(245,158,11,.22) !important;
    color: #334155 !important;
}

html.theme-light .feed-moderation-note.rejected,
body.theme-light .feed-moderation-note.rejected,
body.light-theme .feed-moderation-note.rejected,
.theme-light .feed-moderation-note.rejected,
[data-theme="light"] .feed-moderation-note.rejected {
    background: rgba(239,68,68,.10) !important;
    border-color: rgba(239,68,68,.18) !important;
}


/* === Stage 160: wallpaper-only reset after light-theme overreach ===
   CSS-only.
   Problem fixed:
   previous wallpaper/light fixes started affecting internal surfaces and stacking.
   This stage keeps ONLY passive page wallpapers and removes broad inner z-index/background interventions
   from P2P/Listings/Feed/Disputes/Wallet. No JS/API/modal/button logic changes. */

/* 1) Passive page wallpaper: only on page scroll containers, never as overlay. */
body:has(.p2p-page) .main-content,
body:has(.listings-page) .main-content,
body:has(.disputes-v2) .main-content,
body:has(.feed-page) .main-content,
body:has(.vk-feed-page) .main-content,
body:has(.forum-topic-page) .main-content,
.app:has(.p2p-page) .main-content,
.app:has(.listings-page) .main-content,
.app:has(.disputes-v2) .main-content,
.app:has(.feed-page) .main-content,
.app:has(.vk-feed-page) .main-content,
.app:has(.forum-topic-page) .main-content,
#main-content:has(.p2p-page),
#main-content:has(.listings-page),
#main-content:has(.disputes-v2),
#main-content:has(.feed-page),
#main-content:has(.vk-feed-page),
#main-content:has(.forum-topic-page) {
    background-color: #0b1020 !important;
    background-image:
        linear-gradient(180deg, rgba(7,10,22,.14), rgba(7,10,22,.24)),
        url('./assets/chat-pattern-premium.webp') !important;
    background-repeat: repeat !important;
    background-size: 980px 980px !important;
    background-position: center top !important;
    background-attachment: local !important;
}

/* Light theme page wallpaper: match the chat/deals/wallet soft bluish tone. */
html.theme-light body:has(.p2p-page) .main-content,
html.theme-light body:has(.p2p-page) #main-content,
html.theme-light body:has(.listings-page) .main-content,
html.theme-light body:has(.listings-page) #main-content,
html.theme-light body:has(.disputes-v2) .main-content,
html.theme-light body:has(.disputes-v2) #main-content,
html.theme-light body:has(.feed-page) .main-content,
html.theme-light body:has(.feed-page) #main-content,
html.theme-light body:has(.vk-feed-page) .main-content,
html.theme-light body:has(.vk-feed-page) #main-content,
html.theme-light body:has(.forum-topic-page) .main-content,
html.theme-light body:has(.forum-topic-page) #main-content,
body.theme-light:has(.p2p-page) .main-content,
body.theme-light:has(.p2p-page) #main-content,
body.theme-light:has(.listings-page) .main-content,
body.theme-light:has(.listings-page) #main-content,
body.theme-light:has(.disputes-v2) .main-content,
body.theme-light:has(.disputes-v2) #main-content,
body.theme-light:has(.feed-page) .main-content,
body.theme-light:has(.feed-page) #main-content,
body.theme-light:has(.vk-feed-page) .main-content,
body.theme-light:has(.vk-feed-page) #main-content,
body.theme-light:has(.forum-topic-page) .main-content,
body.theme-light:has(.forum-topic-page) #main-content,
body.light-theme:has(.p2p-page) .main-content,
body.light-theme:has(.p2p-page) #main-content,
body.light-theme:has(.listings-page) .main-content,
body.light-theme:has(.listings-page) #main-content,
body.light-theme:has(.disputes-v2) .main-content,
body.light-theme:has(.disputes-v2) #main-content,
body.light-theme:has(.feed-page) .main-content,
body.light-theme:has(.feed-page) #main-content,
body.light-theme:has(.vk-feed-page) .main-content,
body.light-theme:has(.vk-feed-page) #main-content,
body.light-theme:has(.forum-topic-page) .main-content,
body.light-theme:has(.forum-topic-page) #main-content,
.theme-light body:has(.p2p-page) .main-content,
.theme-light body:has(.p2p-page) #main-content,
.theme-light body:has(.listings-page) .main-content,
.theme-light body:has(.listings-page) #main-content,
.theme-light body:has(.disputes-v2) .main-content,
.theme-light body:has(.disputes-v2) #main-content,
.theme-light body:has(.feed-page) .main-content,
.theme-light body:has(.feed-page) #main-content,
.theme-light body:has(.vk-feed-page) .main-content,
.theme-light body:has(.vk-feed-page) #main-content,
.theme-light body:has(.forum-topic-page) .main-content,
.theme-light body:has(.forum-topic-page) #main-content,
[data-theme="light"] body:has(.p2p-page) .main-content,
[data-theme="light"] body:has(.p2p-page) #main-content,
[data-theme="light"] body:has(.listings-page) .main-content,
[data-theme="light"] body:has(.listings-page) #main-content,
[data-theme="light"] body:has(.disputes-v2) .main-content,
[data-theme="light"] body:has(.disputes-v2) #main-content,
[data-theme="light"] body:has(.feed-page) .main-content,
[data-theme="light"] body:has(.feed-page) #main-content,
[data-theme="light"] body:has(.vk-feed-page) .main-content,
[data-theme="light"] body:has(.vk-feed-page) #main-content,
[data-theme="light"] body:has(.forum-topic-page) .main-content,
[data-theme="light"] body:has(.forum-topic-page) #main-content {
    background-color: #dfe7fb !important;
    background-image:
        linear-gradient(180deg, rgba(255,255,255,.42), rgba(255,255,255,.22)),
        url('./assets/chat-pattern-premium.webp') !important;
    background-repeat: repeat !important;
    background-size: 980px 980px !important;
    background-position: center top !important;
}

/* Route content should be transparent only as a page shell.
   Internal cards/filters keep their original pre-wallpaper styles. */
body:has(.p2p-page) .page-content,
body:has(.listings-page) .page-content,
body:has(.disputes-v2) .page-content,
body:has(.feed-page) .page-content,
body:has(.vk-feed-page) .page-content,
body:has(.forum-topic-page) .page-content,
.page-content:has(.p2p-page),
.page-content:has(.listings-page),
.page-content:has(.disputes-v2),
.page-content:has(.feed-page),
.page-content:has(.vk-feed-page),
.page-content:has(.forum-topic-page),
#page-content:has(.p2p-page),
#page-content:has(.listings-page),
#page-content:has(.disputes-v2),
#page-content:has(.feed-page),
#page-content:has(.vk-feed-page),
#page-content:has(.forum-topic-page) {
    min-height: 100dvh !important;
    background: transparent !important;
    background-image: none !important;
    background-color: transparent !important;
}

/* 2) Undo wallpaper patch broad stacking that broke side swipe/delete overlays.
   Keep the elements' normal layout, just stop forced z-index from winning. */
.p2p-page > *,
.p2p-page .p2p-hero,
.p2p-page .p2p-panel,
.p2p-page .p2p-offer-card,
.p2p-page .p2p-order-card,
.p2p-page .p2p-empty,
.p2p-page .p2p-flow-list div,
.p2p-page .p2p-offer-stats div,
.p2p-page .p2p-payment-box,
.p2p-page .p2p-receipts,
.p2p-page .p2p-order-chat,
.p2p-page button,
.p2p-page a,
.p2p-page input,
.p2p-page select,
.p2p-page textarea,
.listings-page .glass:not(:has(:is(.listings-search-suggestions, .listings-filter-location-suggestions):not([hidden]))),
.listings-page .listings-toolbar:not(:has(:is(.listings-search-suggestions, .listings-filter-location-suggestions):not([hidden]))),
.listings-page .listings-advanced-filters:not(:has(.listings-filter-location-suggestions:not([hidden]))),
.listings-page .listings-active-filters,
.listings-page .listings-section-head,
.listings-page .listings-mine-status-row,
.listings-page .listing-card,
.listings-page .listing-card-new,
.listings-page .listing-details-panel,
.listings-page .listing-detail,
.listings-page .listings-empty,
.listings-page .empty-state,
.listings-page .listings-pagination-host,
.listings-page .listings-map-panel,
.listings-page .listings-map-list,
.listings-page .listings-leaflet-panel,
.disputes-v2 > *,
.disputes-v2 .glass,
.disputes-v2 .disputes-hero,
.disputes-v2 .disputes-kpi-card,
.disputes-v2 .disputes-shell,
.disputes-v2 .dispute-card-v2,
.disputes-v2 .dispute-details-card,
.disputes-v2 .dispute-details-empty,
.feed-page > :not(.feed-scroll-nav),
.vk-feed-page > :not(.feed-scroll-nav),
.forum-topic-page > * {
    z-index: auto !important;
}

/* 3) Do not force internal backgrounds. Remove the most aggressive later overrides by
   returning inner surfaces to project variables instead of wallpaper-specific colors. */
html.theme-light .p2p-page .p2p-hero,
html.theme-light .p2p-page .p2p-panel,
html.theme-light .p2p-page .p2p-payment-box,
html.theme-light .p2p-page .p2p-receipts,
html.theme-light .p2p-page .p2p-order-chat,
html.theme-light .p2p-page .p2p-dispute-box,
body.theme-light .p2p-page .p2p-hero,
body.theme-light .p2p-page .p2p-panel,
body.theme-light .p2p-page .p2p-payment-box,
body.theme-light .p2p-page .p2p-receipts,
body.theme-light .p2p-page .p2p-order-chat,
body.theme-light .p2p-page .p2p-dispute-box,
body.light-theme .p2p-page .p2p-hero,
body.light-theme .p2p-page .p2p-panel,
body.light-theme .p2p-page .p2p-payment-box,
body.light-theme .p2p-page .p2p-receipts,
body.light-theme .p2p-page .p2p-order-chat,
body.light-theme .p2p-page .p2p-dispute-box,
.theme-light .p2p-page .p2p-hero,
.theme-light .p2p-page .p2p-panel,
.theme-light .p2p-page .p2p-payment-box,
.theme-light .p2p-page .p2p-receipts,
.theme-light .p2p-page .p2p-order-chat,
.theme-light .p2p-page .p2p-dispute-box,
[data-theme="light"] .p2p-page .p2p-hero,
[data-theme="light"] .p2p-page .p2p-panel,
[data-theme="light"] .p2p-page .p2p-payment-box,
[data-theme="light"] .p2p-page .p2p-receipts,
[data-theme="light"] .p2p-page .p2p-order-chat,
[data-theme="light"] .p2p-page .p2p-dispute-box {
    background: var(--card-bg, rgba(255,255,255,.86)) !important;
    border-color: var(--border, rgba(148,163,184,.18)) !important;
    color: var(--text-primary, #0f172a) !important;
}

/* Listings: do not create extra tinted/transparent areas under active filters;
   keep these blocks as normal cards/surfaces. */
html.theme-light .listings-page .listings-active-filters,
html.theme-light .listings-page .listings-section-head,
html.theme-light .listings-page .listings-view-tabs,
html.theme-light .listings-page .listings-empty,
body.theme-light .listings-page .listings-active-filters,
body.theme-light .listings-page .listings-section-head,
body.theme-light .listings-page .listings-view-tabs,
body.theme-light .listings-page .listings-empty,
body.light-theme .listings-page .listings-active-filters,
body.light-theme .listings-page .listings-section-head,
body.light-theme .listings-page .listings-view-tabs,
body.light-theme .listings-page .listings-empty,
.theme-light .listings-page .listings-active-filters,
.theme-light .listings-page .listings-section-head,
.theme-light .listings-page .listings-view-tabs,
.theme-light .listings-page .listings-empty,
[data-theme="light"] .listings-page .listings-active-filters,
[data-theme="light"] .listings-page .listings-section-head,
[data-theme="light"] .listings-page .listings-view-tabs,
[data-theme="light"] .listings-page .listings-empty {
    background: var(--card-bg, rgba(255,255,255,.86)) !important;
    border-color: var(--border, rgba(148,163,184,.18)) !important;
}

/* Forum topic: keep only the actual content cards light; remove dark frame/outline around the whole topic page. */
html.theme-light .forum-topic-page,
body.theme-light .forum-topic-page,
body.light-theme .forum-topic-page,
.theme-light .forum-topic-page,
[data-theme="light"] .forum-topic-page {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
}

html.theme-light .forum-topic-view,
html.theme-light .forum-replies-list,
body.theme-light .forum-topic-view,
body.theme-light .forum-replies-list,
body.light-theme .forum-topic-view,
body.light-theme .forum-replies-list,
.theme-light .forum-topic-view,
.theme-light .forum-replies-list,
[data-theme="light"] .forum-topic-view,
[data-theme="light"] .forum-replies-list {
    background: var(--card-bg, rgba(255,255,255,.88)) !important;
    border-color: var(--border, rgba(148,163,184,.18)) !important;
    color: var(--text-primary, #0f172a) !important;
}

/* The reply editor should be a normal light input, not the old dark area. */
html.theme-light .forum-reply-form,
body.theme-light .forum-reply-form,
body.light-theme .forum-reply-form,
.theme-light .forum-reply-form,
[data-theme="light"] .forum-reply-form {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
}

html.theme-light .forum-reply-form textarea,
body.theme-light .forum-reply-form textarea,
body.light-theme .forum-reply-form textarea,
.theme-light .forum-reply-form textarea,
[data-theme="light"] .forum-reply-form textarea {
    background: var(--input-bg, rgba(255,255,255,.92)) !important;
    color: var(--text-primary, #0f172a) !important;
    border-color: var(--border, rgba(148,163,184,.22)) !important;
}

@media (max-width: 1024px) {
    body:has(.p2p-page) .main-content,
    body:has(.listings-page) .main-content,
    body:has(.disputes-v2) .main-content,
    body:has(.feed-page) .main-content,
    body:has(.vk-feed-page) .main-content,
    body:has(.forum-topic-page) .main-content,
    #main-content:has(.p2p-page),
    #main-content:has(.listings-page),
    #main-content:has(.disputes-v2),
    #main-content:has(.feed-page),
    #main-content:has(.vk-feed-page),
    #main-content:has(.forum-topic-page) {
        background-image:
            linear-gradient(180deg, rgba(7,10,22,.10), rgba(7,10,22,.20)),
            url('./assets/chat-pattern-premium-mobile.webp') !important;
        background-size: min(720px,118vw) min(720px,118vw) !important;
    }

    html.theme-light body:has(.p2p-page) .main-content,
    html.theme-light body:has(.p2p-page) #main-content,
    html.theme-light body:has(.listings-page) .main-content,
    html.theme-light body:has(.listings-page) #main-content,
    html.theme-light body:has(.disputes-v2) .main-content,
    html.theme-light body:has(.disputes-v2) #main-content,
    html.theme-light body:has(.feed-page) .main-content,
    html.theme-light body:has(.feed-page) #main-content,
    html.theme-light body:has(.vk-feed-page) .main-content,
    html.theme-light body:has(.vk-feed-page) #main-content,
    html.theme-light body:has(.forum-topic-page) .main-content,
    html.theme-light body:has(.forum-topic-page) #main-content,
    body.theme-light:has(.p2p-page) .main-content,
    body.theme-light:has(.p2p-page) #main-content,
    body.theme-light:has(.listings-page) .main-content,
    body.theme-light:has(.listings-page) #main-content,
    body.theme-light:has(.disputes-v2) .main-content,
    body.theme-light:has(.disputes-v2) #main-content,
    body.theme-light:has(.feed-page) .main-content,
    body.theme-light:has(.feed-page) #main-content,
    body.theme-light:has(.vk-feed-page) .main-content,
    body.theme-light:has(.vk-feed-page) #main-content,
    body.theme-light:has(.forum-topic-page) .main-content,
    body.theme-light:has(.forum-topic-page) #main-content,
    body.light-theme:has(.p2p-page) .main-content,
    body.light-theme:has(.p2p-page) #main-content,
    body.light-theme:has(.listings-page) .main-content,
    body.light-theme:has(.listings-page) #main-content,
    body.light-theme:has(.disputes-v2) .main-content,
    body.light-theme:has(.disputes-v2) #main-content,
    body.light-theme:has(.feed-page) .main-content,
    body.light-theme:has(.feed-page) #main-content,
    body.light-theme:has(.vk-feed-page) .main-content,
    body.light-theme:has(.vk-feed-page) #main-content,
    body.light-theme:has(.forum-topic-page) .main-content,
    body.light-theme:has(.forum-topic-page) #main-content,
    .theme-light body:has(.p2p-page) .main-content,
    .theme-light body:has(.p2p-page) #main-content,
    .theme-light body:has(.listings-page) .main-content,
    .theme-light body:has(.listings-page) #main-content,
    .theme-light body:has(.disputes-v2) .main-content,
    .theme-light body:has(.disputes-v2) #main-content,
    .theme-light body:has(.feed-page) .main-content,
    .theme-light body:has(.feed-page) #main-content,
    .theme-light body:has(.vk-feed-page) .main-content,
    .theme-light body:has(.vk-feed-page) #main-content,
    .theme-light body:has(.forum-topic-page) .main-content,
    .theme-light body:has(.forum-topic-page) #main-content,
    [data-theme="light"] body:has(.p2p-page) .main-content,
    [data-theme="light"] body:has(.p2p-page) #main-content,
    [data-theme="light"] body:has(.listings-page) .main-content,
    [data-theme="light"] body:has(.listings-page) #main-content,
    [data-theme="light"] body:has(.disputes-v2) .main-content,
    [data-theme="light"] body:has(.disputes-v2) #main-content,
    [data-theme="light"] body:has(.feed-page) .main-content,
    [data-theme="light"] body:has(.feed-page) #main-content,
    [data-theme="light"] body:has(.vk-feed-page) .main-content,
    [data-theme="light"] body:has(.vk-feed-page) #main-content,
    [data-theme="light"] body:has(.forum-topic-page) .main-content,
    [data-theme="light"] body:has(.forum-topic-page) #main-content {
        background-image:
            linear-gradient(180deg, rgba(255,255,255,.46), rgba(255,255,255,.26)),
            url('./assets/chat-pattern-premium-mobile.webp') !important;
        background-size: min(720px,118vw) min(720px,118vw) !important;
    }
}


/* === Stage 161: rollback internal style damage, keep wallpaper only ===
   CSS-only.
   This does NOT touch JS/API/data/modals.
   It fixes the three regressions from wallpaper overrides:
   1) Listings: remove the accidental wide translucent strips under filter chips / tabs.
   2) Forum topic: remove the dark discussion frame; keep replies/cards readable.
   3) P2P archive: restore delete/trash reveal geometry to the original side rail. */

/* 1) Listings: these rows are layout containers, not cards. They must not have their own surface. */
html.theme-light .listings-page .listings-active-filters,
html.theme-light .listings-page .listings-section-head,
html.theme-light .listings-page .listings-head-actions,
html.theme-light .listings-page .listings-mode-tabs,
body.theme-light .listings-page .listings-active-filters,
body.theme-light .listings-page .listings-section-head,
body.theme-light .listings-page .listings-head-actions,
body.theme-light .listings-page .listings-mode-tabs,
body.light-theme .listings-page .listings-active-filters,
body.light-theme .listings-page .listings-section-head,
body.light-theme .listings-page .listings-head-actions,
body.light-theme .listings-page .listings-mode-tabs,
.theme-light .listings-page .listings-active-filters,
.theme-light .listings-page .listings-section-head,
.theme-light .listings-page .listings-head-actions,
.theme-light .listings-page .listings-mode-tabs,
[data-theme="light"] .listings-page .listings-active-filters,
[data-theme="light"] .listings-page .listings-section-head,
[data-theme="light"] .listings-page .listings-head-actions,
[data-theme="light"] .listings-page .listings-mode-tabs {
    background: transparent !important;
    background-image: none !important;
    border-color: transparent !important;
    box-shadow: none !important;
}

html.theme-light .listings-page .listings-section-head,
body.theme-light .listings-page .listings-section-head,
body.light-theme .listings-page .listings-section-head,
.theme-light .listings-page .listings-section-head,
[data-theme="light"] .listings-page .listings-section-head {
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* The empty state is the real card; keep it readable but do not stretch a fake strip above it. */
html.theme-light .listings-page .listings-empty,
body.theme-light .listings-page .listings-empty,
body.light-theme .listings-page .listings-empty,
.theme-light .listings-page .listings-empty,
[data-theme="light"] .listings-page .listings-empty {
    background: rgba(255,255,255,.88) !important;
    border-color: rgba(148,163,184,.20) !important;
}

/* 2) Opened forum topic: discussion wrappers are containers, not dark cards. */
html.theme-light .forum-topic-page,
html.theme-light .forum-topic-view,
html.theme-light .forum-replies-list,
body.theme-light .forum-topic-page,
body.theme-light .forum-topic-view,
body.theme-light .forum-replies-list,
body.light-theme .forum-topic-page,
body.light-theme .forum-topic-view,
body.light-theme .forum-replies-list,
.theme-light .forum-topic-page,
.theme-light .forum-topic-view,
.theme-light .forum-replies-list,
[data-theme="light"] .forum-topic-page,
[data-theme="light"] .forum-topic-view,
[data-theme="light"] .forum-replies-list {
    background: transparent !important;
    background-image: none !important;
    border: 0 !important;
    box-shadow: none !important;
}

/* Only the actual topic post and reply items remain card-like. */
html.theme-light .forum-topic-card,
html.theme-light .forum-reply,
body.theme-light .forum-topic-card,
body.theme-light .forum-reply,
body.light-theme .forum-topic-card,
body.light-theme .forum-reply,
.theme-light .forum-topic-card,
.theme-light .forum-reply,
[data-theme="light"] .forum-topic-card,
[data-theme="light"] .forum-reply {
    background: rgba(255,255,255,.92) !important;
    border: 1px solid rgba(148,163,184,.20) !important;
    box-shadow: 0 12px 34px rgba(15,23,42,.06) !important;
    color: #0f172a !important;
}

/* Reply form container should not be a dark block. The textarea itself stays a normal input. */
html.theme-light .forum-reply-form,
body.theme-light .forum-reply-form,
body.light-theme .forum-reply-form,
.theme-light .forum-reply-form,
[data-theme="light"] .forum-reply-form {
    background: transparent !important;
    background-image: none !important;
    border: 0 !important;
    box-shadow: none !important;
}

html.theme-light .forum-reply-form textarea,
body.theme-light .forum-reply-form textarea,
body.light-theme .forum-reply-form textarea,
.theme-light .forum-reply-form textarea,
[data-theme="light"] .forum-reply-form textarea {
    background: rgba(255,255,255,.92) !important;
    border: 1px solid rgba(148,163,184,.24) !important;
    color: #0f172a !important;
}

/* 3) P2P archived order swipe: restore side-rail geometry and original visual behavior. */
.p2p-page .p2p-order-swipe {
    position: relative !important;
    overflow: hidden !important;
    border-radius: 18px !important;
    isolation: isolate !important;
    touch-action: pan-y !important;
}

.p2p-page .p2p-order-swipe .p2p-order-summary {
    position: relative !important;
    z-index: 2 !important;
    width: 100% !important;
    transform: translateX(0) !important;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease !important;
    will-change: transform !important;
}

.p2p-page .p2p-order-delete {
    position: absolute !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: auto !important;
    width: 68px !important;
    height: auto !important;
    min-height: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: 0 !important;
    border-radius: 0 18px 18px 0 !important;
    z-index: 1 !important;
    color: #fff !important;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 54%, #991b1b 100%) !important;
    box-shadow: inset 1px 0 0 rgba(255,255,255,.14), 0 14px 30px rgba(239,68,68,.22) !important;
    transform: translateX(100%) !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transition: transform .18s ease, opacity .18s ease, filter .18s ease !important;
}

.p2p-page .p2p-order-swipe.is-revealed .p2p-order-summary {
    transform: translateX(-68px) !important;
}

.p2p-page .p2p-order-swipe.is-revealed .p2p-order-delete {
    transform: translateX(0) !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

@media (hover: hover) and (pointer: fine) {
    .p2p-page .p2p-order-swipe:hover .p2p-order-summary,
    .p2p-page .p2p-order-swipe:focus-within .p2p-order-summary {
        transform: translateX(-68px) !important;
    }

    .p2p-page .p2p-order-swipe:hover .p2p-order-delete,
    .p2p-page .p2p-order-swipe:focus-within .p2p-order-delete {
        transform: translateX(0) !important;
        opacity: 1 !important;
        pointer-events: auto !important;
    }
}

@media (max-width: 680px) {
    .p2p-page .p2p-order-delete {
        width: 62px !important;
    }

    .p2p-page .p2p-order-swipe.is-revealed .p2p-order-summary {
        transform: translateX(-62px) !important;
    }
}

/* Keep wallpaper strictly on page background. Inner cards and buttons must remain clickable normally. */
.listings-page,
.p2p-page,
.disputes-v2,
.feed-page,
.vk-feed-page,
.forum-topic-page {
    position: relative !important;
}


/* === Stage 162: feed opened topic light surface fix ===
   CSS-only. Touches ONLY opened forum topic/feed discussion surfaces.
   Fixes dark "Обсуждение" wrapper and dull reply cards on light theme.
   Does not touch P2P/listings/disputes/cards/swipes/buttons/JS/API. */

html.theme-light .forum-topic-page .forum-replies-card,
body.theme-light .forum-topic-page .forum-replies-card,
body.light-theme .forum-topic-page .forum-replies-card,
.theme-light .forum-topic-page .forum-replies-card,
[data-theme="light"] .forum-topic-page .forum-replies-card {
    background: rgba(255,255,255,.94) !important;
    background-image: none !important;
    border: 1px solid rgba(148,163,184,.22) !important;
    box-shadow: 0 14px 38px rgba(15,23,42,.07) !important;
    color: #0f172a !important;
    backdrop-filter: blur(12px) saturate(120%) !important;
    -webkit-backdrop-filter: blur(12px) saturate(120%) !important;
}

html.theme-light .forum-topic-page .forum-replies-card h2,
html.theme-light .forum-topic-page .forum-replies-card h3,
html.theme-light .forum-topic-page .forum-replies-card > b,
body.theme-light .forum-topic-page .forum-replies-card h2,
body.theme-light .forum-topic-page .forum-replies-card h3,
body.theme-light .forum-topic-page .forum-replies-card > b,
body.light-theme .forum-topic-page .forum-replies-card h2,
body.light-theme .forum-topic-page .forum-replies-card h3,
body.light-theme .forum-topic-page .forum-replies-card > b,
.theme-light .forum-topic-page .forum-replies-card h2,
.theme-light .forum-topic-page .forum-replies-card h3,
.theme-light .forum-topic-page .forum-replies-card > b,
[data-theme="light"] .forum-topic-page .forum-replies-card h2,
[data-theme="light"] .forum-topic-page .forum-replies-card h3,
[data-theme="light"] .forum-topic-page .forum-replies-card > b {
    color: #0f172a !important;
}

html.theme-light .forum-topic-page .forum-replies-card .forum-topic-meta,
html.theme-light .forum-topic-page .forum-replies-card .forum-topic-meta *,
html.theme-light .forum-topic-page .forum-replies-card .forum-reply-head span,
body.theme-light .forum-topic-page .forum-replies-card .forum-topic-meta,
body.theme-light .forum-topic-page .forum-replies-card .forum-topic-meta *,
body.theme-light .forum-topic-page .forum-replies-card .forum-reply-head span,
body.light-theme .forum-topic-page .forum-replies-card .forum-topic-meta,
body.light-theme .forum-topic-page .forum-replies-card .forum-topic-meta *,
body.light-theme .forum-topic-page .forum-replies-card .forum-reply-head span,
.theme-light .forum-topic-page .forum-replies-card .forum-topic-meta,
.theme-light .forum-topic-page .forum-replies-card .forum-topic-meta *,
.theme-light .forum-topic-page .forum-replies-card .forum-reply-head span,
[data-theme="light"] .forum-topic-page .forum-replies-card .forum-topic-meta,
[data-theme="light"] .forum-topic-page .forum-replies-card .forum-topic-meta *,
[data-theme="light"] .forum-topic-page .forum-replies-card .forum-reply-head span {
    color: #475569 !important;
}

/* Actual replies: make them clean white cards again, not grey/dull blocks. */
html.theme-light .forum-topic-page .forum-replies-card .forum-reply,
body.theme-light .forum-topic-page .forum-replies-card .forum-reply,
body.light-theme .forum-topic-page .forum-replies-card .forum-reply,
.theme-light .forum-topic-page .forum-replies-card .forum-reply,
[data-theme="light"] .forum-topic-page .forum-replies-card .forum-reply {
    background: rgba(255,255,255,.98) !important;
    background-image: none !important;
    border: 1px solid rgba(148,163,184,.16) !important;
    box-shadow: 0 8px 24px rgba(15,23,42,.045) !important;
    color: #0f172a !important;
}

/* Quoted/reply preview inside a reply should stay lightly blue, not washed grey. */
html.theme-light .forum-topic-page .forum-replies-card .forum-reply .reply-preview,
html.theme-light .forum-topic-page .forum-replies-card .forum-reply .feed-reply-preview,
html.theme-light .forum-topic-page .forum-replies-card .forum-reply .quoted-message,
body.theme-light .forum-topic-page .forum-replies-card .forum-reply .reply-preview,
body.theme-light .forum-topic-page .forum-replies-card .forum-reply .feed-reply-preview,
body.theme-light .forum-topic-page .forum-replies-card .forum-reply .quoted-message,
body.light-theme .forum-topic-page .forum-replies-card .forum-reply .reply-preview,
body.light-theme .forum-topic-page .forum-replies-card .forum-reply .feed-reply-preview,
body.light-theme .forum-topic-page .forum-replies-card .forum-reply .quoted-message,
.theme-light .forum-topic-page .forum-replies-card .forum-reply .reply-preview,
.theme-light .forum-topic-page .forum-replies-card .forum-reply .feed-reply-preview,
.theme-light .forum-topic-page .forum-replies-card .forum-reply .quoted-message,
[data-theme="light"] .forum-topic-page .forum-replies-card .forum-reply .reply-preview,
[data-theme="light"] .forum-topic-page .forum-replies-card .forum-reply .feed-reply-preview,
[data-theme="light"] .forum-topic-page .forum-replies-card .forum-reply .quoted-message {
    background: rgba(239,246,255,.88) !important;
    border-color: rgba(96,165,250,.22) !important;
    color: #1e3a8a !important;
}

html.theme-light .forum-topic-page .forum-replies-card .forum-reply-text,
html.theme-light .forum-topic-page .forum-replies-card .forum-reply-body,
body.theme-light .forum-topic-page .forum-replies-card .forum-reply-text,
body.theme-light .forum-topic-page .forum-replies-card .forum-reply-body,
body.light-theme .forum-topic-page .forum-replies-card .forum-reply-text,
body.light-theme .forum-topic-page .forum-replies-card .forum-reply-body,
.theme-light .forum-topic-page .forum-replies-card .forum-reply-text,
.theme-light .forum-topic-page .forum-replies-card .forum-reply-body,
[data-theme="light"] .forum-topic-page .forum-replies-card .forum-reply-text,
[data-theme="light"] .forum-topic-page .forum-replies-card .forum-reply-body {
    color: #0f172a !important;
}

/* Reply editor at the bottom of the discussion: light input, no dark frame. */
html.theme-light .forum-topic-page .forum-replies-card .forum-reply-form,
body.theme-light .forum-topic-page .forum-replies-card .forum-reply-form,
body.light-theme .forum-topic-page .forum-replies-card .forum-reply-form,
.theme-light .forum-topic-page .forum-replies-card .forum-reply-form,
[data-theme="light"] .forum-topic-page .forum-replies-card .forum-reply-form {
    background: transparent !important;
    background-image: none !important;
    border: 0 !important;
    box-shadow: none !important;
}

html.theme-light .forum-topic-page .forum-replies-card .forum-reply-form textarea,
body.theme-light .forum-topic-page .forum-replies-card .forum-reply-form textarea,
body.light-theme .forum-topic-page .forum-replies-card .forum-reply-form textarea,
.theme-light .forum-topic-page .forum-replies-card .forum-reply-form textarea,
[data-theme="light"] .forum-topic-page .forum-replies-card .forum-reply-form textarea {
    background: rgba(255,255,255,.96) !important;
    border: 1px solid rgba(148,163,184,.24) !important;
    color: #0f172a !important;
}

/* Keep the page wallpaper visible only behind the content, not as dark border inside the discussion. */
html.theme-light .forum-topic-page .forum-topic-view,
html.theme-light .forum-topic-page .forum-replies-list,
body.theme-light .forum-topic-page .forum-topic-view,
body.theme-light .forum-topic-page .forum-replies-list,
body.light-theme .forum-topic-page .forum-topic-view,
body.light-theme .forum-topic-page .forum-replies-list,
.theme-light .forum-topic-page .forum-topic-view,
.theme-light .forum-topic-page .forum-replies-list,
[data-theme="light"] .forum-topic-page .forum-topic-view,
[data-theme="light"] .forum-topic-page .forum-replies-list {
    background: transparent !important;
    background-image: none !important;
    border-color: transparent !important;
    box-shadow: none !important;
}


/* === Stage 163: notifications page premium wallpaper, page-level only ===
   CSS-only. No JS/API changes. No internal card/button/switch/modal styling.
   Wallpaper is applied only behind the notifications page content. */

/* Notifications route/page background on dark/glass themes. */


/* The route shell itself is transparent, so the wallpaper is behind the page,
   not duplicated inside cards/settings/list blocks. */


/* Keep page containers transparent only. Do not alter inner cards or controls. */


/* Light theme: same soft bluish wallpaper tone as chats/deals/wallet. */


@media (max-width: 1024px) {
    

    

    
}


/* === Stage 164: notifications light theme action buttons contrast ===
   CSS-only. Touches only action buttons on the notifications page.
   No JS/API, no notification cards, no switches, no modals. */



/* Preserve the main purple action button as primary, only strengthen its text/shadow. */


/* Direct fallback by visible button/link titles if classes differ. */



/* === Stage 165: profile page premium wallpaper, PAGE-LEVEL ONLY ===
   Package 173 (owner 2026-10-20): another person's short page (.profile-mini)
   sits on the plain background of «Меню», so its cards look like the menu's.
   STRICT CSS-only background patch.
   Do NOT touch profile cards, wall posts, photos, stories, tabs, buttons, modals, z-index, JS or API.
   The wallpaper is applied only to the outer page/main container behind profile content. */

/* Dark / glass profile page wallpaper. */
body:has(.profile-page:not(.profile-mini)) .main-content,
.app:has(.profile-page:not(.profile-mini)) .main-content,
#main-content:has(.profile-page:not(.profile-mini)),
body:has(.profile-page-new) .main-content,
.app:has(.profile-page-new) .main-content,
#main-content:has(.profile-page-new),
body:has(.profile-view) .main-content,
.app:has(.profile-view) .main-content,
#main-content:has(.profile-view),
body:has(.profile-shell) .main-content,
.app:has(.profile-shell) .main-content,
#main-content:has(.profile-shell) {
    background-color: #0b1020 !important;
    background-image:
        linear-gradient(180deg, rgba(7,10,22,.14), rgba(7,10,22,.24)),
        url('./assets/chat-pattern-premium.webp') !important;
    background-repeat: repeat !important;
    background-size: 980px 980px !important;
    background-position: center top !important;
    background-attachment: local !important;
}

/* Route shell transparent only, so wallpaper stays behind the page.
   No internal profile blocks are targeted here. */
body:has(.profile-page:not(.profile-mini)) .page-content,
.page-content:has(.profile-page:not(.profile-mini)),
#page-content:has(.profile-page:not(.profile-mini)),
body:has(.profile-page-new) .page-content,
.page-content:has(.profile-page-new),
#page-content:has(.profile-page-new),
body:has(.profile-view) .page-content,
.page-content:has(.profile-view),
#page-content:has(.profile-view),
body:has(.profile-shell) .page-content,
.page-content:has(.profile-shell),
#page-content:has(.profile-shell) {
    min-height: 100dvh !important;
    background: transparent !important;
    background-image: none !important;
    background-color: transparent !important;
}

/* Only root profile containers are made transparent.
   Cards/posts/tabs/buttons keep their existing CSS untouched. */
.profile-page-new,
.profile-view,
.profile-shell {
    min-height: 100dvh !important;
    background: transparent !important;
    background-image: none !important;
    background-color: transparent !important;
}

/* Light theme profile wallpaper: same soft bluish tone as chats/deals/wallet. */
html.theme-light body:has(.profile-page:not(.profile-mini)) .main-content,
html.theme-light body:has(.profile-page:not(.profile-mini)) #main-content,
body.theme-light:has(.profile-page:not(.profile-mini)) .main-content,
body.theme-light:has(.profile-page:not(.profile-mini)) #main-content,
body.light-theme:has(.profile-page:not(.profile-mini)) .main-content,
body.light-theme:has(.profile-page:not(.profile-mini)) #main-content,
.theme-light body:has(.profile-page:not(.profile-mini)) .main-content,
.theme-light body:has(.profile-page:not(.profile-mini)) #main-content,
[data-theme="light"] body:has(.profile-page:not(.profile-mini)) .main-content,
[data-theme="light"] body:has(.profile-page:not(.profile-mini)) #main-content,
html.theme-light body:has(.profile-page-new) .main-content,
html.theme-light body:has(.profile-page-new) #main-content,
body.theme-light:has(.profile-page-new) .main-content,
body.theme-light:has(.profile-page-new) #main-content,
body.light-theme:has(.profile-page-new) .main-content,
body.light-theme:has(.profile-page-new) #main-content,
.theme-light body:has(.profile-page-new) .main-content,
.theme-light body:has(.profile-page-new) #main-content,
[data-theme="light"] body:has(.profile-page-new) .main-content,
[data-theme="light"] body:has(.profile-page-new) #main-content,
html.theme-light body:has(.profile-view) .main-content,
html.theme-light body:has(.profile-view) #main-content,
body.theme-light:has(.profile-view) .main-content,
body.theme-light:has(.profile-view) #main-content,
body.light-theme:has(.profile-view) .main-content,
body.light-theme:has(.profile-view) #main-content,
.theme-light body:has(.profile-view) .main-content,
.theme-light body:has(.profile-view) #main-content,
[data-theme="light"] body:has(.profile-view) .main-content,
[data-theme="light"] body:has(.profile-view) #main-content,
html.theme-light body:has(.profile-shell) .main-content,
html.theme-light body:has(.profile-shell) #main-content,
body.theme-light:has(.profile-shell) .main-content,
body.theme-light:has(.profile-shell) #main-content,
body.light-theme:has(.profile-shell) .main-content,
body.light-theme:has(.profile-shell) #main-content,
.theme-light body:has(.profile-shell) .main-content,
.theme-light body:has(.profile-shell) #main-content,
[data-theme="light"] body:has(.profile-shell) .main-content,
[data-theme="light"] body:has(.profile-shell) #main-content {
    background-color: #dfe7fb !important;
    background-image:
        linear-gradient(180deg, rgba(255,255,255,.42), rgba(255,255,255,.22)),
        url('./assets/chat-pattern-premium.webp') !important;
    background-repeat: repeat !important;
    background-size: 980px 980px !important;
    background-position: center top !important;
}

@media (max-width: 1024px) {
    body:has(.profile-page:not(.profile-mini)) .main-content,
    .app:has(.profile-page:not(.profile-mini)) .main-content,
    #main-content:has(.profile-page:not(.profile-mini)),
    body:has(.profile-page-new) .main-content,
    .app:has(.profile-page-new) .main-content,
    #main-content:has(.profile-page-new),
    body:has(.profile-view) .main-content,
    .app:has(.profile-view) .main-content,
    #main-content:has(.profile-view),
    body:has(.profile-shell) .main-content,
    .app:has(.profile-shell) .main-content,
    #main-content:has(.profile-shell) {
        background-image:
            linear-gradient(180deg, rgba(7,10,22,.10), rgba(7,10,22,.20)),
            url('./assets/chat-pattern-premium-mobile.webp') !important;
        background-size: min(720px,118vw) min(720px,118vw) !important;
        background-position: center top !important;
    }

    html.theme-light body:has(.profile-page:not(.profile-mini)) .main-content,
    html.theme-light body:has(.profile-page:not(.profile-mini)) #main-content,
    body.theme-light:has(.profile-page:not(.profile-mini)) .main-content,
    body.theme-light:has(.profile-page:not(.profile-mini)) #main-content,
    body.light-theme:has(.profile-page:not(.profile-mini)) .main-content,
    body.light-theme:has(.profile-page:not(.profile-mini)) #main-content,
    .theme-light body:has(.profile-page:not(.profile-mini)) .main-content,
    .theme-light body:has(.profile-page:not(.profile-mini)) #main-content,
    [data-theme="light"] body:has(.profile-page:not(.profile-mini)) .main-content,
    [data-theme="light"] body:has(.profile-page:not(.profile-mini)) #main-content,
    html.theme-light body:has(.profile-page-new) .main-content,
    html.theme-light body:has(.profile-page-new) #main-content,
    body.theme-light:has(.profile-page-new) .main-content,
    body.theme-light:has(.profile-page-new) #main-content,
    body.light-theme:has(.profile-page-new) .main-content,
    body.light-theme:has(.profile-page-new) #main-content,
    .theme-light body:has(.profile-page-new) .main-content,
    .theme-light body:has(.profile-page-new) #main-content,
    [data-theme="light"] body:has(.profile-page-new) .main-content,
    [data-theme="light"] body:has(.profile-page-new) #main-content,
    html.theme-light body:has(.profile-view) .main-content,
    html.theme-light body:has(.profile-view) #main-content,
    body.theme-light:has(.profile-view) .main-content,
    body.theme-light:has(.profile-view) #main-content,
    body.light-theme:has(.profile-view) .main-content,
    body.light-theme:has(.profile-view) #main-content,
    .theme-light body:has(.profile-view) .main-content,
    .theme-light body:has(.profile-view) #main-content,
    [data-theme="light"] body:has(.profile-view) .main-content,
    [data-theme="light"] body:has(.profile-view) #main-content,
    html.theme-light body:has(.profile-shell) .main-content,
    html.theme-light body:has(.profile-shell) #main-content,
    body.theme-light:has(.profile-shell) .main-content,
    body.theme-light:has(.profile-shell) #main-content,
    body.light-theme:has(.profile-shell) .main-content,
    body.light-theme:has(.profile-shell) #main-content,
    .theme-light body:has(.profile-shell) .main-content,
    .theme-light body:has(.profile-shell) #main-content,
    [data-theme="light"] body:has(.profile-shell) .main-content,
    [data-theme="light"] body:has(.profile-shell) #main-content {
        background-color: #dfe7fb !important;
        background-image:
            linear-gradient(180deg, rgba(255,255,255,.46), rgba(255,255,255,.26)),
            url('./assets/chat-pattern-premium-mobile.webp') !important;
        background-size: min(720px,118vw) min(720px,118vw) !important;
        background-position: center top !important;
    }

    .profile-page-new,
.profile-view,
.profile-shell {
        padding-bottom: max(104px, calc(env(safe-area-inset-bottom) + 86px)) !important;
    }
}


/* === Stage 166: security page premium wallpaper, PAGE-LEVEL ONLY ===
   STRICT CSS-only background patch.
   Do NOT touch security cards, session rows, forms, buttons, modals, 2FA/reauth UI, z-index, JS or API.
   Wallpaper is applied only to the outer page/main container behind security content. */

/* Dark / glass security page wallpaper. */
body:has(.security-page) .main-content,
.app:has(.security-page) .main-content,
#main-content:has(.security-page),
body:has(.security-page-new) .main-content,
.app:has(.security-page-new) .main-content,
#main-content:has(.security-page-new),
body:has(.security-shell) .main-content,
.app:has(.security-shell) .main-content,
#main-content:has(.security-shell),
body:has(.security-center) .main-content,
.app:has(.security-center) .main-content,
#main-content:has(.security-center),
body:has(.sessions-page) .main-content,
.app:has(.sessions-page) .main-content,
#main-content:has(.sessions-page) {
    background-color: #0b1020 !important;
    background-image:
        linear-gradient(180deg, rgba(7,10,22,.14), rgba(7,10,22,.24)),
        url('./assets/chat-pattern-premium.webp') !important;
    background-repeat: repeat !important;
    background-size: 980px 980px !important;
    background-position: center top !important;
    background-attachment: local !important;
}

/* Only the route shell is transparent. Internal security blocks keep their existing styles. */
body:has(.security-page) .page-content,
.page-content:has(.security-page),
#page-content:has(.security-page),
body:has(.security-page-new) .page-content,
.page-content:has(.security-page-new),
#page-content:has(.security-page-new),
body:has(.security-shell) .page-content,
.page-content:has(.security-shell),
#page-content:has(.security-shell),
body:has(.security-center) .page-content,
.page-content:has(.security-center),
#page-content:has(.security-center),
body:has(.sessions-page) .page-content,
.page-content:has(.sessions-page),
#page-content:has(.sessions-page) {
    min-height: 100dvh !important;
    background: transparent !important;
    background-image: none !important;
    background-color: transparent !important;
}

/* Root containers only; no cards/buttons/session rows are targeted. */
.security-page,
.security-page-new,
.security-shell,
.security-center,
.sessions-page {
    min-height: 100dvh !important;
    background: transparent !important;
    background-image: none !important;
    background-color: transparent !important;
}

/* Light theme security wallpaper: soft bluish tone matching chats/deals/wallet. */
html.theme-light body:has(.security-page) .main-content,
html.theme-light body:has(.security-page) #main-content,
body.theme-light:has(.security-page) .main-content,
body.theme-light:has(.security-page) #main-content,
body.light-theme:has(.security-page) .main-content,
body.light-theme:has(.security-page) #main-content,
.theme-light body:has(.security-page) .main-content,
.theme-light body:has(.security-page) #main-content,
[data-theme="light"] body:has(.security-page) .main-content,
[data-theme="light"] body:has(.security-page) #main-content,
html.theme-light body:has(.security-page-new) .main-content,
html.theme-light body:has(.security-page-new) #main-content,
body.theme-light:has(.security-page-new) .main-content,
body.theme-light:has(.security-page-new) #main-content,
body.light-theme:has(.security-page-new) .main-content,
body.light-theme:has(.security-page-new) #main-content,
.theme-light body:has(.security-page-new) .main-content,
.theme-light body:has(.security-page-new) #main-content,
[data-theme="light"] body:has(.security-page-new) .main-content,
[data-theme="light"] body:has(.security-page-new) #main-content,
html.theme-light body:has(.security-shell) .main-content,
html.theme-light body:has(.security-shell) #main-content,
body.theme-light:has(.security-shell) .main-content,
body.theme-light:has(.security-shell) #main-content,
body.light-theme:has(.security-shell) .main-content,
body.light-theme:has(.security-shell) #main-content,
.theme-light body:has(.security-shell) .main-content,
.theme-light body:has(.security-shell) #main-content,
[data-theme="light"] body:has(.security-shell) .main-content,
[data-theme="light"] body:has(.security-shell) #main-content,
html.theme-light body:has(.security-center) .main-content,
html.theme-light body:has(.security-center) #main-content,
body.theme-light:has(.security-center) .main-content,
body.theme-light:has(.security-center) #main-content,
body.light-theme:has(.security-center) .main-content,
body.light-theme:has(.security-center) #main-content,
.theme-light body:has(.security-center) .main-content,
.theme-light body:has(.security-center) #main-content,
[data-theme="light"] body:has(.security-center) .main-content,
[data-theme="light"] body:has(.security-center) #main-content,
html.theme-light body:has(.sessions-page) .main-content,
html.theme-light body:has(.sessions-page) #main-content,
body.theme-light:has(.sessions-page) .main-content,
body.theme-light:has(.sessions-page) #main-content,
body.light-theme:has(.sessions-page) .main-content,
body.light-theme:has(.sessions-page) #main-content,
.theme-light body:has(.sessions-page) .main-content,
.theme-light body:has(.sessions-page) #main-content,
[data-theme="light"] body:has(.sessions-page) .main-content,
[data-theme="light"] body:has(.sessions-page) #main-content {
    background-color: #dfe7fb !important;
    background-image:
        linear-gradient(180deg, rgba(255,255,255,.42), rgba(255,255,255,.22)),
        url('./assets/chat-pattern-premium.webp') !important;
    background-repeat: repeat !important;
    background-size: 980px 980px !important;
    background-position: center top !important;
}

@media (max-width: 1024px) {
    body:has(.security-page) .main-content,
    .app:has(.security-page) .main-content,
    #main-content:has(.security-page),
    body:has(.security-page-new) .main-content,
    .app:has(.security-page-new) .main-content,
    #main-content:has(.security-page-new),
    body:has(.security-shell) .main-content,
    .app:has(.security-shell) .main-content,
    #main-content:has(.security-shell),
    body:has(.security-center) .main-content,
    .app:has(.security-center) .main-content,
    #main-content:has(.security-center),
    body:has(.sessions-page) .main-content,
    .app:has(.sessions-page) .main-content,
    #main-content:has(.sessions-page) {
        background-image:
            linear-gradient(180deg, rgba(7,10,22,.10), rgba(7,10,22,.20)),
            url('./assets/chat-pattern-premium-mobile.webp') !important;
        background-size: min(720px,118vw) min(720px,118vw) !important;
        background-position: center top !important;
    }

    html.theme-light body:has(.security-page) .main-content,
    html.theme-light body:has(.security-page) #main-content,
    body.theme-light:has(.security-page) .main-content,
    body.theme-light:has(.security-page) #main-content,
    body.light-theme:has(.security-page) .main-content,
    body.light-theme:has(.security-page) #main-content,
    .theme-light body:has(.security-page) .main-content,
    .theme-light body:has(.security-page) #main-content,
    [data-theme="light"] body:has(.security-page) .main-content,
    [data-theme="light"] body:has(.security-page) #main-content,
    html.theme-light body:has(.security-page-new) .main-content,
    html.theme-light body:has(.security-page-new) #main-content,
    body.theme-light:has(.security-page-new) .main-content,
    body.theme-light:has(.security-page-new) #main-content,
    body.light-theme:has(.security-page-new) .main-content,
    body.light-theme:has(.security-page-new) #main-content,
    .theme-light body:has(.security-page-new) .main-content,
    .theme-light body:has(.security-page-new) #main-content,
    [data-theme="light"] body:has(.security-page-new) .main-content,
    [data-theme="light"] body:has(.security-page-new) #main-content,
    html.theme-light body:has(.security-shell) .main-content,
    html.theme-light body:has(.security-shell) #main-content,
    body.theme-light:has(.security-shell) .main-content,
    body.theme-light:has(.security-shell) #main-content,
    body.light-theme:has(.security-shell) .main-content,
    body.light-theme:has(.security-shell) #main-content,
    .theme-light body:has(.security-shell) .main-content,
    .theme-light body:has(.security-shell) #main-content,
    [data-theme="light"] body:has(.security-shell) .main-content,
    [data-theme="light"] body:has(.security-shell) #main-content,
    html.theme-light body:has(.security-center) .main-content,
    html.theme-light body:has(.security-center) #main-content,
    body.theme-light:has(.security-center) .main-content,
    body.theme-light:has(.security-center) #main-content,
    body.light-theme:has(.security-center) .main-content,
    body.light-theme:has(.security-center) #main-content,
    .theme-light body:has(.security-center) .main-content,
    .theme-light body:has(.security-center) #main-content,
    [data-theme="light"] body:has(.security-center) .main-content,
    [data-theme="light"] body:has(.security-center) #main-content,
    html.theme-light body:has(.sessions-page) .main-content,
    html.theme-light body:has(.sessions-page) #main-content,
    body.theme-light:has(.sessions-page) .main-content,
    body.theme-light:has(.sessions-page) #main-content,
    body.light-theme:has(.sessions-page) .main-content,
    body.light-theme:has(.sessions-page) #main-content,
    .theme-light body:has(.sessions-page) .main-content,
    .theme-light body:has(.sessions-page) #main-content,
    [data-theme="light"] body:has(.sessions-page) .main-content,
    [data-theme="light"] body:has(.sessions-page) #main-content {
        background-color: #dfe7fb !important;
        background-image:
            linear-gradient(180deg, rgba(255,255,255,.46), rgba(255,255,255,.26)),
            url('./assets/chat-pattern-premium-mobile.webp') !important;
        background-size: min(720px,118vw) min(720px,118vw) !important;
        background-position: center top !important;
    }

    .security-page,
    .security-page-new,
    .security-shell,
    .security-center,
    .sessions-page {
        padding-bottom: max(104px, calc(env(safe-area-inset-bottom) + 86px)) !important;
    }
}


/* === Stage 167: help center wallpaper, PAGE-LEVEL ONLY ===
   STRICT CSS-only background patch.
   Do NOT touch help cards, article blocks, buttons, modals, support chat logic, z-index, JS or API.
   Wallpaper is applied only to the outer page/main container behind Help Center content.
   The only internal correction is the Help hero light-theme surface, because it was already black/unreadable. */

/* Dark / glass Help Center wallpaper. */
body:has(.help-page) .main-content,
.app:has(.help-page) .main-content,
#main-content:has(.help-page),
body:has(.help-center-page) .main-content,
.app:has(.help-center-page) .main-content,
#main-content:has(.help-center-page),
body:has(.help-center) .main-content,
.app:has(.help-center) .main-content,
#main-content:has(.help-center),
body:has(.help-shell) .main-content,
.app:has(.help-shell) .main-content,
#main-content:has(.help-shell),
body:has(.support-page) .main-content,
.app:has(.support-page) .main-content,
#main-content:has(.support-page) {
    background-color: #0b1020 !important;
    background-image:
        linear-gradient(180deg, rgba(7,10,22,.14), rgba(7,10,22,.24)),
        url('./assets/chat-pattern-premium.webp') !important;
    background-repeat: repeat !important;
    background-size: 980px 980px !important;
    background-position: center top !important;
    background-attachment: local !important;
}

/* Route shell transparent only; all inner help blocks keep their original styling. */
body:has(.help-page) .page-content,
.page-content:has(.help-page),
#page-content:has(.help-page),
body:has(.help-center-page) .page-content,
.page-content:has(.help-center-page),
#page-content:has(.help-center-page),
body:has(.help-center) .page-content,
.page-content:has(.help-center),
#page-content:has(.help-center),
body:has(.help-shell) .page-content,
.page-content:has(.help-shell),
#page-content:has(.help-shell),
body:has(.support-page) .page-content,
.page-content:has(.support-page),
#page-content:has(.support-page) {
    min-height: 100dvh !important;
    background: transparent !important;
    background-image: none !important;
    background-color: transparent !important;
}

/* Root Help containers only. No cards/articles/buttons are targeted here. */
.help-page,
.help-center-page,
.help-center,
.help-shell,
.support-page {
    min-height: 100dvh !important;
    background: transparent !important;
    background-image: none !important;
    background-color: transparent !important;
}

/* Light theme Help Center wallpaper: soft bluish tone matching chats/deals/wallet. */
html.theme-light body:has(.help-page) .main-content,
html.theme-light body:has(.help-page) #main-content,
body.theme-light:has(.help-page) .main-content,
body.theme-light:has(.help-page) #main-content,
body.light-theme:has(.help-page) .main-content,
body.light-theme:has(.help-page) #main-content,
.theme-light body:has(.help-page) .main-content,
.theme-light body:has(.help-page) #main-content,
[data-theme="light"] body:has(.help-page) .main-content,
[data-theme="light"] body:has(.help-page) #main-content,
html.theme-light body:has(.help-center-page) .main-content,
html.theme-light body:has(.help-center-page) #main-content,
body.theme-light:has(.help-center-page) .main-content,
body.theme-light:has(.help-center-page) #main-content,
body.light-theme:has(.help-center-page) .main-content,
body.light-theme:has(.help-center-page) #main-content,
.theme-light body:has(.help-center-page) .main-content,
.theme-light body:has(.help-center-page) #main-content,
[data-theme="light"] body:has(.help-center-page) .main-content,
[data-theme="light"] body:has(.help-center-page) #main-content,
html.theme-light body:has(.help-center) .main-content,
html.theme-light body:has(.help-center) #main-content,
body.theme-light:has(.help-center) .main-content,
body.theme-light:has(.help-center) #main-content,
body.light-theme:has(.help-center) .main-content,
body.light-theme:has(.help-center) #main-content,
.theme-light body:has(.help-center) .main-content,
.theme-light body:has(.help-center) #main-content,
[data-theme="light"] body:has(.help-center) .main-content,
[data-theme="light"] body:has(.help-center) #main-content,
html.theme-light body:has(.help-shell) .main-content,
html.theme-light body:has(.help-shell) #main-content,
body.theme-light:has(.help-shell) .main-content,
body.theme-light:has(.help-shell) #main-content,
body.light-theme:has(.help-shell) .main-content,
body.light-theme:has(.help-shell) #main-content,
.theme-light body:has(.help-shell) .main-content,
.theme-light body:has(.help-shell) #main-content,
[data-theme="light"] body:has(.help-shell) .main-content,
[data-theme="light"] body:has(.help-shell) #main-content,
html.theme-light body:has(.support-page) .main-content,
html.theme-light body:has(.support-page) #main-content,
body.theme-light:has(.support-page) .main-content,
body.theme-light:has(.support-page) #main-content,
body.light-theme:has(.support-page) .main-content,
body.light-theme:has(.support-page) #main-content,
.theme-light body:has(.support-page) .main-content,
.theme-light body:has(.support-page) #main-content,
[data-theme="light"] body:has(.support-page) .main-content,
[data-theme="light"] body:has(.support-page) #main-content {
    background-color: #dfe7fb !important;
    background-image:
        linear-gradient(180deg, rgba(255,255,255,.42), rgba(255,255,255,.22)),
        url('./assets/chat-pattern-premium.webp') !important;
    background-repeat: repeat !important;
    background-size: 980px 980px !important;
    background-position: center top !important;
}

/* Only fix the already-broken black Help hero on light theme.
   This does not alter article/cards/layout. */
html.theme-light .help-page .help-hero,
html.theme-light .help-center-page .help-hero,
html.theme-light .help-center .help-hero,
html.theme-light .help-shell .help-hero,
html.theme-light .support-page .help-hero,
body.theme-light .help-page .help-hero,
body.theme-light .help-center-page .help-hero,
body.theme-light .help-center .help-hero,
body.theme-light .help-shell .help-hero,
body.theme-light .support-page .help-hero,
body.light-theme .help-page .help-hero,
body.light-theme .help-center-page .help-hero,
body.light-theme .help-center .help-hero,
body.light-theme .help-shell .help-hero,
body.light-theme .support-page .help-hero,
.theme-light .help-page .help-hero,
.theme-light .help-center-page .help-hero,
.theme-light .help-center .help-hero,
.theme-light .help-shell .help-hero,
.theme-light .support-page .help-hero,
[data-theme="light"] .help-page .help-hero,
[data-theme="light"] .help-center-page .help-hero,
[data-theme="light"] .help-center .help-hero,
[data-theme="light"] .help-shell .help-hero,
[data-theme="light"] .support-page .help-hero {
    background: rgba(255,255,255,.90) !important;
    background-image:
        radial-gradient(circle at 0% 0%, rgba(139,92,246,.08), transparent 34%),
        linear-gradient(135deg, rgba(255,255,255,.94), rgba(239,246,255,.86)) !important;
    border-color: rgba(148,163,184,.22) !important;
    color: #0f172a !important;
    box-shadow: 0 18px 48px rgba(15,23,42,.08) !important;
}

/* Keep hero text readable on light theme. */
html.theme-light .help-page .help-hero *,
html.theme-light .help-center-page .help-hero *,
html.theme-light .help-center .help-hero *,
html.theme-light .help-shell .help-hero *,
html.theme-light .support-page .help-hero *,
body.theme-light .help-page .help-hero *,
body.theme-light .help-center-page .help-hero *,
body.theme-light .help-center .help-hero *,
body.theme-light .help-shell .help-hero *,
body.theme-light .support-page .help-hero *,
body.light-theme .help-page .help-hero *,
body.light-theme .help-center-page .help-hero *,
body.light-theme .help-center .help-hero *,
body.light-theme .help-shell .help-hero *,
body.light-theme .support-page .help-hero *,
.theme-light .help-page .help-hero *,
.theme-light .help-center-page .help-hero *,
.theme-light .help-center .help-hero *,
.theme-light .help-shell .help-hero *,
.theme-light .support-page .help-hero *,
[data-theme="light"] .help-page .help-hero *,
[data-theme="light"] .help-center-page .help-hero *,
[data-theme="light"] .help-center .help-hero *,
[data-theme="light"] .help-shell .help-hero *,
[data-theme="light"] .support-page .help-hero * {
    color: inherit;
}

@media (max-width: 1024px) {
    body:has(.help-page) .main-content,
    .app:has(.help-page) .main-content,
    #main-content:has(.help-page),
    body:has(.help-center-page) .main-content,
    .app:has(.help-center-page) .main-content,
    #main-content:has(.help-center-page),
    body:has(.help-center) .main-content,
    .app:has(.help-center) .main-content,
    #main-content:has(.help-center),
    body:has(.help-shell) .main-content,
    .app:has(.help-shell) .main-content,
    #main-content:has(.help-shell),
    body:has(.support-page) .main-content,
    .app:has(.support-page) .main-content,
    #main-content:has(.support-page) {
        background-image:
            linear-gradient(180deg, rgba(7,10,22,.10), rgba(7,10,22,.20)),
            url('./assets/chat-pattern-premium-mobile.webp') !important;
        background-size: min(720px,118vw) min(720px,118vw) !important;
        background-position: center top !important;
    }

    html.theme-light body:has(.help-page) .main-content,
    html.theme-light body:has(.help-page) #main-content,
    body.theme-light:has(.help-page) .main-content,
    body.theme-light:has(.help-page) #main-content,
    body.light-theme:has(.help-page) .main-content,
    body.light-theme:has(.help-page) #main-content,
    .theme-light body:has(.help-page) .main-content,
    .theme-light body:has(.help-page) #main-content,
    [data-theme="light"] body:has(.help-page) .main-content,
    [data-theme="light"] body:has(.help-page) #main-content,
    html.theme-light body:has(.help-center-page) .main-content,
    html.theme-light body:has(.help-center-page) #main-content,
    body.theme-light:has(.help-center-page) .main-content,
    body.theme-light:has(.help-center-page) #main-content,
    body.light-theme:has(.help-center-page) .main-content,
    body.light-theme:has(.help-center-page) #main-content,
    .theme-light body:has(.help-center-page) .main-content,
    .theme-light body:has(.help-center-page) #main-content,
    [data-theme="light"] body:has(.help-center-page) .main-content,
    [data-theme="light"] body:has(.help-center-page) #main-content,
    html.theme-light body:has(.help-center) .main-content,
    html.theme-light body:has(.help-center) #main-content,
    body.theme-light:has(.help-center) .main-content,
    body.theme-light:has(.help-center) #main-content,
    body.light-theme:has(.help-center) .main-content,
    body.light-theme:has(.help-center) #main-content,
    .theme-light body:has(.help-center) .main-content,
    .theme-light body:has(.help-center) #main-content,
    [data-theme="light"] body:has(.help-center) .main-content,
    [data-theme="light"] body:has(.help-center) #main-content,
    html.theme-light body:has(.help-shell) .main-content,
    html.theme-light body:has(.help-shell) #main-content,
    body.theme-light:has(.help-shell) .main-content,
    body.theme-light:has(.help-shell) #main-content,
    body.light-theme:has(.help-shell) .main-content,
    body.light-theme:has(.help-shell) #main-content,
    .theme-light body:has(.help-shell) .main-content,
    .theme-light body:has(.help-shell) #main-content,
    [data-theme="light"] body:has(.help-shell) .main-content,
    [data-theme="light"] body:has(.help-shell) #main-content,
    html.theme-light body:has(.support-page) .main-content,
    html.theme-light body:has(.support-page) #main-content,
    body.theme-light:has(.support-page) .main-content,
    body.theme-light:has(.support-page) #main-content,
    body.light-theme:has(.support-page) .main-content,
    body.light-theme:has(.support-page) #main-content,
    .theme-light body:has(.support-page) .main-content,
    .theme-light body:has(.support-page) #main-content,
    [data-theme="light"] body:has(.support-page) .main-content,
    [data-theme="light"] body:has(.support-page) #main-content {
        background-color: #dfe7fb !important;
        background-image:
            linear-gradient(180deg, rgba(255,255,255,.46), rgba(255,255,255,.26)),
            url('./assets/chat-pattern-premium-mobile.webp') !important;
        background-size: min(720px,118vw) min(720px,118vw) !important;
        background-position: center top !important;
    }

    .help-page,
    .help-center-page,
    .help-center,
    .help-shell,
    .support-page {
        padding-bottom: max(104px, calc(env(safe-area-inset-bottom) + 86px)) !important;
    }
}


/* === Stage 168: Help Center light hero/support visibility fix ===
   CSS-only. Touches ONLY Help Center top blocks and the support action on light theme.
   No JS/API, no cards/articles/category lists/modals/layout logic changes. */

/* Main Help Center hero + section page top blocks must be light/readable on light theme. */
html.theme-light .help-center-page .help-hero,
html.theme-light .help-center-page .help-section-top,
html.theme-light .help-section-page .help-section-top,
html.theme-light .help-page .help-hero,
body.theme-light .help-center-page .help-hero,
body.theme-light .help-center-page .help-section-top,
body.theme-light .help-section-page .help-section-top,
body.theme-light .help-page .help-hero,
body.light-theme .help-center-page .help-hero,
body.light-theme .help-center-page .help-section-top,
body.light-theme .help-section-page .help-section-top,
body.light-theme .help-page .help-hero,
.theme-light .help-center-page .help-hero,
.theme-light .help-center-page .help-section-top,
.theme-light .help-section-page .help-section-top,
.theme-light .help-page .help-hero,
[data-theme="light"] .help-center-page .help-hero,
[data-theme="light"] .help-center-page .help-section-top,
[data-theme="light"] .help-section-page .help-section-top,
[data-theme="light"] .help-page .help-hero {
    background:
        radial-gradient(circle at 0% 0%, rgba(139,92,246,.08), transparent 34%),
        linear-gradient(135deg, rgba(255,255,255,.94), rgba(239,246,255,.86)) !important;
    border: 1px solid rgba(148,163,184,.22) !important;
    box-shadow: 0 18px 48px rgba(15,23,42,.08) !important;
    color: #0f172a !important;
}

/* Text inside top Help blocks. */
html.theme-light .help-center-page .help-hero h1,
html.theme-light .help-center-page .help-section-top h1,
html.theme-light .help-section-page .help-section-top h1,
html.theme-light .help-page .help-hero h1,
body.theme-light .help-center-page .help-hero h1,
body.theme-light .help-center-page .help-section-top h1,
body.theme-light .help-section-page .help-section-top h1,
body.theme-light .help-page .help-hero h1,
body.light-theme .help-center-page .help-hero h1,
body.light-theme .help-center-page .help-section-top h1,
body.light-theme .help-section-page .help-section-top h1,
body.light-theme .help-page .help-hero h1,
.theme-light .help-center-page .help-hero h1,
.theme-light .help-center-page .help-section-top h1,
.theme-light .help-section-page .help-section-top h1,
.theme-light .help-page .help-hero h1,
[data-theme="light"] .help-center-page .help-hero h1,
[data-theme="light"] .help-center-page .help-section-top h1,
[data-theme="light"] .help-section-page .help-section-top h1,
[data-theme="light"] .help-page .help-hero h1 {
    color: #0f172a !important;
}

html.theme-light .help-center-page .help-hero p,
html.theme-light .help-center-page .help-section-top p,
html.theme-light .help-section-page .help-section-top p,
html.theme-light .help-page .help-hero p,
body.theme-light .help-center-page .help-hero p,
body.theme-light .help-center-page .help-section-top p,
body.theme-light .help-section-page .help-section-top p,
body.theme-light .help-page .help-hero p,
body.light-theme .help-center-page .help-hero p,
body.light-theme .help-center-page .help-section-top p,
body.light-theme .help-section-page .help-section-top p,
body.light-theme .help-page .help-hero p,
.theme-light .help-center-page .help-hero p,
.theme-light .help-center-page .help-section-top p,
.theme-light .help-section-page .help-section-top p,
.theme-light .help-page .help-hero p,
[data-theme="light"] .help-center-page .help-hero p,
[data-theme="light"] .help-center-page .help-section-top p,
[data-theme="light"] .help-section-page .help-section-top p,
[data-theme="light"] .help-page .help-hero p {
    color: #64748b !important;
}

/* "Связаться с поддержкой" button/link on Help Center light theme. */
html.theme-light .help-center-page .help-support-link,
html.theme-light .help-center-page .help-danger-support,
html.theme-light .help-section-page .help-support-link,
html.theme-light .help-page .help-support-link,
body.theme-light .help-center-page .help-support-link,
body.theme-light .help-center-page .help-danger-support,
body.theme-light .help-section-page .help-support-link,
body.theme-light .help-page .help-support-link,
body.light-theme .help-center-page .help-support-link,
body.light-theme .help-center-page .help-danger-support,
body.light-theme .help-section-page .help-support-link,
body.light-theme .help-page .help-support-link,
.theme-light .help-center-page .help-support-link,
.theme-light .help-center-page .help-danger-support,
.theme-light .help-section-page .help-support-link,
.theme-light .help-page .help-support-link,
[data-theme="light"] .help-center-page .help-support-link,
[data-theme="light"] .help-center-page .help-danger-support,
[data-theme="light"] .help-section-page .help-support-link,
[data-theme="light"] .help-page .help-support-link {
    color: #0f172a !important;
    background: rgba(255,255,255,.82) !important;
    border: 1px solid rgba(148,163,184,.26) !important;
    box-shadow: 0 12px 30px rgba(15,23,42,.08) !important;
    text-shadow: none !important;
}

html.theme-light .help-center-page .help-support-link:hover,
html.theme-light .help-center-page .help-danger-support:hover,
html.theme-light .help-section-page .help-support-link:hover,
html.theme-light .help-page .help-support-link:hover,
body.theme-light .help-center-page .help-support-link:hover,
body.theme-light .help-center-page .help-danger-support:hover,
body.theme-light .help-section-page .help-support-link:hover,
body.theme-light .help-page .help-support-link:hover,
body.light-theme .help-center-page .help-support-link:hover,
body.light-theme .help-center-page .help-danger-support:hover,
body.light-theme .help-section-page .help-support-link:hover,
body.light-theme .help-page .help-support-link:hover,
.theme-light .help-center-page .help-support-link:hover,
.theme-light .help-center-page .help-danger-support:hover,
.theme-light .help-section-page .help-support-link:hover,
.theme-light .help-page .help-support-link:hover,
[data-theme="light"] .help-center-page .help-support-link:hover,
[data-theme="light"] .help-center-page .help-danger-support:hover,
[data-theme="light"] .help-section-page .help-support-link:hover,
[data-theme="light"] .help-page .help-support-link:hover {
    color: #4338ca !important;
    background: rgba(255,255,255,.96) !important;
    border-color: rgba(99,102,241,.24) !important;
}

/* Icons/text inside support action inherit visible color. */
html.theme-light .help-center-page .help-support-link *,
html.theme-light .help-center-page .help-danger-support *,
html.theme-light .help-section-page .help-support-link *,
html.theme-light .help-page .help-support-link *,
body.theme-light .help-center-page .help-support-link *,
body.theme-light .help-center-page .help-danger-support *,
body.theme-light .help-section-page .help-support-link *,
body.theme-light .help-page .help-support-link *,
body.light-theme .help-center-page .help-support-link *,
body.light-theme .help-center-page .help-danger-support *,
body.light-theme .help-section-page .help-support-link *,
body.light-theme .help-page .help-support-link *,
.theme-light .help-center-page .help-support-link *,
.theme-light .help-center-page .help-danger-support *,
.theme-light .help-section-page .help-support-link *,
.theme-light .help-page .help-support-link *,
[data-theme="light"] .help-center-page .help-support-link *,
[data-theme="light"] .help-center-page .help-danger-support *,
[data-theme="light"] .help-section-page .help-support-link *,
[data-theme="light"] .help-page .help-support-link * {
    color: inherit !important;
    stroke: currentColor !important;
}


/* === Stage 169: Buy USDT / On-ramp page wallpaper, PAGE-LEVEL ONLY ===
   STRICT CSS-only background patch.
   Do NOT touch on-ramp cards, buttons, wallet blocks, P2P links, status labels, Web3, JS or API.
   Wallpaper is applied only to the outer page/main container behind the on-ramp page. */

/* Dark / glass Buy USDT page wallpaper. */
body:has(.onramp-page) .main-content,
.app:has(.onramp-page) .main-content,
#main-content:has(.onramp-page),
body:has(.buy-usdt-page) .main-content,
.app:has(.buy-usdt-page) .main-content,
#main-content:has(.buy-usdt-page),
body:has(.fiat-onramp-page) .main-content,
.app:has(.fiat-onramp-page) .main-content,
#main-content:has(.fiat-onramp-page) {
    background-color: #0b1020 !important;
    background-image:
        linear-gradient(180deg, rgba(7,10,22,.14), rgba(7,10,22,.24)),
        url('./assets/chat-pattern-premium.webp') !important;
    background-repeat: repeat !important;
    background-size: 980px 980px !important;
    background-position: center top !important;
    background-attachment: local !important;
}

/* Route shell transparent only. Internal on-ramp blocks keep existing styles. */
body:has(.onramp-page) .page-content,
.page-content:has(.onramp-page),
#page-content:has(.onramp-page),
body:has(.buy-usdt-page) .page-content,
.page-content:has(.buy-usdt-page),
#page-content:has(.buy-usdt-page),
body:has(.fiat-onramp-page) .page-content,
.page-content:has(.fiat-onramp-page),
#page-content:has(.fiat-onramp-page) {
    min-height: 100dvh !important;
    background: transparent !important;
    background-image: none !important;
    background-color: transparent !important;
}

/* Root only; no cards/buttons/statuses are targeted. */
.onramp-page,
.buy-usdt-page,
.fiat-onramp-page {
    min-height: 100dvh !important;
    background: transparent !important;
    background-image: none !important;
    background-color: transparent !important;
}

/* Light theme Buy USDT wallpaper: soft bluish tone matching chats/deals/wallet. */
html.theme-light body:has(.onramp-page) .main-content,
html.theme-light body:has(.onramp-page) #main-content,
body.theme-light:has(.onramp-page) .main-content,
body.theme-light:has(.onramp-page) #main-content,
body.light-theme:has(.onramp-page) .main-content,
body.light-theme:has(.onramp-page) #main-content,
.theme-light body:has(.onramp-page) .main-content,
.theme-light body:has(.onramp-page) #main-content,
[data-theme="light"] body:has(.onramp-page) .main-content,
[data-theme="light"] body:has(.onramp-page) #main-content,
html.theme-light body:has(.buy-usdt-page) .main-content,
html.theme-light body:has(.buy-usdt-page) #main-content,
body.theme-light:has(.buy-usdt-page) .main-content,
body.theme-light:has(.buy-usdt-page) #main-content,
body.light-theme:has(.buy-usdt-page) .main-content,
body.light-theme:has(.buy-usdt-page) #main-content,
.theme-light body:has(.buy-usdt-page) .main-content,
.theme-light body:has(.buy-usdt-page) #main-content,
[data-theme="light"] body:has(.buy-usdt-page) .main-content,
[data-theme="light"] body:has(.buy-usdt-page) #main-content,
html.theme-light body:has(.fiat-onramp-page) .main-content,
html.theme-light body:has(.fiat-onramp-page) #main-content,
body.theme-light:has(.fiat-onramp-page) .main-content,
body.theme-light:has(.fiat-onramp-page) #main-content,
body.light-theme:has(.fiat-onramp-page) .main-content,
body.light-theme:has(.fiat-onramp-page) #main-content,
.theme-light body:has(.fiat-onramp-page) .main-content,
.theme-light body:has(.fiat-onramp-page) #main-content,
[data-theme="light"] body:has(.fiat-onramp-page) .main-content,
[data-theme="light"] body:has(.fiat-onramp-page) #main-content {
    background-color: #dfe7fb !important;
    background-image:
        linear-gradient(180deg, rgba(255,255,255,.42), rgba(255,255,255,.22)),
        url('./assets/chat-pattern-premium.webp') !important;
    background-repeat: repeat !important;
    background-size: 980px 980px !important;
    background-position: center top !important;
}

@media (max-width: 1024px) {
    body:has(.onramp-page) .main-content,
    .app:has(.onramp-page) .main-content,
    #main-content:has(.onramp-page),
    body:has(.buy-usdt-page) .main-content,
    .app:has(.buy-usdt-page) .main-content,
    #main-content:has(.buy-usdt-page),
    body:has(.fiat-onramp-page) .main-content,
    .app:has(.fiat-onramp-page) .main-content,
    #main-content:has(.fiat-onramp-page) {
        background-image:
            linear-gradient(180deg, rgba(7,10,22,.10), rgba(7,10,22,.20)),
            url('./assets/chat-pattern-premium-mobile.webp') !important;
        background-size: min(720px,118vw) min(720px,118vw) !important;
        background-position: center top !important;
    }

    html.theme-light body:has(.onramp-page) .main-content,
    html.theme-light body:has(.onramp-page) #main-content,
    body.theme-light:has(.onramp-page) .main-content,
    body.theme-light:has(.onramp-page) #main-content,
    body.light-theme:has(.onramp-page) .main-content,
    body.light-theme:has(.onramp-page) #main-content,
    .theme-light body:has(.onramp-page) .main-content,
    .theme-light body:has(.onramp-page) #main-content,
    [data-theme="light"] body:has(.onramp-page) .main-content,
    [data-theme="light"] body:has(.onramp-page) #main-content,
    html.theme-light body:has(.buy-usdt-page) .main-content,
    html.theme-light body:has(.buy-usdt-page) #main-content,
    body.theme-light:has(.buy-usdt-page) .main-content,
    body.theme-light:has(.buy-usdt-page) #main-content,
    body.light-theme:has(.buy-usdt-page) .main-content,
    body.light-theme:has(.buy-usdt-page) #main-content,
    .theme-light body:has(.buy-usdt-page) .main-content,
    .theme-light body:has(.buy-usdt-page) #main-content,
    [data-theme="light"] body:has(.buy-usdt-page) .main-content,
    [data-theme="light"] body:has(.buy-usdt-page) #main-content,
    html.theme-light body:has(.fiat-onramp-page) .main-content,
    html.theme-light body:has(.fiat-onramp-page) #main-content,
    body.theme-light:has(.fiat-onramp-page) .main-content,
    body.theme-light:has(.fiat-onramp-page) #main-content,
    body.light-theme:has(.fiat-onramp-page) .main-content,
    body.light-theme:has(.fiat-onramp-page) #main-content,
    .theme-light body:has(.fiat-onramp-page) .main-content,
    .theme-light body:has(.fiat-onramp-page) #main-content,
    [data-theme="light"] body:has(.fiat-onramp-page) .main-content,
    [data-theme="light"] body:has(.fiat-onramp-page) #main-content {
        background-color: #dfe7fb !important;
        background-image:
            linear-gradient(180deg, rgba(255,255,255,.46), rgba(255,255,255,.26)),
            url('./assets/chat-pattern-premium-mobile.webp') !important;
        background-size: min(720px,118vw) min(720px,118vw) !important;
        background-position: center top !important;
    }

    .onramp-page,
    .buy-usdt-page,
    .fiat-onramp-page {
        padding-bottom: max(104px, calc(env(safe-area-inset-bottom) + 86px)) !important;
    }
}

/* === Stage 153: document/file messages match Dealix bubbles ===
   Scope: ordinary/saved/group chats only. Support chat and all other message types stay untouched. */
#chat-active:not([data-chat-type="support"]) #chat-messages .message:has(.chat-file-card) {
    box-sizing: border-box !important;
    width: min(340px, 76vw) !important;
    max-width: min(340px, 76vw) !important;
    min-width: 0 !important;
    padding: 10px 11px 7px !important;
    border-radius: 21px !important;
    overflow: visible !important;
    border: 1px solid rgba(255, 255, 255, .11) !important;
    backdrop-filter: var(--chat-message-surface-filter, blur(14px) saturate(1.12)) !important;
    -webkit-backdrop-filter: var(--chat-message-surface-filter, blur(14px) saturate(1.12)) !important;
}

#chat-active:not([data-chat-type="support"]) #chat-messages .message.sent:has(.chat-file-card) {
    background: linear-gradient(135deg, #8b5cf6 0%, #6d5dfc 58%, #a879ff 100%) !important;
    color: #fff !important;
    border-color: rgba(255, 255, 255, .16) !important;
    border-bottom-right-radius: 8px !important;
    box-shadow: 0 12px 28px rgba(109, 93, 252, .22), inset 0 1px 0 rgba(255,255,255,.12) !important;
}

#chat-active:not([data-chat-type="support"]) #chat-messages .message.received:has(.chat-file-card) {
    background:
        radial-gradient(circle at 14% 0%, rgba(139, 92, 246, .13), transparent 46%),
        linear-gradient(135deg, rgba(30, 41, 59, .78), rgba(15, 23, 42, .70)) !important;
    color: rgba(241, 245, 249, .96) !important;
    border-color: rgba(255, 255, 255, .075) !important;
    border-bottom-left-radius: 8px !important;
    box-shadow: 0 12px 28px rgba(0, 0, 0, .16), inset 0 1px 0 rgba(255,255,255,.05) !important;
}

#chat-active:not([data-chat-type="support"]) #chat-messages .message:has(.chat-file-card) .message-content {
    width: 100% !important;
    min-width: 0 !important;
    padding: 0 !important;
    color: inherit !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
}

#chat-active:not([data-chat-type="support"]) #chat-messages .message .chat-file-card {
    box-sizing: border-box !important;
    display: grid !important;
    grid-template-columns: 50px minmax(0, 1fr) 28px !important;
    align-items: center !important;
    gap: 11px !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: inherit !important;
    text-align: left !important;
    text-decoration: none !important;
    box-shadow: none !important;
    cursor: pointer !important;
    transition: opacity .16s ease !important;
}

#chat-active:not([data-chat-type="support"]) #chat-messages .message .chat-file-card:hover {
    opacity: .94 !important;
    transform: none !important;
}

#chat-active:not([data-chat-type="support"]) #chat-messages .message .chat-file-icon {
    box-sizing: border-box !important;
    position: relative !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 50px !important;
    height: 50px !important;
    min-width: 50px !important;
    min-height: 50px !important;
    flex: 0 0 50px !important;
    border-radius: 16px !important;
    font-size: 0 !important;
    line-height: 0 !important;
    color: currentColor !important;
    background: rgba(255, 255, 255, .16) !important;
    border: 1px solid rgba(255, 255, 255, .13) !important;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.09) !important;
}

#chat-active:not([data-chat-type="support"]) #chat-messages .message .chat-file-icon::before {
    content: "" !important;
    display: block !important;
    width: 27px !important;
    height: 27px !important;
    background: currentColor !important;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6.75A2.75 2.75 0 0 1 5.75 4h3.1c.7 0 1.36.27 1.85.76L11.94 6h6.31A2.75 2.75 0 0 1 21 8.75v7.5A2.75 2.75 0 0 1 18.25 19H5.75A2.75 2.75 0 0 1 3 16.25z'/%3E%3Cpath d='M3.3 9h17.4'/%3E%3C/svg%3E") center / contain no-repeat !important;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6.75A2.75 2.75 0 0 1 5.75 4h3.1c.7 0 1.36.27 1.85.76L11.94 6h6.31A2.75 2.75 0 0 1 21 8.75v7.5A2.75 2.75 0 0 1 18.25 19H5.75A2.75 2.75 0 0 1 3 16.25z'/%3E%3Cpath d='M3.3 9h17.4'/%3E%3C/svg%3E") center / contain no-repeat !important;
}

#chat-active:not([data-chat-type="support"]) #chat-messages .message .chat-file-info {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    gap: 3px !important;
    min-width: 0 !important;
    overflow: hidden !important;
}

#chat-active:not([data-chat-type="support"]) #chat-messages .message .chat-file-info b {
    display: block !important;
    max-width: 100% !important;
    overflow: hidden !important;
    white-space: nowrap !important;
    text-overflow: ellipsis !important;
    color: inherit !important;
    font-size: .95rem !important;
    font-weight: 750 !important;
    line-height: 1.22 !important;
    letter-spacing: -.01em !important;
}

#chat-active:not([data-chat-type="support"]) #chat-messages .message .chat-file-info small {
    display: block !important;
    color: rgba(255,255,255,.72) !important;
    font-size: .76rem !important;
    font-weight: 600 !important;
    line-height: 1.2 !important;
}

#chat-active:not([data-chat-type="support"]) #chat-messages .message .chat-file-card::after {
    content: "" !important;
    display: block !important;
    width: 21px !important;
    height: 21px !important;
    justify-self: center !important;
    background: currentColor !important;
    opacity: .78 !important;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3v12'/%3E%3Cpath d='m8 11 4 4 4-4'/%3E%3Cpath d='M5 20h14'/%3E%3C/svg%3E") center / contain no-repeat !important;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3v12'/%3E%3Cpath d='m8 11 4 4 4-4'/%3E%3Cpath d='M5 20h14'/%3E%3C/svg%3E") center / contain no-repeat !important;
}

#chat-active:not([data-chat-type="support"]) #chat-messages .message span.chat-file-card::after {
    opacity: .32 !important;
}

#chat-active:not([data-chat-type="support"]) #chat-messages .message.sent:has(.chat-file-card) .message-time {
    margin-top: 4px !important;
    color: rgba(255,255,255,.78) !important;
    opacity: 1 !important;
}

#chat-active:not([data-chat-type="support"]) #chat-messages .message.received:has(.chat-file-card) .message-time {
    margin-top: 4px !important;
    color: rgba(203, 213, 225, .76) !important;
    opacity: 1 !important;
}

body.theme-light #chat-active:not([data-chat-type="support"]) #chat-messages .message.received:has(.chat-file-card),
html[data-theme="light"] body #chat-active:not([data-chat-type="support"]) #chat-messages .message.received:has(.chat-file-card) {
    background:
        radial-gradient(circle at 14% 0%, rgba(139, 92, 246, .09), transparent 46%),
        linear-gradient(135deg, rgba(255,255,255,.95), rgba(248,250,252,.90)) !important;
    color: rgba(15, 23, 42, .92) !important;
    border-color: rgba(15, 23, 42, .07) !important;
    box-shadow: 0 12px 28px rgba(15, 23, 42, .08), inset 0 1px 0 rgba(255,255,255,.72) !important;
}

body.theme-light #chat-active:not([data-chat-type="support"]) #chat-messages .message.received .chat-file-icon,
html[data-theme="light"] body #chat-active:not([data-chat-type="support"]) #chat-messages .message.received .chat-file-icon {
    color: #6d5dfc !important;
    background: rgba(109, 93, 252, .11) !important;
    border-color: rgba(109, 93, 252, .13) !important;
}

body.theme-light #chat-active:not([data-chat-type="support"]) #chat-messages .message.received .chat-file-info small,
html[data-theme="light"] body #chat-active:not([data-chat-type="support"]) #chat-messages .message.received .chat-file-info small {
    color: rgba(71, 85, 105, .72) !important;
}

body.theme-light #chat-active:not([data-chat-type="support"]) #chat-messages .message.received:has(.chat-file-card) .message-time,
html[data-theme="light"] body #chat-active:not([data-chat-type="support"]) #chat-messages .message.received:has(.chat-file-card) .message-time {
    color: rgba(71, 85, 105, .76) !important;
}

@media (max-width: 480px) {
    #chat-active:not([data-chat-type="support"]) #chat-messages .message:has(.chat-file-card) {
        width: min(300px, 78vw) !important;
        max-width: min(300px, 78vw) !important;
        padding: 9px 10px 7px !important;
    }

    #chat-active:not([data-chat-type="support"]) #chat-messages .message .chat-file-card {
        grid-template-columns: 46px minmax(0, 1fr) 24px !important;
        gap: 9px !important;
    }

    #chat-active:not([data-chat-type="support"]) #chat-messages .message .chat-file-icon {
        width: 46px !important;
        height: 46px !important;
        min-width: 46px !important;
        min-height: 46px !important;
        flex-basis: 46px !important;
        border-radius: 15px !important;
    }

    #chat-active:not([data-chat-type="support"]) #chat-messages .message .chat-file-icon::before {
        width: 25px !important;
        height: 25px !important;
    }
}

/* === Stage 155: ordinary video/audio attachments are real media, not generic files === */
#chat-active:not([data-chat-type="support"]) #chat-messages .message:has(.chat-video-attachment) {
    width: min(420px, 70vw) !important;
    max-width: min(420px, 70vw) !important;
}

#chat-active:not([data-chat-type="support"]) #chat-messages .chat-video-attachment {
    position: relative !important;
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-height: 0 !important;
    overflow: hidden !important;
    border-radius: 20px !important;
    background: #05070d !important;
}

#chat-active:not([data-chat-type="support"]) #chat-messages .chat-attach-video {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-height: 180px !important;
    max-height: 430px !important;
    object-fit: contain !important;
    background: #05070d !important;
    border: 0 !important;
    border-radius: 20px !important;
}

#chat-active:not([data-chat-type="support"]) #chat-messages .chat-attach-media-name {
    position: absolute !important;
    top: 9px !important;
    left: 10px !important;
    right: 58px !important;
    z-index: 3 !important;
    display: block !important;
    overflow: hidden !important;
    white-space: nowrap !important;
    text-overflow: ellipsis !important;
    padding: 4px 8px !important;
    border-radius: 999px !important;
    color: #fff !important;
    background: rgba(15, 23, 42, .52) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    font-size: .75rem !important;
    font-weight: 760 !important;
    pointer-events: none !important;
}

/* Native video controls occupy the bottom edge, so move the message time up. */
#chat-active:not([data-chat-type="support"]) #chat-messages .message:has(.chat-video-attachment) .message-time {
    top: 9px !important;
    right: 9px !important;
    bottom: auto !important;
}

#chat-active:not([data-chat-type="support"]) #chat-messages .message:has(.chat-audio-attachment) {
    box-sizing: border-box !important;
    width: min(390px, 78vw) !important;
    max-width: min(390px, 78vw) !important;
    min-width: 0 !important;
    padding: 10px 11px 8px !important;
    border-radius: 21px !important;
    overflow: visible !important;
    border: 1px solid rgba(255,255,255,.11) !important;
    backdrop-filter: var(--chat-message-surface-filter, blur(14px) saturate(1.12)) !important;
    -webkit-backdrop-filter: var(--chat-message-surface-filter, blur(14px) saturate(1.12)) !important;
}

#chat-active:not([data-chat-type="support"]) #chat-messages .message.sent:has(.chat-audio-attachment) {
    color: #fff !important;
    background: linear-gradient(135deg, #8b5cf6 0%, #6d5dfc 58%, #a879ff 100%) !important;
    border-color: rgba(255,255,255,.16) !important;
    border-bottom-right-radius: 8px !important;
    box-shadow: 0 12px 28px rgba(109,93,252,.22), inset 0 1px 0 rgba(255,255,255,.12) !important;
}

#chat-active:not([data-chat-type="support"]) #chat-messages .message.received:has(.chat-audio-attachment) {
    color: rgba(241,245,249,.96) !important;
    background: radial-gradient(circle at 14% 0%, rgba(139,92,246,.13), transparent 46%), linear-gradient(135deg, rgba(30,41,59,.78), rgba(15,23,42,.70)) !important;
    border-color: rgba(255,255,255,.075) !important;
    border-bottom-left-radius: 8px !important;
    box-shadow: 0 12px 28px rgba(0,0,0,.16), inset 0 1px 0 rgba(255,255,255,.05) !important;
}

#chat-active:not([data-chat-type="support"]) #chat-messages .message:has(.chat-audio-attachment) .message-content {
    width: 100% !important;
    min-width: 0 !important;
    padding: 0 !important;
    color: inherit !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
}

#chat-active:not([data-chat-type="support"]) #chat-messages .chat-audio-attachment {
    display: grid !important;
    grid-template-columns: 48px minmax(0,1fr) !important;
    align-items: center !important;
    gap: 10px !important;
    width: 100% !important;
    min-width: 0 !important;
    color: inherit !important;
}

#chat-active:not([data-chat-type="support"]) #chat-messages .chat-audio-attachment-icon {
    display: grid !important;
    place-items: center !important;
    width: 48px !important;
    height: 48px !important;
    border-radius: 16px !important;
    color: currentColor !important;
    background: rgba(255,255,255,.16) !important;
    border: 1px solid rgba(255,255,255,.13) !important;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.09) !important;
}

#chat-active:not([data-chat-type="support"]) #chat-messages .chat-audio-attachment-main {
    display: grid !important;
    gap: 5px !important;
    min-width: 0 !important;
}

#chat-active:not([data-chat-type="support"]) #chat-messages .chat-audio-attachment-main b {
    overflow: hidden !important;
    white-space: nowrap !important;
    text-overflow: ellipsis !important;
    color: inherit !important;
    font-size: .9rem !important;
    font-weight: 780 !important;
}

#chat-active:not([data-chat-type="support"]) #chat-messages .chat-audio-attachment audio {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 34px !important;
    min-width: 0 !important;
}

#chat-active:not([data-chat-type="support"]) #chat-messages .message:has(.chat-audio-attachment) .message-time {
    margin-top: 5px !important;
    color: rgba(255,255,255,.78) !important;
    opacity: 1 !important;
}

body.theme-light #chat-active:not([data-chat-type="support"]) #chat-messages .message.received:has(.chat-audio-attachment),
html[data-theme="light"] body #chat-active:not([data-chat-type="support"]) #chat-messages .message.received:has(.chat-audio-attachment) {
    color: rgba(15,23,42,.92) !important;
    background: radial-gradient(circle at 14% 0%, rgba(139,92,246,.09), transparent 46%), linear-gradient(135deg, rgba(255,255,255,.95), rgba(248,250,252,.90)) !important;
    border-color: rgba(15,23,42,.07) !important;
    box-shadow: 0 12px 28px rgba(15,23,42,.08), inset 0 1px 0 rgba(255,255,255,.72) !important;
}

body.theme-light #chat-active:not([data-chat-type="support"]) #chat-messages .message.received .chat-audio-attachment-icon,
html[data-theme="light"] body #chat-active:not([data-chat-type="support"]) #chat-messages .message.received .chat-audio-attachment-icon {
    color: #6d5dfc !important;
    background: rgba(109,93,252,.11) !important;
    border-color: rgba(109,93,252,.13) !important;
}

.chat-info-audio-card {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 48px minmax(0,1fr);
    align-items: center;
    gap: 11px;
    min-width: 0;
    padding: 10px;
    border-radius: 18px;
    color: var(--text);
    background: color-mix(in srgb, var(--bg-secondary) 78%, transparent);
    border: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
}

.chat-info-audio-icon {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 15px;
    color: #fff;
    background: var(--primary-grad);
}

.chat-info-audio-main {
    display: grid;
    gap: 5px;
    min-width: 0;
}

.chat-info-audio-main b {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    color: var(--text);
    font-size: .9rem;
    font-weight: 820;
}

.chat-info-audio-main audio {
    display: block;
    width: 100%;
    max-width: 100%;
    height: 34px;
}

.chat-info-favorite-row.media-favorite:has(.chat-info-audio-card) {
    grid-template-columns: minmax(0,1fr) !important;
    align-items: stretch !important;
}

.chat-info-favorite-row.media-favorite:has(.chat-info-audio-card) .chat-info-audio-card {
    width: 100% !important;
}

@media (max-width: 480px) {
    #chat-active:not([data-chat-type="support"]) #chat-messages .message:has(.chat-video-attachment) {
        width: min(310px, 82vw) !important;
        max-width: min(310px, 82vw) !important;
    }

    #chat-active:not([data-chat-type="support"]) #chat-messages .chat-attach-video {
        min-height: 160px !important;
        max-height: 360px !important;
        border-radius: 18px !important;
    }

    #chat-active:not([data-chat-type="support"]) #chat-messages .message:has(.chat-audio-attachment) {
        width: min(320px, 84vw) !important;
        max-width: min(320px, 84vw) !important;
        padding: 9px 10px 8px !important;
    }

    #chat-active:not([data-chat-type="support"]) #chat-messages .chat-audio-attachment {
        grid-template-columns: 44px minmax(0,1fr) !important;
        gap: 8px !important;
    }

    #chat-active:not([data-chat-type="support"]) #chat-messages .chat-audio-attachment-icon {
        width: 44px !important;
        height: 44px !important;
        border-radius: 14px !important;
    }

    .chat-info-audio-card {
        grid-template-columns: 44px minmax(0,1fr);
        gap: 9px;
        padding: 9px;
    }

    .chat-info-audio-icon {
        width: 44px;
        height: 44px;
        border-radius: 14px;
    }
}

/* === DEALIX 156: chat info Files tab + five-tab frame-safe layout === */
.chat-info-tabs,
.group-members-panel.group-info-panel .chat-info-tabs {
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
}
.chat-info-tab,
.group-members-panel.group-info-panel .chat-info-tab {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: clip !important;
}
.chat-info-file-list {
    display: grid;
    gap: 10px;
    min-width: 0;
}
.chat-info-file-card {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) auto;
    align-items: center;
    gap: 11px;
    min-width: 0;
    min-height: 68px;
    padding: 10px;
    border-radius: 19px;
    color: var(--text);
    text-decoration: none;
    background: color-mix(in srgb, var(--bg-secondary) 78%, transparent);
    border: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
}
.chat-info-file-card:hover {
    background: color-mix(in srgb, var(--bg-secondary) 88%, var(--primary) 12%);
}
.chat-info-file-icon {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 15px;
    color: #fff;
    background: var(--primary-grad);
}
.chat-info-file-main {
    display: grid;
    gap: 4px;
    min-width: 0;
}
.chat-info-file-main b,
.chat-info-file-main small {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chat-info-file-main b {
    color: var(--text);
    font-size: .94rem;
    font-weight: 850;
    white-space: nowrap;
}
.chat-info-file-main small {
    color: var(--text-secondary);
    font-size: .8rem;
    font-weight: 720;
    white-space: nowrap;
}
.chat-info-file-audio-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
body.theme-light .chat-info-file-card,
html[data-theme="light"] body .chat-info-file-card,
body.theme-light .chat-info-audio-card,
html[data-theme="light"] body .chat-info-audio-card {
    background: rgba(255,255,255,.78);
    border-color: rgba(15,23,42,.10);
}
@media (max-width: 768px) {
    .chat-info-content .chat-info-tabs,
    .group-members-panel.group-info-panel .chat-info-tabs {
        display: flex;
        gap: 3px !important;
        padding: 4px !important;
        overflow-x: auto !important;
        overscroll-behavior-x: contain;
        scrollbar-width: thin;
    }
    .chat-info-content .chat-info-tab,
    .group-members-panel.group-info-panel .chat-info-tab {
        flex: 0 0 auto;
        width: auto !important;
        max-width: none !important;
        min-width: max-content !important;
        height: 44px !important;
        padding: 0 12px !important;
        font-size: 12px !important;
        letter-spacing: 0 !important;
    }
    .chat-info-file-card {
        grid-template-columns: 44px minmax(0, 1fr) auto;
        gap: 9px;
        padding: 9px;
        border-radius: 18px;
    }
    .chat-info-file-icon {
        width: 44px;
        height: 44px;
        border-radius: 14px;
    }
    .chat-info-file-audio-row {
        gap: 8px;
    }
}
@media (max-width: 380px) {
    .chat-info-file-card {
        grid-template-columns: 40px minmax(0, 1fr);
    }
    .chat-info-file-card > .chat-info-row-date {
        grid-column: 2;
        justify-self: start;
    }
    .chat-info-file-icon {
        width: 40px;
        height: 40px;
        border-radius: 13px;
    }
    .chat-info-file-audio-row {
        grid-template-columns: minmax(0, 1fr);
    }
    .chat-info-file-audio-row > .chat-info-row-date {
        justify-self: start;
        padding-left: 2px;
    }
}

/* === Stage 15Q: compact integrated voice messages ===
   Scope: visual styling of voice messages inside the chat only.
   Playback/recording logic and the Information panel are untouched. */
.chat-messages .message:has(.voice-message) {
    box-sizing: border-box !important;
    width: min(360px, 74vw) !important;
    max-width: 75% !important;
    min-width: 0 !important;
    padding: 8px 10px 6px !important;
}

.chat-messages .message .voice-message {
    --voice-progress: 0%;
    box-sizing: border-box !important;
    display: grid !important;
    grid-template-columns: 40px minmax(0, 1fr) !important;
    align-items: center !important;
    gap: 10px !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    min-height: 42px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    overflow: visible !important;
}

.chat-messages .message .voice-play-btn {
    box-sizing: border-box !important;
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 999px !important;
    background: rgba(255,255,255,.17) !important;
    color: currentColor !important;
    box-shadow: none !important;
    transform: none !important;
    transition: background-color .16s ease, transform .16s ease !important;
}

.chat-messages .message .voice-play-btn:hover {
    background: rgba(255,255,255,.24) !important;
    transform: scale(1.025) !important;
}

.chat-messages .message .voice-play-btn:active {
    transform: scale(.96) !important;
}

.chat-messages .message.received .voice-play-btn {
    background: rgba(139,92,246,.14) !important;
    color: var(--primary) !important;
}

.chat-messages .message.received .voice-play-btn:hover {
    background: rgba(139,92,246,.22) !important;
}

.chat-messages .message .voice-play-icon {
    width: 17px !important;
    height: 17px !important;
}

.chat-messages .message .voice-message-main {
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 2px !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    overflow: visible !important;
}

.chat-messages .message .voice-progress,
.chat-messages .message .voice-wave {
    box-sizing: border-box !important;
    position: relative !important;
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: 28px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    outline: 0 !important;
    background: transparent !important;
    color: inherit !important;
    box-shadow: none !important;
    overflow: hidden !important;
    cursor: pointer !important;
}

.chat-messages .message .voice-progress:focus-visible {
    outline: 2px solid rgba(255,255,255,.38) !important;
    outline-offset: 2px !important;
    border-radius: 6px !important;
}

.chat-messages .message.received .voice-progress:focus-visible {
    outline-color: rgba(139,92,246,.55) !important;
}

.chat-messages .message .voice-wave-bars {
    box-sizing: border-box !important;
    position: absolute !important;
    inset: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 2px !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: 100% !important;
    overflow: hidden !important;
}

.chat-messages .message .voice-wave-bars span,
.chat-messages .message .voice-wave span {
    flex: 1 1 0 !important;
    width: auto !important;
    min-width: 1px !important;
    max-width: 3px !important;
    height: min(var(--h, 18px), 25px) !important;
    border-radius: 999px !important;
    background: currentColor !important;
    opacity: .34 !important;
}

.chat-messages .message.sent .voice-wave-bars span {
    opacity: .46 !important;
}

.chat-messages .message .voice-wave-played {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    color: currentColor !important;
    clip-path: inset(0 calc(100% - var(--voice-progress, 0%)) 0 0) !important;
    overflow: hidden !important;
    pointer-events: none !important;
}

.chat-messages .message .voice-wave-played .voice-wave-bars span {
    opacity: .98 !important;
}

.chat-messages .message .voice-wave-thumb {
    top: 50% !important;
    width: 6px !important;
    height: 6px !important;
    background: currentColor !important;
    box-shadow: none !important;
    opacity: 0 !important;
}

.chat-messages .message .voice-message.playing .voice-wave-thumb {
    opacity: .82 !important;
}

.chat-messages .message .voice-meta {
    box-sizing: border-box !important;
    display: grid !important;
    grid-template-columns: auto 1fr auto !important;
    align-items: center !important;
    gap: 6px !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: .68rem !important;
    line-height: 1 !important;
    font-weight: 560 !important;
    opacity: .76 !important;
}

.chat-messages .message .voice-current,
.chat-messages .message .voice-duration {
    font-variant-numeric: tabular-nums !important;
    white-space: nowrap !important;
}

.chat-messages .message .voice-label {
    visibility: hidden !important;
    min-width: 0 !important;
}

.chat-messages .message:has(.voice-message) > .message-time {
    margin-top: 2px !important;
    line-height: 1 !important;
}

body.theme-light .chat-messages .message.sent .voice-play-btn {
    background: rgba(255,255,255,.20) !important;
    color: #fff !important;
}

body.theme-light .chat-messages .message.received .voice-play-btn {
    background: rgba(109,93,252,.12) !important;
    color: #5b4df5 !important;
}

@media (max-width: 768px) {
    .chat-messages .message:has(.voice-message) {
        width: min(330px, 82vw) !important;
        max-width: 86% !important;
        padding: 8px 10px 6px !important;
    }

    .chat-messages .message .voice-message {
        grid-template-columns: 38px minmax(0, 1fr) !important;
        gap: 9px !important;
        min-height: 40px !important;
    }

    .chat-messages .message .voice-play-btn {
        width: 38px !important;
        height: 38px !important;
        min-width: 38px !important;
        min-height: 38px !important;
    }

    .chat-messages .message .voice-progress,
    .chat-messages .message .voice-wave {
        height: 26px !important;
    }

    .chat-messages .message .voice-wave-bars span,
    .chat-messages .message .voice-wave span {
        max-width: 3px !important;
        height: min(var(--h, 18px), 23px) !important;
    }
}

@media (max-width: 380px) {
    .chat-messages .message:has(.voice-message) {
        width: min(300px, 86vw) !important;
        max-width: 90% !important;
    }

    .chat-messages .message .voice-wave-bars {
        gap: 1.5px !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .chat-messages .message .voice-play-btn {
        transition: none !important;
    }
}

/* ===== Stage 31A: branded group invitations from group avatar menu ===== */
.group-invite-wrap .message.group-invite-message {
    width: min(380px, 86vw) !important;
    max-width: min(380px, 86vw) !important;
    padding: 5px 5px 4px !important;
    overflow: visible !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
}

.group-invite-wrap .message.group-invite-message > .message-content {
    min-width: 0 !important;
}

.message-group-invite-card {
    width: 100%;
    min-width: 0;
    display: grid;
    gap: 13px;
    padding: 15px;
    border-radius: 22px;
    color: var(--text-primary, var(--text));
    background:
        radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--primary) 22%, transparent), transparent 46%),
        linear-gradient(145deg, color-mix(in srgb, var(--bg-card) 94%, var(--primary) 6%), var(--bg-secondary));
    border: 1px solid color-mix(in srgb, var(--primary) 28%, var(--border));
    box-shadow: 0 16px 38px rgba(0, 0, 0, .18), inset 0 1px 0 rgba(255,255,255,.06);
    text-align: left;
}

.message-group-invite-kicker {
    width: max-content;
    max-width: 100%;
    padding: 5px 9px;
    border-radius: 999px;
    color: color-mix(in srgb, var(--primary) 82%, white 18%);
    background: color-mix(in srgb, var(--primary) 16%, transparent);
    font-size: .69rem;
    line-height: 1;
    font-weight: 900;
    letter-spacing: .035em;
    text-transform: uppercase;
}

.message-group-invite-head {
    min-width: 0;
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
}

.message-group-invite-head > div {
    min-width: 0;
}

.message-group-invite-head b,
.message-group-invite-head small {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.message-group-invite-head b {
    color: var(--text-primary, var(--text));
    font-size: 1.02rem;
    line-height: 1.25;
    font-weight: 900;
}

.message-group-invite-head small {
    margin-top: 4px;
    color: var(--text-muted);
    font-size: .76rem;
    line-height: 1.25;
    font-weight: 700;
}

.message-group-invite-avatar,
.message-group-invite-member {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    overflow: hidden;
    border-radius: 999px;
    color: #fff;
    background: linear-gradient(145deg, var(--primary), color-mix(in srgb, var(--primary) 64%, #7c3aed));
    font-weight: 900;
}

.message-group-invite-avatar {
    width: 58px;
    height: 58px;
    border: 2px solid color-mix(in srgb, var(--primary) 42%, rgba(255,255,255,.2));
    box-shadow: 0 10px 22px color-mix(in srgb, var(--primary) 20%, transparent);
    font-size: 1.05rem;
}

.message-group-invite-avatar img,
.message-group-invite-member img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.message-group-invite-members {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
    font-size: .77rem;
    font-weight: 800;
}

.message-group-invite-stack {
    min-width: 30px;
    display: inline-flex;
    align-items: center;
    padding-left: 2px;
}

.message-group-invite-member {
    width: 29px;
    height: 29px;
    margin-left: -8px;
    border: 2px solid var(--bg-card);
    font-size: .67rem;
    box-shadow: 0 3px 10px rgba(0,0,0,.16);
}

.message-group-invite-member:first-child {
    margin-left: 0;
}

.message-group-invite-accept,
.message-group-invite-status {
    width: 100%;
    min-height: 42px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    font-size: .84rem;
    line-height: 1.15;
    font-weight: 900;
    text-align: center;
}

.message-group-invite-accept {
    border: 1px solid color-mix(in srgb, var(--primary) 72%, white 8%);
    color: #fff;
    background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 72%, #7c3aed));
    box-shadow: 0 9px 22px color-mix(in srgb, var(--primary) 24%, transparent);
    cursor: pointer;
    transition: transform .16s ease, filter .16s ease, opacity .16s ease;
}

.message-group-invite-accept:hover {
    filter: brightness(1.07);
    transform: translateY(-1px);
}

.message-group-invite-accept:active {
    transform: translateY(0) scale(.985);
}

.message-group-invite-accept:disabled,
.message-group-invite-accept.is-loading {
    opacity: .62;
    cursor: wait;
    transform: none;
}

.message-group-invite-status {
    min-height: 38px;
    color: color-mix(in srgb, var(--primary) 80%, white 20%);
    background: color-mix(in srgb, var(--primary) 13%, transparent);
    border: 1px solid color-mix(in srgb, var(--primary) 22%, transparent);
}

.message-group-invite-status.muted {
    color: var(--text-muted);
    background: color-mix(in srgb, var(--bg-tertiary) 88%, transparent);
    border-color: var(--border);
}

.group-invite-wrap .message.group-invite-message > .message-time {
    margin-top: 4px !important;
    padding-right: 6px !important;
    color: var(--text-muted) !important;
    text-shadow: none !important;
}

.group-invite-picker-overlay {
    z-index: 30120 !important;
}

.group-invite-picker .chat-forward-list {
    min-height: 96px;
    max-height: min(430px, 56dvh);
}

.group-invite-picker .chat-forward-user:disabled {
    opacity: .58;
    cursor: wait;
}

.chat-media-viewer-more-menu button.hidden,
#chat-media-viewer-more-menu button.hidden {
    display: none !important;
}

body.theme-light .message-group-invite-card,
html[data-theme="light"] body .message-group-invite-card {
    background:
        radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--primary) 13%, transparent), transparent 46%),
        linear-gradient(145deg, #ffffff, color-mix(in srgb, #f8fafc 94%, var(--primary) 6%));
    border-color: color-mix(in srgb, var(--primary) 22%, #d9deeb);
    box-shadow: 0 16px 35px rgba(30, 41, 59, .12), inset 0 1px 0 rgba(255,255,255,.95);
}

body.theme-light .message-group-invite-member,
html[data-theme="light"] body .message-group-invite-member {
    border-color: #fff;
}

@media (max-width: 640px) {
    .group-invite-wrap .message.group-invite-message {
        width: min(350px, 88vw) !important;
        max-width: 88vw !important;
    }

    .message-group-invite-card {
        gap: 12px;
        padding: 13px;
        border-radius: 20px;
    }

    .message-group-invite-head {
        grid-template-columns: 52px minmax(0, 1fr);
        gap: 10px;
    }

    .message-group-invite-avatar {
        width: 52px;
        height: 52px;
    }

    .message-group-invite-accept,
    .message-group-invite-status {
        min-height: 40px;
    }
}


/* === DEALIX 170: separate group actions menu in group info header === */
.group-members-panel.group-info-panel .group-info-cover {
    position: relative !important;
}
html body .group-members-panel .group-info-more {
    position: absolute !important;
    top: 14px !important;
    left: 14px !important;
    right: auto !important;
    z-index: 8 !important;
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    min-height: 42px !important;
    padding: 0 !important;
    border-radius: 999px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: 1px solid rgba(255,255,255,.16) !important;
    background: rgba(15,23,42,.30) !important;
    color: #fff !important;
    box-shadow: 0 12px 30px rgba(0,0,0,.18), inset 0 1px 0 rgba(255,255,255,.08) !important;
    backdrop-filter: blur(12px) saturate(1.14) !important;
    -webkit-backdrop-filter: blur(12px) saturate(1.14) !important;
    cursor: pointer !important;
    -webkit-tap-highlight-color: transparent !important;
    touch-action: manipulation !important;
}
html body .group-members-panel .group-info-more:hover,
html body .group-members-panel .group-info-more:focus-visible,
html body .group-members-panel .group-info-more.is-open {
    background: rgba(30,41,59,.48) !important;
    border-color: rgba(167,139,250,.28) !important;
}
html body .group-members-panel .group-info-more svg {
    width: 20px !important;
    height: 20px !important;
    display: block !important;
    pointer-events: none !important;
}
html body .group-members-panel .group-info-more-menu {
    position: absolute !important;
    top: 64px !important;
    left: 14px !important;
    right: auto !important;
    z-index: 9 !important;
    width: min(330px, calc(100vw - 28px)) !important;
    max-width: calc(100% - 28px) !important;
}
html body .group-members-panel .group-info-more-menu.hidden {
    display: none !important;
}
html body .group-members-panel .group-info-more-menu button {
    width: 100% !important;
}
html body .group-members-panel .group-info-more-menu button svg {
    width: 19px !important;
    height: 19px !important;
    min-width: 19px !important;
}
body.theme-light .group-members-panel .group-info-more,
html[data-theme="light"] body .group-members-panel .group-info-more {
    color: #111827 !important;
    background: rgba(255,255,255,.82) !important;
    border-color: rgba(15,23,42,.12) !important;
    box-shadow: 0 12px 28px rgba(15,23,42,.12), inset 0 1px 0 rgba(255,255,255,.70) !important;
}
@media (max-width: 640px) {
    html body .group-members-panel .group-info-more {
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
        min-height: 40px !important;
        top: max(12px, env(safe-area-inset-top)) !important;
        left: max(12px, env(safe-area-inset-left)) !important;
    }
    html body .group-members-panel .group-info-more-menu {
        top: calc(max(12px, env(safe-area-inset-top)) + 48px) !important;
        left: max(12px, env(safe-area-inset-left)) !important;
        width: min(310px, calc(100vw - 24px)) !important;
        max-width: calc(100vw - 24px) !important;
    }
}


/* === DEALIX 171: complete group invite picker + native thin close === */
.group-invite-picker .chat-action-modal-close {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    min-height: 38px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 999px !important;
    border: 1px solid color-mix(in srgb, var(--border) 88%, transparent) !important;
    background: color-mix(in srgb, var(--bg-tertiary) 82%, transparent) !important;
    color: var(--text) !important;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 8px 22px rgba(0,0,0,.14) !important;
    font-size: 0 !important;
    line-height: 1 !important;
    cursor: pointer !important;
    -webkit-tap-highlight-color: transparent !important;
    transition: background .16s ease, border-color .16s ease, transform .16s ease !important;
}
.group-invite-picker .chat-action-modal-close::before,
.group-invite-picker .chat-action-modal-close::after {
    content: none !important;
    display: none !important;
}
.group-invite-picker .chat-action-modal-close svg {
    width: 17px !important;
    height: 17px !important;
    display: block !important;
    flex: 0 0 17px !important;
    margin: 0 !important;
    pointer-events: none !important;
    stroke-width: 2.2 !important;
}
.group-invite-picker .chat-action-modal-close:hover,
.group-invite-picker .chat-action-modal-close:focus-visible {
    background: color-mix(in srgb, var(--bg-tertiary) 68%, var(--primary) 32%) !important;
    border-color: color-mix(in srgb, var(--primary) 42%, var(--border)) !important;
}
.group-invite-picker .chat-action-modal-close:active {
    transform: scale(.96) !important;
}
.group-invite-picker .chat-forward-list {
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

/* === DEALIX Group Hub v1: roles, access and legacy post history === */
.group-member-controls {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
}
.group-member-control {
    width: 34px;
    height: 34px;
    min-width: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 11px;
    border: 1px solid var(--border);
    background: color-mix(in srgb, var(--bg-tertiary) 88%, transparent);
    color: var(--text);
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    transition: transform .16s ease, background .16s ease, border-color .16s ease;
}
.group-member-control:hover {
    background: var(--primary-light);
    border-color: color-mix(in srgb, var(--primary) 36%, var(--border));
}
.group-member-control:active { transform: scale(.95); }
.group-member-control.danger { color: #fb7185; }
.group-role-badge {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: color-mix(in srgb, var(--bg-tertiary) 82%, transparent);
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.2;
    font-weight: 700;
}
.group-role-badge.role-creator {
    color: #f9a8d4;
    border-color: color-mix(in srgb, #ec4899 34%, var(--border));
    background: color-mix(in srgb, #ec4899 12%, var(--bg-tertiary));
}
.group-role-badge.role-admin {
    color: #c4b5fd;
    border-color: color-mix(in srgb, var(--primary) 42%, var(--border));
    background: var(--primary-light);
}

.message-wrap.group-post-wrap {
    width: min(100%, 760px) !important;
    max-width: min(100%, 760px) !important;
    align-self: center !important;
    margin: 9px auto !important;
    padding: 0 8px !important;
}
.message-wrap.group-post-wrap .message.group-post-message {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    color: var(--text) !important;
    overflow: visible !important;
}
.message-wrap.group-post-wrap .message.group-post-message::before,
.message-wrap.group-post-wrap .message.group-post-message::after {
    display: none !important;
}
.message-wrap.group-post-wrap .group-post-message > .message-content {
    width: 100%;
    padding: 0;
}
.message-wrap.group-post-wrap .group-post-message > .message-time {
    display: none !important;
}
.group-post-card {
    position: relative;
    width: 100%;
    min-width: 0;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--border) 86%, var(--primary) 14%);
    border-radius: 24px;
    background:
        linear-gradient(145deg, color-mix(in srgb, var(--bg-secondary) 94%, var(--primary) 6%), color-mix(in srgb, var(--bg-tertiary) 96%, transparent));
    box-shadow: 0 18px 48px rgba(0,0,0,.16), inset 0 1px 0 rgba(255,255,255,.055);
    color: var(--text);
    padding: 18px;
}
.group-post-card.loading,
.group-post-card.unavailable {
    min-height: 92px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    color: var(--text-muted);
}
.group-post-card.unavailable b { color: var(--text); }
.group-post-skeleton {
    width: 42%;
    height: 10px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--border), var(--primary-light), var(--border));
    background-size: 220% 100%;
    animation: groupPostSkeleton 1.35s linear infinite;
}
@keyframes groupPostSkeleton { to { background-position: -220% 0; } }
.group-post-head {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
    margin-bottom: 14px;
}
.group-post-author-avatar {
    width: 42px;
    height: 42px;
    min-width: 42px;
    padding: 0;
    border: 1px solid color-mix(in srgb, var(--primary) 28%, var(--border));
    border-radius: 50%;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-grad);
    color: #fff;
    font-weight: 800;
    cursor: pointer;
}
.group-post-author-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.group-post-head > div {
    min-width: 0;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.group-post-head b {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
}
.group-post-head small {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    color: var(--text-muted);
}
.group-post-badge,
.group-post-timer {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .02em;
    white-space: nowrap;
}
.group-post-badge {
    color: #ddd6fe;
    border: 1px solid color-mix(in srgb, var(--primary) 34%, var(--border));
    background: var(--primary-light);
}
.group-post-timer {
    color: #fdba74;
    background: color-mix(in srgb, #f97316 12%, transparent);
}
.group-post-card h3 {
    margin: 0 0 9px;
    font-size: clamp(18px, 2.2vw, 23px);
    line-height: 1.2;
    color: var(--text);
    overflow-wrap: anywhere;
}
.group-post-text {
    font-size: 15px;
    line-height: 1.52;
    color: var(--text);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    margin-bottom: 14px;
}
.group-post-text.muted { color: var(--text-muted); }
.group-post-moderation-note {
    margin: 0 0 12px;
    border-radius: 12px;
    padding: 9px 11px;
    background: color-mix(in srgb, #f59e0b 11%, var(--bg-tertiary));
    border: 1px solid color-mix(in srgb, #f59e0b 24%, var(--border));
    color: #fcd34d;
    font-size: 12px;
    font-weight: 700;
}
.group-post-card.is-hidden { opacity: .9; }
.group-post-media-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    border-radius: 18px;
    overflow: hidden;
    margin: 14px 0;
}
.group-post-media-grid.count-1 { grid-template-columns: minmax(0, 1fr); }
.group-post-media-grid.count-3 .group-post-media:first-child { grid-row: span 2; }
/* B2: высота ячейки медиа фиксируется ДО загрузки изображения (clamp вместо
   min/max-height), иначе карточка поста прыгала на величину до 210px, когда
   img получал реальные размеры. Ячейка span-2 в сетке из 3 растягивается на
   свои две строки сама. */
.group-post-media {
    position: relative;
    min-width: 0;
    height: clamp(170px, 38vw, 380px);
    overflow: hidden;
    border: 0;
    padding: 0;
    background: #060914;
    cursor: pointer;
}
.group-post-media-grid.count-1 .group-post-media {
    height: clamp(200px, 52vw, 380px);
}
.group-post-media-grid.count-3 .group-post-media:first-child {
    height: auto;
}
.group-post-media img,
.group-post-media video {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}
/* B1: в live-предпросмотре композера публикации фото видно целиком. */
.group-post-card.compose-preview .group-post-media img {
    object-fit: contain;
}
.group-post-media.is-video { display: flex; flex-direction: column; }
.group-post-media.is-video video { object-fit: contain; }
.group-post-media.is-video span {
    position: absolute;
    left: 10px;
    bottom: 10px;
    max-width: calc(100% - 20px);
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(4,7,18,.7);
    color: #fff;
    font-size: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    pointer-events: none;
}
.group-post-poll {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 14px 0;
}
.group-post-poll-option {
    position: relative;
    min-height: 46px;
    width: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: color-mix(in srgb, var(--bg-tertiary) 82%, transparent);
    color: var(--text);
    cursor: pointer;
    text-align: left;
}
.group-post-poll-option.selected {
    border-color: color-mix(in srgb, var(--primary) 50%, var(--border));
}
.group-post-poll-fill {
    position: absolute;
    inset: 0 auto 0 0;
    background: color-mix(in srgb, var(--primary) 20%, transparent);
    pointer-events: none;
    transition: width .25s ease;
}
.group-post-poll-label,
.group-post-poll-percent {
    position: relative;
    z-index: 1;
}
.group-post-poll-label { flex: 1; font-weight: 650; overflow-wrap: anywhere; }
.group-post-poll-percent { font-size: 12px; color: var(--text-muted); }
.group-post-poll > small { padding-left: 4px; }
.group-post-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 8px;
    margin-top: 13px;
}
.group-post-action {
    min-height: 38px;
    padding: 8px 13px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: color-mix(in srgb, var(--bg-tertiary) 84%, transparent);
    color: var(--text-muted);
    font-weight: 700;
    cursor: pointer;
}
.group-post-action:hover { color: var(--text); background: var(--primary-light); }
.group-post-buy {
    flex: 1 1 280px;
    min-width: 0;
    min-height: 58px;
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    align-items: center;
    column-gap: 10px;
    padding: 9px 12px;
    border: 1px solid color-mix(in srgb, var(--primary) 34%, var(--border));
    border-radius: 16px;
    background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 19%, var(--bg-tertiary)), color-mix(in srgb, #8b5cf6 12%, var(--bg-secondary)));
    color: var(--text);
    cursor: pointer;
    text-align: left;
}
.group-post-buy > span {
    grid-row: 1 / 3;
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: var(--primary-grad);
    color: #fff;
    font-size: 0;
}
.group-post-buy > span::before {
    content: '';
    width: 18px;
    height: 21px;
    background: currentColor;
    clip-path: polygon(50% 0, 92% 17%, 86% 70%, 50% 100%, 14% 70%, 8% 17%);
}
.group-post-buy b { grid-column: 2; font-size: 13px; }
.group-post-buy small { grid-column: 2 / 4; color: #c4b5fd; }
.group-post-comments {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}
.group-post-comments.disabled {
    color: var(--text-muted);
    font-size: 12px;
}
.group-post-comments-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 7px 2px;
    border: 0;
    background: transparent;
    color: var(--text);
    font-weight: 750;
    cursor: pointer;
}
.group-post-comments-toggle b {
    min-width: 25px;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 11px;
}
.group-post-comments-body { padding-top: 8px; }
.group-post-comment-list {
    display: flex;
    flex-direction: column;
    gap: 9px;
    max-height: 330px;
    overflow: auto;
    overscroll-behavior: contain;
}
.group-post-comment {
    position: relative;
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr) auto;
    gap: 9px;
    align-items: start;
    padding: 9px;
    border-radius: 14px;
    background: color-mix(in srgb, var(--bg-tertiary) 78%, transparent);
}
.group-post-comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--primary-grad);
    color: #fff;
    font-size: 12px;
    font-weight: 800;
}
.group-post-comment-avatar img { width: 100%; height: 100%; object-fit: cover; }
.group-post-comment > div { min-width: 0; }
.group-post-comment b { font-size: 12px; }
.group-post-comment p { margin: 3px 0 0; color: var(--text); font-size: 13px; line-height: 1.42; overflow-wrap: anywhere; }
.group-post-comment > button {
    width: 27px;
    height: 27px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
}
.group-post-comment > button:hover { background: rgba(239,68,68,.12); color: #fb7185; }
.group-post-comments-empty { padding: 12px; text-align: center; color: var(--text-muted); font-size: 12px; }
.group-post-comment-compose {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    margin-top: 10px;
}
.group-post-comment-compose .input { min-width: 0; }
.group-post-comment-compose button {
    border: 0;
    border-radius: 12px;
    padding: 0 14px;
    background: var(--primary-grad);
    color: #fff;
    font-weight: 750;
    cursor: pointer;
}

.group-hub-dialog,
.group-settings-dialog,
.group-post-compose-dialog {
    width: min(94vw, 620px) !important;
    max-height: min(90dvh, 860px) !important;
    overflow: auto !important;
    padding: 0 !important;
    border-radius: 24px !important;
    border: 1px solid var(--border) !important;
    background: color-mix(in srgb, var(--bg-secondary) 96%, transparent) !important;
    color: var(--text) !important;
    box-shadow: 0 28px 90px rgba(0,0,0,.38), inset 0 1px 0 rgba(255,255,255,.055) !important;
}
.group-settings-dialog { width: min(94vw, 760px) !important; }
.group-post-compose-dialog { width: min(96vw, 980px) !important; }
.group-hub-modal-head {
    position: sticky;
    top: 0;
    z-index: 4;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 17px 18px;
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--bg-secondary) 94%, transparent);
    backdrop-filter: blur(18px);
}
.group-hub-modal-head > div { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.group-hub-modal-head b { font-size: 16px; }
.group-hub-modal-head small { color: var(--text-muted); }
.group-hub-modal-head > button,
.group-hub-close {
    width: 38px;
    height: 38px;
    min-width: 38px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: color-mix(in srgb, var(--bg-tertiary) 85%, transparent);
    color: var(--text);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}
.group-hub-dialog > .select,
.group-hub-dialog > .textarea,
.group-hub-dialog > .group-hub-field { margin: 14px 18px 0; width: calc(100% - 36px); }
.group-hub-field { display: flex; flex-direction: column; gap: 7px; }
.group-hub-field > span { color: var(--text-muted); font-size: 12px; font-weight: 700; }
.group-invite-dialog { max-width: 480px; }
/* The legacy .btn display declarations override the native [hidden] rule. */
.group-invite-dialog .group-invite-dialog-actions [hidden] { display: none !important; }
.group-invite-dialog .group-hub-modal-head small { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.group-invite-dialog .group-hub-close { width: 44px; height: 44px; min-width: 44px; }
.group-invite-dialog-hint,
.group-invite-dialog-status { margin: 14px 18px; color: var(--text-muted); line-height: 1.5; }
.group-invite-dialog-status[data-error="1"] { color: var(--danger, #ef4444); }
.group-invite-dialog-qr {
    display: flex;
    align-items: center;
    justify-content: center;
    width: min(240px, calc(100% - 36px));
    min-height: 220px;
    margin: 18px auto;
    padding: 8px;
    background: #fff;
    color: #000;
    border-radius: 16px;
}
.group-invite-dialog-qr svg { display: block; width: 100%; height: auto; }
.group-invite-dialog-link { min-width: 0; width: 100%; font-size: 16px; }
.group-invite-dialog-actions { display: flex; flex-wrap: wrap; gap: 10px; padding: 4px 18px 18px; }
.group-invite-dialog-actions .btn { flex: 1 1 auto; min-height: 44px; }
.group-hub-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 9px;
    padding: 16px 18px 18px;
}
.group-post-moderation-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    padding: 18px;
}
.group-post-moderation-actions button {
    min-height: 46px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: color-mix(in srgb, var(--bg-tertiary) 84%, transparent);
    color: var(--text);
    font-weight: 750;
    cursor: pointer;
}
.group-post-moderation-actions button.danger { color: #fb7185; }
.group-post-timer-box { padding: 0 18px 18px; display: flex; flex-direction: column; gap: 8px; }

.group-settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 18px;
}
.group-settings-grid label,
.group-settings-switches label {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 7px;
}
.group-settings-grid label > span { color: var(--text-muted); font-size: 12px; font-weight: 700; }
.group-settings-switches {
    display: grid;
    gap: 8px;
    padding: 0 18px 16px;
}
.group-settings-switches label {
    flex-direction: row;
    align-items: center;
    min-height: 46px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: color-mix(in srgb, var(--bg-tertiary) 78%, transparent);
}
.group-settings-switches input { accent-color: var(--primary); }
.group-settings-link-row { padding: 0 18px 16px; }
.group-settings-referrals,
.group-settings-bans {
    margin: 0 18px 15px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: color-mix(in srgb, var(--bg-tertiary) 70%, transparent);
}
.group-settings-referrals h4,
.group-settings-bans h4 { margin: 0 0 10px; }
.group-settings-referrals p,
.group-settings-bans p { margin: 0; color: var(--text-muted); }
.group-settings-referral-row,
.group-settings-ban-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 7px 12px;
    padding: 9px 0;
    border-top: 1px solid var(--border);
}
.group-settings-referral-row:first-of-type,
.group-settings-ban-row:first-of-type { border-top: 0; }
.group-settings-ban-row small { grid-column: 1; }
.group-settings-ban-row button {
    grid-column: 2;
    grid-row: 1 / span 2;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 7px 10px;
    background: transparent;
    color: var(--primary);
    cursor: pointer;
}

.group-post-compose-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(300px, .95fr);
    gap: 18px;
    padding: 18px;
}
.group-post-compose-form { min-width: 0; display: flex; flex-direction: column; gap: 11px; }
.group-post-live-preview { min-width: 0; }
.group-post-live-preview > span { display: block; margin-bottom: 8px; color: var(--text-muted); font-size: 12px; font-weight: 750; }
.group-post-media-picker {
    min-height: 76px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    padding: 13px;
    border: 1px dashed color-mix(in srgb, var(--primary) 45%, var(--border));
    border-radius: 16px;
    background: var(--primary-light);
    color: var(--text);
    cursor: pointer;
}
.group-post-media-picker span { font-weight: 750; }
.group-post-media-picker small { color: var(--text-muted); }
.group-post-compose-previews {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
}
.group-post-compose-preview {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 13px;
    background: #060914;
}
/* B1: локальный предпросмотр выбранного файла показывает изображение целиком
   (letterbox на тёмном фоне), а не обрезанный cover-кроп. */
.group-post-compose-preview img,
.group-post-compose-preview video { width: 100%; height: 100%; object-fit: contain; }
.group-post-compose-preview button {
    position: absolute;
    right: 6px;
    top: 6px;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(0,0,0,.72);
    color: #fff;
    cursor: pointer;
}
.group-post-feature-toggle {
    min-height: 46px;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: color-mix(in srgb, var(--bg-tertiary) 74%, transparent);
}
.group-post-feature-toggle input { accent-color: var(--primary); }
.group-post-poll-editor,
.group-post-buy-editor { display: flex; flex-direction: column; gap: 8px; }
.group-post-poll-editor.hidden,
.group-post-buy-editor.hidden { display: none !important; }
.group-post-poll-editor > button {
    min-height: 38px;
    border: 1px dashed var(--border);
    border-radius: 12px;
    background: transparent;
    color: var(--primary);
    cursor: pointer;
}
.group-post-buy-editor > div { display: grid; grid-template-columns: minmax(0, 1fr) 110px; gap: 8px; }
.group-post-card.compose-preview { position: sticky; top: 82px; }

body.theme-light .group-post-card,
html[data-theme="light"] body .group-post-card,
body.theme-light .group-hub-dialog,
body.theme-light .group-settings-dialog,
body.theme-light .group-post-compose-dialog,
html[data-theme="light"] body .group-hub-dialog,
html[data-theme="light"] body .group-settings-dialog,
html[data-theme="light"] body .group-post-compose-dialog {
    box-shadow: 0 18px 48px rgba(15,23,42,.11), inset 0 1px 0 rgba(255,255,255,.7) !important;
}

@media (max-width: 760px) {
    .message-wrap.group-post-wrap { padding: 0 4px !important; margin: 7px auto !important; }
    .group-post-card { padding: 13px; border-radius: 19px; }
    .group-post-head { margin-bottom: 11px; }
    .group-post-badge { display: none; }
    .group-post-media { min-height: 125px; }
    .group-post-media img,
    .group-post-media video { min-height: 125px; max-height: 300px; }
    .group-post-buy { grid-template-columns: 36px minmax(0, 1fr); }
    .group-post-buy small { grid-column: 2; }
    .group-post-comment-compose { grid-template-columns: minmax(0, 1fr); }
    .group-post-comment-compose button { min-height: 40px; }
    .group-settings-grid { grid-template-columns: minmax(0, 1fr); padding: 14px; }
    .group-settings-switches { padding: 0 14px 14px; }
    .group-settings-link-row { padding: 0 14px 14px; }
    .group-settings-referrals,
    .group-settings-bans { margin-left: 14px; margin-right: 14px; }
    .group-post-compose-layout { grid-template-columns: minmax(0, 1fr); padding: 14px; }
    .group-post-live-preview { order: -1; }
    .group-post-card.compose-preview { position: static; }
    .group-post-compose-dialog { width: 100vw !important; max-width: 100vw !important; height: 100dvh !important; max-height: 100dvh !important; border-radius: 0 !important; }
    .group-hub-modal-actions { position: sticky; bottom: 0; background: color-mix(in srgb, var(--bg-secondary) 94%, transparent); backdrop-filter: blur(16px); }
    .group-member-controls { gap: 4px; }
    .group-member-control { width: 31px; height: 31px; min-width: 31px; border-radius: 10px; }
}

@media (max-width: 430px) {
    .group-post-media-grid { grid-template-columns: minmax(0, 1fr); }
    .group-post-media-grid.count-3 .group-post-media:first-child { grid-row: auto; }
    .group-post-actions { flex-direction: column; }
    .group-post-buy { flex-basis: auto; }
    .group-post-compose-previews { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .group-member-row { align-items: center; }
    .group-member-controls { flex-wrap: wrap; justify-content: flex-end; max-width: 76px; }
}

/* Group Hub v1 final polish: report review and live composer media */
.group-post-report-list {
    margin: 16px 18px 0;
    padding: 13px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: color-mix(in srgb, var(--bg-tertiary) 72%, transparent);
    max-height: 260px;
    overflow: auto;
}
.group-post-report-list h4 {
    margin: 0 0 9px;
    font-size: 13px;
}
.group-post-report-row {
    display: grid;
    gap: 5px;
    padding: 10px 0;
    border-top: 1px solid var(--border);
}
.group-post-report-row:first-of-type { border-top: 0; }
.group-post-report-row > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.group-post-report-row span,
.group-post-report-row small { color: var(--text-muted); font-size: 11px; }
.group-post-report-row p { margin: 0; color: var(--text); font-size: 13px; line-height: 1.4; overflow-wrap: anywhere; }
.group-post-compose-preview small {
    position: absolute;
    left: 6px;
    right: 38px;
    bottom: 6px;
    overflow: hidden;
    padding: 4px 7px;
    border-radius: 8px;
    background: rgba(4,7,18,.72);
    color: #fff;
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.group-post-card.compose-preview .group-post-media,
.group-post-card.compose-preview .group-post-media img,
.group-post-card.compose-preview .group-post-media video { min-height: 120px; max-height: 260px; }
.group-post-card.compose-preview .compose-poll .group-post-poll-option,
.group-post-card.compose-preview .compose-buy { pointer-events: none; }
@media (max-width: 760px) {
    .group-post-report-list { margin: 13px 14px 0; max-height: 220px; }
}
.group-member-control svg { width: 17px; height: 17px; display: block; }
.group-post-action.danger { color: #fb7185; border-color: color-mix(in srgb, #ef4444 28%, var(--border)); }

/* === DEALIX 173: Group Hub UX polish, in-panel settings/composer === */
.group-members-panel.group-info-panel.group-info-subview-open .group-info-cover {
    min-height: 112px !important;
    padding: 28px 72px 18px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
}
.group-members-panel.group-info-panel.group-info-subview-open .group-members-title {
    margin-top: 0 !important;
    font-size: clamp(20px, 2.3vw, 28px) !important;
}
.group-members-panel.group-info-panel.group-info-subview-open .group-members-subtitle {
    margin-top: 4px !important;
}
.group-info-back {
    position: absolute;
    top: 14px;
    left: 14px;
    z-index: 10;
    width: 42px;
    height: 42px;
    min-width: 42px;
    min-height: 42px;
    padding: 0;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,.16);
    background: rgba(15,23,42,.30);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 12px 30px rgba(0,0,0,.18), inset 0 1px 0 rgba(255,255,255,.08);
    backdrop-filter: blur(12px) saturate(1.14);
    -webkit-backdrop-filter: blur(12px) saturate(1.14);
    cursor: pointer;
    transition: transform .16s ease, background .16s ease, border-color .16s ease;
}
.group-info-back:hover,
.group-info-back:focus-visible {
    background: rgba(30,41,59,.50);
    border-color: rgba(167,139,250,.35);
}
.group-info-back:active { transform: scale(.96); }
.group-info-back.hidden { display: none !important; }
.group-info-main-content.hidden,
.group-info-subview.hidden { display: none !important; }
.group-info-subview {
    width: min(820px, calc(100% - 36px));
    margin: 0 auto;
    padding: 18px 0 32px;
    min-width: 0;
}

/* Settings become a native inner screen instead of a modal. */
.group-settings-screen {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
}
.group-settings-section {
    border: 1px solid color-mix(in srgb, var(--border) 88%, var(--primary) 12%);
    border-radius: 20px;
    background: color-mix(in srgb, var(--bg-secondary) 92%, transparent);
    box-shadow: 0 14px 36px rgba(0,0,0,.10), inset 0 1px 0 rgba(255,255,255,.04);
    overflow: hidden;
}
.group-settings-section > h3,
.group-settings-section-head {
    margin: 0;
    padding: 16px 18px 10px;
}
.group-settings-section > h3 { font-size: 15px; }
.group-settings-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}
.group-settings-section-head > div { min-width: 0; }
.group-settings-section-head h3 { margin: 0; font-size: 15px; }
.group-settings-section-head p { margin: 4px 0 0; color: var(--text-muted); font-size: 12px; }
.group-settings-link-actions { display: flex; flex-wrap: wrap; flex-shrink: 0; gap: 8px; }
.group-settings-section .group-settings-grid {
    padding: 8px 16px 16px;
}
.group-settings-section .group-settings-switches {
    padding: 0 16px 16px;
}
.group-settings-section .group-settings-switches label {
    display: grid;
    grid-template-columns: auto minmax(0,1fr);
    align-items: center;
    min-height: 58px;
    gap: 12px;
    border-radius: 15px;
    background: color-mix(in srgb, var(--bg-tertiary) 80%, transparent);
}
.group-settings-section .group-settings-switches label > span {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.group-settings-section .group-settings-switches b { font-size: 13px; color: var(--text); }
.group-settings-section .group-settings-switches small { color: var(--text-muted); line-height: 1.35; }
.group-settings-section .group-settings-referrals,
.group-settings-section .group-settings-bans {
    margin: 0 16px 16px;
    background: color-mix(in srgb, var(--bg-tertiary) 70%, transparent);
}
.group-settings-section.compact .group-settings-referrals,
.group-settings-section.compact .group-settings-bans { margin-top: 0; }
.group-settings-sticky-actions {
    position: sticky;
    bottom: 0;
    z-index: 3;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px 0 max(2px, env(safe-area-inset-bottom));
    background: linear-gradient(to bottom, transparent, color-mix(in srgb, var(--bg-secondary) 96%, transparent) 28%);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

/* Composer lives in the group panel and uses one coherent flow. */
.group-post-compose-screen {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
}
.group-post-compose-screen .group-post-compose-form,
.group-post-inline-preview {
    border: 1px solid color-mix(in srgb, var(--border) 88%, var(--primary) 12%);
    border-radius: 20px;
    background: color-mix(in srgb, var(--bg-secondary) 92%, transparent);
    box-shadow: 0 14px 36px rgba(0,0,0,.10), inset 0 1px 0 rgba(255,255,255,.04);
    padding: 16px;
}
.group-compose-intro {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 2px;
}
.group-compose-intro > div:last-child {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.group-compose-intro b { color: var(--text); font-size: 15px; }
.group-compose-intro small { color: var(--text-muted); }
.group-compose-icon {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-grad);
    color: #fff;
    box-shadow: 0 10px 24px color-mix(in srgb, var(--primary) 25%, transparent);
}
.group-compose-icon svg { width: 21px; height: 21px; }
.group-post-compose-features {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 9px;
}
.group-post-compose-screen .group-post-feature-toggle {
    min-height: 62px;
    display: grid;
    grid-template-columns: auto minmax(0,1fr);
    align-items: center;
}
.group-post-compose-screen .group-post-feature-toggle > span {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.group-post-compose-screen .group-post-feature-toggle b { color: var(--text); font-size: 13px; }
.group-post-compose-screen .group-post-feature-toggle small { color: var(--text-muted); line-height: 1.3; }
.group-post-media-picker span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.group-post-media-picker svg { width: 20px; height: 20px; }
.group-post-compose-preview button svg { width: 14px; height: 14px; display: block; margin: auto; }
.group-post-preview-label {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}
.group-post-preview-label span { color: var(--text); font-size: 13px; font-weight: 800; }
.group-post-preview-label small { color: var(--text-muted); }
.group-post-compose-actions {
    position: sticky;
    bottom: 0;
    z-index: 3;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px 0 max(2px, env(safe-area-inset-bottom));
    background: linear-gradient(to bottom, transparent, color-mix(in srgb, var(--bg-secondary) 96%, transparent) 28%);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

/* A group post is one surface, not a bubble inside another bubble. */
#chat-messages .message-wrap.group-post-wrap,
#chat-messages .message-wrap.group-post-wrap.group-message-wrap {
    width: min(100%, 760px) !important;
    max-width: min(100%, 760px) !important;
    padding: 0 8px !important;
    margin: 10px auto !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
}
#chat-messages .message-wrap.group-post-wrap > .message,
#chat-messages .message-wrap.group-post-wrap > .message.group-message,
#chat-messages .message-wrap.group-post-wrap > .message.group-post-message,
#chat-messages .message-wrap.group-post-wrap .message-content {
    width: 100% !important;
    max-width: none !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    overflow: visible !important;
}
#chat-messages .message-wrap.group-post-wrap > .message::before,
#chat-messages .message-wrap.group-post-wrap > .message::after { display: none !important; }
.group-post-card {
    padding: 16px !important;
    border-radius: 22px !important;
    border-color: color-mix(in srgb, var(--border) 82%, var(--primary) 18%) !important;
    background: color-mix(in srgb, var(--bg-secondary) 95%, transparent) !important;
    box-shadow: 0 14px 36px rgba(0,0,0,.13), inset 0 1px 0 rgba(255,255,255,.05) !important;
}
.group-post-card .group-post-head { margin-bottom: 12px; }
.group-post-card .group-post-actions {
    padding-top: 12px;
    margin-top: 12px;
    border-top: 1px solid color-mix(in srgb, var(--border) 82%, transparent);
}
.group-post-buy {
    min-height: 56px;
    grid-template-columns: 40px minmax(0,1fr) auto;
    border-radius: 15px;
    overflow: hidden;
}
.group-post-buy-icon,
.group-post-buy > span.group-post-buy-icon {
    grid-row: 1 / 3;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 13px;
    background: var(--primary-grad);
    color: #fff;
    box-shadow: 0 8px 20px color-mix(in srgb, var(--primary) 24%, transparent);
}
.group-post-buy-icon svg { width: 21px; height: 21px; }
.group-post-buy small {
    color: color-mix(in srgb, var(--primary) 66%, var(--text-muted));
    font-variant-numeric: tabular-nums;
}
.group-post-comments {
    margin-top: 13px;
    border-top: 1px solid color-mix(in srgb, var(--border) 82%, transparent);
}
.group-post-comments.preview-only {
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 12px;
    color: var(--text-muted);
    font-size: 13px;
}
.group-post-comment {
    border-radius: 14px;
    padding: 9px 10px;
    background: color-mix(in srgb, var(--bg-tertiary) 72%, transparent);
}
.group-post-comment > button {
    width: 28px;
    height: 28px;
    border-radius: 9px;
    font-size: 0;
}
.group-post-comment > button::before {
    content: '×';
    font-size: 16px;
    line-height: 1;
}

/* Cleaner member tools: no clipped person icon and no solid red blocks. */
.group-member-row { overflow: visible !important; }
.group-member-controls {
    gap: 7px !important;
    overflow: visible !important;
    max-width: none !important;
    flex-wrap: nowrap !important;
}
.group-member-control {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    border-radius: 12px !important;
    overflow: visible !important;
    background: color-mix(in srgb, var(--bg-tertiary) 72%, transparent) !important;
}
.group-member-control svg {
    width: 20px !important;
    height: 20px !important;
    min-width: 20px !important;
    overflow: visible !important;
}
.group-member-control.danger {
    color: #fb7185 !important;
    background: color-mix(in srgb, #ef4444 8%, var(--bg-tertiary)) !important;
    border-color: color-mix(in srgb, #ef4444 24%, var(--border)) !important;
}
.group-member-control.danger:hover {
    background: color-mix(in srgb, #ef4444 15%, var(--bg-tertiary)) !important;
}

/* Deletable system notices for owners/moderators. */
.message-system-pill {
    display: inline-flex !important;
    align-items: center !important;
    gap: 7px !important;
}
.message-system-pill > span { min-width: 0; }
.message-system-delete {
    width: 25px;
    height: 25px;
    min-width: 25px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,.07);
    color: currentColor;
    opacity: .62;
    cursor: pointer;
    transition: opacity .16s ease, background .16s ease, transform .16s ease;
}
.message-system-delete:hover,
.message-system-delete:focus-visible { opacity: 1; background: rgba(255,255,255,.14); }
.message-system-delete:active { transform: scale(.94); }
.message-system-delete svg { width: 13px; height: 13px; display: block; }

/* Locked amount when a deal is created from a post. */
.deal-amount-locked {
    cursor: not-allowed !important;
    font-weight: 800 !important;
    font-variant-numeric: tabular-nums;
    background: color-mix(in srgb, var(--primary) 9%, var(--bg-tertiary)) !important;
    border-color: color-mix(in srgb, var(--primary) 28%, var(--border)) !important;
}
.deal-amount-lock-hint {
    display: flex !important;
    align-items: center;
    gap: 7px;
    color: color-mix(in srgb, var(--primary) 72%, var(--text-muted)) !important;
}
.deal-amount-lock-icon {
    width: 18px;
    height: 18px;
    min-width: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.deal-amount-lock-icon svg { width: 15px; height: 15px; }

/* Light and glass themes. */
body.theme-light .group-settings-section,
html[data-theme="light"] body .group-settings-section,
body.theme-light .group-post-compose-screen .group-post-compose-form,
body.theme-light .group-post-inline-preview,
html[data-theme="light"] body .group-post-compose-screen .group-post-compose-form,
html[data-theme="light"] body .group-post-inline-preview,
body.theme-light .group-post-card,
html[data-theme="light"] body .group-post-card {
    background: rgba(255,255,255,.94) !important;
    box-shadow: 0 14px 34px rgba(15,23,42,.10), inset 0 1px 0 rgba(255,255,255,.82) !important;
}
body.theme-light .group-info-back,
html[data-theme="light"] body .group-info-back {
    color: #111827;
    background: rgba(255,255,255,.84);
    border-color: rgba(15,23,42,.12);
}
body.theme-glass .group-settings-section,
html[data-theme="glass"] body .group-settings-section,
body[data-theme="glass"] .group-settings-section,
body.theme-glass .group-post-compose-screen .group-post-compose-form,
body.theme-glass .group-post-inline-preview,
html[data-theme="glass"] body .group-post-compose-screen .group-post-compose-form,
html[data-theme="glass"] body .group-post-inline-preview,
body.theme-glass .group-post-card,
html[data-theme="glass"] body .group-post-card {
    background: color-mix(in srgb, var(--bg-secondary) 70%, transparent) !important;
    backdrop-filter: blur(20px) saturate(1.16) !important;
    -webkit-backdrop-filter: blur(20px) saturate(1.16) !important;
    box-shadow: 0 18px 48px rgba(0,0,0,.16), inset 0 1px 0 rgba(255,255,255,.08) !important;
}

@media (max-width: 760px) {
    .group-members-panel.group-info-panel.group-info-subview-open .group-info-cover {
        min-height: 96px !important;
        padding: max(22px, env(safe-area-inset-top)) 62px 14px !important;
    }
    .group-info-back {
        top: max(12px, env(safe-area-inset-top));
        left: max(12px, env(safe-area-inset-left));
        width: 40px;
        height: 40px;
        min-width: 40px;
        min-height: 40px;
    }
    .group-info-subview {
        width: calc(100% - 20px);
        padding: 10px 0 calc(24px + env(safe-area-inset-bottom));
    }
    .group-settings-section,
    .group-post-compose-screen .group-post-compose-form,
    .group-post-inline-preview { border-radius: 17px; padding-left: 12px; padding-right: 12px; }
    .group-settings-section > h3,
    .group-settings-section-head { padding-left: 13px; padding-right: 13px; }
    .group-settings-section .group-settings-grid,
    .group-settings-section .group-settings-switches { padding-left: 12px; padding-right: 12px; }
    .group-settings-section .group-settings-referrals,
    .group-settings-section .group-settings-bans { margin-left: 12px; margin-right: 12px; }
    .group-post-compose-features { grid-template-columns: minmax(0,1fr); }
    .group-post-inline-preview { padding: 12px; }
    .group-post-card { padding: 13px !important; border-radius: 18px !important; }
    .group-post-buy { grid-template-columns: 38px minmax(0,1fr); }
    .group-post-buy small { grid-column: 2; }
    .group-post-actions { flex-direction: column; }
    .group-member-controls { gap: 4px !important; }
    .group-member-control { width: 32px !important; height: 32px !important; min-width: 32px !important; border-radius: 10px !important; }
    .group-member-control svg { width: 18px !important; height: 18px !important; min-width: 18px !important; }
    .message-system-delete { width: 24px; height: 24px; min-width: 24px; }
}

@media (max-width: 430px) {
    #chat-messages .message-wrap.group-post-wrap { padding: 0 3px !important; }
    .group-settings-grid { grid-template-columns: minmax(0,1fr) !important; }
    .group-settings-section-head { align-items: flex-start; flex-direction: column; }
    .group-settings-link-actions { width: 100%; }
    .group-settings-link-actions .btn { flex: 1 1 0; }
    .group-settings-sticky-actions,
    .group-post-compose-actions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
    .group-settings-sticky-actions .btn,
    .group-post-compose-actions .btn { width: 100%; }
    .group-post-compose-previews { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .group-member-main { min-width: 0; }
    .group-member-controls { flex-wrap: nowrap !important; max-width: none !important; }
}

/* Group settings, presentation only (same markup, data-* hooks and handlers):
   settings-style cards with uppercase captions, pill selects with a chevron,
   the two options as one grouped list with native-looking switches, a clearer
   invite/statistics block and a calmer sticky action bar. */
.group-settings-screen {
    width: 100%;
    max-width: 680px;
    margin-inline: auto;
    gap: 16px;
}

.group-settings-screen .group-settings-section {
    border: 1px solid color-mix(in srgb, var(--text) 9%, transparent);
    border-radius: 20px;
    background: color-mix(in srgb, var(--bg-secondary) 94%, transparent);
    box-shadow: 0 10px 28px rgba(0, 0, 0, .12);
}

.group-settings-screen .group-settings-section > h3,
.group-settings-screen .group-settings-section-head h3 {
    margin: 0;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 750;
    line-height: 1.4;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.group-settings-screen .group-settings-section > h3 { padding: 16px 18px 4px; }
.group-settings-screen .group-settings-section-head { padding: 16px 18px 12px; align-items: center; }
.group-settings-screen .group-settings-section-head p { margin-top: 4px; font-size: 13px; line-height: 1.4; }

/* Selects */
.group-settings-screen .group-settings-grid { gap: 14px; padding: 10px 18px 16px; }
.group-settings-screen .group-settings-grid label { gap: 8px; }
.group-settings-screen .group-settings-grid label > span {
    padding-inline: 4px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 650;
}

.group-settings-screen .group-settings-grid select {
    width: 100%;
    height: 50px;
    min-height: 50px;
    margin: 0;
    padding: 0 44px 0 16px;
    border: 1px solid color-mix(in srgb, var(--text) 11%, transparent);
    border-radius: 15px;
    -webkit-appearance: none;
    appearance: none;
    color: var(--text);
    background-color: color-mix(in srgb, var(--bg-tertiary) 80%, transparent);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b95a7' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 16px 16px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .03);
    font-size: 15px;
    font-weight: 600;
    text-overflow: ellipsis;
    cursor: pointer;
    transition: border-color .16s ease, box-shadow .16s ease;
}

.group-settings-screen .group-settings-grid select:hover { border-color: color-mix(in srgb, var(--text) 20%, transparent); }

.group-settings-screen .group-settings-grid select:focus-visible {
    outline: none;
    border-color: color-mix(in srgb, var(--primary) 60%, transparent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent);
}

.group-settings-screen .group-settings-grid select option { color: var(--text); background: var(--bg-secondary); }

html[data-text-dir="rtl"] .group-settings-screen .group-settings-grid select {
    padding: 0 16px 0 44px;
    background-position: left 16px center;
}

/* Options: one grouped list, text first, switch at the end of the row. */
.group-settings-screen .group-settings-section .group-settings-switches {
    gap: 0;
    margin: 0 18px 18px;
    padding: 0;
    border: 1px solid color-mix(in srgb, var(--text) 9%, transparent);
    border-radius: 16px;
    overflow: hidden;
    background: color-mix(in srgb, var(--bg-tertiary) 72%, transparent);
}

.group-settings-screen .group-settings-section .group-settings-switches label {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    min-height: 66px;
    padding: 12px 16px;
    border: 0;
    border-radius: 0;
    background: transparent;
    cursor: pointer;
    transition: background-color .16s ease;
}

.group-settings-screen .group-settings-section .group-settings-switches label + label {
    border-top: 1px solid color-mix(in srgb, var(--text) 8%, transparent);
}

.group-settings-screen .group-settings-section .group-settings-switches label:hover { background: color-mix(in srgb, var(--text) 4%, transparent); }
.group-settings-screen .group-settings-section .group-settings-switches label > span { gap: 3px; }
.group-settings-screen .group-settings-section .group-settings-switches b { font-size: 15px; font-weight: 650; line-height: 1.3; }
.group-settings-screen .group-settings-section .group-settings-switches small { font-size: 13px; line-height: 1.4; }

.group-settings-screen .group-settings-switches input[type="checkbox"] {
    order: 2;
    position: relative;
    flex: 0 0 auto;
    width: 48px;
    height: 29px;
    margin: 0;
    border: 0;
    border-radius: 999px;
    -webkit-appearance: none;
    appearance: none;
    background: color-mix(in srgb, var(--text) 22%, transparent);
    cursor: pointer;
    transition: background-color .2s ease;
}

.group-settings-screen .group-settings-switches input[type="checkbox"]::before {
    content: '';
    position: absolute;
    top: 3px;
    inset-inline-start: 3px;
    width: 23px;
    height: 23px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .28);
    transition: transform .2s cubic-bezier(.2, .8, .2, 1);
}

.group-settings-screen .group-settings-switches input[type="checkbox"]:checked { background: var(--primary); }
.group-settings-screen .group-settings-switches input[type="checkbox"]:checked::before { transform: translateX(19px); }
html[data-text-dir="rtl"] .group-settings-screen .group-settings-switches input[type="checkbox"]:checked::before { transform: translateX(-19px); }

.group-settings-screen .group-settings-switches input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
}

.group-settings-screen .group-settings-switches input[type="checkbox"]:disabled { cursor: default; opacity: .5; }

/* Invite link and statistics */
.group-settings-screen .group-settings-link-actions { gap: 8px; }

.group-settings-screen .group-settings-link-actions .btn {
    min-height: 42px;
    padding: 0 16px;
    border-radius: 13px;
    font-size: 14px;
    font-weight: 650;
}

.group-settings-screen .group-settings-link-actions [data-copy-link] {
    color: var(--primary-text, var(--primary));
    border-color: color-mix(in srgb, var(--primary) 34%, transparent);
    background: color-mix(in srgb, var(--primary) 14%, transparent);
}

.group-settings-screen .group-settings-section .group-settings-referrals,
.group-settings-screen .group-settings-section .group-settings-bans {
    margin: 0 18px 18px;
    padding: 4px 16px;
    border: 1px solid color-mix(in srgb, var(--text) 9%, transparent);
    border-radius: 16px;
    background: color-mix(in srgb, var(--bg-tertiary) 72%, transparent);
}

.group-settings-screen .group-settings-referrals > p {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 54px;
    margin: 0;
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 600;
}

.group-settings-screen .group-settings-referrals > p > b {
    flex: 0 0 auto;
    min-width: 36px;
    padding: 4px 10px;
    border-radius: 999px;
    color: var(--primary-text, var(--primary));
    background: color-mix(in srgb, var(--primary) 16%, transparent);
    font-size: 16px;
    font-weight: 750;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.group-settings-screen .group-settings-referrals > small {
    display: block;
    padding: 0 0 14px;
    color: var(--text-muted);
    font-size: 13px;
}

.group-settings-screen .group-settings-referral-row,
.group-settings-screen .group-settings-ban-row {
    min-height: 52px;
    padding: 10px 0;
    border-top: 1px solid color-mix(in srgb, var(--text) 8%, transparent);
    font-size: 15px;
}

.group-settings-screen .group-settings-referral-row b { font-variant-numeric: tabular-nums; }
.group-settings-screen .group-settings-ban-row:first-of-type { border-top: 0; }
.group-settings-screen .group-settings-ban-row span { font-weight: 650; }
.group-settings-screen .group-settings-ban-row small { color: var(--text-muted); font-size: 13px; }

.group-settings-screen .group-settings-ban-row button {
    min-height: 36px;
    padding: 0 14px;
    border: 0;
    border-radius: 12px;
    color: var(--primary-text, var(--primary));
    background: color-mix(in srgb, var(--primary) 14%, transparent);
    font: inherit;
    font-size: 13px;
    font-weight: 700;
}

.group-settings-screen .group-settings-bans > p {
    min-height: 54px;
    display: flex;
    align-items: center;
    color: var(--text-muted);
    font-size: 14px;
}

/* Action bar */
.group-settings-screen .group-settings-sticky-actions {
    gap: 10px;
    padding: 14px 0 max(6px, env(safe-area-inset-bottom));
}

.group-settings-screen .group-settings-sticky-actions .btn {
    min-width: 140px;
    min-height: 48px;
    border-radius: 15px;
    font-size: 15px;
    font-weight: 700;
}

@media (max-width: 760px) {
    .group-settings-screen .group-settings-section { padding-inline: 0; border-radius: 18px; }
    .group-settings-screen .group-settings-section > h3,
    .group-settings-screen .group-settings-section-head { padding-inline: 16px; }
    .group-settings-screen .group-settings-grid { padding-inline: 16px; }
    .group-settings-screen .group-settings-section .group-settings-switches,
    .group-settings-screen .group-settings-section .group-settings-referrals,
    .group-settings-screen .group-settings-section .group-settings-bans { margin-inline: 16px; }
}

@media (max-width: 430px) {
    .group-settings-screen .group-settings-link-actions .btn { min-height: 44px; }
    .group-settings-screen .group-settings-sticky-actions .btn { min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .group-settings-screen .group-settings-switches input[type="checkbox"],
    .group-settings-screen .group-settings-switches input[type="checkbox"]::before { transition: none; }
}
.group-members-panel.group-info-panel .group-members-card { position: relative !important; }

/* ===== Group Hub 174: forwarded post snapshots ===== */
.message-wrap.group-post-wrap .message-forwarded-badge {
    width: fit-content;
    max-width: calc(100% - 12px);
    margin: 0 0 8px 6px;
    padding: 5px 9px;
    border: 1px solid color-mix(in srgb, var(--primary) 22%, var(--border));
    border-radius: 999px;
    background: color-mix(in srgb, var(--bg-secondary) 84%, transparent);
    color: var(--text-muted);
    box-shadow: 0 6px 18px rgba(0,0,0,.08);
}
.group-post-card.is-shared {
    border-color: color-mix(in srgb, var(--primary) 28%, var(--border)) !important;
}
.group-post-card.is-shared .group-post-badge {
    color: color-mix(in srgb, var(--primary) 72%, #fff);
}
.group-post-share-source {
    width: fit-content;
    max-width: 100%;
    margin: -2px 0 12px;
    padding: 5px 9px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--primary) 9%, var(--bg-tertiary));
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.group-post-poll.is-readonly .group-post-poll-option.readonly {
    cursor: default;
    user-select: none;
}
.group-post-poll.is-readonly .group-post-poll-option.readonly:active {
    transform: none;
}
body.theme-light .message-wrap.group-post-wrap .message-forwarded-badge,
html[data-theme="light"] body .message-wrap.group-post-wrap .message-forwarded-badge {
    background: rgba(255,255,255,.92);
    color: #64748b;
}
body.theme-glass .message-wrap.group-post-wrap .message-forwarded-badge,
html[data-theme="glass"] body .message-wrap.group-post-wrap .message-forwarded-badge {
    background: color-mix(in srgb, var(--bg-secondary) 62%, transparent);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}
@media (max-width: 560px) {
    .message-wrap.group-post-wrap .message-forwarded-badge {
        margin-left: 3px;
        font-size: 11px;
    }
    .group-post-share-source {
        font-size: 10px;
        margin-bottom: 10px;
    }
}

/* ===== Group Hub 176: canonical notice actions, one-shot polls and media playback ===== */
.message-system-row.is-deletable {
    cursor: context-menu;
    -webkit-user-select: none;
    user-select: none;
    touch-action: pan-y;
}
.message-system-row.is-deletable .message-system-pill {
    transition: background .16s ease, border-color .16s ease, transform .16s ease;
}
.message-system-row.is-deletable:hover .message-system-pill {
    border-color: color-mix(in srgb, var(--primary) 24%, var(--border));
    background: color-mix(in srgb, var(--bg-tertiary) 88%, var(--primary) 5%);
}

/* The post itself is the only surface: no bright outgoing-bubble outline. */
#chat-messages .message-wrap.group-post-wrap.sent,
#chat-messages .message-wrap.group-post-wrap.received,
#chat-messages .message-wrap.group-post-wrap .message.group-post-message.sent,
#chat-messages .message-wrap.group-post-wrap .message.group-post-message.received {
    background: transparent !important;
    border: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
}
.group-post-card,
.group-post-card.is-shared {
    border: 0 !important;
    outline: 0 !important;
    background: color-mix(in srgb, var(--bg-secondary) 97%, transparent) !important;
    box-shadow: 0 12px 30px rgba(0,0,0,.12), inset 0 1px 0 rgba(255,255,255,.045) !important;
}
.group-post-card.is-hidden {
    opacity: 1;
}
.group-post-moderation-note {
    border: 0 !important;
    border-left: 3px solid #f59e0b !important;
    border-radius: 10px !important;
    background: color-mix(in srgb, #f59e0b 9%, var(--bg-tertiary)) !important;
    padding: 9px 11px !important;
}
.group-post-head {
    padding-bottom: 11px;
    border-bottom: 1px solid color-mix(in srgb, var(--border) 72%, transparent);
}
.group-post-badge {
    border-color: color-mix(in srgb, var(--border) 86%, transparent) !important;
    background: color-mix(in srgb, var(--bg-tertiary) 86%, transparent) !important;
    color: var(--text-muted) !important;
}
.group-post-text {
    margin-bottom: 12px;
}

/* Video/GIF controls must stay above message gestures and remain tappable. */
.group-post-media-grid {
    gap: 4px;
    border-radius: 16px;
    background: #050812;
}
.group-post-media {
    cursor: default;
    isolation: isolate;
    touch-action: manipulation;
}
.group-post-media video {
    position: relative;
    z-index: 2;
    pointer-events: auto !important;
    touch-action: manipulation;
    background: #050812;
}
.group-post-media.is-video span {
    z-index: 3;
    opacity: .86;
}
.group-post-media.chat-media-image-btn {
    cursor: zoom-in;
}
.group-post-media.is-gif::after {
    content: 'GIF';
    position: absolute;
    right: 9px;
    top: 9px;
    z-index: 3;
    padding: 4px 7px;
    border-radius: 8px;
    background: rgba(5,8,18,.72);
    color: #fff;
    font-size: 10px;
    font-weight: 850;
    letter-spacing: .05em;
    pointer-events: none;
}
.group-post-media.is-gif img {
    image-rendering: auto;
}

/* One vote per account: clean radio-like result state. */
.group-post-poll {
    gap: 7px;
}
.group-post-poll-option {
    min-height: 48px;
    grid-template-columns: 20px minmax(0,1fr) auto;
    border-radius: 13px;
    padding: 10px 12px;
    background: color-mix(in srgb, var(--bg-tertiary) 68%, transparent);
    transition: border-color .16s ease, background .16s ease, transform .12s ease;
}
.group-post-poll-option:not(:disabled):hover {
    border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
    background: color-mix(in srgb, var(--bg-tertiary) 78%, var(--primary) 4%);
}
.group-post-poll-option:not(:disabled):active {
    transform: scale(.995);
}
.group-post-poll-choice {
    position: relative;
    z-index: 2;
    width: 18px;
    height: 18px;
    min-width: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid color-mix(in srgb, var(--text-muted) 64%, var(--border));
    border-radius: 50%;
    background: color-mix(in srgb, var(--bg-secondary) 85%, transparent);
}
.group-post-poll-choice > span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: transparent;
}
.group-post-poll-option.selected .group-post-poll-choice {
    border-color: var(--primary);
}
.group-post-poll-option.selected .group-post-poll-choice > span {
    background: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}
.group-post-poll.is-voted .group-post-poll-option {
    cursor: default;
    opacity: 1;
}
.group-post-poll.is-voted .group-post-poll-option:disabled {
    color: var(--text);
    -webkit-text-fill-color: var(--text);
}
.group-post-poll.is-voted .group-post-poll-option:not(.selected) .group-post-poll-choice {
    opacity: .56;
}
.group-post-poll > small {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 650;
}

/* The SVG is the only guarantee icon; suppress the old CSS shield duplicate. */
.group-post-buy > span::before,
.group-post-buy > span.group-post-buy-icon::before,
.group-post-buy-icon::before {
    display: none !important;
    content: none !important;
}
.group-post-buy {
    border-color: color-mix(in srgb, var(--primary) 22%, var(--border)) !important;
    background: color-mix(in srgb, var(--bg-tertiary) 78%, var(--primary) 5%) !important;
    box-shadow: none !important;
}
.group-post-buy:hover {
    border-color: color-mix(in srgb, var(--primary) 42%, var(--border)) !important;
    background: color-mix(in srgb, var(--bg-tertiary) 72%, var(--primary) 9%) !important;
}
.group-post-buy-icon,
.group-post-buy > span.group-post-buy-icon {
    box-shadow: none !important;
}
.group-post-actions {
    gap: 7px;
}
.group-post-action {
    border-radius: 11px;
    background: transparent;
}

body.theme-light .group-post-card,
html[data-theme="light"] body .group-post-card {
    border-color: rgba(15,23,42,.10) !important;
    background: rgba(255,255,255,.97) !important;
    box-shadow: 0 10px 28px rgba(15,23,42,.09) !important;
}
body.theme-light .group-post-poll-option,
html[data-theme="light"] body .group-post-poll-option {
    background: rgba(241,245,249,.76);
}
body.theme-glass .group-post-card,
html[data-theme="glass"] body .group-post-card,
body[data-theme="glass"] .group-post-card {
    border-color: rgba(255,255,255,.10) !important;
    background: color-mix(in srgb, var(--bg-secondary) 68%, transparent) !important;
    box-shadow: 0 14px 34px rgba(0,0,0,.14), inset 0 1px 0 rgba(255,255,255,.07) !important;
}

@media (max-width: 560px) {
    #chat-messages .message-wrap.group-post-wrap,
    #chat-messages .message-wrap.group-post-wrap.group-message-wrap {
        padding: 0 4px !important;
        margin: 7px auto !important;
    }
    .group-post-card {
        padding: 12px !important;
        border-radius: 17px !important;
    }
    .group-post-head {
        gap: 9px;
        padding-bottom: 9px;
    }
    .group-post-author-avatar {
        width: 38px;
        height: 38px;
        min-width: 38px;
    }
    .group-post-badge {
        padding: 4px 7px;
        font-size: 9px;
    }
    .group-post-media-grid {
        margin: 11px 0;
        border-radius: 14px;
    }
    .group-post-media,
    .group-post-media img,
    .group-post-media video {
        min-height: 150px;
        max-height: 320px;
    }
    .group-post-poll-option {
        min-height: 46px;
        padding: 9px 10px;
    }
    .group-post-buy {
        min-height: 53px;
        padding: 8px 10px;
    }
}

/* === Stage 178: stable mobile chat wallpaper + safe send/circle gesture ===
   The wallpaper used background-attachment: local, so iOS/Android scrolled the
   pattern together with message content and it looked like the whole chat
   background was sliding. Keep the pattern anchored to the chat viewport while
   only the messages move. */
@media (max-width: 1024px) {
    .chats-page .chat-main #chat-messages {
        background-attachment: scroll !important;
        background-position: center top !important;
        background-origin: border-box !important;
        background-clip: border-box !important;
    }

    /* A normal send tap must stay a tap. The deliberate swipe-down mode switch
       now belongs to the inline voice/circle control, not to this button. */
    .app[data-page="chats"] #send-message-btn {
        touch-action: manipulation !important;
        -webkit-tap-highlight-color: transparent !important;
    }
}

/* === Stage 179: messenger-style dialog rows + media thumbnails ===
   UI-only. The row thumbnail is decorative and never intercepts the dialog tap.
   Video sources are attached lazily by JS only when their row nears the viewport. */
#chats-list .chat-item-main,
.chats-list .chat-item-main {
    min-width: 0 !important;
    max-width: 100% !important;
    flex: 1 1 auto !important;
    overflow: hidden !important;
}

#chats-list .chat-item-preview,
.chats-list .chat-item-preview {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    overflow: hidden !important;
    white-space: nowrap !important;
}

#chats-list .chat-item-preview-text,
.chats-list .chat-item-preview-text {
    display: block;
    min-width: 0;
    max-width: 100%;
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#chats-list .chat-item-media-thumb,
.chats-list .chat-item-media-thumb {
    position: relative;
    width: 28px;
    height: 28px;
    min-width: 28px;
    flex: 0 0 28px;
    display: inline-grid;
    place-items: center;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--border) 72%, rgba(255,255,255,.18));
    border-radius: 8px;
    color: #fff;
    background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 76%, #111827), #1f2937);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.05);
    pointer-events: none;
    box-sizing: border-box;
}

#chats-list .chat-item-media-thumb.is-circle,
.chats-list .chat-item-media-thumb.is-circle {
    border-radius: 50%;
}

#chats-list .chat-item-media-thumb img,
#chats-list .chat-item-media-thumb video,
.chats-list .chat-item-media-thumb img,
.chats-list .chat-item-media-thumb video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    border: 0 !important;
    border-radius: inherit !important;
    object-fit: cover;
    object-position: center;
    background: transparent !important;
}

#chats-list .chat-item-media-thumb video,
.chats-list .chat-item-media-thumb video {
    opacity: 0;
}

#chats-list .chat-item-media-thumb.has-frame video,
.chats-list .chat-item-media-thumb.has-frame video {
    opacity: 1;
}

#chats-list .chat-item-media-thumb.load-failed img,
#chats-list .chat-item-media-thumb.load-failed video,
.chats-list .chat-item-media-thumb.load-failed img,
.chats-list .chat-item-media-thumb.load-failed video {
    opacity: 0;
}

#chats-list .chat-item-media-thumb-play,
.chats-list .chat-item-media-thumb-play {
    position: relative;
    z-index: 2;
    width: 14px;
    height: 14px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: rgba(2,6,23,.46);
    box-shadow: 0 1px 4px rgba(0,0,0,.24);
}

#chats-list .chat-item-media-thumb-play svg,
.chats-list .chat-item-media-thumb-play svg {
    width: 9px;
    height: 9px;
    transform: translateX(.5px);
}

/* Desktop only: a subtle lower contour for the dialogs column. */
@media (min-width: 1025px) {
    .chats-page .chats-container {
        overflow: hidden !important;
        border-bottom-left-radius: 20px !important;
        border-bottom-right-radius: 20px !important;
    }

    .chats-page .chats-sidebar,
    .chats-page #chats-list,
    .chats-page .chats-list {
        border-bottom-left-radius: 0 !important;
        border-bottom-right-radius: 0 !important;
    }

    .chats-page #chats-list .chat-item,
    .chats-page .chats-list .chat-item {
        min-height: 80px !important;
        padding: 0 !important;
    }

    /* The swipe content inherits min-height: the padding lives here, as on the
       phone, so the 80px minimum is not counted twice (rows were 108px). */
    .chats-page #chats-list .chat-item-swipe-content,
    .chats-page .chats-list .chat-item-swipe-content {
        padding: 13px !important;
    }

    .chats-page #chats-list .chat-item-left,
    .chats-page .chats-list .chat-item-left {
        gap: 12px !important;
    }

    .chats-page #chats-list .chat-item-left .avatar.small,
    .chats-page .chats-list .chat-item-left .avatar.small {
        width: 48px !important;
        height: 48px !important;
        min-width: 48px !important;
        min-height: 48px !important;
        max-width: 48px !important;
        max-height: 48px !important;
        flex: 0 0 48px !important;
    }

    .chats-page #chats-list .chat-item-name,
    .chats-page .chats-list .chat-item-name {
        font-size: 0.984375rem !important;
        margin-bottom: 4px !important;
    }

    .chats-page #chats-list .chat-item-preview,
    .chats-page .chats-list .chat-item-preview {
        font-size: 0.828125rem !important;
    }

    .chats-page #chats-list .chat-item-media-thumb,
    .chats-page .chats-list .chat-item-media-thumb {
        width: 30px;
        height: 30px;
        min-width: 30px;
        flex-basis: 30px;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    #chats-list .chat-item,
    .chats-list .chat-item {
        min-height: 84px !important;
        padding: 13px !important;
    }

    #chats-list .chat-item-left .avatar.small,
    .chats-list .chat-item-left .avatar.small {
        width: 56px !important;
        height: 56px !important;
        min-width: 56px !important;
        min-height: 56px !important;
        max-width: 56px !important;
        max-height: 56px !important;
        flex: 0 0 56px !important;
    }
}

@media (min-width: 391px) and (max-width: 768px) {
    #chats-list .chat-item,
    .chats-list .chat-item {
        min-height: 86px !important;
        padding: 14px 13px !important;
    }

    .app[data-page="chats"]:not(.mobile-chat-open-app) #chats-list .chat-item .avatar.small,
    .app[data-page="chats"]:not(.mobile-chat-open-app) .chats-list .chat-item .avatar.small,
    #chats-list .chat-item-left .avatar.small,
    .chats-list .chat-item-left .avatar.small {
        width: 58px !important;
        height: 58px !important;
        min-width: 58px !important;
        min-height: 58px !important;
        max-width: 58px !important;
        max-height: 58px !important;
        flex: 0 0 58px !important;
    }

    #chats-list .chat-item-name,
    .chats-list .chat-item-name {
        font-size: 1.015625rem !important;
    }

    #chats-list .chat-item-preview,
    .chats-list .chat-item-preview {
        font-size: 0.859375rem !important;
    }

    #chats-list .chat-item-media-thumb,
    .chats-list .chat-item-media-thumb {
        width: 30px;
        height: 30px;
        min-width: 30px;
        flex-basis: 30px;
    }
}

@media (max-width: 390px) {
    #chats-list .chat-item,
    .chats-list .chat-item {
        min-height: 78px !important;
        padding: 13px 10px !important;
    }

    .app[data-page="chats"]:not(.mobile-chat-open-app) #chats-list .chat-item .avatar.small,
    .app[data-page="chats"]:not(.mobile-chat-open-app) .chats-list .chat-item .avatar.small,
    #chats-list .chat-item-left .avatar.small,
    .chats-list .chat-item-left .avatar.small {
        width: 52px !important;
        height: 52px !important;
        min-width: 52px !important;
        min-height: 52px !important;
        max-width: 52px !important;
        max-height: 52px !important;
        flex: 0 0 52px !important;
    }

    #chats-list .chat-item-name,
    .chats-list .chat-item-name {
        font-size: 0.96875rem !important;
    }

    #chats-list .chat-item-preview,
    .chats-list .chat-item-preview {
        font-size: 0.828125rem !important;
        gap: 5px !important;
    }

    #chats-list .chat-item-media-thumb,
    .chats-list .chat-item-media-thumb {
        width: 27px;
        height: 27px;
        min-width: 27px;
        flex-basis: 27px;
    }
}

/* === Stage 180: Telegram-like multi-message selection === */
.chat-message-selection-toolbar {
    display: none;
}

#chat-active.message-selection-mode .chat-input-area,
#chat-active.message-selection-mode .chat-typing-indicator {
    display: none !important;
}

body.chat-message-selection-active #voice-now-playing {
    display: none !important;
}

#chat-active.message-selection-mode .chat-message-selection-toolbar:not(.hidden) {
    position: absolute;
    left: 20px;
    right: 20px;
    bottom: max(12px, env(safe-area-inset-bottom, 0px));
    z-index: 70;
    min-height: 64px;
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr) 56px;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    border: 1px solid rgba(148, 163, 184, .22);
    border-radius: 999px;
    background: rgba(19, 24, 35, .90);
    box-shadow: 0 18px 44px rgba(0, 0, 0, .34), inset 0 1px 0 rgba(255, 255, 255, .08);
    backdrop-filter: blur(22px) saturate(1.25);
    -webkit-backdrop-filter: blur(22px) saturate(1.25);
    box-sizing: border-box;
}

body.theme-light #chat-active.message-selection-mode .chat-message-selection-toolbar:not(.hidden),
html[data-theme="light"] body #chat-active.message-selection-mode .chat-message-selection-toolbar:not(.hidden) {
    color: #111827;
    background: rgba(255, 255, 255, .92);
    border-color: rgba(15, 23, 42, .14);
    box-shadow: 0 18px 44px rgba(15, 23, 42, .18), inset 0 1px 0 rgba(255, 255, 255, .7);
}

.chat-selection-action,
.chat-selection-count {
    border: 0;
    color: var(--text);
    font: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.chat-selection-action {
    width: 50px;
    height: 50px;
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(148, 163, 184, .10);
    transition: transform .16s ease, background .16s ease, color .16s ease;
}

.chat-selection-action:hover {
    color: #fff;
    background: color-mix(in srgb, var(--primary) 75%, transparent);
    transform: translateY(-1px);
}

.chat-selection-action.danger {
    color: #ff5d69;
}

.chat-selection-action.danger:hover {
    color: #fff;
    background: rgba(239, 68, 68, .78);
}

.chat-selection-action:disabled {
    opacity: .45;
    cursor: wait;
    transform: none;
}

.chat-selection-count:disabled {
    opacity: .65;
    cursor: wait;
}

.chat-selection-count {
    min-width: 0;
    min-height: 48px;
    padding: 0 12px;
    overflow: hidden;
    border-radius: 18px;
    background: transparent;
    font-size: 1rem;
    font-weight: 850;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#chat-active.message-selection-mode #chat-messages {
    padding-bottom: 104px !important;
    scroll-padding-bottom: 112px !important;
}

#chat-active.message-selection-mode #chat-messages .message-selection-row:not(.album-selection-row) {
    position: relative;
    max-width: calc(82% - 36px) !important;
    margin-left: 38px;
    isolation: isolate;
}

#chat-active.message-selection-mode #chat-messages .message-selection-row::after {
    content: "";
    position: absolute;
    z-index: -1;
    inset: -5px -8px;
    border-radius: 18px;
    background: color-mix(in srgb, var(--primary) 18%, transparent);
    opacity: 0;
    transition: opacity .15s ease;
}

#chat-active.message-selection-mode #chat-messages .message-selection-row:has(.message-multi-selected)::after {
    opacity: 1;
}

#chat-active.message-selection-mode #chat-messages .message-multi-selected {
    outline: 2px solid color-mix(in srgb, var(--primary) 78%, #fff 8%);
    outline-offset: 2px;
}

#chat-active.message-selection-mode #chat-messages .message > * {
    pointer-events: none !important;
}

.message-select-toggle {
    position: absolute;
    left: -38px;
    bottom: 50%;
    z-index: 6;
    width: 30px;
    height: 30px;
    padding: 0;
    display: grid;
    place-items: center;
    transform: translateY(50%);
    border: 2px solid rgba(226, 232, 240, .82);
    border-radius: 50%;
    color: transparent;
    background: rgba(15, 23, 42, .52);
    box-shadow: 0 5px 14px rgba(0, 0, 0, .20);
    cursor: pointer;
    touch-action: manipulation;
    transition: background .15s ease, border-color .15s ease, color .15s ease, transform .15s ease;
}

.message-select-toggle svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.message-select-toggle.selected {
    color: #fff;
    border-color: color-mix(in srgb, var(--primary) 86%, #fff 14%);
    background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 88%, #fff 8%), color-mix(in srgb, var(--primary) 72%, #312e81));
}

.message-select-toggle:active {
    transform: translateY(50%) scale(.92);
}

body.theme-light .message-select-toggle,
html[data-theme="light"] body .message-select-toggle {
    border-color: rgba(71, 85, 105, .62);
    background: rgba(255, 255, 255, .78);
}

/* Recipient picker: one overlay, local search, recents and the complete dialog list. */
.chat-multi-forward-overlay {
    position: fixed;
    inset: 0;
    z-index: 130000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    background: rgba(2, 6, 23, .68);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-sizing: border-box;
}

.chat-multi-forward-modal {
    width: min(520px, calc(100vw - 24px));
    max-height: min(780px, calc(100dvh - 24px));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    color: #f8fafc;
    border: 1px solid rgba(148, 163, 184, .20);
    border-radius: 28px;
    background: rgba(24, 27, 34, .97);
    box-shadow: 0 30px 90px rgba(0, 0, 0, .48), inset 0 1px 0 rgba(255, 255, 255, .06);
}

body.theme-light .chat-multi-forward-modal,
html[data-theme="light"] body .chat-multi-forward-modal {
    color: #111827;
    background: rgba(248, 250, 252, .98);
    border-color: rgba(15, 23, 42, .14);
}

.chat-multi-forward-head {
    flex: 0 0 auto;
    min-height: 66px;
    display: grid;
    grid-template-columns: 48px 1fr 48px;
    align-items: center;
    padding: 4px 12px;
}

.chat-multi-forward-head h3 {
    margin: 0;
    font-size: 1.22rem;
    font-weight: 850;
    text-align: left;
}

.chat-multi-forward-close {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: inherit;
    background: transparent;
    cursor: pointer;
}

.chat-multi-forward-close:hover {
    background: rgba(148, 163, 184, .13);
}

.chat-multi-forward-search {
    flex: 0 0 auto;
    min-height: 58px;
    margin: 0 18px 14px;
    padding: 0 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-radius: 999px;
    color: rgba(226, 232, 240, .62);
    background: rgba(255, 255, 255, .055);
}

body.theme-light .chat-multi-forward-search,
html[data-theme="light"] body .chat-multi-forward-search {
    color: #64748b;
    background: rgba(15, 23, 42, .06);
}

.chat-multi-forward-search input {
    width: 100%;
    min-width: 0;
    min-height: 46px;
    border: 0;
    outline: 0;
    color: inherit;
    background: transparent;
    font: inherit;
    font-size: 1rem;
}

.chat-multi-forward-search input::placeholder {
    color: currentColor;
    opacity: .9;
}

.chat-multi-forward-recents {
    flex: 0 0 auto;
    min-height: 132px;
    margin: 0 18px;
    padding: 14px 12px 12px;
    display: flex;
    gap: 12px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
    border-radius: 24px;
    background: rgba(255, 255, 255, .045);
}

.chat-multi-forward-recents::-webkit-scrollbar {
    display: none;
}

.chat-multi-forward-recent {
    width: 72px;
    min-width: 72px;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    border: 0;
    color: inherit;
    background: transparent;
    cursor: pointer;
}

.chat-multi-forward-recent b {
    width: 100%;
    overflow: hidden;
    font-size: .78rem;
    line-height: 1.15;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-multi-forward-avatar {
    width: 50px;
    height: 50px;
    min-width: 50px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 50%;
    color: #fff;
    background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 84%, #60a5fa), color-mix(in srgb, var(--primary) 66%, #312e81));
    font-size: 1rem;
    font-weight: 850;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .13);
}

.chat-multi-forward-recent .chat-multi-forward-avatar {
    width: 58px;
    height: 58px;
    min-width: 58px;
}

.chat-multi-forward-avatar img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.chat-multi-forward-saved {
    font-size: 1.35rem;
    line-height: 1;
}

.chat-multi-forward-all {
    flex: 0 0 auto;
    min-height: 50px;
    margin: 16px 18px 8px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    color: color-mix(in srgb, var(--primary) 75%, #c4b5fd);
    background: color-mix(in srgb, var(--primary) 13%, rgba(255,255,255,.04));
    font-weight: 850;
}

.chat-multi-forward-list {
    flex: 1 1 auto;
    min-height: 0;
    padding: 6px 14px max(16px, env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    overscroll-behavior: contain;
}

.chat-multi-forward-row {
    width: 100%;
    min-height: 68px;
    padding: 8px 10px;
    display: grid;
    grid-template-columns: 50px minmax(0, 1fr) 20px;
    align-items: center;
    gap: 12px;
    border: 0;
    border-radius: 18px;
    color: inherit;
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.chat-multi-forward-row:hover {
    background: rgba(148, 163, 184, .10);
}

.chat-multi-forward-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.chat-multi-forward-copy b,
.chat-multi-forward-copy small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-multi-forward-copy b {
    font-size: .96rem;
}

.chat-multi-forward-copy small {
    color: var(--text-secondary);
    font-size: .81rem;
}

.chat-multi-forward-empty {
    padding: 32px 16px;
    color: var(--text-secondary);
    text-align: center;
}

.chat-multi-forward-modal[aria-busy="true"] {
    cursor: wait;
}

.chat-multi-forward-modal[aria-busy="true"] .chat-multi-forward-row,
.chat-multi-forward-modal[aria-busy="true"] .chat-multi-forward-recent {
    opacity: .52;
}

/* === Stage 180: archived dialogs and horizontal mobile actions === */
.chat-archive-back {
    width: 48px;
    height: 48px;
    min-width: 48px;
    flex: 0 0 48px;
    display: inline-grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: var(--text);
    background: color-mix(in srgb, var(--primary) 12%, var(--surface));
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.chat-archive-back svg { width: 27px; height: 27px; fill: none; stroke: currentColor; stroke-width: 2.35; stroke-linecap: round; stroke-linejoin: round; }

.chat-archive-row {
    width: calc(100% - 16px);
    min-height: 72px;
    margin: 7px 8px 5px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid color-mix(in srgb, var(--primary) 20%, var(--border));
    border-radius: 18px;
    color: var(--text);
    background: color-mix(in srgb, var(--primary) 8%, var(--surface));
    cursor: pointer;
    text-align: left;
}
.chat-archive-icon { width: 46px; height: 46px; flex: 0 0 46px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: linear-gradient(135deg,#8b5cf6,#5b7cff); }
.chat-archive-main { min-width: 0; flex: 1; display: grid; gap: 3px; }
.chat-archive-main b { font-size: 1rem; }
.chat-archive-main small { color: var(--text-secondary); }
.chat-archive-stack { display: flex; flex-direction: row-reverse; padding-left: 18px; }
.chat-archive-stack i { width: 27px; height: 27px; margin-left: -9px; display: grid; place-items: center; border: 2px solid var(--surface); border-radius: 50%; color: #fff; background: var(--primary); font-size: 11px; font-style: normal; font-weight: 800; }
.chat-archive-count { min-width: 34px; height: 34px; padding: 0 9px; display: inline-grid; place-items: center; border-radius: 999px; color: #fff; background: linear-gradient(135deg,#9b7bff,#6d5dfc); box-sizing: border-box; font-size: .82rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.chat-archive-preview-overlay { position: fixed; z-index: 10060; inset: 0; display: grid; place-items: center; padding: 18px; background: rgba(2,6,23,.62); backdrop-filter: blur(10px); }
.chat-archive-preview { width: min(430px, 100%); max-height: min(72dvh, 650px); overflow: hidden; display: grid; grid-template-rows: auto minmax(0,1fr) auto; border: 1px solid var(--border); border-radius: 25px; color: var(--text); background: color-mix(in srgb, var(--surface) 94%, transparent); box-shadow: 0 28px 70px rgba(0,0,0,.4); }
.chat-archive-preview-head { padding: 18px 20px 12px; display: flex; align-items: baseline; justify-content: space-between; }
.chat-archive-preview-head b { font-size: 1.25rem; }
.chat-archive-preview-head span { color: var(--text-secondary); font-size: .82rem; }
.chat-archive-preview-list { overflow: auto; padding: 3px 10px; }
.chat-archive-preview-list > div { min-height: 64px; padding: 8px; display: flex; align-items: center; gap: 11px; border-radius: 15px; }
.chat-archive-preview-list > div:hover { background: var(--bg-hover); }
.chat-archive-preview-list i { width: 44px; height: 44px; flex: 0 0 44px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: linear-gradient(135deg,#8b5cf6,#4f8cff); font-style: normal; font-weight: 800; }
.chat-archive-preview-list span { min-width: 0; display: grid; gap: 3px; }
.chat-archive-preview-list b,.chat-archive-preview-list small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-archive-preview-list small { color: var(--text-secondary); }
.chat-archive-preview-open { margin: 12px; min-height: 48px; border: 0; border-radius: 15px; color: #fff; background: linear-gradient(135deg,#8b5cf6,#6d5dfc); font-weight: 800; cursor: pointer; }

.chat-item { position: relative; overflow: hidden; }
.chat-item-swipe-content { position: relative; z-index: 2; min-height: inherit; display: flex; align-items: center; justify-content: space-between; width: 100%; transition: transform .2s cubic-bezier(.2,.8,.2,1); box-sizing: border-box; }
.chat-item.dialog-swipe-active .chat-item-swipe-content { will-change: transform; transition: none; }
.chat-item.active .chat-item-swipe-content { background: transparent; }
/* Telegram-like separator (owner, 2026-10-18): from the text column to the row
   edge. Laid out against .chat-item-swipe-content with left/right auto, it keeps
   the static left of .chat-item-main, so it follows every avatar size and moves
   with a swipe; the row's overflow clip ends it at the row edge. */
#chats-list .chat-item .chat-item-main::after,
.chats-list .chat-item .chat-item-main::after {
    content: "";
    position: absolute;
    left: auto;
    right: auto;
    bottom: 0;
    width: 100%;
    height: 1px;
    background: var(--border);
    pointer-events: none;
}
#chats-list .chat-item:not(:has(+ .chat-item)) .chat-item-main::after,
.chats-list .chat-item:not(:has(+ .chat-item)) .chat-item-main::after,
#chats-list .chat-item:is(.active, .pinned-dialog, :hover) .chat-item-main::after,
.chats-list .chat-item:is(.active, .pinned-dialog, :hover) .chat-item-main::after,
#chats-list .chat-item:has(+ .chat-item:is(.active, .pinned-dialog, :hover)) .chat-item-main::after,
.chats-list .chat-item:has(+ .chat-item:is(.active, .pinned-dialog, :hover)) .chat-item-main::after {
    display: none;
}
.chat-item-swipe-actions {
    position: absolute;
    z-index: 1;
    inset-block: 0;
    width: 0;
    display: flex;
    align-items: stretch;
    overflow: hidden;
    visibility: hidden;
    pointer-events: none;
}
.chat-item-swipe-left { left: 0; justify-content: flex-start; }
.chat-item-swipe-right { right: 0; justify-content: flex-end; }
.chat-item.swipe-reveal-left .chat-item-swipe-left,
.chat-item.swipe-open-left .chat-item-swipe-left,
.chat-item.swipe-reveal-right .chat-item-swipe-right,
.chat-item.swipe-open-right .chat-item-swipe-right {
    width: var(--dialog-swipe-reveal, 156px);
    visibility: visible;
    pointer-events: auto;
}
.chat-item-swipe-actions button {
    --swipe-action-bg: #686b72;
    flex: 0 0 78px;
    min-width: 78px;
    padding: 6px 4px;
    border: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    color: var(--text-secondary);
    background: transparent;
    font-size: .6875rem;
    line-height: 1.2;
    font-weight: 600;
    letter-spacing: -.01em;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
}
.chat-item-swipe-actions button[data-swipe-action="unread"] { --swipe-action-bg: #666a71; }
.chat-item-swipe-actions button[data-swipe-action="pin"] { --swipe-action-bg: #18ae45; }
.chat-item-swipe-actions button[data-swipe-action="mute"] { --swipe-action-bg: #dc8700; }
.chat-item-swipe-actions button[data-swipe-action="delete"] { --swipe-action-bg: #e2232c; }
.chat-item-swipe-actions button[data-swipe-action="archive"] { --swipe-action-bg: #707278; }
.chat-item-swipe-icon {
    width: 64px; height: 44px; flex: 0 0 44px;
    display: grid; place-items: center; border-radius: 999px;
    color: #fff; background: var(--swipe-action-bg);
    opacity: 0; transform: scale(.82);
    transition: opacity .16s ease, transform .18s cubic-bezier(.2,.8,.2,1);
}
.chat-item-swipe-icon svg { width: 25px; height: 25px; display: block; overflow: visible; }
.chat-item-swipe-label { width: 100%; min-height: 1.2em; display: block; overflow: hidden; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.chat-item:is(.swipe-reveal-left, .swipe-open-left) .chat-item-swipe-left .chat-item-swipe-icon,
.chat-item:is(.swipe-reveal-right, .swipe-open-right) .chat-item-swipe-right .chat-item-swipe-icon { opacity: 1; transform: scale(1); }
.chat-item-swipe-actions button:focus-visible .chat-item-swipe-icon { outline: 2px solid var(--text); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
    .chat-item-swipe-content, .chat-item-swipe-icon { transition: none; }
}

@media (min-width: 1025px) { .chat-item-swipe-actions { display: none; } }

@media (max-width: 1024px) {
    #chat-active {
        /* The gradients/borders keep the glass appearance without sampling the
           moving wallpaper once per bubble on mobile Safari. */
        --chat-message-surface-filter: none;
    }
    #chats-list .chat-item,
    .chats-list .chat-item {
        padding: 0 !important;
        touch-action: pan-y !important;
        background: var(--bg-secondary) !important;
        border-color: transparent !important;
        transform: none !important;
    }
    #chats-list .chat-item-swipe-content,
    .chats-list .chat-item-swipe-content {
        min-height: inherit !important;
        padding: 14px 13px !important;
        border-radius: inherit !important;
        background: inherit !important;
    }
    #chats-list .chat-item.active .chat-item-swipe-content,
    .chats-list .chat-item.active .chat-item-swipe-content {
        background: color-mix(in srgb, var(--primary) 15%, var(--bg-secondary)) !important;
    }
    #chats-list .chat-item-left,
    .chats-list .chat-item-left { overflow: hidden !important; }
    #chat-messages .message { transition: transform .16s ease; touch-action: pan-y; }
    #chat-messages .message.message-swipe-active {
        transform: translate3d(var(--message-swipe-x, 0px),0,0);
        will-change: transform;
    }
    #chat-messages .message-swipe-reply-icon { position: absolute; left: calc(100% + 12px); top: 50%; width: 38px; height: 38px; display: grid; place-items: center; transform: translateY(-50%) scale(.82); border-radius: 50%; color: #fff; background: linear-gradient(135deg,#8b5cf6,#5b6df8); box-shadow: 0 10px 24px rgba(55,48,163,.32); opacity: 0; transition: opacity .14s, transform .14s; pointer-events: none; }
    #chat-messages .message-swipe-reply-icon svg { width: 21px; height: 21px; fill: currentColor; stroke: none; }
    #chat-messages .message.message-swipe-reply-armed .message-swipe-reply-icon { opacity: 1; transform: translateY(-50%) scale(1); }
}

.chats-page .chat-active .chat-header {
    display: grid !important;
    grid-template-columns: 44px minmax(0, 1fr) auto !important;
    align-items: center !important;
    column-gap: 8px !important;
}

.chats-page .chat-active .chat-peer-info {
    width: max-content !important;
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

.chats-page .chat-active #chat-back-btn {
    display: inline-flex !important;
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    margin: 0 !important;
    padding: 0 !important;
    align-items: center !important;
    justify-content: center !important;
    justify-self: start !important;
    border-radius: 50% !important;
    color: var(--text) !important;
    background: color-mix(in srgb, var(--bg-tertiary) 90%, transparent) !important;
    border: 1px solid color-mix(in srgb, var(--border) 78%, rgba(255,255,255,.12)) !important;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.06) !important;
    pointer-events: auto !important;
}

.chats-page .chat-active #chat-back-btn svg,
.chats-page .chat-active .chat-header-actions #chat-search-msg-btn svg {
    width: 28px !important;
    height: 28px !important;
}

/* Header actions keep their existing controls and hit areas; remove the painted plates.
   IDs and !important are required by the older theme/mobile button rules above.
   The settings gear is gone (owner, 2026-10-08): the avatar opens the same info,
   whose "More" holds the same menu. Call and search glyphs are larger two-tone. */
.chats-page .chat-active .chat-header-actions #call-voice-btn,
.chats-page .chat-active .chat-header-actions #call-video-btn,
.chats-page .chat-active .chat-header-actions #chat-search-msg-btn {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}
.chats-page .chat-active .chat-header-actions #call-voice-btn svg,
.chats-page .chat-active .chat-header-actions #call-video-btn svg,
.chats-page .chat-active .chat-header-actions #chat-search-msg-btn svg {
    width: 28px !important;
    height: 28px !important;
    stroke-width: 1.85;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.chats-page .chat-active .chat-header-actions .chat-header-glyph-fill {
    transition: fill-opacity .16s ease;
}
.chats-page .chat-active .chat-header-actions .btn:is(:hover, :focus-visible) .chat-header-glyph-fill {
    fill-opacity: .3;
}
.chats-page .chat-active .chat-header-actions #call-voice-btn:focus-visible,
.chats-page .chat-active .chat-header-actions #call-video-btn:focus-visible,
.chats-page .chat-active .chat-header-actions #chat-search-msg-btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
}

@media (max-width: 768px) {
    .chats-sidebar-header:has(#chat-archive-back:not(.hidden)) { justify-content: flex-start !important; gap: 8px !important; }
    .chats-sidebar.archive-view #new-group-top-btn { display: none !important; }
    .chats-sidebar.archive-view .chats-sidebar-header h2 { font-size: 1.25rem !important; }
    .chats-page .chat-active .chat-header {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        z-index: 80 !important;
        min-height: 0 !important;
        height: auto !important;
        padding: 8px 10px 0 !important;
        gap: 8px !important;
        overflow: visible !important;
        background: transparent !important;
        border: 0 !important;
        -webkit-backdrop-filter: none !important;
        backdrop-filter: none !important;
        box-shadow: none !important;
        pointer-events: none !important;
    }
    .chats-page .chat-active .chat-peer-info {
        flex: 1 1 auto !important;
        align-self: center !important;
        min-width: 0 !important;
        max-width: 100% !important;
        gap: 9px !important;
        padding: 5px 10px 5px 5px !important;
        overflow: hidden !important;
        pointer-events: auto !important;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
    .chats-page .chat-active .chat-peer-info > div:last-child { min-width: 0 !important; overflow: hidden !important; }
    .chats-page .chat-active #chat-peer-avatar { width: 48px !important; height: 48px !important; min-width: 48px !important; flex: 0 0 48px !important; }
    .chats-page .chat-active .chat-peer-name,
    .chats-page .chat-active .chat-peer-status { max-width: 100% !important; overflow: hidden !important; text-overflow: ellipsis !important; white-space: nowrap !important; }
    .chats-page .chat-active .chat-header-actions { flex: 0 0 auto !important; align-self: center !important; gap: 4px !important; padding-top: 0 !important; pointer-events: auto !important; }
    .chats-page .chat-active .chat-header-actions #call-voice-btn,
    .chats-page .chat-active .chat-header-actions #call-video-btn {
        width: 44px !important; height: 44px !important; min-width: 44px !important; min-height: 44px !important; flex: 0 0 44px !important;
    }
    .chats-page .chat-active .chat-header-actions :is(#call-voice-btn, #call-video-btn) svg {
        width: 28px !important;
        height: 28px !important;
    }
    .chats-page .chat-active #chat-search-msg-btn { display: inline-flex !important; }
    #chat-messages .video-circle-message.circle-no-preview:not(.has-preview) {
        background: radial-gradient(circle at 32% 24%,rgba(255,255,255,.20),transparent 34%),linear-gradient(135deg,#6d5dfc,#30258f) !important;
    }
}

@media (max-width: 390px) {
    #chats-list .chat-item-swipe-content,
    .chats-list .chat-item-swipe-content { padding: 12px 10px !important; }
    .chats-page .chat-active .chat-header {
        grid-template-columns: 40px minmax(0, 1fr) auto !important;
        column-gap: 3px !important;
        padding-inline: 4px !important;
    }
    .chats-page .chat-active #chat-back-btn {
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
        min-height: 40px !important;
    }
    .chats-page .chat-active .chat-peer-info {
        gap: 4px !important;
        padding: 2px !important;
    }
    .chats-page .chat-active #chat-peer-avatar {
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
        flex-basis: 40px !important;
    }
    .chats-page .chat-active .chat-peer-status { font-size: .55rem !important; }
    .chats-page .chat-active .chat-header-actions {
        gap: 1px !important;
    }
    .chats-page .chat-active .chat-header-actions #call-voice-btn,
    .chats-page .chat-active .chat-header-actions #call-video-btn { width: 44px !important; height: 44px !important; min-width: 44px !important; min-height: 44px !important; flex-basis: 44px !important; }
    .chats-page .chat-active .chat-header-actions #call-voice-btn svg,
    .chats-page .chat-active .chat-header-actions #call-video-btn svg {
        width: 32px !important;
        height: 32px !important;
    }
}

@media (max-width: 640px) {
    #chat-active.message-selection-mode .chat-message-selection-toolbar:not(.hidden) {
        left: max(8px, env(safe-area-inset-left, 0px));
        right: max(8px, env(safe-area-inset-right, 0px));
        bottom: max(8px, env(safe-area-inset-bottom, 0px));
        min-height: 62px;
        grid-template-columns: 52px minmax(0, 1fr) 52px;
        padding: 5px 8px;
    }

    #chat-active.message-selection-mode #chat-messages {
        padding-bottom: calc(98px + env(safe-area-inset-bottom, 0px)) !important;
        scroll-padding-bottom: calc(106px + env(safe-area-inset-bottom, 0px)) !important;
    }

    #chat-active.message-selection-mode #chat-messages .message-selection-row:not(.album-selection-row) {
        max-width: calc(90% - 34px) !important;
        margin-left: 36px;
    }

    .message-select-toggle {
        left: -35px;
        width: 29px;
        height: 29px;
    }

    .chat-multi-forward-overlay {
        align-items: flex-end;
        padding: 8px 8px max(8px, env(safe-area-inset-bottom, 0px));
    }

    .chat-multi-forward-modal {
        width: 100%;
        max-height: min(88dvh, 780px);
        border-radius: 26px;
    }

    .chat-multi-forward-search,
    .chat-multi-forward-recents,
    .chat-multi-forward-all {
        margin-left: 12px;
        margin-right: 12px;
    }
}

/* === DEALIX Community: standalone forum space inside the existing shell ===
   Desktop keeps the reserved shell menu row. The forum's own mobile navigation
   already links to DEALIX; do not place the global navbar over its composer. */
#app.forum-shell-mode {
    grid-template-areas: "header" "menu" "main" !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: var(--forum-header-row, auto) var(--app-menu-bar-h, 0px) minmax(0, 1fr) !important;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
}

#app.forum-shell-mode.header-compact-mode { --forum-header-row: 0px; }

#app.forum-shell-mode > #mobile-bottom-nav {
    display: none !important;
}

#app.forum-shell-mode > .main-content {
    grid-area: main !important;
    height: auto;
    min-height: 0;
    min-width: 0;
    padding: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior-y: contain;
}

#app.forum-shell-mode > .main-content > .page-content {
    width: 100% !important;
    max-width: none !important;
    height: 100%;
    min-height: 0;
    margin: 0 !important;
    padding: 0 !important;
    background-color: var(--bg) !important;
    background-image:
        linear-gradient(180deg, rgba(7, 10, 22, .18), rgba(7, 10, 22, .28)),
        url('./assets/chat-pattern-premium.webp') !important;
    background-repeat: repeat !important;
    background-size: 980px 980px !important;
    background-position: center top !important;
}

.forum-community-page {
    --forum-panel: color-mix(in srgb, var(--bg-secondary) 88%, transparent);
    --forum-panel-strong: color-mix(in srgb, var(--bg-card) 95%, transparent);
    --forum-line: color-mix(in srgb, var(--border) 82%, transparent);
    --forum-muted: var(--text-muted);
    height: 100%;
    min-height: 100%;
    color: var(--text);
}

.forum-community-layout {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    height: 100%;
    min-height: 100%;
}

/* Opened topics share one bounded message stream. The article is the first
   message in that stream; the shell and composer never become second scrollers. */
#app.forum-shell-mode:has(.forum-community-page[data-forum-topic-view="true"]) {
    height: var(--forum-viewport-height, 100dvh);
}
#app.forum-shell-mode > .main-content:has(.forum-community-page[data-forum-topic-view="true"]) {
    overflow-y: hidden !important;
}
.forum-community-page[data-forum-topic-view="true"],
.forum-community-page[data-forum-topic-view="true"] .forum-community-layout,
.forum-community-page[data-forum-topic-view="true"] .forum-community-center,
.forum-community-page[data-forum-topic-view="true"] .forum-topic-route,
.forum-community-page[data-forum-topic-view="true"] #forum-topic-route-view {
    min-height: 0;
    height: 100%;
}
.forum-community-page[data-forum-topic-view="true"] .forum-community-center {
    display: flex;
    flex-direction: column;
    padding: 0;
}
.forum-community-page[data-forum-topic-view="true"] .forum-topic-route,
.forum-community-page[data-forum-topic-view="true"] #forum-topic-route-view {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
}
.forum-community-sidebar {
    position: sticky;
    top: 0;
    align-self: start;
    height: 100%;
    max-height: 100%;
    overflow-y: auto;
    scrollbar-width: thin;
}

.forum-community-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 22px 18px max(24px, env(safe-area-inset-bottom));
    border-right: 1px solid var(--forum-line);
    background:
        radial-gradient(circle at 18% 0%, rgba(59, 130, 246, .12), transparent 28%),
        color-mix(in srgb, var(--bg-secondary) 94%, transparent);
    backdrop-filter: blur(22px) saturate(1.12);
    -webkit-backdrop-filter: blur(22px) saturate(1.12);
}

.forum-community-brand {
    display: grid;
    gap: 13px;
    padding: 2px 4px 9px;
}

.forum-community-brand > div {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.forum-community-brand > div b {
    font-size: 1.32rem;
    letter-spacing: -.04em;
    background: var(--primary-grad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.forum-community-brand > div span {
    color: var(--text-secondary);
    font-size: .88rem;
}

.forum-community-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    width: 100%;
    min-height: 48px;
    padding: 0 15px;
    border-radius: 13px;
    color: var(--text);
    background: color-mix(in srgb, var(--primary-light) 72%, var(--bg-hover));
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 22%, transparent);
    font-size: .94rem;
    font-weight: 800;
    letter-spacing: .01em;
}

.forum-community-back:hover { color: #fff; background: var(--primary-grad); box-shadow: 0 10px 24px rgba(49, 84, 204, .24); }

.forum-community-nav {
    display: grid;
    gap: 4px;
}

.forum-community-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 50px;
    padding: 0 14px;
    border: 1px solid transparent;
    border-radius: 13px;
    color: var(--text-secondary);
    font-size: .94rem;
    font-weight: 600;
    transition: .18s ease;
}

.forum-community-nav-item:hover {
    color: var(--text);
    background: var(--bg-hover);
    transform: translateX(3px);
}

.forum-community-nav-item.active {
    color: #fff;
    border-color: rgba(96, 135, 255, .25);
    background:
        linear-gradient(135deg, rgba(52, 94, 220, .68), rgba(44, 75, 157, .34)),
        var(--primary-light);
    box-shadow: 0 12px 30px rgba(25, 57, 145, .2), inset 0 1px 0 rgba(255,255,255,.1);
}

.forum-community-section,
.forum-topic-article {
    border: 1px solid var(--forum-line);
    background: var(--forum-panel);
    box-shadow: 0 22px 55px rgba(0, 0, 0, .16);
    backdrop-filter: blur(20px) saturate(1.08);
    -webkit-backdrop-filter: blur(20px) saturate(1.08);
}

.forum-sidebar-create { width: 100%; min-height: 46px; }

.forum-community-center {
    min-width: 0;
    padding: 20px 22px 44px;
}

.forum-community-page[data-forum-section="categories"] .forum-community-center {
    padding-inline: clamp(18px, 3vw, 42px);
}

/* A topic list is one panel down to the bottom of the column, not a card
   that ends mid-page; it still grows with its content. */
@media (min-width: 901px) {
    .forum-community-page:is([data-forum-section="home"], [data-forum-section="topics"], [data-forum-section="mine"]):not([data-forum-topic-view="true"]) .forum-community-center {
        display: flex;
        flex-direction: column;
    }
    .forum-community-page:not([data-forum-topic-view="true"]) .forum-topics-section {
        flex: 1 0 auto;
    }
}

.forum-kicker {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: color-mix(in srgb, var(--primary) 72%, #fff);
    font-size: .75rem;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.forum-community-section {
    overflow: hidden;
    border-radius: 20px;
}

.forum-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 22px 23px;
    border-bottom: 1px solid var(--forum-line);
}

.forum-section-head > * { min-width: 0; }

.forum-section-head h2 {
    margin: 4px 0 0;
    font-size: 1.25rem;
    letter-spacing: -.025em;
}
.forum-section-head p { margin: 6px 0 0; max-width: 680px; font-size: .86rem; }
.forum-active-category a { color: var(--primary); font-weight: 700; }

.forum-topics-head,
.forum-categories-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 16px;
}

.forum-live-banner {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr) max-content;
    align-items: center;
    gap: 12px;
    margin: 14px 16px 0;
    padding: 11px 12px;
    border-radius: 16px;
    color: #eef4ff;
    background:
        radial-gradient(circle at 15% 10%, rgba(133, 170, 255, .28), transparent 42%),
        linear-gradient(135deg, rgba(48, 84, 190, .92), rgba(92, 61, 171, .9));
    box-shadow: 0 16px 38px rgba(35, 54, 130, .26), inset 0 1px 0 rgba(255,255,255,.14);
    animation: forum-live-in .3s ease both;
}
.forum-live-banner.hidden { display: none; }
.forum-live-orb {
    position: relative;
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 15px;
    color: #fff;
    background: rgba(255,255,255,.14);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.14);
}
.forum-live-orb::after {
    content: '';
    position: absolute;
    inset: -4px;
    border: 1px solid rgba(190, 210, 255, .5);
    border-radius: 18px;
    animation: forum-live-pulse 2.2s ease-out infinite;
}
.forum-live-banner > div { min-width: 0; display: grid; gap: 2px; }
.forum-live-banner b { overflow-wrap: anywhere; font-size: .86rem; }
.forum-live-banner small { overflow-wrap: anywhere; color: rgba(229, 236, 255, .72); font-size: .69rem; }
.forum-live-banner button {
    min-height: 38px;
    padding: 0 14px;
    border-radius: 11px;
    color: #263c85;
    background: #fff;
    font: inherit;
    font-size: .75rem;
    font-weight: 800;
    cursor: pointer;
}
.forum-live-banner button:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(8, 16, 50, .2); }

.forum-topic-controls {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    max-width: none;
    margin-left: 0;
}

.forum-topic-search {
    flex: 1 1 auto;
    min-width: 0;
    height: 42px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    border: 1px solid var(--forum-line);
    border-radius: 12px;
    color: var(--text-muted);
    background: color-mix(in srgb, var(--bg-tertiary) 86%, transparent);
}

.forum-topic-search input {
    width: 100%;
    border: 0;
    outline: 0;
    color: var(--text);
    background: transparent;
    font: inherit;
    font-size: .875rem;
}
.forum-topic-search input::placeholder { color: var(--text-muted); }
#forum-topic-sort { width: 184px; min-width: 184px; height: 42px; flex: 0 0 184px; padding-top: 0; padding-bottom: 0; }

.forum-community-topics {
    display: grid;
    transition: opacity .18s ease, filter .18s ease;
}
.forum-community-topics.is-loading {
    opacity: .56;
    filter: saturate(.78);
    pointer-events: none;
}

.forum-community-topic-card {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) 104px;
    gap: 14px;
    align-items: center;
    min-height: 118px;
    padding: 17px 18px;
    border-bottom: 1px solid var(--forum-line);
    transition: .18s ease;
}
.forum-community-topic-card:last-child { border-bottom: 0; }
.forum-community-topic-card:hover { background: var(--bg-hover); }
.forum-community-topic-card.is-new {
    position: relative;
    z-index: 1;
    background: linear-gradient(90deg, color-mix(in srgb, var(--primary-light) 76%, transparent), transparent 78%);
    animation: forum-new-topic-in .65s cubic-bezier(.2,.8,.2,1) both;
}
.forum-community-topic-card.is-new::before {
    content: '';
    position: absolute;
    inset-block: 14px;
    left: 0;
    width: 3px;
    border-radius: 0 4px 4px 0;
    background: var(--primary-grad);
    box-shadow: 0 0 16px color-mix(in srgb, var(--primary) 70%, transparent);
}

.forum-avatar {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid rgba(122, 151, 255, .24);
    border-radius: 50%;
    color: var(--primary);
    background: var(--primary-light);
    font-size: .8rem;
    font-weight: 800;
    flex: 0 0 auto;
}
.forum-avatar.large { width: 54px; height: 54px; }
.forum-avatar img { width: 100%; height: 100%; object-fit: cover; }

.forum-topic-copy { min-width: 0; color: inherit; }
.forum-topic-title-line { display: flex; align-items: center; gap: 9px; }
.forum-topic-copy h3 {
    min-width: 0;
    margin: 0;
    overflow: hidden;
    color: var(--text);
    font-size: 1rem;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow-wrap: anywhere;
}
.forum-topic-copy p {
    display: -webkit-box;
    overflow: hidden;
    margin: 7px 0 9px;
    color: var(--text-secondary);
    font-size: .84rem;
    line-height: 1.45;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.forum-topic-footer { display: flex; flex-wrap: wrap; gap: 9px; color: var(--text-muted); font-size: .75rem; }
.forum-topic-footer span:first-child { color: color-mix(in srgb, var(--primary) 78%, var(--text)); }
.forum-topic-category {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border-radius: 999px;
    color: var(--primary) !important;
    background: var(--primary-light);
    font-weight: 700;
}
.forum-new-topic-badge { color: #67e8f9 !important; font-weight: 800; }

.forum-topic-stats {
    display: grid;
    grid-template-columns: max-content 44px;
    gap: 7px;
    align-items: center;
    color: var(--text-muted);
    font-size: .78rem;
}
.forum-topic-stats a {
    min-height: 44px;
    border-radius: 12px;
    color: var(--text-muted);
    transition: color .18s ease, background .18s ease, transform .18s ease;
}
.forum-topic-replies-link {
    min-width: 50px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 10px;
}
.forum-topic-open-link { width: 44px; height: 44px; display: grid; place-items: center; }
.forum-topic-stats a svg { display: block; flex: 0 0 auto; }
.forum-topic-open-link svg { stroke-width: 2.35; }
.forum-topic-stats a:hover,
.forum-topic-stats a:focus-visible { color: var(--primary); background: var(--primary-light); }
.forum-topic-stats a:active { transform: scale(.96); }
/* Unread replies of a topic the viewer already read (0049 read boundary). */
.forum-topic-unread {
    display: inline-grid;
    place-items: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    color: #fff;
    background: var(--primary-dark);
    font-size: .7rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    white-space: nowrap;
}

.forum-status-chip {
    display: inline-flex;
    align-items: center;
    width: max-content;
    padding: 4px 8px;
    border: 1px solid var(--forum-line);
    border-radius: 999px;
    color: var(--text-muted);
    background: var(--bg-hover);
    font-size: .7rem;
    font-weight: 700;
    white-space: nowrap;
}
.forum-status-chip.success { color: #4ade80; border-color: rgba(34,197,94,.25); background: rgba(34,197,94,.09); }
.forum-status-chip.pending { color: #fbbf24; border-color: rgba(251,191,36,.24); background: rgba(251,191,36,.08); }
.forum-status-chip.danger { color: #fb7185; border-color: rgba(251,113,133,.24); background: rgba(251,113,133,.08); }

.forum-community-loading,
.forum-community-empty {
    min-height: 220px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 8px;
    padding: 28px;
    text-align: center;
    color: var(--text-muted);
}
.forum-community-empty.compact { min-height: 150px; }
.forum-community-empty h3 { margin: 0; color: var(--text); font-size: 1rem; }
.forum-community-empty p { max-width: 440px; margin: 0 0 5px; font-size: .78rem; }
.forum-community-empty.error h3 { color: var(--danger); }

.forum-community-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 18px;
    border-top: 1px solid var(--forum-line);
    color: var(--text-muted);
    font-size: .76rem;
}
.forum-community-pagination > div { display: flex; align-items: center; gap: 5px; }
.forum-page-button {
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    border: 1px solid var(--forum-line);
    border-radius: 9px;
    color: var(--text-secondary);
    background: var(--bg-hover);
    cursor: pointer;
}
.forum-page-button:hover:not(:disabled), .forum-page-button.active { color: #fff; border-color: rgba(85,126,255,.45); background: var(--primary); }
.forum-page-button:disabled { opacity: .42; cursor: default; }
.forum-page-button.nav { min-width: 68px; }
.forum-community-page-gap { padding: 0 3px; }

.forum-category-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 14px 15px; }
.forum-category-grid.large {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    padding: clamp(20px, 2.5vw, 34px);
}
.forum-categories-section { min-height: 0; margin-bottom: 18px; }
.forum-category-topic-controls { min-width: 0; }
.forum-category-discussions { margin-top: 18px; }
.forum-category-card {
    min-height: 164px;
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr) auto;
    align-items: start;
    gap: 16px;
    padding: 21px;
    border: 1px solid var(--forum-line);
    border-radius: 15px;
    color: var(--text-secondary);
    background: var(--bg-hover);
    transition: .18s ease;
}
.forum-category-card:hover { transform: translateY(-2px); color: var(--text); box-shadow: 0 16px 36px rgba(0,0,0,.16); }
.forum-category-card > span { display: grid; place-items: center; width: 58px; height: 58px; border-radius: 17px; background: var(--bg-tertiary); }
.forum-category-card > svg { align-self: center; color: var(--text-muted); }
.forum-category-card div { min-width: 0; display: grid; gap: 7px; }
.forum-category-card b { font-size: 1rem; overflow-wrap: anywhere; }
.forum-category-card p { margin: 0; color: var(--text-secondary); font-size: .8rem; line-height: 1.48; overflow-wrap: anywhere; }
.forum-category-card small { display: flex; flex-wrap: wrap; gap: 5px 10px; margin-top: 4px; color: var(--text-muted); font-size: .72rem; }
.forum-category-card small span:last-child { color: var(--primary); font-weight: 700; }
.forum-category-card.blue > span { color: #83a7ff; background: rgba(59,130,246,.11); }
.forum-category-card.orange > span { color: #f7a853; background: rgba(249,115,22,.11); }
.forum-category-card.violet > span { color: #c99cff; background: rgba(168,85,247,.11); }
.forum-category-card.cyan > span { color: #67d7ed; background: rgba(6,182,212,.11); }
.forum-category-card.green > span { color: #69db9a; background: rgba(34,197,94,.11); }
.forum-category-card.gold > span { color: #f2c968; background: rgba(234,179,8,.11); }

.forum-rules-list { display: grid; }
.forum-rules-list article {
    display: grid;
    grid-template-columns: 42px 1fr;
    gap: 14px;
    padding: 18px 22px;
    border-top: 1px solid var(--forum-line);
}
.forum-rules-list article:first-child { border-top: 0; }
.forum-rules-list article > span { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; color: var(--primary); background: var(--primary-light); font-weight: 800; }
.forum-rules-list h3 { margin: 0 0 5px; font-size: .9rem; }
.forum-rules-list p { margin: 0; font-size: .82rem; line-height: 1.55; }

.forum-topic-route { min-width: 0; }

.forum-topic-article {
    overflow: hidden;
    border-radius: 20px;
}
.forum-topic-article { padding: 24px; }
.forum-topic-article > header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 22px;
}
.forum-topic-article-author { display: flex; align-items: center; gap: 11px; color: inherit; }
.forum-topic-article-author span:last-child { display: grid; gap: 3px; }
.forum-topic-article-author b { font-size: .88rem; }
.forum-topic-article-author small { color: var(--text-muted); font-size: .75rem; }
.forum-topic-article-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.forum-topic-discussion-link { display: inline-flex; align-items: center; gap: 6px; }
.forum-topic-discussion-link svg { flex: 0 0 auto; }
.forum-topic-category-link { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 10px; color: var(--primary); font-size: .76rem; font-weight: 800; }
.forum-topic-article h1 { margin: 0 0 15px; font-size: clamp(1.45rem, 3vw, 2.2rem); line-height: 1.12; letter-spacing: -.035em; }
.forum-topic-text { color: var(--text-secondary); font-size: .94rem; line-height: 1.75; overflow-wrap: anywhere; }
.forum-topic-moderation { display: flex; align-items: center; gap: 7px; margin-top: 18px; padding: 12px; border: 1px solid rgba(251,191,36,.22); border-radius: 12px; color: #fbbf24; background: rgba(251,191,36,.07); font-size: .72rem; }

/* An opened topic fills its area edge to edge, like the chat: no card frame. */
.forum-discussion-card {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    height: 100%;
    min-height: 0;
    margin-top: 0;
    overflow: hidden;
    scroll-margin-top: 88px;
    background: var(--forum-panel);
}
.forum-topic-loading-card > .forum-topic-loading { flex: 1 1 auto; }
/* The chat header (desktop): floats on the wallpaper, 60px, back button first. */
.forum-discussion-card > .forum-section-head {
    min-height: 60px;
    margin: 12px 18px 0;
    padding: 0;
    gap: 8px;
    border-bottom: 0;
    font-size: .8rem;
    color: var(--text-muted);
    background: transparent;
}
.forum-discussion-topic-title {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    gap: 10px;
    min-width: 0;
    min-height: 44px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 4px 0;
    border: 0;
    color: var(--text);
    background: transparent;
    font: inherit;
    font-size: .92rem;
    font-weight: 650;
    text-align: start;
    cursor: pointer;
}
.forum-discussion-topic-title > svg { width: 22px; height: 22px; flex: 0 0 auto; color: var(--text-muted); }
.forum-topic-context-copy { display: grid; min-width: 0; gap: 3px; }
.forum-topic-context-copy strong,
.forum-topic-context-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.forum-topic-context-copy strong { font-size: 1rem; font-weight: 720; line-height: 1.12; letter-spacing: -.028em; }
.forum-topic-context-copy small { color: var(--text-muted); font-size: .7rem; font-weight: 400; }
.forum-discussion-topic-title:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
/* The chat's back button (#chat-back-btn): same size, tokens and glyph weight. */
.forum-discussion-head .forum-topic-header-back {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    color: var(--text);
    background: color-mix(in srgb, var(--bg-tertiary) 90%, transparent);
    border: 1px solid color-mix(in srgb, var(--border) 78%, rgba(255,255,255,.12));
    box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
}
.forum-discussion-head .forum-topic-header-back svg { width: 28px; height: 28px; stroke-width: 2.4; }
.forum-discussion-head .forum-topic-header-back:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.forum-discussion-head > b { flex: 0 0 auto; color: var(--text-muted); font-size: .75rem; }
.forum-community-replies > .forum-topic-article { flex: 0 0 auto; width: 100%; margin-bottom: 8px; }
.forum-discussion-card > .forum-community-pagination {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: .7rem;
    background: var(--bg-secondary);
}
.forum-discussion-card > .forum-community-pagination > span { flex: 0 0 auto; }
.forum-discussion-card > .forum-community-pagination > div { min-width: 0; overflow-x: auto; }
.forum-discussion-card .forum-page-button { flex: 0 0 auto; }
.forum-discussion-card > :is(.forum-discussion-head, .forum-topic-reply-form, .forum-topic-reply-locked, .forum-community-pagination) {
    flex: 0 0 auto;
}
.forum-discussion-stream {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
}
.forum-community-replies {
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 20px 18px 12px;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    scrollbar-width: thin;
    background: transparent;
}
/* A scroll-content spacer clears the arrows without imposing a 66px padding
   floor on the viewport when the mobile keyboard leaves a short stream. */
.forum-community-replies::after { content: ''; flex: 0 0 54px; }
.forum-community-replies:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
/* The chat's own scroll-down and "replies to you" buttons, stacked as in a
   conversation (.new-messages-wrap). The forum's generic `button { border: 0 }`
   would drop the chat button border, so it is restored here. */
.forum-discussion-jumps {
    position: absolute;
    z-index: 2;
    inset-inline-end: 12px;
    bottom: min(12px, max(4px, calc(100% - 44px)));
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    pointer-events: none;
}
.forum-discussion-jumps .chat-scroll-down-btn { border: 1px solid var(--border); pointer-events: auto; }
.forum-discussion-jumps .chat-scroll-down-btn:disabled { opacity: .45; cursor: default; }
/* Where older or newer replies load while scrolling (chat history). */
.forum-history-edge { flex: 0 0 auto; align-self: center; width: 22px; height: 1px; }
.forum-history-edge.is-loading {
    height: 22px;
    border: 2px solid color-mix(in srgb, var(--text-muted) 35%, transparent);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: forum-history-spin .8s linear infinite;
}
@keyframes forum-history-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
    .forum-history-edge.is-loading { animation: none; }
}
.forum-chat-day { flex: 0 0 auto; align-self: center; max-width: 100%; padding: 5px 12px; border: 1px solid var(--forum-line); border-radius: 999px; color: var(--text-secondary); background: color-mix(in srgb, var(--bg-card) 92%, transparent); font-size: .72rem; font-weight: 600; line-height: 1.4; text-align: center; }
.forum-unread-divider { flex: 0 0 auto; display: flex; align-items: center; gap: 10px; color: var(--primary-text); font-size: .72rem; font-weight: 700; line-height: 1.4; }
.forum-unread-divider::before,
.forum-unread-divider::after { content: ''; flex: 1 1 auto; height: 1px; background: color-mix(in srgb, var(--primary) 45%, transparent); }
.forum-community-reply {
    flex: 0 0 auto;
    --forum-bubble-bg: color-mix(in srgb, var(--bg-tertiary) 92%, var(--bg-secondary));
    position: relative;
    display: flex;
    align-items: flex-end;
    gap: 9px;
    /* Owner 2026-10-19: a row spans the stream like a chat row (others at the
       left edge, one's own at the right); the bubble keeps its own limit. */
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    animation: forum-message-in .35s ease both;
}
.forum-community-reply.is-own {
    --forum-bubble-bg: linear-gradient(142deg, color-mix(in srgb, var(--primary) 84%, #6f66ff), color-mix(in srgb, var(--primary) 66%, #343d91));
    flex-direction: row-reverse;
}
.forum-reply-avatar-link {
    display: inline-flex;
    flex: 0 0 auto;
    border-radius: 50%;
}
.forum-community-reply .forum-avatar { width: 36px; height: 36px; }
.forum-reply-stack {
    min-width: 0;
    max-width: min(78%, 760px);
    display: flex;
}
.forum-community-reply.is-own .forum-reply-stack { justify-content: flex-end; }
.forum-reply-bubble {
    position: relative;
    min-width: 130px;
    max-width: 100%;
    padding: 11px 13px 9px;
    border-radius: 18px 18px 18px 6px;
    background: var(--forum-bubble-bg);
    box-shadow:
        inset 0 0 0 1px color-mix(in srgb, var(--forum-line) 68%, transparent),
        0 8px 22px rgba(0,0,0,.1);
    transition: transform .18s ease, box-shadow .18s ease;
}
.forum-community-reply.is-own .forum-reply-bubble {
    border-radius: 18px 18px 6px 18px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.16), 0 10px 26px rgba(37,62,145,.25);
}
.forum-reply-bubble::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: -5px;
    width: 10px;
    height: 12px;
    background: var(--forum-bubble-bg);
    clip-path: polygon(100% 0, 100% 100%, 0 100%);
}
.forum-community-reply.is-own .forum-reply-bubble::after {
    right: -5px;
    left: auto;
    transform: scaleX(-1);
}
.forum-community-reply:hover .forum-reply-bubble {
    transform: translateY(-1px);
    box-shadow:
        inset 0 0 0 1px color-mix(in srgb, var(--primary) 24%, var(--forum-line)),
        0 12px 28px rgba(0,0,0,.12);
}
.forum-community-reply.is-own:hover .forum-reply-bubble {
    box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 14px 30px rgba(37,62,145,.3);
}
.forum-community-reply.has-parent .forum-reply-bubble { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 30%, transparent), 0 8px 22px rgba(0,0,0,.1); }
.forum-community-reply header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.forum-community-reply header a { color: color-mix(in srgb, var(--primary) 82%, var(--text)); font-size: .78rem; font-weight: 800; }
.forum-community-reply header :is(span, time) { color: var(--text-muted); font-size: .67rem; white-space: nowrap; }
.forum-community-reply p { margin: 7px 0 6px; color: var(--text-secondary); font-size: .86rem; line-height: 1.5; overflow-wrap: anywhere; }
.forum-community-reply footer { position: relative; min-height: 27px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.forum-community-reply.is-own header a,
.forum-community-reply.is-own p { color: #fff; }
.forum-community-reply.is-own header :is(span, time) { color: rgba(235,240,255,.72); }
.forum-parent-quote { display: grid; gap: 3px; width: 100%; margin-top: 8px; padding: 9px 11px; border: 0; border-inline-start: 3px solid var(--primary); border-radius: 8px; background: var(--primary-light); font: inherit; text-align: start; cursor: pointer; }
.forum-parent-quote b { color: var(--primary); font-size: .67rem; }
.forum-parent-quote span { color: var(--text-muted); font-size: .66rem; }
.forum-parent-quote:hover { background: color-mix(in srgb, var(--primary-light) 78%, var(--bg-hover)); }
.forum-parent-quote:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.forum-community-reply.is-own .forum-parent-quote { border-left-color: rgba(255,255,255,.72); background: rgba(7,16,52,.2); }
.forum-community-reply.is-own .forum-parent-quote b { color: #fff; }
.forum-community-reply.is-own .forum-parent-quote span { color: rgba(235,240,255,.72); }
.forum-reply-highlight .forum-reply-bubble { outline: 2px solid var(--primary); outline-offset: 3px; }
.forum-share-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-hover); color: var(--text-secondary); font: 500 12px/1.3 var(--font-sans); cursor: pointer; }
.forum-share-button:hover { color: var(--primary-text); background: var(--primary-light); }
.forum-share-button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* The bubble opens the message sheet from the keyboard (Enter, Shift+F10). */
.forum-reply-bubble:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
/* The sheet's profile and chat rows are links: the chat sheet row look. */
#forum-message-action-sheet a.chat-sheet-action { color: var(--message-action-text, var(--text)); text-decoration: none; }
.forum-reply-avatar-link:focus-visible,
.forum-community-reply header a:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* The chat input area: no panel of its own, the pill floats on the wallpaper. */
.forum-topic-reply-form {
    position: relative;
    z-index: 3;
    display: grid;
    gap: 10px;
    padding: 10px 18px;
    background: transparent;
}
/* The chat input pill (.chat-input-wrapper values per theme): paperclip,
   voice/circle, field, emoji, send. Own forum rules: the chat composer rules
   and ids are bound to the chat page and looked up document-wide by chats.js. */
.forum-chat-composer {
    position: relative;
    display: flex;
    align-items: flex-end;
    gap: 2px;
    min-width: 0;
    min-height: 58px;
    box-sizing: border-box;
    padding: 0 4px;
    border: 1px solid rgba(255, 255, 255, .07);
    border-radius: 999px;
    background: rgba(17, 24, 39, .76);
    box-shadow: 0 14px 36px rgba(0, 0, 0, .2);
    backdrop-filter: blur(16px) saturate(1.12);
    -webkit-backdrop-filter: blur(16px) saturate(1.12);
}
body.theme-light .forum-chat-composer {
    border-color: rgba(15, 23, 42, .1);
    background: rgba(255, 255, 255, .82);
    box-shadow: 0 14px 30px rgba(15, 23, 42, .1);
    backdrop-filter: blur(6px) saturate(1.04);
    -webkit-backdrop-filter: blur(6px) saturate(1.04);
}
.forum-chat-composer-input {
    flex: 1 1 auto;
    align-self: flex-start;
    min-width: 0;
    min-height: 50px;
    max-height: 150px;
    padding: 14px 6px 12px;
    overflow-y: auto;
    resize: none;
    border: 0;
    outline: 0;
    color: var(--text);
    background: transparent;
    font: inherit;
    font-size: .95rem;
    font-weight: 430;
    line-height: 1.44;
    caret-color: var(--text);
}
.forum-chat-composer-input::placeholder { color: var(--text-muted); }
.forum-chat-emoji-toggle {
    display: grid;
    place-items: center;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    margin-block: 6px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: var(--text-muted);
    background: transparent;
    cursor: pointer;
}
.forum-chat-emoji-toggle svg { width: 24px; height: 24px; }
.forum-chat-emoji-toggle:hover,
.forum-chat-emoji-toggle[aria-expanded="true"] { color: var(--primary-text); background: var(--primary-light); }
.forum-chat-emoji-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
/* Photos (migration 0050): the chat's paperclip. */
.forum-chat-attach {
    display: grid;
    place-items: center;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    margin-block: 6px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: var(--text-muted);
    background: transparent;
    cursor: pointer;
}
.forum-chat-attach svg { width: 30px; height: 30px; stroke-width: 1.85; }
.forum-chat-attach:hover { color: var(--primary-text); background: var(--primary-light); }
.forum-chat-attach:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
/* Voice / video circle: the chat's media button in the send position while the
   composer is empty; a vertical swipe switches voice <-> circle. */
.forum-chat-media {
    display: grid;
    place-items: center;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    margin-block: 6px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: var(--text-muted);
    background: transparent;
    cursor: pointer;
    touch-action: none;
}
.forum-chat-media .forum-media-glyph-voice { width: 30px; height: 30px; }
.forum-chat-media:hover { color: var(--primary-text); background: var(--primary-light); }
.forum-chat-media:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.forum-chat-media:disabled { opacity: .45; cursor: default; }
.forum-chat-media[data-mode="voice"] .forum-media-glyph-circle,
.forum-chat-media[data-mode="circle"] .forum-media-glyph-voice { display: none; }
/* While the chat recorder's bar is shown, it takes the composer's place. */
.forum-topic-reply-form.voice-recording-active :is(.forum-chat-composer, .forum-attachments) { display: none; }
.forum-topic-reply-form .voice-recording-bar { order: 2; }
.forum-media .voice-message { max-width: 320px; }
.forum-media .video-circle-message { width: 200px; height: 200px; }
/* As in the chat (#chat-messages), a circle shows no corner duration badge. */
.forum-media .video-circle-message .video-circle-duration { display: none; }
.forum-attachments { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 4px; scrollbar-width: thin; }
.forum-attachments.hidden { display: none; }
.forum-attachment-thumb { position: relative; flex: 0 0 auto; width: 72px; height: 72px; border-radius: 12px; overflow: hidden; background: var(--bg-tertiary); }
.forum-attachment-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.forum-attachment-thumb button {
    position: absolute;
    top: 4px;
    inset-inline-end: 4px;
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    padding: 0;
    border-radius: 50%;
    color: #fff;
    background: rgba(0, 0, 0, .58);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}
.forum-attachment-thumb button:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.forum-create-attach { display: grid; gap: 8px; justify-items: start; }
.forum-create-attach .btn { display: inline-flex; align-items: center; gap: 6px; }
.forum-create-attach .btn svg { width: 18px; height: 18px; }
.forum-media { display: grid; gap: 6px; margin: 4px 0 6px; }
.forum-media-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; max-width: 360px; border-radius: 14px; overflow: hidden; }
.forum-media-grid.count-1 { grid-template-columns: minmax(0, 1fr); }
.forum-media-grid.count-3 > :first-child { grid-row: span 2; }
.forum-media-thumb { display: block; min-height: 0; padding: 0; border-radius: 0; background: var(--bg-tertiary); cursor: zoom-in; aspect-ratio: 1 / 1; }
.forum-media-grid.count-1 .forum-media-thumb { aspect-ratio: auto; max-height: 360px; }
.forum-media-grid.count-3 > :first-child { aspect-ratio: auto; }
.forum-media-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.forum-media-grid.count-1 .forum-media-thumb img { height: auto; max-height: 360px; object-fit: contain; }
.forum-media-thumb:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.forum-topic-article .forum-media { margin-top: 14px; }
.forum-chat-emoji-popover {
    position: absolute;
    z-index: 8;
    inset-inline-end: 18px;
    bottom: calc(100% + 8px);
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: min(352px, calc(100vw - 28px));
    max-height: min(380px, calc(100dvh - 150px));
    box-sizing: border-box;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 16px;
    color: var(--text);
    background: var(--bg-modal);
    box-shadow: var(--shadow-xl);
}
.forum-chat-emoji-popover[hidden] { display: none; }
/* Telegram-like, as in the chat (owner, 2026-10-08): an empty composer shows
   voice/circle in the send position; text, photos or a pending send show send. */
.forum-chat-composer:not(.has-payload) .forum-chat-send,
.forum-chat-composer.has-payload .forum-chat-media { display: none; }
/* The chat's send button: shown with a message, dimmed while it is pending. */
.forum-chat-send {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    margin-block: 6px;
    display: grid;
    place-items: center;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: #fff;
    background: var(--primary-grad);
    box-shadow: 0 7px 18px rgba(80, 74, 220, .28);
    font: inherit;
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
}
.forum-chat-send svg { width: 24px; height: 24px; }
.forum-chat-send-label { display: none; }
.forum-chat-send:not(:disabled):hover { transform: scale(1.06); box-shadow: 0 10px 26px rgba(49,84,204,.38); }
.forum-chat-send:disabled { opacity: .48; cursor: default; }
.forum-topic-reply-locked { display: flex; align-items: center; gap: 8px; margin: 0 20px 20px; padding: 13px 15px; border: 1px solid var(--forum-line); border-radius: 13px; color: var(--text-muted); background: color-mix(in srgb, var(--bg-secondary) 86%, transparent); font-size: .76rem; }
/* The chat's reply quote (.chat-reply-inline as in the chat composer). */
.forum-topic-reply-form > .forum-community-reply-target {
    order: initial;
    flex: none;
    border: 0;
    border-left: 3px solid var(--primary);
    border-radius: 9px;
    box-shadow: none;
}

.forum-modal-backdrop {
    --forum-modal-backdrop-alpha: .76;
    --forum-modal-backdrop-blur: 14px;
    position: fixed;
    z-index: 1200;
    inset: 0;
    display: grid;
    place-items: stretch;
    width: 100vw;
    height: 100dvh;
    padding: 0;
    overflow: hidden;
    background: rgba(2, 6, 16, var(--forum-modal-backdrop-alpha));
    backdrop-filter: blur(var(--forum-modal-backdrop-blur));
    -webkit-backdrop-filter: blur(var(--forum-modal-backdrop-blur));
    transition: opacity .24s ease, background .24s ease, backdrop-filter .24s ease, -webkit-backdrop-filter .24s ease;
}
.forum-modal-backdrop.hidden { display: none; }

/* Desktop dock reserves its own row. The topic composer keeps its existing
   layout, but must fit the viewport below that row. Mobile is unchanged. */
@media (min-width: 769px) and (hover: hover) and (pointer: fine) {
    #app.forum-shell-mode:has(> #desktop-shell-nav.native-search-docked:not([hidden])) #forum-create-modal {
        top: var(--app-menu-bar-h, 0px);
        height: calc(100dvh - var(--app-menu-bar-h, 0px));
    }
    #app.forum-shell-mode:has(> #desktop-shell-nav.native-search-docked:not([hidden])) #forum-create-modal > .forum-create-modal {
        height: 100%;
        min-height: 100%;
        max-height: 100%;
    }
}
.forum-create-modal {
    --forum-modal-swipe-x: 0px;
    --forum-modal-swipe-scale: 1;
    --forum-modal-swipe-radius: 0px;
    --forum-modal-swipe-opacity: 1;
    position: relative;
    width: 100vw;
    min-width: 0;
    height: 100dvh;
    min-height: 100dvh;
    max-width: none;
    max-height: 100dvh;
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
    padding: calc(38px + env(safe-area-inset-top, 0px)) clamp(24px, 5vw, 76px) calc(34px + env(safe-area-inset-bottom, 0px));
    border: 0;
    border-radius: var(--forum-modal-swipe-radius);
    background:
        radial-gradient(circle at 10% 0%, rgba(57, 91, 205, .17), transparent 35%),
        color-mix(in srgb, var(--bg-modal) 98%, transparent);
    box-shadow: 0 36px 110px rgba(0,0,0,.48);
    overscroll-behavior: contain;
    opacity: var(--forum-modal-swipe-opacity);
    transform: translate3d(var(--forum-modal-swipe-x), 0, 0) scale(var(--forum-modal-swipe-scale));
    transform-origin: center center;
    transition: transform .26s cubic-bezier(.18,.82,.22,1), border-radius .26s cubic-bezier(.18,.82,.22,1), opacity .22s ease, box-shadow .26s ease;
    animation: forum-modal-screen-in .26s cubic-bezier(.2,.78,.24,1) both;
}
.forum-modal-window-actions { position: absolute; z-index: 4; top: calc(18px + env(safe-area-inset-top, 0px)); right: clamp(18px, 3vw, 40px); display: flex; align-items: center; gap: 8px; }
.forum-modal-close { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 14px; color: var(--text-muted); background: var(--bg-hover); box-shadow: inset 0 0 0 1px var(--forum-line); cursor: pointer; transition: color .18s ease, background .18s ease, transform .18s ease; }
.forum-modal-close:hover { color: var(--text); background: color-mix(in srgb, var(--primary-light) 72%, var(--bg-hover)); transform: scale(1.04); }
.forum-modal-heading,
.forum-create-modal > form,
.forum-modal-swipe-hint { width: min(100%, 980px); margin-inline: auto; }
.forum-modal-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; padding-right: 56px; }
.forum-modal-heading > span { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; color: #fff; background: var(--primary-grad); }
.forum-modal-heading small { color: var(--text-muted); font-size: .66rem; letter-spacing: .1em; text-transform: uppercase; }
.forum-modal-heading h2 { margin: 2px 0 0; font-size: 1.35rem; }
.forum-modal-swipe-hint { display: none; align-items: center; gap: 6px; margin-top: -10px; margin-bottom: 15px; color: var(--text-muted); font-size: .7rem; font-weight: 700; }
.forum-create-modal form { display: grid; gap: 17px; }
.forum-create-modal label { display: grid; gap: 7px; color: var(--text-secondary); font-size: .75rem; font-weight: 700; }
.forum-create-modal .input, .forum-create-modal .select, .forum-create-modal .textarea { width: 100%; }
.forum-create-modal .textarea { min-height: clamp(250px, 43dvh, 620px); resize: vertical; }
.forum-modal-actions { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 3px; }
.forum-modal-actions > span { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); font-size: .68rem; }
.forum-modal-actions > div { display: flex; gap: 8px; }
.forum-modal-backdrop:is(.is-swipe-tracking, .is-swipe-returning, .is-closing, .is-swipe-closing) .forum-create-modal { animation: none; }
.forum-modal-backdrop.is-swipe-tracking .forum-create-modal { transition: none; user-select: none; box-shadow: 0 28px 90px rgba(0,0,0,.42); will-change: transform, border-radius, opacity; }
.forum-modal-backdrop.is-swipe-returning .forum-create-modal { border-radius: 0; opacity: 1; transform: translate3d(0, 0, 0) scale(1); will-change: transform, border-radius, opacity; }
.forum-modal-backdrop.is-closing { opacity: 0; }
.forum-modal-backdrop.is-closing .forum-create-modal { border-radius: 28px; opacity: .75; transform: translate3d(105vw, 0, 0) scale(.94); }
.forum-modal-backdrop.is-swipe-closing .forum-create-modal { border-radius: var(--forum-modal-swipe-radius, 32px); opacity: var(--forum-modal-swipe-opacity, .72); transform: translate3d(var(--forum-modal-swipe-x, 110vw), 0, 0) scale(var(--forum-modal-swipe-scale, .91)); transition-duration: var(--forum-modal-exit-ms, 220ms); will-change: transform, border-radius, opacity; }

.forum-community-mobile-nav { display: none; }

@keyframes forum-live-in {
    from { opacity: 0; transform: translateY(-8px) scale(.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes forum-live-pulse {
    0% { opacity: .7; transform: scale(.88); }
    72%, 100% { opacity: 0; transform: scale(1.2); }
}

@keyframes forum-new-topic-in {
    from { opacity: 0; transform: translateY(-14px); filter: saturate(1.5); }
    to { opacity: 1; transform: translateY(0); filter: saturate(1); }
}

@keyframes forum-message-in {
    from { opacity: 0; transform: translateY(7px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes forum-modal-screen-in {
    from { opacity: .72; translate: 100vw 0; scale: .95; }
    to { opacity: 1; translate: 0 0; scale: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .forum-live-banner,
    .forum-live-orb::after,
    .forum-community-topic-card.is-new,
    .forum-community-reply,
    .forum-create-modal { animation: none; }
    .forum-create-modal,
    .forum-modal-backdrop { transition-duration: .01ms; }
}

.forum-community-page button,
.forum-community-page .btn {
    border: 0;
}

.forum-community-page a,
.forum-community-page a:hover,
.forum-community-page a:focus {
    text-decoration: none;
}

.forum-community-page .btn {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.25;
}

.forum-community-nav-item span,
.forum-topic-article-actions,
.forum-topic-article-actions .btn,
.forum-modal-actions,
.forum-modal-actions .btn {
    min-width: 0;
    overflow-wrap: anywhere;
}

body.theme-light #app.forum-shell-mode > .main-content > .page-content,
html[data-theme="light"] body #app.forum-shell-mode > .main-content > .page-content,
[data-theme="light"] #app.forum-shell-mode > .main-content > .page-content {
    background-color: var(--bg) !important;
    background-image:
        linear-gradient(180deg, rgba(255,255,255,.28), rgba(255,255,255,.12)),
        url('./assets/chat-pattern-premium.webp') !important;
}

body.theme-light .forum-community-sidebar,
html[data-theme="light"] body .forum-community-sidebar,
[data-theme="light"] .forum-community-sidebar {
    background:
        radial-gradient(circle at 18% 0%, rgba(59, 130, 246, .09), transparent 28%),
        rgba(255,255,255,.82);
}

@media (max-width: 1360px) {
    .forum-community-center { padding-inline: 16px; }
    .forum-topic-search { min-width: 0; }
}

@media (max-width: 1180px) {
    .forum-category-grid.large { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
    #app.forum-shell-mode > .main-content > .page-content {
        min-height: 0;
        padding-bottom: calc(112px + env(safe-area-inset-bottom, 0px)) !important;
        background-image:
            linear-gradient(180deg, rgba(7, 10, 22, .12), rgba(7, 10, 22, .22)),
            url('./assets/chat-pattern-premium-mobile.webp') !important;
        background-size: min(720px, 118vw) min(720px, 118vw) !important;
    }

    body.theme-light #app.forum-shell-mode > .main-content > .page-content,
    html[data-theme="light"] body #app.forum-shell-mode > .main-content > .page-content,
    [data-theme="light"] #app.forum-shell-mode > .main-content > .page-content {
        background-image:
            linear-gradient(180deg, rgba(255,255,255,.16), rgba(255,255,255,.08)),
            url('./assets/chat-pattern-premium-mobile.webp') !important;
    }

    /* Match the shell's !important padding: topic view has no bottom forum menu. */
    #app.forum-shell-mode > .main-content > .page-content:has(.forum-community-page[data-forum-topic-view="true"]) {
        padding-bottom: 0 !important;
    }
    .forum-community-page[data-forum-topic-view="true"] .forum-community-center {
        padding: 0;
    }
    .forum-community-page { min-height: 100%; }
    .forum-community-layout { display: block; min-height: 0; }
    .forum-community-sidebar { display: none; }
    /* Reserve below the actual list: the fixed-height shell's padding does not
       follow overflowing topics. The topic-view rule above keeps its own inset. */
    .forum-community-center { padding: 12px 10px calc(112px + env(safe-area-inset-bottom, 0px)); }
    .forum-section-head { align-items: flex-start; flex-direction: column; padding: 17px 15px; }
    .forum-topic-controls { width: 100%; }
    .forum-topic-search { min-width: 0; flex: 1; }
    #forum-topic-sort { min-width: 120px; }
    .forum-community-topic-card { grid-template-columns: 42px minmax(0, 1fr); gap: 11px; min-height: 0; padding: 14px 13px; }
    .forum-community-topic-card .forum-avatar { width: 42px; height: 42px; }
    .forum-topic-stats { grid-column: 2; grid-template-columns: max-content 1fr; justify-content: start; }
    .forum-topic-stats a { justify-self: end; }
    .forum-topic-copy h3 { font-size: .96rem; white-space: normal; }
    .forum-community-pagination { align-items: flex-start; flex-direction: column; }
    .forum-community-pagination > div { max-width: 100%; overflow-x: auto; }
    .forum-category-grid.large { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 14px; }
    /* The chat's mobile header: 53px, back button 40px, tight gaps. */
    .forum-discussion-card > .forum-discussion-head { flex-direction: row; align-items: center; min-height: 53px; margin: 0; padding: 7px 8px 0; gap: 3px; }
    .forum-discussion-head .forum-topic-header-back { width: 40px; height: 40px; }
    .forum-topic-context-copy strong { font-size: .9rem; line-height: 1.15; }
    .forum-topic-article { padding: 18px 15px; }
    .forum-topic-article > header { align-items: flex-start; flex-direction: column; }
    .forum-topic-article-actions { width: 100%; justify-content: space-between; }
    .forum-topic-article-actions .btn { min-width: 0; }
    .forum-topic-article h1 { font-size: 1.45rem; }
    .forum-community-replies { gap: 12px; padding: 14px 11px 12px; }
    .forum-reply-stack { max-width: calc(100% - 47px); }
    .forum-community-reply .forum-avatar { width: 34px; height: 34px; }
    .forum-reply-bubble { min-width: 112px; padding: 10px 12px 8px; }
    .forum-topic-reply-form {
        padding: 5px max(6px, env(safe-area-inset-right, 0px)) calc(5px + max(8px, env(safe-area-inset-bottom, 0px))) max(6px, env(safe-area-inset-left, 0px));
    }
    .forum-topic-reply-form > .forum-community-reply-target { padding: 8px 9px; border-radius: 16px; }
    .forum-topic-reply-locked { margin-bottom: calc(20px + env(safe-area-inset-bottom, 0px)); }
    .forum-chat-composer { min-height: 52px; }
    .forum-chat-composer > button { margin-block: 3px; }
    .forum-chat-emoji-popover { inset-inline-end: 6px; }
    .forum-chat-composer-input { min-height: 44px; padding: 12px 6px 10px; font-size: 16px; line-height: 20px; }
    .forum-modal-actions { align-items: stretch; flex-direction: column; }
    .forum-modal-actions > div { display: grid; grid-template-columns: 1fr 1fr; }

    .forum-community-page:not([data-forum-topic-view="true"]) .forum-community-mobile-nav {
        position: fixed;
        z-index: 180;
        left: 50%;
        right: auto;
        bottom: max(10px, env(safe-area-inset-bottom, 0px));
        width: min(calc(100% - max(16px, env(safe-area-inset-left)) - max(16px, env(safe-area-inset-right))), 520px);
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        min-height: 70px;
        padding: 7px;
        gap: 5px;
        border: 0;
        border-radius: 24px;
        background:
            linear-gradient(180deg, color-mix(in srgb, var(--bg-card) 96%, transparent), color-mix(in srgb, var(--bg-secondary) 92%, transparent));
        box-shadow: 0 20px 55px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.09);
        backdrop-filter: blur(26px) saturate(1.2);
        -webkit-backdrop-filter: blur(26px) saturate(1.2);
        transform: translateX(-50%);
    }
    .forum-community-mobile-nav a,
    .forum-community-mobile-nav button {
        position: relative;
        min-width: 0;
        display: grid;
        place-items: center;
        align-content: center;
        gap: 4px;
        padding: 5px 3px;
        border: 0;
        border-radius: 15px;
        color: var(--text-muted);
        background: transparent;
        font: inherit;
        font-size: .68rem;
        font-weight: 700;
        line-height: 1;
        cursor: pointer;
        transition: color .18s ease, background .18s ease, transform .18s ease;
    }
    .forum-community-mobile-nav .forum-mobile-nav-link:hover { color: var(--text); background: var(--bg-hover); }
    .forum-community-mobile-nav .forum-mobile-nav-link.active { color: var(--primary); background: color-mix(in srgb, var(--primary-light) 78%, transparent); }
    .forum-community-mobile-nav .forum-mobile-nav-link.active::after {
        content: '';
        position: absolute;
        bottom: 2px;
        width: 18px;
        height: 3px;
        border-radius: 999px;
        background: var(--primary-grad);
        box-shadow: 0 0 10px color-mix(in srgb, var(--primary) 55%, transparent);
    }
    .forum-community-mobile-nav .forum-mobile-nav-icon { width: 25px; height: 25px; display: grid; place-items: center; }
    .forum-community-mobile-nav .forum-mobile-create .forum-mobile-nav-icon { width: 30px; height: 30px; margin-block: -3px -2px; border-radius: 10px; color: #fff; background: var(--primary-grad); box-shadow: 0 7px 18px rgba(49,84,204,.3); }
    .forum-community-mobile-nav .forum-mobile-create:hover .forum-mobile-nav-icon { transform: scale(1.04); }
    .forum-community-mobile-nav .forum-mobile-nav-label { width: 100%; max-width: 100%; overflow: hidden; text-align: center; text-overflow: ellipsis; white-space: nowrap; font-size: .68rem; font-weight: 800; }
    .forum-community-mobile-nav :is(a, button):focus-visible { outline: 2px solid color-mix(in srgb, var(--primary) 76%, #fff); outline-offset: 2px; }
}

@media (max-width: 680px) {
    .forum-category-grid.large { grid-template-columns: 1fr; }
    .forum-live-banner { grid-template-columns: 42px minmax(0, 1fr); }
    .forum-live-orb { width: 42px; height: 42px; }
    .forum-live-banner button { grid-column: 1 / -1; width: 100%; }
}

@media (max-width: 430px) {
    .forum-discussion-head > b { font-size: .68rem; line-height: 1.25; }
    .forum-topic-context-copy { flex: 1 1 auto; }
    .forum-topic-context-copy small { font-size: .55rem; }
    .forum-topic-controls { align-items: stretch; flex-direction: column; }
    #forum-topic-sort { width: 100%; min-width: 0; flex: 0 0 42px; }
    .forum-topic-title-line { align-items: flex-start; flex-direction: column; gap: 5px; }
    .forum-category-grid.large { grid-template-columns: 1fr; }
    .forum-category-card { min-height: 142px; grid-template-columns: 50px minmax(0, 1fr) auto; padding: 17px; }
    .forum-category-card > span { width: 50px; height: 50px; }
    .forum-topic-article-actions { display: grid; grid-template-columns: 1fr; }
    .forum-topic-article-actions .btn { width: 100%; }
    .forum-community-reply.is-own .forum-reply-avatar-link { display: none; }
    .forum-community-reply.is-own .forum-reply-stack { max-width: 88%; }
    .forum-community-mobile-nav { min-height: 66px; padding: 6px; border-radius: 21px; }
    .forum-community-mobile-nav a,
    .forum-community-mobile-nav button { gap: 3px; padding-inline: 2px; }
    .forum-community-mobile-nav .forum-mobile-nav-label { font-size: .62rem; }
    .forum-community-mobile-nav .forum-mobile-nav-icon { width: 23px; height: 23px; }
    .forum-community-mobile-nav .forum-mobile-create .forum-mobile-nav-icon { width: 28px; height: 28px; }
}

/* Forum navigation in the main menu's language: a round back control identical
   to the settings header (.dxs-back 48px, glyph 27px) beside the brand, and
   menu tiles (.dashboard-home-icon: 32px, radius 9px, solid hue, white
   Ionicons glyph 22px) for the sections. The settings/menu variables are
   scoped elsewhere, so the values are restated here. */
.forum-community-sidebar .forum-community-brand {
    grid-template-columns: 48px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
}

.forum-community-back-round {
    --dxs-card: var(--bg-secondary, #1e1e22);
    --dxs-line: color-mix(in srgb, var(--text) 10%, transparent);
    display: grid;
    place-items: center;
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    border: 1px solid var(--dxs-line);
    border-radius: 50%;
    background: var(--dxs-card);
    color: var(--text);
    text-decoration: none;
}

.forum-community-back-round .dxs-icon {
    display: grid;
    place-items: center;
    width: auto;
    height: auto;
    background: none;
}

.forum-community-back-round .dxs-icon svg {
    display: block;
    width: 27px;
    height: 27px;
}

.forum-community-back-round:hover { background: var(--bg-hover); }

.forum-community-back-round:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

html[data-text-dir="rtl"] .forum-community-back-round svg { transform: scaleX(-1); }

.forum-community-nav-icon {
    flex: 0 0 32px;
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    color: #fff;
    background: #257be4;
}

.forum-community-nav-icon svg {
    display: block;
    width: 22px;
    height: 22px;
}

.forum-community-nav-icon[data-forum-nav="topics"] { background: #8354c7; }
.forum-community-nav-icon[data-forum-nav="categories"] { background: #168b91; }
.forum-community-nav-icon[data-forum-nav="mine"] { background: #279b56; }
.forum-community-nav-icon[data-forum-nav="rules"] { background: #bb7220; }

.forum-community-nav-item {
    padding-inline: 9px 14px;
}

.forum-sidebar-create svg {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
}

.forum-community-mobile-nav .forum-mobile-nav-icon svg { display: block; }
html[data-text-dir="rtl"] .forum-community-mobile-nav a[href="#dashboard"] .forum-mobile-nav-icon svg { transform: scaleX(-1); }

/* Category cards: the same solid menu tile with a white Ionicons glyph, scaled
   for the card (48px, radius 13px, glyph 28px). The tones map onto the menu
   hues; «gold» uses the menu red so that neighbouring cards stay distinct. */
.forum-category-card {
    grid-template-columns: 48px minmax(0, 1fr) auto;
}

.forum-category-card:is(.blue, .orange, .violet, .cyan, .green, .gold) > span.forum-category-icon,
html[data-ui-theme="system"] body.theme-system .forum-category-card:is(.blue, .violet, .cyan) > span.forum-category-icon {
    width: 48px;
    height: 48px;
    border-radius: 13px;
    color: #fff;
    background: #257be4;
    box-shadow: none;
}

.forum-category-card > span.forum-category-icon svg {
    display: block;
    width: 28px;
    height: 28px;
}

.forum-category-card.orange > span.forum-category-icon { background: #bb7220; }
.forum-category-card.violet > span.forum-category-icon,
html[data-ui-theme="system"] body.theme-system .forum-category-card.violet > span.forum-category-icon { background: #8354c7; }
.forum-category-card.cyan > span.forum-category-icon,
html[data-ui-theme="system"] body.theme-system .forum-category-card.cyan > span.forum-category-icon { background: #168b91; }
.forum-category-card.green > span.forum-category-icon { background: #279b56; }
.forum-category-card.gold > span.forum-category-icon { background: #d84c61; }

@media (max-width: 430px) {
    .forum-category-card { grid-template-columns: 44px minmax(0, 1fr) auto; }
    .forum-category-card:is(.blue, .orange, .violet, .cyan, .green, .gold) > span.forum-category-icon { width: 44px; height: 44px; border-radius: 12px; }
    .forum-category-card > span.forum-category-icon svg { width: 26px; height: 26px; }
}

.forum-topic-category-link svg { flex: 0 0 auto; }

/* Forum search and sort: one visual family with the header search (pill,
   translucent field, hairline border, inset highlight). Only presentation:
   the same input, select, ids and listeners. The search takes its own row
   across the whole width of its panel; the sort sits under it as a chip. */
.forum-community-page .forum-topic-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    width: 100%;
}

.forum-community-page .forum-topic-search {
    flex: 0 0 auto;
    width: 100%;
    height: 54px;
    min-height: 54px;
    gap: 12px;
    padding: 0 20px 0 18px;
    border: 1px solid var(--forum-line);
    border-radius: 27px;
    color: var(--text-muted);
    background: color-mix(in srgb, var(--bg-tertiary) 72%, transparent);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .035);
    cursor: text;
    transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
}

.forum-community-page .forum-topic-search > svg {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    transition: color .16s ease;
}

.forum-community-page .forum-topic-search:hover {
    border-color: color-mix(in srgb, var(--text) 18%, transparent);
}

.forum-community-page .forum-topic-search:focus-within {
    border-color: color-mix(in srgb, var(--primary) 60%, transparent);
    background: color-mix(in srgb, var(--bg-tertiary) 88%, transparent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent);
}

.forum-community-page .forum-topic-search:focus-within > svg { color: var(--primary-text, var(--primary)); }

.forum-community-page .forum-topic-search input {
    min-width: 0;
    height: 100%;
    padding: 0;
    /* At least the 16px of the mobile anti-zoom rule, a step larger here. */
    font-size: 17px !important;
    font-weight: 500;
    text-overflow: ellipsis;
}

.forum-community-page .forum-topic-search input::placeholder {
    color: var(--text-muted);
    opacity: 1;
}

.forum-community-page .forum-topic-search input::-webkit-search-decoration { display: none; }

.forum-community-page #forum-topic-sort {
    flex: 0 0 auto;
    align-self: flex-start;
    width: auto;
    min-width: 0;
    max-width: 100%;
    height: 44px;
    margin: 0;
    padding: 0 40px 0 16px;
    border: 1px solid var(--forum-line);
    border-radius: 22px;
    -webkit-appearance: none;
    appearance: none;
    color: var(--text);
    background-color: color-mix(in srgb, var(--bg-tertiary) 72%, transparent);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b95a7' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 16px 16px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .035);
    font-size: .9375rem;
    font-weight: 600;
    line-height: 1.2;
    text-overflow: ellipsis;
    cursor: pointer;
    transition: border-color .16s ease, box-shadow .16s ease;
}

.forum-community-page #forum-topic-sort:hover {
    border-color: color-mix(in srgb, var(--text) 18%, transparent);
}

.forum-community-page #forum-topic-sort:focus-visible {
    outline: none;
    border-color: color-mix(in srgb, var(--primary) 60%, transparent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent);
}

.forum-community-page #forum-topic-sort option {
    color: var(--text);
    background: var(--bg-secondary);
}

html[data-text-dir="rtl"] .forum-community-page .forum-topic-search { padding-inline: 18px 20px; }
html[data-text-dir="rtl"] .forum-community-page #forum-topic-sort {
    padding: 0 16px 0 40px;
    background-position: left 16px center;
}

/* Narrow screens: a column flex basis of 0 used to shrink the field to the
   text line; it keeps its full height, and the panel insets are trimmed so
   the search spans nearly the whole screen. */
@media (max-width: 760px) {
    .forum-community-page .forum-section-head { padding-inline: 12px; }
    .forum-community-page .forum-topic-search { flex: 0 0 54px; }
}

/* === Full-screen modal navigation (chat/call dialogs are excluded in JS) === */
.dealix-modal-layer.dealix-modal-active {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    min-width: 0 !important;
    height: 100dvh !important;
    min-height: 100dvh !important;
    max-width: none !important;
    max-height: 100dvh !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
    border-radius: 0 !important;
}

.dealix-modal-layer.dealix-modal-active.dealix-modal-swipe-layer {
    background: rgba(2, 6, 23, var(--dealix-modal-backdrop-alpha, .68)) !important;
    backdrop-filter: blur(var(--dealix-modal-backdrop-blur, 14px)) saturate(1.06) !important;
    -webkit-backdrop-filter: blur(var(--dealix-modal-backdrop-blur, 14px)) saturate(1.06) !important;
    transition: background .24s ease, backdrop-filter .24s ease, -webkit-backdrop-filter .24s ease !important;
}

.dealix-modal-screen {
    --dealix-modal-swipe-x: 0px;
    --dealix-modal-swipe-scale: 1;
    --dealix-modal-swipe-radius: 0px;
    --dealix-modal-swipe-opacity: 1;
    inset: 0 !important;
    width: 100vw !important;
    min-width: 0 !important;
    height: 100dvh !important;
    min-height: 100dvh !important;
    max-width: none !important;
    max-height: 100dvh !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    border-radius: var(--dealix-modal-swipe-radius) !important;
    overscroll-behavior: contain;
    transform: translate3d(var(--dealix-modal-swipe-x), 0, 0) scale(var(--dealix-modal-swipe-scale)) !important;
    transform-origin: center center;
    transition: transform .26s cubic-bezier(.18,.82,.22,1), border-radius .26s cubic-bezier(.18,.82,.22,1), opacity .22s ease, box-shadow .26s ease !important;
    animation: none !important;
}

.dealix-modal-screen:not(.listing-photo-viewer-panel):not(.profile-followers-panel) {
    overflow-x: hidden !important;
    overflow-y: auto !important;
}

.dealix-modal-screen.modal {
    display: flex !important;
    flex-direction: column;
}

.dealix-modal-screen.modal > .modal-header {
    flex: 0 0 auto;
    width: min(100%, 1180px);
    margin-inline: auto;
    padding-top: calc(20px + env(safe-area-inset-top, 0px));
}

.dealix-modal-screen.modal > .modal-body {
    flex: 1 1 auto;
    width: min(100%, 1180px);
    margin-inline: auto;
    overflow-y: auto;
}

.dealix-modal-screen.modal > .modal-footer {
    flex: 0 0 auto;
    width: min(100%, 1180px);
    margin-inline: auto;
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
}

.dealix-modal-screen.group-chat-card {
    display: flex !important;
    flex-direction: column;
    gap: 12px;
    padding: calc(24px + env(safe-area-inset-top, 0px)) clamp(18px, 5vw, 72px) calc(22px + env(safe-area-inset-bottom, 0px)) !important;
    overflow: hidden !important;
}

.dealix-modal-screen.group-chat-card > * {
    width: min(100%, 980px);
    margin-inline: auto;
    box-sizing: border-box;
}

.dealix-modal-screen.group-chat-card .group-chat-results {
    flex: 1 1 auto;
    min-height: 160px;
    max-height: none;
    overflow-y: auto;
}

.dealix-modal-screen.group-invite-picker {
    gap: 16px;
    width: 100vw !important;
    height: 100dvh !important;
    max-width: none !important;
    max-height: 100dvh !important;
    border-radius: var(--dealix-modal-swipe-radius, 0px) !important;
    padding: calc(24px + env(safe-area-inset-top, 0px)) clamp(18px, 5vw, 72px) calc(22px + env(safe-area-inset-bottom, 0px)) !important;
    overflow: hidden !important;
}

.dealix-modal-screen.group-invite-picker > * {
    width: min(100%, 980px);
    margin-inline: auto;
    box-sizing: border-box;
}

.dealix-modal-screen.group-invite-picker .chat-forward-list {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none !important;
    overflow-y: auto !important;
}

.dealix-modal-screen .dealix-modal-close-control {
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    min-height: 42px !important;
    max-width: 42px !important;
    max-height: 42px !important;
    padding: 0 !important;
    border: 1px solid rgba(255,255,255,.16) !important;
    border-radius: 999px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: #fff !important;
    background: rgba(15,23,42,.30) !important;
    box-shadow: 0 12px 30px rgba(0,0,0,.18), inset 0 1px 0 rgba(255,255,255,.08) !important;
    backdrop-filter: blur(12px) saturate(1.14) !important;
    -webkit-backdrop-filter: blur(12px) saturate(1.14) !important;
    font-size: 0 !important;
    line-height: 1 !important;
    cursor: pointer !important;
    -webkit-tap-highlight-color: transparent !important;
    touch-action: manipulation !important;
}

.dealix-modal-screen .dealix-modal-close-control svg {
    width: 18px !important;
    height: 18px !important;
    display: block !important;
    flex: 0 0 18px !important;
    margin: 0 !important;
    fill: none !important;
    stroke: currentColor !important;
    stroke-width: 2.35 !important;
    stroke-linecap: round !important;
    stroke-linejoin: round !important;
    pointer-events: none !important;
}

.dealix-modal-screen .dealix-modal-close-control:hover,
.dealix-modal-screen .dealix-modal-close-control:focus-visible {
    color: #fff !important;
    background: rgba(30,41,59,.46) !important;
    border-color: rgba(167,139,250,.26) !important;
    outline: none !important;
}

body.theme-light .dealix-modal-screen .dealix-modal-close-control,
html[data-theme="light"] body .dealix-modal-screen .dealix-modal-close-control,
body.theme-glass .deal-action-modal-overlay .dealix-modal-close-control {
    color: #111827 !important;
    background: rgba(255,255,255,.82) !important;
    border-color: rgba(15,23,42,.12) !important;
    box-shadow: 0 12px 28px rgba(15,23,42,.12), inset 0 1px 0 rgba(255,255,255,.70) !important;
}

.dealix-modal-screen:is(.feed-dialog, .p2p-modal-card, .profile-photo-modal-card, .profile-report-modal, .dispute-message-modal) {
    padding: calc(32px + env(safe-area-inset-top, 0px)) clamp(20px, 5vw, 72px) calc(28px + env(safe-area-inset-bottom, 0px)) !important;
}

.dealix-modal-screen.feed-dialog > :not(.feed-dialog-x),
.dealix-modal-screen.p2p-modal-card > *,
.dealix-modal-screen.profile-photo-modal-card > :not(.profile-photo-modal-close),
.dealix-modal-screen.profile-report-modal > *,
.dealix-modal-screen.dispute-message-modal > * {
    width: min(100%, 980px);
    margin-inline: auto;
    box-sizing: border-box;
}



.dealix-modal-screen.garant-deal-confirm-dialog > *,
.dealix-modal-screen.listing-deal-panel > :not(.listing-deal-close),
.dealix-modal-screen.listing-confirm-panel > *,
.dealix-modal-screen.listing-report-panel > *,
.dealix-modal-screen.admin-listing-action-panel > :not(.admin-listing-action-close),
.dealix-modal-screen.listing-report-panel > form {
    width: min(100%, 980px);
    margin-inline: auto;
    box-sizing: border-box;
}

.dealix-modal-screen.listing-form-panel > .listing-form {
    width: min(100%, 1180px);
    margin-inline: auto;
    box-sizing: border-box;
}

.dealix-modal-screen.dashboard-clear-modal {
    grid-template-columns: 54px minmax(0, 720px);
    grid-template-rows: auto auto;
    align-content: center;
    justify-content: center;
    padding: calc(24px + env(safe-area-inset-top, 0px)) clamp(18px, 5vw, 72px) calc(24px + env(safe-area-inset-bottom, 0px)) !important;
}

.dealix-modal-screen.profile-photo-actions-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 7px;
    padding: calc(24px + env(safe-area-inset-top, 0px)) clamp(16px, 5vw, 72px) calc(24px + env(safe-area-inset-bottom, 0px)) !important;
}

.dealix-modal-screen.profile-photo-actions-card > button {
    width: min(100%, 720px);
    margin-inline: auto;
}

.dealix-modal-screen.dealix-modal-entering {
    animation: dealix-modal-screen-in .26s cubic-bezier(.2,.78,.24,1) both !important;
}

.dealix-modal-screen.dealix-modal-swipe-tracking {
    transition: none !important;
    user-select: none;
    opacity: var(--dealix-modal-swipe-opacity) !important;
    box-shadow: 0 28px 90px rgba(0,0,0,.42) !important;
    will-change: transform, border-radius, opacity;
}

.dealix-modal-screen.dealix-modal-swipe-returning {
    border-radius: 0 !important;
    opacity: 1 !important;
    transform: translate3d(0, 0, 0) scale(1) !important;
    will-change: transform, border-radius, opacity;
}

.dealix-modal-screen.dealix-modal-leaving-right {
    border-radius: var(--dealix-modal-swipe-radius, 32px) !important;
    opacity: var(--dealix-modal-swipe-opacity, .72) !important;
    transform: translate3d(var(--dealix-modal-swipe-x, 110vw), 0, 0) scale(var(--dealix-modal-swipe-scale, .91)) !important;
    transition-duration: var(--dealix-modal-exit-ms, 220ms) !important;
    will-change: transform, border-radius, opacity;
}

@keyframes dealix-modal-screen-in {
    from { opacity: .72; translate: 100vw 0; scale: .95; }
    to { opacity: 1; translate: 0 0; scale: 1; }
}

@media (max-width: 900px), (pointer: coarse) {
    .dealix-modal-screen {
        touch-action: pan-y;
    }

    .dealix-modal-screen.group-chat-card {
        padding: calc(18px + env(safe-area-inset-top, 0px)) 16px calc(16px + env(safe-area-inset-bottom, 0px)) !important;
    }

    .dealix-modal-screen.group-invite-picker {
        padding: calc(18px + env(safe-area-inset-top, 0px)) 16px calc(16px + env(safe-area-inset-bottom, 0px)) !important;
    }

    .dealix-modal-screen .dealix-modal-close-control {
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
        min-height: 40px !important;
        max-width: 40px !important;
        max-height: 40px !important;
    }

    .dealix-modal-screen .dealix-modal-close-control svg {
        width: 17px !important;
        height: 17px !important;
        flex-basis: 17px !important;
    }

    .forum-create-modal {
        padding: calc(25px + env(safe-area-inset-top, 0px)) 14px calc(22px + env(safe-area-inset-bottom, 0px));
        touch-action: pan-y;
    }

    .forum-modal-window-actions {
        top: calc(10px + env(safe-area-inset-top, 0px));
        right: 10px;
    }

    .forum-modal-heading {
        min-height: 48px;
        margin-bottom: 18px;
        padding-right: 48px;
    }

    .forum-modal-swipe-hint {
        display: flex;
    }

    .forum-create-modal .textarea {
        min-height: clamp(220px, 38dvh, 480px);
    }

    .dealix-modal-screen:is(.feed-dialog, .p2p-modal-card, .profile-photo-modal-card, .profile-report-modal, .dispute-message-modal) {
        padding: calc(24px + env(safe-area-inset-top, 0px)) 16px calc(22px + env(safe-area-inset-bottom, 0px)) !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .dealix-modal-screen.dealix-modal-entering { animation: none !important; }
    .dealix-modal-screen { transition-duration: .01ms !important; }
}

/* Compact post quote and share dialogs. Keep the existing modal controller,
   close/swipe/focus lifecycle and handlers; only these three layouts opt out
   of the full-height presentation. Other modal screens are unchanged. */
.feed-dialog:is(.feed-quote-dialog, .feed-share-dialog:has(> .feed-share-preview-post, > .feed-share-comment-preview), .dxp-share-panel) {
    inset: auto !important;
    width: min(600px, calc(100vw - 24px)) !important;
    max-width: none !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: calc(100dvh - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) !important;
    margin: auto !important;
    padding: 20px !important;
    border-radius: max(20px, var(--dealix-modal-swipe-radius, 0px)) !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr);
    grid-auto-rows: max-content;
    align-content: start;
    align-items: start;
    gap: 12px !important;
    box-sizing: border-box;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
}
.feed-dialog:is(.feed-quote-dialog, .feed-share-dialog:has(> .feed-share-preview-post, > .feed-share-comment-preview), .dxp-share-panel) > :not(.feed-dialog-x) {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    margin-inline: 0;
    box-sizing: border-box;
}
.feed-dialog:is(.feed-quote-dialog, .feed-share-dialog:has(> .feed-share-preview-post, > .feed-share-comment-preview), .dxp-share-panel) > h3 {
    min-height: 42px;
    display: flex;
    align-items: center;
    padding-inline-end: 48px;
    font-size: 19px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}
.feed-dialog:is(.feed-quote-dialog, .feed-share-dialog:has(> .feed-share-preview-post, > .feed-share-comment-preview), .dxp-share-panel) > .feed-dialog-x {
    top: 12px;
    left: auto;
    right: auto;
    inset-inline-end: 12px;
    z-index: 1;
}
.feed-quote-dialog .feed-dialog-textarea {
    height: clamp(112px, 18dvh, 144px);
    min-height: 104px;
    max-width: 100%;
    box-sizing: border-box;
    padding: 12px;
    font-size: 16px;
    line-height: 1.45;
}
.feed-quote-dialog .feed-quote-embed.is-preview {
    margin: 0;
    gap: 8px;
    align-content: start;
    grid-auto-rows: max-content;
    max-height: min(34dvh, 220px);
    overflow: auto;
}
.feed-quote-dialog .feed-quote-embed.is-preview .feed-quote-head b {
    white-space: normal;
    overflow-wrap: anywhere;
}
.feed-quote-dialog .feed-dialog-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}
.feed-dialog.feed-quote-dialog .feed-dialog-actions > .btn,
.feed-dialog.dxp-share-panel .dxp-share-actions > .btn {
    width: 100%;
    height: auto;
    min-height: 44px;
    min-width: 0;
    max-width: 100%;
    padding: 10px 12px;
    font-size: 14px !important;
    line-height: 1.35 !important;
    white-space: normal;
    overflow-wrap: anywhere;
    justify-content: center;
    align-self: start;
}
.feed-dialog.dxp-share-panel .dxp-share-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr));
    gap: 8px;
    margin-top: 0;
}
.feed-dialog.dxp-share-panel .dxp-share-actions > .btn.ghost {
    border: 1px solid var(--border, rgba(127,127,127,.25)) !important;
    border-radius: 12px;
    background: var(--bg-secondary, transparent) !important;
}
.feed-dialog.dxp-share-panel .dxp-share-owner {
    display: grid;
    gap: 8px;
    margin-top: 0;
    padding-top: 12px;
    min-width: 0;
}
.feed-dialog.dxp-share-panel .dxp-share-owner[hidden],
.feed-dialog.dxp-share-panel [hidden] { display: none !important; }
.feed-dialog.dxp-share-panel .dxp-share-status,
.feed-dialog.dxp-share-panel .dxp-share-owner > p {
    font-size: 14px;
    line-height: 1.45;
}
.feed-dialog.dxp-share-panel .dxp-share-url { margin: 0; font-size: 16px; }
.feed-dialog.dxp-share-panel .dxp-share-qr {
    width: min(156px, 100%);
    margin: 0 auto;
}
.feed-dialog.feed-share-dialog:has(> .feed-share-preview-post, > .feed-share-comment-preview) .feed-share-search { margin: 0; }
.feed-dialog.feed-share-dialog:has(> .feed-share-preview-post, > .feed-share-comment-preview) .feed-share-preview-card {
    margin: 0;
    min-height: 0;
    max-height: min(32dvh, 250px);
    overflow: auto;
    overflow-wrap: anywhere;
}
.feed-dialog.feed-share-dialog:has(> .feed-share-preview-post, > .feed-share-comment-preview) .feed-share-list {
    min-height: 0;
    max-height: min(38dvh, 320px);
    align-content: start;
    overflow-y: auto;
}
.feed-dialog.feed-share-dialog:has(> .feed-share-preview-post, > .feed-share-comment-preview) .feed-share-recipient {
    min-width: 0;
    min-height: 48px;
    height: auto;
}
@media (max-width: 560px) {
    .feed-dialog:is(.feed-quote-dialog, .feed-share-dialog:has(> .feed-share-preview-post, > .feed-share-comment-preview), .dxp-share-panel) {
        padding: 16px !important;
        gap: 10px !important;
    }
    .feed-dialog:is(.feed-quote-dialog, .feed-share-dialog:has(> .feed-share-preview-post, > .feed-share-comment-preview), .dxp-share-panel) > h3 { font-size: 18px; }
    .feed-dialog.dxp-share-panel .dxp-share-actions {
        grid-template-columns: repeat(auto-fit, minmax(min(120px, 100%), 1fr));
    }
}

/* Compact post edit and report dialogs. The only 500-character feed text
   dialog is the post report; keep all other modal screens and handlers intact. */
.feed-dialog.feed-dialog-wide:is(.feed-edit-dialog, :has(> textarea.feed-dialog-textarea[maxlength="500"])) {
    inset: auto !important;
    width: min(600px, calc(100vw - 24px)) !important;
    max-width: none !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: calc(100dvh - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) !important;
    margin: auto !important;
    padding: 20px !important;
    border-radius: max(20px, var(--dealix-modal-swipe-radius, 0px)) !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr);
    grid-auto-rows: max-content;
    align-content: start;
    align-items: start;
    gap: 12px !important;
    box-sizing: border-box;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
}
.feed-dialog.feed-dialog-wide:is(.feed-edit-dialog, :has(> textarea.feed-dialog-textarea[maxlength="500"])) > :not(.feed-dialog-x) {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    margin-inline: 0;
    box-sizing: border-box;
}
.feed-dialog.feed-dialog-wide:is(.feed-edit-dialog, :has(> textarea.feed-dialog-textarea[maxlength="500"])) > h3 {
    min-height: 42px;
    display: flex;
    align-items: center;
    padding-inline-end: 48px;
    font-size: 19px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}
.feed-dialog.feed-dialog-wide:is(.feed-edit-dialog, :has(> textarea.feed-dialog-textarea[maxlength="500"])) > .feed-dialog-x {
    top: 12px;
    left: auto;
    right: auto;
    inset-inline-end: 12px;
    z-index: 1;
}
.feed-dialog.feed-dialog-wide:is(.feed-edit-dialog, :has(> textarea.feed-dialog-textarea[maxlength="500"])) > .feed-dialog-textarea {
    height: clamp(112px, 20dvh, 160px);
    min-height: 104px;
    max-width: 100%;
    margin: 0;
    padding: 12px;
    font-size: 16px;
    line-height: 1.45;
    box-sizing: border-box;
}
.feed-dialog.feed-dialog-wide:is(.feed-edit-dialog, :has(> textarea.feed-dialog-textarea[maxlength="500"])) .feed-dialog-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}
.feed-dialog.feed-dialog-wide:is(.feed-edit-dialog, :has(> textarea.feed-dialog-textarea[maxlength="500"])) .feed-dialog-actions > .btn {
    width: 100%;
    height: auto;
    min-height: 44px;
    min-width: 0;
    max-width: 100%;
    padding: 10px 12px;
    font-size: 14px !important;
    line-height: 1.35 !important;
    white-space: normal;
    overflow-wrap: anywhere;
    justify-content: center;
    align-self: start;
}
.feed-dialog.feed-edit-dialog > .feed-audience-control,
.feed-dialog.feed-edit-dialog > .feed-edit-media-title,
.feed-dialog.feed-edit-dialog > .feed-compose-preview,
.feed-dialog.feed-edit-dialog > .feed-edit-tools {
    margin-block: 0;
}
.feed-dialog.feed-edit-dialog .feed-audience-control select { font-size: 16px; }
.feed-dialog.feed-edit-dialog .feed-edit-tools { align-items: center; }
.feed-dialog.feed-edit-dialog .feed-edit-tools small { min-width: 0; overflow-wrap: anywhere; }
.feed-dialog.feed-edit-dialog .feed-compose-preview { align-content: start; }
@media (max-width: 560px) {
    .feed-dialog.feed-dialog-wide:is(.feed-edit-dialog, :has(> textarea.feed-dialog-textarea[maxlength="500"])) {
        padding: 16px !important;
        gap: 10px !important;
    }
    .feed-dialog.feed-dialog-wide:is(.feed-edit-dialog, :has(> textarea.feed-dialog-textarea[maxlength="500"])) > h3 { font-size: 18px; }
}

/* Compact confirmation for deleting a feed/profile post only.
   Keep the modal navigation controller and action handlers unchanged. */
.feed-dialog.feed-post-delete-dialog {
    inset: auto !important;
    width: min(440px, calc(100vw - 24px)) !important;
    min-width: 0 !important;
    max-width: none !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: calc(100dvh - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) !important;
    margin: auto !important;
    padding: 20px !important;
    border-radius: max(20px, var(--dealix-modal-swipe-radius, 0px)) !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr);
    grid-auto-rows: max-content;
    align-content: start;
    align-items: start;
    gap: 12px !important;
    box-sizing: border-box;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
}
.feed-dialog.feed-post-delete-dialog > :not(.feed-dialog-x) {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    margin-inline: 0;
    box-sizing: border-box;
}
.feed-dialog.feed-post-delete-dialog > h3 {
    min-height: 42px;
    display: flex;
    align-items: center;
    padding-inline-end: 48px;
    font-size: 19px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}
.feed-dialog.feed-post-delete-dialog > .feed-dialog-x {
    top: 12px;
    left: auto;
    right: auto;
    inset-inline-end: 12px;
    z-index: 1;
}
.feed-dialog.feed-post-delete-dialog > p {
    overflow-wrap: anywhere;
}
.feed-dialog.feed-post-delete-dialog > .feed-dialog-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}
.feed-dialog.feed-post-delete-dialog > .feed-dialog-actions > .btn {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    height: auto;
    min-height: 44px;
    padding: 10px 12px;
    font-size: 14px !important;
    line-height: 1.35 !important;
    white-space: normal;
    overflow-wrap: anywhere;
    justify-content: center;
    align-self: start;
}
@media (max-width: 560px) {
    .feed-dialog.feed-post-delete-dialog { padding: 16px !important; gap: 10px !important; }
    .feed-dialog.feed-post-delete-dialog > h3 { font-size: 18px; }
}

/* === DEALIX chat info quick actions: existing call / sound / search / menu === */
.chat-info-quick-actions {
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.chat-info-quick-action {
    min-width: 0;
    min-height: 80px;
    padding: 10px 6px 8px;
    border: 1px solid transparent;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: color-mix(in srgb, var(--info) 78%, #7dd3fc);
    background: color-mix(in srgb, var(--bg-card) 92%, #05070d);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.04), 0 10px 24px rgba(0,0,0,.10);
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: transform .16s ease, color .16s ease, background .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.chat-info-quick-action:hover:not(:disabled),
.chat-info-quick-action:focus-visible {
    color: color-mix(in srgb, var(--info) 86%, #bae6fd);
    background: color-mix(in srgb, var(--bg-card) 82%, var(--primary-light));
    border-color: color-mix(in srgb, var(--info) 22%, transparent);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 14px 30px rgba(59,130,246,.12);
    outline: none;
    transform: translateY(-2px);
}

.chat-info-quick-action:active:not(:disabled) {
    transform: translateY(0) scale(.97);
}

.chat-info-quick-action:disabled {
    cursor: not-allowed;
    opacity: .44;
}

.chat-info-quick-action-icon {
    width: 34px;
    height: 34px;
    min-width: 34px;
    min-height: 34px;
    border-radius: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: inherit;
    background: transparent;
    box-shadow: none;
}

.chat-info-quick-action-icon svg {
    width: 29px;
    height: 29px;
    min-width: 29px;
    min-height: 29px;
    display: block;
}

.chat-info-quick-action-label {
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
    font-size: 11px;
    line-height: 1.1;
    font-weight: 850;
    letter-spacing: .025em;
    text-transform: uppercase;
    color: inherit;
}

.chat-info-quick-action.is-active .chat-info-quick-action-icon {
    color: inherit;
    background: transparent;
    box-shadow: none;
}

.chat-info-quick-action.is-muted .chat-info-quick-action-icon {
    color: var(--text-muted);
    background: transparent;
    box-shadow: none;
}

.chat-info-quick-action.is-muted .chat-info-quick-action-label {
    color: var(--text-muted);
}

.chat-info-content .user-info > .chat-info-quick-actions,
.chat-info-content .user-info-cover > .chat-info-quick-actions {
    margin-top: -2px;
    margin-bottom: 2px;
}

.group-info-quick-actions {
    width: 100%;
    max-width: 560px;
    margin: 4px auto 0;
}
.group-members-panel.group-info-panel .group-info-quick-actions > .chat-info-quick-actions { gap: 6px; }
.group-members-panel.group-info-panel .group-info-quick-actions .chat-info-quick-action {
    min-height: 72px;
    padding: 8px 4px 7px;
    border-radius: 16px;
    gap: 4px;
}
.group-members-panel.group-info-panel .group-info-quick-actions .chat-info-quick-action-icon {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
}
.group-members-panel.group-info-panel .group-info-quick-actions .chat-info-quick-action-icon svg {
    width: 27px;
    height: 27px;
    min-width: 27px;
    min-height: 27px;
}

.group-info-quick-actions.hidden,
.group-info-actions.hidden {
    display: none !important;
}

.group-info-quick-actions > .chat-info-quick-actions {
    max-width: 100%;
}

body.theme-light .chat-info-quick-action,
html[data-theme="light"] body .chat-info-quick-action {
    background: rgba(15,23,42,.055);
    border-color: transparent;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.92), 0 10px 24px rgba(15,23,42,.07);
}

@media (max-width: 640px) {
    .group-members-panel.group-info-panel .group-info-cover {
        gap: 5px !important;
        padding-top: max(14px, env(safe-area-inset-top)) !important;
        padding-bottom: 11px !important;
    }
    .group-members-panel.group-info-panel .group-info-avatar {
        width: 66px !important;
        height: 66px !important;
        font-size: 22px !important;
    }
    .group-members-panel.group-info-panel .group-members-title { font-size: 18px !important; }
    .group-members-panel.group-info-panel .group-info-quick-actions .chat-info-quick-action { min-height: 68px; border-radius: 15px; }
    .group-info-notifications { margin: 8px 10px 0; border-radius: 15px; }
    .group-info-notifications > summary { min-height: 54px; padding: 9px 11px; }
    .group-info-notifications-body { padding: 0 8px 8px; }
    .chats-page .group-info-notifications .group-notification-preferences { padding: 10px; }
}

@media (max-width: 640px) {
    .chat-info-quick-actions {
        gap: 7px;
    }

    .chat-info-quick-action {
        min-height: 86px;
        padding: 11px 4px 9px;
        border-radius: 19px;
        gap: 5px;
    }

    .chat-info-quick-action-icon {
        width: 36px;
        height: 36px;
        min-width: 36px;
        min-height: 36px;
        border-radius: 0;
    }

    .chat-info-quick-action-icon svg {
        width: 31px;
        height: 31px;
        min-width: 31px;
        min-height: 31px;
    }

    .chat-info-quick-action-label {
        font-size: 11px;
    }

    .group-info-cover {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }
}

@media (max-width: 360px) {
    .chat-info-quick-actions { gap: 5px; }
    .chat-info-quick-action { min-height: 82px; border-radius: 17px; }
    .chat-info-quick-action-icon { width: 33px; height: 33px; min-width: 33px; min-height: 33px; }
    .chat-info-quick-action-icon svg { width: 28px; height: 28px; min-width: 28px; min-height: 28px; }
    .chat-info-quick-action-label { font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
    .chat-info-quick-action,
    .group-info-notifications-chevron { transition-duration: .01ms !important; }
}

/* Private-chat identity and block action share the existing deals card. */
.chat-info-content .user-info-stats.user-info-private-summary {
    gap: 0 !important;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
    border-radius: 18px;
    background: color-mix(in srgb, var(--bg-card) 78%, transparent);
}

.chat-info-content .user-info-stats.user-info-private-summary .stat {
    min-height: 64px !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
}

.user-info-private-row {
    min-height: 72px;
    padding: 12px 14px;
    border-top: 1px solid color-mix(in srgb, var(--border) 62%, transparent);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 3px;
}

.user-info-private-label {
    color: var(--text-secondary);
    font-size: .78rem;
    line-height: 1.2;
    font-weight: 780;
}

.user-info-private-handle,
.user-info-private-block {
    border: 0;
    font: inherit;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.user-info-private-handle {
    max-width: 100%;
    padding: 0;
    overflow: hidden;
    color: color-mix(in srgb, var(--info) 84%, #7dd3fc);
    background: transparent;
    font-size: 1rem;
    line-height: 1.3;
    font-weight: 850;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-info-private-handle:hover,
.user-info-private-handle:focus-visible {
    color: color-mix(in srgb, var(--info) 94%, #bae6fd);
    outline: none;
}

.user-info-private-block {
    width: 100%;
    min-height: 58px;
    padding: 12px 14px;
    border-top: 1px solid color-mix(in srgb, var(--border) 62%, transparent);
    color: #ff6b76;
    background: transparent;
    text-align: left;
    font-size: 1rem;
    font-weight: 900;
    transition: background .16s ease, color .16s ease, opacity .16s ease;
}

.user-info-private-block.is-blocked {
    color: color-mix(in srgb, var(--info) 86%, #7dd3fc);
}

.user-info-private-block:hover:not(:disabled),
.user-info-private-block:focus-visible {
    background: color-mix(in srgb, currentColor 9%, transparent);
    outline: none;
}

.user-info-private-block:disabled,
.user-info-private-block[aria-busy="true"] {
    cursor: wait;
    opacity: .55;
}

body.theme-light .chat-info-content .user-info-stats.user-info-private-summary,
html[data-theme="light"] body .chat-info-content .user-info-stats.user-info-private-summary {
    background: rgba(15,23,42,.045);
}

/* Light theme: #ff6b76 on the summary grey was 2.51:1 (contrast audit
   2026-10-13); --danger #dc2626 gives only 4.43:1 for this 16px text. */
body.theme-light .user-info-private-block:not(.is-blocked) {
    color: #b91c1c;
}

@media (max-width: 640px) {
    .user-info-private-row {
        min-height: 76px;
        padding: 13px 15px;
    }

    .user-info-private-block {
        min-height: 62px;
        padding: 14px 15px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .user-info-private-block { transition-duration: .01ms !important; }
}

/* === Профиль: строки входящих запросов на подписку (UI-only, scoped) ===
   Живут только внутри существующей панели подписчиков во вкладке «Запросы».
   Ни один общий класс статистики, карточек или кнопок не переопределяется. */
.profile-followers-panel .profile-follow-request-row {
    width: 100%;
    border: 1px solid rgba(148,163,184,.12);
    background: rgba(148,163,184,.065);
    color: inherit;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border-radius: 20px;
    text-align: left;
}

.profile-followers-panel .profile-follow-request-row + .profile-follow-request-row {
    margin-top: 10px;
}

.profile-followers-panel .profile-follow-request-row .profile-follower-info {
    min-width: 0;
    flex: 1 1 auto;
}

.profile-followers-panel .profile-follow-request-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    margin-left: auto;
}

.profile-followers-panel .profile-follow-request-row[data-request-busy="1"] {
    opacity: .7;
}

@media (max-width: 480px) {
    .profile-followers-panel .profile-follow-request-row {
        flex-wrap: wrap;
        row-gap: 10px;
    }

    .profile-followers-panel .profile-follow-request-actions {
        width: 100%;
        margin-left: 0;
    }

    .profile-followers-panel .profile-follow-request-actions .btn {
        flex: 1 1 0;
        justify-content: center;
    }
}


/* ===== Recent accounts on the sign-in screen =====
   The list only fills in the login: no token is stored on the device and the
   password is always required (services/recent-accounts.js). Colours reuse the
   auth panel variables so both themes work without a second rule set. */
.auth-recent {
    display: none;
}
.auth-recent.has-items {
    display: block;
    margin-bottom: 16px;
}
.auth-recent-title {
    margin-bottom: 8px;
    color: var(--text-secondary, rgba(255, 255, 255, .6));
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
}
.auth-recent-list {
    display: grid;
    gap: 6px;
}
.auth-recent-item {
    position: relative;
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) 22px;
    gap: 10px;
    align-items: center;
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border, rgba(255, 255, 255, .12));
    border-radius: 14px;
    background: var(--bg-card, rgba(255, 255, 255, .04));
    color: inherit;
    cursor: pointer;
    text-align: left;
    transition: background .15s ease, border-color .15s ease;
}
.auth-recent-item:hover,
.auth-recent-item:focus-visible {
    border-color: rgba(139, 92, 246, .45);
    background: rgba(139, 92, 246, .1);
}
.auth-recent-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    overflow: hidden;
    background-color: rgba(139, 92, 246, .22);
    background-size: cover;
    background-position: center;
    font-weight: 800;
}
.auth-recent-copy {
    min-width: 0;
    display: grid;
}
.auth-recent-copy b {
    overflow: hidden;
    font-size: .92rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.auth-recent-copy small {
    overflow: hidden;
    color: var(--text-secondary, rgba(255, 255, 255, .55));
    font-size: .78rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.auth-recent-remove {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    color: var(--text-secondary, rgba(255, 255, 255, .5));
    font-size: 1.05rem;
    line-height: 1;
}
.auth-recent-remove:hover,
.auth-recent-remove:focus-visible {
    background: rgba(239, 68, 68, .16);
    color: #fca5a5;
}
.auth-recent-hint {
    margin-top: 8px;
    color: var(--text-muted, rgba(255, 255, 255, .45));
    font-size: .76rem;
    line-height: 1.4;
}

/* ===== DEALIX route: delayed lightweight unavoidable-loading indicator ===== */
.route-native-loader {
    width: 100%;
    min-height: min(240px, 32vh);
    display: grid;
    place-items: center;
    pointer-events: none;
}

.route-native-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 2px solid color-mix(in srgb, var(--text-muted) 24%, transparent);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: dealix-chat-loading-spin .68s linear infinite;
    will-change: transform;
}

@media (prefers-reduced-motion: reduce) {
    .route-native-spinner {
        animation: none;
        will-change: auto;
        border-top-color: var(--primary);
        border-right-color: var(--primary);
    }
}

/* Native first-open chat loading: no black 150ms gap or stale bubbles. */
.chat-loading-skeleton {
    width: min(380px, calc(100% - 36px));
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin: auto;
    padding: 12px 0;
}
.chat-loading-shape {
    display: block;
    width: 74%;
    height: 48px;
    border-radius: 17px 17px 17px 5px;
    background: color-mix(in srgb, var(--bg-tertiary, #272b33) 88%, var(--text-muted, #777) 12%);
    opacity: .68;
}
.chat-loading-shape.is-own {
    width: 63%;
    height: 56px;
    border-radius: 17px 17px 5px 17px;
    background: color-mix(in srgb, var(--bg-tertiary, #272b33) 82%, var(--primary, #76bbcb) 18%);
}
.chat-loading-shape.is-short { width: 53%; height: 36px; }
.chat-loading-only .chat-loading-spinner { opacity: 0; transition: opacity .15s ease; }
.chat-loading-only.show-spinner .chat-loading-spinner { opacity: 1; }
.chat-loading-error { gap: 14px; padding: 28px 14px; text-align: center; }
.chat-loading-error p { margin: 0; color: var(--text-secondary, #b8bfcc); font-size: 14px; }
.chat-loading-retry {
    pointer-events: auto;
    min-height: 42px;
    padding: 9px 18px;
    border-radius: 12px;
    background: var(--bg-tertiary, #30343d);
    color: var(--text-primary, #fff);
    border: 1px solid var(--border-color, rgba(255,255,255,.15));
    font: inherit;
    cursor: pointer;
}
.chat-loading-retry:focus-visible { outline: 2px solid var(--primary, #76bbcb); outline-offset: 3px; }
.chat-loading-retry:disabled { opacity: .5; cursor: default; }

/* Group timeline: known/just-failed media gets a stable accessible tile. */
.group-post-media .group-post-media-error { display: none; }
.group-post-media.load-failed img,
.group-post-media.load-failed video { visibility: hidden; }
.group-post-media.is-video.load-failed > span:not(.group-post-media-error) { display: none; }
.group-post-media.load-failed .group-post-media-error {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 12px;
    text-align: center;
    color: var(--text-secondary, #b8bfcc);
    font-size: 12px;
    font-weight: 600;
    background: color-mix(in srgb, var(--bg-tertiary, #272b33) 90%, transparent);
}
.group-post-media.chat-media-album-unavailable {
    display: grid;
    place-items: center;
    padding: 12px;
    color: var(--text-secondary, #b8bfcc);
    text-align: center;
    font-size: 12px;
}

/* ===== DEALIX chat: lightweight unavoidable-loading indicator ===== */
.chat-loading-only {
    width: 100%;
    min-height: 100%;
    display: grid;
    place-items: center;
    align-content: center;
    pointer-events: none;
}

.chat-loading-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    border: 2px solid color-mix(in srgb, var(--text-muted) 24%, transparent);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: dealix-chat-loading-spin .68s linear infinite;
    will-change: transform;
}

.chat-media-viewer-loading {
    position: fixed;
    inset: 0;
    z-index: 2;
    display: grid;
    place-items: center;
    pointer-events: none;
}

.chat-media-viewer-loading.hidden {
    display: none !important;
}

@keyframes dealix-chat-loading-spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .chat-loading-spinner {
        animation: none;
        will-change: auto;
        border-top-color: var(--primary);
        border-right-color: var(--primary);
    }
}

/* === DEALIX mobile deal action-priority compact pass === */
/* The mobile route shows the next action and counterpart before technical crypto metadata.
   Visual-only: DOM action bindings, deal state and API flow stay unchanged. */
@media (max-width: 900px) {
    .deals-page .deal-details-card {
        display: flex !important;
        flex-direction: column !important;
    }

    .deals-page .deal-details-card > * {
        order: 10 !important;
        min-width: 0;
    }

    .deals-page .deal-header {
        order: 1 !important;
    }

    .deals-page .deal-timeline {
        order: 2 !important;
    }

    .deals-page .deal-actions-section {
        order: 3 !important;
    }

    .deals-page .deal-info-grid {
        display: contents !important;
    }

    .deals-page .deal-info-grid > .deal-info-section:last-child {
        order: 4 !important;
    }

    .deals-page .deal-contract-panel {
        order: 5 !important;
    }

    .deals-page .deal-crypto-panel {
        order: 6 !important;
    }

    .deals-page .deal-info-grid > .deal-info-section:first-child {
        order: 7 !important;
    }
}

@media (max-width: 560px) {
    .deals-page .deal-header {
        grid-template-columns: minmax(0, 1fr) minmax(0, .9fr);
        gap: 10px !important;
        margin-bottom: 0 !important;
        padding: 0 0 10px !important;
    }

    .deals-page .deal-timeline {
        margin: 10px 0 0 !important;
    }

    .deals-page .deal-crypto-panel > .deal-timeline {
        margin: 14px 0 0 !important;
    }

    .deals-page .deal-actions-section {
        margin-top: 10px !important;
        padding: 12px !important;
    }

    .deals-page .deal-contract-panel {
        margin-top: 10px !important;
    }

    .deals-page .deal-crypto-panel {
        margin-top: 10px !important;
    }

    .deals-page .deal-title {
        margin-bottom: 9px !important;
        font-size: clamp(1.28rem, 7vw, 1.55rem) !important;
    }

    .deals-page .deal-subtitle {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        gap: 6px !important;
        padding: 0 0 2px !important;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-inline: contain;
    }

    .deals-page .deal-subtitle::-webkit-scrollbar {
        display: none;
    }

    .deals-page .deal-subtitle > * {
        flex: 0 0 auto;
    }

    .deals-page .deal-subtitle span,
    .deals-page .deal-subtitle .deal-type,
    .deals-page .deal-subtitle .deal-role,
    .deals-page .deal-subtitle .deal-id {
        padding: 6px 9px !important;
        font-size: 0.72rem !important;
    }

    .deals-page .deal-header-right {
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-end !important;
        gap: 8px 10px !important;
        min-width: 0 !important;
        max-width: 100%;
        width: auto !important;
        padding: 9px 10px !important;
        border-radius: 16px !important;
    }

    .deals-page .deal-amount {
        min-width: 0;
        margin: 0 !important;
        font-size: 1.16rem !important;
        line-height: 1.2 !important;
        text-align: end !important;
        overflow-wrap: anywhere;
        font-variant-numeric: tabular-nums;
    }

    .deals-page .deal-status {
        flex: 0 0 auto;
        max-width: 100%;
        white-space: normal;
        text-align: end;
        padding: 6px 9px !important;
        font-size: 0.72rem !important;
    }

    .deals-page .deal-actions-section .deal-section-title {
        grid-template-columns: 32px minmax(0, 1fr) !important;
        gap: 8px !important;
        margin-bottom: 10px !important;
    }

    .deals-page .deal-actions-section .deal-section-title-icon {
        width: 32px !important;
        height: 32px !important;
        min-width: 32px !important;
        border-radius: 12px !important;
    }

    .deals-page .deal-actions-section .deal-section-svg {
        width: 18px !important;
        height: 18px !important;
    }

    .deals-page .deal-actions {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 8px !important;
        align-items: stretch !important;
    }

    .deals-page .deal-actions > .btn,
    .deals-page .deal-actions > .deal-action-chat {
        width: 100% !important;
        min-width: 0 !important;
        min-height: 46px !important;
        padding: 10px 9px !important;
        border-radius: 14px !important;
        font-size: 0.82rem !important;
        line-height: 1.15 !important;
        white-space: normal !important;
        flex: none !important;
    }

    .deals-page .deal-actions > :last-child:nth-child(odd) {
        grid-column: 1 / -1 !important;
    }
}

@media (max-width: 340px) {
    .deals-page .deal-header-right {
        padding: 8px 9px !important;
    }

    .deals-page .deal-amount {
        font-size: 1.08rem !important;
    }

    .deals-page .deal-actions > .btn,
    .deals-page .deal-actions > .deal-action-chat {
        min-height: 44px !important;
        padding-inline: 7px !important;
        font-size: 0.78rem !important;
    }
}

/* === DEALIX P2P simplified task shell — UI only === */
.p2p-simple-shell {
    width: min(100%, 820px);
    margin: 0 auto;
    padding: 8px 14px max(110px, calc(var(--mobile-bottom-nav-h, 76px) + env(safe-area-inset-bottom, 0px) + 28px));
    color: var(--text);
}

.p2p-simple-shell [hidden] { display: none !important; }

.p2p-home-view,
.p2p-market-view,
.p2p-create-view {
    min-width: 0;
}

.p2p-home-hero {
    display: grid;
    justify-items: center;
    text-align: center;
    gap: 10px;
    padding: 28px 14px 18px;
}

.p2p-home-logo {
    width: 76px;
    height: 76px;
    display: grid;
    place-items: center;
    border-radius: 26px;
    color: #fff;
    background: linear-gradient(145deg, #7c3aed 0%, #3b82f6 52%, #22d3ee 100%);
    box-shadow: 0 18px 48px rgba(59, 130, 246, .24), inset 0 1px 0 rgba(255,255,255,.25);
}

.p2p-home-logo svg { width: 40px; height: 40px; }
.p2p-home-hero h1 { margin: 0; font-size: clamp(28px, 7vw, 36px); letter-spacing: -.04em; }
.p2p-home-hero p { margin: 0; max-width: 520px; color: var(--muted); line-height: 1.45; font-size: 15px; }

.p2p-home-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 8px 0 22px;
}

.p2p-primary-action {
    min-height: 58px;
    border: 0;
    border-radius: 18px;
    font: inherit;
    font-weight: 900;
    font-size: 17px;
    color: #fff;
    cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 14px 34px rgba(37,99,235,.18);
}
.p2p-primary-action.buy { background: linear-gradient(135deg, #1d9bf0, #3b82f6); }
.p2p-primary-action.sell { background: linear-gradient(135deg, #4f46e5, #7c3aed); }
.p2p-primary-action:active { transform: translateY(1px); }

.p2p-profile-entry {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    min-height: 70px;
    padding: 12px 14px;
    border: 1px solid rgba(148,163,184,.16);
    border-radius: 18px;
    color: inherit;
    text-decoration: none;
    background: rgba(15,23,42,.34);
}
.p2p-profile-entry-icon {
    width: 42px; height: 42px; border-radius: 15px; display: grid; place-items: center;
    font-weight: 900; color: #fff; background: linear-gradient(135deg, #2563eb, #7c3aed);
}
.p2p-profile-entry b { display: block; font-size: 15px; }
.p2p-profile-entry small { display: block; margin-top: 2px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p2p-profile-entry-chevron { color: var(--muted); font-size: 28px; }

.p2p-home-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 20px;
    border-bottom: 1px solid rgba(148,163,184,.16);
}
.p2p-home-tabs button {
    min-height: 52px;
    border: 0;
    border-bottom: 3px solid transparent;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-weight: 850;
    cursor: pointer;
}
.p2p-home-tabs button.active { color: #38bdf8; border-bottom-color: #38bdf8; }
/* Light theme (2026-10-11): same sky hue, dark enough to read on the pale page. */
body.theme-light .p2p-home-tabs button.active { color: #0369a1; border-bottom-color: #0369a1; }

.p2p-home-section { padding-top: 14px; }
.p2p-home-toolbar { display: flex; gap: 10px; margin-bottom: 12px; }
.p2p-home-toolbar .p2p-small-select { min-height: 42px; border-radius: 14px; }
.p2p-create-entry {
    width: 100%; min-height: 54px; margin-bottom: 14px; border: 0; border-radius: 16px;
    color: #fff; font: inherit; font-weight: 900; background: linear-gradient(135deg, #0ea5e9, #3b82f6); cursor: pointer;
}

.p2p-back-btn {
    width: 40px; height: 40px; display: grid; place-items: center; border-radius: 14px;
    border: 1px solid rgba(148,163,184,.15); background: rgba(15,23,42,.35); color: var(--text); font-size: 28px; cursor: pointer;
}

.p2p-market-segment {
    display: grid; grid-template-columns: repeat(2, minmax(0,1fr));
    gap: 4px; padding: 4px; margin-bottom: 14px; border-radius: 16px; background: rgba(148,163,184,.10);
}
.p2p-market-segment button {
    min-height: 44px; border: 0; border-radius: 13px; background: transparent; color: var(--muted); font: inherit; font-weight: 900; cursor: pointer;
}
.p2p-market-segment button.active { color: #fff; background: linear-gradient(135deg, #4f46e5, #3b82f6); box-shadow: 0 8px 22px rgba(59,130,246,.18); }

.p2p-market-pair {
    display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; margin-bottom: 10px;
}
.p2p-market-pair label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; font-weight: 750; }
.p2p-market-pair select,
.p2p-create-form input,
.p2p-create-form select,
.p2p-create-form textarea,
.p2p-trade-field input,
.p2p-trade-field textarea {
    width: 100%; min-width: 0; min-height: 46px; box-sizing: border-box; border-radius: 14px;
    border: 1px solid rgba(148,163,184,.16); color: var(--text); background: rgba(15,23,42,.38); font: inherit;
}

.p2p-market-toolbar-simple { display: grid; grid-template-columns: auto minmax(0,1fr) 44px; gap: 8px; margin-bottom: 10px; }
.p2p-filter-toggle, .p2p-icon-refresh {
    min-height: 44px; border: 1px solid rgba(148,163,184,.16); border-radius: 14px; color: var(--text); background: rgba(15,23,42,.34); font: inherit; font-weight: 800; cursor: pointer;
}
.p2p-offers-list { display: grid; gap: 0 !important; }
.p2p-market-row {
    display: grid;
    grid-template-columns: minmax(0,1fr) auto;
    grid-template-areas: "maker price" "facts price";
    gap: 10px 16px;
    padding: 16px 2px;
    border-bottom: 1px solid rgba(148,163,184,.14);
}
.p2p-market-maker { grid-area: maker; display: flex; align-items: center; gap: 10px; min-width: 0; }
.p2p-market-avatar { width: 40px; height: 40px; flex: 0 0 40px; display: grid; place-items: center; border-radius: 50%; color: #fff; font-weight: 900; background: linear-gradient(135deg,#38bdf8,#7c3aed); }
.p2p-market-maker-copy { min-width: 0; }
.p2p-market-maker-copy b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; }
.p2p-market-maker-copy small { display: block; margin-top: 2px; color: #38bdf8; font-weight: 750; }
.p2p-market-facts { grid-area: facts; display: grid; gap: 4px; }
.p2p-market-facts span { display: grid; grid-template-columns: 100px minmax(0,1fr); gap: 8px; font-size: 13px; }
.p2p-market-facts em { color: var(--muted); font-style: normal; }
.p2p-market-facts b { font-weight: 750; overflow-wrap: anywhere; }
.p2p-market-price { grid-area: price; display: grid; justify-items: end; align-content: start; gap: 2px; min-width: 116px; }
.p2p-market-price strong { font-size: 19px; white-space: nowrap; }
.p2p-share-offer { min-height: 44px; max-width: 100%; padding: 7px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-hover); color: var(--text-secondary); font: 500 12px/1.3 var(--font-sans); cursor: pointer; }
.p2p-share-offer:hover { color: var(--primary-text); background: var(--primary-light); }
.p2p-share-offer:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.p2p-market-price small { color: var(--muted); font-size: 11px; }
.p2p-market-cta { margin-top: 10px; min-width: 96px; min-height: 40px; border: 0; border-radius: 13px; color:#fff; background:#38a9e8; font:inherit; font-weight:900; cursor:pointer; }
.p2p-market-cta:disabled { opacity:.45; cursor:default; }

.p2p-trade-panel {
    border: 1px solid rgba(148,163,184,.16); border-radius: 20px; padding: 16px; background: rgba(15,23,42,.40); box-shadow: 0 18px 54px rgba(2,6,23,.18);
}
.p2p-trade-summary { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; margin-bottom:14px; }
.p2p-trade-summary span { padding:10px; border-radius:14px; background:rgba(148,163,184,.07); }
.p2p-trade-summary em,.p2p-trade-summary b { display:block; }
.p2p-trade-summary em { color:var(--muted); font-style:normal; font-size:11px; }
.p2p-trade-summary b { margin-top:3px; font-size:13px; }
.p2p-trade-field { display:grid; gap:6px; margin-top:12px; color:var(--muted); font-size:12px; font-weight:800; }
.p2p-trade-field > div { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; border:1px solid rgba(148,163,184,.16); border-radius:14px; overflow:hidden; background:rgba(15,23,42,.38); }
.p2p-trade-field > div input { border:0; background:transparent; }
.p2p-trade-field > div b { padding:0 12px; color:var(--text); }
.p2p-trade-terms { margin-top:12px; padding:10px 12px; border-radius:12px; background:rgba(245,158,11,.08); color:var(--muted); font-size:12px; }
.p2p-trade-submit { width:100%; min-height:52px; margin-top:14px; border-radius:15px !important; }

.p2p-create-view { max-width: 660px; margin:0 auto; }
.p2p-create-form { padding: 16px; border:1px solid rgba(148,163,184,.16); border-radius:20px; background:rgba(15,23,42,.34); }

.p2p-native-loader { min-height: 120px; display:grid; place-items:center; }
.p2p-native-loader > span { width:24px; height:24px; border-radius:50%; border:2px solid rgba(148,163,184,.24); border-top-color:#60a5fa; animation:p2pSimpleSpin .65s linear infinite; }
@keyframes p2pSimpleSpin { to { transform:rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .p2p-native-loader > span { animation:none; border-top-color:rgba(148,163,184,.55); } }

body.theme-light .p2p-profile-entry,
body.theme-light .p2p-back-btn,
body.theme-light .p2p-filter-toggle,
body.theme-light .p2p-icon-refresh,
body.theme-light .p2p-trade-panel,
body.theme-light .p2p-create-form,
body.theme-light .p2p-market-pair select,
body.theme-light .p2p-create-form input,
body.theme-light .p2p-create-form select,
body.theme-light .p2p-create-form textarea,
body.theme-light .p2p-trade-field input,
body.theme-light .p2p-trade-field textarea { background:#fff; color:#0f172a; border-color:rgba(15,23,42,.11); }

@media (max-width: 620px) {
    .p2p-simple-shell { padding-left: 10px; padding-right: 10px; }
    .p2p-home-hero { padding-top: 18px; }
    .p2p-home-logo { width:68px; height:68px; border-radius:23px; }
    .p2p-home-actions { gap:10px; }
    .p2p-primary-action { min-height:56px; font-size:16px; }
    .p2p-market-row { grid-template-columns:minmax(0,1fr) 110px; gap:8px 10px; }
    .p2p-market-facts span { grid-template-columns:86px minmax(0,1fr); font-size:12px; }
    .p2p-market-price { min-width:100px; }
    .p2p-market-price strong { font-size:17px; }
    .p2p-market-cta { min-width:88px; }
    .p2p-trade-summary { grid-template-columns:1fr; }
}

@media (max-width: 360px) {
    .p2p-simple-shell { padding-left: 8px; padding-right: 8px; }
    .p2p-home-hero p { font-size:13px; }
    .p2p-primary-action { min-height:52px; }
    .p2p-market-pair { gap:6px; }
    .p2p-market-row { grid-template-columns:minmax(0,1fr) 96px; }
    .p2p-market-facts span { grid-template-columns:76px minmax(0,1fr); }
    .p2p-market-price strong { font-size:15px; }
    .p2p-market-cta { min-width:82px; min-height:38px; font-size:13px; }
}

/* P2P order list/detail navigation: presentation only, existing action hooks stay intact. */
.p2p-simple-shell .p2p-orders-list-mode .p2p-orders-rail { width:100%; max-width:none; display:grid; gap:10px; padding:0; overflow:visible; }
.p2p-simple-shell .p2p-orders-list-mode .p2p-order-summary { width:100%; min-height:76px; border-radius:16px; }
.p2p-simple-shell .p2p-order-detail-screen { display:grid; gap:10px; }
.p2p-simple-shell .p2p-order-detail-head { margin-bottom:0; }
.p2p-simple-shell .p2p-order-detail-pane { width:100%; min-width:0; }
.p2p-simple-shell .p2p-order-detail-pane .p2p-order-card { border-radius:18px; }
@media (max-width:620px) {
  .p2p-simple-shell .p2p-order-detail-pane .p2p-order-layout { grid-template-columns:1fr; }
  .p2p-simple-shell .p2p-order-detail-pane .p2p-order-side { align-items:stretch; }
}

/* === DEALIX P2P flow fidelity v2 — standalone task screens, UI only === */
.p2p-simple-shell {
    width: min(100%, 720px);
    padding-top: 4px;
}

.p2p-flow-screen {
    width: 100%;
    min-width: 0;
}

.p2p-flow-topbar {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 42px;
    align-items: center;
    min-height: 56px;
    margin: 0 0 12px;
}

.p2p-flow-topbar h2 {
    margin: 0;
    min-width: 0;
    text-align: center;
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -.025em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.p2p-flow-topbar .p2p-back-btn {
    width: 38px;
    height: 38px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
}

.p2p-flow-topbar .p2p-back-btn:hover {
    background: rgba(148, 163, 184, .09);
}

.p2p-flow-topbar .p2p-back-btn svg {
    width: 22px;
    height: 22px;
}

.p2p-topbar-spacer {
    width: 38px;
    height: 38px;
}

.p2p-home-hero {
    gap: 8px;
    padding: 22px 14px 16px;
}

.p2p-home-logo {
    width: 68px;
    height: 68px;
    border-radius: 23px;
}

.p2p-home-logo svg {
    width: 36px;
    height: 36px;
}

.p2p-home-hero h1 {
    font-size: clamp(27px, 6vw, 33px);
    color: var(--text);
    background: none;
    -webkit-background-clip: initial;
    background-clip: initial;
}

.p2p-home-hero p {
    max-width: 420px;
    margin: 0;
    font-size: 14px;
    color: var(--text-muted);
}

.p2p-home-actions {
    margin: 8px 0 18px;
}

.p2p-primary-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 54px;
    border-radius: 15px;
    font-size: 16px;
}

.p2p-primary-action svg {
    width: 21px;
    height: 21px;
    flex: 0 0 21px;
}

.p2p-profile-entry {
    min-height: 62px;
    padding: 10px 12px;
    border-radius: 15px;
}

.p2p-profile-entry-icon {
    width: 38px;
    height: 38px;
    border-radius: 13px;
}

.p2p-profile-entry-chevron {
    width: 20px;
    height: 20px;
    display: grid;
    place-items: center;
    font-size: 0;
}

.p2p-profile-entry-chevron svg {
    width: 18px;
    height: 18px;
}

.p2p-home-tabs {
    margin-top: 15px;
}

.p2p-home-tabs button {
    min-height: 48px;
    font-size: 14px;
}

.p2p-home-section {
    padding-top: 12px;
}

.p2p-market-view,
.p2p-filters-view,
.p2p-trade-view,
.p2p-create-view,
.p2p-order-view {
    max-width: 620px;
    margin: 0 auto;
}

/* Detail needs room for payment data and actions beside the order summary. */
.p2p-order-view {
    max-width: 760px;
}

.p2p-market-segment,
.p2p-create-side-segment {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 3px;
    padding: 3px;
    border-radius: 14px;
    background: rgba(148, 163, 184, .09);
}

.p2p-market-segment {
    margin-bottom: 13px;
}

.p2p-create-side-segment {
    position: relative;
    margin-bottom: 16px;
}

.p2p-market-segment button,
.p2p-create-side-segment button {
    min-height: 42px;
    border: 0;
    border-radius: 11px;
    color: var(--text-muted);
    background: transparent;
    font: inherit;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
}

.p2p-market-segment button.active,
.p2p-create-side-segment button.active {
    color: #fff;
    background: linear-gradient(135deg, #5b4df7 0%, #3478f6 100%);
    box-shadow: 0 5px 16px rgba(59, 130, 246, .18);
}

.p2p-create-side-native {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    min-height: 1px !important;
    opacity: 0 !important;
    pointer-events: none !important;
    clip: rect(0 0 0 0) !important;
    clip-path: inset(50%) !important;
}

.p2p-market-pair {
    gap: 8px;
    margin-bottom: 9px;
}

.p2p-market-pair label {
    gap: 4px;
    font-size: 11px;
    font-weight: 650;
}

.p2p-market-pair select {
    min-height: 44px;
    border-radius: 13px;
}

.p2p-market-toolbar-simple {
    grid-template-columns: minmax(100px, auto) minmax(0, 1fr) 42px;
    gap: 7px;
    margin-bottom: 8px;
}

.p2p-sort-trigger {
    min-width: 0;
}

.p2p-icon-refresh {
    display: inline-grid;
    place-items: center;
    padding: 0;
}

.p2p-icon-refresh svg {
    width: 18px;
    height: 18px;
}

.p2p-filters-topbar {
    grid-template-columns: 42px minmax(0, 1fr) auto;
}

.p2p-filter-reset {
    min-width: 0;
    min-height: 38px;
    padding: 0 4px 0 10px;
    border: 0;
    color: #38a9ff;
    background: transparent;
    font: inherit;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}

.p2p-filter-form {
    display: grid;
    gap: 14px;
    padding-top: 3px;
}

.p2p-filter-form label {
    display: grid;
    gap: 7px;
    min-width: 0;
}

.p2p-filter-form label > span {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 750;
}

.p2p-filter-form select,
.p2p-filter-form input {
    width: 100%;
    min-width: 0;
    min-height: 50px;
    padding: 0 13px;
    border: 1px solid rgba(148, 163, 184, .14);
    border-radius: 14px;
    color: var(--text);
    background: rgba(30, 41, 59, .38);
    font: inherit;
    font-size: 14px;
    outline: none;
}

.p2p-filter-form select:focus,
.p2p-filter-form input:focus {
    border-color: rgba(96, 102, 255, .54);
    box-shadow: 0 0 0 3px rgba(91, 77, 247, .10);
}

.p2p-filter-apply {
    width: 100%;
    min-height: 54px;
    margin-top: 3px;
    border-radius: 15px !important;
    font-weight: 850;
}

.p2p-filter-toggle,
.p2p-icon-refresh {
    min-height: 42px;
    border-radius: 13px;
    font-size: 13px;
}

.p2p-market-row {
    gap: 8px 13px;
    padding: 14px 1px;
}

.p2p-market-avatar {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
    font-size: 14px;
}

.p2p-market-maker-copy b {
    font-size: 15px;
}

.p2p-market-maker-copy small {
    font-size: 11px;
}

.p2p-market-facts {
    gap: 3px;
}

.p2p-market-facts span {
    grid-template-columns: 92px minmax(0, 1fr);
    font-size: 12px;
    line-height: 1.35;
}

.p2p-market-price {
    min-width: 108px;
}

.p2p-market-price strong {
    font-size: 18px;
}

.p2p-market-cta {
    min-width: 92px;
    min-height: 38px;
    margin-top: 8px;
    border-radius: 12px;
    font-size: 13px;
}

.p2p-trade-view,
.p2p-order-view {
    padding-bottom: 8px;
}

.p2p-trade-panel {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.p2p-trade-party {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    padding: 12px;
    border: 1px solid rgba(148, 163, 184, .13);
    border-radius: 16px;
    background: rgba(30, 41, 59, .42);
}

.p2p-trade-party-copy {
    min-width: 0;
}

.p2p-trade-party-copy b,
.p2p-trade-party-copy small {
    display: block;
}

.p2p-trade-party-copy b {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 15px;
}

.p2p-trade-party-copy small {
    margin-top: 2px;
    color: #38bdf8;
    font-size: 11px;
    font-weight: 750;
}

.p2p-trade-party-price {
    display: grid;
    justify-items: end;
}

.p2p-trade-party-price strong {
    font-size: 17px;
    white-space: nowrap;
}

.p2p-trade-party-price small {
    color: var(--text-muted);
    font-size: 10px;
}

.p2p-trade-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    margin-bottom: 12px;
}

.p2p-trade-summary span {
    padding: 9px 10px;
    border: 1px solid rgba(148, 163, 184, .10);
    border-radius: 13px;
    background: rgba(30, 41, 59, .32);
}

.p2p-trade-field {
    margin-top: 10px;
    gap: 5px;
    font-size: 11px;
    font-weight: 700;
}

.p2p-trade-field > div {
    min-height: 50px;
    border-radius: 14px;
}

.p2p-trade-field > div input {
    min-height: 48px;
    padding: 0 12px;
    font-size: 16px;
}

.p2p-trade-conversion,
.p2p-trade-method {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-height: 48px;
    margin-top: 8px;
    padding: 0 12px;
    border: 1px solid rgba(148, 163, 184, .11);
    border-radius: 14px;
    background: rgba(30, 41, 59, .30);
}

.p2p-trade-conversion span,
.p2p-trade-method span {
    color: var(--text-muted);
    font-size: 12px;
}

.p2p-trade-conversion strong,
.p2p-trade-method b {
    min-width: 0;
    text-align: right;
    font-size: 13px;
}

.p2p-trade-terms {
    border: 1px solid rgba(245, 158, 11, .12);
    border-radius: 13px;
}

.p2p-trade-submit {
    min-height: 54px;
    margin-top: 13px;
    border-radius: 15px !important;
    font-weight: 850;
}

.p2p-create-form {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.p2p-create-form > label,
.p2p-create-form .p2p-form-row > label {
    display: grid;
    gap: 5px;
    margin-bottom: 10px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
}

.p2p-create-form .p2p-form-row {
    gap: 8px;
}

.p2p-create-form input,
.p2p-create-form select,
.p2p-create-form textarea {
    min-height: 46px;
    border-radius: 13px;
    padding-inline: 12px;
}

.p2p-create-form textarea {
    min-height: 84px;
    padding-top: 11px;
    padding-bottom: 11px;
    resize: vertical;
}

.p2p-create-form .p2p-submit {
    width: 100%;
    min-height: 54px;
    margin-top: 6px;
    border-radius: 15px;
}

.p2p-order-detail-host {
    min-width: 0;
}

.p2p-order-view .p2p-order-card {
    border-radius: 16px;
}

.p2p-order-view .p2p-order-layout {
    gap: 10px;
}

body.theme-light .p2p-trade-party,
body.theme-light .p2p-trade-summary span,
body.theme-light .p2p-trade-conversion,
body.theme-light .p2p-trade-method,
body.theme-light .p2p-filter-form select,
body.theme-light .p2p-filter-form input {
    background: #fff;
    border-color: rgba(15, 23, 42, .09);
}

@media (max-width: 620px) {
    .p2p-simple-shell {
        width: 100%;
        padding: 2px 12px max(98px, calc(var(--mobile-bottom-nav-h, 76px) + env(safe-area-inset-bottom, 0px) + 20px));
    }

    .p2p-flow-topbar {
        min-height: 50px;
        margin-bottom: 8px;
    }

    .p2p-flow-topbar h2 {
        font-size: 16px;
    }

    .p2p-home-hero {
        padding-top: 14px;
        padding-bottom: 13px;
    }

    .p2p-home-logo {
        width: 62px;
        height: 62px;
        border-radius: 21px;
    }

    .p2p-home-logo svg {
        width: 32px;
        height: 32px;
    }

    .p2p-home-hero h1 {
        font-size: 27px;
    }

    .p2p-home-hero p {
        max-width: 330px;
        font-size: 13px;
        line-height: 1.42;
    }

    .p2p-home-actions {
        gap: 9px;
        margin-bottom: 15px;
    }

    .p2p-primary-action {
        min-height: 52px;
        border-radius: 14px;
        font-size: 15px;
    }

    .p2p-market-pair {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .p2p-market-toolbar-simple {
        grid-template-columns: auto minmax(0, 1fr) 40px;
    }

    .p2p-market-row {
        grid-template-columns: minmax(0, 1fr) 104px;
        gap: 7px 9px;
        padding: 13px 0;
    }

    .p2p-market-facts span {
        grid-template-columns: 78px minmax(0, 1fr);
        font-size: 11.5px;
    }

    .p2p-market-price {
        min-width: 96px;
    }

    .p2p-market-price strong {
        font-size: 16px;
    }

    .p2p-market-cta {
        min-width: 84px;
        min-height: 37px;
    }

    .p2p-trade-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .p2p-create-form .p2p-form-row {
        grid-template-columns: 1fr;
    }

    .p2p-order-view .p2p-order-layout {
        grid-template-columns: 1fr;
    }

    .p2p-order-view .p2p-order-side {
        align-items: stretch;
    }
}

@media (max-width: 360px) {
    .p2p-simple-shell {
        padding-inline: 9px;
    }

    .p2p-market-pair {
        gap: 6px;
    }

    .p2p-market-row {
        grid-template-columns: minmax(0, 1fr) 92px;
    }

    .p2p-market-facts span {
        grid-template-columns: 72px minmax(0, 1fr);
        font-size: 11px;
    }

    .p2p-market-price strong {
        font-size: 15px;
    }

    .p2p-trade-summary {
        grid-template-columns: 1fr;
    }
}


/* === DEALIX unified global header/search ===
   Replaces the old desktop/mobile split. A small number of !important rules
   are intentional here because historical Stage 24 header blocks use
   !important themselves; this layer is the canonical header contract. */
:root {
    --header-user-pill-mobile-max: 118px;
}

.header {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: center !important;
    gap: 12px !important;
    min-height: 64px !important;
    position: sticky !important;
    top: 0;
    z-index: 1200 !important;
    height: auto !important;
    padding: 8px 16px !important;
    overflow: visible !important;
}

/* Desktop route access and account controls are independent of the search row.
   The existing shell menu row reserves its space, including chat/forum viewports. */
.desktop-shell-nav { display: none; }
.desktop-header-actions { display: contents; }
@media (min-width: 769px) {
    .app:has(> .desktop-shell-nav:not([hidden])) { --app-menu-bar-h: max(48px, 3rem); }
    .desktop-shell-nav:not([hidden]) {
        grid-area: menu; display: flex; align-items: center; gap: 12px;
        position: fixed; top: 0; inset-inline: 0; z-index: 1201;
        height: var(--app-menu-bar-h); min-width: 0; padding: 4px 16px;
        background: var(--bg-secondary); border-bottom: 1px solid var(--border);
    }
    .desktop-shell-menu, .desktop-shell-links > a, .desktop-header-toggle {
        display: inline-flex; align-items: center; justify-content: center; gap: 8px;
        min-height: 40px; padding: 8px 14px; border: 1px solid transparent;
        border-radius: 10px; color: var(--text-secondary); background: transparent;
        font: inherit; font-size: .88rem; font-weight: 600; line-height: 1.2;
        text-decoration: none; white-space: nowrap; cursor: pointer;
    }
    .desktop-shell-nav .desktop-shell-menu, .desktop-header-toggle { flex: 0 0 auto; color: var(--text); }
    .desktop-shell-menu svg, .desktop-header-toggle svg { flex-shrink: 0; }
    .desktop-shell-links { display: flex; gap: 4px; flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: thin; }
    .desktop-shell-menu:hover, .desktop-shell-links > a:hover, .desktop-header-toggle:hover { background: var(--bg-hover); color: var(--text); }
    .desktop-shell-menu.active, .desktop-shell-links > a.active, .desktop-header-toggle[aria-expanded="true"] { background: var(--primary-light); color: var(--primary-text, var(--primary)); }
    .desktop-shell-nav :is(a, button):focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
}
@media (min-width: 769px) and (hover: hover) and (pointer: fine) {
    .app:has(> .desktop-shell-nav:not([hidden])) { --app-menu-bar-h: max(56px, 3.5rem); }
    .desktop-header-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; min-width: 0; }
    .desktop-header-toggle > span { display: none; }
    /* Package 174: the search button and the bell are one pair — 44px, a
       24px glyph, the text colour. */
    .desktop-header-toggle > svg { width: 24px; height: 24px; }
    .desktop-header-toggle,
    #notification-bell-btn {
        width: 44px; height: 44px; padding: 0; border-radius: 14px;
        color: var(--text); transition: background .16s ease, color .16s ease;
    }
    #notification-bell-btn:hover,
    #notification-bell-btn[aria-expanded="true"] { background: var(--bg-hover); color: var(--text); }
    #notification-bell-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
    /* The global header has legacy important grid rules; scope this override
       to the desktop dock only. The mobile header keeps its existing columns. */
    .app:has(> .desktop-shell-nav:not([hidden])) > .header {
        grid-template-columns: minmax(0, 1fr) !important; gap: 0 !important;
    }
    #desktop-shell-nav #user-dropdown {
        max-height: calc(100dvh - var(--app-menu-bar-h) - 20px);
    }
    html body #desktop-shell-nav #notification-dropdown.notification-dropdown {
        max-height: min(650px, calc(100dvh - var(--app-menu-bar-h) - 20px));
    }
}
@media (min-width: 769px) and (hover: hover) and (pointer: fine) and (prefers-reduced-motion: reduce) {
    .desktop-header-toggle { transition: none; }
}

/* No floating tab. The desktop dock has explicit search; Tab exposes this skip action. */
.header-access-btn {
    position: fixed;
    inset-block-start: max(8px, env(safe-area-inset-top));
    inset-inline-start: 12px;
    z-index: 1201;
    min-height: 44px;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    background: var(--bg-card);
    font: inherit;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transform: translateY(calc(-100% - 24px));
}
.header-access-btn[hidden] { display: none; }
.header-access-btn:focus-visible {
    opacity: 1;
    pointer-events: auto;
    transform: none;
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
.header-dismiss-btn {
    display: none;
    position: absolute;
    inset-inline-start: 0;
    inset-block-start: 0;
    width: 40px;
    height: 100%;
    min-height: 36px;
    padding: 0;
    border: 0;
    border-radius: var(--radius);
    background: transparent;
    color: var(--text);
    cursor: pointer;
    z-index: 1;
    align-items: center;
    justify-content: center;
}
.app.header-compact-mode .header-dismiss-btn { display: flex; }
.app.header-compact-mode .header-search-icon { visibility: hidden; }
.app.header-compact-mode #header-search-input { padding-inline-start: 40px !important; }
.header-dismiss-btn:hover { background: var(--bg-hover); }
.header-dismiss-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: -3px; }
@media (prefers-reduced-motion: reduce) {
    .app.header-compact-mode .header { transition: none; }
}

.header-right {
    display: flex !important;
    align-items: center !important;
    min-width: 0 !important;
}

.header-right {
    gap: 10px !important;
    flex: 0 0 auto !important;
    justify-content: flex-end !important;
}

.header > .header-center {
    display: none !important;
}

.header-search {
    display: block !important;
    position: relative !important;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    order: initial !important;
    flex: 1 1 auto !important;
    background: transparent !important;
    border: 0 !important;
    z-index: 140 !important;
}

.header-search .search-container {
    position: relative;
    width: 100% !important;
    min-width: 0 !important;
}

.header-search-icon {
    position: absolute;
    inset-inline-start: 14px;
    top: 50%;
    width: 20px;
    height: 20px;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    z-index: 2;
}

.header-search-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

#header-search-input {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    height: 44px !important;
    min-height: 44px !important;
    padding: 0 44px 0 44px !important;
    border-radius: 20px !important;
    border: 1px solid rgba(148, 163, 184, .18) !important;
    background: rgba(15, 23, 42, .34) !important;
    color: var(--text) !important;
    font-size: .9rem !important;
    line-height: 1 !important;
    outline: none !important;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.035) !important;
    transition: border-color .16s ease, background .16s ease, box-shadow .16s ease !important;
    appearance: none;
    -webkit-appearance: none;
}

#header-search-input::-webkit-search-cancel-button {
    cursor: pointer;
    opacity: .68;
}

#header-search-input:focus {
    border-color: rgba(139, 92, 246, .52) !important;
    background: rgba(15, 23, 42, .58) !important;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, .10), inset 0 1px 0 rgba(255,255,255,.045) !important;
}

#header-search-input::placeholder {
    color: var(--text-muted) !important;
    font-size: .86rem !important;
    opacity: .92 !important;
}

.header .search-results-dropdown {
    position: absolute !important;
    top: calc(100% + 8px) !important;
    inset-inline: 0 !important;
    width: 100% !important;
    max-width: none !important;
    max-height: min(68vh, 620px, calc(100dvh - var(--app-menu-bar-h, 0px) - 80px)) !important;
    padding: 8px !important;
    border-radius: 18px !important;
    border: 1px solid rgba(148, 163, 184, .18) !important;
    background: rgba(15, 23, 42, .96) !important;
    box-shadow: 0 22px 64px rgba(2, 6, 23, .34) !important;
    backdrop-filter: blur(22px) saturate(1.15) !important;
    -webkit-backdrop-filter: blur(22px) saturate(1.15) !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
}

.global-search-group + .global-search-group {
    margin-top: 7px;
    padding-top: 7px;
    border-top: 1px solid rgba(148, 163, 184, .10);
}

.global-search-group-title {
    padding: 6px 9px 7px;
    color: var(--text-muted);
    font-size: .68rem;
    font-weight: 850;
    letter-spacing: .055em;
    text-transform: uppercase;
}

.global-search-group-list {
    display: grid;
    gap: 2px;
}

.global-search-result {
    width: 100%;
    min-width: 0;
    min-height: 54px;
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 7px 9px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--text);
    text-align: start;
    cursor: pointer;
    font: inherit;
    transition: background .14s ease, transform .14s ease;
}

.global-search-result:hover,
.global-search-result:focus-visible,
.global-search-result.active {
    background: var(--primary-light);
}

.global-search-result:active {
    transform: scale(.994);
}

.global-search-result:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}

.global-search-avatar {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, .16);
    border-radius: 12px;
    background: linear-gradient(145deg, rgba(99, 102, 241, .22), rgba(14, 165, 233, .12));
    color: #e2e8f0;
    font-size: .75rem;
    font-weight: 850;
}

.global-search-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.global-search-result--listing { grid-template-columns: 48px minmax(0, 1fr) auto; min-height: 64px; }
.global-search-result--listing .global-search-avatar { width: 48px; height: 48px; border-radius: 10px; }
.global-search-result-copy {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.global-search-result-title,
.global-search-result-meta {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.global-search-result-title {
    color: var(--text);
    font-size: .87rem;
    font-weight: 790;
}

.global-search-result-meta {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    white-space: normal;
    overflow-wrap: anywhere;
    color: var(--text-muted);
    font-size: .72rem;
    font-weight: 560;
}

.global-search-result-badge {
    max-width: 116px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 5px 8px;
    border-radius: 999px;
    background: rgba(59, 130, 246, .11);
    color: #7dd3fc;
    font-size: .66rem;
    font-weight: 780;
}

.global-search-state,
.global-search-partial {
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 10px 12px;
    color: var(--text-muted);
    text-align: center;
    font-size: .8rem;
}

.global-search-partial {
    min-height: 34px;
    padding-block: 7px 4px;
    font-size: .7rem;
}

.global-search-spinner {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    border: 2px solid rgba(148, 163, 184, .22);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: global-search-spin .72s linear infinite;
}

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

.header-right .user-menu {
    position: relative !important;
    min-width: 0 !important;
    width: auto !important;
    max-width: none !important;
    overflow: visible !important;
    flex: 0 0 auto !important;
}

.header-right #user-menu-btn {
    width: auto !important;
    min-width: 0 !important;
    max-width: 184px !important;
    height: 48px !important;
    min-height: 48px !important;
    padding: 5px 12px 5px 7px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 9px !important;
    overflow: hidden !important;
    border-radius: 16px !important;
    border: 1px solid rgba(167, 139, 250, .24) !important;
    background:
        radial-gradient(circle at 18% 0%, rgba(167, 139, 250, .22), transparent 52%),
        radial-gradient(circle at 92% 100%, rgba(14, 165, 233, .12), transparent 58%),
        linear-gradient(135deg, rgba(255,255,255,.075), rgba(255,255,255,.035)) !important;
    color: var(--text) !important;
    box-shadow:
        0 12px 28px rgba(15, 23, 42, .18),
        inset 0 1px 0 rgba(255,255,255,.14) !important;
    backdrop-filter: blur(16px) saturate(1.18) !important;
    -webkit-backdrop-filter: blur(16px) saturate(1.18) !important;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease !important;
    flex: 0 1 auto !important;
}

@media (hover: hover) and (pointer: fine) {
    .header-right #user-menu-btn:hover {
        border-color: rgba(167, 139, 250, .48) !important;
        box-shadow:
            0 16px 36px rgba(99, 102, 241, .18),
            inset 0 1px 0 rgba(255,255,255,.18) !important;
    }
}

.header-right #user-menu-btn .avatar,
.header-right #user-menu-btn .user-avatar {
    width: 38px !important;
    min-width: 38px !important;
    max-width: 38px !important;
    height: 38px !important;
    min-height: 38px !important;
    max-height: 38px !important;
    margin: 0 !important;
    flex: 0 0 38px !important;
    border-radius: 50% !important;
    border: 2px solid rgba(255,255,255,.42) !important;
    box-shadow:
        0 8px 18px rgba(59, 130, 246, .16),
        0 0 0 1px rgba(167, 139, 250, .18) !important;
    object-fit: cover !important;
}

.header-right #user-menu-btn .user-name {
    display: block !important;
    min-width: 0 !important;
    max-width: 106px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    color: var(--text) !important;
    font-size: .9rem !important;
    font-weight: 800 !important;
    line-height: 1 !important;
}

.header-right #user-menu-btn > svg {
    display: block !important;
    width: 15px !important;
    min-width: 15px !important;
    height: 15px !important;
    flex: 0 0 15px !important;
    color: var(--text-secondary) !important;
    stroke: currentColor !important;
    filter: drop-shadow(0 1px 3px rgba(0,0,0,.18));
}

body.theme-light .header-right #user-menu-btn,
[data-theme="light"] .header-right #user-menu-btn {
    border-color: rgba(79, 70, 229, .13) !important;
    background:
        radial-gradient(circle at 20% 0%, rgba(139, 92, 246, .13), transparent 54%),
        linear-gradient(135deg, rgba(255,255,255,.98), rgba(248,250,252,.92)) !important;
    color: #0f172a !important;
    box-shadow:
        0 12px 28px rgba(15, 23, 42, .08),
        inset 0 1px 0 rgba(255,255,255,.9) !important;
}

body.theme-light .header-right #user-menu-btn .avatar,
body.theme-light .header-right #user-menu-btn .user-avatar,
[data-theme="light"] .header-right #user-menu-btn .avatar,
[data-theme="light"] .header-right #user-menu-btn .user-avatar {
    border-color: rgba(255,255,255,.88) !important;
    box-shadow:
        0 8px 18px rgba(15, 23, 42, .10),
        0 0 0 1px rgba(124, 58, 237, .14) !important;
}

body.theme-light .header-right #user-menu-btn .user-name,
[data-theme="light"] .header-right #user-menu-btn .user-name {
    color: #0f172a !important;
}

body.theme-light #header-search-input {
    background: rgba(255,255,255,.82) !important;
    border-color: rgba(15, 23, 42, .10) !important;
    color: #0f172a !important;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.9) !important;
}

body.theme-light #header-search-input:focus {
    background: #fff !important;
    border-color: rgba(109, 93, 252, .36) !important;
}

body.theme-light .header .search-results-dropdown {
    background: rgba(255,255,255,.97) !important;
    border-color: rgba(15, 23, 42, .10) !important;
    box-shadow: 0 22px 60px rgba(15,23,42,.14) !important;
}

body.theme-light .global-search-result:hover,
body.theme-light .global-search-result:focus-visible {
    background: rgba(109, 93, 252, .07);
}

body.theme-light .global-search-avatar {
    color: #334155;
    border-color: rgba(15,23,42,.08);
    background: linear-gradient(145deg, rgba(99,102,241,.09), rgba(14,165,233,.06));
}

.app.header-compact-mode.header-collapsed .header,
.app.header-compact-mode.header-collapsed .header * {
    visibility: hidden !important;
    pointer-events: none !important;
}

@media (max-width: 768px) {
    :root {
        --header-user-pill-mobile-max: 118px;
    }

    .header {
        grid-template-columns: minmax(0, 1fr) auto !important;
        grid-template-areas: none !important;
        gap: 6px !important;
        height: auto !important;
        min-height: 56px !important;
        max-height: none !important;
        padding: 7px 8px !important;
        flex-wrap: nowrap !important;
    }

    .header-right {
        grid-area: auto !important;
        gap: 5px !important;
        min-width: 0 !important;
    }

    #notification-bell-btn,
    .notification-bell {
        width: 40px !important;
        min-width: 40px !important;
        max-width: 40px !important;
        height: 40px !important;
        min-height: 40px !important;
        max-height: 40px !important;
        flex: 0 0 40px !important;
    }

    #header-search-input {
        height: 40px !important;
        min-height: 40px !important;
        padding-inline-start: 38px !important;
        padding-inline-end: 12px !important;
        border-radius: 17px !important;
        font-size: 16px !important;
    }

    #header-search-input::placeholder {
        color: var(--text-muted) !important;
        font-size: .76rem !important;
    }

    .header-search-icon {
        inset-inline-start: 11px;
        width: 19px;
        height: 19px;
    }

    .header-right .user-menu,
    .header-right #user-menu-btn {
        width: auto !important;
        min-width: 0 !important;
        max-width: var(--header-user-pill-mobile-max) !important;
        flex-basis: auto !important;
    }

    .header-right #user-menu-btn {
        height: 40px !important;
        min-height: 40px !important;
        padding: 3px 7px 3px 4px !important;
        gap: 6px !important;
        border-radius: 14px !important;
    }

    .header-right #user-menu-btn .avatar,
    .header-right #user-menu-btn .user-avatar {
        width: 32px !important;
        min-width: 32px !important;
        max-width: 32px !important;
        height: 32px !important;
        min-height: 32px !important;
        max-height: 32px !important;
        flex-basis: 32px !important;
    }

    .header-right #user-menu-btn .user-name {
        display: block !important;
        max-width: 54px !important;
        font-size: .78rem !important;
    }

    .header-right #user-menu-btn > svg {
        display: block !important;
        width: 12px !important;
        min-width: 12px !important;
        height: 12px !important;
        flex-basis: 12px !important;
    }

    .header .search-results-dropdown {
        position: fixed !important;
        top: calc(56px + env(safe-area-inset-top, 0px)) !important;
        left: 8px !important;
        right: 8px !important;
        width: auto !important;
        max-width: none !important;
        max-height: min(72vh, 560px) !important;
    }

    .global-search-result {
        min-height: 52px;
        grid-template-columns: 36px minmax(0, 1fr) auto;
        gap: 9px;
        padding: 7px 8px;
    }

    .global-search-avatar {
        width: 36px;
        height: 36px;
    }

    .global-search-result--listing { grid-template-columns: 48px minmax(0, 1fr) auto; min-height: 64px; }
    .global-search-result--listing .global-search-avatar { width: 48px; height: 48px; }
    .global-search-result-badge {
        max-width: 86px;
        font-size: .62rem;
    }
}

@media (max-width: 430px) {
    :root {
        --header-user-pill-mobile-max: 106px;
    }

    .header {
        grid-template-columns: minmax(0, 1fr) auto !important;
        gap: 4px !important;
        padding-inline: 5px !important;
    }

    .header-right {
        gap: 3px !important;
    }

    #notification-bell-btn,
    .notification-bell {
        width: 40px !important;
        min-width: 40px !important;
        max-width: 40px !important;
        flex-basis: 40px !important;
    }

    .header-right #user-menu-btn {
        padding-inline-end: 5px !important;
        gap: 4px !important;
    }

    .header-right #user-menu-btn .user-name {
        max-width: 44px !important;
        font-size: .72rem !important;
    }

    #header-search-input {
        padding-inline-start: 32px !important;
        padding-inline-end: 7px !important;
        font-size: 16px !important;
    }

    #header-search-input::placeholder {
        font-size: .69rem !important;
    }

    .header-search-icon {
        inset-inline-start: 9px;
        width: 18px;
        height: 18px;
    }
}

/* Package 174 (owner 2026-10-20): the bell in one colour with the text, a
   24px glyph, a soft pill on hover; the badge sits on its shoulder. */
#notification-bell-btn { color: var(--text); }
#notification-bell-btn > svg { width: 24px; height: 24px; flex: 0 0 24px; }
@media (max-width: 768px) {
    #notification-bell-btn { border-radius: 14px; }
    #notification-bell-btn:active { background: var(--bg-hover); }
}

@media (max-width: 350px) {
    :root {
        --header-user-pill-mobile-max: 96px;
    }

    .header-right #user-menu-btn .user-name {
        max-width: 36px !important;
    }

    #header-search-input::placeholder {
        color: transparent !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .global-search-spinner {
        animation: none !important;
    }
    .global-search-result,
    #header-search-input {
        transition: none !important;
    }
}



/* === Notification Center in the bell: full history, lazy paging, mobile sheet === */
.notification-center-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    border: 0;
    padding: 0;
    background: rgba(15, 23, 42, .46);
    z-index: 1145;
}

html body #notification-dropdown.notification-dropdown {
    width: min(440px, calc(100vw - 24px));
    max-height: min(650px, calc(100vh - var(--app-menu-bar-h, 0px) - 88px));
    display: none;
    flex-direction: column;
    overflow: hidden;
}

html body #notification-dropdown.notification-dropdown.visible {
    display: flex;
}

.notification-dropdown-heading {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.notification-dropdown-count {
    font-size: .76rem;
    line-height: 1.25;
    color: var(--muted, #64748b);
}

.notification-dropdown-header-actions {
    display: flex;
    align-items: center;
    gap: 7px;
    flex: 0 0 auto;
}

.notification-center-filters {
    display: flex;
    gap: 6px;
    padding: 10px 12px 8px;
    border-bottom: 1px solid rgba(148, 163, 184, .16);
    flex: 0 0 auto;
}

.notification-center-filter {
    min-height: 32px;
    padding: 6px 11px;
    border: 1px solid rgba(148, 163, 184, .18);
    border-radius: 999px;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: .8rem;
    font-weight: 650;
    cursor: pointer;
    transition: background .16s ease, border-color .16s ease, transform .16s ease;
}

.notification-center-filter:hover { transform: translateY(-1px); }
.notification-center-filter.active {
    background: rgba(99, 91, 255, .12);
    border-color: rgba(99, 91, 255, .24);
    color: #4f46e5;
}
.notification-center-filter:disabled { opacity: .58; cursor: default; transform: none; }

html body #notification-dropdown.notification-dropdown .notification-dropdown-list {
    min-height: 132px;
    max-height: none;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    flex: 1 1 auto;
    padding: 8px 10px;
}

.notification-center-load-more-wrap {
    display: flex;
    justify-content: center;
    padding: 4px 10px 9px;
    flex: 0 0 auto;
}

#notification-load-more[hidden] { display: none !important; }
#notification-load-more { min-width: 132px; }

body.dark .notification-dropdown-count,
body.theme-dark .notification-dropdown-count,
html[data-theme="dark"] body .notification-dropdown-count { color: #94a3b8; }

body.dark .notification-center-filter.active,
body.theme-dark .notification-center-filter.active,
html[data-theme="dark"] body .notification-center-filter.active {
    color: #c4b5fd;
    background: rgba(124, 58, 237, .20);
    border-color: rgba(196, 181, 253, .20);
}

@media (max-width: 720px) {
    body.notification-center-open { overflow: hidden; }
    body.notification-center-open .notification-center-backdrop { display: block; }

    html body #notification-dropdown.notification-dropdown,
    html body .notification-bell #notification-dropdown.notification-dropdown {
        position: fixed;
        left: 8px;
        right: 8px;
        top: auto;
        bottom: max(8px, env(safe-area-inset-bottom));
        width: auto;
        height: min(88dvh, calc(100dvh - 68px));
        max-height: none;
        margin: 0;
        border-radius: 22px;
        z-index: 1150;
        transform: translateY(18px) scale(.985);
        transform-origin: center bottom;
        opacity: 0;
        pointer-events: none;
        transition: transform .18s ease, opacity .18s ease;
    }

    html body #notification-dropdown.notification-dropdown.visible,
    html body .notification-bell #notification-dropdown.notification-dropdown.visible {
        display: flex;
        transform: translateY(0) scale(1);
        opacity: 1;
        pointer-events: auto;
    }

    .notification-dropdown-header { padding: 14px 14px 10px; }
    .notification-dropdown-title { font-size: 1.02rem; }
    .notification-dropdown-header-actions #mark-all-read-dropdown { font-size: .75rem; padding-inline: 8px; }
    .notification-center-filters { padding-inline: 12px; overflow-x: auto; scrollbar-width: none; }
    .notification-center-filters::-webkit-scrollbar { display: none; }
    html body #notification-dropdown.notification-dropdown .notification-dropdown-list { padding: 8px; }
    .notification-dropdown-footer { padding-bottom: max(10px, env(safe-area-inset-bottom)); }
}


/* === Package 175 (owner 2026-10-20): the bell window, native and quiet ===
   «Слишком много кнопок; настройки — просто шестерёнка; не прозрачное, не
   нативное, не живое; сверху много места; тексты кривые; крестик тоненький
   большой, как везде». One translucent surface per theme, a compact header
   (title, unread pill, three icon buttons), a segmented filter, flat rows
   (name and time on one line, text below), the row's × on hover or a swipe.
   Earlier stages pin these parts with !important; this block is scoped by
   two ids and repeats !important only where they pin. */
#notification-bell #notification-dropdown.notification-dropdown {
    --nc-surface: rgba(20, 26, 41, .84);
    --nc-solid: #161d2e;
    --nc-border: rgba(255, 255, 255, .08);
    --nc-text: #f1f5f9;
    --nc-text-2: rgba(226, 232, 240, .9);
    --nc-muted: rgba(203, 213, 225, .72);
    --nc-faint: rgba(148, 163, 184, .8);
    --nc-hover: rgba(255, 255, 255, .055);
    --nc-control: rgba(255, 255, 255, .06);
    --nc-segment: rgba(255, 255, 255, .13);
    --nc-unread: color-mix(in srgb, var(--primary) 11%, transparent);
    --nc-accent: var(--primary);
    --nc-shadow: 0 24px 64px rgba(2, 6, 23, .5), 0 2px 8px rgba(2, 6, 23, .25);
    background: var(--nc-surface) !important;
    background-image: none !important;
    -webkit-backdrop-filter: blur(28px) saturate(1.6);
    backdrop-filter: blur(28px) saturate(1.6) !important;
    border: 1px solid var(--nc-border) !important;
    border-radius: 22px !important;
    box-shadow: var(--nc-shadow) !important;
    color: var(--nc-text) !important;
    padding: 0 !important;
}
body.theme-light #notification-bell #notification-dropdown.notification-dropdown {
    --nc-surface: rgba(255, 255, 255, .86);
    --nc-solid: #ffffff;
    --nc-border: rgba(15, 23, 42, .08);
    --nc-text: #0f172a;
    --nc-text-2: #1e293b;
    --nc-muted: #475569;
    --nc-faint: #64748b;
    --nc-hover: rgba(15, 23, 42, .045);
    --nc-control: rgba(15, 23, 42, .055);
    --nc-segment: #ffffff;
    --nc-shadow: 0 24px 60px rgba(15, 23, 42, .18), 0 2px 8px rgba(15, 23, 42, .08);
}
body.theme-system #notification-bell #notification-dropdown.notification-dropdown {
    --nc-surface: rgba(40, 48, 56, .88);
    --nc-solid: #283038;
    --nc-text: #f2f5f7;
    --nc-text-2: rgba(226, 233, 238, .92);
    --nc-muted: rgba(208, 219, 226, .74);
    --nc-faint: rgba(178, 192, 201, .8);
}
body.theme-system.theme-night #notification-bell #notification-dropdown.notification-dropdown {
    --nc-surface: rgba(28, 28, 30, .9);
    --nc-solid: #1c1c1e;
}

/* Header: the title with its unread pill; read all, settings and close as icons. */
#notification-bell #notification-dropdown .notification-dropdown-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px !important;
    min-height: 56px;
    padding: 10px 8px 4px 18px !important;
    border: 0 !important;
    background: none !important;
    box-shadow: none !important;
}
#notification-bell #notification-dropdown .notification-dropdown-heading { display: flex; flex-direction: row; align-items: center; gap: 8px; min-width: 0; }
#notification-bell #notification-dropdown .notification-dropdown-title {
    color: var(--nc-text) !important;
    font-size: 19px !important;
    font-weight: 700 !important;
    letter-spacing: -.01em;
    line-height: 1.2;
}
#notification-bell #notification-dropdown .notification-dropdown-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: 999px;
    background: var(--nc-accent);
    color: #fff !important;
    font-size: 12px !important;
    font-weight: 700;
    line-height: 1;
}
#notification-bell #notification-dropdown .notification-dropdown-count[hidden] { display: none; }
#notification-bell #notification-dropdown .notification-dropdown-count strong { color: inherit; font-weight: inherit; }
#notification-bell #notification-dropdown .notification-dropdown-count-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}
#notification-bell #notification-dropdown .notification-dropdown-header-actions { display: flex; align-items: center; gap: 2px; }
#notification-bell #notification-dropdown :is(#mark-all-read-dropdown, #notification-settings-link, #notification-dropdown-close).notification-icon-btn {
    appearance: none;
    display: grid !important;
    place-items: center;
    width: 40px !important;
    min-width: 40px !important;
    height: 40px !important;
    min-height: 40px !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 999px !important;
    background: transparent !important;
    box-shadow: none !important;
    color: var(--nc-muted) !important;
    font-size: 0 !important;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}
#notification-bell #notification-dropdown :is(#mark-all-read-dropdown, #notification-settings-link, #notification-dropdown-close).notification-icon-btn:hover {
    background: var(--nc-hover) !important;
    color: var(--nc-text) !important;
}
#notification-bell #notification-dropdown #mark-all-read-dropdown.notification-icon-btn:disabled { opacity: .36; cursor: default; background: transparent !important; }
#notification-bell #notification-dropdown .notification-icon-btn:focus-visible { outline: 2px solid var(--nc-accent); outline-offset: 1px; }
#notification-bell #notification-dropdown .notification-icon-btn > svg { width: 22px; height: 22px; }
#notification-bell #notification-dropdown #notification-dropdown-close.notification-icon-btn > svg { width: 24px; height: 24px; }

/* A segmented filter instead of two pills. */
#notification-bell #notification-dropdown .notification-center-filters {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 2px !important;
    margin: 2px 14px 8px;
    padding: 3px !important;
    border: 0 !important;
    border-radius: 12px;
    background: var(--nc-control) !important;
    overflow: visible !important;
}
#notification-bell #notification-dropdown .notification-center-filter {
    min-height: 32px !important;
    padding: 4px 10px !important;
    border: 0 !important;
    border-radius: 9px !important;
    background: transparent !important;
    box-shadow: none !important;
    color: var(--nc-muted) !important;
    font-size: 13.5px !important;
    font-weight: 600 !important;
    transform: none !important;
    transition: background .15s ease, color .15s ease;
}
#notification-bell #notification-dropdown .notification-center-filter.active {
    background: var(--nc-segment) !important;
    color: var(--nc-text) !important;
    box-shadow: 0 1px 3px rgba(2, 6, 23, .16) !important;
}

/* Rows: flat, name and time on one line, the text below. */
#notification-bell #notification-dropdown .notification-dropdown-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 2px 8px 8px !important;
    background: none !important;
    scrollbar-width: thin;
}
#notification-bell #notification-dropdown .notification-dropdown-row { position: relative; flex: 0 0 auto; border-radius: 14px; overflow: hidden; }
#notification-bell #notification-dropdown .notification-dropdown-item {
    position: relative;
    z-index: 1;
    display: grid !important;
    grid-template-columns: 42px minmax(0, 1fr) 12px;
    align-items: center !important;
    gap: 12px !important;
    width: 100%;
    min-height: 64px;
    margin: 0 !important;
    padding: 10px 12px !important;
    border: 0 !important;
    border-radius: 14px !important;
    background: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
    color: var(--nc-text) !important;
    font-size: 14px !important;
    text-align: start;
    cursor: pointer;
    transform: translateX(var(--notification-swipe, 0px));
    transition: background .15s ease, transform .22s cubic-bezier(.2, .8, .2, 1);
}
#notification-bell #notification-dropdown .notification-dropdown-item:hover { background: var(--nc-hover) !important; }
#notification-bell #notification-dropdown .notification-dropdown-item.unread { background: var(--nc-unread) !important; }
#notification-bell #notification-dropdown .notification-dropdown-item:focus-visible { outline: 2px solid var(--nc-accent); outline-offset: -2px; }
#notification-bell #notification-dropdown .notification-dropdown-item .notification-avatar {
    width: 42px !important;
    height: 42px !important;
    min-width: 42px;
    border-radius: 50% !important;
    font-size: 16px !important;
}
#notification-bell #notification-dropdown .notification-dropdown-content { display: grid; gap: 2px; min-width: 0; }
#notification-bell #notification-dropdown .notification-dropdown-head { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
#notification-bell #notification-dropdown .notification-dropdown-text {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    color: var(--nc-text) !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#notification-bell #notification-dropdown .notification-dropdown-meta {
    flex: 0 0 auto;
    color: var(--nc-faint) !important;
    font-size: 12.5px !important;
    font-weight: 500 !important;
    line-height: 1.3;
}
#notification-bell #notification-dropdown .notification-row-action {
    display: -webkit-box;
    overflow: hidden;
    color: var(--nc-text-2) !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    line-height: 1.35;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow-wrap: anywhere;
}
#notification-bell #notification-dropdown .notification-dropdown-message {
    display: -webkit-box;
    overflow: hidden;
    color: var(--nc-muted) !important;
    font-size: 13.5px !important;
    font-weight: 400 !important;
    line-height: 1.35;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow-wrap: anywhere;
}
#notification-bell #notification-dropdown .notification-dropdown-dot {
    width: 9px !important;
    height: 9px !important;
    border-radius: 50% !important;
    background: var(--nc-accent) !important;
    box-shadow: none !important;
    justify-self: center;
}

/* The row's ×: with a mouse on hover or focus, on a touch screen behind the row. */
#notification-bell #notification-dropdown .notification-dropdown-delete {
    appearance: none;
    position: absolute;
    z-index: 2;
    top: 50%;
    inset-inline-end: 8px;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    margin-top: -16px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: var(--nc-control);
    color: var(--nc-muted);
    opacity: 0;
    cursor: pointer;
    transition: opacity .15s ease, color .15s ease, background .15s ease;
}
#notification-bell #notification-dropdown .notification-dropdown-row:is(:hover, :focus-within) .notification-dropdown-delete { opacity: 1; }
#notification-bell #notification-dropdown .notification-dropdown-row:is(:hover, :focus-within) .notification-dropdown-dot { opacity: 0; }
#notification-bell #notification-dropdown .notification-dropdown-delete:hover { background: color-mix(in srgb, var(--danger, #ef4444) 16%, transparent); color: var(--danger, #ef4444); }
#notification-bell #notification-dropdown .notification-dropdown-delete:focus-visible { opacity: 1; outline: 2px solid var(--nc-accent); outline-offset: 1px; }
#notification-bell #notification-dropdown .notification-dropdown-row.is-removing { opacity: .45; pointer-events: none; transition: opacity .15s ease; }
@media (hover: none), (pointer: coarse) {
    #notification-bell #notification-dropdown .notification-dropdown-item { touch-action: pan-y; }
    #notification-bell #notification-dropdown .notification-dropdown-delete {
        z-index: 0;
        top: 0;
        bottom: 0;
        inset-inline-end: 0;
        width: 88px;
        height: auto;
        margin: 0;
        border-radius: 0;
        background: var(--danger, #ef4444);
        color: #fff;
        opacity: 1;
        visibility: hidden;
    }
    #notification-bell #notification-dropdown .notification-dropdown-row:is(.is-swiped, .is-dragging) .notification-dropdown-delete { visibility: visible; }
    #notification-bell #notification-dropdown .notification-dropdown-row:is(.is-swiped, .is-dragging) .notification-dropdown-item { background: var(--nc-solid) !important; }
    #notification-bell #notification-dropdown .notification-dropdown-row.is-swiped .notification-dropdown-item { --notification-swipe: -88px; }
    #notification-bell #notification-dropdown .notification-dropdown-row.is-dragging .notification-dropdown-item { transition: none; }
    #notification-bell #notification-dropdown .notification-dropdown-row:is(:hover, :focus-within) .notification-dropdown-dot { opacity: 1; }
}

/* Paging is a quiet text button (scrolling to the end loads by itself). */
#notification-bell #notification-dropdown .notification-center-load-more-wrap { padding: 0 10px 10px !important; background: none !important; border: 0 !important; }
#notification-bell #notification-dropdown .notification-load-more {
    appearance: none;
    min-height: 36px;
    padding: 6px 14px;
    border: 0;
    border-radius: 10px;
    background: none;
    color: var(--nc-accent);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
#notification-bell #notification-dropdown .notification-load-more:hover { background: var(--nc-hover); }
#notification-bell #notification-dropdown .notification-load-more[hidden] { display: none; }

/* Empty and loading states. */
#notification-bell #notification-dropdown .notification-dropdown-empty {
    display: grid;
    justify-items: center;
    gap: 6px;
    padding: 40px 24px !important;
    border: 0 !important;
    background: none !important;
    color: var(--nc-muted) !important;
    font-size: 14px !important;
    line-height: 1.45;
    text-align: center;
}
#notification-bell #notification-dropdown .notification-dropdown-empty b { color: var(--nc-text); font-size: 16px; font-weight: 650; }
#notification-bell #notification-dropdown .notification-empty-icon {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    margin-bottom: 4px;
    border-radius: 50%;
    background: var(--nc-control) !important;
    color: var(--nc-muted) !important;
}

/* Desktop: the window grows out of the bell; phones keep their sheet and get a grabber. */
@media (min-width: 721px) {
    #notification-bell #notification-dropdown.notification-dropdown.visible { animation: notification-center-pop .16s cubic-bezier(.2, .8, .2, 1); transform-origin: top right; }
}
@keyframes notification-center-pop { from { opacity: 0; transform: translateY(-6px) scale(.98); } to { opacity: 1; transform: none; } }
@media (max-width: 720px) {
    #notification-bell #notification-dropdown.notification-dropdown { border-radius: 24px !important; }
    #notification-bell #notification-dropdown.notification-dropdown::before {
        content: "";
        flex: 0 0 auto;
        width: 38px;
        height: 5px;
        margin: 8px auto 0;
        border-radius: 3px;
        background: var(--nc-faint);
        opacity: .45;
    }
    #notification-bell #notification-dropdown .notification-dropdown-header { min-height: 48px; padding-top: 4px !important; }
}
@media (prefers-reduced-motion: reduce) {
    #notification-bell #notification-dropdown.notification-dropdown.visible { animation: none; }
    #notification-bell #notification-dropdown .notification-dropdown-item { transition: none; }
}

/* DEALIX Music × Ecosystem · Phase 1A: photo route and proportional profile previews.
   Scoped to existing profile/gallery components; global theme tokens and settings untouched. */
.profile-page.profile-redesign .profile-strip-add-action {
    min-width: 44px; min-height: 44px;
}
.profile-page.profile-redesign .profile-all-photos {
    min-height: 44px; padding-inline: 8px; white-space: nowrap;
}
.profile-page.profile-redesign .profile-strip-tiles[data-photo-count="1"] {
    grid-template-columns: minmax(0, 1fr); max-width: 520px;
}
.profile-page.profile-redesign .profile-strip-tiles[data-photo-count="2"] {
    grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 800px;
}
.profile-page.profile-redesign .profile-strip-tiles[data-photo-count="1"] .profile-strip-tile {
    aspect-ratio: 4 / 3;
}
.profile-page.profile-redesign .profile-gallery-route-header {
    display: flex; gap: 12px; align-items: center; min-height: 70px;
    padding: 12px 16px; margin-bottom: 14px; border: 1px solid var(--border);
    border-radius: var(--profile-radius, 16px); background: var(--bg-card);
}
.profile-page.profile-redesign .profile-gallery-route-header h1 {
    margin: 0; font: 700 clamp(18px, 2.5vw, 22px)/1.3 var(--font-sans);
}
.profile-page.profile-redesign .profile-gallery-route-header p {
    margin: 3px 0 0; color: var(--text-secondary); font-size: 13px;
}
.profile-page.profile-redesign .profile-gallery-route-back {
    display: grid; place-items: center; flex: 0 0 44px;
    height: 44px; color: var(--text); border-radius: 12px;
    text-decoration: none; background: var(--bg-tertiary);
}
.profile-page.profile-redesign .profile-gallery-route-back:hover { background: var(--bg-hover); }
.profile-page.profile-redesign .profile-gallery-route-back:focus-visible,
.profile-page.profile-redesign .profile-gallery-album-filter:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.profile-page.profile-redesign .profile-gallery-route-content { min-width: 0; padding: 0 2px 20px; }
.profile-page.profile-redesign .profile-gallery-album-filters {
    display: flex; align-items: center; gap: 8px; min-width: 0; overflow-x: auto;
    padding: 4px 2px 8px; scrollbar-width: thin;
}
.profile-page.profile-redesign .profile-gallery-album-filter {
    display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
    min-height: 44px; padding: 8px 14px; border: 1px solid var(--border);
    border-radius: 999px; background: var(--bg-card); color: var(--text);
    font: 600 13px/1.35 var(--font-sans); text-decoration: none; white-space: nowrap; cursor: pointer;
}
.profile-page.profile-redesign .profile-gallery-album-filter.active {
    background: var(--primary); border-color: var(--primary); color: #fff;
}
.profile-page.profile-redesign .profile-photos-grid[data-photo-count="1"] {
    grid-template-columns: minmax(0, 1fr); max-width: 640px;
}
.profile-page.profile-redesign .profile-photos-grid[data-photo-count="2"] {
    grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 800px;
}
.profile-page.profile-redesign .profile-photos-grid[data-photo-count="1"] .profile-photo-tile {
    aspect-ratio: 4 / 3;
}
/* The audience is the existing feed select; only its profile presentation is compact. */
.profile-page.profile-redesign .profile-wall-composer .feed-audience-control {
    display: flex; align-items: center; flex-wrap: wrap; gap: 7px 10px;
    margin-top: 9px; max-width: 100%;
}
.profile-page.profile-redesign .profile-wall-composer .feed-audience-control select {
    width: auto; min-width: 140px; max-width: min(240px, 100%);
    min-height: 40px; border-radius: 999px; padding-inline: 12px 28px;
}
.profile-page.profile-redesign .profile-wall-composer .feed-audience-control small {
    flex-basis: 100%; margin-top: -3px;
}
@media (max-width: 640px) {
    .profile-page.profile-redesign .profile-strip-tiles[data-photo-count="1"] {
        grid-template-columns: minmax(0, 1fr);
    }
    .profile-page.profile-redesign .profile-strip-tiles[data-photo-count="2"] {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .profile-page.profile-redesign .profile-photos-grid[data-photo-count="1"] {
        grid-template-columns: minmax(0, 1fr);
    }
    .profile-page.profile-redesign .profile-photos-grid[data-photo-count="2"] {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .profile-page.profile-redesign .profile-gallery-route-header { margin-inline: 0; }
    .profile-page.profile-redesign .profile-gallery-route-content { padding-inline: 0; }
}

/* DEALIX Music × Ecosystem Phase 1A — ACL-backed, read-only profile music shelf */
.profile-page.profile-redesign .profile-music-showcase {
    min-width: 0; margin: 0 0 12px; padding: 14px;
    border: 1px solid var(--border); border-radius: var(--profile-radius, 16px);
    background: var(--bg-card); color: var(--text);
}
.profile-page.profile-redesign .profile-music-showcase[hidden] { display: none; }
.profile-page.profile-redesign .profile-music-showcase-heading {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.profile-page.profile-redesign .profile-music-showcase-heading h2 {
    font: 700 16px/1.4 var(--font-sans); margin: 0;
}
.profile-page.profile-redesign .profile-music-showcase-heading a {
    display: inline-flex; align-items: center; min-height: 44px;
    color: var(--primary); text-decoration: none; font-size: 12px;
}
.profile-page.profile-redesign .profile-music-showcase h3 {
    margin: 12px 0 8px; font-size: 13px; font-weight: 650;
}
.profile-page.profile-redesign .profile-music-tracks {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 8px;
}
.profile-page.profile-redesign .profile-music-track,
.profile-page.profile-redesign .profile-music-playlist {
    display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 60px;
    padding: 7px 9px; border: 1px solid var(--border); border-radius: 12px;
    background: var(--bg-tertiary); color: var(--text); text-decoration: none;
}
.profile-page.profile-redesign .profile-music-track:hover,
.profile-page.profile-redesign .profile-music-playlist:hover { border-color: var(--primary); }
.profile-page.profile-redesign .profile-music-track:focus-visible,
.profile-page.profile-redesign .profile-music-playlist:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.profile-page.profile-redesign .profile-music-cover {
    display: grid; place-items: center; flex: 0 0 44px; width: 44px; height: 44px;
    border-radius: 9px; overflow: hidden; background: var(--bg-card); color: var(--primary);
}
.profile-page.profile-redesign .profile-music-cover img { width: 100%; height: 100%; object-fit: cover; }
.profile-page.profile-redesign .profile-music-track-copy,
.profile-page.profile-redesign .profile-music-playlist > span:last-child { display: grid; gap: 3px; min-width: 0; flex: 1 1 auto; }
.profile-page.profile-redesign .profile-music-track-copy b,
.profile-page.profile-redesign .profile-music-playlist b { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 12px; }
.profile-page.profile-redesign .profile-music-track-copy small,
.profile-page.profile-redesign .profile-music-playlist small { color: var(--text-secondary); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 11px; }
.profile-page.profile-redesign .profile-music-mode {
    flex: 0 0 auto; padding: 4px 7px; border-radius: 999px;
    color: var(--text-secondary); background: var(--bg-card); font-size: 10px;
}
.profile-page.profile-redesign .profile-music-mode-full { color: var(--primary); }
.profile-page.profile-redesign .profile-music-playlists { display: flex; gap: 8px; overflow-x: auto; padding: 1px 1px 4px; }
.profile-page.profile-redesign .profile-music-playlist { flex: 1 0 180px; max-width: 320px; }
@media (max-width: 640px) {
    .profile-page.profile-redesign .profile-music-showcase { padding: 10px; }
    .profile-page.profile-redesign .profile-music-tracks { grid-template-columns: minmax(0, 1fr); }
}

/* DEALIX Music × Ecosystem Phase 1B — explicit pinned-track controls */
.profile-page.profile-redesign .profile-music-entry {
    display: flex; align-items: center; gap: 6px; min-width: 0;
}
.profile-page.profile-redesign .profile-music-entry > .profile-music-track { flex: 1 1 auto; min-width: 0; }
.profile-page.profile-redesign .profile-music-pin-action {
    flex: 0 0 auto; min-height: 44px; padding: 5px 10px;
    border: 1px solid var(--border); border-radius: 11px;
    color: var(--text); background: var(--bg-tertiary);
    cursor: pointer; font: inherit; font-size: 12px;
}
.profile-page.profile-redesign .profile-music-pin-action:hover { border-color: var(--primary); }
.profile-page.profile-redesign .profile-music-pin-action:focus-visible {
    outline: 2px solid var(--primary); outline-offset: 2px;
}
.profile-page.profile-redesign .profile-music-pin-action:disabled { opacity: .6; cursor: wait; }
.profile-page.profile-redesign .profile-music-pin-unavailable {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
    color: var(--text-secondary); font-size: 12px;
}
@media (max-width: 380px) {
    .profile-page.profile-redesign .profile-music-entry { flex-wrap: wrap; }
    .profile-page.profile-redesign .profile-music-pin-action { margin-inline-start: auto; }
}

/* DEALIX Profile Repair Phase 1C: compact overview, no loss of editor/preferences. */
.profile-page.profile-redesign .profile-strip-tiles[data-photo-count="1"] {
    grid-template-columns: minmax(0, 1fr);
    max-width: none;
}
.profile-page.profile-redesign .profile-strip-tiles[data-photo-count="1"] .profile-strip-tile {
    aspect-ratio: auto;
    width: 100%;
    height: clamp(180px, 23vw, 240px);
    max-height: 240px;
}
.profile-page.profile-redesign .profile-strip-tiles[data-photo-count="1"] .profile-strip-tile img {
    width: 100%; height: 100%; object-fit: cover; object-position: center;
}
.profile-page.profile-redesign .profile-strip-tiles[data-photo-count="2"] {
    max-width: none;
}
.profile-page.profile-redesign .profile-strip-tiles[data-photo-count="2"] .profile-strip-tile {
    max-height: 230px;
}
.profile-page.profile-redesign.profile-editor-open > :is(.profile-hero, .profile-social-band, .profile-local-navigation) { display: none; }
.profile-page.profile-redesign.profile-editor-open { padding-block: 24px 40px; }
.profile-page.profile-redesign.profile-editor-open .profile-content { display: block; }
.profile-page.profile-redesign .profile-editor-shell {
    width: min(100%, 640px); margin-inline: auto; min-width: 0; box-sizing: border-box;
    border: 1px solid var(--profile-line); border-radius: 22px;
    background: var(--profile-surface); color: var(--text);
}
.profile-page.profile-redesign .profile-editor-heading {
    position: sticky; top: 0; z-index: 5; display: grid; grid-template-columns: minmax(0, 1fr) 44px;
    align-items: center; gap: 12px; padding: 16px 24px; margin: 0;
    border-bottom: 1px solid var(--profile-line); border-radius: 22px 22px 0 0;
    background: var(--profile-surface); color: var(--text);
}
.profile-page.profile-redesign .profile-editor-heading h2 { margin: 0; min-width: 0; font-size: 19px; line-height: 1.3; text-align: start; overflow-wrap: anywhere; }
.profile-page.profile-redesign .profile-editor-close {
    display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 1px solid var(--border); border-radius: 50%;
    color: var(--text); background: var(--profile-field); cursor: pointer;
}
.profile-page.profile-redesign .profile-editor-close svg { width: 20px; height: 20px; }
.profile-page.profile-redesign .profile-editor-close:focus-visible { outline: 2px solid var(--profile-accent); outline-offset: 3px; }
.profile-page.profile-redesign .profile-editor-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; min-width: 0; padding: 24px; }
.profile-page.profile-redesign .profile-editor-form .profile-settings-form { gap: 22px; min-width: 0; }
.profile-page.profile-redesign .profile-editor-field { display: grid; gap: 8px; min-width: 0; align-content: start; }
.profile-page.profile-redesign .profile-editor-field .form-label { margin: 0; font-size: 13px; font-weight: 600; line-height: 1.4; color: var(--text-secondary); }
.profile-page.profile-redesign .profile-editor-form .input { width: 100%; min-width: 0; min-height: 48px; margin: 0; padding: 12px 14px; box-sizing: border-box; font-size: 16px; border-radius: 13px; scroll-margin-block: 84px 120px; }
.profile-page.profile-redesign .profile-editor-form textarea.input { min-height: 120px; resize: vertical; }
.profile-page.profile-redesign .profile-editor-form .form-hint { margin: 0; font-size: 13px; line-height: 1.45; color: var(--text-secondary); }
.profile-page.profile-redesign .profile-editor-actions { display: grid; gap: 14px; padding-block-start: 18px; margin: 0; border-top: 1px solid var(--profile-line); }
.profile-page.profile-redesign .profile-editor-actions .profile-settings-status { margin: 0; min-height: 20px; line-height: 1.5; }
.profile-page.profile-redesign .profile-editor-actions .profile-settings-status[data-error="true"] { color: var(--danger); }
.profile-page.profile-redesign .profile-editor-controls { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.profile-page.profile-redesign .profile-editor-controls[hidden] { display: none; }
.profile-page.profile-redesign .profile-editor-controls .btn { min-height: 44px; flex: 0 1 auto; white-space: normal; }
.profile-page.profile-redesign .profile-photo-publish-entry { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: 15px; background: var(--bg-card); }
.profile-page.profile-redesign .profile-photo-publish-entry .profile-photo-feed-author-avatar { width: 36px; height: 36px; flex: 0 0 36px; }
.profile-page.profile-redesign .profile-photo-publish-entry button { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; min-height: 44px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; text-align: start; background: var(--bg-tertiary); color: var(--text-secondary); font: inherit; cursor: pointer; }
.profile-page.profile-redesign .profile-photo-publish-entry button svg { flex: 0 0 20px; width: 20px; height: 20px; color: var(--profile-accent); }
@media (max-width: 600px) {
    .profile-page.profile-redesign .profile-strip-tiles[data-photo-count="1"] .profile-strip-tile {
        height: clamp(170px, 52vw, 220px);
        max-height: 220px;
    }
    .profile-page.profile-redesign .profile-strip-tiles[data-photo-count="2"] .profile-strip-tile {
        max-height: 185px;
    }
    .profile-page.profile-redesign.profile-editor-open { padding-block: 0 max(104px, calc(env(safe-area-inset-bottom) + 86px)); }
    .profile-page.profile-redesign .profile-editor-shell { border: 0; border-radius: 0; }
    .profile-page.profile-redesign .profile-editor-heading { padding: 12px 16px; border-radius: 0; }
    .profile-page.profile-redesign .profile-editor-heading h2 { font-size: 17px; }
    .profile-page.profile-redesign .profile-editor-form { padding: 20px 16px; }
    .profile-page.profile-redesign .profile-editor-controls .btn { flex: 1 1 120px; }
    .profile-page.profile-redesign .profile-editor-form .profile-settings-row { grid-template-columns: minmax(0, 1fr); }
}
/* DEALIX Phase 1F — profile navigation, not a page/cover redesign.
   Do not constrain the profile canvas or change its hero/story geometry. */
.profile-page.profile-redesign { max-width: none; margin-inline: 0; }
.profile-page.profile-redesign .profile-mini-track-slot:not([hidden]) {
    display: block;
    width: min(100%, 370px);
    margin-block-start: 9px;
    min-width: 0;
}
.profile-page.profile-redesign .profile-mini-track-slot[hidden] { display: none; }
.profile-page.profile-redesign .profile-mini-track {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 5px 7px;
    min-height: 44px;
    max-width: 370px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--bg-tertiary);
    color: var(--text);
}
.profile-page.profile-redesign .profile-mini-track-cover {
    display: grid; place-items: center; overflow: hidden; flex: 0 0 36px;
    width: 36px; height: 36px; border-radius: 7px;
    color: var(--text-secondary); background: var(--bg-secondary);
}
.profile-page.profile-redesign .profile-mini-track-cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.profile-page.profile-redesign .profile-mini-track-copy { flex: 1 1 auto; min-width: 0; display: grid; gap: 2px; }
.profile-page.profile-redesign .profile-mini-track-copy b,
.profile-page.profile-redesign .profile-mini-track-copy small { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.profile-page.profile-redesign .profile-mini-track-copy b { font-size: 12px; line-height: 1.25; font-weight: 650; }
.profile-page.profile-redesign .profile-mini-track-copy small { font-size: 11px; line-height: 1.25; color: var(--text-secondary); }
.profile-page.profile-redesign .profile-mini-track-play {
    flex: 0 0 34px; width: 34px; height: 34px; padding: 0;
    display: grid; place-items: center; border: 1px solid var(--border-light);
    border-radius: 50%; background: var(--primary-light); color: var(--primary);
    cursor: pointer;
}
.profile-page.profile-redesign .profile-mini-track-play:disabled { opacity: 0.6; cursor: wait; }
.profile-page.profile-redesign .profile-mini-track-unpin {
    flex: 0 0 26px; width: 26px; height: 32px; padding: 0;
    border: 0; border-radius: 8px; background: transparent;
    color: var(--text-secondary); cursor: pointer; font-size: 20px;
}
.profile-page.profile-redesign .profile-extra-sections { flex: 0 0 auto; position: relative; }
.profile-page.profile-redesign .profile-extra-sections[hidden] { display: none; }
.profile-page.profile-redesign .profile-extra-sections summary {
    cursor: pointer; list-style: none; border-radius: 8px;
    padding: 10px 8px; min-height: 44px; color: var(--text-secondary); font-size: 12px; line-height: 24px;
}
.profile-page.profile-redesign .profile-extra-sections summary::-webkit-details-marker { display: none; }
.profile-page.profile-redesign .profile-extra-sections-menu {
    display: grid; gap: 3px; position: absolute; z-index: 30;
    inset-inline-end: 0; top: calc(100% + 4px); min-width: 155px;
    background: var(--bg-card); padding: 6px; border: 1px solid var(--border);
    border-radius: 10px; box-shadow: 0 9px 28px #0004;
}
.profile-page.profile-redesign .profile-extra-sections-menu button {
    display: flex; align-items: center; gap: 8px; border: 0; padding: 10px;
    border-radius: 8px; background: transparent; color: var(--text); text-align: start; cursor: pointer;
}
.profile-page.profile-redesign .profile-extra-sections-menu button:hover { background: var(--bg-hover); }
/* Keep the full original desktop canvas. The side rail exists only below the
   untouched cover and stories; never reduce header/banner dimensions. */
.profile-page.profile-redesign .profile-overview-stack { display: block; min-width: 0; }
.profile-page.profile-redesign .profile-main-column { display: block; min-width: 0; }
.profile-page.profile-redesign .profile-native-aside { display: none; min-width: 0; }
.profile-page.profile-redesign .profile-playlists-aside[hidden] { display: none; }
.profile-page.profile-redesign .profile-playlists-aside {
    padding: 14px; min-width: 0; border: 1px solid var(--border);
    border-radius: 13px; background: var(--bg-card);
}
.profile-page.profile-redesign .profile-native-aside-heading {
    display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px;
}
.profile-page.profile-redesign .profile-native-aside-heading h2 { margin: 0; font-size: 16px; }
.profile-page.profile-redesign .profile-native-aside-heading a { font-size: 12px; color: var(--primary); text-decoration: none; }
.profile-page.profile-redesign .profile-native-playlist-items { display: grid; gap: 8px; }
.profile-page.profile-redesign .profile-native-playlist-card {
    display: flex; align-items: center; gap: 10px; min-width: 0;
    padding: 7px; border: 1px solid var(--border); border-radius: 11px;
    background: var(--bg-tertiary); color: var(--text); text-decoration: none;
}
.profile-page.profile-redesign .profile-native-playlist-card > span:nth-child(2) { min-width: 0; flex: 1; display: grid; gap: 3px; }
.profile-page.profile-redesign .profile-native-playlist-card b,
.profile-page.profile-redesign .profile-native-playlist-card small {
    display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.profile-page.profile-redesign .profile-native-playlist-card b { font-size: 13px; }
.profile-page.profile-redesign .profile-native-playlist-card small { font-size: 11px; color: var(--text-secondary); }
.profile-page.profile-redesign .profile-native-playlist-cover {
    display: grid; place-items: center; flex: 0 0 48px;
    width: 48px; height: 48px; border-radius: 8px;
    overflow: hidden; background: var(--bg-secondary);
}
.profile-page.profile-redesign .profile-native-playlist-cover img { width: 100%; height: 100%; object-fit: cover; }
/* Playlists open the existing Music page. Only the account's pinned-track
   picker remains here, inside the existing profile modal lifecycle. */
.profile-music-picker .profile-playlists-pin-picker > p { margin: 0 0 16px; font-size: 13px; line-height: 1.5; color: var(--text-secondary); }
.profile-music-picker .profile-playlists-pin-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin-bottom: 12px; }
.profile-music-picker :is(.profile-playlists-pin-track, .profile-playlists-unpin) {
    display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
    width: 100%; min-width: 0; min-height: 44px; padding: 12px 14px;
    border: 1px solid var(--border); border-radius: 12px; text-align: start; overflow-wrap: anywhere;
    background: var(--bg-tertiary); color: var(--text); font: inherit; cursor: pointer;
}
.profile-music-picker .profile-playlists-pin-track small { color: var(--text-secondary); }
.profile-music-picker :is(.profile-playlists-pin-track, .profile-playlists-unpin):hover { border-color: var(--primary); }
.profile-music-picker :is(.profile-playlists-pin-track, .profile-playlists-unpin):focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
@media (min-width: 1100px) {
    .profile-page.profile-redesign .profile-overview-stack {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(290px, 25%);
        gap: 16px;
        align-items: start;
    }
    .profile-page.profile-redesign .profile-native-aside { display: grid; align-content: start; gap: 14px; }
    .profile-page.profile-redesign .profile-native-aside .profile-strip-tiles { grid-template-columns: repeat(3,minmax(0,1fr)); }
    .profile-page.profile-redesign .profile-native-aside .profile-photo-strip { min-width: 0; }
    .profile-page.profile-redesign .profile-native-aside .profile-strip-tile { height: auto; aspect-ratio: 1; }
    .profile-page.profile-redesign .profile-native-aside .profile-strip-tiles[data-photo-count="1"] .profile-strip-tile { max-height: 200px; }
}
@media (max-width: 600px) {
    .profile-page.profile-redesign .profile-mini-track-slot:not([hidden]) { width: min(100%, 300px); }
}

/* DEALIX Profile Phase 1H: native composition, on top of Phase 1G.
   Scope every rule to the profile; never change the cover, avatar, stories,
   global shell, feed editor, permissions, or the working settings forms. */
.profile-page.profile-redesign.profile-native-polish {
    max-width: none;
    width: 100%;
    min-width: 0;
    margin-inline: 0;
    --profile-native-line: color-mix(in srgb, var(--profile-accent) 12%, var(--profile-line));
    --profile-native-card: linear-gradient(150deg, var(--profile-card), var(--profile-surface));
}
/* Leave the existing album/story components intact; only align their row
   with the already-existing follower and following buttons. */
.profile-page.profile-redesign.profile-native-polish:not(.profile-editor-open) > .profile-social-band {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 16px;
    width: 100%;
    min-width: 0;
    margin-block: 10px 14px;
}
.profile-page.profile-redesign.profile-native-polish .profile-social-band .profile-highlights {
    flex: 1 1 auto; min-width: 0;
}
.profile-page.profile-redesign.profile-native-polish .profile-social-band .profile-navigation-stats {
    flex: 0 0 auto;
    max-width: 100%;
    margin: 0 0 5px;
}
.profile-page.profile-redesign.profile-native-polish .profile-social-band .profile-social-actions {
    border-color: var(--profile-native-line);
    background: var(--profile-native-card);
    box-shadow: 0 2px 10px rgba(0,0,0,.08);
    border-radius: 14px;
}
.profile-page.profile-redesign.profile-native-polish .profile-social-band .profile-social-action {
    min-height: 48px;
    min-width: 120px;
    padding: 8px 14px;
    transition: background .16s ease, color .16s ease;
}
.profile-page.profile-redesign.profile-native-polish .profile-social-band .profile-social-action:hover {
    background: var(--profile-accent-soft);
}
/* Deliberately small user-selected track in the existing info area. */
.profile-page.profile-redesign.profile-native-polish .profile-mini-track {
    border-color: var(--profile-native-line);
    background: color-mix(in srgb, var(--primary) 6%, var(--bg-tertiary));
    box-shadow: inset 0 1px color-mix(in srgb, var(--text) 3%, transparent);
}
.profile-page.profile-redesign.profile-native-polish .profile-mini-track-play {
    min-width: 36px;
    min-height: 36px;
    background: var(--primary-light);
    border-color: color-mix(in srgb, var(--primary) 38%, var(--border));
}
.profile-page.profile-redesign.profile-native-polish .profile-mini-track-unpin:hover {
    color: var(--text);
    background: var(--bg-hover);
}
/* The full original hero spans the entire desktop canvas. Only the area
   BELOW profile navigation becomes a feed + useful media rail. */
.profile-page.profile-redesign.profile-native-polish .profile-overview-stack {
    display: block;
    min-width: 0;
}
.profile-page.profile-redesign.profile-native-polish .profile-main-column {
    display: block;
    min-width: 0;
}
.profile-page.profile-redesign.profile-native-polish .profile-native-aside {
    display: none;
    min-width: 0;
}
.profile-page.profile-redesign.profile-native-polish .profile-native-aside .profile-photo-strip {
    grid-area: auto;
    grid-row: auto;
    grid-column: auto;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}
.profile-page.profile-redesign.profile-native-polish .profile-native-aside .profile-playlists-aside {
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}
.profile-page.profile-redesign.profile-native-polish .profile-native-aside :is(.profile-photo-strip, .profile-playlists-aside) {
    padding: 16px;
    border: 1px solid var(--profile-native-line);
    border-radius: 16px;
    background: var(--profile-native-card);
    box-shadow: 0 5px 22px rgba(0,0,0,.06);
}
.profile-page.profile-redesign.profile-native-polish .profile-native-aside .profile-strip-tiles {
    grid-template-columns: repeat(3,minmax(0,1fr));
    gap: 7px;
    max-width: none;
}
.profile-page.profile-redesign.profile-native-polish .profile-native-aside .profile-strip-tile {
    width: 100%;
    height: auto;
    max-height: none;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 10px;
}
.profile-page.profile-redesign.profile-native-polish .profile-native-aside .profile-strip-tiles[data-photo-count="1"] {
    grid-template-columns: minmax(0,1fr);
}
.profile-page.profile-redesign.profile-native-polish .profile-native-aside .profile-strip-tiles[data-photo-count="1"] .profile-strip-tile {
    aspect-ratio: 16 / 10;
    height: auto;
    max-height: 210px;
}
.profile-page.profile-redesign.profile-native-polish .profile-native-aside .profile-strip-tiles[data-photo-count="2"] {
    grid-template-columns: repeat(2,minmax(0,1fr));
}
.profile-page.profile-redesign.profile-native-polish .profile-native-aside .profile-strip-tiles[data-photo-count="2"] .profile-strip-tile {
    aspect-ratio: 1;
    height: auto;
}
.profile-page.profile-redesign.profile-native-polish .profile-native-aside .profile-strip-tile img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform .18s ease;
}
.profile-page.profile-redesign.profile-native-polish .profile-native-aside .profile-strip-tile:hover img {
    transform: scale(1.035);
}
.profile-page.profile-redesign.profile-native-polish .profile-native-aside .profile-native-aside-heading {
    margin-bottom: 12px;
}
.profile-page.profile-redesign.profile-native-polish .profile-native-aside .profile-native-playlist-items {
    grid-template-columns: minmax(0,1fr);
    gap: 9px;
}
.profile-page.profile-redesign.profile-native-polish .profile-native-aside .profile-native-playlist-card {
    padding: 8px;
    border-color: var(--profile-native-line);
    border-radius: 12px;
    background: color-mix(in srgb, var(--primary) 3%, var(--bg-tertiary));
    transition: border-color .16s ease, background .16s ease;
}
.profile-page.profile-redesign.profile-native-polish .profile-native-aside .profile-native-playlist-card:hover {
    border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
    background: var(--primary-light);
}
.profile-page.profile-redesign.profile-native-polish .profile-native-aside .profile-native-playlist-cover {
    flex-basis: 52px; width: 52px; height: 52px; border-radius: 9px;
}
/* Do not modify the feed's internal actions, permissions, likes or composer.
   Only match the existing post card surfaces to the profile navigation. */
.profile-page.profile-redesign.profile-native-polish .profile-main-column :is(.feed-post, .feed-post-card) {
    min-width: 0;
    border-radius: 16px;
}
/* No empty photo rail: the existing playlist aside is laid out only when
   the server returned at least one visible public playlist. */
.profile-page.profile-redesign.profile-native-polish .profile-native-aside[hidden] { display: none; }
@media (min-width: 1000px) {
    .profile-page.profile-redesign.profile-native-polish .profile-overview-stack.has-playlists-aside {
        display: grid;
        grid-template-columns: minmax(0,1fr) minmax(300px, min(26vw,375px));
        gap: 18px;
        align-items: start;
    }
    .profile-page.profile-redesign.profile-native-polish .profile-native-aside {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        grid-auto-flow: row;
        align-content: start;
        gap: 14px;
    }
}
@media (max-width: 760px) {
    .profile-page.profile-redesign.profile-native-polish:not(.profile-editor-open) > .profile-social-band {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        margin-block: 8px 12px;
    }
    .profile-page.profile-redesign.profile-native-polish .profile-social-band .profile-highlights {
        flex: none; width: 100%;
    }
    .profile-page.profile-redesign.profile-native-polish .profile-social-band .profile-navigation-stats {
        flex: none; width: 100%; margin: 0;
    }
    .profile-page.profile-redesign.profile-native-polish .profile-social-band .profile-social-actions {
        display: flex; width: 100%;
    }
    .profile-page.profile-redesign.profile-native-polish .profile-social-band .profile-social-action {
        flex: 1 1 50%; min-width: 0;
    }
}
@media (prefers-reduced-motion: reduce) {
    .profile-page.profile-redesign.profile-native-polish :is(.profile-tab-new,.profile-mini-track-play,.profile-native-playlist-card,.profile-strip-tile img) {
        transition: none;
    }
}


/* Phase 1K: followers/following are addressable profile pages, not a second social system. */
.profile-page.profile-social-route .profile-followers-in-page {
    position: relative;
    inset: auto;
    z-index: auto;
    width: 100%;
    height: auto;
    min-height: 0;
    overflow: visible;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}
.profile-page.profile-social-route .profile-followers-panel {
    width: 100%;
    height: auto;
    min-height: 0;
    max-height: none;
    border-radius: 18px !important;
    box-shadow: none;
}
.profile-page.profile-social-route .profile-followers-list {
    flex: none;
    overflow: visible;
    min-height: 0;
}
.profile-page.profile-social-route .profile-social-list-summary {
    width: min(100%, 1120px);
    box-sizing: border-box;
    margin: 0 auto;
    padding: 14px clamp(18px, 4vw, 52px) 4px;
    color: var(--text-muted);
}
.profile-page.profile-social-route .profile-followers-tabs {
    width: min(100%, 1120px);
    margin-inline: auto;
}
@media (max-width: 768px) {
    .profile-page.profile-social-route .profile-followers-panel { border-radius: 0 !important; }
}

/* DEALIX Phase 1L — native section navigation. Scoped: no profile cover,
   desktop widths, story rail, feed post or settings geometry changes. */
.feed-page .feed-tabs,
.profile-page.profile-redesign .profile-native-tabs {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,.06);
}
.feed-page .feed-tab,
.profile-page.profile-redesign .profile-native-tab { -webkit-tap-highlight-color: transparent; transition: background .16s ease, color .16s ease; }
.profile-page.profile-redesign .profile-native-tabs {
    display: flex;
    gap: 0;
    width: 100%;
    margin: 0 0 16px;
    align-items: stretch;
    min-width: 0;
}
.profile-page.profile-redesign .profile-native-tab {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    min-height: 51px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 8px;
    background: transparent;
    color: var(--text-muted);
    text-decoration: none;
    font-size: clamp(12px, 3vw, 15px);
    font-weight: 650;
    text-align: center;
}
.profile-page.profile-redesign .profile-native-tab:hover { background: var(--bg-hover); }
.profile-page.profile-redesign .profile-native-tab.active { color: var(--text); font-weight: 750; }
.profile-page.profile-redesign .profile-native-tab.active::after {
    content: ""; position: absolute; bottom: 0; left: 18%; width: 64%;
    height: 4px; border-radius: 999px; background: var(--profile-accent);
}
.profile-page.profile-redesign .profile-native-tab:focus-visible { outline: 2px solid var(--profile-accent); outline-offset: -2px; }
.profile-page.profile-redesign .profile-gallery-route-back {
    flex: 0 0 48px; width: 48px; height: 48px;
    border-radius: 50%; background: var(--bg-card); border: 1px solid var(--border);
}
.profile-page.profile-redesign .profile-gallery-route-back svg { width: 27px; height: 27px; }
.profile-page.profile-redesign .profile-followers-panel .profile-followers-list,
.profile-page.profile-redesign .profile-gallery-route-content { min-width: 0; }
.profile-page.profile-redesign .profile-gallery-album-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
    gap: 12px; padding: 4px 0 28px;
}
.profile-page.profile-redesign .profile-gallery-album-grid .profile-photo-album-card {
    display: grid; gap: 6px; min-width: 0; padding: 8px;
    border-radius: 15px; border: 1px solid var(--border); background: var(--bg-card);
    text-align: start; color: var(--text); cursor: pointer;
}
.profile-page.profile-redesign .profile-gallery-album-image {
    display: block; width: 100%; aspect-ratio: 1; overflow: hidden;
    border-radius: 12px; background: var(--bg-tertiary);
}
.profile-page.profile-redesign .profile-gallery-album-image img { width: 100%; height: 100%; object-fit: cover; }
.profile-page.profile-redesign .profile-gallery-album-empty { display: grid; place-items: center; width: 100%; height: 100%; color: var(--text-muted); font-size: 40px; }
.profile-page.profile-redesign .profile-gallery-album-grid :is(strong,small) { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-inline: 3px; }
.profile-page.profile-redesign .profile-gallery-album-grid small { color: var(--text-secondary); }
.profile-page.profile-redesign .profile-photo-feed-list {
    display: grid; gap: 16px; width: min(100%, 740px); margin: 0 auto 24px;
}
.profile-page.profile-redesign .profile-photo-feed-card {
    min-width: 0; overflow: hidden; border-radius: 20px;
    border: 1px solid var(--profile-line); background: var(--profile-card); color: var(--text);
}
/* Phase 1P: keep the Instagram-like photo stream inside the existing gallery.
   Local selectors only; the profile cover, feed composer and global tokens stay as-is. */
.profile-page.profile-redesign .profile-photo-feed-shell { gap: 12px; }
.profile-page.profile-redesign .profile-photo-feed-toolbar {
    flex-direction: row; align-items: center; justify-content: space-between;
    min-height: 44px; gap: 10px; padding: 0 2px;
}
.profile-page.profile-redesign .profile-photo-feed-toolbar p {
    margin: 0; color: var(--text-secondary); font-size: 13px; font-weight: 600;
}
.profile-page.profile-redesign .profile-photo-feed-toolbar h3 {
    font-size: 15px; line-height: 1.3;
}
.profile-page.profile-redesign .profile-photo-feed-toolbar .btn {
    width: auto; min-height: 40px; padding: 8px 15px;
    flex: 0 0 auto; justify-content: center; border-radius: 999px;
}
.profile-page.profile-redesign .profile-photo-feed-author {
    display: flex; align-items: center; min-height: 66px; padding: 11px 16px;
}
.profile-page.profile-redesign .profile-photo-feed-author-link {
    display: inline-flex; align-items: center; gap: 11px; min-width: 0;
    color: var(--text); text-decoration: none; border-radius: 12px;
}
.profile-page.profile-redesign .profile-photo-feed-author-avatar {
    display: grid; place-items: center; flex: 0 0 40px;
    width: 40px; height: 40px; border-radius: 50%; overflow: hidden;
    background: var(--bg-tertiary); color: var(--text); font-weight: 750;
}
.profile-page.profile-redesign .profile-photo-feed-author-avatar img,
.profile-page.profile-redesign .profile-photo-feed-comment-avatar img {
    display: block; width: 100%; height: 100%; object-fit: cover;
}
.profile-page.profile-redesign .profile-photo-feed-author-meta { display: grid; gap: 2px; min-width: 0; }
.profile-page.profile-redesign .profile-photo-feed-author-meta strong {
    display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-size: 14px; font-weight: 750;
}
.profile-page.profile-redesign .profile-photo-feed-author-meta time {
    font-size: 12px; font-weight: 400; color: var(--text-secondary);
}
.profile-page.profile-redesign .profile-photo-feed-media {
    display: block; width: 100%; border: 0; padding: 0; background: var(--bg-tertiary);
    /* Reserve a stable viewport before slow/lazy photos decode. */
    border-radius: 0; height: auto; aspect-ratio: 4 / 5;
    max-height: 74vh; max-height: 74svh; overflow: hidden;
}
.profile-page.profile-redesign .profile-photo-feed-media img {
    display: block; width: 100%; height: 100%; max-height: none;
    object-fit: contain; background: var(--bg-tertiary);
}
.profile-page.profile-redesign .profile-photo-feed-actions {
    display: flex; align-items: center; gap: 4px; padding: 5px 10px 0;
}
.profile-page.profile-redesign .profile-photo-feed-actions button,
.profile-page.profile-redesign .profile-photo-feed-all {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 7px; min-height: 44px; border: 0; background: transparent;
    color: var(--text); padding: 7px 10px; font: inherit;
    cursor: pointer; border-radius: 11px;
}
.profile-page.profile-redesign .profile-photo-feed-actions button svg {
    flex: 0 0 22px; width: 22px; height: 22px;
}
.profile-page.profile-redesign .profile-photo-feed-actions button[aria-pressed="true"] { color: #e84f74; }
.profile-page.profile-redesign .profile-photo-feed-like[aria-pressed="true"] svg { fill: currentColor; }
.profile-page.profile-redesign .profile-photo-feed-actions button:hover,
.profile-page.profile-redesign .profile-photo-feed-all:hover { background: var(--bg-hover); }
.profile-page.profile-redesign .profile-photo-feed-author-link:focus-visible,
.profile-page.profile-redesign .profile-photo-feed-actions button:focus-visible,
.profile-page.profile-redesign .profile-photo-feed-all:focus-visible,
.profile-page.profile-redesign .profile-photo-feed-compose :is(input,button):focus-visible {
    outline: 2px solid var(--primary); outline-offset: 2px;
}
.profile-page.profile-redesign .profile-photo-feed-actions .profile-photo-feed-open-all {
    margin-inline-start: auto; min-width: 0;
    font-size: 12px; color: var(--text-secondary); font-weight: 600;
}
.profile-page.profile-redesign .profile-photo-feed-caption {
    margin: 3px 16px 7px; line-height: 1.5; overflow-wrap: anywhere;
}
.profile-page.profile-redesign .profile-photo-feed-caption strong { font-weight: 750; margin-inline-end: 4px; }
.profile-page.profile-redesign .profile-photo-feed-comments {
    padding: 0 16px 10px; min-height: 26px;
}
.profile-page.profile-redesign .profile-photo-feed-comment {
    display: flex; align-items: flex-start; gap: 9px;
    margin: 8px 0; line-height: 1.45; overflow-wrap: anywhere;
}
.profile-page.profile-redesign .profile-photo-feed-comment-avatar {
    display: grid; place-items: center; flex: 0 0 26px;
    width: 26px; height: 26px; border-radius: 50%; overflow: hidden;
    background: var(--bg-tertiary); color: var(--text-secondary);
    font-size: 11px; font-weight: 750;
}
.profile-page.profile-redesign .profile-photo-feed-comment-text { min-width: 0; flex: 1; padding-top: 2px; }
.profile-page.profile-redesign .profile-photo-feed-comment-actions {
    display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
    margin-top: 3px;
}
.profile-page.profile-redesign .profile-photo-feed-comment-actions button {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 4px; min-height: 28px; border: 0;
    border-radius: 8px; background: transparent;
    color: var(--text-secondary); font: inherit; font-size: 12px;
    cursor: pointer;
}
.profile-page.profile-redesign .profile-photo-feed-comment-actions button:hover { color: var(--text); background: var(--bg-hover); }
.profile-page.profile-redesign .profile-photo-feed-comment-actions button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.profile-page.profile-redesign .profile-photo-feed-comment-actions button.liked { color: #ec5e80; }
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment-actions button {
    min-height: 34px;
    padding: 5px 8px;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment-actions button:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
.profile-page.profile-redesign .profile-photo-feed-comment-actions button:disabled { opacity: .55; cursor: wait; }

.profile-page.profile-redesign .profile-photo-feed-comment b { margin-inline-end: 6px; font-weight: 750; }
.profile-page.profile-redesign .profile-photo-feed-muted,
.profile-page.profile-redesign .profile-photo-feed-loading { font-size: 13px; color: var(--text-secondary); }
.profile-page.profile-redesign .profile-photo-feed-comments .profile-photo-feed-all {
    justify-content: flex-start; min-height: 36px; padding-inline: 0;
    font-size: 13px; color: var(--text-secondary);
}
.profile-page.profile-redesign .profile-photo-feed-compose {
    display: flex; gap: 8px; padding: 11px 14px; border-top: 1px solid var(--border);
}
.profile-page.profile-redesign .profile-photo-feed-compose[hidden] { display: none; }
.profile-page.profile-redesign .profile-photo-feed-compose input {
    min-width: 0; flex: 1; min-height: 44px; border-radius: 12px;
    border: 1px solid var(--profile-line); background: var(--profile-field);
    color: var(--text); padding: 9px 12px; font: inherit;
}
.profile-page.profile-redesign .profile-photo-feed-compose button {
    flex: 0 0 auto; min-height: 44px; padding: 8px 12px;
    border-radius: 12px; border: 0; color: #fff;
    background: var(--profile-action); cursor: pointer;
}
.profile-page.profile-redesign .profile-photo-feed-compose button:disabled { opacity: .6; cursor: wait; }
@media (max-width: 600px) {
    .profile-page.profile-redesign .profile-photo-feed-list { gap: 10px; }
    .profile-page.profile-redesign .profile-photo-feed-card { border-radius: 14px; }
    .profile-page.profile-redesign .profile-gallery-album-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
}
@media (prefers-reduced-motion: reduce) {
    .feed-page .feed-tab,.profile-page.profile-redesign .profile-native-tab { transition: none; }
}
.profile-page.profile-redesign .profile-native-social-tabs .profile-native-tab,
.profile-page.profile-redesign .profile-gallery-native-tabs .profile-native-tab { text-decoration: none; }


/* DEALIX profile gallery visual repair Phase 1AA: scoped to Photos, Albums,
   Playlists only. The main profile, its cover, wall and feed stay untouched. */
.profile-page.profile-redesign.profile-gallery-route .profile-gallery-route-header,
.profile-page.profile-redesign.profile-gallery-route .profile-gallery-native-tabs {
    box-sizing: border-box;
    width: min(100%, 1200px);
    margin-inline: auto;
}
.profile-page.profile-redesign.profile-gallery-route .profile-gallery-route-content {
    box-sizing: border-box;
    width: min(100%, 1200px);
    margin-inline: auto;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-list {
    width: min(100%, 700px);
    gap: 14px;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-media {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    height: auto;
    max-height: none;
    aspect-ratio: auto;
    overflow: hidden;
    line-height: 0;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-media img {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
    max-height: min(76vh, 760px);
    max-height: min(76svh, 760px);
    object-fit: contain;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-card {
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0,0,0,.09);
}
.profile-page.profile-redesign.profile-gallery-route .profile-gallery-album-page .profile-photos-head {
    width: min(100%, 980px);
    box-sizing: border-box;
    margin-inline: auto;
}
.profile-page.profile-redesign.profile-gallery-route .profile-gallery-album-grid {
    width: min(100%, 980px);
    max-width: 980px;
    box-sizing: border-box;
    margin-inline: auto;
    grid-template-columns: repeat(auto-fill, minmax(min(205px, 100%), 1fr));
    gap: 16px;
}
.profile-page.profile-redesign.profile-gallery-route .profile-gallery-album-grid .profile-photo-album-card {
    padding: 9px 9px 13px;
    gap: 9px;
    border-radius: 17px;
    transition: border-color .15s ease, transform .15s ease;
}
.profile-page.profile-redesign.profile-gallery-route .profile-gallery-album-grid .profile-photo-album-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
}
.profile-page.profile-redesign.profile-gallery-route .profile-gallery-album-image {
    border-radius: 12px;
}
.profile-page.profile-redesign.profile-gallery-route .profile-gallery-album-empty {
    display: grid;
    place-items: center;
    background: linear-gradient(145deg, color-mix(in srgb, var(--primary) 15%, var(--bg-tertiary)), var(--bg-tertiary));
    color: var(--text-secondary);
}
.profile-page.profile-redesign.profile-gallery-route .profile-gallery-album-grid strong { font-size: 14px; }
.profile-page.profile-redesign.profile-gallery-route .profile-gallery-album-grid small { font-size: 12px; }
@media (max-width: 600px) {
    .profile-page.profile-redesign.profile-gallery-route .profile-gallery-album-grid {
        grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px;
    }
    .profile-page.profile-redesign.profile-gallery-route .profile-gallery-album-grid .profile-photo-album-card { padding: 6px 6px 10px; }
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-card { border-radius: 12px; }
}
@media (prefers-reduced-motion: reduce) {
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-album-card { transition: none; }
}

/* DEALIX Profile Phase 1AB — gallery and playlist detail refinement.
   Only scoped inner pages; desktop profile hero, wall, stories and global UI unchanged. */
.profile-page.profile-redesign.profile-gallery-route .profile-gallery-album-page {
    box-sizing: border-box;
    width: min(100%, 1120px);
    margin-inline: auto;
    padding: clamp(14px, 2.5vw, 24px);
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--bg-card);
}
.profile-page.profile-redesign.profile-gallery-route .profile-gallery-album-page .profile-photos-head {
    margin: 0 0 14px;
    gap: 12px;
    align-items: center;
}
.profile-page.profile-redesign.profile-gallery-route .profile-gallery-album-page .profile-photos-head h3 {
    margin: 0;
    font-size: clamp(17px, 2vw, 21px);
    line-height: 1.35;
}
.profile-page.profile-redesign.profile-gallery-route .profile-gallery-album-page .profile-gallery-album-grid {
    padding: 0;
    gap: clamp(10px, 1.5vw, 16px);
}
.profile-page.profile-redesign.profile-gallery-route .profile-gallery-album-grid .profile-photo-album-card {
    box-sizing: border-box;
    align-content: start;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.profile-page.profile-redesign.profile-gallery-route .profile-gallery-album-grid .profile-photo-album-card:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
.profile-page.profile-redesign.profile-gallery-route .profile-gallery-empty {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    flex-direction: column;
    justify-content: center;
    min-height: 200px;
    padding: 24px;
    border-radius: 14px;
    border: 1px dashed var(--border);
    background: var(--bg-tertiary);
    text-align: center;
    color: var(--text);
}
.profile-page.profile-redesign.profile-gallery-route .profile-gallery-empty-art {
    display: grid; place-items: center;
    height: 60px; width: 60px;
    margin-bottom: 12px;
    background: var(--bg-card);
    color: var(--primary);
    border-radius: 20px;
    font-size: 32px;
}
.profile-page.profile-redesign.profile-gallery-route .profile-gallery-empty strong { font-size: 16px; }
.profile-page.profile-redesign.profile-gallery-route .profile-gallery-empty p {
    max-width: 320px; margin: 7px 0 0;
    color: var(--text-secondary); line-height: 1.45; font-size: 13px;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-card { contain: layout; }
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-author-link { min-height: 50px; }
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-actions { gap: 6px; }
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-compose { padding-bottom: 12px; }
@media (max-width: 600px) {
    .profile-page.profile-redesign.profile-gallery-route .profile-gallery-album-page {
        border: 0; border-radius: 0; padding: 10px 2px 18px;
        background: transparent;
    }
    .profile-page.profile-redesign.profile-gallery-route .profile-gallery-album-page .profile-gallery-album-grid { gap: 10px; }
    .profile-page.profile-redesign.profile-gallery-route .profile-gallery-empty { min-height: 180px; }
}
/* The album detail retains its filter markup for older profile renderers,
   but does not duplicate the parent album navigation on the native route. */
.profile-page.profile-redesign.profile-gallery-route[data-photo-album-detail="1"] .profile-gallery-album-filters {
    display: none;
}
/* Hide duplicate album chips inside an Albums-origin detail; other filters remain intact. */
.profile-page.profile-redesign.profile-gallery-route[data-photo-album-detail="1"] .profile-gallery-album-filters {
    display: none;
}
/* DEALIX Phase 1AC — Native photo experience (Instagram-like structure).
   Only standalone Photos / Albums and the global PHOTO viewer are touched.
   Existing photo API, upload, ACL and moderation handlers stay unchanged. */
/* Phase 1AD: the old 935px Instagram-profile shelf must not constrain the
   *standalone* photo stream. The main profile shelf retains its old width. */
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-shell {
    width: 100%;
    max-width: none;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-list {
    width: min(100%, 1000px);
    margin-inline: auto;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-card {
    background: var(--profile-card);
    border: 1px solid var(--profile-line);
    border-radius: 18px;
    overflow: hidden;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
    margin: 8px 0;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment-text {
    display: grid;
    align-content: start;
    gap: 3px;
    min-width: 0;
    flex: 1;
    padding-top: 0;
    font-size: 14px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 3px 9px;
    min-width: 0;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment-body {
    display: block;
    min-width: 0;
    line-height: 1.45;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment-avatar:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment-text a {
    font-weight: 750;
    text-decoration: none;
    color: var(--text);
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment-text a:hover {
    text-decoration: underline;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment-meta time {
    display: inline;
    margin: 0;
    font-size: 12px;
    color: var(--text-secondary);
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment-text a:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 3px;
}
.profile-page.profile-redesign.profile-gallery-route .profile-gallery-album-grid {
    width: min(100%, 1120px);
    max-width: 1120px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(12px, 2vw, 20px);
}
.profile-page.profile-redesign.profile-gallery-route .profile-gallery-album-grid .profile-photo-album-card {
    padding: 10px 10px 15px;
    min-width: 0;
    border-radius: 18px;
}
.profile-page.profile-redesign.profile-gallery-route .profile-gallery-album-image {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 13px;
}
.profile-page.profile-redesign.profile-gallery-route .profile-gallery-album-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.profile-page.profile-redesign.profile-gallery-route .profile-gallery-album-grid strong {font-size: 16px;}
.profile-page.profile-redesign.profile-gallery-route .profile-gallery-album-grid small {font-size: 13px;}

/* Enlarged immersive photo with a permanent conversation side column (desktop). */
.profile-photo-viewer.profile-photo-native-viewer {
    position: fixed !important;
    inset: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;
    padding: 66px 18px 14px !important;
    overflow: hidden !important;
    background: rgba(6, 9, 17, .97) !important;
    box-sizing: border-box !important;
}
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-viewer-top {
    position: absolute !important;
    top: 10px !important;
    height: 44px !important;
    left: max(14px, env(safe-area-inset-left)) !important;
    right: max(14px, env(safe-area-inset-right)) !important;
    z-index: 50 !important;
}
.profile-photo-native-shell {
    position: relative;
    width: min(1420px, 100%);
    height: min(920px, calc(100dvh - 84px));
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(340px, 430px);
    border: 1px solid rgba(255,255,255,.13);
    border-radius: 18px;
    overflow: hidden;
    background: #121827;
    box-shadow: 0 20px 80px rgba(0,0,0,.35);
}
.profile-photo-native-stage {
    position: relative;
    min-width: 0;
    min-height: 0;
    background: #06080d;
    display: grid;
    place-items: center;
    overflow: hidden;
    max-width: 100%;
    max-height: 100%;
    isolation: isolate;
}
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-stage .profile-photo-viewer-media {
    position: absolute !important;
    inset: 0 !important;
    min-width: 0 !important;
    min-height: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    display: grid !important;
    place-items: center !important;
    background: #06080d !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
}
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-stage .profile-photo-viewer-media img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    object-position: center !important;
    border-radius: 0 !important;
    background: transparent !important;
}
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-stage .profile-photo-nav {
    position: absolute !important;
    top: 50% !important;
    bottom: auto !important;
    transform: translateY(-50%) !important;
    width: 38px !important;
    height: 48px !important;
    z-index: 2 !important;
    opacity: .85 !important;
    border-radius: 100px !important;
    background: rgba(8,12,22,.60) !important;
    backdrop-filter: blur(8px);
}
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-stage .profile-photo-nav.prev {left: 12px !important;right: auto !important;}
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-stage .profile-photo-nav.next {right: 12px !important;left: auto !important;}
/* The photo popover belongs to its viewer, never the outer app viewport. */
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-shell > .profile-photo-menu {
    position: absolute !important;
    top: 12px !important;
    right: 12px !important;
    left: auto !important;
    bottom: auto !important;
    z-index: 40 !important;
    width: min(286px, calc(100% - 24px)) !important;
    max-height: min(470px, calc(100% - 24px)) !important;
    overflow-y: auto !important;
    border-radius: 16px !important;
    background: rgba(24, 29, 43, .97) !important;
}
.profile-photo-native-side {
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #171d2d;
    color: #f3f5fb;
    border-left: 1px solid rgba(255,255,255,.10);
}
.profile-photo-native-author {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 66px;
    padding: 10px 18px;
    box-sizing: border-box;
    border-bottom: 1px solid rgba(255,255,255,.10);
}
.profile-photo-native-author-link {
    display: inline-flex;
    gap: 12px;
    align-items: center;
    min-width: 0;
    width: 100%;
    min-height: 44px;
    padding: 0;
    background: none;
    border: 0;
    color: inherit;
    text-align: start;
    cursor: pointer;
}
.profile-photo-native-author-link:hover .profile-photo-native-author-info strong { color: #c4b5fd; }
.profile-photo-native-author-link:focus-visible { outline: 2px solid #b6a5ff; outline-offset: 2px; border-radius: 10px; }
.profile-photo-native-author-avatar {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 50%;
    background: #29354b;
    font-weight: 700;
}
.profile-photo-native-author-avatar img {width: 100%;height: 100%;object-fit: cover;}
.profile-photo-native-author-info {display: flex;flex-direction: column;gap: 2px;min-width: 0;}
.profile-photo-native-author-info strong {font-size: 14px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;}
.profile-photo-native-author-info time {font-size: 12px;color: #a4adc0;}
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-caption {
    position: static !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 12px 18px !important;
    margin: 0 !important;
    color: #f3f5fb !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
    font-weight: 450 !important;
    overflow-wrap: anywhere;
    box-sizing: border-box;
    text-align: start !important;
    white-space: normal !important;
    text-overflow: clip !important;
    max-height: none !important;
    height: auto !important;
}
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-caption:empty {display:none !important;}
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-socialbar {
    position: static !important;
    display: flex !important;
    width: 100% !important;
    min-height: 58px !important;
    align-items: center !important;
    justify-content: space-around !important;
    padding: 6px 12px !important;
    margin: 0 !important;
    background: transparent !important;
    border-top: 1px solid rgba(255,255,255,.06) !important;
    border-bottom: 1px solid rgba(255,255,255,.08) !important;
    box-sizing: border-box !important;
    transform: none !important;
}
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-socialbar button {
    width: auto !important;
    flex: 1 !important;
    max-width: 128px !important;
    min-width: 0 !important;
    min-height: 44px !important;
}
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-socialbar button svg {width: 24px !important;height: 24px !important;}
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-liked-summary {
    position: static !important;
    width: 100% !important;
    min-height: 0 !important;
    padding: 6px 18px !important;
    margin: 0 !important;
    font-size: 12px !important;
    background: transparent !important;
    border: 0 !important;
    border-bottom: 1px solid rgba(255,255,255,.07) !important;
}
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-liked-summary.hidden {display:none !important;}
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-comments-panel {
    position: static !important;
    display: flex !important;
    flex: 1 1 auto !important;
    flex-direction: column !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    border: 0 !important;
    background: transparent !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-comments-panel.hidden {display:none !important;}
.profile-photo-native-comments-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex: 0 0 auto;
    padding: 13px 18px;
    font-size: 14px;
    color: #f4f6ff;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.profile-photo-native-comments-heading span {color:#aeb7ce;font-weight:650;}
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-comments-list {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    padding: 14px 18px !important;
    overscroll-behavior: contain;
    align-content: start;
    gap: 8px !important;
}
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-comment {
    grid-template-columns: 36px minmax(0,1fr) !important;
    gap: 10px !important;
    padding: 6px 0 !important;
}
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-comment-avatar {
    width: 36px !important;
    height: 36px !important;
}
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-comment-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 9px;
    width: 100%;
    min-width: 0;
}
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-comment-head time {
    font-size: 12px;
    color: #9ca9c4;
    white-space: nowrap;
}
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-comment-author {font-size: 14px !important;font-weight: 720 !important;}
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-comment p {font-size: 14px !important;line-height: 1.5 !important;overflow-wrap: anywhere;}
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-comment small {font-size: 11px !important;}
/* Phase 1AE: real threaded photo comments, scoped to the native viewer. */
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-comment-content {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
    align-items: flex-start;
    overflow-wrap: anywhere;
}
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-comment-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    min-height: 29px;
}
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-comment-actions button,
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-comment-thread-toggle,
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-comment-more-replies {
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #b6c1d9;
    font: inherit;
    font-size: 13px;
    font-weight: 650;
    padding: 6px 9px;
    cursor: pointer;
    min-height: 36px;
}
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-comment-actions button:hover,
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-comment-thread-toggle:hover,
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-comment-more-replies:hover { background: rgba(183,166,255,.13); color: #f4f6ff; }
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-comment-like {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #c6cee0;
}
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-comment-like > [aria-hidden] {font-size: 20px;line-height: 1;}
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-comment-like.liked {color: #f46a89;}
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-comment-replies {
    width: 100%;
    min-width: 0;
    padding-inline-start: 10px;
    margin: 4px 0;
    border-inline-start: 2px solid rgba(183,166,255,.25);
    box-sizing: border-box;
}
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-comment-replies[hidden] {display:none;}
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-comment.is-reply {
    grid-template-columns: 30px minmax(0,1fr) !important;
    margin: 9px 0;
}
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-comment.is-reply .profile-photo-comment-avatar {width:30px !important;height:30px !important;}
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-comment-avatar {
    border: 0;
    cursor: pointer;
    flex-shrink: 0;
}
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-reply-target {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 9px 16px;
    color: #d5c9ff;
    background: rgba(155,110,255,.13);
    font-size: 12px;
}
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-reply-target.hidden {display:none;}
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-reply-target button {
    min-width: 30px;
    min-height: 30px;
    border-radius: 10px;
    border: 0;
    color: inherit;
    background: rgba(255,255,255,.07);
    cursor: pointer;
    font-size: 20px;
}
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side :is(.profile-photo-comment-actions button,.profile-photo-comment-thread-toggle,.profile-photo-comment-more-replies,.profile-photo-reply-target button):focus-visible {
    outline: 2px solid #b6a5ff;
    outline-offset: 1px;
}
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-comment-form {
    position: static !important;
    flex: 0 0 auto;
    display: grid !important;
    grid-template-columns: 40px minmax(0,1fr) 48px !important;
    gap: 9px !important;
    padding: 12px 14px !important;
    margin: 0 !important;
    background: #171d2d !important;
    border-top: 1px solid rgba(255,255,255,.10) !important;
}
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-comment-form input {
    min-width: 0 !important;
    width: 100% !important;
    padding-inline: 12px !important;
    font-size: 14px !important;
}
.profile-photo-viewer.profile-photo-native-viewer :is(.profile-photo-nav,.profile-photo-socialbar button,.profile-photo-comment-form button,.profile-photo-comment-author):focus-visible {
    outline: 2px solid #b6a5ff !important;
    outline-offset: 2px !important;
}
@media (max-width: 900px) {
    .profile-photo-viewer.profile-photo-native-viewer {
        display: block !important;
        padding: max(54px, env(safe-area-inset-top)) 0 0 !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        overscroll-behavior: contain;
    }
    .profile-photo-native-shell {
        width: 100%;
        height: auto;
        min-height: calc(100svh - 54px);
        display: flex;
        flex-direction: column;
        border: 0;
        border-radius: 0;
        box-shadow: none;
        overflow: visible;
    }
    .profile-photo-native-stage {
        height: min(64svh, 650px);
        min-height: 250px;
        flex: 0 0 auto;
        overflow: hidden;
    }
    .profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-stage .profile-photo-viewer-media {
        height: 100% !important;
        width: 100% !important;
        max-height: none !important;
    }
    .profile-photo-native-side {
        height: auto;
        min-height: 0;
        overflow: visible;
        border: 0;
        width: 100%;
    }
    .profile-photo-native-author {min-height: 60px;padding: 10px 14px;}
    .profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-comments-panel {
        flex: 0 0 auto !important;
        min-height: 200px !important;
        height: auto !important;
        max-height: min(70svh, 670px) !important;
        overflow: hidden !important;
    }
    .profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-comments-list {
        flex: 1 1 auto !important;
        min-height: 90px !important;
        max-height: min(48svh, 470px) !important;
        overflow-y: auto !important;
    }
    .profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-comment-form {
        padding: 10px max(12px, env(safe-area-inset-left)) calc(10px + env(safe-area-inset-bottom)) !important;
    }
    .profile-page.profile-redesign.profile-gallery-route .profile-gallery-album-grid {grid-template-columns: repeat(2, minmax(0, 1fr));gap: 10px;}
    .profile-page.profile-redesign.profile-gallery-route .profile-gallery-album-grid .profile-photo-album-card {padding: 6px 6px 10px;}
}
@media (max-width: 420px) {
    .profile-photo-native-stage {height: min(58svh, 520px);}
    .profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-stage .profile-photo-nav {width: 34px !important;height: 40px !important;}
    .profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-stage .profile-photo-nav.prev {left: 5px !important;}
    .profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-stage .profile-photo-nav.next {right: 5px !important;}
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-card {border-radius: 11px;}
}

/* DEALIX Phase 1AG — photo discussion usability (viewer only).
   Desktop comments must remain visible; mobile editing stays compact. */
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-comment-content {
    gap: 3px !important;
}
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-comment-actions {
    gap: 2px 6px !important;
    min-height: 0 !important;
    margin-top: 1px;
}
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-comment-actions button,
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-comment-thread-toggle,
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-comment-more-replies {
    min-height: 32px !important;
    padding: 4px 7px !important;
    font-size: 12px !important;
    line-height: 1.2 !important;
    font-weight: 600 !important;
}
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-comment-like > [aria-hidden] {
    font-size: 17px !important;
}
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-comment-delete {
    color: #96a3bb !important;
}
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-comment-delete:hover {
    color: #ff8599 !important;
}
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-comments-progress,
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-comments-error {
    padding: 18px 12px;
    text-align: center;
    color: #aeb7ce;
    font-size: 13px;
    line-height: 1.45;
}
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-comments-error button {
    display: block;
    min-height: 36px;
    margin: 10px auto 0;
    padding: 6px 14px;
    border: 1px solid rgba(190,173,255,.32);
    border-radius: 10px;
    background: rgba(177,150,255,.11);
    color: #d5c9ff;
    font: inherit;
    cursor: pointer;
}
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-comments-error button:focus-visible {
    outline: 2px solid #b6a5ff;
    outline-offset: 2px;
}
@media (max-width: 900px) {
    .profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-comments-panel {
        min-height: 0 !important;
        max-height: min(65svh, 560px) !important;
    }
    .profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-comments-list {
        min-height: 0 !important;
        max-height: min(40svh, 360px) !important;
    }
    .profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-comment {
        gap: 9px !important;
        padding: 4px 0 !important;
    }
}

/* DEALIX Phase 1AI — one-level photo navigation and comment parity.
   These rules are restricted to the standalone photo route / native viewer.
   Main profile, its wall, stories and general modal/window styles stay intact. */
.profile-page.profile-redesign.profile-gallery-route .profile-gallery-route-header.profile-photo-native-nav {
    width: min(100%, 1200px);
    box-sizing: border-box;
    min-height: 58px;
    margin: 0 auto 12px;
    padding: 5px 8px;
    display: flex;
    gap: 10px;
    align-items: center;
    border-radius: 18px;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-native-nav .profile-gallery-route-back {
    width: 44px; height: 44px; flex: 0 0 44px;
    border-radius: 50%;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-native-nav .profile-photo-route-heading {
    position: absolute;
    width: 1px; height: 1px; overflow: hidden;
    clip: rect(0,0,0,0); white-space: nowrap;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-native-nav .profile-gallery-native-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    margin: 0;
    padding: 3px;
    gap: 3px;
    border: 0;
    background: transparent;
    border-radius: 12px;
    overflow: visible;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-native-nav .profile-gallery-native-tabs .profile-native-tab {
    min-width: 0; min-height: 44px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 10px;
    padding: 8px 10px;
    white-space: nowrap;
    text-align: center;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-native-nav .profile-gallery-native-tabs .profile-native-tab:focus-visible {
    outline: 2px solid var(--primary, #9777ff);
    outline-offset: 1px;
}
.profile-page.profile-redesign.profile-gallery-route:dir(rtl) .profile-photo-native-nav .profile-gallery-route-back svg {
    transform: scaleX(-1);
}
/* Viewer composer uses the same lazy emoji picker as chats / music. */
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side { position: relative; }
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-comment-form {
    position: relative !important;
    grid-template-columns: 38px 38px minmax(0, 1fr) 46px !important;
    gap: 7px !important;
}
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-comment-form .profile-photo-comment-emoji {
    display: grid; place-items: center;
    width: 38px; height: 40px;
    border: 1px solid rgba(188,196,218,.2);
    border-radius: 12px;
    background: transparent;
    color: #c9d3e8;
    cursor: pointer;
}
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-comment-emoji:hover,
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-comment-emoji[aria-expanded="true"] {
    color: #fff; background: rgba(147,112,255,.16);
}
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-comment-emoji-popover {
    position: fixed;
    /* The legacy comments panel has z-index:10120; stay above its hit area. */
    z-index: 12000;
    inset-inline: auto;
    bottom: calc(72px + env(safe-area-inset-bottom));
    display: flex; flex-direction: column;
    max-height: min(380px, 55dvh);
    overflow: auto;
    background: var(--bg-modal, #1c2234);
    color: var(--text, #f6f7ff);
    border: 1px solid var(--border, rgba(255,255,255,.18));
    border-radius: 16px;
    box-shadow: 0 16px 36px rgba(0,0,0,.28);
    padding: 8px;
}
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-emoji-close {
    align-self: flex-end;
    min-height: 30px; min-width: 30px;
    background: transparent; border: 0;
    border-radius: 8px; color: inherit; cursor: pointer;
}
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-comment-context-menu {
    display: flex; gap: 3px; flex-wrap: wrap;
    padding: 5px;
    border: 1px solid rgba(183,166,255,.16);
    border-radius: 10px;
    background: rgba(39,45,68,.92);
}
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-comment-context-menu.hidden { display: none; }
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-comment-context-menu button {
    border: 0; border-radius: 8px; background: transparent;
    color: #cad3e6; font: 600 12px/1.25 var(--font-sans, sans-serif);
    min-height: 36px; padding: 7px 10px; cursor: pointer;
}
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-comment-context-menu button:hover { background: rgba(170,147,255,.17); color: white; }
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-comment-reaction-strip {
    display: flex; flex-wrap: wrap; align-items: center; gap: 5px;
    max-width: 100%; margin-top: 2px;
}
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-comment-reactions {
    display: flex; flex-wrap: wrap; gap: 5px;
}
.profile-photo-viewer.profile-photo-native-viewer :is(.profile-photo-comment-reaction-chip,.profile-photo-comment-emoji-add) {
    min-height: 30px; border-radius: 999px;
    border: 1px solid rgba(183,166,255,.23);
    background: rgba(183,166,255,.09);
    color: #dce2f7;
    padding: 4px 9px;
    font: 600 12px/1.3 var(--font-sans, sans-serif);
    cursor: pointer;
}
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-comment-reaction-chip.mine {
    border-color: var(--primary, #9777ff);
    background: rgba(154,116,255,.24);
}
.profile-photo-viewer.profile-photo-native-viewer :is(.profile-photo-comment-emoji,.profile-photo-comment-emoji-add,.profile-photo-comment-context-menu button,.profile-photo-comment-reaction-chip):focus-visible {
    outline: 2px solid var(--primary, #b6a5ff);
    outline-offset: 2px;
}
@media (max-width: 420px) {
    .profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-comment-form {
        grid-template-columns: 36px 36px minmax(0, 1fr) 44px !important;
        gap: 5px !important;
    }
    .profile-page.profile-redesign.profile-gallery-route .profile-gallery-route-header.profile-photo-native-nav {padding: 4px;gap: 4px;}
}
@media (prefers-reduced-motion: reduce) {
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-native-nav .profile-native-tab {transition: none;}
}

/* ACL denial takes precedence over the always-mounted native composer. */
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-comments-panel.comments-locked .profile-photo-comment-form,
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-comments-panel.comments-locked .profile-photo-reply-target,
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-native-side .profile-photo-comments-panel.comments-locked .profile-photo-comment-attach-preview {
    display: none !important;
}

/* Phase 1AI: existing feed photo composer gains the shared DEALIX emoji chooser. */
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-compose { position: relative; }
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-emoji {
    display: inline-grid; place-items: center; padding: 0; flex: 0 0 36px; width: 36px; height: 36px;
    border: 0; border-radius: 50%; background: transparent; color: var(--text-muted, #b8bfcd); cursor: pointer;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-emoji:is(:hover,:focus-visible),
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-emoji[aria-expanded="true"] {
    color: var(--text, #fff); background: rgba(139, 117, 245, .16);
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-emoji-popover {
    position: absolute; z-index: 75; bottom: calc(100% + 8px); inset-inline-start: 0;
    width: min(340px, calc(100vw - 36px)); max-width: 100%; overflow: hidden;
    background: var(--surface-raised, #202538); border: 1px solid rgba(140,150,200,.35);
    border-radius: 16px; box-shadow: 0 12px 36px rgba(0,0,0,.32);
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-emoji-popover .dealix-emoji-picker { max-width: 100%; }

.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-submit-icon { display: none; }
/* Phase 1AL — full discussions live inside the standalone photo feed.
   The gallery media viewer is a separate swipeable image/video surface. */
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-card {
    position: relative;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment-text {
    position: relative;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment.is-reply {
    margin-inline-start: clamp(9px, 4vw, 34px);
    padding-inline-start: 11px;
    border-inline-start: 2px solid var(--border);
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment-media {
    max-width: min(360px, 100%);
    margin-block: 7px;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment-media :is(img, video) {
    display: block;
    max-width: 100%;
    max-height: 280px;
    object-fit: contain;
    border-radius: 12px;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment-menu:not([hidden]) {
    display: grid;
    gap: 3px;
    max-width: min(230px, 100%);
    margin-block: 4px;
    padding: 6px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, .12);
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment-menu button,
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-reactions button,
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-show-replies,
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-older,
.profile-page.profile-redesign.profile-gallery-route [data-photo-feed-replies-more] {
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    cursor: pointer;
    min-height: 34px;
    padding: 5px 9px;
    text-align: start;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment-menu button:hover,
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-reactions button:hover,
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-show-replies:hover,
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-older:hover {
    color: var(--text);
    background: var(--bg-hover);
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-block: 5px;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-reactions button {
    min-height: 32px;
    border: 1px solid var(--border);
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-reactions button.mine {
    border-color: var(--primary);
    color: var(--primary);
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-thread[hidden],
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment-menu[hidden],
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-reply-target[hidden],
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-attachment-preview[hidden] {
    display: none;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-reply-target {
    display: flex;
    gap: 9px;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-secondary);
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-reply-target button {
    border: 0;
    border-radius: 50%;
    min-width: 32px;
    min-height: 32px;
    background: var(--bg-tertiary);
    color: var(--text);
    cursor: pointer;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-compose {
    flex-wrap: wrap;
    align-items: center;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-compose .profile-photo-feed-attach {
    background: transparent;
    color: var(--text);
    padding: 8px;
    min-width: 40px;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-attachment-preview {
    flex-basis: 100%;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment-text > .profile-photo-feed-emoji-popover {
    position: relative;
    inset: auto;
    max-width: 100%;
    margin-block: 6px;
    z-index: 15;
}
.profile-photo-viewer.profile-photo-native-viewer.profile-photo-media-only .profile-photo-native-shell {
    grid-template-columns: minmax(0, 1fr);
    width: min(1540px, 100%);
}
.profile-photo-viewer.profile-photo-native-viewer.profile-photo-media-only .profile-photo-native-side {
    display: none !important;
}
.profile-photo-viewer.profile-photo-native-viewer.profile-photo-media-only .profile-photo-native-stage {
    min-height: 0;
    width: 100%;
}
.profile-photo-viewer.profile-photo-native-viewer.profile-photo-media-only .profile-photo-viewer-media video {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

/* DEALIX Phase 1AM — only the existing gallery media viewer.
   An unavailable previous/next action should not look clickable. */
.profile-photo-viewer.profile-photo-native-viewer.profile-photo-media-only .profile-photo-nav:disabled {
    opacity: .22 !important;
    pointer-events: none !important;
    cursor: default !important;
}
/* Gallery-only media navigation: preserve touch swipes, expose accessible arrows
   on narrow screens despite legacy global photo-viewer hiding rules. */
@media (max-width: 760px) {
    html body .profile-photo-viewer.profile-photo-native-viewer.profile-photo-media-only .profile-photo-native-stage .profile-photo-nav:not(body:has(.feed-page) .feed-post-media-viewer .profile-photo-nav) {
        display: grid !important;
        place-items: center;
    }
}
/* Media and arrow buttons are siblings. Legacy photo CSS elevates media to
   z-index:10010, masking the controls; keep both in the viewer's own stack. */
.profile-photo-viewer.profile-photo-native-viewer.profile-photo-media-only .profile-photo-native-stage .profile-photo-viewer-media {
    z-index: 1 !important;
}
.profile-photo-viewer.profile-photo-native-viewer.profile-photo-media-only .profile-photo-native-stage .profile-photo-nav {
    z-index: 2 !important;
}

@media (max-width: 600px) {
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-card {
        border-radius: 12px;
    }
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-compose {
        gap: 4px;
        padding-inline: 8px;
    }
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-compose input[name="body"] {
        min-width: 80px;
    }
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment-actions {
        gap: 2px;
    }
}

@media (max-width: 600px) {
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-compose .profile-photo-feed-submit {
        width: 44px;
        min-width: 44px;
        height: 44px;
        padding: 0;
        border-radius: 14px;
    }
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-submit-label { display: none; }
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-submit-icon { display: block; }
}


/* DEALIX Profile Phase 1AN — the native photo feed, not the media viewer.
   At a genuinely wide GALLERY content width, make conversation a dedicated
   right-hand pane. Keep the existing DOM/actions and stacked mobile layout. */
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-list {
    width: min(100%, 1120px);
    /* Use the actual available feed width, not the full browser width: the
       app may have a navigation sidebar or a reduced desktop window. */
    container-type: inline-size;
    container-name: dealix-photo-feed;
}
@container dealix-photo-feed (min-width: 780px) {
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-card {
        display: grid;
        grid-template-columns: minmax(0, 1.55fr) minmax(310px, .95fr);
        grid-template-rows: auto auto auto minmax(0, 1fr) auto auto;
        height: clamp(480px, 78svh, 780px);
        align-items: stretch;
    }
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-card > .profile-photo-feed-author {
        grid-column: 1 / -1;
        grid-row: 1;
        min-height: 64px;
        padding-block: 7px;
        border-bottom: 1px solid var(--border);
    }
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-card > .profile-publication-carousel {
        grid-column: 1;
        grid-row: 2 / 7;
        align-self: stretch;
        width: 100%;
        min-width: 0;
        min-height: 0;
        height: 100%;
        max-height: none;
        aspect-ratio: auto;
        border-inline-end: 1px solid var(--border);
        border-radius: 0;
        background: var(--bg-tertiary);
        display: flex;
        flex-direction: column;
    }
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-card > .profile-publication-carousel .profile-publication-stage {
        flex: 1;
        height: 0;
        min-height: 0;
        max-height: none;
        aspect-ratio: auto;
    }
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-card > .profile-publication-carousel .profile-publication-dots {
        flex: 0 0 auto;
    }
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-card > .profile-photo-feed-actions,
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-card > .profile-photo-feed-caption,
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-card > .profile-photo-feed-comments,
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-card > .profile-photo-feed-reply-target,
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-card > .profile-photo-feed-compose {
        grid-column: 2;
        min-width: 0;
    }
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-card > .profile-photo-feed-actions {
        grid-row: 2;
        padding: 9px 10px 4px;
    }
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-card > .profile-photo-feed-caption {
        grid-row: 3;
        max-height: 100px;
        overflow-y: auto;
        margin-block: 4px 7px;
    }
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-card > .profile-photo-feed-comments {
        grid-row: 4;
        min-height: 0;
        overflow-y: auto;
        overscroll-behavior-y: contain;
        padding-block: 3px 12px;
        scrollbar-gutter: stable;
    }
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-card > .profile-photo-feed-reply-target {
        grid-row: 5;
    }
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-card > .profile-photo-feed-compose {
        grid-row: 6;
        align-self: end;
        padding: 10px 10px 12px;
        background: var(--profile-card);
    }
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-card > .profile-photo-feed-compose input[name="body"] {
        min-width: 0;
    }
    /* A narrow conversation sidebar must prioritize its input over a long
       send-button label; the existing accessible label stays on the button. */
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-card .profile-photo-feed-submit {
        display: grid;
        place-items: center;
        width: 44px;
        height: 44px;
        flex: 0 0 44px;
        padding: 0;
        border-radius: 13px;
    }
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-card .profile-photo-feed-submit-label {
        display: none;
    }
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-card .profile-photo-feed-submit-icon {
        display: block;
    }
}

/* DEALIX Phase 1AO — premium native mobile media feed (scoped to the standalone
   Photos route). No Instagram branding, no global design-token override. */
.profile-page.profile-redesign .profile-photo-tile .profile-photo-inline-video,
.profile-page.profile-redesign .profile-gallery-album-image .profile-photo-inline-video,
.profile-page.profile-redesign .profile-highlight-ring .profile-photo-inline-video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-media .profile-photo-inline-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #101116;
}
.profile-page.profile-redesign .profile-photo-tile {
    position: relative;
}
.profile-page.profile-redesign .profile-photo-video-marker {
    position: absolute;
    inset-inline-end: 12px;
    inset-block-start: 12px;
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: rgba(12, 14, 22, .68);
    border: 1px solid rgba(255, 255, 255, .18);
    pointer-events: none;
}
.profile-page.profile-redesign .profile-photo-video-marker svg {
    width: 19px;
    height: 19px;
}
@container dealix-photo-feed (min-width: 780px) {
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-card > .profile-photo-feed-media .profile-photo-inline-video {
        width: 100%;
        height: 100%;
        max-width: 100%;
        max-height: none;
        object-fit: contain;
    }
}
@media (max-width: 760px) {
    /* Remove inherited page padding only while the standalone photo route is
       active; profile dashboard, financial pages, and the global Feed are safe. */
    html body #main-content:has(.profile-page.profile-gallery-route) {
        padding-inline: 0 !important;
        max-width: 100% !important;
    }
    html body .profile-page.profile-redesign.profile-gallery-route {
        width: 100%;
        max-width: 100%;
        margin-inline: 0;
        padding-inline: 0 !important;
    }
    html body .profile-page.profile-redesign.profile-gallery-route :is(.profile-gallery-route-content, #tab-photos, .profile-photo-feed-shell, .profile-photo-feed-list) {
        box-sizing: border-box;
        width: 100%;
        max-width: 100%;
        padding-inline: 0;
        margin-inline: 0;
    }
    .profile-page.profile-redesign.profile-gallery-route .profile-gallery-route-header.profile-photo-native-nav {
        margin-inline: 0;
        padding-inline: 12px;
        border-radius: 0;
    }
    .profile-page.profile-redesign.profile-gallery-route .profile-gallery-album-filters {
        padding-inline: 12px;
    }
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-toolbar {
        box-sizing: border-box;
        padding-inline: 14px;
        margin: 0;
    }
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-list {
        gap: 10px;
    }
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-card {
        box-sizing: border-box;
        width: 100%;
        max-width: 100%;
        border-inline: 0;
        border-radius: 0;
        box-shadow: none;
        contain: layout;
        background: var(--profile-card);
    }
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-author {
        box-sizing: border-box;
        padding: 7px 14px;
        min-height: 56px;
    }
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-author-link {
        min-height: 44px;
        gap: 9px;
    }
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-author-avatar {
        width: 36px;
        height: 36px;
        flex-basis: 36px;
    }
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-media {
        display: block;
        box-sizing: border-box;
        width: 100%;
        max-width: 100%;
        aspect-ratio: 4 / 5;
        height: auto;
        max-height: 76svh;
        padding: 0;
        border: 0;
        border-radius: 0;
        background: var(--bg-tertiary);
        overflow: hidden;
        touch-action: manipulation;
    }
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-media :is(img,video) {
        display: block;
        width: 100%;
        height: 100%;
        max-width: 100%;
        max-height: none;
        object-fit: contain;
    }
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-actions {
        padding: 3px 7px 1px;
        gap: 2px;
    }
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-actions button {
        min-width: 44px;
        min-height: 44px;
        padding: 6px 8px;
        border-radius: 12px;
    }
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-actions .profile-photo-feed-open-all {
        font-size: 12px;
        min-width: 0;
        flex: 0 1 auto;
        text-align: end;
    }
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-caption {
        margin: 2px 14px 7px;
        font-size: 14px;
        line-height: 1.45;
    }
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comments {
        box-sizing: border-box;
        width: 100%;
        min-width: 0;
        padding: 1px 14px 9px;
    }
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment {
        margin-block: 6px;
        gap: 8px;
    }
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment-avatar {
        width: 29px;
        height: 29px;
        flex: 0 0 29px;
    }
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment-text {
        font-size: 13px;
        line-height: 1.48;
    }
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment-actions button {
        min-height: 32px;
        padding: 3px 6px;
    }
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-reply-target {
        margin-inline: 14px;
    }
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-compose {
        box-sizing: border-box;
        width: 100%;
        gap: 5px;
        align-items: center;
        padding: 9px 10px max(10px, env(safe-area-inset-bottom));
        border-top: 1px solid var(--border);
    }
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-compose input[name="body"] {
        min-width: 0;
        height: 44px;
        min-height: 44px;
        border-radius: 999px;
        padding-inline: 12px;
    }
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-compose :is(.profile-photo-feed-emoji,.profile-photo-feed-attach) {
        display: grid;
        place-items: center;
        flex: 0 0 37px;
        width: 37px;
        height: 44px;
        min-height: 44px;
        padding: 0;
        border-radius: 12px;
        color: var(--text-secondary);
        background: transparent;
    }
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-compose .profile-photo-feed-submit {
        display: grid;
        place-items: center;
        flex: 0 0 44px;
        min-width: 44px;
        height: 44px;
        padding: 0;
        border-radius: 50%;
    }
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-submit-label { display: none; }
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-submit-icon { display: block; }
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-media.photo-double-like::after {
        content: '♥';
        position: absolute;
        inset: 0;
        display: grid;
        place-items: center;
        pointer-events: none;
        font-size: clamp(70px, 24vw, 110px);
        color: #fff;
        text-shadow: 0 5px 24px rgba(0,0,0,.4);
        animation: dealix-photo-heart-burst .65s ease-out both;
    }
}
@keyframes dealix-photo-heart-burst {
    0% {opacity: 0; transform: scale(.4);}
    35% {opacity: 1; transform: scale(1.1);}
    100% {opacity: 0; transform: scale(1.4);}
}
@media (prefers-reduced-motion: reduce) {
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-media.photo-double-like::after { animation: none; }
}


/* DEALIX Phase 1AP — premium immersive MEDIA mode. Only the opt-in viewer.
   All comments live in the photo feed; this is NOT a second social feed. */
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-toolbar-actions {
    display: flex; align-items: center; gap: 10px; min-width: 0;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-reels-launch {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 42px; padding: 8px 14px; border-radius: 13px;
    background: color-mix(in srgb, var(--primary) 11%, var(--bg-card));
    color: var(--text); border: 1px solid color-mix(in srgb, var(--primary) 27%, var(--border));
    font-size: 13px; font-weight: 730; cursor: pointer;
    transition: background .16s ease, border-color .16s ease;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-reels-launch svg { width: 20px; height: 20px; flex: 0 0 20px; }
.profile-page.profile-redesign.profile-gallery-route .profile-photo-reels-launch:hover { background: color-mix(in srgb, var(--primary) 19%, var(--bg-card)); }
.profile-page.profile-redesign.profile-gallery-route .profile-photo-reels-launch:focus-visible {
    outline: 2px solid var(--primary); outline-offset: 2px;
}
@media(max-width:420px) {
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-toolbar-actions { gap: 6px; }
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-reels-launch { min-height: 40px; padding: 7px 10px; font-size: 12px; }
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-toolbar-actions #profile-upload-photo-btn { font-size: 12px; padding-inline: 9px; min-width: 0; }
}
.profile-photo-viewer.profile-photo-native-viewer.profile-photo-immersive {
    display: flex !important; align-items: center !important; justify-content: center !important;
    padding: 0 !important; overflow: hidden !important; background: #080c15 !important;
}
.profile-photo-viewer.profile-photo-native-viewer.profile-photo-immersive .profile-photo-native-shell {
    box-sizing: border-box; display: block !important;
    width: min(530px, 100vw) !important; max-width: 100vw !important;
    height: 100dvh !important; max-height: 100dvh !important;
    min-height: 0 !important; border: 1px solid rgba(255,255,255,.12) !important;
    border-radius: 0 !important; background: #05070c !important;
    box-shadow: 0 24px 90px rgba(0,0,0,.45) !important; overflow: hidden !important;
}
.profile-photo-viewer.profile-photo-native-viewer.profile-photo-immersive .profile-photo-native-stage {
    position: relative !important; display: block !important;
    width: 100% !important; height: 100% !important;
    min-height: 0 !important; max-height: none !important;
    background: #05070c !important; overflow: hidden !important;
}
.profile-photo-viewer.profile-photo-native-viewer.profile-photo-immersive .profile-photo-native-stage .profile-photo-viewer-media {
    z-index: 1 !important; inset: 0 !important; background: #05070c !important;
}
.profile-photo-viewer.profile-photo-native-viewer.profile-photo-immersive .profile-photo-native-stage .profile-photo-viewer-media :is(img,video) {
    max-width: 100% !important; max-height: 100% !important;
    width: 100% !important; height: 100% !important;
    object-fit: contain !important; background: #05070c !important;
}
.profile-photo-viewer.profile-photo-native-viewer.profile-photo-immersive .profile-photo-viewer-top {
    position: absolute !important; z-index: 25 !important;
    top: max(10px, env(safe-area-inset-top)) !important;
    left: 10px !important; right: 10px !important; width: auto !important;
    border-radius: 18px; backdrop-filter: blur(15px);
    background: rgba(8,12,22,.52) !important;
}
.profile-photo-viewer.profile-photo-native-viewer.profile-photo-immersive .profile-photo-viewer-top button {
    background: rgba(255,255,255,.08) !important; color: #f8f9fd !important;
}
.profile-photo-viewer.profile-photo-native-viewer.profile-photo-immersive .profile-photo-native-stage .profile-photo-nav {
    display: grid !important; place-items: center !important;
    z-index: 17 !important; left: auto !important; right: 12px !important;
    width: 42px !important; height: 42px !important; transform: none !important;
    background: rgba(12,18,30,.58) !important; border: 1px solid rgba(255,255,255,.16) !important;
    border-radius: 50% !important; backdrop-filter: blur(16px);
}
.profile-photo-viewer.profile-photo-native-viewer.profile-photo-immersive .profile-photo-native-stage .profile-photo-nav.prev {top: 23% !important; bottom: auto !important;}
.profile-photo-viewer.profile-photo-native-viewer.profile-photo-immersive .profile-photo-native-stage .profile-photo-nav.next {top: 31% !important; bottom: auto !important;}
.profile-photo-viewer.profile-photo-native-viewer.profile-photo-immersive .profile-photo-native-stage .profile-photo-nav:disabled {opacity: .25 !important;}
.profile-photo-viewer.profile-photo-native-viewer.profile-photo-immersive .profile-photo-reels-ui {
    position: absolute; z-index: 12; inset: 0; color: #fff;
    pointer-events: none; box-sizing: border-box;
}
.profile-photo-viewer.profile-photo-native-viewer.profile-photo-immersive .profile-photo-reels-info {
    position: absolute; left: max(16px, env(safe-area-inset-left));
    right: 92px; bottom: calc(62px + env(safe-area-inset-bottom));
    display: grid; gap: 7px; pointer-events: none;
    text-shadow: 0 2px 10px rgba(0,0,0,.75);
}
.profile-photo-viewer.profile-photo-native-viewer.profile-photo-immersive .profile-photo-reels-label {
    font-size: 10px; letter-spacing: .14em; font-weight: 800;
    color: #c6d1f1; text-transform: uppercase;
}
.profile-photo-viewer.profile-photo-native-viewer.profile-photo-immersive .profile-photo-reels-author {
    font-size: 16px; font-weight: 800; line-height: 1.2; overflow-wrap: anywhere;
}
.profile-photo-viewer.profile-photo-native-viewer.profile-photo-immersive .profile-photo-reels-caption {
    max-height: 23svh; margin: 0; overflow: hidden; font-size: 13px;
    font-weight: 520; line-height: 1.5; overflow-wrap: anywhere;
}
.profile-photo-viewer.profile-photo-native-viewer.profile-photo-immersive .profile-photo-reels-caption[hidden] {display:none !important;}
.profile-photo-viewer.profile-photo-native-viewer.profile-photo-immersive .profile-photo-reels-actions {
    position: absolute; right: max(14px, env(safe-area-inset-right));
    bottom: calc(83px + env(safe-area-inset-bottom));
    display: flex; flex-direction: column; align-items: center; gap: 13px;
    pointer-events: auto;
}
.profile-photo-viewer.profile-photo-native-viewer.profile-photo-immersive .profile-photo-reels-actions button {
    display: grid; place-items: center; gap: 2px; color: #f9faff;
    width: 52px; min-height: 49px; padding: 8px 5px;
    border: 1px solid rgba(255,255,255,.14); border-radius: 17px;
    background: rgba(8,13,25,.56); backdrop-filter: blur(13px); cursor: pointer;
    font: inherit; font-size: 11px; font-weight: 750;
    text-shadow: 0 2px 7px rgba(0,0,0,.5);
}
.profile-photo-viewer.profile-photo-native-viewer.profile-photo-immersive .profile-photo-reels-actions button svg {width: 25px;height:25px;}
.profile-photo-viewer.profile-photo-native-viewer.profile-photo-immersive .profile-photo-reels-actions .profile-photo-reels-like[aria-pressed="true"] {color: #ff738e;}
.profile-photo-viewer.profile-photo-native-viewer.profile-photo-immersive .profile-photo-reels-actions button:focus-visible,
.profile-photo-viewer.profile-photo-native-viewer.profile-photo-immersive .profile-photo-reels-timeline input:focus-visible {
    outline: 2px solid #c0afff; outline-offset: 2px;
}
.profile-photo-viewer.profile-photo-native-viewer.profile-photo-immersive .profile-photo-reels-actions button[hidden],
.profile-photo-viewer.profile-photo-native-viewer.profile-photo-immersive .profile-photo-reels-timeline[hidden],
.profile-photo-viewer.profile-photo-native-viewer.profile-photo-immersive .profile-photo-reels-error[hidden] {display: none !important;}
.profile-photo-viewer.profile-photo-native-viewer.profile-photo-immersive .profile-photo-reels-timeline {
    position: absolute; bottom: calc(10px + env(safe-area-inset-bottom));
    left: 16px; right: 16px; z-index: 20; pointer-events: auto;
    display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 10px; align-items: center;
}
.profile-photo-viewer.profile-photo-native-viewer.profile-photo-immersive .profile-photo-reels-timeline input {
    width: 100%; margin: 0; height: 25px; accent-color: #b9a5ff; cursor: pointer;
}
.profile-photo-viewer.profile-photo-native-viewer.profile-photo-immersive .profile-photo-reels-clock {
    font-variant-numeric: tabular-nums; font-size: 11px; font-weight: 700;
    color: rgba(255,255,255,.92); text-shadow: 0 2px 7px #000;
}
.profile-photo-viewer.profile-photo-native-viewer.profile-photo-immersive .profile-photo-reels-error {
    position: absolute; bottom: 90px; left: 15px; right: 75px;
    max-width: 390px; border-radius: 14px; padding: 12px;
    background: rgba(90,22,34,.82); color: #fff; font-size: 13px;
}
.profile-photo-viewer.profile-photo-native-viewer.profile-photo-immersive .profile-photo-reels-hint {
    position: absolute; top: 17%; left: 16px; font-size: 11px;
    color: rgba(255,255,255,.74); text-shadow: 0 2px 5px #000;
}
@media(max-width:760px) {
    .profile-photo-viewer.profile-photo-native-viewer.profile-photo-immersive .profile-photo-native-shell {
        width: 100vw !important; border: 0 !important;
    }
}
@media(max-width:375px) {
    .profile-photo-viewer.profile-photo-native-viewer.profile-photo-immersive .profile-photo-reels-actions {gap: 8px;}
    .profile-photo-viewer.profile-photo-native-viewer.profile-photo-immersive .profile-photo-reels-actions button {width: 46px; min-height: 44px; padding: 5px;}
    .profile-photo-viewer.profile-photo-native-viewer.profile-photo-immersive .profile-photo-reels-info {right: 75px;}
}
@media(prefers-reduced-motion:reduce) {
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-reels-launch {transition: none;}
}

/* DEALIX Phase 1AQ — focused photo feed repairs (no global chat overrides).
   + stays beside Reply; the emoji picker is a viewport portal, never a row. */
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment {
    gap: 10px;
    padding-block: 2px 5px;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment-text {
    gap: 5px;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment-meta a {
    font-size: 13px;
    font-weight: 720;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment-body {
    font-size: 13px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
    margin-block: 1px 2px;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment-actions button {
    min-height: 32px;
    border-radius: 9px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 650;
    padding: 5px 8px;
    transition: background .14s ease, color .14s ease;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment-actions .profile-photo-feed-add-reaction {
    display: inline-grid;
    place-items: center;
    min-height: 29px;
    min-width: 29px;
    width: 29px;
    padding: 0;
    border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
    border-radius: 10px;
    background: color-mix(in srgb, var(--primary) 6%, var(--bg-card));
    color: var(--text-secondary);
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment-actions .profile-photo-feed-add-reaction:is(:hover,:focus-visible),
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment-actions .profile-photo-feed-add-reaction[aria-expanded="true"] {
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 13%, var(--bg-card));
    border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-reactions[hidden] { display: none !important; }
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 1px 0 5px;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-reactions button {
    min-height: 28px;
    font-size: 12px;
    border-radius: 999px;
    padding: 4px 9px;
    background: color-mix(in srgb, var(--primary) 5%, var(--bg-card));
}
/* The existing shared emoji picker is styled neutrally ONLY inside this overlay. */
html body .profile-photo-feed-emoji-portal {
    position: fixed !important;
    inset: auto;
    z-index: 13060;
    box-sizing: border-box;
    width: min(348px, calc(100vw - 20px));
    max-width: calc(100vw - 20px);
    max-height: min(392px, calc(100dvh - 24px));
    padding: 10px;
    border: 1px solid color-mix(in srgb, var(--primary) 20%, var(--border));
    border-radius: 18px;
    overflow: hidden;
    color: var(--text);
    background: var(--bg-card, #1c2234);
    box-shadow: 0 20px 60px rgba(0,0,0,.38);
}
html body .profile-photo-feed-emoji-portal .dealix-emoji-picker {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-width: 0;
    max-height: min(370px, calc(100dvh - 48px));
    overflow: hidden;
    gap: 8px;
}
html body .profile-photo-feed-emoji-portal .dealix-emoji-search {
    box-sizing: border-box;
    flex-shrink: 0;
    width: 100%;
    height: 41px;
    min-height: 41px;
    font-size: 14px;
    border-radius: 11px;
    padding-inline: 11px;
}
html body .profile-photo-feed-emoji-portal .dealix-emoji-categories {
    display: flex;
    flex-shrink: 0;
    gap: 4px;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    padding-block: 2px;
    scrollbar-width: thin;
}
html body .profile-photo-feed-emoji-portal .dealix-emoji-category {
    flex: 0 0 34px;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    min-width: 34px;
    min-height: 34px;
    border: 0;
    border-radius: 9px;
    padding: 0;
    color: var(--text-secondary);
    background: transparent;
    box-shadow: none;
}
html body .profile-photo-feed-emoji-portal .dealix-emoji-category[aria-pressed="true"],
html body .profile-photo-feed-emoji-portal .dealix-emoji-category:hover {
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 14%, transparent);
}
html body .profile-photo-feed-emoji-portal .dealix-emoji-category svg { width: 18px; height: 18px; }
html body .profile-photo-feed-emoji-portal .dealix-emoji-heading { font-size: 11px; }
html body .profile-photo-feed-emoji-portal .dealix-emoji-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    min-height: 0;
    max-height: 228px;
    overflow-y: auto;
    padding: 1px;
    gap: 3px;
    align-content: start;
}
html body .profile-photo-feed-emoji-portal .chat-composer-emoji-option {
    width: 100%;
    min-width: 0;
    height: 37px;
    min-height: 37px;
    max-height: 37px;
    border: 0;
    border-radius: 9px;
    padding: 0;
    background: transparent;
    color: var(--text);
    font-size: 23px;
    box-shadow: none;
    line-height: 1;
}
html body .profile-photo-feed-emoji-portal .chat-composer-emoji-option:is(:hover,:focus-visible) {
    background: color-mix(in srgb, var(--primary) 14%, transparent);
    outline: none;
}
html body .profile-photo-feed-emoji-portal .dealix-emoji-glyph {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    line-height: 1;
}
/* A real four-action attachment menu: no pretend deals/music cards. */
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-compose {
    position: relative;
    isolation: isolate;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-attachment-menu[hidden] { display: none !important; }
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-attachment-menu {
    position: absolute;
    inset-inline-start: 8px;
    bottom: calc(100% + 8px);
    z-index: 90;
    box-sizing: border-box;
    display: grid;
    width: min(245px, calc(100vw - 30px));
    gap: 2px;
    padding: 7px;
    border: 1px solid var(--border);
    border-radius: 16px;
    color: var(--text);
    background: var(--bg-card);
    box-shadow: 0 16px 45px rgba(0,0,0,.27);
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-attachment-menu button {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    min-height: 42px;
    padding: 8px 10px;
    border: 0;
    border-radius: 11px;
    font-weight: 620;
    font-size: 13px;
    text-align: start;
    background: transparent;
    color: var(--text);
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-attachment-menu button:hover,
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-attachment-menu button:focus-visible {
    background: color-mix(in srgb, var(--primary) 13%, var(--bg-card));
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-attachment-menu button > span {
    display: inline-grid;
    place-items: center;
    flex: 0 0 25px;
    font-size: 21px;
    font-weight: 500;
    color: var(--primary);
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-attachment-menu button small {
    margin-inline-start: auto;
    font-size: 11px;
    color: var(--text-secondary);
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-attachment-preview[hidden] { display: none !important; }
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-attachment-preview {
    box-sizing: border-box;
    display: flex;
    flex-basis: 100%;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-width: 0;
    padding: 6px;
    gap: 8px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: color-mix(in srgb, var(--primary) 3%, var(--bg-tertiary));
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-attachment-preview .profile-photo-feed-preview-open {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
    min-height: 48px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text);
    font-size: 12px;
    text-align: start;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-preview-open :is(img, video) {
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    border-radius: 9px;
    object-fit: cover;
    background: var(--bg-tertiary);
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-preview-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-attachment-preview .profile-photo-feed-preview-remove {
    display: grid;
    place-items: center;
    flex: 0 0 34px;
    min-width: 34px;
    height: 34px;
    min-height: 34px;
    padding: 0;
    border-radius: 50%;
    background: color-mix(in srgb, var(--text) 7%, transparent);
    color: var(--text);
    font-size: 21px;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment-media {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    max-width: min(330px, 100%);
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment-media .profile-photo-feed-media-preview {
    display: block;
    width: 100%;
    max-width: 100%;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: transparent;
    cursor: zoom-in;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment-media :is(img,video) {
    display: block;
    width: auto;
    max-width: 100%;
    max-height: 260px;
    border-radius: 12px;
    object-fit: contain;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-expand-media {
    position: absolute;
    z-index: 1;
    inset-inline-end: 8px;
    top: 8px;
    display: grid;
    place-items: center;
    width: 32px;
    min-width: 32px;
    height: 32px;
    min-height: 32px;
    border: 1px solid rgba(255,255,255,.22);
    border-radius: 10px;
    background: rgba(7,11,21,.72);
    color: white;
    cursor: pointer;
}
/* Chat-style isolated lightbox used for photo-comment media and local previews. */
html body.profile-comment-media-open { overflow: hidden !important; }
html body .profile-comment-media-viewer {
    position: fixed;
    z-index: 14020;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 16px;
    box-sizing: border-box;
    outline: 0;
}
html body .profile-comment-media-viewer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(4,7,14,.92);
    backdrop-filter: blur(16px);
}
html body .profile-comment-media-viewer-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    width: min(100%, 1140px);
    height: min(90dvh, 960px);
    overflow: hidden;
    border: 1px solid rgba(207,217,245,.16);
    border-radius: 18px;
    background: #0b0d15;
    box-shadow: 0 20px 90px rgba(0,0,0,.4);
    color: #f5f6fc;
}
html body .profile-comment-media-viewer-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex: 0 0 56px;
    min-width: 0;
    padding: 8px 12px 8px 18px;
    border-bottom: 1px solid rgba(255,255,255,.09);
}
html body .profile-comment-media-viewer-title {
    font-size: 13px;
    font-weight: 670;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
html body .profile-comment-media-viewer-tools { display: flex; align-items: center; gap: 6px; }
html body .profile-comment-media-viewer-tools button {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 12px;
    color: #e5e9f9;
    background: rgba(255,255,255,.07);
    font-size: 25px;
    cursor: pointer;
}
html body .profile-comment-media-viewer-tools button:is(:hover,:focus-visible) { background: rgba(255,255,255,.15); }
html body .profile-comment-media-viewer-stage {
    display: grid;
    position: relative;
    flex: 1 1 auto;
    place-items: center;
    min-height: 0;
    overflow: auto;
    padding: 12px;
}
html body .profile-comment-media-viewer-media {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    border-radius: 6px;
    object-fit: contain;
    transition: transform .16s ease;
}
html body .profile-comment-media-viewer-media.is-zoomed { transform: scale(1.8); cursor: zoom-out; }
html body .profile-comment-media-viewer-status { color: #fff; font-size: 13px; }
html body .profile-comment-media-viewer-status[hidden] { display: none !important; }
@media (max-width: 600px) {
    html body .profile-comment-media-viewer { padding: 0; }
    html body .profile-comment-media-viewer-panel {
        width: 100vw;
        height: 100dvh;
        max-width: 100vw;
        border: 0;
        border-radius: 0;
    }
    html body .profile-comment-media-viewer-head {
        padding: max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left));
        flex-basis: auto;
        min-height: 56px;
    }
    html body .profile-comment-media-viewer-stage { padding: 0 0 env(safe-area-inset-bottom); }
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment-actions { gap: 3px; }
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment-actions .profile-photo-feed-add-reaction { width: 30px; height: 30px; }
}
@media (prefers-reduced-motion: reduce) {
    html body .profile-comment-media-viewer-media { transition: none; }
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment-actions button { transition: none; }
}
/* The dropdown is positioned above the inline composer; don't crop it at card edges. */
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-card:has(.profile-photo-feed-attachment-menu:not([hidden])) {
    overflow: visible !important;
    contain: none !important;
    z-index: 40;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-attachment-menu button:focus-visible,
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-attachment-preview button:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}


/* DEALIX Phase 1AR — align photo discussions with native feed controls.
   These selectors do not change chats, normal wall posts or finance modules. */
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment {
    gap: 11px;
    margin-block: 12px;
    overflow: visible;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment-avatar {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    font-size: 14px;
    box-sizing: border-box;
    border: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment-avatar img {object-fit:cover;}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment.is-reply .profile-photo-feed-comment-avatar {
    width: 33px; height: 33px; flex-basis: 33px;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment.is-reply {
    margin-inline-start: clamp(7px, 2.8vw, 22px);
    padding-inline-start: 10px;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment-meta a {font-size: 13px; font-weight: 750;}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment-meta time {font-size: 11px; opacity: .78;}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment-text {gap: 3px;}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment-body {font-size: 13.5px; line-height: 1.42;}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment-actions {
    flex-wrap: nowrap;
    gap: 4px;
    min-height: 32px;
    margin-top: 1px;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment-actions button {
    flex: 0 0 auto;
    padding: 4px 7px;
    min-height: 32px;
    white-space: nowrap;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment-actions .profile-photo-feed-add-reaction {
    display: inline-flex;
    width: 34px;
    height: 34px;
    min-width: 34px;
    min-height: 34px;
    border-radius: 12px;
    padding: 0;
    background: transparent;
    border-color: transparent;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment-actions .profile-photo-feed-add-reaction svg {display:block; flex:0 0 20px;}
/* Popover is in the browser top layer, not in the comment's layout. */
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment-actions {position:relative;}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment-menu:not([hidden]) {
    position: fixed;
    inset: auto;
    margin: 0;
    z-index: 15050;
    display: grid;
    box-sizing: border-box;
    min-width: 175px;
    width: max-content;
    max-width: min(230px, calc(100vw - 16px));
    padding: 5px;
    border-radius: 13px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    box-shadow: 0 12px 35px rgba(0,0,0,.35);
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment-menu button {min-height: 39px; padding: 8px 13px;}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment-menu[hidden] {display:none!important;}
/* Chat emoji engine: use the shared animated single-emoji DOM contract in the
   photo comment only. Undo global chat bubble styles inside this scope. */
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment-body .profile-photo-feed-emoji-message.message {
    all: unset;
    display: inline-block;
    position: relative;
    vertical-align: middle;
    background: transparent;
    color: inherit;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment-body .profile-photo-feed-emoji-message .chat-single-emoji {
    font-size: 34px;
    line-height: 1.1;
    cursor: pointer;
}
@media(max-width: 600px) {
  .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment-avatar { width:36px; height:36px; flex-basis:36px; }
  .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment.is-reply .profile-photo-feed-comment-avatar { width:32px; height:32px; flex-basis:32px; }
  .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment-actions { gap:3px; }
  .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment-actions button { padding-inline:5px; }
}
@media(max-width: 350px) {
  .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment-actions button { font-size:11px; padding-inline:3px; }
  .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment-actions .profile-photo-feed-add-reaction {min-width:30px; width:30px;}
}

.profile-photo-viewer.profile-photo-native-viewer .profile-photo-comment-emoji-add {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    min-width: 36px;
    height: 36px;
    min-height: 36px;
    padding: 0;
}
.profile-photo-viewer.profile-photo-native-viewer .profile-photo-comment-emoji-add svg { flex: 0 0 20px; }

.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-reactions [data-photo-feed-reaction-chip] {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-reaction-glyph {
    display: inline-grid;
    place-items: center;
    width: 21px;
    height: 21px;
    font-size: 17px;
    line-height: 1;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-reaction-count {font-size:12px;font-variant-numeric:tabular-nums;}


/* DEALIX Phase 1AS — profile-only media navigation. The chat viewer is not
   imported or modified: these classes exist only inside the photo lightbox. */
html body .profile-comment-media-viewer-heading {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1 1 auto;
}
html body .profile-comment-media-viewer-counter {
    white-space: nowrap;
    color: rgba(230,235,255,.7);
    font-size: 12px;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
}
html body .profile-comment-media-viewer-counter[hidden],
html body .profile-comment-media-viewer-nav[hidden],
html body .profile-comment-media-viewer-tools button[hidden],
html body .profile-comment-media-viewer-media[hidden] { display: none !important; }
html body .profile-comment-media-viewer-nav {
    position: absolute;
    top: 50%;
    z-index: 3;
    display: grid;
    place-items: center;
    width: 44px;
    height: 52px;
    padding: 0;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 14px;
    transform: translateY(-50%);
    color: #fff;
    background: rgba(10,14,26,.72);
    font-size: 34px;
    line-height: 1;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
html body .profile-comment-media-viewer-stage > img.profile-comment-media-viewer-media { touch-action: pan-y pinch-zoom; }
html body .profile-comment-media-viewer-nav.is-prev { left: 12px; }
html body .profile-comment-media-viewer-nav.is-next { right: 12px; }
html body .profile-comment-media-viewer-nav:disabled { opacity: .22; cursor: default; }
html body .profile-comment-media-viewer-nav:not(:disabled):is(:hover,:focus-visible) { background: rgba(75,85,116,.82); }
@media (max-width: 600px) {
    html body .profile-comment-media-viewer-nav { width: 37px; height: 44px; font-size: 27px; border-radius: 12px; }
    html body .profile-comment-media-viewer-nav.is-prev { left: 6px; }
    html body .profile-comment-media-viewer-nav.is-next { right: 6px; }
    html body .profile-comment-media-viewer-heading { gap: 7px; }
}

/* DEALIX Phase 1AT — isolated profile refinements; no chat or global controls. */
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-actions .profile-photo-feed-like svg {
    width: 28px !important;
    height: 28px !important;
    flex: 0 0 28px !important;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-actions .profile-photo-feed-like {
    gap: 8px;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-comment-actions .profile-photo-feed-comment-like [aria-hidden="true"] {
    display: inline-block;
    font-size: 20px;
    line-height: 1;
}
@media (max-width: 900px) {
    /* Gallery lightbox contains no comment panel. Consume the entire area
       below its top navigation instead of keeping a 64svh image above an
       empty min-height shell (the dark rectangle visible on phones). */
    .profile-photo-viewer.profile-photo-native-viewer.profile-photo-media-only {
        box-sizing: border-box !important;
        padding: max(54px, env(safe-area-inset-top)) 0 env(safe-area-inset-bottom) !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
    }
    .profile-photo-viewer.profile-photo-native-viewer.profile-photo-media-only .profile-photo-native-shell {
        display: flex !important;
        flex: 1 1 auto !important;
        width: 100% !important;
        height: 100% !important;
        min-height: 0 !important;
        max-height: 100% !important;
        border: 0 !important;
        border-radius: 0 !important;
        overflow: hidden !important;
        background: #06080d !important;
    }
    .profile-photo-viewer.profile-photo-native-viewer.profile-photo-media-only .profile-photo-native-stage {
        height: 100% !important;
        min-height: 0 !important;
        max-height: 100% !important;
        flex: 1 1 auto !important;
        background: #06080d !important;
    }
    .profile-photo-viewer.profile-photo-native-viewer.profile-photo-media-only .profile-photo-native-stage .profile-photo-viewer-media {
        width: 100% !important;
        height: 100% !important;
        min-height: 0 !important;
        background: #06080d !important;
    }
}
@media (prefers-reduced-motion: reduce) {
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-emoji-draft-glyph {animation: none !important;}
}

/* DEALIX Phase 1AU — true in-field emoji animation in photo comments.
   Strictly scoped to the profile gallery composer; no chats or feed styling.
   Keep the real input, Unicode value, caret, keyboard and selection intact.
   The shared emoji artwork is painted AT the glyph, not in a popup above it. */
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-compose .profile-photo-feed-emoji-draft {
    position: absolute;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    transform: translateY(-50%);
    line-height: 1;
    color: inherit;
    pointer-events: none;
    user-select: none;
    overflow: visible;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-compose .profile-photo-feed-emoji-draft[hidden] {
    display: none !important;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-compose .profile-photo-feed-emoji-draft-glyph {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    font-size: 28px;
    line-height: 1;
    white-space: nowrap;
}
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-compose input[name="body"].profile-photo-feed-input-has-emoji-art {
    /* This is the real editable text; only its painted glyph is substituted.
       A visible native caret and selection remain at the same coordinates. */
    font-size: 28px;
    color: transparent !important;
    -webkit-text-fill-color: transparent;
    caret-color: var(--text);
}
@media (prefers-reduced-motion: reduce) {
    .profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-compose .profile-photo-feed-emoji-draft-glyph {
        animation: none !important;
    }
}

/* Selecting text must reveal the native selection highlight, not hide it. */
.profile-page.profile-redesign.profile-gallery-route .profile-photo-feed-compose input[name="body"].profile-photo-feed-input-has-emoji-art.profile-photo-feed-input-emoji-selected {
    color: var(--text) !important;
    -webkit-text-fill-color: var(--text) !important;
}

/* DEALIX content cards — source-backed, chat-native previews.  The source is
   always fetched with recipient ACL; this section changes presentation only. */
.message-source-card[data-content-kind="feed_post"],
.message-source-card[data-content-kind="feed_comment"],
.message-source-card[data-content-kind="listing"],
.message-source-card[data-content-kind="music_playlist"],
.message-source-card[data-content-kind="music_comment"],
.message-source-card[data-content-kind="forum_topic"],
.message-source-card[data-content-kind="forum_reply"],
.message-source-card[data-content-kind="p2p_offer"] {
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid var(--border-dark);
    box-shadow: 0 4px 18px rgba(0,0,0,.08);
}
.message-source-card[data-content-kind="feed_post"] .message-source-kind,
.message-source-card[data-content-kind="feed_comment"] .message-source-kind,
.message-source-card[data-content-kind="listing"] .message-source-kind {
    letter-spacing: .035em;
    text-transform: uppercase;
}
.message-source-card .message-source-content { min-width: 0; gap: 9px; }
.message-source-card .message-source-author-row {
    display: flex; align-items: center; gap: 9px; min-width: 0;
}
.message-source-card .message-source-avatar {
    width: 32px; height: 32px; flex: 0 0 32px; display: grid;
    place-items: center; border-radius: 50%; background: var(--bg-hover);
    font-size: 13px; font-weight: 700; overflow: hidden;
}
.message-source-card .message-source-avatar img {
    width: 100%; height: 100%; object-fit: cover; display: block;
}
.message-source-card .message-source-author { min-width: 0; overflow-wrap: anywhere; }
.message-source-card .message-source-title { font-size: 15px; letter-spacing: -.015em; }
.message-source-card .message-source-body {
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 5;
    line-clamp: 5; overflow: hidden; max-height: 8em;
}
.message-source-card .message-source-media-grid {
    display: grid; gap: 3px; width: 100%; min-width: 0;
    border-radius: 13px; overflow: hidden; background: var(--bg);
    grid-template-columns: minmax(0,1fr);
}
.message-source-card .message-source-media-grid.count-2,
.message-source-card .message-source-media-grid.count-3,
.message-source-card .message-source-media-grid.count-4 {
    grid-template-columns: repeat(2,minmax(0,1fr));
}
.message-source-card .message-source-media-grid.count-3 .message-source-media-item:first-child {
    grid-row: span 2;
}
.message-source-card .message-source-media-item {
    position: relative; min-width: 0; min-height: 96px;
    overflow: hidden; background: var(--bg); isolation: isolate;
}
.message-source-card .message-source-media-grid.count-1 .message-source-media-item { min-height: 150px; }
.message-source-card .message-source-media-item img,
.message-source-card .message-source-media-item video {
    display: block; width: 100%; height: 100%; min-height: 96px;
    max-height: 230px; object-fit: cover;
}
.message-source-card .message-source-media-grid.count-3 .message-source-media-item:first-child img,
.message-source-card .message-source-media-grid.count-3 .message-source-media-item:first-child video { height: 100%; }
.message-source-card .message-source-media-count {
    position: absolute; z-index: 1; right: 7px; bottom: 7px;
    padding: 3px 8px; border-radius: 999px;
    color: #fff; background: rgba(0,0,0,.76); pointer-events: none;
}
.message-source-card .message-feed-share-open { width: 100%; }
.message-source-card[data-content-kind="listing"] .message-source-price,
.message-source-card[data-content-kind="p2p_offer"] .message-source-price {
    font-size: 18px; font-variant-numeric: tabular-nums;
}
.message-source-card[data-content-kind="music_track"] {
    border-radius: 18px; overflow: hidden;
}
@media (max-width: 560px) {
    .message-source-card { width: min(340px,82vw) !important; padding: 11px !important; }
    .content-share-preview .message-source-card { width: 100% !important; }
    .message-source-card .message-source-media-item { min-height: 82px; }
    .message-source-card .message-source-media-grid.count-1 .message-source-media-item { min-height: 132px; }
}
@media (prefers-reduced-motion: reduce) {
    .message-source-card, .message-source-card * { animation-duration: 0s !important; transition-duration: 0s !important; }
}

/* DEALIX Content Cards V2 — music share: one full-art message, not a mini music page.
   Scoped to the existing music_track reference; no change to normal chat bubbles,
   server message format, player engine or the finance/escrow surface. */
.message-feed-share-card.message-source-card.message-music-card {
    position: relative;
    isolation: isolate;
    display: block;
    width: min(368px, 82vw);
    max-width: 100%;
    aspect-ratio: 0.93;
    min-height: 0;
    padding: 0;
    gap: 0;
    box-sizing: border-box;
    overflow: hidden;
    border-radius: 22px;
    border: 1px solid rgba(178, 156, 247, .35);
    background: linear-gradient(155deg, #26374a 0%, #0e1829 100%);
    color: #fff;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.16), 0 9px 24px rgba(0,0,0,.15);
}
.message.sent .message-feed-share-card.message-source-card.message-music-card { background: #13253d; border-color: rgba(178,156,247,.38); }
.message-music-card .message-source-kind {
    position: absolute;
    z-index: 4;
    top: 14px;
    left: 14px;
    padding: 6px 11px;
    border-radius: 999px;
    font-size: 12px;
    line-height: 1.25;
    letter-spacing: .01em;
    font-weight: 750;
    color: rgba(255,255,255,.95);
    background: rgba(13,20,31,.55);
    border: 1px solid rgba(255,255,255,.11);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    pointer-events: none;
}
.message-music-card .music-card-content { display: block; position: absolute; inset: 0; min-width: 0; }
.message-music-card .music-card-artwork {
    position: absolute;
    inset: 0;
    z-index: 0;
    display: grid;
    place-items: center;
    color: rgba(255,255,255,.65);
    overflow: hidden;
    pointer-events: none;
}
.message-music-card .music-card-artwork img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    object-fit: cover;
    object-position: center;
}
.message-music-card .music-card-artwork::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(6,11,22,.28) 0%, rgba(6,11,22,.07) 33%, rgba(6,11,22,.25) 56%, rgba(4,8,17,.92) 100%);
    pointer-events: none;
}
.message-music-card .music-card-open-surface {
    position: absolute;
    inset: 0;
    z-index: 1;
    cursor: pointer;
    border-radius: inherit;
}
.message-music-card .music-card-open-surface:focus-visible {
    outline: 3px solid #b9a5ff;
    outline-offset: -5px;
}
.message-music-card .music-card-controls {
    position: absolute;
    z-index: 3;
    top: 47%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 17px;
    opacity: 1;
    transition: opacity .26s ease;
}
.message-music-card .music-card-play,
.message-music-card .music-card-save {
    appearance: none;
    -webkit-appearance: none;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,.5);
    color: #fff;
    background: rgba(26,30,44,.43);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.22), 0 8px 26px rgba(0,0,0,.22);
    cursor: pointer;
    transition: background .2s ease, transform .2s ease, box-shadow .2s ease;
    font: inherit;
    margin: 0;
    padding: 0;
}
.message-music-card .music-card-play { width: 80px; height: 80px; position: relative; --music-card-progress: 0%; }
.message-music-card .music-card-control-icon { display: grid; place-items: center; position: relative; z-index: 1; }
.message-music-card .music-card-control-icon svg { width: 32px; height: 32px; }
.message-music-card .music-card-play-ring {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: conic-gradient(#b89cff var(--music-card-progress), rgba(255,255,255,.15) 0);
    -webkit-mask: radial-gradient(farthest-side,transparent calc(100% - 3px),#000 calc(100% - 2px));
    mask: radial-gradient(farthest-side,transparent calc(100% - 3px),#000 calc(100% - 2px));
    pointer-events: none;
}
.message-music-card .music-card-save { width: 54px; height: 54px; }
.message-music-card .music-card-save.is-saved { background: rgba(77,177,156,.65); }
.message-music-card .music-card-play:hover,
.message-music-card .music-card-save:hover { background: rgba(29,33,48,.75); transform: scale(1.05); }
.message-music-card .music-card-play:focus-visible,
.message-music-card .music-card-save:focus-visible,
.message-music-card .music-card-title-link:focus-visible,
.message-music-card .music-card-artist-link:focus-visible {
    outline: 2px solid #b9a5ff;
    outline-offset: 4px;
}
/* Fade controls during playback. They remain keyboard reachable and return
   immediately on hover/focus; touch users keep them visible. */
.message-music-card[data-music-state="playing"] .music-card-controls { opacity: .16; transition-delay: 1.35s; }
.message-music-card:hover .music-card-controls,
.message-music-card:focus-within .music-card-controls { opacity: 1; transition-delay: 0s; }
.message-music-card .music-card-copy {
    position: absolute;
    z-index: 2;
    left: 17px;
    right: 17px;
    bottom: 18px;
    display: grid;
    justify-items: start;
    gap: 4px;
    color: #fff;
    min-width: 0;
    pointer-events: none;
}
.message-music-card .music-card-title { display: block; max-width: 100%; font-size: clamp(19px, 4.4vw, 26px); font-weight: 850; line-height: 1.16; }
.message-music-card .music-card-title-link {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-width: 100%;
    color: #fff;
    text-decoration: none;
    text-shadow: 0 2px 10px rgba(0,0,0,.55);
    overflow-wrap: anywhere;
    pointer-events: auto;
}
.message-music-card .music-card-artist-link,
.message-music-card .music-card-artist {
    display: block;
    max-width: 100%;
    color: rgba(255,255,255,.86);
    font-weight: 600;
    font-size: 15px;
    line-height: 1.4;
    text-decoration: none;
    text-shadow: 0 2px 8px rgba(0,0,0,.65);
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    pointer-events: auto;
}
.message-music-card .music-card-artist-link:hover { color:#fff; text-decoration: underline; text-underline-offset:3px; }
.message-music-card .music-card-duration,
.message-music-card .music-card-note {
    font-size: 13px;
    line-height: 1.45;
    color: rgba(255,255,255,.72);
    text-shadow: 0 1px 6px rgba(0,0,0,.65);
}
.message-music-card .music-card-placeholder {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: rgba(255,255,255,.48);
    background: linear-gradient(160deg,#273b54,#102034);
}
.message-music-card .music-card-unavailable {
    position: absolute;
    z-index: 3;
    bottom: 20px;
    left: 18px;
    right: 18px;
    display: grid;
    gap: 8px;
    color: #fff;
    font-size: 14px;
}
.message-music-card .music-card-unavailable .message-source-status { color:rgba(255,255,255,.9); }
.message-music-card .music-card-unavailable .message-source-retry {
    width: max-content;
    background: rgba(33,41,60,.75);
    border-color: rgba(255,255,255,.25);
    color: #fff;
}
.content-share-preview .message-feed-share-card.message-source-card.message-music-card {
    width: min(300px, 100%) !important;
    aspect-ratio: 1.6;
    min-height: 0;
}
.content-share-preview .message-music-card .music-card-controls { top: 45%; transform: translate(-50%, -50%) scale(.7); }
.content-share-preview .message-music-card .music-card-copy { bottom: 9px; }
.content-share-preview .message-music-card .music-card-title { font-size: 17px; }
.content-share-preview .message-music-card .music-card-artist-link,
.content-share-preview .message-music-card .music-card-duration { font-size: 11px; }
@media (max-width: 560px) {
    .message-feed-share-card.message-source-card.message-music-card { width: min(350px, 84vw) !important; padding: 0 !important; border-radius: 19px; }
    .message-music-card .music-card-play { width: 68px; height: 68px; }
    .message-music-card .music-card-save { width: 48px; height: 48px; }
    .message-music-card .music-card-controls { gap: 14px; }
    .message-music-card .music-card-copy { left:14px;right:14px;bottom:15px; }
    .message-music-card .music-card-title { font-size: 21px; }
}
@media (hover: none) {
    /* A touch user must not need to discover an invisible affordance. */
    .message-music-card[data-music-state="playing"] .music-card-controls { opacity: .83; transition-delay: 0s; }
    .message-music-card .music-card-play,
    .message-music-card .music-card-save { min-width: 44px; min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
    .message-music-card .music-card-controls,
    .message-music-card .music-card-play,
    .message-music-card .music-card-save { transition: none !important; }
}

/* V4: compact status for verified missing chat-info media (404 only). */
.chat-info-missing-media-details { margin-top: 10px; border: 1px solid var(--border-color, rgba(255,255,255,.12)); border-radius: 14px; padding: 0 11px; background: var(--bg-tertiary, rgba(120,132,170,.08)); }
.chat-info-missing-media-summary { cursor: pointer; padding: 12px 4px; color: var(--text-secondary, #b8bfcc); font-size: 12px; font-weight: 650; min-height: 42px; }
.chat-info-missing-media-summary:focus-visible { outline: 2px solid var(--primary, #76bbcb); outline-offset: 2px; }
.chat-info-missing-media-items { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; padding: 0 0 12px; }
.chat-info-missing-media-item { min-width: 0; aspect-ratio: 1; border-radius: 12px; background: rgba(120,132,170,.12); display: grid; place-items: center; text-align: center; padding: 7px; color: var(--text-secondary, #b8bfcc); font-size: 11px; }
@media (max-width: 460px) { .chat-info-missing-media-items { grid-template-columns: repeat(3, minmax(0,1fr)); } }

/* === CHAT INFO NATIVE 1: shared presentation; keeps all existing chat controllers ===
   Scoped to Info only. Do not change the main chat header/composer/call UI. */
#chat-info-sidebar.chat-info-sidebar {
    isolation: isolate;
}
#chat-info-sidebar .chat-info-header {
    position: absolute !important;
    z-index: 16 !important;
    inset: 0 0 auto !important;
    height: 68px !important;
    min-height: 68px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: max(10px, env(safe-area-inset-top, 0px)) max(14px, env(safe-area-inset-right, 0px)) 8px max(14px, env(safe-area-inset-left, 0px)) !important;
    background: transparent !important;
    border: 0 !important;
    pointer-events: none;
    box-sizing: border-box;
}
#chat-info-sidebar .chat-info-header button {
    position: relative !important;
    pointer-events: auto;
    flex: 0 0 44px;
    width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
    min-width: 44px !important;
    padding: 0 !important;
    display: inline-grid !important;
    place-items: center !important;
    color: #fff !important;
    background: rgba(18,24,38,.45) !important;
    border: 1px solid rgba(255,255,255,.18) !important;
    border-radius: 50% !important;
    box-shadow: 0 6px 24px rgba(0,0,0,.19) !important;
    backdrop-filter: blur(14px) saturate(1.15) !important;
    -webkit-backdrop-filter: blur(14px) saturate(1.15) !important;
    touch-action: manipulation;
}
#chat-info-sidebar .chat-info-header button:hover,
#chat-info-sidebar .chat-info-header button:focus-visible {
    background: rgba(33,41,59,.77) !important;
    color: #fff !important;
}
#chat-info-sidebar .chat-info-header button svg {
    display: block;
    width: 22px;
    height: 22px;
    pointer-events: none;
}
#chat-info-sidebar .chat-info-content {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    padding: 0 0 max(24px, env(safe-area-inset-bottom, 0px)) !important;
    overscroll-behavior-y: contain;
}
#chat-info-sidebar .chat-info-content > .user-info {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    gap: 14px !important;
}
#chat-info-sidebar .chat-info-content > .user-info > :not(.user-info-cover) {
    width: calc(100% - 32px) !important;
    max-width: 760px !important;
    min-width: 0;
    box-sizing: border-box;
    margin-inline: auto !important;
}
#chat-info-sidebar .user-info-cover {
    box-sizing: border-box;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: max(80px, calc(66px + env(safe-area-inset-top, 0px))) 18px 20px !important;
    border-radius: 0 0 20px 20px;
}
#chat-info-sidebar .user-info-cover.is-avatar-expanded,
#group-members-panel.group-info-panel .group-info-cover.is-avatar-expanded {
    width: 100% !important;
    max-width: none !important;
    min-height: clamp(390px, 68vw, 560px) !important;
    margin: 0 !important;
    padding: 190px 18px 20px !important;
    border: 0 !important;
    border-radius: 0 !important;
    overflow: visible !important;
}
#chat-info-sidebar .user-info-cover.is-avatar-expanded .user-info-avatar-open,
#group-members-panel.group-info-panel .group-info-cover.is-avatar-expanded .group-info-avatar {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    overflow: hidden !important;
}
#chat-info-sidebar .user-info-cover.is-avatar-expanded .user-info-avatar-open img,
#group-members-panel.group-info-panel .group-info-cover.is-avatar-expanded .group-info-avatar img {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    object-fit: cover !important;
    object-position: center !important;
    border-radius: 0 !important;
}
#chat-info-sidebar .user-info-cover.is-avatar-expanded::after,
#group-members-panel.group-info-panel .group-info-cover.is-avatar-expanded::after {
    background: linear-gradient(180deg, rgba(0,0,0,.34) 0%, transparent 30%, rgba(0,0,0,.18) 53%, rgba(0,0,0,.83) 100%) !important;
}
#chat-info-sidebar .user-info-cover.is-avatar-expanded .user-info-name,
#group-members-panel.group-info-panel .group-info-cover.is-avatar-expanded .group-members-title,
#group-members-panel.group-info-panel .group-info-cover.is-avatar-expanded .group-members-subtitle {
    width: 100%;
    margin-inline: 0 !important;
    text-align: start !important;
    text-shadow: 0 1px 10px rgba(0,0,0,.55);
}
#chat-info-sidebar .user-info-cover.is-avatar-expanded .chat-info-avatar-collapse {
    top: max(72px, calc(60px + env(safe-area-inset-top, 0px)));
    right: 14px;
}
#group-members-panel.group-info-panel .group-info-cover.is-avatar-expanded .chat-info-avatar-collapse {
    top: max(70px, calc(58px + env(safe-area-inset-top, 0px))) !important;
    right: 14px !important;
    left: auto !important;
}
#group-members-panel.group-info-panel .group-info-cover.is-avatar-expanded .chat-info-avatar-edit {
    top: max(70px, calc(58px + env(safe-area-inset-top, 0px))) !important;
    right: 68px !important;
    left: auto !important;
}
#chat-info-sidebar .is-avatar-expanded .chat-info-avatar-collapse,
#group-members-panel.group-info-panel .is-avatar-expanded .chat-info-avatar-collapse,
#group-members-panel.group-info-panel .is-avatar-expanded .chat-info-avatar-edit {
    color: #fff !important;
    background: rgba(18,24,38,.48) !important;
    border-color: rgba(255,255,255,.24) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
/* Group actions: back left, global menu always right; settings subview gets its own back. */
html body #group-members-panel.group-info-panel .group-info-more {
    top: max(12px, env(safe-area-inset-top, 0px)) !important;
    right: max(14px, env(safe-area-inset-right, 0px)) !important;
    left: auto !important;
    z-index: 14 !important;
}
html body #group-members-panel.group-info-panel .group-members-close {
    top: max(12px, env(safe-area-inset-top, 0px)) !important;
    left: max(14px, env(safe-area-inset-left, 0px)) !important;
    right: auto !important;
    z-index: 14 !important;
    width: 44px !important;
    height: 44px !important;
    background: rgba(18,24,38,.45) !important;
}
html body #group-members-panel.group-info-panel .group-members-close svg {
    width: 22px !important;
    height: 22px !important;
    stroke-width: 2 !important;
}
html body #group-members-panel.group-info-panel .group-info-more-menu {
    top: max(66px, calc(54px + env(safe-area-inset-top, 0px))) !important;
    right: max(14px, env(safe-area-inset-right, 0px)) !important;
    left: auto !important;
    z-index: 15 !important;
}
#group-members-panel.group-info-panel.group-info-subview-open .group-members-close {
    display: none !important;
}
#group-members-panel.group-info-panel.group-info-subview-open .group-info-back {
    top: max(12px, env(safe-area-inset-top, 0px)) !important;
    left: max(14px, env(safe-area-inset-left, 0px)) !important;
}
/* Shared action row: existing call controllers, no duplicated capture/AV logic. */
#chat-info-sidebar .chat-info-quick-actions,
#group-members-panel.group-info-panel .chat-info-quick-actions {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 9px !important;
    width: 100% !important;
    max-width: none !important;
}
#chat-info-sidebar .chat-info-quick-action,
#group-members-panel.group-info-panel .chat-info-quick-action {
    min-height: 72px !important;
    padding: 9px 4px 8px !important;
    border-radius: 15px !important;
    background: color-mix(in srgb, var(--bg-card) 88%, transparent) !important;
    color: var(--text) !important;
    border: 1px solid color-mix(in srgb, var(--border) 50%, transparent) !important;
    box-shadow: none !important;
    gap: 5px !important;
}
#chat-info-sidebar .user-info-cover.is-avatar-expanded .chat-info-quick-action,
#group-members-panel.group-info-panel .group-info-cover.is-avatar-expanded .chat-info-quick-action {
    background: rgba(14,20,34,.42) !important;
    color: #fff !important;
    border-color: rgba(255,255,255,.21) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
#chat-info-sidebar .chat-info-quick-action-label,
#group-members-panel.group-info-panel .chat-info-quick-action-label {
    font-size: clamp(11px, 2.75vw, 13px) !important;
    font-weight: 720 !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
}
#chat-info-sidebar .chat-info-quick-action-icon,
#group-members-panel.group-info-panel .chat-info-quick-action-icon { width: 29px !important; height: 29px !important; min-width: 29px !important; min-height: 29px !important; }
#chat-info-sidebar .chat-info-quick-action-icon svg,
#group-members-panel.group-info-panel .chat-info-quick-action-icon svg { width: 27px !important; height: 27px !important; min-width: 27px !important; min-height: 27px !important; }
#chat-info-sidebar .chat-info-username-actions {
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}
#chat-info-sidebar .user-info-private-handle {
    min-width: 0 !important;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}
#chat-info-sidebar .chat-info-profile-qr {
    width: 44px;
    min-width: 44px;
    height: 44px;
    display: inline-grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
}
#chat-info-sidebar .chat-info-profile-qr:hover,
#chat-info-sidebar .chat-info-profile-qr:focus-visible {
    background: var(--bg-hover);
    color: var(--text);
}
#chat-info-sidebar .chat-info-profile-qr svg { width: 22px; height: 22px; pointer-events: none; }
/* A five-page media navigator must not shrink its labels to 9px on phones.
   The current data source, ACL, media viewer and saved-jump behavior are reused. */
#chat-info-sidebar .chat-info-tabs,
#group-members-panel.group-info-panel .chat-info-tabs {
    position: sticky;
    top: 0;
    z-index: 3;
    display: flex !important;
    align-items: center !important;
    grid-template-columns: none !important;
    gap: 5px !important;
    padding: 6px !important;
    box-sizing: border-box;
    width: 100% !important;
    max-width: none !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
}
#chat-info-sidebar .chat-info-tabs::-webkit-scrollbar,
#group-members-panel.group-info-panel .chat-info-tabs::-webkit-scrollbar { display: none; }
#chat-info-sidebar .chat-info-tab,
#group-members-panel.group-info-panel .chat-info-tab {
    flex: 0 0 auto !important;
    width: auto !important;
    max-width: none !important;
    min-width: max-content !important;
    height: 45px !important;
    min-height: 44px !important;
    padding: 0 15px !important;
    font-size: 14px !important;
    line-height: 1.2 !important;
    letter-spacing: 0 !important;
    border-radius: 13px !important;
    white-space: nowrap !important;
    overflow: visible !important;
    scroll-snap-align: center;
    touch-action: pan-x;
}
#chat-info-sidebar .chat-info-tab[aria-selected="true"],
#group-members-panel.group-info-panel .chat-info-tab[aria-selected="true"] {
    color: var(--text) !important;
    background: color-mix(in srgb, var(--primary) 16%, var(--bg-secondary)) !important;
    font-weight: 780 !important;
}
#chat-info-sidebar .chat-info-tab:focus-visible,
#group-members-panel.group-info-panel .chat-info-tab:focus-visible {
    outline: 2px solid var(--primary) !important;
    outline-offset: -3px;
}
#chat-info-sidebar .chat-info-collections,
#group-members-panel.group-info-panel .chat-info-collections {
    width: calc(100% - 32px) !important;
    max-width: 760px !important;
    margin: 0 auto 16px !important;
    padding: 4px 0 10px !important;
    box-sizing: border-box;
}
#group-members-panel.group-info-panel .chat-info-collections {
    width: calc(100% - 24px) !important;
}
#chat-info-sidebar .chat-info-collection-body,
#group-members-panel.group-info-panel .chat-info-collection-body {
    width: 100% !important;
    max-height: none !important;
    min-height: 145px;
    overflow: visible !important;
    padding: 8px 0 18px !important;
    box-sizing: border-box;
}
#chat-info-sidebar .chat-info-collection-body:focus-visible,
#group-members-panel.group-info-panel .chat-info-collection-body:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}
#group-members-panel.group-info-panel .chat-info-media-grid,
#chat-info-sidebar .chat-info-media-grid {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0,1fr)) !important;
    gap: 5px !important;
}
#group-members-panel.group-info-panel .chat-info-media-card,
#chat-info-sidebar .chat-info-media-card {
    width: 100% !important;
    max-width: none !important;
    aspect-ratio: 1 !important;
    min-width: 0;
    border-radius: 9px !important;
}
#group-members-panel.group-info-panel .chat-info-file-card,
#chat-info-sidebar .chat-info-file-card { min-height: 68px; }
#group-members-panel.group-info-panel .chat-info-file-main,
#chat-info-sidebar .chat-info-file-main { min-width: 0; }
.chat-info-qr-overlay .chat-info-qr-link {
    width: 100%;
    box-sizing: border-box;
    min-height: 40px;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 8px 12px;
    margin: 6px 0 12px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 12px;
}
.chat-info-qr-overlay [data-chat-qr-share][hidden] { display: none !important; }
.chat-info-qr-overlay .profile-qr-status[data-error="1"] { color: var(--danger, #fb7185); }
@media (max-width: 640px) {
    #chat-info-sidebar .chat-info-content > .user-info > :not(.user-info-cover) { width: calc(100% - 24px) !important; }
    #chat-info-sidebar .user-info-cover.is-avatar-expanded,
    #group-members-panel.group-info-panel .group-info-cover.is-avatar-expanded {
        min-height: clamp(370px, 108vw, 540px) !important;
        padding: 164px 12px 16px !important;
    }
    #chat-info-sidebar .chat-info-header { padding-inline: 12px !important; }
    #group-members-panel.group-info-panel .chat-info-collections { width: calc(100% - 24px) !important; }
    #chat-info-sidebar .chat-info-quick-actions,
    #group-members-panel.group-info-panel .chat-info-quick-actions { gap: 6px !important; }
    #chat-info-sidebar .chat-info-quick-action,
    #group-members-panel.group-info-panel .chat-info-quick-action { min-height: 70px !important; padding: 8px 2px 6px !important; }
    #chat-info-sidebar .chat-info-tab,
    #group-members-panel.group-info-panel .chat-info-tab { font-size: 14px !important; min-width: max-content !important; padding: 0 14px !important; }
}
@media (max-width: 360px) {
    #chat-info-sidebar .chat-info-tab,
    #group-members-panel.group-info-panel .chat-info-tab { font-size: 13px !important; padding-inline: 12px !important; }
}
@media (prefers-reduced-motion: reduce) {
    #chat-info-sidebar .chat-info-tabs,
    #group-members-panel.group-info-panel .chat-info-tabs,
    #chat-info-sidebar .chat-info-quick-action,
    #group-members-panel.group-info-panel .chat-info-quick-action { scroll-behavior: auto !important; transition: none !important; }
}

/* === DEALIX CHAT INFO V3: desktop buttons only, 2026-11-18 ===
   Desktop restoration: use the earlier bounded avatar and vertical action tiles.
   Preserve V1 phone/tablet presentation and existing action/permission handlers. */
@media (min-width: 1025px) {
    #chat-info-sidebar .user-info-cover {
        width: min(520px, calc(100% - 32px)) !important;
        max-width: 520px !important;
        margin-inline: auto !important;
        padding-inline: 0 !important;
    }
    #chat-info-sidebar .user-info-cover.is-avatar-expanded,
    #group-members-panel.group-info-panel .group-info-cover.is-avatar-expanded {
        width: min(720px, calc(100% - 40px)) !important;
        max-width: 720px !important;
        min-height: clamp(340px, 45vw, 460px) !important;
        margin: 16px auto 0 !important;
        padding: 200px 18px 18px !important;
        border-radius: 22px !important;
        overflow: hidden !important;
    }
    #chat-info-sidebar .user-info-cover.is-avatar-expanded {
        width: min(520px, calc(100% - 32px)) !important;
        max-width: 520px !important;
        /* The private panel's back/menu bar is outside the cover. */
        margin-top: 68px !important;
    }
    #chat-info-sidebar .user-info-cover.is-avatar-expanded::after,
    #group-members-panel.group-info-panel .group-info-cover.is-avatar-expanded::after {
        background: linear-gradient(180deg, rgba(0,0,0,.08) 30%, rgba(0,0,0,.72) 100%) !important;
    }
    #chat-info-sidebar .chat-info-quick-actions,
    #group-members-panel.group-info-panel .chat-info-quick-actions {
        display: grid !important;
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
        gap: 10px !important;
        width: 100% !important;
        max-width: 560px !important;
        margin-inline: auto !important;
    }
    #chat-info-sidebar .chat-info-quick-action,
    #group-members-panel.group-info-panel .chat-info-quick-action {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        min-width: 0 !important;
        min-height: 80px !important;
        padding: 10px 6px 8px !important;
        border-radius: 20px !important;
        gap: 4px !important;
        color: color-mix(in srgb, var(--info) 78%, #7dd3fc) !important;
        background: color-mix(in srgb, var(--bg-card) 92%, #05070d) !important;
        border-color: transparent !important;
        box-shadow: inset 0 1px 0 rgba(255,255,255,.04), 0 10px 24px rgba(0,0,0,.10) !important;
    }
    #chat-info-sidebar .chat-info-quick-action:hover:not(:disabled),
    #chat-info-sidebar .chat-info-quick-action:focus-visible,
    #group-members-panel.group-info-panel .chat-info-quick-action:hover:not(:disabled),
    #group-members-panel.group-info-panel .chat-info-quick-action:focus-visible {
        color: color-mix(in srgb, var(--info) 86%, #bae6fd) !important;
        background: color-mix(in srgb, var(--bg-card) 82%, var(--primary-light)) !important;
        border-color: color-mix(in srgb, var(--info) 22%, transparent) !important;
    }
    #chat-info-sidebar .chat-info-quick-action-icon,
    #group-members-panel.group-info-panel .chat-info-quick-action-icon {
        width: 34px !important; height: 34px !important;
        min-width: 34px !important; min-height: 34px !important;
    }
    #chat-info-sidebar .chat-info-quick-action-icon svg,
    #group-members-panel.group-info-panel .chat-info-quick-action-icon svg {
        width: 29px !important; height: 29px !important;
        min-width: 29px !important; min-height: 29px !important;
    }
    #chat-info-sidebar .chat-info-quick-action-label,
    #group-members-panel.group-info-panel .chat-info-quick-action-label {
        min-width: 0;
        font-size: 11px !important;
        font-weight: 850 !important;
        text-transform: uppercase !important;
        letter-spacing: .025em !important;
        white-space: nowrap;
    }
    #group-members-panel.group-info-panel .group-info-quick-actions > .chat-info-quick-actions { gap: 6px !important; }
    #group-members-panel.group-info-panel .group-info-quick-actions .chat-info-quick-action {
        min-height: 72px !important;
        padding: 8px 4px 7px !important;
        border-radius: 16px !important;
    }
    #group-members-panel.group-info-panel .group-info-quick-actions .chat-info-quick-action-icon {
        width: 32px !important; height: 32px !important;
        min-width: 32px !important; min-height: 32px !important;
    }
    #group-members-panel.group-info-panel .group-info-quick-actions .chat-info-quick-action-icon svg {
        width: 27px !important; height: 27px !important;
        min-width: 27px !important; min-height: 27px !important;
    }
    body.theme-light #chat-info-sidebar .user-info-cover:not(.is-avatar-expanded) .chat-info-quick-action,
    html[data-theme="light"] #chat-info-sidebar .user-info-cover:not(.is-avatar-expanded) .chat-info-quick-action,
    body.theme-light #group-members-panel.group-info-panel .group-info-cover:not(.is-avatar-expanded) .chat-info-quick-action,
    html[data-theme="light"] #group-members-panel.group-info-panel .group-info-cover:not(.is-avatar-expanded) .chat-info-quick-action {
        background: rgba(15,23,42,.055) !important;
        box-shadow: inset 0 1px 0 rgba(255,255,255,.92), 0 10px 24px rgba(15,23,42,.07) !important;
    }
    #chat-info-sidebar .user-info-cover.is-avatar-expanded .chat-info-quick-action,
    #group-members-panel.group-info-panel .group-info-cover.is-avatar-expanded .chat-info-quick-action {
        color: #fff !important;
        background: rgba(20,26,32,.52) !important;
        border-color: rgba(255,255,255,.2) !important;
        box-shadow: none !important;
    }
    #chat-info-sidebar .user-info-cover.is-avatar-expanded .chat-info-avatar-collapse {
        top: 12px !important;
        right: 12px !important;
        left: auto !important;
    }
    #group-members-panel.group-info-panel .group-info-cover.is-avatar-expanded .chat-info-avatar-collapse {
        top: 12px !important;
        right: 68px !important;
        left: auto !important;
    }
    #group-members-panel.group-info-panel .group-info-cover.is-avatar-expanded .chat-info-avatar-edit {
        top: 12px !important;
        right: 122px !important;
        left: auto !important;
    }
    /* The existing private profile QR stays in the username row. */
    #chat-info-sidebar .chat-info-username-actions {
        width: 100%;
        justify-content: space-between;
    }
    #chat-info-sidebar .chat-info-username-actions .chat-info-profile-qr { flex: 0 0 44px; }
    /* Group invites have no deals count. Decorate the existing permission-gated
       invitation button instead of introducing a second button or handler. */
    #group-members-panel.group-info-panel .group-info-actions > [data-group-action="invite-link"] {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        text-align: start;
        min-height: 44px;
        height: auto;
        padding-block: 8px;
    }
    #group-members-panel.group-info-panel .group-info-actions > [data-group-action="invite-link"]::after {
        content: "";
        flex: 0 0 22px;
        width: 22px;
        height: 22px;
        background: currentColor;
        -webkit-mask: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.8%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Crect%20x%3D%222%22%20y%3D%222%22%20width%3D%228%22%20height%3D%228%22%20rx%3D%221%22%2F%3E%3Cpath%20d%3D%22M5%205h2%22%2F%3E%3Crect%20x%3D%2214%22%20y%3D%222%22%20width%3D%228%22%20height%3D%228%22%20rx%3D%221%22%2F%3E%3Cpath%20d%3D%22M17%205h2%22%2F%3E%3Crect%20x%3D%222%22%20y%3D%2214%22%20width%3D%228%22%20height%3D%228%22%20rx%3D%221%22%2F%3E%3Cpath%20d%3D%22M5%2017h2M14%2014h4v4h4M14%2022v-4M18%2022h4%22%2F%3E%3C%2Fsvg%3E") center / contain no-repeat;
        mask: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.8%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Crect%20x%3D%222%22%20y%3D%222%22%20width%3D%228%22%20height%3D%228%22%20rx%3D%221%22%2F%3E%3Cpath%20d%3D%22M5%205h2%22%2F%3E%3Crect%20x%3D%2214%22%20y%3D%222%22%20width%3D%228%22%20height%3D%228%22%20rx%3D%221%22%2F%3E%3Cpath%20d%3D%22M17%205h2%22%2F%3E%3Crect%20x%3D%222%22%20y%3D%2214%22%20width%3D%228%22%20height%3D%228%22%20rx%3D%221%22%2F%3E%3Cpath%20d%3D%22M5%2017h2M14%2014h4v4h4M14%2022v-4M18%2022h4%22%2F%3E%3C%2Fsvg%3E") center / contain no-repeat;
        pointer-events: none;
    }
}

/* === DEALIX CHAT INFO V4: desktop alignment only, 2026-11-18 ===
   Center the restored header lane. Keep existing collection and tab geometry. */
@media (min-width: 1025px) {
    #chat-info-sidebar .user-info-cover > .chat-info-quick-actions,
    #group-members-panel.group-info-panel .group-info-cover .chat-info-quick-actions {
        width: 100% !important;
        max-width: 560px !important;
        margin-inline: auto !important;
        justify-self: center !important;
        align-self: center !important;
    }
    #chat-info-sidebar .user-info-cover.is-avatar-expanded .user-info-name,
    #group-members-panel.group-info-panel .group-info-cover.is-avatar-expanded .group-members-title,
    #group-members-panel.group-info-panel .group-info-cover.is-avatar-expanded .group-members-subtitle {
        box-sizing: border-box;
        width: 100% !important;
        max-width: 560px !important;
        margin-inline: auto !important;
        text-align: start !important;
    }
    #group-members-panel.group-info-panel .group-info-quick-actions {
        width: 100% !important;
        max-width: 560px !important;
        align-self: center !important;
        margin-inline: auto !important;
    }
    /* Preserve V4's five media tabs and horizontal scrolling. */
    #chat-info-sidebar .chat-info-tabs,
    #group-members-panel.group-info-panel .chat-info-tabs {
        justify-content: space-between !important;
    }
    #chat-info-sidebar .chat-info-tabs > .chat-info-tab,
    #group-members-panel.group-info-panel .chat-info-tabs > .chat-info-tab {
        flex: 1 0 max-content !important;
        text-align: center !important;
    }
}
/* === END DEALIX CHAT INFO V4 === */

/* DEALIX Listings · compact native navigation, 2026-11-22.
   Cosmetic relocation only: original button IDs, datasets and handlers remain.
   Scoped to the listings board; listing detail, deal, wallet and other routes untouched. */
.listings-page .listings-market-search {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 48px;
    align-items: center;
    gap: 8px;
}
.listings-page .listings-market-search .listings-searchbox {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
    min-height: 52px;
    padding-inline-end: 5px;
    border-radius: 15px;
}
.listings-page .listings-market-search .listings-searchbox .input {
    min-width: 0;
    min-height: 50px;
    flex: 1 1 auto;
    width: 0;
}
.listings-page .listings-market-search #listing-create-btn {
    grid-column: 2;
    grid-row: 1;
    display: inline-flex;
    place-content: center;
    align-items: center;
    width: 48px;
    height: 48px;
    border-radius: 14px;
}
.listings-page .listings-searchbox #listings-location-toggle {
    flex: 0 0 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 12px;
    background: color-mix(in srgb, var(--primary) 9%, transparent);
    color: var(--primary-text, var(--primary));
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.listings-page .listings-searchbox #listings-location-toggle:is(:hover,:focus-visible),
.listings-page .listings-searchbox #listings-location-toggle[aria-expanded="true"] {
    border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
    background: var(--primary-light);
}
.listings-page .listings-searchbox #listings-location-toggle:focus-visible,
.listings-page .listings-native-navigation button:focus-visible,
.listings-page .listings-map-toggle:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}
.listings-location-sr-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.listings-page .listings-browse-actions {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    align-items: stretch;
    gap: 8px;
    width: min(100%, 720px);
}
.listings-page .listings-filter-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    width: 100%;
    max-width: none;
    gap: 8px;
}
.listings-page .listings-browse-actions .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-width: 0;
    min-height: 46px;
    padding: 8px 10px;
    border-radius: 14px;
    font-weight: 740;
    white-space: nowrap;
    text-align: center;
    line-height: 1.15;
}
.listings-page .listings-browse-actions .btn span {
    overflow-wrap: normal;
    min-width: 0;
}
.listings-page .listings-browse-actions .listings-map-toggle {
    height: auto;
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--bg-tertiary);
    color: var(--text);
    box-shadow: none;
    font-size: inherit;
    font-weight: 750;
}
.listings-page .listings-browse-actions .listings-map-toggle.active {
    /* Deliberately subtle: visible ON state, no neon glow. */
    background: color-mix(in srgb, var(--primary) 15%, var(--bg-tertiary)) !important;
    color: var(--text) !important;
    border-color: color-mix(in srgb, var(--primary) 42%, var(--border)) !important;
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 9%, transparent) !important;
}
.listings-page .listings-market-filters .listings-filter-sort {
    grid-column: span 2;
    grid-row: auto;
    min-width: 0;
    max-width: none;
    width: 100%;
}
.listings-page .listings-market-filters .listings-mine-status-row {
    grid-column: 1 / -1;
    margin: 0;
    padding: 10px;
    border-radius: 15px;
}
.listings-page .listings-market-filters .listings-mine-status-row {
    overflow-x: visible;
}
.listings-page .listings-market-filters .listings-mine-tabs {
    flex-wrap: wrap;
    min-width: 0;
}
.listings-page .listings-section-head-modern {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
}
.listings-page .listings-head-actions {
    display: block;
    width: 100%;
    min-width: 0;
}
.listings-page .listings-native-navigation {
    width: 100%;
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: 17px;
    background: var(--bg-card);
    background: color-mix(in srgb, var(--bg-card) 90%, transparent);
    box-shadow: 0 3px 18px rgba(0,0,0,.06);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    overflow: hidden;
}
.listings-native-navigation-scroll {
    display: flex;
    align-items: stretch;
    width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.listings-native-navigation-scroll::-webkit-scrollbar { display: none; }
.listings-page .listings-native-navigation .listings-mode-tabs {
    display: flex !important;
    flex: 0 0 auto;
    align-items: stretch !important;
    grid-template-columns: none !important;
    justify-content: flex-start !important;
    gap: 0 !important;
    width: max-content !important;
    min-width: max-content !important;
    padding: 0;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: transparent !important;
    box-shadow: none !important;
    overflow: visible !important;
}
.listings-page .listings-native-navigation .listings-mode-tabs .listings-mode-tab {
    position: relative;
    flex: 0 0 auto !important;
    width: auto !important;
    max-width: none !important;
    min-width: 53px !important;
    min-height: 50px;
    padding: 10px 13px !important;
    margin: 0;
    border-radius: 0;
    background: transparent !important;
    box-shadow: none !important;
    color: var(--text-secondary) !important;
    font-size: .94rem !important;
    font-weight: 700;
    letter-spacing: normal !important;
    white-space: nowrap !important;
    overflow: visible !important;
    text-overflow: clip !important;
}
.listings-page .listings-native-navigation .listings-mode-tabs .listings-mode-tab.active {
    color: var(--text) !important;
    font-weight: 800;
}
.listings-page .listings-native-navigation .listings-mode-tabs .listings-mode-tab.active::after,
.listings-page .listings-native-navigation .listings-layout-btn.active::after {
    content: '';
    position: absolute;
    inset-inline: 18%;
    bottom: 0;
    height: 3px;
    border-radius: 99px;
    background: var(--primary);
}
.listings-page .listings-native-navigation .listings-layout-toggle {
    display: flex !important;
    flex: 0 0 auto;
    align-items: stretch;
    grid-template-columns: none !important;
    justify-self: auto;
    gap: 0;
    width: auto !important;
    min-width: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent !important;
    box-shadow: none;
}
.listings-page .listings-native-navigation .listings-layout-toggle .listings-layout-btn {
    position: relative;
    flex: 0 0 auto;
    display: inline-flex;
    width: auto !important;
    min-width: 0;
    height: auto;
    min-height: 50px;
    padding: 10px 13px !important;
    border-radius: 0;
    background: transparent !important;
    color: var(--text-secondary);
    box-shadow: none !important;
    font-weight: 700;
    white-space: nowrap;
}
.listings-page .listings-native-navigation .listings-layout-btn.active {
    background: transparent !important;
    color: var(--text);
    box-shadow: none !important;
}
.listings-page .listings-native-navigation .listings-layout-btn span {
    font-size: .88rem;
    font-weight: 750;
}
.listings-page .listings-native-navigation button:hover {
    background: var(--bg-hover) !important;
}
@media (max-width: 720px) {
    .listings-page .listings-market-search {
        grid-template-columns: minmax(0, 1fr) 46px;
        gap: 7px;
    }
    .listings-page .listings-market-search .listings-searchbox {
        grid-column: 1;
        grid-row: 1;
        min-height: 48px;
    }
    .listings-page .listings-market-search .listings-searchbox .input {
        min-height: 46px;
        font-size: clamp(.78rem, 3.3vw, .94rem);
    }
    .listings-page .listings-market-search #listing-create-btn {
        grid-column: 2;
        grid-row: 1;
        width: 46px;
        height: 46px;
    }
    .listings-page .listings-browse-actions {
        width: 100%;
        grid-template-columns: minmax(0, 2.28fr) minmax(0, .72fr);
        gap: 6px;
    }
    .listings-page .listings-filter-actions { gap: 6px; }
    .listings-page .listings-browse-actions .btn {
        gap: 5px;
        padding-inline: 7px;
        min-height: 44px;
        font-size: clamp(.80rem, 3.2vw, .91rem) !important;
    }
    .listings-page .listings-browse-actions .btn svg {
        width: 16px;
        height: 16px;
    }
    .listings-page .listings-native-navigation .listings-mode-tabs .listings-mode-tab,
    .listings-page .listings-native-navigation .listings-layout-toggle .listings-layout-btn {
        padding-inline: 10px !important;
        min-height: 48px;
    }
    .listings-page .listings-native-navigation .listings-mode-tabs .listings-mode-tab {
        font-size: .85rem !important;
    }
    .listings-page .listings-native-navigation .listings-layout-btn span {
        font-size: .85rem;
    }
    .listings-page .listings-market-filters .listings-filter-sort { grid-column: 1 / -1; }
}
@media (min-width: 361px) and (max-width: 720px) {
    .listings-page .listings-browse-actions .btn { font-size: .87rem !important; }
}
@media (max-width: 360px) {
    .listings-page .listings-browse-actions .btn { font-size: .80rem !important; padding-inline: 4px; gap: 4px; }
    .listings-page .listings-native-navigation .listings-mode-tabs .listings-mode-tab,
    .listings-page .listings-native-navigation .listings-layout-toggle .listings-layout-btn {
        padding-inline: 8px !important;
    }
}
