* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #0f6e5d;
    --primary-dark: #0b5346;
    --primary-light: #e3f2ee;

    --accent: #ff7a45;
    --accent-dark: #ef6531;
    --accent-light: #ffe9df;

    --background: #f6f4ef;

    --white: #ffffff;

    --text: #17211d;
    --muted: #74827c;

    --border: #e7e3d9;

    --green: #2fae64;

    --danger: #e14a3d;

    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 20px;

    --font-display: "Space Grotesk", "Segoe UI", Arial, sans-serif;
    --font-body: "Inter", "Segoe UI", Arial, sans-serif;

    --shadow-sm: 0 1px 3px rgba(23, 33, 29, .06);
    --shadow-md: 0 10px 30px rgba(23, 33, 29, .07);
    --shadow-lg: 0 24px 60px rgba(23, 33, 29, .14);
}

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

body {
    min-height: 100dvh;
    font-family: var(--font-body);

    background: var(--background);

    color: var(--text);

    overflow: hidden;
}

h1,
h2 {
    font-family: var(--font-display);
    letter-spacing: -.01em;
}

button,
input {
    font-family: inherit;
}

button {
    cursor: pointer;
    border: none;
}

input {
    outline: none;
}

.hidden {
    display: none !important;
}


/* ==================================
   LOGIN
================================== */

.login-screen {
    width: 100%;
    height: 100vh;

    display: flex;

    align-items: center;
    justify-content: center;

    padding: 20px;

    background:
        radial-gradient(circle at 12% 8%, rgba(15, 110, 93, .10), transparent 42%),
        radial-gradient(circle at 88% 92%, rgba(255, 122, 69, .12), transparent 40%),
        var(--background);
}

.login-card {
    width: 100%;
    max-width: 400px;

    padding: 44px 34px;

    background: var(--white);

    border: 1px solid var(--border);

    border-radius: var(--radius-lg);

    text-align: center;

    box-shadow: var(--shadow-lg);
}

.login-logo {
    width: 68px;
    height: 68px;

    margin: 0 auto 22px;

    display: flex;

    align-items: center;
    justify-content: center;

    border-radius: var(--radius-md);

    /* The logo already contains its own rounded square; don't add a second box. */
    background: transparent;

    font-size: 30px;
}

.login-card h1 {
    font-size: 26px;

    margin-bottom: 9px;
}

.login-card p {
    color: var(--muted);

    line-height: 1.5;

    margin-bottom: 26px;
}

.login-card input {
    width: 100%;

    height: 50px;

    padding: 0 16px;

    border: 1px solid var(--border);

    border-radius: var(--radius-sm);

    background: var(--background);

    font-size: 14px;

    margin-bottom: 12px;

    transition: border-color .15s, background .15s;
}

.login-card input:focus {
    border-color: var(--primary);
    background: var(--white);
}

.login-card button {
    width: 100%;

    height: 50px;

    border-radius: var(--radius-sm);

    background: var(--primary);

    color: white;

    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: .01em;

    transition: .2s;
}

.login-card button:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

#loginError {
    color: var(--danger);

    font-size: 13px;

    margin-top: 12px;
}


/* ==================================
   APP
================================== */

.app {
    width: 100%;
    height: 100vh;

    display: grid;

    grid-template-columns: 340px 1fr;

    background: var(--white);
}

/* On very wide desktop screens, keep the message column from
   stretching edge to edge so long lines stay readable. */
@media (min-width: 1400px) {

    .messages {
        max-width: 820px;
        margin: 0 auto;
        width: 100%;
    }

    .welcome-panel {
        max-width: 820px;
        margin: 0 auto;
    }

}


/* ==================================
   SIDEBAR
================================== */

.sidebar {
    height: 100vh;

    display: flex;

    flex-direction: column;

    background: var(--white);

    border-right: 1px solid var(--border);
}

.sidebar-header {
    min-height: 82px;

    padding: 18px 20px;

    display: flex;

    align-items: center;

    justify-content: space-between;
}

.small-label {
    color: var(--muted);

    font-size: 11px;

    text-transform: uppercase;

    letter-spacing: 1px;
}

.sidebar-header h1 {
    font-size: 25px;

    margin-top: 3px;
}

.icon-button {
    width: 42px;
    height: 42px;

    border-radius: var(--radius-sm);

    background: var(--primary);

    color: white;

    font-size: 24px;
    font-weight: 300;

    line-height: 1;

    box-shadow: var(--shadow-sm);

    transition: background .15s, transform .15s;
}

.icon-button:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}


/* ==================================
   SEARCH
================================== */

.search-box {
    height: 46px;

    margin: 0 15px 15px;

    padding: 0 13px;

    display: flex;

    align-items: center;

    gap: 9px;

    background: var(--background);

    border: 1px solid transparent;

    border-radius: var(--radius-sm);

    color: var(--muted);

    transition: border-color .15s;
}

.search-box:focus-within {
    border-color: var(--primary);
}

.search-box span {
    font-size: 22px;
}

.search-box input {
    flex: 1;

    min-width: 0;

    border: none;

    background: transparent;

    font-size: 13px;

    color: var(--text);
}


/* ==================================
   CHAT LIST
================================== */

.chat-list {
    flex: 1;

    overflow-y: auto;
}

.chat-list::-webkit-scrollbar {
    width: 5px;
}

.chat-list::-webkit-scrollbar-thumb {
    background: #ddd;

    border-radius: 10px;
}

.chat-item {
    min-height: 76px;

    padding: 12px 17px;

    display: flex;

    align-items: center;

    gap: 12px;

    border-left: 3px solid transparent;
    border-bottom: 1px solid #f1efe9;

    cursor: pointer;

    transition: background .15s, border-color .15s;
}

.chat-item:hover {
    background: #faf9f5;
}

.chat-item.selected {
    background: var(--primary-light);
    border-left-color: var(--primary);
}

.chat-avatar {
    width: 48px;
    height: 48px;

    flex-shrink: 0;

    border-radius: 50%;

    display: flex;

    align-items: center;
    justify-content: center;

    background: linear-gradient(150deg, var(--primary-light), var(--accent-light));

    color: var(--primary-dark);

    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 600;

    position: relative;
}

.chat-item.selected .chat-avatar {
    background: white;
}

.chat-content {
    flex: 1;

    min-width: 0;
}

.chat-top {
    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 10px;
}

.chat-top strong {
    font-size: 14px;

    white-space: nowrap;

    overflow: hidden;

    text-overflow: ellipsis;
}

.chat-time {
    flex-shrink: 0;

    color: var(--muted);

    font-size: 10px;
}

.chat-preview {
    margin-top: 5px;

    color: var(--muted);

    font-size: 12px;

    white-space: nowrap;

    overflow: hidden;

    text-overflow: ellipsis;
}

.unread {
    min-width: 20px;
    height: 20px;

    padding: 0 5px;

    border-radius: 20px;

    display: flex;

    align-items: center;
    justify-content: center;

    background: var(--accent);

    color: white;

    font-size: 9px;

    font-weight: bold;
}

.empty-chat {
    padding: 60px 25px;

    text-align: center;

    color: var(--muted);
}

.empty-chat div {
    font-size: 35px;

    margin-bottom: 12px;
}

.empty-chat p {
    color: var(--text);

    font-weight: bold;

    font-size: 14px;

    margin-bottom: 7px;
}

.empty-chat small {
    font-size: 11px;

    line-height: 1.5;
}


/* ==================================
   SIDEBAR USER
================================== */

.sidebar-user {
    min-height: 70px;

    padding: 10px 15px;

    display: flex;

    align-items: center;

    gap: 10px;

    border-top: 1px solid var(--border);
}

.user-avatar {
    width: 42px;
    height: 42px;

    border-radius: 50%;

    display: flex;

    align-items: center;
    justify-content: center;

    background: linear-gradient(150deg, var(--primary-light), var(--accent-light));

    color: var(--primary-dark);

    font-family: var(--font-display);
    font-weight: 600;
}

.sidebar-user-info {
    flex: 1;

    min-width: 0;
}

.sidebar-user-info strong {
    display: block;

    font-size: 13px;

    white-space: nowrap;

    overflow: hidden;

    text-overflow: ellipsis;
}

.sidebar-user-info small {
    display: block;

    color: var(--green);

    font-size: 10px;

    margin-top: 3px;
}

.more-button {
    width: 35px;
    height: 35px;

    border-radius: 10px;

    background: transparent;

    color: var(--muted);

    font-size: 20px;
}

.desktop-logout-button {
    height: 35px;
    padding: 0 11px;

    border: 1px solid var(--border);
    border-radius: 10px;

    background: transparent;
    color: var(--danger);

    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 600;

    white-space: nowrap;
}

.desktop-logout-button:hover {
    background: #fdeeec;
}


/* ==================================
   MESSAGE PANEL
================================== */

.message-panel {
    height: 100vh;

    background:
        radial-gradient(
            circle at 20% 15%,
            rgba(15, 110, 93, .06),
            transparent 32%
        ),
        radial-gradient(
            circle at 85% 85%,
            rgba(255, 122, 69, .05),
            transparent 30%
        ),
        var(--background);

    position: relative;
}


/* ==================================
   WELCOME
================================== */

.welcome-panel {
    height: 100%;

    display: flex;

    flex-direction: column;

    align-items: center;
    justify-content: center;

    text-align: center;

    padding: 30px;
}

.welcome-icon {
    width: 80px;
    height: 80px;

    display: flex;

    align-items: center;
    justify-content: center;

    border-radius: var(--radius-lg);

    background: linear-gradient(150deg, var(--primary-light), var(--accent-light));

    font-size: 36px;

    margin-bottom: 20px;
}

.welcome-panel h2 {
    font-size: 25px;

    margin-bottom: 8px;
}

.welcome-panel p {
    color: var(--muted);

    font-size: 13px;

    margin-bottom: 20px;
}

.welcome-panel button {
    padding: 12px 22px;

    border-radius: var(--radius-sm);

    background: var(--primary);

    color: white;

    font-family: var(--font-display);
    font-weight: 600;

    transition: background .15s, transform .15s;
}

.welcome-panel button:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}


/* ==================================
   CONVERSATION
================================== */

.conversation {
    height: 100%;
    min-height: 0;

    display: flex;

    flex-direction: column;
}


/* ==================================
   CONVERSATION HEADER
================================== */

.conversation-header {
    height: 70px;

    flex-shrink: 0;

    padding: 0 18px;

    display: flex;

    align-items: center;

    gap: 12px;

    background: rgba(255,255,255,.95);

    border-bottom: 1px solid var(--border);
}

.conversation-avatar {
    width: 44px;
    height: 44px;

    flex-shrink: 0;

    border-radius: 50%;

    display: flex;

    align-items: center;
    justify-content: center;

    background: linear-gradient(150deg, var(--primary-light), var(--accent-light));

    color: var(--primary-dark);

    font-family: var(--font-display);
    font-weight: 600;
}

.conversation-info {
    flex: 1;

    min-width: 0;
}

.conversation-info strong {
    display: block;

    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 600;

    white-space: nowrap;

    overflow: hidden;

    text-overflow: ellipsis;
}

.conversation-info small {
    display: flex;
    align-items: center;
    gap: 5px;

    color: var(--green);

    font-size: 10px;

    margin-top: 4px;
}

.conversation-info small::before {
    content: "";

    width: 6px;
    height: 6px;

    border-radius: 50%;

    background: currentColor;
}

.conversation-more {
    width: 38px;
    height: 38px;

    border-radius: 10px;

    background: transparent;

    color: var(--muted);

    font-size: 20px;
}

.mobile-back {
    display: none;

    width: 38px;
    height: 38px;

    border-radius: var(--radius-sm);

    background: var(--background);

    font-size: 20px;
}


/* ==================================
   MESSAGES
================================== */

.messages {
    flex: 1;
    min-height: 0;

    overflow-y: auto;
    overscroll-behavior: contain;

    padding: 25px;

    display: flex;

    flex-direction: column;

    gap: 9px;
}

.messages::-webkit-scrollbar {
    width: 5px;
}

.messages::-webkit-scrollbar-thumb {
    background: #ddd;

    border-radius: 10px;
}

.message {
    max-width: 65%;

    align-self: flex-start;

    padding: 9px 13px;

    background: white;

    border-radius: 15px 15px 15px 4px;

    box-shadow: var(--shadow-sm);

    border: 1px solid #efece4;
}

.message.own {
    align-self: flex-end;

    background: var(--primary);

    color: white;

    border-color: var(--primary);

    border-radius: 15px 15px 4px 15px;
}

.message-name {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    width: 100%;
    font-size: 9px;
    font-weight: bold;
    letter-spacing: .2px;
    color: var(--accent-dark);
    margin-bottom: 4px;
}

.message.own .message-name {
    color: rgba(255,255,255,.75);
}

.message-text {
    font-size: 13px;

    line-height: 1.45;

    word-break: break-word;
}

.message-seen {
    display: inline-block;
    margin-left: auto;
    flex: 0 0 auto;
    font-size: 10px;
    line-height: 1;
    font-weight: 900;
    letter-spacing: -1px;
    color: var(--accent);
    opacity: 1;
    vertical-align: middle;
    transform: translateY(-1px);
}

.message-time {
    display: block;

    text-align: right;

    font-size: 8px;

    margin-top: 4px;

    opacity: .55;
}

.system-message {
    align-self: center;

    padding: 5px 10px;

    border-radius: 10px;

    background: rgba(0,0,0,.05);

    color: var(--muted);

    font-size: 9px;
}


/* ==================================
   SWIPE / REPLY
================================== */

.message {
    touch-action: pan-y;
    position: relative;
    will-change: transform;
}

.message.swiping { transition: none; }
.message { touch-action: pan-y; user-select: none; }
.message-text, .reply-quote { user-select: text; }

 .message.delete-ready {
    box-shadow: 0 0 0 2px rgba(255, 80, 80, 0.35);
    opacity: 0.9;
}

.message.reply-ready {
    box-shadow: 0 0 0 2px rgba(15, 110, 93, .16), var(--shadow-sm);
}

.message.reply-highlight {
    animation: replyHighlight 1.2s ease-out;
}

@keyframes replyHighlight {
    0% { transform: scale(1.025); box-shadow: 0 0 0 3px rgba(15, 110, 93, .38), 0 6px 22px rgba(15, 110, 93, .18); }
    55% { transform: scale(1.015); box-shadow: 0 0 0 3px rgba(15, 110, 93, .24), 0 5px 18px rgba(15, 110, 93, .12); }
    100% { transform: scale(1); box-shadow: var(--shadow-sm); }
}

.reply-quote {
    cursor: pointer;
}

.reply-quote:active {
    opacity: .8;
}

.reply-quote {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 0 0 7px;
    padding: 6px 8px;
    border-left: 3px solid var(--accent);
    border-radius: 6px;
    background: rgba(0, 0, 0, .045);
    min-width: 0;
}

.message.own .reply-quote {
    background: rgba(255, 255, 255, .12);
    border-left-color: rgba(255, 255, 255, .75);
}

.reply-quote strong { font-size: 9px; line-height: 1.2; }
.reply-quote span {
    font-size: 10px;
    line-height: 1.25;
    opacity: .75;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.reply-bar {
    min-height: 54px;
    padding: 7px 12px;
    display: flex;
    align-items: center;
    gap: 9px;
    background: white;
    border-top: 1px solid var(--border);
}

.reply-indicator {
    width: 3px;
    align-self: stretch;
    border-radius: 4px;
    background: var(--accent);
}

.reply-content {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.reply-content strong { font-size: 10px; color: var(--accent-dark); }

.reply-content span {
    min-width: 0;
    font-size: 11px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.reply-close {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--muted);
    font-size: 21px;
    line-height: 1;
}

.reply-close:hover { background: var(--background); }

/* ==================================
   MESSAGE FORM
================================== */

.message-form {
    min-height: 68px;

    padding: 10px 15px;

    display: flex;

    align-items: center;

    gap: 8px;

    background: white;

    border-top: 1px solid var(--border);
}

.message-form input {
    flex: 1;

    min-width: 0;

    height: 46px;

    padding: 0 16px;

    border: 1px solid var(--border);

    border-radius: var(--radius-md);

    background: var(--background);

    font-size: 13px;

    transition: border-color .15s, background .15s;
}

.message-form input:focus {
    border-color: var(--primary);
    background: var(--white);
}

.send-button {
    width: 46px;
    height: 46px;

    flex-shrink: 0;

    border-radius: var(--radius-md);

    background: var(--accent);

    color: white;

    font-size: 16px;

    transition: background .15s, transform .15s;
}

.send-button:hover {
    background: var(--accent-dark);
    transform: translateY(-1px);
}


/* ==================================
   BOTTOM NAV
================================== */

.bottom-nav {
    display: none;
    --nav-index: 0;
}


/* ==================================
   MOBILE PAGES
================================== */

.mobile-page {
    display: none;
}


/* ==================================
   MODAL
================================== */

.modal {
    position: fixed;

    inset: 0;

    z-index: 1000;

    display: flex;

    align-items: center;
    justify-content: center;

    padding: 20px;

    background: rgba(10,10,20,.45);

    backdrop-filter: blur(5px);
}

.modal-card {
    width: 100%;

    max-width: 430px;

    padding: 22px;

    background: white;

    border-radius: var(--radius-lg);

    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;

    align-items: center;

    justify-content: space-between;

    margin-bottom: 15px;
}

.modal-header span {
    color: var(--muted);

    font-size: 10px;

    text-transform: uppercase;
    letter-spacing: .8px;
}

.modal-header h2 {
    margin-top: 4px;

    font-size: 21px;
}

.modal-close {
    width: 35px;
    height: 35px;

    border-radius: 50%;

    background: #f3f3f6;

    font-size: 20px;

    color: var(--muted);
}

.action-card {
    width: 100%;

    padding: 14px;

    margin-top: 9px;

    display: flex;

    align-items: center;

    gap: 12px;

    text-align: left;

    background: white;

    border: 1px solid var(--border);

    border-radius: var(--radius-md);

    transition: .15s;
}

.action-card:hover {
    border-color: var(--primary);

    background: var(--primary-light);
}

.action-icon {
    width: 45px;
    height: 45px;

    flex-shrink: 0;

    display: flex;

    align-items: center;
    justify-content: center;

    border-radius: var(--radius-sm);

    background: linear-gradient(150deg, var(--primary-light), var(--accent-light));

    font-size: 20px;
}

.action-card div:nth-child(2) {
    flex: 1;
}

.action-card strong,
.action-card small {
    display: block;
}

.action-card strong {
    font-size: 13px;
}

.action-card small {
    margin-top: 4px;

    color: var(--muted);

    font-size: 10px;
}

.action-card > span:last-child {
    color: var(--muted);

    font-size: 20px;
}

.join-box {
    margin-top: 15px;

    padding: 15px;

    border-radius: var(--radius-md);

    background: var(--background);
}

.join-box label {
    display: block;

    color: var(--muted);

    font-size: 11px;

    margin-bottom: 7px;
}

.join-input-row {
    display: flex;

    gap: 7px;
}

.join-input-row input {
    flex: 1;

    min-width: 0;

    height: 43px;

    padding: 0 12px;

    border: 1px solid var(--border);

    border-radius: 10px;

    text-transform: uppercase;

    font-weight: bold;

    letter-spacing: 2px;
}

.join-input-row button {
    padding: 0 16px;

    border-radius: 10px;

    background: var(--primary);

    color: white;

    font-weight: bold;
}



/* ==================================
   DELETE ACCOUNT CONFIRMATION
================================== */

.delete-account-modal {
    position: fixed;
    inset: 0;
    z-index: 1500;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 20px;

    background: rgba(10, 10, 20, .52);
    backdrop-filter: blur(5px);
}

.delete-account-card {
    width: 100%;
    max-width: 480px;

    position: relative;

    padding: 28px;

    background: white;
    border: 1px solid #ead8d6;
    border-radius: var(--radius-lg);

    box-shadow: var(--shadow-lg);
}

.delete-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;

    width: 34px;
    height: 34px;

    border-radius: 50%;
    background: #f3f3f6;

    color: var(--muted);
    font-size: 20px;
}

.delete-warning-icon {
    width: 46px;
    height: 46px;

    display: flex;
    align-items: center;
    justify-content: center;

    margin-bottom: 14px;

    border-radius: 12px;
    background: #fff0ee;

    font-size: 22px;
}

.delete-account-card h2 {
    font-size: 22px;
    margin-bottom: 10px;
}

.delete-account-warning {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.6;
    margin-bottom: 20px;
}

.delete-account-warning strong {
    color: var(--danger);
}

.delete-confirm-label {
    display: block;

    color: var(--text);
    font-size: 12px;
    font-weight: 600;

    line-height: 1.5;
    margin-bottom: 8px;
}

.delete-confirm-label code {
    padding: 3px 6px;

    border-radius: 5px;

    background: #f6f6f6;
    color: var(--danger);

    font-family: monospace;
    font-size: 11px;
}

.delete-account-input {
    width: 100%;
    height: 45px;

    padding: 0 12px;

    border: 1px solid var(--border);
    border-radius: 9px;

    background: white;
    color: var(--text);

    font-family: inherit;
    font-size: 13px;

    outline: none;
}

.delete-account-input:focus {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(214, 74, 61, .08);
}

.delete-account-error {
    min-height: 16px;

    margin-top: 6px;

    color: var(--danger);
    font-size: 10px;
}

.delete-account-actions {
    display: flex;
    gap: 8px;

    margin-top: 10px;
}

.delete-cancel-button,
.delete-confirm-button {
    flex: 1;

    height: 45px;

    border-radius: 9px;

    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 600;
}

.delete-cancel-button {
    background: var(--background);
    color: var(--text);
}

.delete-confirm-button {
    background: var(--danger);
    color: white;
}

.delete-confirm-button:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.delete-confirm-button:not(:disabled):hover {
    filter: brightness(.95);
}

@media (max-width: 767px) {

    .delete-account-modal {
        align-items: flex-end;
        padding: 0;
    }

    .delete-account-card {
        max-width: none;

        padding: 24px 20px calc(24px + env(safe-area-inset-bottom));

        border-radius: 23px 23px 0 0;

        animation: deleteModalUp .2s ease;
    }

    @keyframes deleteModalUp {

        from {
            transform: translateY(100%);
        }

        to {
            transform: translateY(0);
        }

    }

}


/* ==================================
   ROOM POPUP
================================== */

.room-popup {
    position: fixed;

    inset: 0;

    z-index: 1200;

    display: flex;

    align-items: center;
    justify-content: center;

    padding: 20px;

    background: rgba(10,10,20,.45);

    backdrop-filter: blur(5px);
}

.room-popup-card {
    width: 100%;

    max-width: 370px;

    padding: 30px 25px;

    position: relative;

    text-align: center;

    background: white;

    border-radius: var(--radius-lg);

    box-shadow: var(--shadow-lg);
}

.popup-close {
    position: absolute;

    right: 15px;
    top: 15px;

    width: 32px;
    height: 32px;

    border-radius: 50%;

    background: #f3f3f6;

    color: var(--muted);

    font-size: 18px;
}

.popup-icon {
    font-size: 35px;

    margin-bottom: 12px;
}

.room-popup-card h2 {
    font-size: 20px;
}

.room-popup-card p {
    color: var(--muted);

    font-size: 12px;

    line-height: 1.5;

    margin: 8px 0 18px;
}

.created-room-code {
    padding: 15px;

    border-radius: var(--radius-sm);

    background: linear-gradient(150deg, var(--primary-light), var(--accent-light));

    color: var(--primary-dark);

    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 700;

    letter-spacing: 6px;

    margin-bottom: 12px;
}

.created-room-qr-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    margin: 10px 0 14px;
}

.created-room-qr {
    width: 132px;
    height: 132px;
    padding: 10px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-radius: 12px;
}

.created-room-qr img,
.created-room-qr canvas {
    display: block;
    width: 112px !important;
    height: 112px !important;
}

.created-room-qr-wrap span {
    font-size: 11px;
    color: var(--muted);
}

.copy-button,
.continue-button {
    width: 100%;

    height: 45px;

    border-radius: var(--radius-sm);

    font-family: var(--font-display);
    font-weight: 600;

    transition: background .15s, transform .15s;
}

.copy-button {
    background: var(--background);

    color: var(--text);

    margin-bottom: 8px;
}

.copy-button:hover {
    background: var(--border);
}

.continue-button {
    background: var(--primary);

    color: white;
}

.continue-button:hover {
    background: var(--primary-dark);
}


/* ==================================
   MOBILE
================================== */

@media (max-width: 767px) {

    body {
        overflow: hidden;
        min-height: 100dvh;
        height: 100dvh;
        background: var(--white);
    }

    .app {
        display: block;

        height: 100dvh;
        min-height: 100dvh;
    }


    /* Sidebar */

    .sidebar {
        width: 100%;
        height: calc(100dvh - 65px);

        border: none;

        display: flex;
    }


    /* Message */

    .message-panel {
        position: fixed;

        left: 0;
        right: 0;
        top: 0;
        bottom: 0;

        z-index: 200;

        display: block;

        width: 100%;
        height: auto;
        min-height: 0;

        background: var(--white);

        /* JS pins this panel to the exact visible visual viewport.
           The chat therefore covers the entire screen with no background strip. */
        overflow: hidden;
    }

    /* The hidden class is the single source of truth on mobile.
       Do not depend on a second mobile-open class to make the panel visible. */
    .message-panel.hidden {
        display: none !important;
    }

    .conversation {
        height: 100%;
        min-height: 0;
        max-height: 100%;
    }

    .mobile-back {
        display: block;
    }

    .message {
        max-width: 80%;
    }

    .message-form {
        min-height: 64px;
        padding: 8px 10px;
        flex-shrink: 0;
        position: relative;
        z-index: 2;
        /* Never reserve the device safe-area inside the keyboard-visible
           chat. Android/Chrome can report that inset while the keyboard is
           open, which creates the small strip of page background above it. */
    }

    .message-panel.keyboard-open .message-form {
        padding-bottom: 8px;
    }

    .message-panel.keyboard-open,
    .message-panel.keyboard-open .conversation {
        overflow: hidden;
    }

    .message-form input {
        height: 46px;
        font-size: 13px;
        font-family: inherit;
    }

    .send-button {
        width: 46px;
        height: 46px;
        border-radius: var(--radius-md);
    }

    .messages {
        padding: 15px;
    }


    /* Hide the desktop user/logout row on mobile.
       Profile and logout are available from the bottom Profile tab. */
    .sidebar-user {
        display: none;
    }

    /* Bottom nav */

    .bottom-nav {
        position: fixed;

        left: 12px;
        right: 12px;
        bottom: calc(10px + env(safe-area-inset-bottom));

        width: auto;
        height: 64px;

        display: flex;
        align-items: center;

        z-index: 100;

        /* Floating liquid-glass effect */
        background: rgba(255, 255, 255, 0.58);
        -webkit-backdrop-filter: blur(22px) saturate(165%);
        backdrop-filter: blur(22px) saturate(165%);

        border: 1px solid rgba(255, 255, 255, 0.72);
        border-radius: 24px;
        box-shadow:
            0 10px 30px rgba(0, 0, 0, 0.10),
            inset 0 1px 0 rgba(255, 255, 255, 0.82),
            inset 0 -1px 0 rgba(255, 255, 255, 0.22);

        overflow: hidden;
    }

    .bottom-nav::before {
        content: '';
        position: absolute;
        top: 0;
        left: 8%;
        right: 8%;
        height: 1px;
        background: rgba(255, 255, 255, 0.9);
        pointer-events: none;
    }

    .nav-liquid-indicator {
        position: absolute;
        z-index: 0;
        top: 7px;
        bottom: 7px;
        left: 7px;
        width: calc((100% - 14px) / 3);
        border-radius: 19px;
        background: rgba(255, 255, 255, 0.42);
        border: 1px solid rgba(255, 255, 255, 0.62);
        box-shadow:
            0 5px 18px rgba(0, 0, 0, 0.08),
            inset 0 1px 0 rgba(255, 255, 255, 0.72),
            inset 0 -1px 0 rgba(255, 255, 255, 0.18);
        backdrop-filter: blur(18px) saturate(180%);
        -webkit-backdrop-filter: blur(18px) saturate(180%);
        transform: translateX(calc(var(--nav-index) * 100%));
        transition: transform .42s cubic-bezier(.22, 1, .36, 1),
                    box-shadow .28s ease, background .28s ease;
        pointer-events: none;
    }

    .nav-liquid-indicator::after {
        content: '';
        position: absolute;
        left: 18%;
        right: 18%;
        top: 5px;
        height: 1px;
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.9);
    }

    .nav-button {
        position: relative;
        z-index: 1;
        flex: 1;

        display: flex;

        flex-direction: column;

        align-items: center;
        justify-content: center;

        gap: 3px;

        min-width: 0;
        height: 100%;
        border: 0;
        background: transparent;

        color: #999;
        -webkit-tap-highlight-color: transparent;
        transition: transform .18s ease, color .18s ease;
    }

    .nav-button:active {
        transform: scale(.94);
    }

    .nav-button span {
        font-size: 20px;
    }

    .nav-button small {
        font-size: 10px;
    }

    .nav-button.active {
        color: var(--primary);
    }




    /* Mobile pages */

    .mobile-page {
        position: fixed;

        inset: 0;

        z-index: 50;

        display: block;

        padding: 20px 15px 85px;

        background: var(--background);

        overflow-y: auto;
    }

    .mobile-page.hidden {
        display: none;
    }

    .mobile-page-header {
        margin-bottom: 25px;
    }

    .mobile-page-header span {
        color: var(--muted);

        font-size: 11px;

        text-transform: uppercase;
        letter-spacing: .8px;
    }

    .mobile-page-header h1 {
        margin-top: 4px;

        font-size: 26px;
    }


    /* Home */

    .home-card {
        padding: 32px 20px;

        background: white;

        border: 1px solid var(--border);

        border-radius: var(--radius-lg);

        text-align: center;

        box-shadow: var(--shadow-md);
    }

    .home-icon {
        width: 65px;
        height: 65px;

        margin: auto;

        display: flex;

        align-items: center;
        justify-content: center;

        border-radius: var(--radius-md);

        background: linear-gradient(150deg, var(--primary-light), var(--accent-light));

        font-size: 28px;
    }

    .home-card h2 {
        margin-top: 17px;

        font-size: 19px;
    }

    .home-card p {
        color: var(--muted);

        font-size: 12px;

        line-height: 1.5;

        margin: 9px 0 18px;
    }

    .home-card button {
        width: 100%;

        height: 46px;

        border-radius: var(--radius-sm);

        background: var(--primary);

        color: white;

        font-family: var(--font-display);
        font-weight: 600;

        margin-bottom: 8px;
    }

    .home-card .secondary-button {
        background: var(--background);

        color: var(--text);
    }


    /* Profile */

    .profile-card {
        padding: 32px 20px;

        background: white;

        border: 1px solid var(--border);

        border-radius: var(--radius-lg);

        text-align: center;

        box-shadow: var(--shadow-md);
    }

    .profile-avatar {
        width: 80px;
        height: 80px;

        margin: auto;

        display: flex;

        align-items: center;
        justify-content: center;

        border-radius: 50%;

        background: linear-gradient(150deg, var(--primary-light), var(--accent-light));

        color: var(--primary-dark);

        font-family: var(--font-display);
        font-size: 28px;
        font-weight: 700;
    }

    .profile-card h2 {
        margin-top: 13px;

        font-size: 19px;
    }

    .profile-card p {
        color: var(--muted);

        font-size: 11px;

        margin-top: 5px;
    }

    .profile-stats {
        margin-top: 10px;

        padding: 18px;

        display: flex;

        background: white;

        border: 1px solid var(--border);

        border-radius: var(--radius-md);
    }

    .profile-stats div {
        flex: 1;

        text-align: center;
    }

    .profile-stats strong,
    .profile-stats span {
        display: block;
    }

    .profile-stats strong {
        font-family: var(--font-display);
        font-size: 21px;
    }

    .profile-stats span {
        color: var(--muted);

        font-size: 10px;

        margin-top: 3px;
    }

    .logout-button {
        width: 100%;

        height: 46px;

        margin-top: 10px;

        border-radius: var(--radius-sm);

        background: #fdeeec;

        color: var(--danger);

        font-family: var(--font-display);
        font-weight: 600;
    }


    /* Modal */

    .modal {
        align-items: flex-end;

        padding: 0;
    }

    .modal-card {
        max-width: none;

        border-radius: 23px 23px 0 0;

        padding: 20px;

        animation: modalUp .2s ease;
    }

    @keyframes modalUp {

        from {
            transform: translateY(100%);
        }

        to {
            transform: translateY(0);
        }

    }

}


/* ==================================
   SMALL MOBILE
================================== */

@media (max-width: 380px) {

    .sidebar-header {
        padding-left: 15px;
        padding-right: 15px;
    }

    .chat-item {
        padding-left: 12px;
        padding-right: 12px;
    }

    .chat-avatar {
        width: 45px;
        height: 45px;
    }

}

/* DEVELOPED BY */
.developed-by {
    margin-top: 150px;

    padding-bottom: 10px;

    text-align: center;

    color: var(--muted);

    font-size: 11px;
}

.developed-by strong {
    color: var(--primary);

    font-weight: bold;
}

/* ==================================
   ROOM DELETE ACTION
================================== */
.room-delete-button {
    width: 30px;
    height: 34px;
    flex: 0 0 30px;
    border-radius: 9px;
    background: transparent;
    color: var(--muted);
    font-size: 18px;
    line-height: 1;
    opacity: 0;
    transition: opacity .15s, background .15s;
}

.chat-item:hover .room-delete-button,
.chat-item:focus-within .room-delete-button {
    opacity: 1;
}

.room-delete-button:disabled {
    opacity: 0;
    cursor: default;
}

.room-delete-button:not(:disabled):hover {
    background: #fdeeec;
    color: var(--danger);
}

@media (max-width: 767px) {
    .room-delete-button:not(:disabled) {
        opacity: .7;
    }
}

/* ==================================
   ROOM ACTIONS MENU / RENAME
================================== */
.room-actions-menu {
    position: fixed;
    z-index: 10050;
    min-width: 150px;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--card, #fff);
    box-shadow: 0 12px 30px rgba(0,0,0,.16);
}

.room-action-menu-item {
    display: block;
    width: 100%;
    border: 0;
    border-radius: 8px;
    padding: 10px 12px;
    background: transparent;
    color: var(--text);
    text-align: left;
    font-size: 14px;
    cursor: pointer;
}

.room-action-menu-item:hover {
    background: var(--hover, rgba(0,0,0,.06));
}

.room-action-menu-item.room-action-danger {
    color: var(--danger);
}

.rename-room-card .delete-warning-icon {
    font-size: 30px;
}

@media (max-width: 767px) {
    .room-actions-menu {
        min-width: 165px;
    }
}


/* Room code dialog */
.room-code-card {
    text-align: center;
}
.room-code-display {
    margin: 18px 0 8px;
    padding: 15px 18px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--background);
    color: var(--text);
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 3px;
    user-select: all;
}
.room-code-copied {
    min-height: 20px;
    margin: 4px 0 10px;
    color: var(--primary);
    font-size: 13px;
}

/* Room actions: keep the mobile chat header menu easy to use. */
.room-actions-menu .room-action-menu-item { min-height: 44px; }
@media (max-width: 767px) {
  .room-actions-menu { min-width: 170px; max-width: calc(100vw - 16px); }
}

/* Keep the Chat17 logo on the opening name screen the same compact size
   as the old message icon. */
.login-logo img {
    width: 62px;
    height: 62pxpx;
    max-width: 62px;
    max-height: 62px;
    object-fit: contain;
    display: block;
    border-radius: 14px;
}


/* QR room sharing and camera scanner */
.room-code-qr {
    width: 190px;
    min-height: 190px;
    margin: 14px auto 8px;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-radius: 14px;
    box-sizing: border-box;
}

.room-code-qr img,
.room-code-qr canvas {
    display: block;
    max-width: 100%;
    height: auto;
}

.room-qr-wrap {
    text-align: center;
}

.room-qr-wrap p {
    margin: 4px 0 10px;
    font-size: 12px;
    opacity: .72;
}

.scan-qr-button {
    width: 100%;
    margin-top: 10px;
    min-height: 44px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--background);
    color: var(--text);
    font-weight: 700;
    cursor: pointer;
}

.qr-scanner-box {
    margin-top: 12px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--background);
    overflow: hidden;
}

#qrReader {
    width: 100%;
    max-width: 360px;
    margin: 0 auto;
}

#qrReader video {
    border-radius: 12px;
}

#qrReader__scan_region {
    border-radius: 12px;
    overflow: hidden;
}

.stop-qr-button {
    width: 100%;
    margin-top: 10px;
    min-height: 42px;
    border: 0;
    border-radius: 12px;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

.qr-scanner-status {
    min-height: 18px;
    margin: 8px 2px 0;
    text-align: center;
    font-size: 12px;
    opacity: .78;
}

@media (max-width: 767px) {
    .room-code-qr {
        width: 175px;
        min-height: 175px;
    }
}


/* ==========================================
   TYPING INDICATOR
========================================== */

#conversationStatus.typing-active {
    color: var(--primary);
    font-weight: 600;
    animation: typingPulse 1.4s ease-in-out infinite;
}

@keyframes typingPulse {
    0%, 100% { opacity: .55; }
    50% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    #conversationStatus.typing-active {
        animation: none;
    }
}

/* Clickable links inside messages */
.message-link {
    color: var(--primary);
    text-decoration: underline;
    text-decoration-thickness: 1.5px;
    text-underline-offset: 2px;
    overflow-wrap: anywhere;
    cursor: pointer;
}

.message-link:hover {
    opacity: 0.82;
}

.message-link:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 3px;
}

/* ==========================================
   AUDIO CALL UI — FULL SCREEN
========================================== */
.conversation-call{
    width:42px;height:42px;margin-left:auto;border-radius:50%;
    display:inline-flex;align-items:center;justify-content:center;
    background:#eef5f2;color:var(--primary);border:1px solid rgba(15,110,93,.08);
    transition:transform .18s,background .18s,box-shadow .18s
}
.conversation-call:hover{transform:translateY(-1px);background:var(--primary-light);box-shadow:var(--shadow-sm)}
.call-icon{width:21px;height:21px;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}
.call-modal{
    position:fixed;inset:0;z-index:3000;display:flex;align-items:center;justify-content:center;
    padding:20px;background:rgba(10,18,30,.48);backdrop-filter:blur(14px);-webkit-backdrop-filter:blur(14px)
}
/* Incoming calls behave like a phone-call banner: stay at the top instead of covering the chat. */
#incomingCallModal{
    align-items:flex-start;
    justify-content:center;
    padding:12px 12px 0;
    background:rgba(10,18,30,.18);
    backdrop-filter:blur(5px);
    -webkit-backdrop-filter:blur(5px);
}
#incomingCallModal .incoming-call-card{
    width:min(560px,100%);
    margin:0;
    padding:14px 16px;
    border-radius:20px;
    display:grid;
    grid-template-columns:52px minmax(0,1fr) auto;
    grid-template-areas:"avatar info actions";
    align-items:center;
    gap:12px;
    text-align:left;
    background:rgba(247,249,252,.97);
    box-shadow:0 16px 45px rgba(0,0,0,.24);
    animation:incomingDrop .28s ease-out;
}
#incomingCallModal .incoming-call-avatar{
    grid-area:avatar;
    width:52px;height:52px;margin:0;font-size:19px;
}
#incomingCallModal .call-eyebrow{
    margin:0 0 2px;
    font-size:9px;
    letter-spacing:1px;
}
#incomingCallModal .incoming-call-card h3{
    grid-area:info;
    margin:0;
    font-size:17px;
    line-height:1.2;
}
#incomingCallModal .incoming-call-card p{
    grid-area:info;
    margin:21px 0 0;
    color:var(--muted);
    font-size:11px;
}
#incomingCallModal .incoming-call-card .call-eyebrow{
    grid-area:info;
    align-self:start;
}
#incomingCallModal .incoming-call-actions{
    grid-area:actions;
    display:flex;
    align-items:center;
    gap:8px;
    margin:0;
}
#incomingCallModal .call-action{
    width:44px;height:44px;padding:0;border-radius:50%;
    display:inline-flex;align-items:center;justify-content:center;
    font-size:0;
    box-shadow:0 6px 16px rgba(0,0,0,.12);
}
#incomingCallModal .call-action span{
    margin:0;font-size:18px;line-height:1;
}
#incomingCallModal .call-action.decline{background:#ef5350}
#incomingCallModal .call-action.accept{background:#20b86a}
@keyframes incomingDrop{from{opacity:0;transform:translateY(-14px)}to{opacity:1;transform:translateY(0)}}
.call-picker-card,.incoming-call-card{
    width:min(390px,100%);border-radius:26px;padding:24px;background:rgba(247,249,252,.96);
    border:1px solid rgba(255,255,255,.72);box-shadow:0 28px 80px rgba(0,0,0,.22)
}
.call-modal-top{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin-bottom:18px}
.call-eyebrow{display:block;color:var(--muted);font-size:11px;text-transform:uppercase;letter-spacing:1.2px;font-weight:700}
.call-picker-card h3,.incoming-call-card h3{margin-top:4px;font-family:var(--font-display);font-size:22px}
.call-close,.active-call-minimize,.active-call-close{width:34px;height:34px;border-radius:50%;background:rgba(0,0,0,.06);color:var(--text);font-size:20px}
.call-people-list{display:grid;gap:10px;max-height:55vh;overflow:auto}
.call-person{width:100%;display:flex;align-items:center;gap:12px;padding:11px;border-radius:17px;background:white;border:1px solid #e8ebef;text-align:left;transition:transform .15s,box-shadow .15s}
.call-person:hover{transform:translateY(-1px);box-shadow:0 8px 24px rgba(15,110,93,.10)}
.call-person-avatar,.incoming-call-avatar,.active-call-avatar{
    width:52px;height:52px;flex:0 0 auto;border-radius:50%;display:flex;align-items:center;justify-content:center;
    color:white;font-family:var(--font-display);font-weight:700;background:linear-gradient(145deg,#1c5f72,#6e5a99);
    box-shadow:0 8px 24px rgba(28,95,114,.18)
}
.call-person-info{flex:1;min-width:0}.call-person-info strong{display:block;font-size:14px}
.call-person-info small{display:block;margin-top:3px;color:var(--green);font-size:11px}
.call-person-button{width:40px;height:40px;border-radius:50%;background:var(--green);color:white;font-size:18px;display:inline-flex;align-items:center;justify-content:center}
.call-person-button::before{content:'☎';font-size:17px}
.call-empty{padding:20px 8px 4px;color:var(--muted);text-align:center;font-size:13px}
.incoming-call-card{text-align:center;padding:34px 26px 28px}
.incoming-call-avatar{width:82px;height:82px;margin:0 auto 18px;font-size:28px;animation:incomingPulse 1.6s ease-in-out infinite}
.incoming-call-card h3{font-size:25px;margin-top:8px}.incoming-call-card p{margin-top:6px;color:var(--muted)}
.incoming-call-actions{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-top:26px}
.call-action{height:50px;border-radius:16px;color:white;font-family:var(--font-display);font-weight:700}
.call-action.decline{background:#ef5350}.call-action.accept{background:#20b86a}.call-action span{margin-right:5px}

/* Full-screen active call experience */
.active-call-panel{
    position:fixed;inset:0;z-index:4000;width:100vw;height:100vh;height:100dvh;
    min-height:100%;overflow:hidden;border-radius:0;color:white;
    background:
      radial-gradient(circle at 20% 15%,rgba(75,123,255,.20),transparent 34%),
      radial-gradient(circle at 85% 80%,rgba(255,77,126,.18),transparent 34%),
      linear-gradient(150deg,#0c1733 0%,#152b55 55%,#0b1328 100%);
    box-shadow:none;border:0
}
.active-call-glow{position:absolute;width:310px;height:310px;left:50%;top:27%;transform:translate(-50%,-50%);border-radius:50%;border:1px solid rgba(154,183,255,.22);box-shadow:0 0 0 28px rgba(124,154,226,.06),0 0 0 58px rgba(124,154,226,.035),0 0 90px rgba(82,120,220,.12);animation:callGlow 2.8s ease-in-out infinite}
.active-call-minimize,.active-call-close{position:absolute;top:24px;z-index:2;background:rgba(255,255,255,.10);color:rgba(255,255,255,.94);border:1px solid rgba(255,255,255,.08)}
.active-call-minimize{right:70px}.active-call-close{right:24px}
.active-call-content{position:relative;z-index:1;width:100%;height:100%;min-height:100%;padding:72px 24px 42px;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;box-sizing:border-box}
.active-call-content .call-eyebrow{color:rgba(255,255,255,.62);margin-bottom:26px}
.active-call-avatar{width:142px;height:142px;border:3px solid rgba(255,255,255,.90);box-shadow:0 0 0 10px rgba(255,255,255,.08),0 24px 60px rgba(0,0,0,.28);font-size:44px}
.active-call-content h2{margin-top:24px;font-size:30px;letter-spacing:-.4px}.active-call-content p{margin-top:7px;color:rgba(255,255,255,.72);font-size:15px}
.active-call-timer{margin-top:7px;color:rgba(255,255,255,.68);font-variant-numeric:tabular-nums;font-size:14px}
.active-call-controls{display:flex;align-items:center;justify-content:center;gap:22px;margin-top:64px}
.round-call-control{width:64px;height:64px;border-radius:50%;background:rgba(255,255,255,.12);color:white;font-size:19px;box-shadow:inset 0 1px 0 rgba(255,255,255,.10);display:inline-flex;align-items:center;justify-content:center;border:1px solid rgba(255,255,255,.08)}
.round-call-control.active{background:rgba(255,255,255,.24)}
.round-call-control.end{background:#ff4d50;transform:none}
.call-control-icon{width:24px;height:24px;fill:currentColor}
.end-icon{transform:rotate(135deg)}
@keyframes incomingPulse{0%,100%{box-shadow:0 8px 24px rgba(28,95,114,.18),0 0 0 0 rgba(32,184,106,.25)}50%{box-shadow:0 8px 24px rgba(28,95,114,.18),0 0 0 16px rgba(32,184,106,0)}}
@keyframes callGlow{0%,100%{transform:translate(-50%,-50%) scale(.96);opacity:.72}50%{transform:translate(-50%,-50%) scale(1.04);opacity:1}}

/* Minimized state remains a compact floating call bar */
.active-call-panel.call-minimized{inset:auto;top:12px;right:12px;width:270px;height:82px;min-height:82px;border-radius:20px;box-shadow:0 20px 60px rgba(6,13,32,.36);border:1px solid rgba(255,255,255,.12)}
.active-call-panel.call-minimized .active-call-content{height:82px;min-height:82px;padding:10px 48px 10px 12px;display:grid;grid-template-columns:46px 1fr;grid-template-rows:auto auto;column-gap:10px;text-align:left}
.active-call-panel.call-minimized .active-call-content .call-eyebrow,.active-call-panel.call-minimized .active-call-controls{display:none}
.active-call-panel.call-minimized .active-call-avatar{grid-row:1/3;width:46px;height:46px;font-size:16px;border-width:2px;box-shadow:none}
.active-call-panel.call-minimized .active-call-content h2{margin:0;font-size:14px;align-self:end}
.active-call-panel.call-minimized .active-call-content p{margin:1px 0 0;font-size:10px;align-self:start}
.active-call-panel.call-minimized .active-call-timer{display:none}

@media(max-width:767px){
    #incomingCallModal{padding:8px 8px 0}
    #incomingCallModal .incoming-call-card{
        width:100%;
        grid-template-columns:46px minmax(0,1fr) auto;
        gap:10px;
        padding:12px;
        border-radius:18px;
    }
    #incomingCallModal .incoming-call-avatar{width:46px;height:46px;font-size:17px}
    #incomingCallModal .incoming-call-card h3{font-size:15px}
    #incomingCallModal .incoming-call-card p{font-size:10px;margin-top:19px}
    #incomingCallModal .call-action{width:42px;height:42px}
    .conversation-call{width:39px;height:39px;font-size:17px}
    .active-call-panel{inset:0;width:100vw;height:100vh;height:100dvh;border-radius:0}
    .active-call-content{padding:70px 20px 34px}
    .active-call-glow{width:250px;height:250px;top:31%}
    .active-call-avatar{width:124px;height:124px;font-size:38px}
    .active-call-content h2{font-size:27px}
    .active-call-controls{gap:16px;margin-top:52px}
    .round-call-control{width:60px;height:60px}
    .incoming-call-card,.call-picker-card{border-radius:22px}
}

/* Modern call controls + WhatsApp-style call history */
.call-control-icon{width:23px;height:23px;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}
.round-call-control{transition:transform .18s ease,background .18s ease,box-shadow .18s ease}
.round-call-control:hover{transform:translateY(-2px);background:rgba(255,255,255,.18);box-shadow:0 8px 24px rgba(0,0,0,.18)}
.round-call-control:active{transform:scale(.94)}
.round-call-control.end:hover{background:#ff3f43}
.call-person-button svg{width:19px;height:19px;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}
.call-action{display:inline-flex;align-items:center;justify-content:center;gap:9px;cursor:pointer;transition:transform .16s ease,filter .16s ease}
.call-action:hover{transform:translateY(-1px);filter:brightness(1.03)}
.call-action:active{transform:scale(.97)}
.incoming-action-icon{width:26px;height:26px;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;background:rgba(255,255,255,.18)}
.incoming-action-icon svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.call-action.decline .incoming-action-icon{background:rgba(0,0,0,.10)}
.call-action.accept .incoming-action-icon{background:rgba(255,255,255,.20)}

.call-history-message{width:min(260px,82%);margin:10px auto;padding:10px 13px;border-radius:18px;background:var(--surface-2,#f1f3f5);border:1px solid rgba(0,0,0,.06);display:flex;align-items:center;gap:10px;color:var(--text);box-shadow:0 2px 8px rgba(0,0,0,.04)}
.call-history-icon{width:36px;height:36px;flex:0 0 36px;border-radius:50%;display:flex;align-items:center;justify-content:center}
.call-history-icon.outgoing{background:#e7f6ee;color:#19a35c}
.call-history-icon.incoming{background:#eaf2ff;color:#3d73d9}
.call-history-icon svg{width:19px;height:19px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.call-history-body{min-width:0;display:flex;flex-direction:column;gap:2px}
.call-history-body strong{font-size:13px;font-weight:700}
.call-history-body span{font-size:11px;color:var(--muted)}

@media(max-width:767px){
  .call-history-message{width:min(245px,86%);padding:9px 12px;border-radius:16px}
  .incoming-action-label{display:none}
  .call-action{width:48px;height:48px;border-radius:50%;padding:0}
  .incoming-action-icon{width:30px;height:30px}
}


/* Premium interactive full-screen audio call UI */
.active-call-panel{background:radial-gradient(circle at 50% 35%,#263f72 0%,#101b38 38%,#070d1d 100%);isolation:isolate}
.active-call-panel::before{content:"";position:absolute;inset:0;background:linear-gradient(180deg,rgba(255,255,255,.05),transparent 28%,rgba(0,0,0,.20));pointer-events:none}
.active-call-bg-orb{position:absolute;border-radius:50%;filter:blur(55px);opacity:.42;pointer-events:none;animation:orbFloat 8s ease-in-out infinite}
.orb-one{width:280px;height:280px;left:-80px;top:8%;background:#496eff}.orb-two{width:300px;height:300px;right:-100px;bottom:8%;background:#7c4dff;animation-delay:-3s}
.active-call-glow{width:270px;height:270px;top:31%;border-color:rgba(255,255,255,.18);box-shadow:0 0 0 22px rgba(255,255,255,.035),0 0 0 52px rgba(125,150,255,.035),0 0 90px rgba(83,119,255,.20)}
.active-call-content{padding:70px 22px 38px;justify-content:flex-start}
.active-call-top{height:34px;display:flex;align-items:center;gap:8px;margin-bottom:40px}
.active-call-content .call-eyebrow{margin:0;color:rgba(255,255,255,.72);letter-spacing:1.8px;font-size:10px}
.call-live-dot{width:7px;height:7px;border-radius:50%;background:#43e59a;box-shadow:0 0 0 5px rgba(67,229,154,.10),0 0 16px rgba(67,229,154,.65);animation:livePulse 1.5s infinite}
.active-call-avatar{position:relative;width:154px;height:154px;font-size:48px;border:3px solid rgba(255,255,255,.92);background:linear-gradient(145deg,#5277ff,#8d63d8);box-shadow:0 0 0 9px rgba(255,255,255,.06),0 0 0 18px rgba(111,135,255,.08),0 30px 80px rgba(0,0,0,.38);animation:avatarFloat 4s ease-in-out infinite}
.active-call-avatar::after{content:"";position:absolute;inset:-10px;border:1px solid rgba(255,255,255,.16);border-radius:50%;animation:avatarRing 2.4s ease-out infinite}
.active-call-content h2{margin-top:30px;font-size:32px;letter-spacing:-.8px;text-shadow:0 4px 25px rgba(0,0,0,.25)}
.active-call-content p{margin-top:8px;color:rgba(255,255,255,.62);font-size:14px}
.active-call-timer{margin-top:8px;color:rgba(255,255,255,.88);font-size:15px;letter-spacing:.5px}
.call-wave{height:28px;display:flex;align-items:center;gap:4px;margin-top:18px;opacity:.85}
.call-wave i{display:block;width:3px;height:8px;border-radius:9px;background:rgba(255,255,255,.72);animation:wave 1.15s ease-in-out infinite}
.call-wave i:nth-child(2){animation-delay:.1s}.call-wave i:nth-child(3){animation-delay:.2s}.call-wave i:nth-child(4){animation-delay:.3s}.call-wave i:nth-child(5){animation-delay:.4s}.call-wave i:nth-child(6){animation-delay:.3s}.call-wave i:nth-child(7){animation-delay:.2s}.call-wave i:nth-child(8){animation-delay:.1s}.call-wave i:nth-child(9){animation-delay:0s}
.active-call-controls{margin-top:auto;width:min(420px,100%);padding:18px 18px calc(18px + env(safe-area-inset-bottom));border:1px solid rgba(255,255,255,.12);border-radius:32px;background:rgba(255,255,255,.075);backdrop-filter:blur(24px) saturate(150%);-webkit-backdrop-filter:blur(24px) saturate(150%);box-shadow:0 20px 70px rgba(0,0,0,.30),inset 0 1px 0 rgba(255,255,255,.10);gap:28px}
.round-call-control{width:62px;height:62px;background:rgba(255,255,255,.10);border:1px solid rgba(255,255,255,.12);box-shadow:inset 0 1px 0 rgba(255,255,255,.12),0 10px 28px rgba(0,0,0,.16)}
.round-call-control:hover{background:rgba(255,255,255,.18);box-shadow:0 12px 34px rgba(0,0,0,.22),inset 0 1px 0 rgba(255,255,255,.16)}
.round-call-control.active{background:rgba(255,255,255,.28);box-shadow:0 0 0 5px rgba(255,255,255,.06)}
.round-call-control.end{width:68px;height:68px;background:#ff4b55;box-shadow:0 10px 30px rgba(255,75,85,.30),inset 0 1px 0 rgba(255,255,255,.22)}
.round-call-control.end:hover{background:#ff3944;box-shadow:0 14px 36px rgba(255,75,85,.38)}
.call-control-icon{width:25px;height:25px;stroke-width:1.8}
.glass-call-btn{display:inline-flex;align-items:center;justify-content:center;width:42px;height:42px;border-radius:50%;background:rgba(255,255,255,.08);border:1px solid rgba(255,255,255,.10);backdrop-filter:blur(18px);-webkit-backdrop-filter:blur(18px);transition:.2s}
.glass-call-btn svg{width:19px;height:19px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.glass-call-btn:hover{background:rgba(255,255,255,.15);transform:translateY(-1px)}
.active-call-minimize{top:22px;left:22px;right:auto}.active-call-close{top:22px;right:22px}
@keyframes orbFloat{0%,100%{transform:translate3d(0,0,0) scale(1)}50%{transform:translate3d(15px,-18px,0) scale(1.08)}}
@keyframes avatarFloat{0%,100%{transform:translateY(0)}50%{transform:translateY(-5px)}}
@keyframes avatarRing{0%{transform:scale(.9);opacity:.7}100%{transform:scale(1.22);opacity:0}}
@keyframes livePulse{0%,100%{opacity:1}50%{opacity:.45}}
@keyframes wave{0%,100%{height:7px;opacity:.45}50%{height:25px;opacity:1}}
@media(max-width:767px){
 .active-call-content{padding:66px 18px 24px}
 .active-call-top{margin-bottom:30px}
 .active-call-avatar{width:132px;height:132px;font-size:40px}
 .active-call-content h2{font-size:28px;margin-top:26px}
 .active-call-controls{width:calc(100% - 4px);gap:18px;border-radius:28px;padding:15px 14px calc(15px + env(safe-area-inset-bottom))}
 .round-call-control{width:58px;height:58px}.round-call-control.end{width:64px;height:64px}
}
@media(prefers-reduced-motion:reduce){.active-call-bg-orb,.active-call-avatar,.active-call-avatar::after,.call-wave i,.call-live-dot{animation:none}}

/* Compact call controls + cleaner minimized call chip */
.active-call-controls{
  width:min(360px,calc(100% - 24px));
  padding:12px 14px calc(12px + env(safe-area-inset-bottom));
  border-radius:24px;
  gap:20px;
}
.round-call-control{width:54px;height:54px}
.round-call-control.end{width:60px;height:60px}
.call-control-icon{width:22px;height:22px}

/* When minimized, hide the caller profile and keep only a compact call status + close button. */
.active-call-panel.call-minimized{
  inset:auto;
  top:14px;
  right:14px;
  width:190px;
  height:52px;
  min-height:52px;
  border-radius:18px;
  overflow:hidden;
  box-shadow:0 16px 45px rgba(0,0,0,.35);
}
.active-call-panel.call-minimized .active-call-glow,
.active-call-panel.call-minimized .active-call-bg-orb,
.active-call-panel.call-minimized .active-call-avatar,
.active-call-panel.call-minimized .active-call-content h2,
.active-call-panel.call-minimized .active-call-content p,
.active-call-panel.call-minimized .active-call-top,
.active-call-panel.call-minimized .active-call-controls,
.active-call-panel.call-minimized .active-call-minimize,
.active-call-panel.call-minimized .call-wave{
  display:none;
}
.active-call-panel.call-minimized .active-call-content{
  width:100%;height:52px;min-height:52px;padding:0 42px 0 14px;
  display:flex;align-items:center;justify-content:flex-start;text-align:left;
}
.active-call-panel.call-minimized .active-call-timer{
  display:block;margin:0;color:rgba(255,255,255,.9);font-size:12px;font-weight:600;
  white-space:nowrap;
}
.active-call-panel.call-minimized .active-call-timer::before{
  content:"Audio call  •  ";color:rgba(255,255,255,.62);font-weight:500;
}
.active-call-panel.call-minimized .active-call-close{
  display:flex;top:9px;right:8px;width:34px;height:34px;
  background:rgba(255,255,255,.12);border-color:rgba(255,255,255,.12);
}
.active-call-panel.call-minimized .active-call-close svg{width:16px;height:16px}

@media(max-width:767px){
  .active-call-controls{width:calc(100% - 24px);padding:11px 12px calc(11px + env(safe-area-inset-bottom));gap:16px;border-radius:22px}
  .round-call-control{width:52px;height:52px}
  .round-call-control.end{width:58px;height:58px}
  .call-control-icon{width:21px;height:21px}
  .active-call-panel.call-minimized{top:10px;right:10px;width:184px;height:50px;min-height:50px;border-radius:17px}
  .active-call-panel.call-minimized .active-call-content{height:50px;min-height:50px;padding-left:12px;padding-right:40px}
}

/* Minimized call: incoming-call-style top bar with profile, minimize and close */
.active-call-panel.call-minimized{
  inset:auto 12px auto 12px;
  top:12px;
  width:auto;
  height:64px;
  min-height:64px;
  border-radius:20px;
  overflow:hidden;
  background:rgba(18,27,52,.94);
  backdrop-filter:blur(22px) saturate(150%);
  -webkit-backdrop-filter:blur(22px) saturate(150%);
  border:1px solid rgba(255,255,255,.14);
  box-shadow:0 14px 40px rgba(0,0,0,.28);
  z-index:99999;
}
.active-call-panel.call-minimized .active-call-glow,
.active-call-panel.call-minimized .active-call-bg-orb,
.active-call-panel.call-minimized .call-wave,
.active-call-panel.call-minimized .active-call-controls,
.active-call-panel.call-minimized .active-call-top{display:none}
.active-call-panel.call-minimized .active-call-content{
  width:100%;height:64px;min-height:64px;padding:7px 96px 7px 12px;
  display:grid;grid-template-columns:44px 1fr;grid-template-rows:auto auto;
  column-gap:10px;align-items:center;text-align:left;
}
.active-call-panel.call-minimized .active-call-avatar{
  display:flex;grid-row:1 / 3;width:44px;height:44px;margin:0;font-size:16px;border-width:2px;box-shadow:none;align-self:center;
}
.active-call-panel.call-minimized .active-call-content h2{
  display:block;margin:0;font-size:14px;line-height:18px;align-self:end;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
.active-call-panel.call-minimized .active-call-content p{
  display:block;margin:0;color:rgba(255,255,255,.62);font-size:11px;line-height:15px;align-self:start;
}
.active-call-panel.call-minimized .active-call-timer{
  display:block;position:absolute;left:auto;right:98px;top:23px;margin:0;color:rgba(255,255,255,.82);font-size:11px;font-weight:600;
}
.active-call-panel.call-minimized .active-call-timer::before{content:""}
.active-call-panel.call-minimized .active-call-minimize{
  display:flex;position:absolute;top:15px;right:54px;left:auto;width:34px;height:34px;background:rgba(255,255,255,.10);border-color:rgba(255,255,255,.12);z-index:3;
}
.active-call-panel.call-minimized .active-call-close{
  display:flex;position:absolute;top:15px;right:12px;width:34px;height:34px;background:rgba(255,255,255,.10);border-color:rgba(255,255,255,.12);z-index:3;
}
.active-call-panel.call-minimized .active-call-minimize svg,
.active-call-panel.call-minimized .active-call-close svg{width:16px;height:16px}

@media(max-width:767px){
  .active-call-panel.call-minimized{top:8px;left:8px;right:8px;height:60px;min-height:60px;border-radius:18px}
  .active-call-panel.call-minimized .active-call-content{height:60px;min-height:60px;padding-left:10px;padding-right:92px;grid-template-columns:42px 1fr;column-gap:9px}
  .active-call-panel.call-minimized .active-call-avatar{width:42px;height:42px;font-size:15px}
  .active-call-panel.call-minimized .active-call-content h2{font-size:13px}
  .active-call-panel.call-minimized .active-call-content p{font-size:10px}
  .active-call-panel.call-minimized .active-call-timer{right:91px;top:22px;font-size:10px}
  .active-call-panel.call-minimized .active-call-minimize{right:49px;top:13px;width:32px;height:32px}
  .active-call-panel.call-minimized .active-call-close{right:9px;top:13px;width:32px;height:32px}
}

/* Final call UX: compact 4-button bottom dock + clean top minimized call bar */
.active-call-controls{
  width:min(360px,calc(100% - 28px)) !important;
  gap:12px !important;
  padding:10px 12px calc(10px + env(safe-area-inset-bottom)) !important;
  border-radius:24px !important;
}
.round-call-control{
  width:52px !important;height:52px !important;min-width:52px !important;
}
.round-call-control.more{background:rgba(255,255,255,.11)}
.round-call-control.more svg{width:22px;height:22px}
.call-more-menu{
  position:absolute;left:50%;bottom:calc(92px + env(safe-area-inset-bottom));transform:translateX(-50%);
  width:220px;padding:8px;border-radius:18px;
  background:rgba(20,29,52,.92);border:1px solid rgba(255,255,255,.14);
  box-shadow:0 18px 55px rgba(0,0,0,.38);backdrop-filter:blur(22px);-webkit-backdrop-filter:blur(22px);
  z-index:20;
}
.call-more-menu button{width:100%;display:flex;align-items:center;justify-content:space-between;gap:14px;padding:12px 13px;border:0;background:transparent;color:#fff;border-radius:13px;font:600 13px inherit;text-align:left}
.call-more-menu button:hover{background:rgba(255,255,255,.09)}
.call-more-menu button.danger{color:#ff8d8d}
.call-more-menu svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}

/* No top +/-/X controls. Minimized call becomes a single incoming-call-style banner. */
.active-call-panel.call-minimized{
  inset:0 !important;top:0 !important;left:0 !important;right:0 !important;
  width:100% !important;height:auto !important;min-height:0 !important;
  background:transparent !important;box-shadow:none !important;border:0 !important;
  pointer-events:none !important;
}
.active-call-panel.call-minimized .active-call-bg-orb,
.active-call-panel.call-minimized .active-call-glow,
.active-call-panel.call-minimized .call-wave,
.active-call-panel.call-minimized .active-call-controls,
.active-call-panel.call-minimized .call-more-menu{display:none !important}
.active-call-panel.call-minimized .active-call-content{
  pointer-events:auto;height:68px !important;min-height:68px !important;
  position:absolute;top:10px;left:10px;right:10px;padding:10px 14px !important;
  display:grid !important;grid-template-columns:44px 1fr auto !important;grid-template-rows:1fr 1fr !important;
  column-gap:11px;text-align:left;align-items:center;
  border-radius:20px;background:rgba(24,31,48,.92);border:1px solid rgba(255,255,255,.13);
  box-shadow:0 14px 40px rgba(0,0,0,.30);backdrop-filter:blur(24px) saturate(150%);-webkit-backdrop-filter:blur(24px) saturate(150%);
}
.active-call-panel.call-minimized .active-call-avatar{
  grid-row:1/3;width:44px !important;height:44px !important;font-size:15px !important;margin:0 !important;border-width:2px;box-shadow:none;
}
.active-call-panel.call-minimized .active-call-top{display:none !important}
.active-call-panel.call-minimized .active-call-content h2{margin:0 !important;font-size:13px !important;align-self:end !important;grid-column:2}
.active-call-panel.call-minimized .active-call-content p{margin:0 !important;font-size:10px !important;color:rgba(255,255,255,.68);align-self:start !important;grid-column:2}
.active-call-panel.call-minimized .active-call-timer{display:block !important;grid-column:3;grid-row:1/3;position:static !important;margin:0 !important;font-size:11px !important;color:rgba(255,255,255,.82)}
@media (max-width:600px){
  .active-call-controls{width:calc(100% - 28px) !important;gap:10px !important;border-radius:22px !important}
  .round-call-control{width:50px !important;height:50px !important;min-width:50px !important}
  .call-more-menu{bottom:calc(84px + env(safe-area-inset-bottom));width:205px}
  .active-call-panel.call-minimized .active-call-content{top:8px;left:8px;right:8px;height:62px !important;min-height:62px !important;border-radius:18px;padding:8px 12px !important}
  .active-call-panel.call-minimized .active-call-avatar{width:40px !important;height:40px !important}
}

/* Final refinement: no page blur for incoming/minimized call; centered mini bar with end button */
#incomingCallModal{
  background:transparent !important;
  backdrop-filter:none !important;
  -webkit-backdrop-filter:none !important;
}
#incomingCallModal::before{display:none !important}

.active-call-panel.call-minimized{
  inset:auto !important;
  top:12px !important;
  left:50% !important;
  right:auto !important;
  transform:translateX(-50%) !important;
  width:min(390px,calc(100% - 24px)) !important;
  height:64px !important;
  min-height:64px !important;
  background:rgba(24,31,48,.97) !important;
  backdrop-filter:none !important;
  -webkit-backdrop-filter:none !important;
  border-radius:18px !important;
  pointer-events:auto !important;
  box-shadow:0 10px 30px rgba(0,0,0,.24) !important;
}
.active-call-panel.call-minimized .active-call-content{
  top:0 !important;left:0 !important;right:0 !important;
  height:64px !important;min-height:64px !important;
  padding:8px 62px 8px 12px !important;
  background:transparent !important;
  backdrop-filter:none !important;
  -webkit-backdrop-filter:none !important;
}
.active-call-panel.call-minimized .active-call-close{
  display:flex !important;
  position:absolute !important;
  top:14px !important;
  right:12px !important;
  width:36px !important;height:36px !important;
  border-radius:50% !important;
  background:#ef4444 !important;
  color:#fff !important;
  border:0 !important;
  box-shadow:0 5px 14px rgba(239,68,68,.28) !important;
}
.active-call-panel.call-minimized .active-call-close svg{width:17px !important;height:17px !important}
.active-call-panel.call-minimized .active-call-minimize{display:none !important}

@media(max-width:600px){
  .active-call-panel.call-minimized{
    top:8px !important;
    width:calc(100% - 20px) !important;
    height:60px !important;
    min-height:60px !important;
  }
  .active-call-panel.call-minimized .active-call-content{
    height:60px !important;min-height:60px !important;padding-right:58px !important;
  }
  .active-call-panel.call-minimized .active-call-close{
    top:12px !important;right:10px !important;width:36px !important;height:36px !important;
  }
}

/* Final: incoming + minimized call must NEVER blur or dim the chat background. */
#incomingCallModal,
#incomingCallModal.call-modal,
#incomingCallModal.hidden {
  backdrop-filter:none !important;
  -webkit-backdrop-filter:none !important;
  background:transparent !important;
}
#incomingCallModal .incoming-call-card {
  backdrop-filter:none !important;
  -webkit-backdrop-filter:none !important;
}
.active-call-panel.call-minimized,
.active-call-panel.call-minimized .active-call-content {
  backdrop-filter:none !important;
  -webkit-backdrop-filter:none !important;
}
/* Keep the page fully interactive while the mini call bar is visible. */
.active-call-panel.call-minimized {
  pointer-events:none !important;
}
.active-call-panel.call-minimized .active-call-content {
  pointer-events:auto !important;
}
/* Missed-call notification styling */
.call-history-message.missed{border-color:rgba(239,68,68,.16);background:rgba(239,68,68,.045)}
.call-history-message.missed .call-history-icon{background:#fff0f0;color:#e5484d}
.call-history-message.missed .call-history-body strong{color:#d93b42}

/* iPhone Dynamic Island call UI refinement */
.active-call-panel.call-minimized{
  top:10px !important;
  left:50% !important;
  right:auto !important;
  transform:translateX(-50%) !important;
  width:196px !important;
  height:52px !important;
  min-height:52px !important;
  border-radius:999px !important;
  background:#050505 !important;
  border:1px solid rgba(255,255,255,.10) !important;
  box-shadow:0 8px 28px rgba(0,0,0,.30), inset 0 1px 0 rgba(255,255,255,.05) !important;
  overflow:hidden !important;
  z-index:9999 !important;
}
.active-call-panel.call-minimized .active-call-content{
  top:0 !important;left:0 !important;right:0 !important;
  width:100% !important;height:52px !important;min-height:52px !important;
  padding:7px 12px !important;
  display:grid !important;
  grid-template-columns:32px minmax(0,1fr) auto !important;
  grid-template-rows:1fr !important;
  column-gap:8px !important;
  align-items:center !important;
  border:0 !important;border-radius:999px !important;
  background:transparent !important;
  box-shadow:none !important;
}
.active-call-panel.call-minimized .active-call-avatar{
  grid-column:1 !important;grid-row:1 !important;
  width:32px !important;height:32px !important;
  font-size:12px !important;margin:0 !important;
  border:1.5px solid rgba(255,255,255,.75) !important;
  box-shadow:none !important;
}
.active-call-panel.call-minimized .active-call-content h2{
  grid-column:2 !important;grid-row:1 !important;
  min-width:0 !important;margin:0 !important;
  overflow:hidden !important;text-overflow:ellipsis !important;white-space:nowrap !important;
  font-size:12px !important;font-weight:650 !important;align-self:center !important;
  color:#fff !important;
}
.active-call-panel.call-minimized .active-call-content p{display:none !important}
.active-call-panel.call-minimized .active-call-timer{
  grid-column:3 !important;grid-row:1 !important;
  position:static !important;margin:0 !important;
  font-size:11px !important;font-weight:650 !important;
  color:rgba(255,255,255,.78) !important;
}
.active-call-panel.call-minimized .active-call-close,
.active-call-panel.call-minimized .active-call-minimize{display:none !important}
.active-call-panel.call-minimized .active-call-bg-orb,
.active-call-panel.call-minimized .active-call-glow,
.active-call-panel.call-minimized .call-wave,
.active-call-panel.call-minimized .active-call-controls,
.active-call-panel.call-minimized .call-more-menu{display:none !important}


/* Call audio mode label */
.round-call-control .call-control-label{display:block;font-size:9px;line-height:1;font-weight:700;margin-top:4px;letter-spacing:.1px;opacity:.92}
.round-call-control:has(.call-control-label){flex-direction:column;gap:1px}
@media (max-width:520px){.round-call-control .call-control-label{font-size:8px}}

/* Speaker control: icon only. Normal call is default; speaker uses the active color. */
.round-call-control .call-control-label{display:none !important}
.round-call-control:not(.end):not(.more):hover{background:rgba(255,255,255,.18);color:#fff;transform:translateY(-1px)}
.round-call-control#speakerCallBtn.active{background:rgba(255,255,255,.24);color:#fff;box-shadow:0 0 0 1px rgba(255,255,255,.18) inset,0 8px 24px rgba(0,0,0,.16)}
.round-call-control#speakerCallBtn.active:hover{background:rgba(255,255,255,.30)}

/* Chat17 call UI — compact, stable Dynamic Island + simple full-screen call */
.active-call-panel.call-minimized{
  top:8px !important;
  width:170px !important;
  height:44px !important;
  min-height:44px !important;
  transform:translateX(-50%) !important;
  animation:none !important;
}
.active-call-panel.call-minimized .active-call-content{
  height:44px !important;
  min-height:44px !important;
  padding:5px 10px !important;
  grid-template-columns:27px minmax(0,1fr) auto !important;
  column-gap:7px !important;
  animation:none !important;
}
.active-call-panel.call-minimized .active-call-avatar{
  width:27px !important;
  height:27px !important;
  font-size:10px !important;
  animation:none !important;
}
.active-call-panel.call-minimized .active-call-timer{font-size:10px !important}

/* Keep the full-screen call visually still: no floating avatar/orb motion. */
.active-call-bg-orb{animation:none !important}
.active-call-avatar{animation:none !important}
.active-call-avatar::after{animation:none !important;opacity:.45}

/* Simple full-screen call layout */
.active-call-panel{
  background:#101827 !important;
}
.active-call-panel::before{background:linear-gradient(180deg,rgba(255,255,255,.025),transparent 35%,rgba(0,0,0,.12)) !important}
.active-call-bg-orb{opacity:.12 !important;filter:blur(70px) !important}
.active-call-glow{
  width:220px !important;
  height:220px !important;
  top:33% !important;
  box-shadow:0 0 0 18px rgba(255,255,255,.025),0 0 55px rgba(83,119,255,.10) !important;
}
.active-call-content{
  padding:64px 20px 24px !important;
}
.active-call-top{margin-bottom:34px !important}
.active-call-avatar{
  width:118px !important;
  height:118px !important;
  font-size:38px !important;
  box-shadow:0 0 0 7px rgba(255,255,255,.05),0 20px 45px rgba(0,0,0,.22) !important;
}
.active-call-avatar::after{display:none !important}
.active-call-content h2{margin-top:22px !important;font-size:27px !important;text-shadow:none !important}
.active-call-content p{margin-top:6px !important}
.call-wave{margin-top:12px !important}
.active-call-controls{
  width:min(360px,100%) !important;
  padding:14px 12px calc(14px + env(safe-area-inset-bottom)) !important;
  border-radius:24px !important;
  background:rgba(255,255,255,.055) !important;
  box-shadow:0 12px 35px rgba(0,0,0,.20) !important;
  gap:18px !important;
}
.round-call-control{width:56px !important;height:56px !important}
.round-call-control.end{width:62px !important;height:62px !important}
.round-call-control:hover{transform:none !important}
@media(max-width:767px){
  .active-call-content{padding:62px 16px 20px !important}
  .active-call-top{margin-bottom:28px !important}
  .active-call-avatar{width:112px !important;height:112px !important;font-size:36px !important}
  .active-call-content h2{font-size:26px !important}
  .active-call-controls{gap:15px !important;border-radius:22px !important}
  .round-call-control{width:54px !important;height:54px !important}
  .round-call-control.end{width:60px !important;height:60px !important}
}

/* Final call controls: compact rounded bottom bar. */
.active-call-controls{
    position:absolute;
    left:50%;
    right:auto;
    bottom:18px;
    transform:translateX(-50%);
    width:max-content;
    margin:0;
    padding:8px 10px;
    display:flex;
    align-items:center;
    justify-content:center;
    gap:8px;
    background:rgba(8,17,38,.88);
    border:1px solid rgba(255,255,255,.16);
    border-radius:24px;
    box-shadow:0 8px 28px rgba(0,0,0,.22);
    backdrop-filter:blur(18px);
    -webkit-backdrop-filter:blur(18px);
}
.active-call-controls .round-call-control{
    width:46px;
    height:46px;
    flex:0 0 46px;
    flex-direction:column;
    gap:2px;
    border-radius:50%;
    border:1px solid rgba(255,255,255,.12);
}
.active-call-controls .round-call-control .call-control-icon{width:28px;height:18px}
.call-control-label{font-size:8px;line-height:1;font-weight:600;opacity:.82}
.active-call-controls .round-call-control.end{width:46px;height:46px;flex-basis:46px;border-radius:50%}
.active-call-controls .round-call-control.active{background:rgba(255,255,255,.25)}
.active-call-panel.call-minimized .active-call-controls{display:none}

@media(max-width:480px){
    .active-call-controls{bottom:14px;gap:7px;padding:7px 8px;border-radius:22px}
    .active-call-controls .round-call-control,
    .active-call-controls .round-call-control.end{width:44px;height:44px;flex-basis:44px}
    .active-call-controls .round-call-control .call-control-icon{width:17px;height:17px}
    .call-control-label{font-size:7px}
}

/* Active call controls: compact app-style bottom navbar, inset from screen edges. */
.active-call-controls{
  left:50% !important;
  right:auto !important;
  bottom:18px !important;
  width:270px !important;
  max-width:calc(100% - 32px) !important;
  box-sizing:border-box !important;
  padding:6px !important;
  gap:5px !important;
  border-radius:18px !important;
  margin:0 !important;
  background:rgba(10,18,36,.94) !important;
  border:1px solid rgba(255,255,255,.14) !important;
  box-shadow:0 8px 24px rgba(0,0,0,.24) !important;
}
.active-call-controls .round-call-control,
.active-call-controls .round-call-control.end{
  width:42px !important;
  height:42px !important;
  flex:0 0 42px !important;
  border-radius:13px !important;
  padding:0 !important;
}
.active-call-controls .round-call-control .call-control-icon{
  width:17px !important;
  height:17px !important;
}
.active-call-controls .call-control-label{display:none !important}
@media(max-width:480px){
  .active-call-controls{
    width:258px !important;
    max-width:calc(100% - 32px) !important;
    bottom:14px !important;
    padding:5px !important;
    gap:4px !important;
    border-radius:17px !important;
  }
  .active-call-controls .round-call-control,
  .active-call-controls .round-call-control.end{
    width:40px !important;
    height:40px !important;
    flex-basis:40px !important;
    border-radius:12px !important;
  }
  .active-call-controls .round-call-control .call-control-icon{
    width:16px !important;
    height:16px !important;
  }
}
\n\n/* Premium active-call controls: compact floating app navbar. */\nhtml.chat17-saved-user #loginScreen {\n    display:none !important;\n}\nhtml.chat17-saved-user #app {\n    display:grid !important;\n}\n\n.active-call-controls {\n    width: 292px !important;\n    max-width: calc(100% - 40px) !important;\n    height: 58px !important;\n    box-sizing: border-box !important;\n    padding: 6px !important;\n    gap: 5px !important;\n    bottom: max(18px, env(safe-area-inset-bottom)) !important;\n    border-radius: 20px !important;\n    background: rgba(18, 24, 39, .72) !important;\n    border: 1px solid rgba(255,255,255,.13) !important;\n    box-shadow: 0 18px 50px rgba(0,0,0,.30), inset 0 1px 0 rgba(255,255,255,.10) !important;\n    backdrop-filter: blur(24px) saturate(165%) !important;\n    -webkit-backdrop-filter: blur(24px) saturate(165%) !important;\n}\n.active-call-controls::before {\n    content: "";\n    position: absolute;\n    inset: 1px 24px auto;\n    height: 1px;\n    border-radius: 999px;\n    background: rgba(255,255,255,.16);\n    pointer-events: none;\n}\n.active-call-controls .round-call-control,\n.active-call-controls .round-call-control.end {\n    position: relative;\n    width: 46px !important;\n    height: 46px !important;\n    flex: 0 0 46px !important;\n    border-radius: 14px !important;\n    border: 1px solid rgba(255,255,255,.09) !important;\n    background: rgba(255,255,255,.065) !important;\n    color: rgba(255,255,255,.90) !important;\n    transition: transform .16s ease, background .16s ease, border-color .16s ease, box-shadow .16s ease !important;\n}\n.active-call-controls .round-call-control:active {\n    transform: scale(.93) !important;\n}\n.active-call-controls .round-call-control:hover {\n    transform: translateY(-1px) !important;\n    background: rgba(255,255,255,.11) !important;\n}\n.active-call-controls .round-call-control.active {\n    background: rgba(255,255,255,.17) !important;\n    border-color: rgba(255,255,255,.24) !important;\n    box-shadow: 0 0 0 1px rgba(255,255,255,.04), 0 6px 18px rgba(0,0,0,.18) !important;\n}\n.active-call-controls .round-call-control.end {\n    background: rgba(235, 74, 91, .92) !important;\n    border-color: rgba(255,255,255,.16) !important;\n    box-shadow: 0 8px 22px rgba(190,40,58,.28) !important;\n}\n.active-call-controls .round-call-control.end:hover {\n    background: rgba(245, 86, 102, .98) !important;\n}\n.active-call-controls .round-call-control .call-control-icon {\n    width: 18px !important;\n    height: 18px !important;\n}\n.active-call-controls .call-control-label {\n    display: none !important;\n}\n\n@media (max-width: 480px) {\n    .active-call-controls {\n        width: 272px !important;\n        max-width: calc(100% - 34px) !important;\n        height: 54px !important;\n        bottom: max(14px, env(safe-area-inset-bottom)) !important;\n        padding: 5px !important;\n        gap: 4px !important;\n        border-radius: 18px !important;\n    }\n    .active-call-controls .round-call-control,\n    .active-call-controls .round-call-control.end {\n        width: 43px !important;\n        height: 43px !important;\n        flex-basis: 43px !important;\n        border-radius: 13px !important;\n    }\n    .active-call-controls .round-call-control .call-control-icon {\n        width: 17px !important;\n        height: 17px !important;\n    }\n}\n
/* Chat17 brand palette: use the application's teal/coral palette in the active call */
.active-call-panel {
    color: var(--text);
    background:
        radial-gradient(circle at 15% 12%, rgba(15,110,93,.14), transparent 34%),
        radial-gradient(circle at 88% 82%, rgba(255,122,69,.13), transparent 34%),
        linear-gradient(150deg, var(--primary-light) 0%, var(--background) 52%, var(--accent-light) 100%);
    border: 0;
}
.active-call-panel::before {
    background: linear-gradient(180deg, rgba(255,255,255,.48), transparent 32%, rgba(23,33,29,.035));
}
.active-call-bg-orb { opacity: .22; filter: blur(65px); }
.orb-one { background: var(--primary); }
.orb-two { background: var(--accent); }
.active-call-glow {
    border-color: rgba(15,110,93,.18);
    box-shadow:
        0 0 0 22px rgba(15,110,93,.035),
        0 0 0 52px rgba(255,122,69,.035),
        0 0 90px rgba(15,110,93,.12);
}
.active-call-content .call-eyebrow { color: var(--muted); }
.call-live-dot {
    background: var(--green);
    box-shadow: 0 0 0 5px rgba(47,174,100,.10), 0 0 16px rgba(47,174,100,.38);
}
.active-call-avatar {
    border-color: rgba(255,255,255,.96);
    background: linear-gradient(145deg, var(--primary), var(--primary-dark));
    color: var(--white);
    box-shadow: 0 0 0 9px rgba(15,110,93,.07), 0 0 0 18px rgba(15,110,93,.055), var(--shadow-lg);
}
.active-call-avatar::after { border-color: rgba(15,110,93,.18); }
.active-call-content h2 { color: var(--text); text-shadow: none; }
.active-call-content p,
.active-call-timer { color: var(--muted); }
.call-wave i { background: var(--primary); }
.active-call-controls {
    border-color: var(--border);
    background: rgba(255,255,255,.76);
    box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255,255,255,.9);
    backdrop-filter: blur(22px) saturate(135%);
    -webkit-backdrop-filter: blur(22px) saturate(135%);
}
.round-call-control {
    background: var(--primary-light);
    color: var(--primary-dark);
    border-color: rgba(15,110,93,.12);
    box-shadow: var(--shadow-sm);
}
.round-call-control:hover { background: var(--white); box-shadow: var(--shadow-md); }
.round-call-control.active {
    background: var(--primary);
    color: var(--white);
    box-shadow: 0 0 0 5px rgba(15,110,93,.10), 0 8px 24px rgba(15,110,93,.18);
}
.round-call-control.end {
    background: var(--danger);
    color: var(--white);
    box-shadow: 0 10px 30px rgba(225,74,61,.24), inset 0 1px 0 rgba(255,255,255,.22);
}
.round-call-control.end:hover { background: #c93f35; }
.active-call-minimize,
.active-call-close {
    background: rgba(255,255,255,.76);
    color: var(--text);
    border-color: var(--border);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}
.active-call-minimize:hover,
.active-call-close:hover { background: var(--white); }

/* Keep profile visuals consistently on the same application palette. */
.profile-card,
.profile-stats { background: var(--white); border-color: var(--border); }
.profile-avatar { background: linear-gradient(150deg, var(--primary-light), var(--accent-light)); color: var(--primary-dark); }
.profile-card h2 { color: var(--text); }
.profile-card p,
.profile-stats span { color: var(--muted); }
.profile-stats strong { color: var(--text); }

@media (max-width: 767px) {
    .active-call-controls {
        background: rgba(255,255,255,.82);
        border-color: var(--border);
    }
}

/* FINAL: Active call uses the exact Chat17 application palette */
.active-call-panel {
  color: var(--text) !important;
  background: var(--background) !important;
}
.active-call-panel::before {
  display: none !important;
}
.active-call-panel .active-call-bg-orb { display: none !important; }
.active-call-panel .active-call-glow {
  border-color: rgba(15,110,93,.10) !important;
  box-shadow: 0 0 0 22px rgba(15,110,93,.025), 0 0 0 52px rgba(255,122,69,.025), 0 0 70px rgba(15,110,93,.07) !important;
}
.active-call-panel .active-call-content .call-eyebrow { color: var(--muted) !important; }
.active-call-panel .call-live-dot {
  background: var(--green) !important;
  box-shadow: 0 0 0 5px rgba(47,174,100,.10), 0 0 12px rgba(47,174,100,.22) !important;
}
.active-call-panel .active-call-avatar {
  background: linear-gradient(150deg, var(--primary-light), var(--accent-light)) !important;
  color: var(--primary-dark) !important;
  border: 3px solid var(--white) !important;
  box-shadow: 0 0 0 8px rgba(15,110,93,.05), var(--shadow-lg) !important;
}
.active-call-panel .active-call-content h2 { color: var(--text) !important; }
.active-call-panel .active-call-content p,
.active-call-panel .active-call-timer { color: var(--muted) !important; }
.active-call-panel .call-wave i { background: var(--primary) !important; }

.active-call-panel .active-call-controls {
  background: rgba(255,255,255,.94) !important;
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255,255,255,.95) !important;
  backdrop-filter: blur(18px) !important;
  -webkit-backdrop-filter: blur(18px) !important;
}
.active-call-panel .active-call-controls .round-call-control,
.active-call-panel .active-call-controls .round-call-control.end {
  background: var(--primary-light) !important;
  color: var(--primary-dark) !important;
  border: 1px solid rgba(15,110,93,.10) !important;
  box-shadow: var(--shadow-sm) !important;
}
.active-call-panel .active-call-controls .round-call-control:hover {
  background: var(--white) !important;
  box-shadow: var(--shadow-md) !important;
}
.active-call-panel .active-call-controls .round-call-control.active {
  background: var(--primary) !important;
  color: var(--white) !important;
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 4px rgba(15,110,93,.10), 0 8px 20px rgba(15,110,93,.16) !important;
}
.active-call-panel .active-call-controls .round-call-control.end {
  background: var(--danger) !important;
  color: var(--white) !important;
  border-color: var(--danger) !important;
  box-shadow: 0 8px 22px rgba(225,74,61,.20) !important;
}
.active-call-panel .active-call-controls .round-call-control.end:hover { background: #c93f35 !important; }

.active-call-panel .active-call-minimize,
.active-call-panel .active-call-close {
  background: var(--white) !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow-sm) !important;
}

/* Slightly larger premium active-call control navbar */
.active-call-controls{
  width:min(380px,calc(100% - 20px));
  padding:14px 16px calc(14px + env(safe-area-inset-bottom));
  border-radius:26px;
  gap:22px;
}
.round-call-control{width:58px;height:58px}
.round-call-control.end{width:64px;height:64px}
.call-control-icon{width:23px;height:23px}
@media(max-width:767px){
  .active-call-controls{
    width:calc(100% - 20px);
    padding:14px 16px calc(14px + env(safe-area-inset-bottom));
    gap:20px;
  }
  .round-call-control{width:58px;height:58px}
  .round-call-control.end{width:64px;height:64px}
}

/* Mobile call controls: slightly larger while keeping the same premium inset navbar. */
@media (max-width: 480px) {
.active-call-controls {
    width: 280px !important;
    height: 80px !important;
    padding: 8px !important;
    gap: 10px !important;
    border-radius: 24px !important;
}

.active-call-controls .round-call-control,
.active-call-controls .round-call-control.end {
    width: 58px !important;
    height: 58px !important;
    flex-basis: 54px !important;
    border-radius: 17px !important;
}

.active-call-controls .round-call-control .call-control-icon {
    width: 22px !important;
    height: 22px !important;
}
}