/* Story bar */
.bale-story-bar {
    display: flex;
    gap: 12px;
    padding: 14px 16px 12px;
    overflow-x: auto;
    border-bottom: 1px solid var(--bale-border);
    scrollbar-width: none;
    background: linear-gradient(180deg, #fff 0%, #fafbfc 100%);
}
.bale-story-bar::-webkit-scrollbar { display: none; }
.bale-story-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    text-decoration: none;
    color: var(--bale-text-secondary);
    font-size: 11px;
    min-width: 68px;
    flex-shrink: 0;
    transition: transform 0.18s ease;
}
.bale-story-item:hover { transform: translateY(-2px); }
.bale-story-item:active { transform: scale(0.96); }
.bale-story-ring {
    position: relative;
    padding: 3px;
    border-radius: 50%;
    background: conic-gradient(
        from 200deg,
        #f09433 0deg,
        #e6683c 55deg,
        #dc2743 110deg,
        #cc2366 165deg,
        #833ab4 220deg,
        #5851db 275deg,
        #00A693 330deg,
        #25D366 360deg
    );
    box-shadow: 0 2px 10px rgba(0, 166, 147, 0.22);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.bale-story-item:hover .bale-story-ring {
    box-shadow: 0 4px 14px rgba(0, 166, 147, 0.32);
}
.bale-story-item.unseen .bale-story-ring::before {
    content: "";
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    background: inherit;
    filter: blur(6px);
    opacity: 0.35;
    z-index: -1;
}
.bale-story-item.seen .bale-story-ring {
    background: var(--bale-avatar-bg, #d1d7db);
    box-shadow: none;
}
.bale-story-item.seen .bale-story-ring::before { display: none; }
.bale-story-item.mine:not(.add-story) .bale-story-ring {
    background: linear-gradient(135deg, var(--bale-primary) 0%, #25D366 50%, #00c9b7 100%);
}
.bale-story-avatar {
    display: block;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 3px solid #fff;
    object-fit: cover;
    background: var(--bale-avatar-bg, #e9edef);
}
.bale-story-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--bale-text-secondary);
    max-width: 68px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
    line-height: 1.3;
}
.bale-story-item.unseen .bale-story-label { color: var(--bale-text); }
.bale-story-add-ring {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 62px;
    height: 62px;
    background: var(--bale-bg, #f0f2f5);
    box-shadow: none;
}
.bale-story-add-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 20px;
    font-weight: 400;
    line-height: 1;
    color: #fff;
    background: var(--bale-primary);
    box-shadow: 0 2px 6px rgba(0, 166, 147, 0.35);
}
.bale-story-item.add-story .bale-story-ring {
    padding: 0;
    background: transparent;
    border: 2px dashed rgba(0, 166, 147, 0.45);
    box-shadow: none;
}
.bale-story-item.add-story:hover .bale-story-ring {
    border-color: var(--bale-primary);
    background: rgba(0, 166, 147, 0.06);
}

/* Chat pattern background */
.bale-chat-pattern {
    background-color: #D5DBE0;
    background-image: url("/img/chat-pattern.svg");
    background-repeat: repeat;
    background-size: 420px;
}
.bale-main-plain {
    background: var(--bale-surface-alt, #F0F2F5);
    overflow-y: auto;
    min-height: 0;
}

/* Profile page */
.bale-profile-main {
    padding: 16px;
    overflow-x: hidden;
}

@media (max-width: 900px) {
    .bale-profile-main {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }
}

.bale-username-hint {
    font-size: 12px;
    margin-top: 4px;
    color: var(--bale-text-secondary, #667781);
}

.bale-bubble-text .bale-mention-link {
    color: var(--bale-link);
    text-decoration: none;
    font-weight: 500;
}

.bale-bubble-text .bale-mention-link:hover {
    text-decoration: underline;
}

.bale-profile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 16px;
    max-width: 480px;
    margin-inline: auto;
    width: 100%;
}

.bale-profile-header h1 {
    margin: 0;
    flex: 1;
    text-align: center;
    font-size: 18px;
}

.bale-profile-header-spacer {
    width: 40px;
    flex-shrink: 0;
}

.bale-profile-inner {
    max-width: 480px;
    margin: 0 auto;
    width: 100%;
}

.bale-profile-alert {
    padding: 12px;
    border-radius: 8px;
    margin: 0 auto 16px;
    max-width: 480px;
}

.bale-profile-alert-success { background: #D9FDD3; }
.bale-profile-alert-error { background: #FFE5E5; }

.bale-profile-avatar-block {
    text-align: center;
    margin-bottom: 20px;
}

.bale-profile-avatar {
    width: 96px;
    height: 96px;
}

.bale-profile-avatar-actions {
    margin-top: 12px;
}

.bale-profile-card {
    background: var(--bale-surface, #fff);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.bale-profile-wallet {
    text-align: center;
}

.bale-profile-wallet-label {
    font-size: 13px;
    color: var(--bale-text-secondary, #667781);
}

.bale-profile-wallet-balance {
    font-size: 22px;
    font-weight: 600;
    color: #00A693;
    margin: 8px 0 12px;
}

.bale-profile-wallet-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.bale-profile-form .bale-form-field {
    margin-bottom: 12px;
}

.bale-profile-form .bale-form-field:last-of-type {
    margin-bottom: 16px;
}

.bale-profile-form input,
.bale-profile-form textarea {
    width: 100%;
    max-width: 100%;
    padding: 10px;
    border: 1px solid var(--bale-border, #E9EDEF);
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
}

.bale-profile-form .bale-input-disabled {
    background: #f5f5f5;
}

.bale-profile-submit {
    width: 100%;
}

.bale-profile-logout {
    margin-top: 0;
}

.bale-profile-logout-btn {
    width: 100%;
    color: #c0392b;
}

@media (max-width: 900px) {
    .bale-profile-page .bale-main {
        flex: 1;
        width: 100%;
    }

    .bale-profile-main {
        padding: 12px 12px 24px;
    }

    .bale-profile-header h1 {
        font-size: 17px;
    }

    .bale-profile-wallet-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .bale-profile-wallet-actions .bale-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 420px) {
    .bale-profile-main {
        padding: 10px 10px 20px;
    }

    .bale-profile-card {
        padding: 14px;
    }

    .bale-profile-avatar {
        width: 80px;
        height: 80px;
    }
}

/* Avatar story ring in list */
.bale-avatar.has-story {
    box-shadow:
        0 0 0 2px #fff,
        0 0 0 4px var(--bale-primary),
        0 0 0 5px rgba(0, 166, 147, 0.25);
}

.bale-type-icon { font-size: 14px; margin-left: 4px; }

/* Join bar */
.bale-join-bar {
    padding: 12px 16px;
    background: var(--bale-sidebar);
    border-top: 1px solid var(--bale-border);
}
.bale-join-bar .bale-btn { width: 100%; }

.bale-view-count { color: var(--bale-text-secondary); font-size: 11px; }

/* Profile drawer */
.bale-profile-drawer { display: none; }
.bale-profile-drawer.open { display: block; }
.bale-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(11, 20, 26, .35);
    z-index: 1100;
}
.bale-drawer-panel {
    position: fixed;
    top: 0;
    right: var(--bale-nav-width);
    width: 320px;
    height: 100vh;
    height: 100dvh;
    background: var(--bale-surface, #fff);
    z-index: 1101;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: -4px 0 24px rgba(0,0,0,.08);
}
.bale-drawer-profile {
    text-align: center;
    padding: 24px 20px 16px;
    border-bottom: 8px solid #F0F2F5;
    position: relative;
    flex-shrink: 0;
}
.bale-drawer-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}
.bale-drawer-moon {
    position: absolute;
    left: 16px;
    top: 16px;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
}
.bale-drawer-avatar-wrap { position: relative; display: inline-block; }
.bale-drawer-avatar {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    object-fit: cover;
}
.bale-drawer-edit {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 28px;
    height: 28px;
    background: var(--bale-primary);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}
.bale-drawer-name { font-weight: 600; margin-top: 12px; }
.bale-drawer-phone { color: var(--bale-text-secondary); font-size: 13px; margin-top: 4px; direction: ltr; }
.bale-drawer-menu { padding: 8px 0; }
.bale-drawer-menu-secondary { border-top: 8px solid #F0F2F5; }
.bale-drawer-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    color: var(--bale-text);
    text-decoration: none;
    font-size: 14px;
}
.bale-drawer-item:hover { background: var(--bale-hover, #F5F6F6); }
.bale-drawer-item .bale-svg-icon { width: 22px; height: 22px; color: var(--bale-text-secondary); }
.bale-drawer-footer {
    padding: 16px 20px;
    color: var(--bale-text-secondary);
    font-size: 12px;
    border-top: 1px solid var(--bale-border);
    flex-shrink: 0;
}

/* Services */
.bale-app-services {
    height: 100vh;
    height: 100dvh;
}
.bale-app-services .bale-main { display: none; }
.bale-app-services .bale-services-sidebar {
    flex: 1;
    width: auto;
    min-width: 0;
}
.bale-services-sidebar .bale-sidebar-header h1 { flex: 1; text-align: center; }
.bale-wallet-card {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 12px 16px;
    padding: 14px 16px;
    background: var(--bale-pinned-bg, #F8FAFA);
    border-radius: 12px;
    border: 1px solid var(--bale-border);
}
.bale-wallet-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--bale-highlight-bg, #E7F8F5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}
.bale-wallet-info { flex: 1; }
.bale-wallet-title { font-size: 13px; color: var(--bale-text-secondary); }
.bale-wallet-balance { font-weight: 600; margin-top: 2px; }
.bale-services-scroll {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 24px;
    -webkit-overflow-scrolling: touch;
}
.bale-app-services .bale-service-section {
    max-width: 480px;
    margin-inline: auto;
    width: 100%;
}
.bale-service-section { padding: 16px; }
.bale-service-section h3 {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 12px;
}
.bale-service-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}
.bale-service-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.bale-service-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px 6px;
    border: 1px solid var(--bale-border);
    border-radius: 14px;
    background: var(--bale-surface, #fff);
    cursor: pointer;
    font-family: inherit;
    font-size: 11px;
    color: var(--bale-text);
    text-align: center;
    min-width: 0;
    width: 100%;
}
.bale-service-tile:hover { border-color: var(--bale-primary); }
.bale-service-tile-icon {
    font-size: 24px;
    flex-shrink: 0;
    line-height: 1;
}
.bale-service-tile-label {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.35;
    width: 100%;
    word-break: break-word;
}
.bale-service-tile small { color: var(--bale-text-secondary); font-size: 10px; }

/* Magazine */
.bale-magazine-app { background: var(--bale-surface-alt, #F0F2F5); }
.bale-magazine-main {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    max-width: 680px;
    margin: 0 auto;
    width: 100%;
}
.bale-magazine-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--bale-surface, #fff);
    border-bottom: 1px solid var(--bale-border);
    position: sticky;
    top: 0;
    z-index: 10;
}
.bale-magazine-header h1 { margin: 0; font-size: 18px; }
.bale-link-shop, .bale-link-back {
    color: var(--bale-primary);
    text-decoration: none;
    font-size: 13px;
}
.bale-category-pills {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    overflow-x: auto;
    background: var(--bale-surface, #fff);
    border-bottom: 1px solid var(--bale-border);
}
.bale-pill {
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid var(--bale-border);
    color: var(--bale-text);
    text-decoration: none;
    font-size: 13px;
    white-space: nowrap;
}
.bale-pill.active {
    border-color: var(--bale-primary);
    color: var(--bale-primary);
    font-weight: 600;
}
.bale-magazine-feed { padding: 12px 16px 24px; display: flex; flex-direction: column; gap: 16px; }
.bale-magazine-card {
    background: var(--bale-surface, #fff);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.bale-mag-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
}
.bale-mag-card-author { display: flex; align-items: center; gap: 10px; flex: 1; }
.bale-mag-card-name { font-weight: 600; font-size: 14px; }
.bale-mag-card-meta { font-size: 12px; color: var(--bale-text-secondary); }
.bale-btn-outline-sm {
    padding: 6px 14px;
    border: 1px solid var(--bale-primary);
    color: var(--bale-primary);
    background: var(--bale-surface, #fff);
    border-radius: 999px;
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    white-space: nowrap;
}
.bale-btn-outline-sm.joined,
.mag-join-btn.joined {
    border-color: var(--bale-border);
    color: var(--bale-text-secondary);
    background: var(--bale-bg);
}
.mag-join-btn.joined:hover { background: var(--bale-highlight-bg, #E7F8F5); color: var(--bale-primary); border-color: var(--bale-primary); }
.bale-mag-card-media img { width: 100%; display: block; max-height: 360px; object-fit: cover; }
.bale-mag-card-body { padding: 12px 14px; font-size: 14px; line-height: 1.6; }
.bale-mag-body-text { margin: 0; white-space: pre-wrap; word-break: break-word; }
.bale-mag-body-clamped {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.bale-more-link {
    display: inline-block;
    margin-top: 4px;
    padding: 0;
    border: none;
    background: none;
    font-family: inherit;
    font-size: 13px;
    color: var(--bale-primary);
    cursor: pointer;
}
.bale-mag-feed-loader {
    text-align: center;
    padding: 16px;
    font-size: 13px;
}
.bale-mag-action[href] { text-decoration: none; }
.bale-mag-card-footer {
    padding: 10px 14px 14px;
    border-top: 1px solid var(--bale-border);
}
.bale-mag-actions {
    display: flex;
    gap: 16px;
    margin-bottom: 10px;
}
.bale-mag-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    font-family: inherit;
    font-size: 13px;
    color: var(--bale-text-secondary);
    cursor: pointer;
}
.bale-mag-action .bale-svg-icon { width: 18px; height: 18px; }
.bale-mag-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: var(--bale-text-secondary);
}
.bale-suggested-label {
    margin-right: auto;
    background: var(--bale-surface-alt, #F0F2F5);
    padding: 2px 8px;
    border-radius: 6px;
}

/* Magazine channel author link */
.bale-mag-card-author-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}
.bale-mag-card-author-link:hover .bale-mag-card-name { text-decoration: underline; }

/* Magazine viewer channel link */
.bale-mag-viewer-channel-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}
.bale-mag-viewer-channel-link:hover .bale-mag-viewer-channel-name { text-decoration: underline; }

/* Highlight card when closing viewer */
@keyframes bale-mag-highlight-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(0,184,148,0.7); }
    40%  { box-shadow: 0 0 0 7px rgba(0,184,148,0.3); }
    100% { box-shadow: 0 0 0 0 rgba(0,184,148,0); }
}
.bale-magazine-card.bale-mag-card-highlight {
    animation: bale-mag-highlight-pulse 1.8s ease-out;
}

/* Magazine media (image / video) */
.bale-mag-card-media { position: relative; cursor: pointer; }
.bale-mag-video-play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0,0,0,0.55);
    pointer-events: none;
    z-index: 3;
}
.bale-mag-media-corners {
    position: absolute;
    inset: 10px;
    pointer-events: none;
    z-index: 2;
}
.bale-mag-media-corner {
    position: absolute;
    width: 18px;
    height: 18px;
    border-color: rgba(255,255,255,0.9);
    border-style: solid;
}
.bale-mag-media-corner.tl { top: 0; right: 0; border-width: 2.5px 2.5px 0 0; border-radius: 0 3px 0 0; }
.bale-mag-media-corner.tr { top: 0; left: 0; border-width: 2.5px 0 0 2.5px; border-radius: 3px 0 0 0; }
.bale-mag-media-corner.bl { bottom: 0; right: 0; border-width: 0 2.5px 2.5px 0; border-radius: 0 0 3px 0; }
.bale-mag-media-corner.br { bottom: 0; left: 0; border-width: 0 0 2.5px 2.5px; border-radius: 0 0 0 3px; }

/* Magazine post viewer (full-screen lightbox) */
.bale-mag-post-viewer {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    flex-direction: column;
    background: #0f1923;
    color: #e0e0e0;
}
.bale-mag-post-viewer.visible { display: flex; }
.bale-mag-viewer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: rgba(0,0,0,0.45);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}
.bale-mag-viewer-header-left { display: flex; align-items: center; gap: 8px; }
.bale-mag-viewer-header-right { display: flex; align-items: center; gap: 12px; direction: rtl; }
.bale-mag-viewer-close,
.bale-mag-viewer-more {
    background: rgba(255,255,255,0.12);
    border: none;
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.bale-mag-viewer-close:hover,
.bale-mag-viewer-more:hover { background: rgba(255,255,255,0.22); }
.bale-mag-viewer-channel-info { text-align: right; }
.bale-mag-viewer-channel-name { font-weight: 700; font-size: 15px; color: #fff; display: flex; align-items: center; gap: 5px; justify-content: flex-end; }
.bale-mag-viewer-channel-members { font-size: 12px; color: rgba(255,255,255,0.55); text-align: right; }
.bale-mag-viewer-body {
    flex: 1;
    display: flex;
    min-height: 0;
}
.bale-mag-viewer-text {
    width: 340px;
    min-width: 240px;
    max-width: 38vw;
    padding: 20px 18px;
    overflow-y: auto;
    background: #161f27;
    direction: rtl;
    text-align: right;
    border-left: 1px solid rgba(255,255,255,0.07);
    font-size: 14px;
    line-height: 1.85;
    white-space: pre-wrap;
    word-break: break-word;
    order: 2;
}
.bale-mag-viewer-image {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0a0f14;
    position: relative;
    overflow: hidden;
    order: 1;
}
.bale-mag-viewer-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}
.bale-mag-viewer-image .bale-mag-media-corners { inset: 16px; }
.bale-mag-viewer-footer {
    padding: 10px 18px;
    background: rgba(0,0,0,0.45);
    border-top: 1px solid rgba(255,255,255,0.08);
    direction: rtl;
    flex-shrink: 0;
}
.bale-mag-viewer-actions {
    display: flex;
    gap: 20px;
    align-items: center;
}
.bale-mag-viewer-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    color: rgba(255,255,255,0.65);
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
    padding: 4px 0;
}
.bale-mag-viewer-action .bale-svg-icon { width: 20px; height: 20px; }
.bale-mag-viewer-action.liked { color: #e74c3c; }
.bale-mag-viewer-action[data-viewer-like]:hover { color: #e74c3c; }
.bale-mag-viewer-views { margin-right: auto; }

@media (max-width: 640px) {
    .bale-mag-viewer-body { flex-direction: column; }
    .bale-mag-viewer-image { min-height: 52vw; order: 1; }
    .bale-mag-viewer-text { width: 100%; max-width: 100%; border-left: none; border-top: 1px solid rgba(255,255,255,0.07); max-height: 40vh; order: 2; }
}

/* Story viewer */
.bale-story-viewer {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.bale-story-viewer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(11, 20, 26, 0.88);
    backdrop-filter: blur(10px);
}
.bale-story-viewer-controls {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    gap: 8px;
    z-index: 10;
    pointer-events: auto;
}
.bale-story-ctrl {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: background 0.15s ease, transform 0.15s ease;
}
.bale-story-ctrl:hover {
    background: rgba(255, 255, 255, 0.24);
    transform: scale(1.05);
}
.bale-story-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 22px;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    z-index: 4;
    backdrop-filter: blur(8px);
    transition: background 0.15s ease, transform 0.15s ease;
}
.bale-story-nav:hover {
    background: rgba(255, 255, 255, 0.22);
    transform: translateY(-50%) scale(1.06);
}
.bale-story-nav-prev { right: calc(50% + min(200px, 46vw)); }
.bale-story-nav-next { left: calc(50% + min(200px, 46vw)); }
.bale-story-card {
    position: relative;
    width: min(400px, 92vw);
    height: min(720px, 90vh);
    background: #0b141a;
    border-radius: 20px;
    overflow: hidden;
    z-index: 2;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
}
.bale-story-progress-track {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 3;
    display: flex;
    gap: 4px;
    padding: 10px 12px 0;
}
.bale-story-progress-seg {
    flex: 1;
    height: 3px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.28);
    overflow: hidden;
}
.bale-story-progress-fill {
    display: block;
    height: 100%;
    width: 0;
    background: #FFF; /* always white over story media, both themes */
    border-radius: 2px;
}
.bale-story-progress-seg.done .bale-story-progress-fill { width: 100%; }
.bale-story-progress-seg.active .bale-story-progress-fill {
    animation: bale-story-progress 5s linear forwards;
}
.bale-story-progress-seg.active.is-video .bale-story-progress-fill {
    animation: none;
    width: 100%;
}
@keyframes bale-story-progress {
    from { width: 0; }
    to { width: 100%; }
}
.bale-story-card-media {
    position: absolute;
    inset: 0;
    background: #0b141a;
    display: flex;
    align-items: center;
    justify-content: center;
}
.bale-story-image {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
}
.bale-story-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000;
}
.bale-story-card-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    pointer-events: none;
}
.bale-story-card--with-media .bale-story-card-overlay {
    background: linear-gradient(
        180deg,
        rgba(0, 0, 0, 0.5) 0%,
        rgba(0, 0, 0, 0.06) 18%,
        transparent 38%,
        transparent 58%,
        rgba(0, 0, 0, 0.28) 78%,
        rgba(0, 0, 0, 0.55) 100%
    );
}
.bale-story-card--text-only .bale-story-card-overlay {
    background: linear-gradient(
        180deg,
        rgba(0, 0, 0, 0.35) 0%,
        transparent 22%,
        transparent 78%,
        rgba(0, 0, 0, 0.2) 100%
    );
}
.bale-story-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 28px 14px 12px;
    color: #fff;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}
.bale-story-card-header .bale-avatar {
    border: 2px solid rgba(255, 255, 255, 0.85);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
.bale-story-card-name { font-weight: 600; font-size: 14px; }
.bale-story-card-meta { font-size: 11px; opacity: 0.9; margin-top: 2px; }
.bale-story-text-bg {
    width: 100%;
    height: 100%;
    background: linear-gradient(145deg, #5b6ee1 0%, #7c4fbe 45%, #d946a8 100%);
}
.bale-story-caption-wrap {
    pointer-events: none;
    width: 100%;
}
.bale-story-card--with-media .bale-story-caption-wrap {
    margin-top: auto;
    padding: 0 16px 68px;
}
.bale-story-card--with-media .bale-story-caption {
    margin: 0;
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.45;
    text-align: center;
    padding: 10px 14px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.38);
    backdrop-filter: blur(8px);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
    word-break: break-word;
}
.bale-story-card--text-only .bale-story-caption-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 72px 32px 88px;
    text-align: center;
}
.bale-story-card--text-only .bale-story-caption {
    margin: 0;
    max-width: 88%;
    color: #fff;
    font-size: clamp(17px, 4.2vw, 20px);
    font-weight: 600;
    line-height: 1.55;
    letter-spacing: 0.01em;
    word-break: break-word;
}
.bale-story-card-footer {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px 16px;
    pointer-events: auto;
}
.bale-story-add-btn { width: auto !important; padding: 8px 16px !important; font-size: 13px !important; }
.bale-story-stats {
    color: #fff;
    display: flex;
    gap: 12px;
    font-size: 13px;
    opacity: 0.92;
}
.bale-story-tap-zones {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
}
.bale-story-tap-prev,
.bale-story-tap-next {
    flex: 1;
    text-decoration: none;
    color: transparent;
}
.bale-story-tap-prev { cursor: w-resize; }
.bale-story-tap-next { cursor: e-resize; }

/* Story create */
.bale-story-create-app { background: var(--bale-surface-alt, #F0F2F5); }
.bale-story-create-main {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 24px;
    max-width: 480px;
    margin: 0 auto;
    width: 100%;
}
.bale-story-create-header h1 { margin: 8px 0; font-size: 22px; }
.bale-story-upload-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    border: 2px dashed var(--bale-border, #ddd);
    border-radius: 16px;
    padding: 32px;
    cursor: pointer;
    text-align: center;
    margin-bottom: 16px;
}
.bale-story-upload-icon { font-size: 32px; }
.bale-story-preview-wrap img,
.bale-story-preview-wrap video {
    display: block;
    max-width: 100%;
    max-height: 60vh;
    object-fit: contain;
    border-radius: 12px;
    margin-bottom: 16px;
}
.bale-story-create-form .bale-field { display: block; margin-bottom: 16px; }
.bale-story-create-form textarea { width: 100%; border-radius: 8px; padding: 8px; }
.bale-story-create-form .bale-error { color: #c0392b; margin-top: 12px; }

.bale-viewers-list { list-style: none; padding: 0; margin: 0; }
.bale-viewer-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--bale-border);
}
.bale-viewer-item small { margin-right: auto; color: var(--bale-text-secondary); font-size: 12px; }
.bale-viewers-empty { padding: 18px 4px; text-align: center; color: var(--bale-text-secondary); font-size: 13px; }
.bale-modal-sm { max-width: 360px; }

/* Story viewers overlay (centered dialog opened from the report card) */
.bale-viewers-overlay {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.bale-viewers-overlay[hidden] { display: none; }
.bale-viewers-overlay-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .5);
}
.bale-viewers-overlay-panel {
    position: relative;
    z-index: 1;
    width: 90%;
    max-width: 360px;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    background: var(--bale-surface, #fff);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: var(--bale-shadow, 0 10px 40px rgba(0, 0, 0, .3));
}
.bale-viewers-overlay-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--bale-border);
}
.bale-viewers-overlay-head h3 { margin: 0; font-size: 15px; }
.bale-viewers-overlay-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--bale-text-secondary);
    line-height: 1;
}
.bale-viewers-overlay .bale-viewers-list { padding: 6px 16px 14px; overflow-y: auto; }

/* Story report card (تاریخچه ماجرای من bot) */
.bale-story-report-card {
    min-width: 220px;
    max-width: 280px;
    padding: 12px 14px;
    border-radius: 14px;
    background: var(--bale-bubble-in, #fff);
    border: 1px solid var(--bale-border);
}
.bale-story-report-card.is-deleted { opacity: .75; }
.bale-story-report-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.bale-story-report-icon { font-size: 18px; }
.bale-story-report-title { font-weight: 700; font-size: 14px; }
.bale-story-report-type {
    margin-right: auto;
    font-size: 11px;
    color: var(--bale-text-secondary);
    background: var(--bale-surface-2, rgba(0,0,0,.05));
    padding: 2px 8px;
    border-radius: 10px;
}
.bale-story-report-caption {
    font-size: 13px;
    color: var(--bale-text-secondary);
    margin-bottom: 8px;
    line-height: 1.5;
    word-break: break-word;
}
.bale-story-report-stats { font-size: 13px; margin-bottom: 10px; }
.bale-story-report-stat strong { color: var(--bale-primary, #1aa179); }
.bale-story-report-viewers {
    display: block;
    width: 100%;
    padding: 8px 12px;
    border: none;
    border-radius: 10px;
    background: var(--bale-primary, #1aa179);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: filter .15s ease;
}
.bale-story-report-viewers:hover { filter: brightness(.95); }
.bale-story-report-deleted {
    font-size: 12px;
    color: var(--bale-text-secondary);
    text-align: center;
    padding: 4px 0;
}

/* Contacts page */
.bale-app-contacts {
    height: 100vh;
    height: 100dvh;
}
.bale-contacts-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 16px;
}
.bale-contacts-sidebar .bale-chat-list {
    flex: none;
    min-height: unset;
    overflow: visible;
}

/* Contacts suggestions */
.bale-suggestions-box {
    margin: 12px 16px;
    padding: 14px;
    background: var(--bale-pinned-bg, #F8FAFA);
    border-radius: 12px;
    border: 1px solid var(--bale-border);
}
.bale-suggestions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 13px;
    font-weight: 600;
}
.bale-suggestion-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-top: 1px solid var(--bale-border);
}
.bale-suggestion-card:first-of-type { border-top: none; }
.bale-suggestion-info { flex: 1; min-width: 0; }
.bale-suggestion-title { font-size: 13px; font-weight: 500; }
.bale-suggestion-desc { font-size: 11px; color: var(--bale-text-secondary); }
.bale-suggestion-start {
    padding: 6px 16px;
    background: var(--bale-primary);
    color: #fff;
    border: none;
    border-radius: 999px;
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
}

/* Context menu reactions */
.bale-context-reactions {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--bale-border);
    font-size: 18px;
}
.bale-context-reactions span { cursor: pointer; padding: 2px 4px; }

.bale-svg-icon { width: 20px; height: 20px; display: inline-block; vertical-align: middle; }
.bale-empty-illustration { width: 280px; max-width: 100%; }

.bale-nav-item.active svg { stroke: var(--bale-primary); }

@media (max-width: 900px) {
    .bale-app-contacts .bale-sidebar {
        flex: 1;
        min-width: 0;
        width: auto;
    }
    .bale-app-contacts .bale-action-item {
        padding: 11px 16px;
        gap: 12px;
    }
    .bale-app-contacts .bale-action-item .icon-circle {
        width: 40px;
        height: 40px;
        flex-shrink: 0;
    }
    .bale-app-contacts .bale-suggestions-box {
        margin: 8px 12px 0;
    }
    .bale-app-contacts .bale-suggestion-card {
        gap: 8px;
    }
    .bale-app-contacts .bale-suggestion-start {
        flex-shrink: 0;
        padding: 6px 12px;
        font-size: 11px;
    }
    .bale-app-services .bale-service-section {
        max-width: none;
        padding: 12px;
    }
    .bale-service-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }
    .bale-service-tile {
        padding: 10px 4px;
        font-size: 11px;
    }
    .bale-wallet-card { margin: 10px 12px; }
    .bale-drawer-panel { right: 0; width: 100%; max-width: 320px; }
    .bale-magazine-main { max-width: 100%; }
    .bale-story-nav { display: none; }
    .bale-story-viewer { padding: 0; }
    .bale-story-card {
        width: 100vw;
        height: 100vh;
        max-height: 100dvh;
        border-radius: 0;
        box-shadow: none;
    }
    .bale-story-viewer-controls { top: 12px; left: 12px; }
}

.bale-poll {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    max-width: 280px;
    min-width: 0;
}
.bale-poll-question {
    font-weight: 600;
    margin-bottom: 4px;
    word-break: break-word;
}
.bale-poll-option {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    width: 100%;
    min-width: 0;
    padding: 8px 12px;
    border: 1px solid var(--bale-border);
    border-radius: 8px;
    background: var(--bale-surface, #fff);
    cursor: pointer;
    text-align: right;
    font-size: 13px;
    box-sizing: border-box;
}
.bale-poll-option-text {
    flex: 1;
    min-width: 0;
    word-break: break-word;
    line-height: 1.4;
}
.bale-poll-option-stats {
    flex-shrink: 0;
    font-size: 11px;
    color: var(--bale-text-secondary, #667781);
    white-space: nowrap;
    padding-top: 1px;
}
.bale-poll-option.selected { border-color: var(--bale-primary); background: var(--bale-highlight-bg, #E7F8F5); }
.bale-poll-option.disabled { opacity: 0.7; cursor: default; }

/* بازی دوز (Tic-Tac-Toe) */
.bale-game {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    width: 100%;
    max-width: 240px;
    min-width: 0;
}
.bale-game-title {
    font-weight: 600;
    text-align: center;
}
/* دکمه‌ی لغوِ گوشه‌ی عنوان، مشترک بین هر سه بازی (RTL: گوشه‌ی چپ) */
.bale-game-title, .bale-nard-title, .bale-chess-title { position: relative; }
.bale-game-cancel-btn {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--bale-text-secondary, #667781);
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
}
.bale-game-cancel-btn:hover { background: var(--bale-danger-bg, #fdecea); color: var(--bale-danger, #e74c3c); }
.bale-game-cancel-btn:active { transform: translateY(-50%) scale(0.9); }
/* دکمه‌ی «بازی جدید» روی تختهٔ تمام‌شده/لغوشده، مشترک بین هر سه بازی */
.bale-game-new-btn {
    display: block;
    margin: 6px auto 0;
    padding: 6px 16px;
    border: none;
    border-radius: 16px;
    background: var(--bale-primary, #00B894);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.bale-game-new-btn:hover { filter: brightness(1.05); }
.bale-game-new-btn:active { transform: scale(0.96); }
.bale-game-legend {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 12px;
    color: var(--bale-text-secondary, #667781);
}
.bale-game-legend > span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.bale-game-mark-x { color: var(--bale-primary, #00B894); font-weight: 700; }
.bale-game-mark-o { color: #e17055; font-weight: 700; }
.bale-game-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    width: 100%;
    aspect-ratio: 1 / 1;
}
.bale-game-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1 / 1;
    border: 1px solid var(--bale-border, #E9EDEF);
    border-radius: 10px;
    background: var(--bale-surface, #fff);
    font-size: 30px;
    font-weight: 700;
    line-height: 1;
    color: var(--bale-text, #111b21);
    cursor: pointer;
    transition: background .15s, border-color .15s, transform .05s;
    -webkit-user-select: none;
    user-select: none;
}
.bale-game-cell.x { color: var(--bale-primary, #00B894); }
.bale-game-cell.o { color: #e17055; }
.bale-game-cell:not(:disabled):hover { border-color: var(--bale-primary, #00B894); background: var(--bale-highlight-bg, #E7F8F5); }
.bale-game-cell:not(:disabled):active { transform: scale(0.95); }
.bale-game-cell:disabled { cursor: default; }
.bale-game-cell.win { background: var(--bale-highlight-bg, #E7F8F5); border-color: var(--bale-primary, #00B894); }
.bale-game-turn {
    text-align: center;
    font-size: 13px;
    color: var(--bale-text-secondary, #667781);
}
.bale-game-turn.my-turn {
    color: var(--bale-primary, #00B894);
    font-weight: 600;
}
.bale-game-turn-mark { font-weight: 700; }
.bale-game-result {
    text-align: center;
    font-size: 14px;
    font-weight: 700;
    color: var(--bale-text, #111b21);
    padding: 4px 0;
}

/* بازی دوز سخت / اتللو (Othello / Reversi) */
.bale-othello {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    width: 100%;
    max-width: 260px;
    min-width: 0;
}
.bale-othello-board {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    grid-template-rows: repeat(8, minmax(0, 1fr));
    gap: 2px;
    width: 100%;
    aspect-ratio: 1 / 1;
    padding: 4px;
    border-radius: 8px;
    background: #1f7a4d;
    border: 2px solid #14532d;
    /* تخته جهتِ ثابت دارد؛ مستقل از RTL محیط چت، خانه‌ها چپ‌به‌راست چیده شوند */
    direction: ltr;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
}
.bale-othello-cell {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1 / 1;
    min-width: 0;
    min-height: 0;
    padding: 0;
    border: none;
    border-radius: 3px;
    background: #2a9d63;
    cursor: pointer;
    transition: background .12s;
}
.bale-othello-cell:not(:disabled):hover { background: #36b873; }
.bale-othello-cell:disabled { cursor: default; }
.bale-othello-cell.last { box-shadow: inset 0 0 0 2px #ffd24a; }
.bale-othello-disc {
    width: 78%;
    height: 78%;
    border-radius: 50%;
    box-shadow: inset 0 -2px 3px rgba(0, 0, 0, .35), 0 1px 2px rgba(0, 0, 0, .4);
}
.bale-othello-disc.x { background: radial-gradient(circle at 35% 30%, #555, #1a1a1a 75%); }
.bale-othello-disc.o { background: radial-gradient(circle at 35% 30%, #fff, #cfcfcf 80%); }
.bale-othello-disc.sm {
    display: inline-block;
    width: 12px;
    height: 12px;
    flex: 0 0 auto;
    vertical-align: middle;
    box-shadow: inset 0 -1px 2px rgba(0, 0, 0, .3);
}
.bale-othello-hint {
    width: 30%;
    height: 30%;
    border-radius: 50%;
    background: rgba(255, 255, 255, .45);
}
.bale-othello-pass {
    text-align: center;
    font-size: 12px;
    color: var(--bale-text-secondary, #667781);
}

/* بازی تخته نرد (Backgammon) */
.bale-nard {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    max-width: 340px;
    min-width: 0;
}
.bale-nard-title { font-weight: 600; text-align: center; }
.bale-nard-legend {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 12px;
    color: var(--bale-text-secondary, #667781);
}
.bale-nard-legend > span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.bale-nard-legend b { color: var(--bale-text, #111b21); }
.bale-nard-board {
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: #caa472;
    border: 2px solid #8a6a3f;
    border-radius: 8px;
    padding: 4px;
    /* The points have a fixed board orientation (point 1 bottom-right); keep them
       laid out left-to-right even though the surrounding chat UI is RTL. */
    direction: ltr;
}
.bale-nard-row { display: flex; gap: 1px; align-items: stretch; }
.bale-nard-point {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 2px 0;
    min-height: 78px;
    border-radius: 4px;
    background: rgba(255, 255, 255, .05);
}
.bale-nard-point:nth-child(odd) { background: rgba(0, 0, 0, .06); }
.bale-nard-point.top { flex-direction: column; }
.bale-nard-point.bottom { flex-direction: column-reverse; }
.bale-nard-pnum { font-size: 8px; line-height: 1; color: #5a4326; opacity: .7; }
.bale-nard-stack { display: flex; gap: 1px; align-items: center; }
.bale-nard-stack.top { flex-direction: column; }
.bale-nard-stack.bottom { flex-direction: column-reverse; }
.bale-nard-chip {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    flex: 0 0 auto;
}
.bale-nard-chip.x { background: #f5f1e6; box-shadow: 0 0 0 1px #b9a77e, inset 0 0 0 2px #fff; }
.bale-nard-chip.o { background: #3a3a3a; box-shadow: 0 0 0 1px #000, inset 0 0 0 2px #555; }
.bale-nard-count { font-size: 9px; font-weight: 700; color: #fff; text-shadow: 0 0 2px #000; }
.bale-nard-bar {
    flex: 0 0 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #8a6a3f;
    border-radius: 3px;
}
.bale-nard-bar.top { flex-direction: column; }
.bale-nard-bar.bottom { flex-direction: column-reverse; }
.bale-nard-point.target,
.bale-nard-bar.target,
.bale-nard-bar[data-nard-bar],
[data-nard-roll],
[data-nard-off].target { cursor: pointer; }
.bale-nard-point.target,
.bale-nard-bar.target { outline: 2px solid var(--bale-primary, #00B894); outline-offset: -2px; }
.bale-nard-point.sel,
.bale-nard-bar.sel { outline: 2px solid #f1c40f; outline-offset: -2px; }
.bale-nard-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 32px;
}
.bale-nard-dice { display: flex; gap: 6px; }
.bale-nard-die { font-size: 28px; line-height: 1; color: var(--bale-text, #111b21); }
.bale-nard-roll {
    border: none;
    background: var(--bale-primary, #00B894);
    color: #fff;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 8px;
    cursor: pointer;
}
.bale-nard-roll:active { transform: scale(.97); }
.bale-nard-off {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    padding: 4px 10px;
    border: 1px dashed var(--bale-border, #E9EDEF);
    border-radius: 8px;
    font-size: 11px;
    color: var(--bale-text-secondary, #667781);
}
.bale-nard-off.target {
    border-style: solid;
    border-color: var(--bale-primary, #00B894);
    background: var(--bale-highlight-bg, #E7F8F5);
}
.bale-nard-off-counts b.x { color: #8a6a3f; }
.bale-nard-off-counts b.o { color: #111; }
.bale-nard-turn { text-align: center; font-size: 13px; color: var(--bale-text-secondary, #667781); }
.bale-nard-turn.my-turn { color: var(--bale-primary, #00B894); font-weight: 600; }
.bale-nard-turn-mark {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    vertical-align: middle;
}
.bale-nard-turn-mark.x { background: #f5f1e6; box-shadow: 0 0 0 1px #b9a77e; }
.bale-nard-turn-mark.o { background: #3a3a3a; box-shadow: 0 0 0 1px #000; }
.bale-nard-result {
    text-align: center;
    font-size: 14px;
    font-weight: 700;
    color: var(--bale-text, #111b21);
    padding: 4px 0;
}

/* بازی شطرنج (Chess) */
.bale-chess {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    max-width: 340px;
    min-width: 0;
}
.bale-chess-title { font-weight: 600; text-align: center; }
.bale-chess-legend {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 12px;
    color: var(--bale-text-secondary, #667781);
}
.bale-chess-legend > span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.bale-chess-dotmark {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex: 0 0 auto;
    border: 1px solid rgba(0, 0, 0, .35);
}
.bale-chess-dotmark.w { background: #f0f0f0; }
.bale-chess-dotmark.b { background: #3a3a3a; }
.bale-chess-board {
    display: grid;
    /* minmax(0, 1fr) lets the tracks shrink below the glyph size so every square stays
       an equal slice and the board keeps its 1:1 shape regardless of which squares hold
       pieces. container-type drives the piece glyph sizing below. */
    grid-template-columns: repeat(8, minmax(0, 1fr));
    grid-template-rows: repeat(8, minmax(0, 1fr));
    aspect-ratio: 1 / 1;
    width: 100%;
    container-type: inline-size;
    border: 2px solid #6d4c2f;
    border-radius: 8px;
    overflow: hidden;
    /* The board has a fixed orientation handled in JS; keep cells laid out LTR
       even though the surrounding chat UI is RTL. */
    direction: ltr;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
}
.bale-chess-sq {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    cursor: pointer;
}
.bale-chess-sq.light { background: #ebd2a8; }
.bale-chess-sq.dark { background: #b07d4a; }
.bale-chess-sq.lastmove { box-shadow: inset 0 0 0 100px rgba(255, 235, 110, .35); }
.bale-chess-sq.sel { box-shadow: inset 0 0 0 100px rgba(120, 200, 120, .45); }
.bale-chess-sq.check { box-shadow: inset 0 0 0 100px rgba(231, 76, 60, .45); }
.bale-chess-piece {
    /* Sized in container query units so the glyph always fits its square (each of the 8
       columns is 12.5cqi wide) and the squares never have to grow to contain it. */
    font-size: 9.5cqi;
    line-height: 1;
    cursor: pointer;
    pointer-events: none;
}
.bale-chess-piece.w {
    color: #fff;
    text-shadow: 0 0 1px #222, 0 1px 1px rgba(0, 0, 0, .5);
}
.bale-chess-piece.b {
    color: #222;
    text-shadow: 0 0 1px #000, 0 1px 1px rgba(255, 255, 255, .25);
}
.bale-chess-dot {
    position: absolute;
    width: 26%;
    height: 26%;
    border-radius: 50%;
    background: rgba(40, 90, 40, .5);
    pointer-events: none;
}
.bale-chess-sq.capture::after {
    content: "";
    position: absolute;
    inset: 6%;
    border: 3px solid rgba(40, 90, 40, .55);
    border-radius: 50%;
    pointer-events: none;
}
.bale-chess-promo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
}
.bale-chess-promo-label { font-size: 12px; color: var(--bale-text-secondary, #667781); }
.bale-chess-promo-btn {
    font-size: 24px;
    line-height: 1;
    width: 38px;
    height: 38px;
    border: 1px solid var(--bale-border, #d1d7db);
    border-radius: 8px;
    background: var(--bale-panel, #fff);
    cursor: pointer;
}
.bale-chess-promo-btn.w { color: #555; text-shadow: 0 0 1px #888; }
.bale-chess-promo-btn.b { color: #222; }
.bale-chess-promo-btn:hover { background: var(--bale-hover, #f0f2f5); }
.bale-chess-turn {
    font-size: 13px;
    text-align: center;
    color: var(--bale-text-secondary, #667781);
}
.bale-chess-turn.my-turn { color: var(--bale-accent, #1f8a70); font-weight: 600; }
.bale-chess-turn-mark {
    display: inline-block;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    vertical-align: middle;
    border: 1px solid rgba(0, 0, 0, .35);
}
.bale-chess-turn-mark.w { background: #f0f0f0; }
.bale-chess-turn-mark.b { background: #3a3a3a; }
.bale-chess-result {
    font-size: 14px;
    font-weight: 700;
    text-align: center;
    color: var(--bale-text, #111b21);
    padding: 4px 0;
}

/* Notifications */
.bale-drawer-badge {
    margin-right: auto;
    background: #e74c3c;
    color: #fff;
    font-size: 11px;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
}
.bale-notifications-main {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 20px;
    max-width: 640px;
    margin: 0 auto;
}
.bale-notifications-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.bale-notifications-list { list-style: none; padding: 0; margin: 0; }
.bale-notification-item { border-bottom: 1px solid var(--bale-border, #eee); }
.bale-notification-item.unread { background: var(--bale-highlight-bg, #f0faf8); }
.bale-notification-link { display: block; padding: 14px 8px; text-decoration: none; color: inherit; }
.bale-notification-title { font-weight: 600; margin-bottom: 4px; }
.bale-notification-body { font-size: 13px; color: var(--bale-text-secondary, #666); }
.bale-notification-time { font-size: 11px; color: #999; margin-top: 6px; }
.bale-empty-inline { text-align: center; padding: 48px 16px; color: #888; }

/* Toast notifications */
.bale-toast-host {
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 320px;
}
.bale-toast {
    background: var(--bale-surface, #fff);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,.15);
    padding: 12px 16px;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity .3s, transform .3s;
}
.bale-toast.visible { opacity: 1; transform: translateY(0); }
.bale-toast strong { display: block; margin-bottom: 4px; font-size: 14px; }
.bale-toast span { font-size: 12px; color: var(--bale-text-secondary, #666); }

/* Services placeholder modal */
.bale-service-placeholder {
    text-align: center;
    padding: 32px 24px;
}
.bale-service-placeholder-icon { font-size: 48px; margin-bottom: 12px; }

/* Phase 9 — screenshot fidelity */

.bale-nav-icon-wrap { position: relative; display: inline-flex; }
.bale-nav-dot {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background: #EA0038;
    border-radius: 50%;
    border: 2px solid var(--bale-nav, #fff);
}

.bale-notify-banner {
    margin: 8px 12px;
    border-radius: 12px;
    background: #F0F4F8;
}
.bale-notify-arrow { color: var(--bale-text-secondary); font-size: 16px; margin-left: auto; }
.bale-notify-icon { font-size: 16px; }

.bale-outlined-field {
    position: relative;
    margin-bottom: 20px;
}
.bale-outlined-field > label {
    position: absolute;
    top: -9px;
    right: 12px;
    background: var(--bale-surface, #fff);
    padding: 0 6px;
    font-size: 12px;
    color: var(--bale-text-secondary);
    z-index: 1;
}
.bale-outlined-input {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #C5CBD1;
    border-radius: 10px;
    padding: 14px 12px;
    min-height: 52px;
}
.bale-outlined-input input {
    flex: 1;
    border: none;
    outline: none;
    font-family: inherit;
    font-size: 14px;
    background: transparent;
}
.bale-country-select { justify-content: flex-start; font-size: 14px; }
.bale-country-flag { font-size: 18px; }
.bale-country-code { margin-right: auto; color: var(--bale-text-secondary); font-size: 13px; }
.bale-phone-input { padding: 0; overflow: hidden; }
.bale-phone-prefix {
    padding: 14px 12px;
    background: var(--bale-pinned-bg, #F8FAFA);
    border-left: 1px solid #C5CBD1;
    color: var(--bale-text-secondary);
    font-size: 14px;
    direction: ltr;
}
.bale-phone-input input { padding: 14px 12px; }

.bale-modal-sm { max-width: 380px; }
.bale-pin-body { text-align: center; padding-top: 8px; }
.bale-pin-checkbox { justify-content: flex-start; text-align: right; }
.bale-pin-actions { flex-direction: row-reverse; }
.bale-pin-actions .bale-btn { width: auto; flex: 1; }

.bale-forward-body { padding-top: 0; }
.bale-forward-tabs { border-bottom: 1px solid var(--bale-border); margin: 0 -20px; padding: 0 8px; }
.bale-forward-list { max-height: 320px; overflow-y: auto; margin: 0 -20px; }
.bale-forward-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    cursor: pointer;
    border-bottom: 1px solid var(--bale-border);
}
.bale-forward-row:hover { background: var(--bale-hover, #F5F6F6); }
.bale-forward-row-body { flex: 1; min-width: 0; }
.bale-forward-row-name { font-weight: 500; font-size: 14px; }
.bale-forward-row-preview { font-size: 12px; color: var(--bale-text-secondary); }
.bale-forward-row-time { font-size: 11px; color: var(--bale-text-secondary); }
.bale-forward-check {
    width: 22px;
    height: 22px;
    border: 2px solid #C5CBD1;
    border-radius: 6px;
    appearance: none;
    cursor: pointer;
    flex-shrink: 0;
}
.bale-forward-check:checked {
    background: var(--bale-primary);
    border-color: var(--bale-primary);
}

.bale-profile-modal-header {
    border-bottom: none;
    justify-content: space-between;
    padding: 12px 16px;
}
.bale-profile-kebab { font-size: 20px; }
.bale-profile-modal-body { padding: 0 0 16px; overflow-y: auto; max-height: 85vh; }
.bale-profile-modal .profile-top { padding-top: 0; }
.bale-profile-actions {
    display: flex;
    gap: 12px;
    margin: 16px 20px;
    justify-content: stretch;
}
.bale-profile-action {
    flex: 1;
    border: 1px solid var(--bale-border);
    border-radius: 12px;
    padding: 12px 8px;
    font-size: 11px;
}
.bale-profile-tabs {
    display: flex;
    border-bottom: 1px solid var(--bale-border);
    margin-top: 8px;
}
.bale-profile-tab {
    flex: 1;
    padding: 12px 8px;
    border: none;
    background: none;
    font-family: inherit;
    font-size: 13px;
    color: var(--bale-text-secondary);
    cursor: pointer;
    position: relative;
}
.bale-profile-tab.active { color: var(--bale-primary); font-weight: 600; }
.bale-profile-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 15%;
    right: 15%;
    height: 3px;
    background: var(--bale-primary);
    border-radius: 3px 3px 0 0;
}
.bale-profile-tab-panel { padding: 12px 20px; }
.bale-profile-file-search { margin: 0 0 12px; }
.bale-profile-files-list { display: flex; flex-direction: column; gap: 4px; }
.bale-profile-file-row .bale-file-dl-icon {
    text-decoration: none;
    flex-shrink: 0;
}
.bale-profile-file-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--bale-border);
}
.bale-profile-file-row .bale-file-icon { width: 40px; height: 40px; font-size: 10px; }
.bale-profile-file-info { flex: 1; }
.bale-profile-file-name { font-size: 14px; font-weight: 500; }
.bale-profile-file-size { font-size: 12px; color: var(--bale-text-secondary); }

.bale-context-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
}
.bale-context-item .ctx-icon {
    width: 20px;
    text-align: center;
    color: var(--bale-text-secondary);
}

.bale-selection-bar {
    justify-content: space-between;
    padding: 10px 20px;
}
.bale-selection-close {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    font-family: inherit;
    font-size: 16px;
    cursor: pointer;
    color: var(--bale-text);
}
.bale-selection-actions { display: flex; gap: 20px; }
.bale-selection-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    font-family: inherit;
    font-size: 11px;
    color: var(--bale-primary);
    cursor: pointer;
}
.bale-selection-btn.danger { color: var(--bale-danger); }
.bale-selection-btn .sel-icon { font-size: 18px; }

.bale-reply-bar {
    border-right: 3px solid var(--bale-link);
    padding-right: 12px;
    margin: 0 16px;
    border-radius: 0;
    background: var(--bale-surface-alt);
}
.bale-reply-content { flex: 1; border-right: none; }
.bale-reply-label { font-size: 12px; color: var(--bale-link); font-weight: 500; }
.bale-reply-text { font-size: 13px; color: var(--bale-text-secondary); }
.bale-reply-close { color: var(--bale-text-secondary); }

.bale-voice-wave {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 2px;
    height: 28px;
}
.bale-voice-wave span {
    width: 3px;
    background: var(--bale-primary);
    border-radius: 2px;
    opacity: 0.7;
}
.bale-voice-duration { font-size: 12px; color: var(--bale-text-secondary); direction: ltr; }

.bale-voice-player.playing .bale-voice-play { background: var(--bale-primary); }
.bale-voice-wave span.active { opacity: 1; background: var(--bale-link); }
.bale-voice-wave span.played { opacity: 0.85; }

.bale-voice-recording {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
    background: var(--bale-sidebar);
    border-top: 1px solid var(--bale-border);
}
.bale-voice-rec-delete {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    color: #e74c3c;
    cursor: pointer;
    padding: 0;
}
.bale-voice-rec-delete .bale-svg-icon { width: 22px; height: 22px; }
.bale-voice-rec-center {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 0;
}
.bale-voice-rec-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #e74c3c;
    flex-shrink: 0;
    animation: bale-rec-pulse 1s ease-in-out infinite;
}
.bale-voice-recording.preview .bale-voice-rec-dot {
    animation: none;
    opacity: 0.45;
}
.bale-voice-rec-stop {
    background: none;
    border: none;
    font-family: inherit;
    font-size: 15px;
    color: var(--bale-text);
    cursor: pointer;
    padding: 4px 2px;
}
.bale-voice-rec-stop:disabled {
    opacity: 0.45;
    cursor: default;
}
.bale-voice-rec-time {
    font-size: 15px;
    font-weight: 500;
    color: var(--bale-text);
    direction: ltr;
    font-variant-numeric: tabular-nums;
    min-width: 44px;
}
@keyframes bale-rec-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.85); }
}
.bale-voice-rec-send {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: var(--bale-primary);
    color: #fff;
    cursor: pointer;
    padding: 0;
    box-shadow: 0 2px 6px rgba(0, 150, 136, 0.35);
}
.bale-voice-rec-send .bale-svg-icon { width: 20px; height: 20px; }
.bale-voice-rec-send:hover { filter: brightness(1.05); }
.bale-voice-rec-send:active { transform: scale(0.96); }

.bale-emoji-picker {
    width: 360px;
    padding: 0;
    overflow: hidden;
}
.bale-emoji-toolbar {
    display: flex;
    gap: 2px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--bale-border);
    overflow-x: auto;
}
.bale-emoji-cat {
    background: none;
    border: none;
    font-size: 18px;
    padding: 6px 8px;
    border-radius: 8px;
    cursor: pointer;
    opacity: 0.6;
}
.bale-emoji-cat.active { opacity: 1; background: var(--bale-active-bg); }
.bale-emoji-search { margin: 8px 12px; padding: 6px 12px; }
.bale-emoji-section-label {
    padding: 4px 14px 6px;
    font-size: 12px;
    color: var(--bale-text-secondary);
}
.bale-emoji-picker .bale-emoji-grid {
    padding: 0 10px 8px;
    max-height: 180px;
}
.bale-emoji-tabs {
    display: flex;
    align-items: center;
    border-top: 1px solid var(--bale-border);
    padding: 0 8px;
}
.bale-emoji-tab {
    flex: 1;
    padding: 10px 4px;
    border: none;
    background: none;
    font-family: inherit;
    font-size: 12px;
    color: var(--bale-text-secondary);
    cursor: pointer;
    position: relative;
}
.bale-emoji-tab.active { color: var(--bale-primary); font-weight: 600; }
.bale-emoji-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20%;
    right: 20%;
    height: 2px;
    background: var(--bale-primary);
}
.bale-emoji-backspace {
    background: none;
    border: none;
    font-size: 18px;
    padding: 8px 12px;
    cursor: pointer;
    color: var(--bale-text-secondary);
}
.bale-emoji-empty {
    text-align: center;
    padding: 24px 16px;
    font-size: 13px;
    color: var(--bale-text-secondary);
}
.bale-emoji-loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 24px;
    font-size: 13px;
    color: var(--bale-text-secondary);
}
.bale-emoji-toolbar.hidden,
.bale-emoji-search.hidden,
.bale-emoji-section-label.hidden { display: none; }
.bale-media-asset-grid {
    grid-template-columns: repeat(4, 1fr);
    max-height: 220px;
    gap: 6px;
}
.bale-media-asset-btn {
    background: none;
    border: none;
    padding: 6px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
}
.bale-media-asset-btn:hover { background: var(--bale-bg); }
.bale-media-asset-btn img {
    width: 100%;
    height: 100%;
    max-width: 72px;
    max-height: 72px;
    object-fit: contain;
    pointer-events: none;
}
.bale-bubble-sticker {
    background: transparent !important;
    box-shadow: none !important;
    padding: 4px 0 !important;
}
.bale-sticker-image {
    width: 128px;
    height: 128px;
    object-fit: contain;
    display: block;
}
.bale-gif-image {
    max-width: 200px;
    max-height: 200px;
    border-radius: 8px;
    display: block;
    object-fit: contain;
}

.bale-magazine-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
}
.bale-magazine-header h1 { text-align: center; }
.bale-magazine-header-end { text-align: left; }

.bale-service-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
}
.bale-service-section-head h3 {
    margin: 0;
    min-width: 0;
}
.bale-service-all-link {
    color: var(--bale-primary);
    text-decoration: none;
    font-size: 12px;
    white-space: nowrap;
    flex-shrink: 0;
}
.bale-service-cards-scroll {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
}
.bale-service-cards-scroll::-webkit-scrollbar { display: none; }
.bale-service-card {
    flex: 0 0 130px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 14px 10px;
    border: 1px solid var(--bale-border);
    border-radius: 14px;
    background: var(--bale-surface, #fff);
    cursor: pointer;
    font-family: inherit;
    text-align: center;
}
.bale-service-card-icon { font-size: 32px; }
.bale-service-card-title { font-size: 11px; color: var(--bale-text); line-height: 1.4; }
.bale-service-card-tag {
    font-size: 10px;
    color: var(--bale-primary);
    background: var(--bale-highlight-bg, #E7F8F5);
    padding: 2px 8px;
    border-radius: 999px;
}
.bale-subsidy-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}
.bale-subsidy-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    min-width: 72px;
}
.bale-subsidy-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--bale-surface-alt, #F0F2F5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    border: 1px solid var(--bale-border);
}
.bale-subsidy-chip small { font-size: 11px; color: var(--bale-text); }

.bale-muted { color: var(--bale-text-secondary); font-size: 13px; }

/* فاز A — pagination, upload, media */
.bale-messages-loader {
    text-align: center;
    padding: 8px;
    font-size: 12px;
    color: var(--bale-text-secondary);
    background: rgba(255,255,255,.85);
    position: sticky;
    top: 0;
    z-index: 2;
}
.bale-upload-progress {
    position: absolute;
    bottom: 100%;
    left: 12px;
    right: 12px;
    background: var(--bale-surface, #fff);
    border-radius: 10px;
    padding: 10px 14px;
    box-shadow: 0 2px 12px rgba(0,0,0,.12);
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    z-index: 10;
}
.bale-upload-progress-bar {
    flex: 1;
    height: 6px;
    background: var(--bale-surface-alt, #E9EDEF);
    border-radius: 3px;
    overflow: hidden;
}
.bale-upload-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--bale-primary, #00B894);
    border-radius: 3px;
    transition: width .15s ease;
}
.bale-upload-progress-text {
    font-size: 12px;
    color: var(--bale-text-secondary);
    min-width: 36px;
    text-align: left;
}
.bale-media-link { display: block; border-radius: 8px; overflow: hidden; }
.bale-media-image {
    max-width: 280px;
    max-height: 320px;
    width: 100%;
    display: block;
    border-radius: 8px;
    object-fit: cover;
}
.bale-media-video {
    max-width: 280px;
    max-height: 320px;
    width: 100%;
    border-radius: 8px;
    display: block;
    background: #000;
}
.bale-media-caption { margin-top: 6px; }
.bale-location-card {
    display: block;
    text-decoration: none;
    color: inherit;
    border-radius: 8px;
    overflow: hidden;
    max-width: 280px;
}
.bale-location-map {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
    background: var(--bale-surface-alt, #E9EDEF);
}
.bale-location-label {
    display: block;
    padding: 8px 4px 2px;
    font-size: 13px;
    color: var(--bale-primary, #00B894);
}
.bale-mag-forward-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    padding: 10px;
    margin: 0;
    border: 1px solid var(--bale-border);
    border-radius: 10px;
    background: rgba(0, 166, 147, 0.06);
    text-align: right;
    cursor: pointer;
    font: inherit;
    color: inherit;
    transition: background 0.15s ease;
}

.bale-mag-forward-card:hover,
.bale-mag-forward-card:focus-visible {
    background: rgba(0, 166, 147, 0.12);
    outline: none;
}

.bale-mag-forward-icon {
    font-size: 22px;
    line-height: 1;
    flex-shrink: 0;
}

.bale-mag-forward-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.bale-mag-forward-channel {
    font-weight: 600;
    font-size: 14px;
    color: var(--bale-link);
}

.bale-mag-forward-preview {
    font-size: 13px;
    color: var(--bale-text-secondary);
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.bale-wallet-withdraw-main {
    padding: 16px;
    overflow: auto;
    flex: 1;
    min-height: 0;
}

.bale-wallet-withdraw-inner {
    max-width: 560px;
    margin: 0 auto;
    width: 100%;
}

.bale-wallet-withdraw-mobile {
    display: none;
}

.bale-wallet-withdraw-balance {
    padding: 16px;
    background: var(--bale-surface-alt, #E8EDF2);
    margin-bottom: 16px;
    border-radius: 10px;
    text-align: center;
}

.bale-wallet-withdraw-balance-label {
    font-size: 13px;
    color: var(--bale-text-secondary, #667781);
}

.bale-wallet-withdraw-balance-amount {
    font-size: 20px;
    font-weight: 600;
    color: #00A693;
    margin-top: 4px;
}

.bale-wallet-withdraw-balance .bale-btn {
    display: block;
    margin-top: 12px;
}

.bale-wallet-transactions-main {
    padding: 16px;
    overflow: auto;
    flex: 1;
    min-height: 0;
}

.bale-wallet-empty {
    text-align: center;
    color: var(--bale-text-secondary, #667781);
    padding: 40px 16px;
    margin: 0;
}

.bale-wallet-transactions-list {
    max-width: 560px;
    margin: 0 auto;
    width: 100%;
}

.bale-wallet-transaction-item {
    background: var(--bale-surface, #fff);
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.bale-wallet-transaction-info {
    flex: 1;
    min-width: 0;
}

.bale-wallet-transaction-title {
    font-weight: 500;
    font-size: 14px;
    line-height: 1.4;
    word-break: break-word;
}

.bale-wallet-transaction-time {
    font-size: 12px;
    color: var(--bale-text-secondary, #667781);
    margin-top: 4px;
}

.bale-wallet-transaction-amounts {
    text-align: left;
    flex-shrink: 0;
}

.bale-wallet-transaction-amount {
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
}

.bale-wallet-transaction-amount.positive { color: #00A693; }
.bale-wallet-transaction-amount.negative { color: #c0392b; }

.bale-wallet-transaction-balance {
    font-size: 11px;
    color: var(--bale-text-secondary, #667781);
    margin-top: 4px;
    white-space: nowrap;
}

@media (max-width: 900px) {
    .bale-app.bale-wallet-transactions .bale-sidebar { display: none; }

    .bale-app.bale-wallet-withdraw .bale-sidebar { display: none; }

    .bale-wallet-withdraw-mobile {
        display: block;
        max-width: 560px;
        margin: 0 auto;
        width: 100%;
    }

    .bale-wallet-withdraw-main {
        padding: 12px;
    }

    .bale-wallet-transactions-main {
        padding: 12px;
    }

    .bale-wallet-transaction-item {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .bale-wallet-transaction-amounts {
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: right;
        border-top: 1px solid var(--bale-border);
        padding-top: 8px;
    }

    .bale-wallet-transaction-amount,
    .bale-wallet-transaction-balance {
        font-size: 13px;
    }
}

.bale-credit-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(0,184,148,.08);
    border-radius: 8px;
    min-width: 180px;
}
.bale-credit-icon { font-size: 28px; }
.bale-credit-text { font-weight: 600; color: var(--bale-primary, #00B894); }
.bale-chat-header-status.online { color: var(--bale-primary, #00B894); }

/* Site admin panel */
.bale-admin-app {
    display: flex;
    min-height: 100vh;
    background: var(--bale-bg, #f0f2f5);
}
.bale-admin-sidebar {
    width: 260px;
    flex-shrink: 0;
    background: linear-gradient(180deg, #1a3a42 0%, #0f2429 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    padding: 20px 0;
}
.bale-admin-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px 24px;
    border-bottom: 1px solid rgba(255,255,255,.1);
    margin-bottom: 16px;
}
.bale-admin-brand-icon { font-size: 28px; }
.bale-admin-brand-title { font-size: 16px; font-weight: 700; }
.bale-admin-brand-sub { font-size: 12px; opacity: .7; margin-top: 2px; }
.bale-admin-nav { flex: 1; display: flex; flex-direction: column; gap: 2px; padding: 0 12px; }
.bale-admin-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    color: rgba(255,255,255,.85);
    text-decoration: none;
    font-size: 14px;
    transition: background .15s;
}
.bale-admin-nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.bale-admin-nav-item.active { background: var(--bale-primary, #00B894); color: #fff; }
.bale-admin-nav-divider { height: 1px; background: rgba(255,255,255,.1); margin: 12px 8px; }
.bale-admin-back {
    margin: 16px 20px 0;
    padding: 10px 14px;
    border-radius: 8px;
    color: rgba(255,255,255,.7);
    text-decoration: none;
    font-size: 13px;
    border: 1px solid rgba(255,255,255,.15);
    text-align: center;
}
.bale-admin-back:hover { background: rgba(255,255,255,.06); color: #fff; }
.bale-admin-main {
    flex: 1;
    overflow: auto;
    padding: 28px 32px;
    max-width: 1000px;
}
.bale-admin-page-header { margin-bottom: 24px; }
.bale-admin-page-header h1 { margin: 0 0 6px; font-size: 22px; }
.bale-admin-page-header p { margin: 0; color: var(--bale-text-secondary, #667781); font-size: 14px; }
.bale-admin-card {
    background: var(--bale-surface, #fff);
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.bale-admin-card h2 { margin: 0 0 16px; font-size: 16px; }
.bale-admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.bale-admin-stat-card {
    background: var(--bale-surface, #fff);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.bale-admin-stat-value { font-size: 32px; font-weight: 700; color: var(--bale-primary, #00B894); }
.bale-admin-stat-label { font-size: 13px; color: var(--bale-text-secondary, #667781); margin: 4px 0 12px; }
.bale-admin-stat-link { font-size: 13px; color: var(--bale-primary, #00B894); text-decoration: none; }
.bale-admin-guide { margin: 0; padding-right: 20px; line-height: 1.8; font-size: 14px; color: var(--bale-text, #3b4a54); }
.bale-admin-alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}
.bale-admin-alert-success { background: var(--bale-highlight-bg, #E7F8F5); color: #009688; }
.bale-admin-alert-error { background: #fdecea; color: #c0392b; }
.bale-admin-empty { color: var(--bale-text-secondary, #667781); text-align: center; padding: 24px 0; margin: 0; }
.bale-admin-form { display: grid; gap: 12px; max-width: 480px; }
.bale-admin-submit { width: auto !important; padding: 10px 24px !important; }
.bale-admin-danger-btn { color: #c0392b !important; border-color: #f5c6cb !important; }
.bale-admin-tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.bale-admin-tabs .bale-btn { width: auto; padding: 8px 20px; }
.bale-admin-table-wrap { overflow-x: auto; }
.bale-admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.bale-admin-table th {
    background: var(--bale-surface-alt, #E8EDF2);
    padding: 12px;
    text-align: right;
    font-weight: 600;
}
.bale-admin-table td { padding: 12px; border-top: 1px solid var(--bale-border, #E9EDEF); vertical-align: top; }
.bale-admin-role-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.bale-admin-role-actions .bale-btn { font-size: 11px; padding: 4px 10px; width: auto; }
.bale-admin-story-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}
.bale-admin-story-item {
    border: 1px solid var(--bale-border, #E9EDEF);
    border-radius: 12px;
    overflow: hidden;
}
.bale-admin-story-item.expired { opacity: .55; }
.bale-admin-story-media { width: 100%; height: 140px; object-fit: cover; display: block; }
.bale-admin-story-text {
    min-height: 100px;
    padding: 16px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    font-size: 14px;
    display: flex;
    align-items: center;
}
.bale-admin-story-meta { padding: 10px 12px; font-size: 13px; }
.bale-admin-story-stats { font-size: 11px; color: var(--bale-text-secondary, #667781); margin: 4px 0 8px; }
.bale-admin-badge-muted {
    background: var(--bale-surface-alt, #E9EDEF);
    color: var(--bale-text-secondary, #667781);
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 4px;
}
.bale-admin-promo-list { display: flex; flex-direction: column; gap: 12px; }
.bale-admin-promo-item {
    display: flex;
    gap: 14px;
    padding: 14px;
    border: 1px solid var(--bale-border, #E9EDEF);
    border-radius: 12px;
}
.bale-admin-promo-item.inactive { opacity: .55; }
.bale-admin-promo-img {
    width: 72px;
    height: 72px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
}
.bale-admin-promo-img-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bale-surface-alt, #E8EDF2);
    font-size: 28px;
}
.bale-admin-promo-body { flex: 1; min-width: 0; }
.bale-admin-promo-title { font-weight: 600; font-size: 15px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bale-admin-promo-desc { font-size: 13px; color: var(--bale-text-secondary, #667781); margin-top: 4px; }
.bale-admin-promo-link { font-size: 12px; color: var(--bale-primary); margin-top: 4px; }
.bale-admin-promo-meta { font-size: 11px; color: var(--bale-text-secondary, #667781); margin-top: 6px; }
.bale-admin-promo-actions { display: flex; gap: 8px; margin-top: 10px; }
.bale-admin-promo-actions .bale-btn { font-size: 12px; padding: 6px 12px; width: auto; }
.bale-admin-pre {
    background: var(--bale-surface-alt, #f4f6f8);
    border: 1px solid var(--bale-border, #E9EDEF);
    border-radius: 8px;
    padding: 14px 16px;
    font-size: 12px;
    line-height: 1.6;
    overflow-x: auto;
    margin: 12px 0 0;
    white-space: pre-wrap;
    word-break: break-all;
}
.bale-admin-media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 16px;
}
.bale-admin-media-item {
    border: 1px solid var(--bale-border, #E9EDEF);
    border-radius: 12px;
    padding: 12px;
    text-align: center;
}
.bale-admin-media-item.inactive { opacity: .5; }
.bale-admin-media-item img { width: 80px; height: 80px; object-fit: contain; margin-bottom: 8px; }
.bale-admin-media-name { font-size: 13px; font-weight: 500; }
.bale-admin-media-date { font-size: 11px; color: var(--bale-text-secondary, #667781); margin-bottom: 8px; }
.bale-admin-media-actions { display: flex; gap: 4px; justify-content: center; flex-wrap: wrap; }
.bale-admin-media-actions .bale-btn { font-size: 11px; padding: 4px 8px; width: auto; }
.bale-admin-poll-card { margin-bottom: 12px; }
.bale-admin-poll-title { font-weight: 600; margin-bottom: 4px; }
.bale-admin-poll-meta { font-size: 13px; color: var(--bale-text-secondary, #667781); margin-bottom: 12px; }
.bale-admin-poll-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    cursor: pointer;
    font-size: 14px;
}
.bale-admin-poll-votes { font-size: 12px; color: var(--bale-text-secondary, #667781); }

/* Channel promotions (user-facing) */
.bale-ad-tag {
    background: #ff9800;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
}
.bale-channel-promotions {
    flex-shrink: 0;
    margin: 8px 12px 12px;
    padding-top: 8px;
    border-top: 1px solid var(--bale-border);
}
.bale-channel-promotions.inline {
    margin: 16px 8px 8px;
    padding: 12px;
    background: var(--bale-surface, #fff);
    border: 1px solid var(--bale-border);
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.bale-messages .bale-channel-promotions {
    margin-top: 12px;
    border-top: none;
}
.bale-chat-list .bale-channel-promotions {
    margin: 0;
    padding: 12px 16px 8px;
    border-top: 1px solid var(--bale-border);
}
.bale-channel-promotions .bale-suggestions-box {
    margin-top: 0;
    background: var(--bale-surface, #fff);
    border-radius: 12px;
    border: 1px solid var(--bale-border);
    padding: 4px 12px;
}
.bale-field-hint {
    display: block;
    font-size: 12px;
    color: var(--bale-text-secondary, #667781);
    margin-top: 4px;
    line-height: 1.5;
}
.bale-promo-card { text-decoration: none; color: inherit; cursor: pointer; }
.bale-promo-card:hover { background: rgba(0,184,148,.04); }
.bale-promo-thumb { object-fit: cover; border-radius: 8px; }
.bale-promo-thumb-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bale-surface-alt, #E8EDF2);
    font-size: 20px;
    border-radius: 8px;
}
.bale-drawer-admin { color: var(--bale-primary, #00B894) !important; font-weight: 600; }

.bale-combobox { position: relative; }
.bale-combobox-list {
    position: absolute;
    z-index: 20;
    left: 0;
    right: 0;
    top: calc(100% - 4px);
    max-height: 180px;
    overflow-y: auto;
    background: var(--bale-surface, #fff);
    border: 1px solid var(--bale-border, #E9EDEF);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,.1);
}
.bale-combobox-list.hidden { display: none; }
.bale-combobox-item {
    display: block;
    width: 100%;
    text-align: right;
    padding: 10px 12px;
    border: none;
    background: none;
    font-size: 14px;
    cursor: pointer;
    color: inherit;
}
.bale-combobox-item:hover,
.bale-combobox-item.active { background: rgba(0,184,148,.08); }
.bale-combobox-item.create-new { color: var(--bale-primary, #00B894); font-weight: 500; }

@media (max-width: 900px) {
    .bale-admin-app { flex-direction: column; }
    .bale-admin-sidebar { width: 100%; padding: 12px 0; flex-shrink: 0; }
    .bale-admin-nav { flex-direction: row; flex-wrap: wrap; padding: 0 8px; }
    .bale-admin-nav-item { font-size: 12px; padding: 8px 10px; }
    .bale-admin-nav-divider { display: none; }
    .bale-admin-back { margin: 8px 12px 0; }
    .bale-admin-main {
        padding: 16px;
        overflow: visible;
        flex: 1 1 auto;
    }
}

/* ===== Bot inline buttons ===== */
.bale-inline-buttons {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}

.bale-inline-btn {
    width: 100%;
    border: 1px solid var(--bale-primary, #3390ec);
    background: transparent;
    color: var(--bale-primary, #3390ec);
    border-radius: 10px;
    padding: 8px 12px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, color .15s;
}

.bale-inline-btn:hover {
    background: var(--bale-primary, #3390ec);
    color: #fff;
}

/* ===== Magazine / channel comments ===== */
.bale-mag-comments-list,
.bale-forward-list {
    list-style: none;
    padding: 0;
    margin: 0 0 12px;
    max-height: 280px;
    overflow-y: auto;
}

.bale-mag-comment-item,
.bale-forward-item {
    display: flex;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--bale-border, #eee);
}

.bale-mag-comment-item > div {
    flex: 1;
    min-width: 0;
}

.bale-mag-comment-delete {
    align-self: flex-start;
    flex-shrink: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 8px;
    font-size: 0.95rem;
    line-height: 1;
    color: var(--bale-text-secondary, #667781);
    opacity: 0.65;
    transition: opacity 0.15s, background 0.15s, color 0.15s;
}

.bale-mag-comment-delete:hover {
    opacity: 1;
    background: rgba(192, 57, 43, 0.12);
    color: #c0392b;
}

.bale-mag-comment-form {
    display: flex;
    gap: 8px;
}

.bale-mag-comment-form input {
    flex: 1;
    padding: 8px;
    border-radius: 8px;
    border: 1px solid var(--bale-border, #ddd);
    font-family: inherit;
}

.bale-mag-login-hint {
    margin: 0;
    padding: 12px 0 0;
    text-align: center;
    color: var(--bale-text-secondary, #666);
    font-size: 0.9rem;
}

.bale-mag-login-hint a {
    color: var(--bale-primary, #2ecc71);
    font-weight: 600;
}

.bale-mag-comment-error {
    margin: 8px 0 0;
    color: #c0392b;
    font-size: 0.85rem;
    text-align: center;
}

.bale-mag-comment-error.hidden {
    display: none;
}

.bale-channel-comment-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 4px 0 0 4px;
    padding: 2px 8px;
    border: none;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.05);
    color: var(--bale-text-secondary, #667781);
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    transition: background .15s, color .15s;
}

/* ===== Media viewer (lightbox) ===== */
.bale-media-viewer {
    position: fixed;
    inset: 0;
    z-index: 4000;
    display: flex;
    flex-direction: column;
    direction: rtl;
    background: rgba(8, 12, 16, 0.78);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .18s ease, visibility .18s ease;
}

.bale-media-viewer.visible {
    opacity: 1;
    visibility: visible;
}

.bale-mv-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 16px 20px 8px;
    flex-shrink: 0;
}

.bale-mv-chat-info {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    min-width: 0;
}

.bale-mv-chat-info img {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.bale-mv-chat-name {
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bale-mv-chat-time {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 3px;
}

.bale-mv-top-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.bale-mv-actions-pill {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 6px;
    background: rgba(28, 32, 38, 0.85);
    border-radius: 14px;
}

.bale-mv-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    transition: background .15s;
}

.bale-mv-btn:hover {
    background: rgba(255, 255, 255, 0.12);
}

.bale-mv-btn svg {
    width: 22px;
    height: 22px;
    display: block;
}

.bale-mv-stage {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 0;
    padding: 0 64px;
    gap: 12px;
}

.bale-mv-media-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    max-width: 100%;
}

.bale-mv-media-wrap img,
.bale-mv-media-wrap video {
    max-width: min(82vw, 1100px);
    max-height: 72vh;
    border-radius: 6px;
    object-fit: contain;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    background: #000;
}

.bale-mv-media-wrap img.zoomed {
    max-width: none;
    max-height: none;
    width: auto;
    cursor: zoom-out;
}

.bale-mv-media-wrap img {
    cursor: zoom-in;
}

.bale-media-viewer.has-zoom .bale-mv-stage {
    overflow: auto;
    justify-content: flex-start;
}

.bale-mv-caption {
    max-width: min(82vw, 700px);
    text-align: center;
    color: #fff;
    font-size: 14px;
    line-height: 1.9;
    white-space: pre-wrap;
    background: rgba(20, 24, 28, 0.65);
    border-radius: 10px;
    padding: 6px 14px;
    flex-shrink: 0;
}

.bale-mv-caption:empty {
    display: none;
}

.bale-mv-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 52px;
    height: 52px;
    border: none;
    border-radius: 50%;
    background: rgba(28, 32, 38, 0.55);
    color: #fff;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
    transition: background .15s, opacity .15s;
}

.bale-mv-nav:hover {
    background: rgba(28, 32, 38, 0.85);
}

.bale-mv-nav.hidden {
    display: none;
}

.bale-mv-nav-prev { right: 16px; }
.bale-mv-nav-next { left: 16px; }

.bale-mv-bottom {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px 18px;
    flex-shrink: 0;
}

.bale-mv-bottom-bar {
    display: flex;
    align-items: center;
    gap: 28px;
    padding: 6px 24px;
    background: rgba(28, 32, 38, 0.85);
    border-radius: 14px;
}

.bale-mv-counter {
    color: rgba(255, 255, 255, 0.75);
    font-size: 12.5px;
    min-width: 48px;
    text-align: center;
}

@media (max-width: 640px) {
    .bale-mv-stage { padding: 0 8px; }
    .bale-mv-media-wrap img,
    .bale-mv-media-wrap video {
        max-width: 96vw;
        max-height: 64vh;
    }
    .bale-mv-nav {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    .bale-mv-nav-prev { right: 6px; }
    .bale-mv-nav-next { left: 6px; }
    .bale-mv-chat-info img { width: 36px; height: 36px; }
    .bale-mv-bottom-bar { gap: 18px; padding: 4px 16px; }
}

.bale-channel-comment-btn:hover {
    background: rgba(0, 184, 148, 0.12);
    color: var(--bale-primary, #00B894);
}

.bale-channel-comment-icon {
    font-size: 13px;
    line-height: 1;
}

.bale-message.incoming .bale-channel-comment-btn {
    margin-right: 4px;
    margin-left: 0;
}

/* Admin dashboard analytics */
.bale-admin-main:has(.bale-admin-page--dashboard) {
    max-width: 1320px;
}
.bale-admin-section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--bale-text-secondary, #667781);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 12px;
}
.bale-admin-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}
.bale-admin-kpi-card {
    background: var(--bale-surface, #fff);
    border-radius: 12px;
    padding: 16px 18px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
    border-right: 3px solid var(--bale-primary, #00B894);
}
.bale-admin-kpi-label {
    font-size: 12px;
    color: var(--bale-text-secondary, #667781);
    margin-bottom: 6px;
}
.bale-admin-kpi-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--bale-text, #1a3a42);
    line-height: 1.3;
}
.bale-admin-kpi-sub {
    font-size: 12px;
    color: var(--bale-text-secondary, #667781);
    margin-top: 4px;
}
.bale-admin-kpi-trend {
    font-size: 11px;
    margin-top: 8px;
    font-weight: 600;
}
.bale-admin-kpi-trend--up { color: #00B894; }
.bale-admin-kpi-trend--down { color: #e17055; }
.bale-admin-kpi-trend--neutral { color: var(--bale-text-secondary, #667781); }
.bale-admin-chart-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}
.bale-admin-chart-card--wide { grid-column: 1 / -1; }
.bale-admin-chart-wrap {
    position: relative;
    height: 260px;
}
.bale-admin-chart-wrap--donut {
    height: 280px;
}
.bale-admin-insights {
    display: grid;
    gap: 12px;
}
.bale-admin-insight {
    padding: 14px 16px;
    border-radius: 10px;
    border-right: 4px solid #667781;
}
.bale-admin-insight--success {
    background: var(--bale-highlight-bg, #E7F8F5);
    border-right-color: #00B894;
}
.bale-admin-insight--warning {
    background: #fff8e6;
    border-right-color: #f39c12;
}
.bale-admin-insight--info {
    background: #eef4fb;
    border-right-color: #0984e3;
}
.bale-admin-insight-title {
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 4px;
    color: var(--bale-text, #1a3a42);
}
.bale-admin-insight-text {
    margin: 0;
    font-size: 13px;
    line-height: 1.7;
    color: var(--bale-text, #3b4a54);
}
@media (max-width: 900px) {
    .bale-admin-chart-grid { grid-template-columns: 1fr; }
    .bale-admin-chart-card--half { grid-column: auto; }
}

.bale-referral-main {
    max-width: 640px;
    margin: 0 auto;
    padding-bottom: 32px;
}

.bale-referral-inner {
    padding: 0 16px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.bale-referral-hero {
    text-align: center;
    padding: 20px 12px 8px;
}

.bale-referral-hero-icon {
    font-size: 48px;
    margin-bottom: 8px;
}

.bale-referral-hero h2 {
    font-size: 20px;
    margin: 0 0 10px;
}

.bale-referral-hero p {
    margin: 0;
    font-size: 14px;
    line-height: 1.8;
    color: var(--bale-text-secondary, #667781);
}

.bale-referral-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    text-align: center;
    padding: 16px 12px;
}

.bale-referral-stat-value {
    font-size: 18px;
    font-weight: 700;
}

.bale-referral-stat-earned {
    color: #00A693;
}

.bale-referral-stat-label {
    font-size: 12px;
    color: var(--bale-text-secondary, #667781);
    margin-top: 4px;
}

.bale-referral-link-label {
    font-size: 13px;
    color: var(--bale-text-secondary, #667781);
    margin-bottom: 10px;
}

.bale-referral-link-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.bale-referral-link-input {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid var(--bale-border, #E9EDEF);
    border-radius: 8px;
    font-size: 12px;
    background: var(--bale-surface-alt, #E8EDF2);
}

.bale-referral-copy-feedback {
    margin-top: 8px;
    font-size: 13px;
    color: #00A693;
}

.bale-referral-share-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.bale-referral-share-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px;
    border: 1px solid var(--bale-border, #E9EDEF);
    border-radius: 10px;
    background: var(--bale-surface, #fff);
    cursor: pointer;
}

.bale-referral-share-btn span {
    font-size: 22px;
}

.bale-referral-share-btn small {
    font-size: 11px;
    color: var(--bale-text-secondary, #667781);
}

.bale-referral-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.bale-referral-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--bale-border, #E9EDEF);
}

.bale-referral-list-item:last-child {
    border-bottom: none;
}

.bale-referral-list-name {
    font-size: 14px;
    font-weight: 500;
}

.bale-referral-list-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    font-size: 12px;
    color: var(--bale-text-secondary, #667781);
}

.bale-referral-rewarded {
    color: #00A693;
    font-weight: 600;
}

.bale-referral-pending {
    color: var(--bale-text-secondary, #667781);
}

.bale-referral-list-empty {
    padding: 16px 0;
    text-align: center;
    font-size: 13px;
    color: var(--bale-text-secondary, #667781);
}

@media (max-width: 520px) {
    .bale-referral-link-row {
        flex-direction: column;
    }

    .bale-referral-share-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

