:root {
    --bg-main: #efeae2;
    --bg-sidebar: #ffffff;
    --bg-header: rgba(240, 242, 245, 0.98);
    --bg-input: #ffffff;
    --bg-panel: #ffffff;
    --bg-elevated: #f7f8fa;
    --bg-soft: #f0f2f5;
    --primary: #00a884;
    --primary-hover: #0abf97;
    --text-primary: #111b21;
    --text-secondary: #54656f;
    --text-muted: #667781;
    --border: #e9edef;
    --msg-in: #ffffff;
    --msg-out: #d9fdd3;
    --system-msg: #ffffff;
    --highlight: #f5c518;
    --danger: #ff6b6b;
    --shadow-sm: 0 1px 0.5px rgba(11, 20, 26, 0.13);
    --shadow-md: 0 6px 18px rgba(11, 20, 26, 0.08);
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    --wa-row-gap: 2px;
    --wa-bubble-radius: 7.5px;
    --wa-meta-fs: 11px;
}

body:not(.light-theme) {
    --bg-main: #0b141a;
    --bg-sidebar: #111b21;
    --bg-header: rgba(32, 44, 51, 0.96);
    --bg-input: #202c33;
    --bg-panel: #111b21;
    --bg-elevated: #182229;
    --bg-soft: #101920;
    --text-primary: #e9edef;
    --text-secondary: #8696a0;
    --text-muted: #667781;
    --border: #222d34;
    --msg-in: #202c33;
    --msg-out: #005c4b;
    --system-msg: #182229;
    --shadow-sm: 0 1px 0.5px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 20px 45px rgba(0, 0, 0, 0.35);
}

@page {
    size: A4;
    margin: 12mm;
}

@media print {
    html,
    body {
        width: auto !important;
        min-height: auto !important;
        height: auto !important;
        overflow: visible !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    #loader,
    .media-modal,
    .processing-overlay,
    #toast,
    .sidebar-backdrop,
    .dropdown-menu,
    .drawer,
    .date-sheet-backdrop {
        display: none !important;
    }

    .app-layout,
    .chat-interface,
    .preview-stage,
    .device-shell,
    .device-frame,
    .device-screen,
    .messages-viewport,
    .message-list {
        display: block !important;
        width: auto !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow: visible !important;
        box-shadow: none !important;
        margin: 0 !important;
    }

    body,
    .app-layout,
    .chat-interface,
    .preview-stage,
    .device-shell,
    .device-frame,
    .device-screen,
    .messages-viewport,
    .message-list,
    .bubble,
    .system-msg,
    .media-image,
    .media-sticker,
    .media-video,
    .media-gallery,
    .media-doc,
    .media-missing,
    .media-audio,
    .chat-header,
    .search-toolbar,
    .chat-footer {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    body {
        background: #ffffff !important;
        background-image: none !important;
    }

    .app-layout {
        height: auto !important;
        max-width: none !important;
        margin: 0 !important;
        border: 0 !important;
        box-shadow: none !important;
    }

    .sidebar {
        width: 290px !important;
        min-width: 290px !important;
        flex: 0 0 290px !important;
        display: flex !important;
    }

    .chat-interface {
        flex: 1 !important;
        border-left: 1px solid var(--border) !important;
    }

    .preview-stage {
        padding: 0 !important;
    }

    .device-shell[data-preview-mode="desktop"] {
        padding: 0 !important;
        background: transparent !important;
        border-radius: 0 !important;
        width: auto !important;
        height: auto !important;
    }

    .device-shell[data-preview-mode="desktop"] .device-frame {
        border-radius: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
    }

    .device-shell[data-preview-mode="mobile"] {
        margin: 0 auto !important;
        width: 430px !important;
        height: auto !important;
        background:
            linear-gradient(160deg, #2e3138, #0f1014 34%, #2f333a 68%, #111216) !important;
        border-radius: 54px !important;
        padding: 14px !important;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .device-shell[data-preview-mode="mobile"] .device-frame {
        border-radius: 42px !important;
        background: #000 !important;
        overflow: hidden !important;
    }

    .messages-viewport {
        overflow: visible !important;
        height: auto !important;
        max-height: none !important;
    }

    .msg-row {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .device-shell[data-preview-mode="desktop"] .msg-row {
        max-width: min(66%, 720px) !important;
    }

    .device-shell[data-preview-mode="mobile"] .msg-row {
        max-width: 82% !important;
    }

    .system-msg,
    .msg-media-stack,
    .media-gallery,
    .media-doc,
    .media-missing,
    .media-audio {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .sticky-date {
        position: static !important;
        top: auto !important;
    }

    .media-nav {
        display: none !important;
    }

    .media-gallery-more,
    .media-gallery-play {
        display: grid !important;
    }

    .search-toolbar:not(.active) {
        display: none !important;
    }

    .message-list img,
    .message-list video {
        opacity: 1 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .message-list .media-video video.print-has-poster,
    .message-list .media-gallery video.print-has-poster {
        display: none !important;
    }

    .print-video-poster {
        display: block !important;
        width: 100% !important;
        height: auto !important;
        max-width: 100% !important;
        max-height: none !important;
        border-radius: inherit !important;
        object-fit: cover !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .message-list .media-image img,
    .message-list .media-sticker img,
    .message-list .media-gallery img {
        width: 100% !important;
        height: auto !important;
        max-width: 100% !important;
        max-height: none !important;
        object-fit: cover !important;
        opacity: 1 !important;
    }

    a {
        text-decoration: none !important;
        color: inherit !important;
    }
}

body.light-theme {
    --bg-main: #efeae2;
    --bg-sidebar: #ffffff;
    --bg-header: rgba(240, 242, 245, 0.95);
    --bg-input: #ffffff;
    --bg-panel: #ffffff;
    --bg-elevated: #f4f5f7;
    --bg-soft: #eef2f4;
    --text-primary: #111b21;
    --text-secondary: #54656f;
    --text-muted: #667781;
    --border: #e9edef;
    --msg-in: #ffffff;
    --msg-out: #d9fdd3;
    --system-msg: #fff;
    --shadow-md: 0 18px 40px rgba(17, 27, 33, 0.12);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    width: 100%;
    min-height: 100dvh;
    height: 100dvh;
    overflow: hidden;
}

body {
    background: var(--bg-main);
    background-image: linear-gradient(180deg, #00a884 0, #00a884 126px, #e5ddd5 126px, #e5ddd5 100%);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 14.5px;
    line-height: 1.5;
}

body:not(.light-theme) {
    background: #111b21;
    background-image: linear-gradient(180deg, #005c4b 0, #005c4b 126px, #0b141a 126px, #0b141a 100%);
}

button,
input,
textarea {
    font: inherit;
}

button {
    color: inherit;
}

img,
video {
    max-width: 100%;
}

a {
    color: inherit;
}

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

:focus-visible {
    outline: 2px solid rgba(0, 168, 132, 0.65);
    outline-offset: 2px;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(134, 150, 160, 0.3);
    border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(134, 150, 160, 0.5);
}

#loader {
    position: fixed;
    inset: 0;
    z-index: 5000;
    background: var(--bg-main);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease;
}

.loader-content {
    width: min(320px, 88vw);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    color: var(--text-secondary);
    text-align: center;
}

.loader-logo {
    font-size: 64px;
    color: var(--primary);
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(134, 150, 160, 0.22);
    border-radius: 999px;
    overflow: hidden;
}

.progress-bar .fill {
    width: 0;
    height: 100%;
    background: var(--primary);
    border-radius: inherit;
    transition: width 0.7s ease;
}

.loader-content p {
    font-size: 12px;
    letter-spacing: 0.2px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.app-layout {
    display: flex;
    width: 100vw;
    height: 100dvh;
    margin: 0;
    position: relative;
    background: var(--bg-main);
    box-shadow: none;
    border: 0;
    overflow: hidden;
}

.sidebar {
    width: 400px;
    min-width: 320px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 200;
    transition: transform 0.35s cubic-bezier(0.19, 1, 0.22, 1);
    box-shadow: none;
    overflow: hidden;
}

.sidebar-header {
    height: 60px;
    background: var(--bg-header);
    backdrop-filter: blur(10px);
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.profile-button,
.sidebar-nav button,
.mobile-menu,
.header-tools button,
.drawer-close,
.chat-item,
.chat-footer button,
.search-input-group button,
.search-nav button,
.upi-display button,
.avatar-upload-trigger,
.btn-primary,
.btn-secondary,
.menu-item,
.media-modal-actions button,
.media-modal-actions a,
.media-modal-backdrop {
    border: 0;
    background: none;
    cursor: pointer;
    touch-action: manipulation;
}

.profile-thumb {
    border-radius: 50%;
}

.profile-thumb img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.sidebar-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.preview-toggle {
    display: inline-flex;
    align-items: center;
    padding: 4px;
    border-radius: 999px;
    background: rgba(17, 27, 33, 0.06);
    border: 1px solid rgba(17, 27, 33, 0.08);
}

.preview-toggle-btn {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    color: var(--text-secondary);
    font-size: 18px;
}

.preview-toggle-btn.active {
    background: #ffffff;
    color: var(--text-primary);
    box-shadow: 0 1px 3px rgba(11, 20, 26, 0.12);
}

.sidebar-nav button,
.header-tools button,
.mobile-menu,
.chat-footer button {
    color: var(--text-secondary);
    font-size: 22px;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s ease, color 0.2s ease;
}

.sidebar-nav button:hover,
.header-tools button:hover,
.chat-footer button:hover,
.mobile-menu:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.sidebar-content {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.sidebar-footer {
    padding: 12px;
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    background: var(--bg-sidebar);
}

.sidebar-footer a {
    color: var(--text-secondary);
    text-decoration: none;
}

.upload-state {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 30px 20px;
    gap: 20px;
    overflow-y: auto;
}

.load-hint {
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-secondary);
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
}

.hidden {
    display: none !important;
}

.brand-hero {
    text-align: center;
    margin-bottom: 10px;
}

.brand-hero h1 {
    font-weight: 300;
    font-size: 28px;
    color: var(--text-primary);
}

.brand-hero span {
    font-size: 12px;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 600;
}

.input-wrapper label {
    display: block;
    color: var(--primary);
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 8px;
    margin-left: 4px;
}

.display-name-picker {
    position: relative;
    display: flex;
    align-items: stretch;
}

.input-wrapper input,
.search-input-group input,
.date-sheet-input {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    background: var(--bg-input);
}

.input-wrapper input {
    padding: 12px 48px 12px 16px;
    transition: border-color 0.2s ease;
}

.display-name-toggle {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: 10px;
    color: var(--text-secondary);
    display: grid;
    place-items: center;
    font-size: 18px;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.display-name-toggle:hover,
.display-name-toggle[aria-expanded="true"] {
    background: var(--bg-soft);
    color: var(--primary);
}

.display-name-toggle:disabled {
    opacity: 0.55;
    cursor: wait;
}

.display-name-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 80;
    max-height: 220px;
    overflow-y: auto;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-sidebar);
    box-shadow: var(--shadow-md);
}

.display-name-option,
.display-name-empty {
    width: 100%;
    padding: 10px 12px;
    border-radius: 9px;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.3;
    text-align: left;
}

.display-name-option {
    display: block;
    color: var(--text-primary);
}

.display-name-option:hover,
.display-name-option:focus-visible {
    background: rgba(0, 168, 132, 0.08);
    color: var(--primary);
}

.input-wrapper input:focus,
.search-input-group input:focus,
.date-sheet-input:focus {
    border-color: var(--primary);
}

.input-help {
    margin-top: 8px;
    margin-left: 4px;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.4;
}

.drop-target {
    background: transparent;
    cursor: pointer;
    border: 2px dashed var(--border);
    border-radius: 16px;
    padding: 40px 20px;
    text-align: center;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.drop-target:hover,
.drop-target.dragover {
    border-color: var(--primary);
    background: rgba(0, 168, 132, 0.05);
}

.drop-target.ready {
    border-color: var(--primary);
    background: rgba(0, 168, 132, 0.1);
}

.drop-target i {
    font-size: 48px;
    color: var(--text-muted);
}

.btn-secondary,
.btn-primary,
.media-download {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.1s ease;
}

.btn-secondary,
.media-download {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 8px 20px;
    border-radius: 20px;
}

.btn-secondary:hover,
.media-download:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    border-radius: 24px;
    font-size: 15px;
    box-shadow: 0 4px 10px rgba(0, 168, 132, 0.3);
}

.btn-primary[disabled],
.btn-secondary[disabled],
.drop-target[disabled] {
    opacity: 0.6;
    cursor: wait;
    pointer-events: none;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-primary:active,
.btn-secondary:active,
.media-download:active {
    transform: scale(0.98);
}

.privacy-pill {
    background: rgba(0, 168, 132, 0.08);
    color: var(--primary);
    padding: 10px;
    border-radius: 8px;
    font-size: 11px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 500;
}

.chat-list {
    padding: 10px;
    height: 100%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.search-bar-sidebar {
    background: var(--bg-input);
    padding: 8px 12px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
    border-bottom: 1px solid transparent;
}

.search-bar-sidebar:focus-within {
    border-bottom-color: var(--primary);
}

.search-bar-sidebar input {
    background: transparent;
    border: none;
    flex: 1;
    color: var(--text-primary);
}

.chat-item {
    display: flex;
    gap: 15px;
    padding: 12px;
    border-radius: 12px;
    align-items: center;
    text-align: left;
    color: inherit;
    transition: background 0.2s ease;
}

.chat-item.active,
.chat-item:hover {
    background: var(--bg-header);
}

.chat-item-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6a7175, #88939a);
    flex-shrink: 0;
}

.chat-item-info {
    flex: 1;
    min-width: 0;
}

.chat-item-info h4 {
    font-weight: 500;
    font-size: 16px;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-item-info span {
    font-size: 13px;
    color: var(--text-secondary);
}

.drawer {
    position: absolute;
    inset: 0;
    background: var(--bg-panel);
    transform: translateX(-100%);
    transition: transform 0.35s cubic-bezier(0.19, 1, 0.22, 1);
    z-index: 300;
    display: flex;
    flex-direction: column;
}

.drawer.open {
    transform: translateX(0);
}

.drawer-header {
    height: 110px;
    background: var(--bg-header);
    display: flex;
    align-items: flex-end;
    padding: 20px;
    gap: 20px;
    border-bottom: 1px solid var(--border);
}

.drawer-header h2 {
    font-size: 19px;
    font-weight: 500;
}

.drawer-close {
    color: var(--text-primary);
    font-size: 24px;
}

.drawer-scroll {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.profile-hero {
    text-align: center;
    margin-bottom: 30px;
}

.large-avatar {
    width: 200px;
    height: 200px;
    margin: 0 auto 20px;
    position: relative;
    border-radius: 50%;
    overflow: hidden;
}

.large-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.large-avatar .overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 40px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.large-avatar:hover .overlay,
.large-avatar:focus-visible .overlay {
    opacity: 1;
}

.section-label {
    color: var(--primary);
    font-size: 12px;
    font-weight: 600;
    margin: 30px 0 15px;
}

.support-card,
.stat-box,
.repo-card,
.media-doc,
.media-missing,
.media-caption {
    border: 1px solid var(--border);
}

.support-card {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent), var(--bg-header);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
}

.support-text {
    margin-bottom: 15px;
    color: var(--text-secondary);
    font-size: 14px;
}

.upi-display {
    background: var(--bg-input);
    padding: 12px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    margin-bottom: 20px;
    font-size: 14px;
}

.upi-display button {
    color: var(--primary);
}

.qr-frame {
    background: #fff;
    padding: 6px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 182px;
    height: 182px;
}

.qr-frame img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

.qr-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    justify-items: center;
    align-items: start;
}

.secure-badge {
    margin-top: 10px;
    font-size: 12px;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    opacity: 0.85;
}

.stats-overview {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 30px;
}

.stat-box {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent), var(--bg-input);
    padding: 20px 15px;
    border-radius: 12px;
    text-align: center;
}

.stat-box .val {
    display: block;
    font-size: 26px;
    color: var(--primary);
    font-weight: 300;
    margin-bottom: 5px;
}

.stat-box .label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stats-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.stat-row {
    font-size: 13px;
}

.stat-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
}

.stat-name {
    font-weight: 500;
    color: var(--text-primary);
}

.stat-pct {
    color: var(--text-secondary);
    text-align: right;
}

.progress-bg {
    height: 6px;
    background: var(--bg-input);
    border-radius: 3px;
    overflow: hidden;
}

.progress-val {
    height: 100%;
    background: var(--primary);
    border-radius: inherit;
    transition: width 0.4s ease;
}

.info-block {
    margin-bottom: 25px;
}

.info-block h3 {
    color: var(--primary);
    font-size: 14px;
    margin-bottom: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-block p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.feature-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.feature-list li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
}

.feature-list li i {
    color: var(--primary);
    font-size: 18px;
    margin-top: 2px;
    flex-shrink: 0;
}

.repo-card {
    display: flex;
    align-items: center;
    gap: 15px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent), var(--bg-input);
    padding: 15px;
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-primary);
    transition: background 0.2s ease, border-color 0.2s ease;
}

.repo-card:hover {
    border-color: var(--primary);
    background: rgba(0, 168, 132, 0.05);
}

.repo-card i:first-child {
    font-size: 32px;
}

.repo-card i:last-child {
    margin-left: auto;
    color: var(--text-secondary);
}

.repo-card div {
    display: flex;
    flex-direction: column;
}

.repo-card div span {
    font-size: 12px;
    color: var(--text-secondary);
}

.chat-interface {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-main);
    position: relative;
    border-left: 1px solid var(--border);
    min-width: 0;
    z-index: 10;
    background-image: none;
}

.chat-bg {
    position: absolute;
    inset: 0;
    opacity: 0.055;
    background-image: url("https://user-images.githubusercontent.com/15075759/28719144-86dc0f70-73b1-11e7-911d-60d70fcded21.png");
    pointer-events: none;
}

body.light-theme .chat-bg {
    opacity: 0.08;
}

.chat-header,
.search-toolbar,
.chat-footer {
    background: var(--bg-header);
    backdrop-filter: blur(10px);
}

.chat-header {
    height: 60px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    z-index: 20;
}

.mobile-menu {
    display: none;
    color: var(--text-primary);
    margin-right: 12px;
}

.header-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    overflow: hidden;
    min-width: 0;
    flex: 1;
}

.header-pfp {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border);
}

.header-info h2 {
    font-size: 16px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-info p {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-tools {
    display: flex;
    gap: 8px;
    align-items: center;
}

.preview-stage {
    position: relative;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.device-shell {
    position: relative;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.device-frame,
.device-screen {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1;
}

.device-notch {
    display: none;
}

.device-statusbar {
    display: none;
}

.menu-container {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    width: 176px;
    background: var(--bg-sidebar);
    box-shadow: var(--shadow-md);
    border-radius: 10px;
    padding: 4px 0;
    display: none;
    z-index: 100;
    border: 1px solid var(--border);
    transform-origin: top right;
    animation: scaleIn 0.12s ease-out;
}

.dropdown-menu.show {
    display: block;
}

.menu-item {
    padding: 8px 12px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    text-align: left;
    line-height: 1.25;
}

.menu-item i {
    font-size: 14px;
    color: var(--text-muted);
}

.menu-item:hover {
    background: var(--bg-input);
    color: var(--text-primary);
}

@keyframes scaleIn {
    from {
        transform: scale(0.94);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.search-toolbar {
    height: 60px;
    border-bottom: 1px solid var(--border);
    display: none;
    align-items: center;
    padding: 0 16px;
    gap: 15px;
    z-index: 19;
    animation: slideDown 0.2s ease;
}

.search-toolbar.active {
    display: flex;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
    }

    to {
        transform: translateY(0);
    }
}

.search-input-group {
    flex: 1;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    gap: 10px;
    background: var(--bg-input);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.search-input-group input {
    border: none;
    background: transparent;
    flex: 1;
    font-size: 14px;
}

.search-input-group button {
    color: var(--text-secondary);
    font-size: 20px;
}

.search-nav {
    display: flex;
    gap: 4px;
    align-items: center;
    color: var(--text-secondary);
    font-size: 13px;
    white-space: nowrap;
}

.search-nav button {
    font-size: 20px;
    padding: 4px;
    border-radius: 50%;
}

.search-nav button:hover {
    background: rgba(255, 255, 255, 0.05);
}

.messages-viewport {
    flex: 1;
    overflow-y: auto;
    padding: 10px 5% 14px;
    position: relative;
    z-index: 10;
    scroll-behavior: auto;
}

.preview-stage.is-mobile-preview {
    align-items: center;
    justify-content: center;
    padding: 28px 24px 36px;
}

.preview-stage.is-mobile-preview .device-shell {
    flex: 0 0 auto;
    width: min(430px, calc(100vw - 64px));
    height: min(932px, calc(100dvh - 150px));
    padding: 14px;
    border-radius: 54px;
    background:
        linear-gradient(160deg, #2e3138, #0f1014 34%, #2f333a 68%, #111216);
    box-shadow:
        0 24px 60px rgba(11, 20, 26, 0.24),
        inset 0 1px 0 rgba(255, 255, 255, 0.22),
        inset 0 -2px 8px rgba(0, 0, 0, 0.45);
}

.preview-stage.is-mobile-preview .device-frame {
    position: relative;
    overflow: hidden;
    border-radius: 42px;
    background: #000;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.preview-stage.is-mobile-preview .device-screen {
    position: relative;
    overflow: hidden;
    background: var(--bg-main);
}

.preview-stage.is-mobile-preview .device-statusbar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 16px 18px 6px;
    position: relative;
    z-index: 35;
    color: #111;
    font-weight: 700;
    font-size: 14px;
}

.device-statusbar-time {
    justify-self: start;
    min-width: 52px;
}

.device-statusbar-island {
    width: 124px;
    height: 30px;
    border-radius: 999px;
    background: #000;
    justify-self: center;
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.08);
}

.device-statusbar-right {
    justify-self: end;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #111;
}

.signal-bars {
    display: inline-flex;
    align-items: end;
    gap: 2px;
    height: 12px;
}

.signal-bars span {
    display: block;
    width: 3px;
    background: currentColor;
    border-radius: 2px;
}

.signal-bars span:nth-child(1) { height: 4px; }
.signal-bars span:nth-child(2) { height: 6px; }
.signal-bars span:nth-child(3) { height: 9px; }
.signal-bars span:nth-child(4) { height: 12px; }

.network-badge {
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.01em;
}

.battery-pack {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 15px;
    padding: 0 5px;
    border: 1.8px solid currentColor;
    border-radius: 4px;
    font-size: 10px;
    line-height: 1;
}

.battery-pack::after {
    content: "";
    position: absolute;
    right: -3px;
    top: 4px;
    width: 2px;
    height: 6px;
    border-radius: 0 2px 2px 0;
    background: currentColor;
}

.battery-level {
    position: absolute;
    left: 2px;
    top: 2px;
    bottom: 2px;
    width: 49%;
    border-radius: 2px;
    background: rgba(17, 27, 33, 0.16);
}

.battery-text {
    position: relative;
    z-index: 1;
    font-weight: 800;
}

.preview-stage.is-mobile-preview .device-notch {
    display: flex;
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 40;
    width: 132px;
    height: 34px;
    border-radius: 999px;
    background: #050608;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.05);
}

.device-camera {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #1e3c67, #0a0f16 62%, #000 100%);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.04);
}

.device-speaker {
    width: 48px;
    height: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
}

.preview-stage.is-mobile-preview .chat-header {
    padding-top: 8px;
}

.preview-stage.is-mobile-preview .search-toolbar,
.preview-stage.is-mobile-preview .messages-viewport,
.preview-stage.is-mobile-preview .chat-footer {
    width: 100%;
}

.preview-stage.is-mobile-preview .messages-viewport {
    padding: 10px 12px 14px;
}

.preview-stage.is-mobile-preview .msg-row {
    max-width: 82%;
}

.preview-stage.is-mobile-preview .system-msg {
    margin: 10px auto 12px;
}

.preview-stage.is-mobile-preview .sticky-date {
    position: relative;
    top: auto;
    z-index: auto;
}

.preview-stage.is-mobile-preview .chat-footer {
    padding-bottom: max(10px, env(safe-area-inset-bottom));
}

.empty-placeholder {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-secondary);
    padding: 20px;
}

.empty-placeholder .illustration {
    font-size: 80px;
    margin-bottom: 20px;
    color: var(--border);
    opacity: 0.5;
}

.empty-placeholder h2 {
    color: var(--text-primary);
    font-weight: 300;
    margin-bottom: 10px;
}

.message-list {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 0 2px;
}

.system-msg {
    align-self: center;
    background: #fff6d5;
    color: var(--text-secondary);
    font-size: 12px;
    padding: 6px 14px;
    border-radius: 7px;
    margin: 8px 0;
    font-weight: 500;
    text-align: center;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(17, 27, 33, 0.05);
}

.sticky-date {
    position: sticky;
    top: 10px;
    z-index: 50;
}

.msg-row {
    display: flex;
    flex-direction: column;
    margin-bottom: 2px;
    position: relative;
    max-width: min(66%, 720px);
}

.msg-row.received { align-self: flex-start; align-items: flex-start; }
.msg-row.sent { align-self: flex-end; align-items: flex-end; }
.msg-row.tail { margin-top: 8px; }

.msg-row.tail.received .bubble { border-top-left-radius: 7.5px; }
.msg-row.tail.sent .bubble { border-top-right-radius: 7.5px; }

.bubble {
    border-radius: var(--wa-bubble-radius);
    position: relative;
    font-size: 14.2px;
    line-height: 19px;
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
    min-width: 80px;
    max-width: 100%;
    width: fit-content;
    display: block;
    padding: 6px 8px 8px;
}

.msg-row.direct-chat .bubble {
    min-width: 120px;
}

.received .bubble {
    background: var(--msg-in);
    border: 1px solid rgba(17, 27, 33, 0.04);
}

.sent .bubble {
    background: var(--msg-out);
    border: 1px solid rgba(17, 27, 33, 0.02);
}

.sender {
    margin-bottom: 4px;
    font-size: 12.8px;
    font-weight: 600;
    line-height: 1.2;
}

.msg-text {
    display: block;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
    color: inherit;
    min-width: 0;
}

.msg-text::after {
    content: "\00A0\00A0\00A0\00A0\00A0\00A0\00A0\00A0\00A0"; 
    display: inline-block;
    width: 52px;
}

.msg-text a {
    color: #53bdeb;
    text-decoration: underline;
}

.sent .meta { color: rgba(233, 237, 239, 0.78); }
body.light-theme .sent .meta { color: rgba(17, 27, 33, 0.56); }

.meta i {
    font-size: 15px;
    line-height: 1;
}

.msg-media-stack {
    display: grid;
    gap: 6px;
    margin-top: 4px;
    padding-bottom: 12px;
}

.msg-media-stack.has-gallery {
    gap: 10px;
}

.meta {
    position: absolute;
    right: 8px;
    bottom: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: var(--wa-meta-fs);
    line-height: 1;
    color: var(--text-muted);
}

.msg-text + .msg-media-stack {
    margin-top: 6px; 
}

.media-button {
    border: 0;
    background: transparent;
    padding: 0;
    cursor: pointer;
    width: 100%;
    text-align: left;
    position: relative;
}

.media-gallery {
    display: grid;
    gap: 1px;
    overflow: hidden;
    border-radius: 8px;
    background: rgba(17, 27, 33, 0.08);
}

.media-gallery-2,
.media-gallery-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.media-gallery-3 {
    grid-template-columns: 1.15fr 0.85fr;
    grid-template-rows: repeat(2, minmax(110px, 1fr));
}

.media-gallery-3 .media-gallery-tile:first-child {
    grid-row: 1 / span 2;
}

.media-gallery-tile {
    min-height: 132px;
    border-radius: 0;
    border: 0;
}

.media-gallery-tile img,
.media-gallery-tile video,
.media-gallery-video-frame {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    min-height: 132px;
}

.media-gallery-video-frame {
    position: relative;
    background: rgba(0, 0, 0, 0.16);
}

.media-gallery-play,
.media-gallery-more {
    position: absolute;
    inset: auto;
    z-index: 2;
}

.media-gallery-play {
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 42px;
    height: 42px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: rgba(17, 27, 33, 0.54);
    color: #fff;
    font-size: 20px;
}

.media-gallery-more {
    right: 0;
    bottom: 0;
    left: 0;
    top: 0;
    display: grid;
    place-items: center;
    background: rgba(17, 27, 33, 0.42);
    color: #fff;
    font-size: 26px;
    font-weight: 600;
}

.media-image,
.media-sticker,
.media-video {
    overflow: hidden;
    border-radius: 8px;
    border: 1px solid rgba(17, 27, 33, 0.05);
    background: linear-gradient(90deg, rgba(17, 27, 33, 0.02) 25%, rgba(17, 27, 33, 0.08) 50%, rgba(17, 27, 33, 0.02) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite linear;
}

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.media-image:has(img.loaded),
.media-sticker:has(img.loaded),
.media-video:has(video.loaded) {
    animation: none;
    background: rgba(17, 27, 33, 0.03);
}

.media-image img,
.media-sticker img,
.media-video video {
    display: block;
    width: 100%;
    max-width: min(320px, 60vw);
    max-height: 320px;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.3s ease-out;
}

.print-video-poster {
    display: none;
}

.media-gallery img,
.media-gallery video {
    aspect-ratio: 1 / 1;
}

.media-image img.loaded,
.media-sticker img.loaded,
.media-video video.loaded {
    opacity: 1;
}

.media-sticker img {
    object-fit: contain;
    padding: 10px;
    background:
        linear-gradient(45deg, rgba(255, 255, 255, 0.04) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(255, 255, 255, 0.04) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(255, 255, 255, 0.04) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(255, 255, 255, 0.04) 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}

.media-audio {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.media-audio-head,
.media-doc-head,
.media-missing-head {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.media-audio-head i,
.media-doc-head i,
.media-missing-head i {
    font-size: 24px;
    color: var(--primary);
    flex-shrink: 0;
}

.media-audio strong,
.media-doc strong,
.media-missing strong {
    display: block;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-audio span,
.media-doc span,
.media-missing span {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
}

.media-audio audio,
.media-modal audio,
.media-modal video {
    width: 100%;
}

.media-doc,
.media-missing {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    border-radius: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.06);
}

.media-placeholder {
    width: min(320px, 60vw);
    max-width: 100%;
    aspect-ratio: 1 / 1;
    display: grid;
    place-items: center;
    color: var(--text-secondary);
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.015)),
        var(--bg-soft);
}

.media-placeholder i {
    font-size: 38px;
}

.media-doc-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.media-doc-link {
    color: var(--primary);
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
}

.media-doc-link:hover {
    text-decoration: underline;
}

.media-caption {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
}

.hl {
    background: rgba(245, 197, 24, 0.4);
    color: inherit;
    padding: 0 1px;
    border-radius: 2px;
}

.hl.focus {
    background: var(--highlight);
    color: #000;
    box-shadow: 0 0 0 2px var(--highlight);
}

.chat-footer {
    height: 62px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    gap: 12px;
    border-left: 1px solid var(--border);
    z-index: 20;
}

.fake-input {
    flex: 1;
    background: var(--bg-input);
    height: 42px;
    border-radius: 8px;
    padding: 11px 16px;
    color: var(--text-secondary);
    cursor: text;
    font-size: 15px;
}

.sidebar-backdrop {
    display: none;
}

.date-jumper-input {
    position: fixed;
    left: 10px;
    top: 10px;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.date-sheet-backdrop,
.media-modal {
    position: fixed;
    inset: 0;
    z-index: 1400;
    background: rgba(0, 0, 0, 0.45);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.date-sheet-backdrop.open,
.media-modal.open {
    display: flex;
}

.date-sheet,
.media-modal-dialog {
    width: min(420px, 100%);
    background: var(--bg-sidebar);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow-md);
}

.date-sheet {
    padding: 18px;
}

.date-sheet h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 6px;
}

.date-sheet p {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 12px;
}

.date-sheet-input {
    height: 42px;
    padding: 8px 10px;
    margin-bottom: 14px;
    font-size: 16px;
}

.date-sheet-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.date-sheet-actions .btn-secondary,
.date-sheet-actions .btn-primary {
    width: auto;
    margin-top: 0;
    min-width: 96px;
    padding: 10px 16px;
}

.media-modal {
    z-index: 1600;
}

.media-modal-backdrop {
    position: absolute;
    inset: 0;
}

.media-modal-dialog {
    width: min(880px, 100%);
    max-height: min(88dvh, 900px);
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.media-modal-header {
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.media-modal-header h2 {
    font-size: 18px;
}

.media-modal-header p {
    font-size: 12px;
    color: var(--text-secondary);
}

.media-modal-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.media-modal-actions button {
    font-size: 22px;
    color: var(--text-secondary);
}

.media-modal-body {
    padding: 18px;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.18);
    min-height: 260px;
}

.media-viewer-shell {
    width: 100%;
    display: grid;
    gap: 14px;
}

.media-viewer-stage {
    position: relative;
    min-height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.media-modal-body img,
.media-modal-body video {
    max-width: 100%;
    max-height: calc(88dvh - 160px);
    border-radius: 12px;
    display: block;
}

.media-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: 42px;
    height: 42px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: rgba(17, 27, 33, 0.56);
    color: #fff;
    font-size: 24px;
}

.media-nav.prev {
    left: 12px;
}

.media-nav.next {
    right: 12px;
}

.media-thumb-strip {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
}

.media-thumb {
    width: 68px;
    height: 68px;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid transparent;
    background: rgba(17, 27, 33, 0.08);
    flex: 0 0 auto;
    display: grid;
    place-items: center;
}

.media-thumb.active {
    border-color: var(--primary);
}

.media-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-thumb-icon {
    font-size: 24px;
    color: var(--text-secondary);
}

.media-modal-body .media-doc,
.media-modal-body .media-missing {
    width: min(520px, 100%);
    background: var(--bg-elevated);
}

.processing-overlay {
    position: fixed;
    inset: 0;
    z-index: 1700;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(6, 12, 15, 0.68);
    backdrop-filter: blur(6px);
}

.processing-overlay.open {
    display: flex;
}

.processing-card {
    width: min(360px, 92vw);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent), var(--bg-sidebar);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow-md);
    padding: 24px 22px;
    text-align: center;
}

.processing-card h2 {
    font-size: 20px;
    margin-bottom: 8px;
}

.processing-card p {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.6;
}

.processing-spinner {
    display: inline-flex;
    font-size: 42px;
    color: var(--primary);
    margin-bottom: 14px;
    animation: spin 0.9s linear infinite;
}

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

#toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--primary);
    color: #fff;
    padding: 12px 24px;
    border-radius: 30px;
    font-weight: 600;
    font-size: 14px;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 9999;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

#toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

@media (max-width: 800px) {
    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(92vw, 380px);
        min-width: 0;
        max-width: 100%;
        height: 100dvh;
        z-index: 1000;
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        display: block;
        background: rgba(0, 0, 0, 0.4);
        border: 0;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
        z-index: 999;
    }

    .sidebar-backdrop.active {
        opacity: 1;
        pointer-events: auto;
    }

    .mobile-menu {
        display: block;
    }

    .chat-header,
    .search-toolbar {
        padding-left: 10px;
        padding-right: 10px;
    }

    .header-info h2 {
        font-size: 14px;
    }

    .header-info p {
        font-size: 11px;
    }

    .header-tools {
        gap: 2px;
    }

    .header-tools button {
        padding: 7px;
    }

    .messages-viewport {
        padding: 12px 8px;
        padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 10px);
    }

    .msg-row {
        max-width: 92%;
    }

    .media-image img,
    .media-sticker img,
    .media-video video {
        max-width: min(100%, 300px);
    }

    .search-toolbar {
        height: auto;
        min-height: 54px;
        gap: 8px;
    }

    .search-input-group {
        min-width: 0;
    }

    .search-nav {
        font-size: 12px;
        gap: 2px;
    }

    .dropdown-menu {
        width: min(78vw, 220px);
    }

    .menu-item {
        padding: 12px 14px;
        font-size: 14px;
        gap: 10px;
    }

    .date-sheet-backdrop,
    .media-modal {
        padding: 12px;
    }

    .date-sheet {
        width: min(420px, 94vw);
    }

    .chat-footer {
        height: 58px;
        gap: 8px;
        padding: 0 8px calc(env(safe-area-inset-bottom, 0px) + 2px);
    }

    .chat-footer button {
        font-size: 22px;
    }

    .fake-input {
        height: 38px;
        padding: 9px 12px;
        font-size: 14px;
    }

    .input-wrapper input,
    .search-input-group input {
        font-size: 16px;
    }

    .media-modal-dialog {
        max-height: 92dvh;
    }

    .media-modal-header {
        align-items: flex-start;
    }
}
