:root {
    /* Themes*/
    --bg-main: #0b141a;
    --bg-sidebar: #111b21;
    --bg-header: rgba(32, 44, 51, 0.95); /* Glass effect */
    --bg-input: #2a3942;
    --bg-panel: #111b21;
    
    --primary: #00a884;
    --primary-hover: #00c298;
    
    --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.13);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
    
    --highlight: #f5c518;
    
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body.light-theme {
    --bg-main: #dfd7cf;
    --bg-sidebar: #ffffff;
    --bg-header: rgba(240, 242, 245, 0.95);
    --bg-input: #ffffff;
    --bg-panel: #ffffff;
    
    --primary: #00a884;
    
    --text-primary: #111b21;
    --text-secondary: #54656f;
    --text-muted: #667781;
    
    --border: #e9edef;
    
    --msg-in: #ffffff;
    --msg-out: #d9fdd3;
    --system-msg: #fff;
}

/* Base */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body { 
    background: var(--bg-main); 
    color: var(--text-primary); 
    height: 100vh; 
    width: 100vw; 
    overflow: hidden; 
    font-family: var(--font-family); 
    font-size: 14.5px;
    line-height: 1.5;
}

/* Loader */
#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;
}

.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;
}

/* Scrollbars */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(134, 150, 160, 0.3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(134, 150, 160, 0.5); }

/* Layout */
.app-layout { 
    display: flex; 
    height: 100%; 
    width: 100%; 
    max-width: 1600px; 
    margin: 0 auto; 
    position: relative; 
    background: var(--bg-main);
    box-shadow: 0 0 50px rgba(0,0,0,0.5);
}

/* Sidebar */
.sidebar { 
    width: 400px; 
    min-width: 320px; 
    background: var(--bg-sidebar); 
    border-right: 1px solid var(--border); 
    display: flex; 
    flex-direction: column; 
    z-index: 200; 
    transition: transform 0.35s cubic-bezier(0.19, 1, 0.22, 1);
}

.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-thumb img { 
    width: 40px; 
    height: 40px; 
    border-radius: 50%; 
    object-fit: cover; 
    cursor: pointer; 
    transition: opacity 0.2s; 
}
.profile-thumb img:hover { opacity: 0.8; }

.sidebar-nav button { 
    background: none; 
    border: none; 
    color: var(--text-secondary); 
    font-size: 24px; 
    cursor: pointer; 
    padding: 8px; 
    border-radius: 50%; 
    transition: background 0.2s;
}
.sidebar-nav button: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 Panel */
.upload-state { 
    height: 100%; 
    display: flex; 
    flex-direction: column; 
    padding: 30px 20px; 
    gap: 20px; 
    overflow-y: auto;
}

.brand-hero { text-align: center; margin-bottom: 10px; }
.brand-hero h2 { 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; }
.input-wrapper input { 
    width: 100%; 
    padding: 12px 16px; 
    background: var(--bg-input); 
    border: 1px solid var(--border); 
    border-radius: 10px; 
    color: var(--text-primary); 
    transition: border 0.2s;
}
.input-wrapper input:focus { border-color: var(--primary); }

.drop-target { 
    border: 2px dashed var(--border); 
    border-radius: 16px; 
    padding: 40px 20px; 
    text-align: center; 
    color: var(--text-secondary); 
    transition: all 0.2s; 
    cursor: pointer; 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
    justify-content: center; 
    align-items: center;
}
.drop-target:hover { border-color: var(--primary); background: rgba(0, 168, 132, 0.04); }
.drop-target i { font-size: 48px; margin-bottom: 15px; color: var(--text-muted); }

.btn-secondary { background: transparent; border: 1px solid var(--border); color: var(--text-primary); padding: 8px 20px; border-radius: 20px; margin-top: 15px; cursor: pointer; font-weight: 500; }
.btn-primary { 
    width: 100%; 
    padding: 14px; 
    background: var(--primary); 
    color: #fff; 
    font-weight: 600; 
    border: none; 
    border-radius: 24px; 
    cursor: pointer; 
    font-size: 15px; 
    box-shadow: 0 4px 10px rgba(0, 168, 132, 0.3); 
    transition: transform 0.1s;
}
.btn-primary: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 (After Load) */
.chat-list { padding: 10px; height: 100%; overflow-y: auto; display: flex; flex-direction: column; }
.hidden { display: none !important; }

.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: 1px solid var(--primary); }
.search-bar-sidebar input { background: transparent; border: none; flex: 1; color: var(--text-primary); }

.chat-item { 
    display: flex; 
    gap: 15px; 
    padding: 12px; 
    background: transparent; 
    border-radius: 12px; 
    cursor: pointer; 
    transition: background 0.2s; 
    align-items: center;
}
.chat-item.active, .chat-item:hover { background: var(--bg-header); }
.chat-item-avatar { width: 50px; height: 50px; border-radius: 50%; background: #6a7175; 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); }

/* Drawers (Profile/Stats) */
.drawer { 
    position: absolute; 
    top: 0; left: 0; width: 100%; height: 100%; 
    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; 
    font-size: 19px; 
    font-weight: 500; 
    gap: 20px;
    border-bottom: 1px solid var(--border);
}
.drawer-header button { background: none; border: none; color: var(--text-primary); font-size: 24px; cursor: pointer; }
.drawer-scroll { padding: 20px; overflow-y: auto; flex: 1; }

/* Profile Styles */
.profile-hero { text-align: center; margin-bottom: 30px; }
.large-avatar { width: 200px; height: 200px; margin: 0 auto 20px; position: relative; cursor: pointer; 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: 0.2s; 
}
.large-avatar:hover .overlay { opacity: 1; }

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

.support-card { 
    background: var(--bg-header); 
    padding: 20px; 
    border-radius: 12px; 
    border: 1px solid var(--border); 
    text-align: center; 
}
.upi-display { 
    background: var(--bg-input); 
    padding: 12px; 
    border-radius: 8px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    font-family: monospace; 
    margin-bottom: 20px;
    font-size: 14px;
}
.upi-display button { background: none; border: none; color: var(--primary); cursor: pointer; }
.qr-frame { background: #fff; padding: 15px; border-radius: 8px; display: inline-block; }
.qr-frame img { display: block; width: 160px; height: 160px; }

/* Stats Styles */
.stats-overview { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 30px; }
.stat-box { background: var(--bg-input); padding: 20px 15px; border-radius: 12px; text-align: center; border: 1px solid var(--border); }
.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; margin-bottom: 6px; }
.stat-name { font-weight: 500; color: var(--text-primary); }
.stat-pct { color: var(--text-secondary); }
.progress-bg { height: 6px; background: var(--bg-input); border-radius: 3px; overflow: hidden; }
.progress-val { height: 100%; background: var(--primary); border-radius: 3px; transition: width 0.5s ease; }

/* Chat Interface */
.chat-interface { 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
    background: var(--bg-main); 
    position: relative; 
    border-left: 1px solid var(--border); 
    z-index: 10;
}

.chat-bg { 
    position: absolute; inset: 0; 
    opacity: 0.06; 
    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.4; }

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

.header-profile { display: flex; align-items: center; gap: 12px; cursor: pointer; overflow: hidden; }
.header-pfp { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; border: 1px solid var(--border); }
.header-info h3 { font-size: 16px; font-weight: 500; white-space: nowrap; }
.header-info p { font-size: 12px; color: var(--text-secondary); margin-top: 1px; }

.header-tools { display: flex; gap: 8px; }
.header-tools button { background: none; border: none; color: var(--text-secondary); font-size: 20px; cursor: pointer; padding: 8px; border-radius: 50%; }
.header-tools button:hover { background: rgba(255,255,255,0.05); color: var(--text-primary); }
.mobile-menu { display: none; background: none; border: none; color: var(--text-primary); font-size: 24px; margin-right: 12px; cursor: pointer; }
.header-tools button,
.menu-item,
.mobile-menu,
.btn-primary,
.btn-secondary {
    touch-action: manipulation;
}

/* Search Toolbar (Hidden) */
.search-toolbar { 
    height: 60px; 
    background: var(--bg-header); 
    border-bottom: 1px solid var(--border); 
    display: none; 
    align-items: center; 
    padding: 0 16px; 
    gap: 15px; 
    z-index: 19; 
    animation: slideDown 0.2s ease;
}
@keyframes slideDown { from { transform: translateY(-100%); } to { transform: translateY(0); } }
.search-toolbar.active { display: flex; }

.search-input-group { flex: 1; background: var(--bg-input); height: 40px; border-radius: 8px; display: flex; align-items: center; padding: 0 12px; gap: 10px; }
.search-input-group input { background: transparent; border: none; flex: 1; color: var(--text-primary); font-size: 14px; }
.search-input-group button { background: none; border: none; color: var(--text-secondary); cursor: pointer; 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 { background: none; border: none; color: var(--text-primary); cursor: pointer; font-size: 20px; padding: 4px; border-radius: 50%; }
.search-nav button:hover { background: rgba(255,255,255,0.05); }

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

.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 h1 { color: var(--text-primary); font-weight: 300; margin-bottom: 10px; }

/* System & Bubbles */
.system-msg { align-self: center; background: var(--system-msg); color: var(--text-secondary); font-size: 12px; padding: 6px 14px; border-radius: 8px; margin: 8px 0; text-transform: uppercase; font-weight: 600; text-align: center; box-shadow: var(--shadow-sm); border: 1px solid rgba(0,0,0,0.05); }
.sticky-date { position: sticky; top: 10px; z-index: 50; }

.msg-row { 
    display: flex; 
    flex-direction: column; 
    max-width: 65%; 
    margin-bottom: 2px; 
    position: relative; 
}
.msg-row.sent { align-self: flex-end; align-items: flex-end; }
.msg-row.received { align-self: flex-start; align-items: flex-start; }

.bubble { 
    border-radius: 8px; 
    position: relative; 
    font-size: 14.2px; 
    line-height: 19px; 
    color: var(--text-primary); 
    box-shadow: var(--shadow-sm); 
    min-width: 80px;
    word-wrap: break-word; 
    border: 1px solid transparent;
    width: fit-content !important;
    max-width: 100% !important;
    display: block !important; 
    padding: 6px 9px 8px 9px !important;
}
.received .bubble { background: var(--msg-in); border-top-left-radius: 0; }
.sent .bubble { background: var(--msg-out); border-top-right-radius: 0; }

.sender { font-size: 13px; font-weight: 600; margin-bottom: 4px; cursor: pointer; color: #f39c12; }
.meta {
    float: none !important;
    margin: 0 !important;
    position: absolute !important;
    bottom: 4px !important;
    right: 8px !important;
    display: flex !important;
    align-items: center !important;
    gap: 3px !important;
}
.meta i {
    font-size: 16px !important;
    margin-bottom: -1px !important; 
}
.msg-text {
    display: inline !important; 
    white-space: pre-wrap !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
}
.msg-text::after {
    content: '\00a0\00a0\00a0\00a0\00a0\00a0\00a0\00a0\00a0\00a0\00a0\00a0\00a0\00a0\00a0\00a0' !important; 
    display: inline-block !important;
    width: auto !important;
}

@media (max-width: 800px) {
    .msg-row { max-width: 100% !important; } 
}
@media (min-width: 801px) {
    .msg-row { max-width: 65% !important; } 
}

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

/* Tails (SVG kinda using css) */
.tail-in .bubble::before { content: ""; position: absolute; top: 0; left: -8px; width: 8px; height: 13px; background: var(--msg-in); clip-path: polygon(100% 0, 100% 100%, 0 0); }
.tail-out .bubble::after { content: ""; position: absolute; top: 0; right: -8px; width: 8px; height: 13px; background: var(--msg-out); clip-path: polygon(0 0, 0 100%, 100% 0); }
.msg-row.tail { margin-top: 8px; }

/* Search Highlights */
.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); }

/* Footer */
.chat-footer { 
    height: 62px; 
    background: var(--bg-header); 
    display: flex; 
    align-items: center; 
    padding: 0 12px; 
    gap: 12px; 
    border-left: 1px solid var(--border); 
    z-index: 20; 
}
.chat-footer button { background: none; border: none; color: var(--text-secondary); font-size: 26px; cursor: pointer; }
.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; 
}

/* Toast */
#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); }

/* Mobile Friendliness stuff */
@media (max-width: 800px) {
    .sidebar { position: absolute; width: 100%; height: 100%; transform: translateX(-100%); box-shadow: 5px 0 15px rgba(0,0,0,0.3); }
    .sidebar.active { transform: translateX(0); }
    .mobile-menu { display: block; }
    .messages-viewport { padding: 20px 10px; }
    .chat-footer { padding: 0 8px; }
    .header-info h3 { font-size: 15px; }
}

/* Info Drawer */
.info-block { margin-bottom: 25px; }
.info-block h4 { 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; }

.inline-code { background: var(--bg-input); padding: 2px 6px; border-radius: 4px; font-family: monospace; font-size: 12px; color: var(--text-primary); }

.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; }

.feature-list.warning li i { color: #f1c40f; }

.repo-card { 
    display: flex; align-items: center; gap: 15px; 
    background: var(--bg-input); 
    padding: 15px; border-radius: 12px; 
    border: 1px solid var(--border); 
    text-decoration: none; color: var(--text-primary); 
    transition: all 0.2s;
}
.repo-card:hover { border-color: var(--primary); background: rgba(0,168,132,0.05); }
.repo-card i:first-child { font-size: 32px; color: var(--text-primary); }
.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); }

.support-text { margin-bottom: 15px; color: var(--text-secondary); font-size: 14px; }
.secure-badge { margin-top: 10px; font-size: 12px; color: var(--primary); display: flex; align-items: center; justify-content: center; gap: 6px; opacity: 0.8; }

/* date menu */
.menu-container {
    position: relative;
    display: inline-block;
}

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

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

.menu-item {
    padding: 10px 20px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 14.5px;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
    font-family: inherit;
}

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

@keyframes scaleIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* fidelity enhancements */
:root {
    --wa-row-gap: 2px;
    --wa-bubble-radius: 7.5px;
    --wa-meta-fs: 11px;
}

.message-list {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.message-list .msg-row {
    margin-bottom: var(--wa-row-gap);
    max-width: min(65%, 690px);
}

.message-list .msg-row.tail {
    margin-top: 7px;
}

.message-list .bubble {
    border-radius: var(--wa-bubble-radius);
    border: 0;
    box-shadow: 0 1px 0.5px rgba(11, 20, 26, 0.24);
    padding: 6px 9px 7px 9px !important;
    min-height: 20px;
}

.message-list .received .bubble {
    border-top-left-radius: 0;
}

.message-list .sent .bubble {
    border-top-right-radius: 0;
}

.message-list .msg-text {
    display: inline;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
    color: inherit;
}

.message-list .msg-text::after {
    content: '';
    display: inline-block;
    width: 56px;
}

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

.message-list .sent .meta {
    color: rgba(233, 237, 239, 0.78);
}

body.light-theme .message-list .sent .meta {
    color: rgba(17, 27, 33, 0.56);
}

.message-list .meta i {
    font-size: 14px !important;
    line-height: 1;
    margin-bottom: 0 !important;
}

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

/* tails */
.message-list .tail-in .bubble::before,
.message-list .tail-out .bubble::after {
    width: 9px;
    height: 12px;
    top: 0;
}

.message-list .tail-in .bubble::before {
    left: -8px;
    clip-path: polygon(100% 0, 100% 100%, 0 0);
}

.message-list .tail-out .bubble::after {
    right: -8px;
    clip-path: polygon(0 0, 0 100%, 100% 0);
}

.messages-viewport {
    padding-top: 10px;
    padding-bottom: 14px;
}

.system-msg {
    border-radius: 7px;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.2px;
    text-transform: none;
}

@media (max-width: 800px) {
    .message-list .msg-row {
        max-width: 88% !important;
    }

    .message-list .msg-text::after {
        width: 52px;
    }
}

/* mobile + picker reliability overrides */
body,
.app-layout {
    min-height: 100dvh;
    height: 100dvh;
}

.sidebar-backdrop {
    display: none;
}

.date-jumper-input {
    position: fixed;
    left: 10px;
    top: 10px;
    width: 1px;
    height: 1px;
    opacity: 0;
    border: none;
    border-radius: 10px;
    background: var(--bg-input);
    color: var(--text-primary);
    -webkit-appearance: none;
    appearance: none;
    pointer-events: none;
    z-index: 1200;
}

.date-jumper-input.open {
    left: 50%;
    top: 50%;
    width: min(280px, 76vw);
    height: 44px;
    transform: translate(-50%, -50%);
    opacity: 0.01;
    pointer-events: auto;
}

.date-sheet-backdrop {
    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 {
    display: flex;
}

.date-sheet {
    width: min(420px, 100%);
    background: var(--bg-sidebar);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow-md);
    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 {
    width: 100%;
    height: 42px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-primary);
    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 (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;
    }

    .chat-interface {
        width: 100%;
        min-width: 0;
    }

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

    .header-profile {
        min-width: 0;
        flex: 1;
    }

    .header-info h3 {
        font-size: 14px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .header-info p {
        font-size: 11px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .header-tools {
        gap: 2px;
    }

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

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

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

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

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

    .message-list .msg-row {
        max-width: 92% !important;
    }

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

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

    .date-sheet-backdrop {
        align-items: center;
        justify-content: center;
        padding: 12px;
    }

    .date-sheet {
        width: min(420px, 94vw);
        border-radius: 14px;
        padding-bottom: 18px;
    }

    .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;
    }
}
