:root {
    --brand-950: #043d34;
    --brand-900: #075e54;
    --brand-800: #075E54;
    --brand-700: #128C7E;
    --brand-600: #1EBE5D;
    --brand-500: #25D366;
    --brand-300: #7bd9c0;
    --brand-100: #dff7f0;
    --brand-50: #effbf7;
    --ink-950: #101d1a;
    --ink-900: #182622;
    --ink-800: #273630;
    --ink-700: #3e4d48;
    --ink-600: #5a6964;
    --ink-500: #71807b;
    --ink-400: #8f9c98;
    --ink-300: #afbab6;
    --ink-200: #d8dfdc;
    --ink-100: #edf1ef;
    --ink-50: #f6f8f7;
    --white: #ffffff;
    --danger: #e5484d;
    --danger-dark: #c9363c;
    --warning: #e2a400;
    --blue: #35a6e8;
    --shadow-sm: 0 8px 24px rgba(12, 41, 33, .08);
    --shadow-lg: 0 24px 70px rgba(7, 38, 30, .22);
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    color-scheme: light;
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Tahoma, Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    background: var(--ink-100);
    color: var(--ink-950);
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
}

button,
input,
textarea,
select {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

button {
    border: 0;
}

button:not(:disabled),
a {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    opacity: .55;
}

input,
textarea {
    color: var(--ink-950);
}

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

[hidden] {
    display: none !important;
}

.svg-sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

.icon-button,
.rail-button,
.composer-button,
.send-button,
.mobile-nav button,
.call-control {
    display: inline-grid;
    place-items: center;
}

.icon-button svg,
.rail-button svg,
.composer-button svg,
.send-button svg,
.mobile-nav svg,
.call-control svg,
.primary-button svg,
.avatar-picker button svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Authentication */
.auth-page {
    overflow: auto;
    background:
        radial-gradient(circle at 18% 20%, rgba(123, 217, 192, .32), transparent 34%),
        linear-gradient(135deg, #e9f8f3 0%, #f5faf8 42%, #e7efed 100%);
}

.auth-shell {
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(420px, .85fr);
}

.auth-visual {
    position: relative;
    overflow: hidden;
    padding: clamp(38px, 6vw, 88px);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    background:
        linear-gradient(145deg, rgba(4, 61, 52, .96), rgba(8, 116, 95, .92)),
        #075e54;
    color: var(--white);
}

.auth-visual::before,
.auth-visual::after {
    content: "";
    position: absolute;
    border-radius: 999px;
    background: rgba(255, 255, 255, .06);
}

.auth-visual::before {
    width: 380px;
    height: 380px;
    right: -120px;
    top: -130px;
}

.auth-visual::after {
    width: 220px;
    height: 220px;
    left: -70px;
    bottom: 20%;
}

.auth-orbit {
    position: absolute;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 999px;
}

.orbit-one {
    width: 520px;
    height: 520px;
    right: -70px;
    top: 6%;
}

.orbit-two {
    width: 650px;
    height: 650px;
    right: -135px;
    top: 0;
}

.auth-phone {
    position: absolute;
    width: min(45%, 330px);
    aspect-ratio: 9 / 17;
    top: 8%;
    right: 13%;
    padding: 15px;
    border: 7px solid rgba(255, 255, 255, .2);
    border-radius: 38px;
    background: #eef4f2;
    box-shadow: 0 38px 90px rgba(0, 0, 0, .28);
    transform: rotate(5deg);
}

.auth-phone::before {
    content: "";
    position: absolute;
    width: 38%;
    height: 19px;
    left: 31%;
    top: 6px;
    border-radius: 0 0 14px 14px;
    background: #0e2d27;
}

.mock-header {
    height: 58px;
    margin: 10px -2px 0;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    border-radius: 20px 20px 4px 4px;
    background: var(--brand-800);
}

.mock-header span:last-child {
    display: flex;
    flex-direction: column;
    font-size: 12px;
}

.mock-header small {
    margin-top: 2px;
    opacity: .75;
}

.mock-avatar {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, .18);
    font-weight: 800;
}

.mock-chat {
    height: calc(100% - 70px);
    padding: 30px 11px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background:
        radial-gradient(circle at 20% 10%, rgba(11, 128, 107, .08), transparent 23%),
        #e8efec;
    border-radius: 0 0 22px 22px;
}

.mock-bubble {
    max-width: 86%;
    padding: 11px 12px;
    font-size: 11px;
    line-height: 1.5;
    color: var(--ink-800);
    box-shadow: 0 2px 6px rgba(0, 0, 0, .06);
}

.mock-bubble.incoming {
    align-self: flex-start;
    border-radius: 5px 13px 13px 13px;
    background: #fff;
}

.mock-bubble.outgoing {
    align-self: flex-end;
    border-radius: 13px 5px 13px 13px;
    background: #d4f4e6;
}

.mock-bubble span {
    color: var(--blue);
    margin-left: 4px;
}

.mock-wave {
    align-self: flex-end;
    width: 74%;
    margin-top: 2px;
    padding: 14px;
    border-radius: 13px 5px 13px 13px;
    background: #d4f4e6;
    color: var(--brand-800);
    font-size: 12px;
    letter-spacing: 3px;
}

.auth-copy {
    position: relative;
    z-index: 2;
    max-width: 620px;
}

.eyebrow,
.panel-kicker {
    display: block;
    color: var(--brand-500);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .16em;
}

.auth-copy .eyebrow {
    color: var(--brand-300);
}

.auth-copy h1 {
    max-width: 620px;
    margin: 17px 0 20px;
    font-size: clamp(40px, 5vw, 76px);
    line-height: .98;
    letter-spacing: -.055em;
}

.auth-copy p {
    max-width: 540px;
    margin: 0;
    color: rgba(255, 255, 255, .74);
    font-size: clamp(15px, 1.4vw, 19px);
    line-height: 1.7;
}

.auth-card-wrap {
    padding: 34px;
    display: grid;
    place-items: center;
}

.auth-card {
    width: min(100%, 470px);
    padding: clamp(28px, 5vw, 52px);
    border: 1px solid rgba(255, 255, 255, .8);
    border-radius: 30px;
    background: rgba(255, 255, 255, .87);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(18px);
}

.brand-lockup {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--brand-900);
    font-size: 22px;
    font-weight: 850;
    letter-spacing: -.03em;
}

.auth-heading {
    margin: 42px 0 30px;
}

.auth-heading h2 {
    margin: 0 0 10px;
    font-size: 32px;
    letter-spacing: -.04em;
}

.auth-heading p,
.auth-note {
    margin: 0;
    color: var(--ink-500);
    line-height: 1.6;
}

.auth-form {
    display: grid;
    gap: 20px;
}

.auth-form label,
.modal-field {
    display: grid;
    gap: 8px;
}

.auth-form label > span,
.modal-field > span,
.color-field > span {
    color: var(--ink-700);
    font-size: 13px;
    font-weight: 750;
}

.auth-form input,
.modal-field input,
.modal-field textarea,
.modal-textarea {
    width: 100%;
    border: 1px solid var(--ink-200);
    border-radius: 13px;
    outline: 0;
    background: var(--white);
    transition: border-color .2s, box-shadow .2s;
}

.auth-form input,
.modal-field input {
    height: 52px;
    padding: 0 15px;
}

.auth-form textarea,
.modal-field textarea,
.modal-textarea {
    padding: 13px 15px;
    resize: vertical;
}

.auth-form input:focus,
.modal-field input:focus,
.modal-field textarea:focus,
.modal-textarea:focus {
    border-color: var(--brand-500);
    box-shadow: 0 0 0 4px rgba(22, 184, 144, .12);
}

.auth-form small {
    color: var(--ink-400);
    font-size: 11px;
}

.form-error {
    padding: 12px 14px;
    border: 1px solid rgba(229, 72, 77, .18);
    border-radius: 12px;
    background: rgba(229, 72, 77, .08);
    color: var(--danger-dark);
    font-size: 13px;
    line-height: 1.5;
}

.primary-button,
.secondary-button {
    min-height: 50px;
    padding: 0 17px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border-radius: 13px;
    text-decoration: none;
    font-weight: 800;
    transition: transform .18s, box-shadow .18s, background .18s;
}

.primary-button {
    color: var(--white);
    background: linear-gradient(135deg, var(--brand-700), var(--brand-500));
    box-shadow: 0 14px 28px rgba(11, 128, 107, .2);
}

.primary-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 17px 32px rgba(11, 128, 107, .26);
}

.primary-button.compact,
.secondary-button {
    min-height: 42px;
}

.secondary-button {
    color: var(--ink-700);
    background: var(--ink-100);
}

.button-arrow {
    margin-left: auto;
    font-size: 20px;
}

.auth-note {
    margin-top: 27px;
    font-size: 11px;
    text-align: center;
}

/* Application layout */
.app-page {
    background: #dce5e2;
}

.app-shell {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    display: grid;
    grid-template-columns: 76px minmax(320px, 390px) minmax(0, 1fr);
    background: var(--white);
    overflow: hidden;
}

.nav-rail {
    position: relative;
    z-index: 20;
    padding: 14px 10px calc(14px + var(--safe-bottom));
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 9px;
    color: rgba(255, 255, 255, .7);
    background: linear-gradient(180deg, var(--brand-950), #053f35);
}

.brand-button,
.rail-avatar {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 15px;
    background: transparent;
}

.brand-button {
    margin-bottom: 13px;
}

.brand-button img {
    width: 44px;
    height: 44px;
}

.rail-tabs {
    display: grid;
    gap: 8px;
}

.rail-spacer {
    flex: 1;
}

.rail-button {
    position: relative;
    width: 46px;
    height: 46px;
    border-radius: 14px;
    color: rgba(255, 255, 255, .62);
    background: transparent;
    text-decoration: none;
    transition: color .18s, background .18s, transform .18s;
}

.rail-button:hover,
.rail-button.active {
    color: #fff;
    background: rgba(255, 255, 255, .12);
}

.rail-button.active::before {
    content: "";
    position: absolute;
    left: -10px;
    width: 3px;
    height: 22px;
    border-radius: 0 4px 4px 0;
    background: var(--brand-300);
}

.rail-badge {
    position: absolute;
    right: 2px;
    top: 1px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    display: grid;
    place-items: center;
    border: 2px solid var(--brand-950);
    border-radius: 999px;
    color: #fff;
    background: var(--brand-500);
    font-size: 9px;
    font-weight: 800;
}

.rail-avatar {
    flex: 0 0 auto;
    border: 2px solid rgba(255, 255, 255, .22);
    border-radius: 50%;
    color: #fff;
    background: var(--brand-700);
    overflow: hidden;
    font-weight: 850;
}

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

.list-panel {
    position: relative;
    z-index: 10;
    min-width: 0;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    border-right: 1px solid var(--ink-200);
    background: var(--white);
}

.list-header {
    min-height: 92px;
    padding: 20px 19px 12px 23px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
}

.list-header h1 {
    margin: 3px 0 0;
    font-size: 29px;
    line-height: 1.1;
    letter-spacing: -.045em;
}

.header-actions,
.chat-actions,
.modal-actions {
    display: flex;
    align-items: center;
    gap: 7px;
}

.icon-button {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    color: var(--ink-600);
    background: transparent;
    transition: color .16s, background .16s, transform .16s;
}

.icon-button:hover {
    color: var(--brand-800);
    background: var(--brand-50);
}

.icon-button.primary-icon {
    color: #fff;
    background: var(--brand-700);
    box-shadow: 0 10px 20px rgba(11, 128, 107, .2);
}

.icon-button.small {
    width: 34px;
    height: 34px;
}

.search-wrap {
    height: 42px;
    margin: 9px 18px 12px;
    padding: 0 13px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid transparent;
    border-radius: 13px;
    background: var(--ink-50);
    transition: border-color .16s, box-shadow .16s;
}

.search-wrap:focus-within {
    border-color: var(--brand-300);
    box-shadow: 0 0 0 3px rgba(22, 184, 144, .08);
}

.search-wrap svg {
    width: 19px;
    height: 19px;
    fill: none;
    stroke: var(--ink-400);
    stroke-width: 1.8;
    stroke-linecap: round;
}

.search-wrap input {
    min-width: 0;
    flex: 1;
    border: 0;
    outline: 0;
    background: transparent;
    font-size: 13px;
}

.list-content {
    min-height: 0;
    padding: 0 9px 20px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.list-content::-webkit-scrollbar,
.message-viewport::-webkit-scrollbar,
.select-list::-webkit-scrollbar {
    width: 6px;
}

.list-content::-webkit-scrollbar-thumb,
.message-viewport::-webkit-scrollbar-thumb,
.select-list::-webkit-scrollbar-thumb {
    border-radius: 99px;
    background: var(--ink-200);
}

.list-section-title {
    margin: 17px 14px 8px;
    color: var(--ink-400);
    font-size: 10px;
    font-weight: 850;
    letter-spacing: .13em;
    text-transform: uppercase;
}

.list-row {
    position: relative;
    width: 100%;
    min-height: 72px;
    padding: 10px 10px;
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) auto;
    align-items: center;
    gap: 11px;
    border-radius: 14px;
    color: inherit;
    background: transparent;
    text-align: left;
    transition: background .15s, transform .15s;
}

.list-row:hover,
.list-row.active {
    background: var(--brand-50);
}

.list-row:active {
    transform: scale(.995);
}

.avatar,
.avatar-button,
.status-avatar,
.profile-avatar,
#statusViewerAvatar {
    position: relative;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 50%;
    color: var(--brand-950);
    background:
        linear-gradient(145deg, rgba(123, 217, 192, .95), rgba(22, 184, 144, .58));
    overflow: hidden;
    font-weight: 850;
    text-transform: uppercase;
}

.avatar {
    width: 52px;
    height: 52px;
    font-size: 16px;
}

.avatar img,
.avatar-button img,
.status-avatar img,
.profile-avatar img,
#statusViewerAvatar img,
.call-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.online-dot {
    position: absolute;
    right: 1px;
    bottom: 1px;
    width: 12px;
    height: 12px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: var(--brand-500);
}

.list-main {
    min-width: 0;
    display: grid;
    gap: 5px;
}

.list-name-line,
.list-preview-line {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 5px;
}

.list-name {
    min-width: 0;
    overflow: hidden;
    color: var(--ink-900);
    font-size: 14px;
    font-weight: 780;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.list-preview {
    min-width: 0;
    overflow: hidden;
    color: var(--ink-500);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
    unicode-bidi: plaintext;
}

.list-preview .receipt {
    margin-right: 2px;
}

.list-meta {
    height: 43px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: space-between;
    color: var(--ink-400);
    font-size: 10px;
}

.unread-pill {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    color: #fff;
    background: var(--brand-500);
    font-size: 10px;
    font-weight: 850;
}

.receipt {
    color: var(--ink-400);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: -4px;
}

.receipt.read {
    color: var(--blue);
}

.list-empty {
    min-height: 55%;
    padding: 42px 24px;
    display: grid;
    place-items: center;
    align-content: center;
    text-align: center;
    color: var(--ink-500);
}

.list-empty .empty-icon {
    width: 62px;
    height: 62px;
    margin-bottom: 16px;
    display: grid;
    place-items: center;
    border-radius: 20px;
    color: var(--brand-700);
    background: var(--brand-50);
}

.list-empty svg {
    width: 28px;
    height: 28px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
}

.list-empty h3 {
    margin: 0 0 8px;
    color: var(--ink-800);
    font-size: 16px;
}

.list-empty p {
    max-width: 260px;
    margin: 0;
    font-size: 12px;
    line-height: 1.6;
}

.list-skeleton {
    padding: 12px 8px;
    display: grid;
    gap: 10px;
}

.list-skeleton span {
    height: 68px;
    border-radius: 14px;
    background: linear-gradient(90deg, var(--ink-50), var(--ink-100), var(--ink-50));
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite linear;
}

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

.chat-panel {
    position: relative;
    min-width: 0;
    min-height: 0;
    background:
        radial-gradient(circle at 18% 25%, rgba(11, 128, 107, .055), transparent 17%),
        radial-gradient(circle at 79% 65%, rgba(11, 128, 107, .045), transparent 18%),
        #edf2f0;
}

.chat-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    opacity: .28;
    pointer-events: none;
    background-image:
        linear-gradient(45deg, transparent 48%, rgba(7, 94, 84, .045) 49%, rgba(7, 94, 84, .045) 51%, transparent 52%),
        linear-gradient(-45deg, transparent 48%, rgba(7, 94, 84, .035) 49%, rgba(7, 94, 84, .035) 51%, transparent 52%);
    background-size: 46px 46px;
}

.empty-chat {
    position: relative;
    z-index: 1;
    height: 100%;
    padding: 32px;
    display: grid;
    place-items: center;
    align-content: center;
    text-align: center;
}

.empty-illustration {
    position: relative;
    width: 190px;
    height: 190px;
    display: grid;
    place-items: center;
}

.empty-illustration img {
    position: relative;
    z-index: 2;
    filter: drop-shadow(0 18px 32px rgba(7, 94, 84, .22));
}

.empty-ring {
    position: absolute;
    border: 1px solid rgba(11, 128, 107, .18);
    border-radius: 50%;
}

.ring-a {
    width: 146px;
    height: 146px;
}

.ring-b {
    width: 190px;
    height: 190px;
}

.empty-chat h2 {
    margin: 14px 0 9px;
    color: var(--ink-800);
    font-size: 27px;
    letter-spacing: -.035em;
}

.empty-chat p {
    max-width: 420px;
    margin: 0;
    color: var(--ink-500);
    font-size: 13px;
    line-height: 1.7;
}

.feature-pills {
    margin-top: 22px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 7px;
}

.feature-pills span {
    padding: 7px 11px;
    border: 1px solid rgba(11, 128, 107, .12);
    border-radius: 999px;
    color: var(--brand-800);
    background: rgba(255, 255, 255, .65);
    font-size: 10px;
    font-weight: 750;
}

.chat-view {
    position: relative;
    z-index: 2;
    height: 100%;
    display: grid;
    grid-template-rows: 72px minmax(0, 1fr) auto auto auto;
}

.chat-header {
    padding: 10px 17px;
    display: flex;
    align-items: center;
    gap: 11px;
    border-bottom: 1px solid rgba(216, 223, 220, .9);
    background: rgba(255, 255, 255, .94);
    backdrop-filter: blur(18px);
}

.mobile-back {
    display: none;
}

.avatar-button {
    width: 45px;
    height: 45px;
    border: 0;
}

.chat-heading {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.chat-heading strong,
.chat-heading span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-heading strong {
    color: var(--ink-900);
    font-size: 14px;
}

.chat-heading span {
    color: var(--ink-500);
    font-size: 11px;
}

.chat-heading span.typing {
    color: var(--brand-600);
    font-weight: 700;
}

.message-viewport {
    position: relative;
    min-height: 0;
    padding: 18px clamp(18px, 5vw, 72px) 24px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.load-older {
    margin: 0 auto 16px;
    padding: 8px 14px;
    display: block;
    border-radius: 999px;
    color: var(--ink-600);
    background: rgba(255, 255, 255, .8);
    box-shadow: var(--shadow-sm);
    font-size: 11px;
    font-weight: 750;
}

.message-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.day-divider {
    align-self: center;
    margin: 13px 0;
    padding: 6px 11px;
    border-radius: 8px;
    color: var(--ink-500);
    background: rgba(255, 255, 255, .78);
    box-shadow: 0 2px 7px rgba(32, 57, 50, .08);
    font-size: 9px;
    font-weight: 750;
    text-transform: uppercase;
}

.message-row {
    display: flex;
    align-items: flex-end;
    gap: 7px;
}

.message-row.mine {
    justify-content: flex-end;
}

.message-row.system {
    justify-content: center;
}

.message-sender-avatar {
    width: 27px;
    height: 27px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: var(--brand-900);
    background: var(--brand-100);
    overflow: hidden;
    font-size: 9px;
    font-weight: 850;
}

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

.message-bubble {
    position: relative;
    max-width: min(72%, 680px);
    padding: 8px 10px 6px;
    border-radius: 5px 14px 14px 14px;
    color: var(--ink-900);
    background: #fff;
    box-shadow: 0 2px 7px rgba(30, 54, 47, .08);
}

.message-row.mine .message-bubble {
    border-radius: 14px 5px 14px 14px;
    background: #d8f7e9;
}

.message-row.system .message-bubble {
    max-width: 80%;
    padding: 6px 12px;
    border-radius: 8px;
    color: var(--ink-500);
    background: rgba(255, 255, 255, .75);
    font-size: 10px;
    text-align: center;
}

.sender-name {
    display: block;
    margin-bottom: 3px;
    color: var(--brand-700);
    font-size: 10px;
    font-weight: 850;
}

.message-text {
    min-width: 32px;
    font-size: 13px;
    line-height: 1.45;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
    unicode-bidi: plaintext;
}

.message-deleted {
    color: var(--ink-400);
    font-style: italic;
}

.message-media {
    display: block;
    max-width: min(360px, 60vw);
    max-height: 420px;
    margin: -3px -5px 5px;
    border-radius: 10px;
    object-fit: cover;
    background: var(--ink-100);
}

.message-video {
    width: min(360px, 60vw);
}

.message-audio {
    width: min(300px, 62vw);
    height: 40px;
}

/* Compact WhatsApp-style voice note. The actual <audio> element stays hidden so
   Safari/Chrome do not replace the message with their oversized native player. */
.voice-note {
    width: min(330px, 68vw);
    min-width: 245px;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 3px 1px 1px;
}

.voice-note-play {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border: 0;
    border-radius: 50%;
    display: grid;
    place-items: center;
    cursor: pointer;
    background: transparent;
    color: #00a884;
    font-size: 21px;
    line-height: 1;
}

.voice-note-play:active { transform: scale(.96); }
.voice-play-icon { transform: translateX(1px); }
.voice-note.playing .voice-play-icon { transform: none; font-size: 15px; letter-spacing: -2px; }

.voice-note-track {
    min-width: 0;
    flex: 1;
    position: relative;
    padding-top: 3px;
}

.voice-waveform {
    height: 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2px;
    opacity: .55;
    pointer-events: none;
}

.voice-waveform i {
    width: 2px;
    border-radius: 3px;
    background: #667781;
}
.voice-waveform i:nth-child(3n+1) { height: 8px; }
.voice-waveform i:nth-child(3n+2) { height: 17px; }
.voice-waveform i:nth-child(3n) { height: 12px; }
.voice-waveform i:nth-child(5n) { height: 22px; }

.voice-note-progress {
    position: absolute;
    left: 0;
    right: 0;
    top: 5px;
    width: 100%;
    height: 24px;
    margin: 0;
    opacity: .01;
    cursor: pointer;
}

.voice-note-time {
    margin-top: 1px;
    display: flex;
    justify-content: space-between;
    gap: 8px;
    color: #667781;
    font-size: 10px;
    line-height: 1;
}

.voice-mic {
    flex: 0 0 auto;
    font-size: 16px;
    opacity: .7;
}

.voice-note-audio {
    display: none !important;
}

@media (max-width: 600px) {
    .voice-note {
        width: min(285px, 72vw);
        min-width: 215px;
    }
}

.file-card {
    min-width: min(280px, 58vw);
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 10px;
    color: inherit;
    background: rgba(255, 255, 255, .55);
    text-decoration: none;
}

.file-card svg {
    width: 28px;
    height: 28px;
    flex: 0 0 auto;
    fill: none;
    stroke: var(--brand-700);
    stroke-width: 1.6;
}

.file-card div {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.file-card strong,
.file-card small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-card strong {
    font-size: 11px;
}

.file-card small {
    color: var(--ink-500);
    font-size: 9px;
}

.reply-preview {
    margin-bottom: 6px;
    padding: 6px 8px;
    border-left: 3px solid var(--brand-500);
    border-radius: 6px;
    background: rgba(11, 128, 107, .07);
    font-size: 10px;
}

.reply-preview strong,
.reply-preview span {
    display: block;
}

.reply-preview strong {
    color: var(--brand-700);
    margin-bottom: 2px;
}

.reply-preview span {
    overflow: hidden;
    color: var(--ink-500);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.message-meta {
    min-height: 13px;
    margin: 2px 0 0 9px;
    display: inline-flex;
    float: right;
    align-items: center;
    gap: 5px;
    color: var(--ink-400);
    font-size: 8px;
}

.message-meta .receipt {
    font-size: 10px;
}

.message-bubble:hover .message-reply-button {
    opacity: 1;
}

.message-reply-button {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    opacity: 0;
    color: var(--ink-500);
    background: #fff;
    box-shadow: var(--shadow-sm);
    transition: opacity .16s;
}

.message-row.mine .message-reply-button {
    left: -8px;
    right: auto;
}

.message-reply-button svg {
    width: 13px;
    height: 13px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}

.typing-line {
    padding: 5px clamp(18px, 5vw, 72px);
    color: var(--brand-700);
    background: rgba(255, 255, 255, .88);
    font-size: 10px;
    font-weight: 700;
}

.reply-strip {
    min-height: 50px;
    padding: 8px 16px 8px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-top: 1px solid var(--ink-200);
    background: rgba(255, 255, 255, .96);
}

.reply-strip > div {
    min-width: 0;
    flex: 1;
    display: grid;
    gap: 2px;
    padding-left: 9px;
    border-left: 3px solid var(--brand-500);
}

.reply-strip strong,
.reply-strip span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 10px;
}

.reply-strip strong {
    color: var(--brand-700);
}

.reply-strip span {
    color: var(--ink-500);
}

.composer {
    position: relative;
    min-height: 67px;
    padding: 10px 15px calc(10px + var(--safe-bottom));
    display: flex;
    align-items: flex-end;
    gap: 7px;
    border-top: 1px solid rgba(216, 223, 220, .95);
    background: rgba(247, 249, 248, .96);
    backdrop-filter: blur(16px);
}

.composer-button,
.send-button {
    width: 43px;
    height: 43px;
    flex: 0 0 auto;
    border-radius: 50%;
    color: var(--ink-500);
    background: transparent;
}

.composer-button:hover {
    color: var(--brand-700);
    background: var(--brand-50);
}

.composer-input-wrap {
    min-width: 0;
    min-height: 43px;
    flex: 1;
    padding: 5px 13px;
    display: grid;
    align-items: center;
    border: 1px solid var(--ink-200);
    border-radius: 20px;
    background: #fff;
}

.composer-input-wrap:focus-within {
    border-color: var(--brand-300);
}

.composer textarea {
    width: 100%;
    max-height: 120px;
    padding: 6px 0;
    border: 0;
    outline: 0;
    resize: none;
    background: transparent;
    font-size: 13px;
    line-height: 1.45;
}

.attachment-name {
    max-width: 100%;
    padding: 4px 7px;
    overflow: hidden;
    border-radius: 7px;
    color: var(--brand-800);
    background: var(--brand-50);
    font-size: 9px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.send-button {
    color: #fff;
    background: var(--brand-700);
    box-shadow: 0 8px 18px rgba(11, 128, 107, .24);
}

.record-button.recording {
    color: #fff;
    background: var(--danger);
    animation: recordPulse 1.2s infinite;
}

.record-time {
    position: absolute;
    right: 0;
    bottom: -11px;
    color: var(--danger);
    font-size: 8px;
    font-weight: 800;
}

@keyframes recordPulse {
    50% { box-shadow: 0 0 0 7px rgba(229, 72, 77, .12); }
}

.emoji-panel {
    position: absolute;
    left: 14px;
    bottom: calc(72px + var(--safe-bottom));
    width: 250px;
    padding: 10px;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 4px;
    border: 1px solid var(--ink-200);
    border-radius: 15px;
    background: #fff;
    box-shadow: var(--shadow-lg);
}

.emoji-panel button {
    height: 34px;
    border-radius: 8px;
    background: transparent;
    font-size: 20px;
}

.emoji-panel button:hover {
    background: var(--ink-50);
}

.mobile-nav {
    display: none;
}

/* Contacts, calls, updates */
.contact-action {
    color: var(--brand-700);
    font-size: 11px;
    font-weight: 800;
}

.invite-label,
.status-label {
    padding: 5px 8px;
    border-radius: 999px;
    color: var(--ink-500);
    background: var(--ink-100);
    font-size: 9px;
    font-weight: 750;
}

.call-direction {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.call-direction.missed {
    color: var(--danger);
}

.call-again {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: var(--brand-700);
    background: var(--brand-50);
}

.call-again svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
}

.status-row .avatar {
    padding: 3px;
    border: 2px solid var(--brand-500);
    background: #fff;
}

.status-row.viewed .avatar {
    border-color: var(--ink-300);
}

.status-row .avatar > span,
.status-row .avatar > img {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    border-radius: 50%;
    overflow: hidden;
    background: var(--brand-100);
}

/* Modal */
.modal-backdrop {
    position: fixed;
    z-index: 1000;
    inset: 0;
    padding: 20px;
    display: grid;
    place-items: center;
    background: rgba(5, 25, 20, .56);
    backdrop-filter: blur(7px);
}

.modal-card {
    width: min(100%, 520px);
    max-height: min(86vh, 760px);
    max-height: min(86dvh, 760px);
    padding: 24px;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, .7);
    border-radius: 24px;
    background: #fff;
    box-shadow: var(--shadow-lg);
    animation: modalIn .2s ease-out;
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(10px) scale(.98); }
}

.modal-card > header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.modal-card h2 {
    margin: 4px 0 0;
    font-size: 24px;
    letter-spacing: -.04em;
}

.modal-intro {
    margin: 18px 0;
    color: var(--ink-500);
    font-size: 12px;
    line-height: 1.7;
}

.picker-button {
    width: 100%;
}

.import-source-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.import-source-grid .primary-button,
.import-source-grid .secondary-button {
    min-height: 48px;
    padding-left: 13px;
    padding-right: 13px;
    font-size: 12px;
}

.import-source-grid svg {
    width: 19px;
    height: 19px;
}

.divider {
    margin: 20px 0;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--ink-400);
    font-size: 10px;
}

.divider::before,
.divider::after {
    content: "";
    height: 1px;
    flex: 1;
    background: var(--ink-200);
}

.modal-textarea {
    min-height: 150px;
}

.modal-actions {
    margin-top: 22px;
    justify-content: flex-end;
}

.profile-form,
.status-form {
    margin-top: 20px;
    display: grid;
    gap: 16px;
}

.avatar-picker {
    display: grid;
    place-items: center;
    gap: 9px;
}

.avatar-picker > span {
    width: 92px;
    height: 92px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: var(--brand-900);
    background: var(--brand-100);
    overflow: hidden;
    font-size: 30px;
    font-weight: 850;
}

.avatar-picker button {
    padding: 7px 11px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border-radius: 9px;
    color: var(--brand-700);
    background: var(--brand-50);
    font-size: 11px;
    font-weight: 750;
}

.avatar-picker button svg {
    width: 16px;
    height: 16px;
}

.color-field {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.color-field input {
    width: 56px;
    height: 38px;
    padding: 3px;
    border: 1px solid var(--ink-200);
    border-radius: 9px;
    background: #fff;
}

.select-list {
    max-height: 360px;
    margin-top: 16px;
    overflow-y: auto;
    border: 1px solid var(--ink-200);
    border-radius: 14px;
}

.select-contact {
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--ink-100);
}

.select-contact:last-child {
    border-bottom: 0;
}

.select-contact input {
    width: 18px;
    height: 18px;
    accent-color: var(--brand-700);
}

.select-contact .avatar {
    width: 38px;
    height: 38px;
    font-size: 12px;
}

.select-contact div {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.select-contact strong,
.select-contact small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.select-contact strong {
    font-size: 12px;
}

.select-contact small {
    color: var(--ink-500);
    font-size: 10px;
}

/* Status viewer */
.status-backdrop {
    background: rgba(3, 14, 11, .9);
}

.status-viewer-card {
    width: min(100%, 470px);
    height: min(88vh, 760px);
    height: min(88dvh, 760px);
    display: grid;
    grid-template-rows: 64px 4px minmax(0, 1fr) auto;
    border-radius: 22px;
    overflow: hidden;
    color: #fff;
    background: #0a1714;
    box-shadow: var(--shadow-lg);
}

.status-viewer-card > header {
    padding: 9px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(4, 18, 14, .95);
}

#statusViewerAvatar {
    width: 42px;
    height: 42px;
}

.status-viewer-card header > div:nth-child(2) {
    min-width: 0;
    flex: 1;
    display: grid;
    gap: 3px;
}

.status-viewer-card header strong,
.status-viewer-card header span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.status-viewer-card header strong {
    font-size: 13px;
}

.status-viewer-card header span {
    color: rgba(255, 255, 255, .62);
    font-size: 9px;
}

.status-viewer-card .icon-button {
    color: #fff;
}

.status-progress {
    padding: 0 8px;
    background: #08120f;
}

.status-progress::before {
    content: "";
    display: block;
    height: 2px;
    border-radius: 99px;
    background: rgba(255, 255, 255, .2);
}

.status-progress span {
    position: relative;
    top: -2px;
    display: block;
    width: 0;
    height: 2px;
    border-radius: 99px;
    background: #fff;
}

.status-viewer-card.playing .status-progress span {
    animation: statusProgress 8s linear forwards;
}

@keyframes statusProgress {
    to { width: 100%; }
}

.status-stage {
    min-height: 0;
    display: grid;
    place-items: center;
    overflow: hidden;
}

.status-stage img,
.status-stage video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

.status-text-card {
    width: 100%;
    height: 100%;
    padding: 36px;
    display: grid;
    place-items: center;
    text-align: center;
    font-size: clamp(24px, 5vw, 42px);
    line-height: 1.25;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.status-viewer-card footer {
    min-height: 48px;
    padding: 12px 16px;
    color: rgba(255, 255, 255, .86);
    background: #08120f;
    font-size: 11px;
    line-height: 1.5;
    text-align: center;
}

/* Calling */
.call-backdrop {
    z-index: 1500;
    padding: 0;
    background: rgba(0, 0, 0, .82);
}

.call-card {
    position: relative;
    width: min(100%, 980px);
    height: min(92vh, 720px);
    height: min(92dvh, 720px);
    border-radius: 28px;
    overflow: hidden;
    color: #fff;
    background:
        radial-gradient(circle at 50% 24%, rgba(24, 197, 154, .25), transparent 34%),
        linear-gradient(160deg, #153d34, #071612 75%);
    box-shadow: 0 30px 90px rgba(0, 0, 0, .48);
}

#remoteVideo {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: transparent;
}

#localVideo {
    position: absolute;
    z-index: 3;
    right: 20px;
    top: 20px;
    width: min(25%, 190px);
    aspect-ratio: 3 / 4;
    border: 2px solid rgba(255, 255, 255, .28);
    border-radius: 18px;
    object-fit: cover;
    background: #14251f;
    box-shadow: 0 12px 30px rgba(0, 0, 0, .28);
}

.call-card.voice-call #localVideo,
.call-card.voice-call #remoteVideo {
    opacity: 0;
    pointer-events: none;
}

.call-gradient {
    position: absolute;
    z-index: 1;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(0, 0, 0, .1), transparent 35%, rgba(0, 0, 0, .68));
}

.call-person {
    position: absolute;
    z-index: 2;
    inset: 0;
    padding: 50px 20px 145px;
    display: grid;
    place-items: center;
    align-content: center;
    text-align: center;
    pointer-events: none;
}

.call-card.video-connected .call-person {
    align-content: start;
    justify-items: start;
    padding: 25px;
    text-align: left;
}

.call-card.video-connected .call-avatar {
    display: none;
}

.call-avatar {
    width: 130px;
    height: 130px;
    margin-bottom: 23px;
    display: grid;
    place-items: center;
    border: 5px solid rgba(255, 255, 255, .15);
    border-radius: 50%;
    overflow: hidden;
    color: #fff;
    background: rgba(24, 197, 154, .28);
    box-shadow: 0 0 0 12px rgba(255, 255, 255, .035);
    font-size: 44px;
    font-weight: 850;
}

.call-person h2 {
    margin: 0 0 8px;
    font-size: clamp(27px, 4vw, 44px);
    letter-spacing: -.04em;
}

.call-person p,
.call-person span {
    margin: 0;
    color: rgba(255, 255, 255, .68);
    font-size: 13px;
}

.call-person span {
    margin-top: 5px;
    color: #fff;
    font-variant-numeric: tabular-nums;
}

.incoming-call-actions,
.active-call-actions {
    position: absolute;
    z-index: 5;
    left: 50%;
    bottom: 34px;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(24px, 6vw, 60px);
}

.call-control {
    width: 64px;
    height: 64px;
    position: relative;
    border-radius: 50%;
    color: #fff;
    background: rgba(255, 255, 255, .16);
    backdrop-filter: blur(12px);
}

.call-control span {
    position: absolute;
    top: 71px;
    color: rgba(255, 255, 255, .8);
    font-size: 10px;
    white-space: nowrap;
}

.call-control.danger {
    background: var(--danger);
}

.call-control.danger svg {
    transform: rotate(135deg);
}

.call-control.accept {
    background: var(--brand-500);
}

.call-control.muted,
.call-control.off {
    color: var(--ink-950);
    background: #fff;
}

/* Toasts */
.toast-stack {
    position: fixed;
    z-index: 3000;
    right: 18px;
    top: 18px;
    width: min(360px, calc(100vw - 36px));
    display: grid;
    gap: 9px;
    pointer-events: none;
}

.toast {
    padding: 12px 14px;
    border: 1px solid rgba(255, 255, 255, .5);
    border-radius: 13px;
    color: #fff;
    background: rgba(16, 29, 26, .94);
    box-shadow: var(--shadow-lg);
    font-size: 12px;
    line-height: 1.45;
    animation: toastIn .22s ease-out;
}

.toast.error {
    background: rgba(178, 40, 45, .96);
}

.toast.success {
    background: rgba(7, 116, 95, .96);
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(-8px); }
}

/* Responsive */
@media (max-width: 1050px) {
    .app-shell {
        grid-template-columns: 70px minmax(300px, 350px) minmax(0, 1fr);
    }

    .message-viewport {
        padding-left: 26px;
        padding-right: 26px;
    }

    .typing-line {
        padding-left: 26px;
        padding-right: 26px;
    }

    .auth-phone {
        right: 8%;
    }
}

@media (max-width: 820px) {
    body.app-page {
        background: #fff;
    }

    .app-shell {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: minmax(0, 1fr) calc(64px + var(--safe-bottom));
    }

    .nav-rail {
        display: none;
    }

    .list-panel {
        grid-column: 1;
        grid-row: 1;
        border-right: 0;
    }

    .chat-panel {
        position: fixed;
        z-index: 40;
        inset: 0 0 calc(64px + var(--safe-bottom)) 0;
        transform: translateX(100%);
        transition: transform .22s ease-out;
    }

    .app-shell.chat-open .chat-panel {
        transform: translateX(0);
    }

    .mobile-nav {
        position: relative;
        z-index: 50;
        grid-column: 1;
        grid-row: 2;
        padding: 5px 7px calc(5px + var(--safe-bottom));
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        border-top: 1px solid var(--ink-200);
        background: rgba(255, 255, 255, .96);
        backdrop-filter: blur(15px);
    }

    .mobile-nav button {
        gap: 3px;
        border-radius: 12px;
        color: var(--ink-400);
        background: transparent;
        font-size: 9px;
        font-weight: 750;
    }

    .mobile-nav button.active {
        color: var(--brand-700);
        background: var(--brand-50);
    }

    .mobile-nav svg {
        width: 21px;
        height: 21px;
    }

    .mobile-back {
        display: inline-grid;
        margin-left: -7px;
    }

    .chat-view {
        grid-template-rows: 66px minmax(0, 1fr) auto auto auto;
    }

    .chat-header {
        padding-left: 8px;
    }

    .message-viewport {
        padding: 15px 12px 20px;
    }

    .typing-line {
        padding-left: 15px;
        padding-right: 15px;
    }

    .message-bubble {
        max-width: 84%;
    }

    .chat-actions .icon-button:last-child {
        display: none;
    }

    .composer {
        padding-left: 7px;
        padding-right: 7px;
        gap: 2px;
    }

    .composer-button {
        width: 38px;
    }

    #emojiButton {
        display: none;
    }

    .emoji-panel {
        left: 7px;
    }

    .list-header {
        min-height: 84px;
        padding-top: 15px;
    }

    .call-card {
        width: 100%;
        height: 100%;
        border-radius: 0;
    }

    .call-backdrop {
        place-items: stretch;
    }
}

@media (max-width: 760px) {
    .auth-shell {
        grid-template-columns: 1fr;
    }

    .auth-visual {
        min-height: 340px;
        padding: 38px 24px;
    }

    .auth-phone {
        width: 150px;
        height: 285px;
        right: 5%;
        top: 20px;
        padding: 9px;
        border-width: 4px;
        border-radius: 25px;
        opacity: .82;
    }

    .auth-phone::before {
        height: 12px;
        top: 4px;
    }

    .mock-header {
        height: 42px;
        margin-top: 5px;
        padding: 7px;
    }

    .mock-avatar {
        width: 25px;
        height: 25px;
        font-size: 10px;
    }

    .mock-header span:last-child {
        font-size: 8px;
    }

    .mock-chat {
        height: calc(100% - 48px);
        padding: 18px 6px;
        gap: 8px;
    }

    .mock-bubble,
    .mock-wave {
        padding: 7px;
        font-size: 7px;
    }

    .auth-copy {
        max-width: 68%;
    }

    .auth-copy h1 {
        margin: 11px 0 12px;
        font-size: clamp(35px, 11vw, 54px);
    }

    .auth-copy p {
        display: none;
    }

    .auth-card-wrap {
        padding: 22px 15px 34px;
        margin-top: -22px;
        position: relative;
        z-index: 3;
    }

    .auth-card {
        padding: 27px 22px;
        border-radius: 24px;
    }

    .auth-heading {
        margin: 29px 0 23px;
    }
}

@media (max-width: 500px) {
    .import-source-grid {
        grid-template-columns: 1fr;
    }

    .modal-backdrop {
        padding: 0;
        place-items: end stretch;
    }

    .modal-card {
        width: 100%;
        max-height: 91vh;
        max-height: 91dvh;
        padding: 21px 17px calc(21px + var(--safe-bottom));
        border-radius: 24px 24px 0 0;
    }

    .status-backdrop {
        place-items: stretch;
    }

    .status-viewer-card {
        width: 100%;
        height: 100%;
        border-radius: 0;
    }

    .list-header h1 {
        font-size: 27px;
    }

    .header-actions .icon-button {
        width: 39px;
        height: 39px;
    }

    .chat-actions .icon-button {
        width: 38px;
        height: 38px;
    }

    .avatar-button {
        width: 42px;
        height: 42px;
    }

    .message-media,
    .message-video {
        max-width: 72vw;
        width: auto;
    }

    .file-card {
        min-width: 62vw;
    }

    #localVideo {
        width: 31%;
        right: 13px;
        top: 13px;
        border-radius: 14px;
    }

    .call-avatar {
        width: 110px;
        height: 110px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}


/* WhatsChat v1.1 - familiar WhatsApp-inspired interaction refinements */
.chat-header {
    background: #f0f2f5;
    border-bottom-color: #d7d9db;
}
.message-viewport {
    background-color: #efeae2;
    background-image:
        radial-gradient(circle at 16px 18px, rgba(11, 92, 83, .035) 1.3px, transparent 1.5px),
        radial-gradient(circle at 52px 42px, rgba(11, 92, 83, .025) 1px, transparent 1.2px);
    background-size: 68px 68px;
}
.message-row.mine .message-bubble { background: #d9fdd3; }
.message-row.theirs .message-bubble { background: #fff; }
.composer { background: #f0f2f5; }
.send-button { background: #00a884; }
.receipt.read { color: #53bdeb; }
.unread-pill { background: #25d366; }
.mobile-nav button.active { color: #008069; }

.call-backdrop { background: #111b21; }
.call-card {
    width: min(100%, 1120px);
    height: min(100dvh, 820px);
    border-radius: 0;
    background: linear-gradient(180deg, #182b26 0%, #101a17 65%, #0b141a 100%);
    box-shadow: none;
}
.call-card.voice-call::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 28%, rgba(0, 168, 132, .18), transparent 38%);
}
.call-person { padding-bottom: 175px; }
.call-avatar {
    width: 144px;
    height: 144px;
    border: 0;
    box-shadow: 0 0 0 1px rgba(255,255,255,.08), 0 18px 60px rgba(0,0,0,.3);
}
.call-person h2 { font-size: clamp(28px, 4vw, 42px); font-weight: 500; }
.call-person p { font-size: 15px; color: rgba(255,255,255,.72); }
.incoming-call-actions, .active-call-actions {
    bottom: max(42px, calc(28px + env(safe-area-inset-bottom)));
    gap: clamp(26px, 7vw, 70px);
}
.call-control {
    width: 62px;
    height: 62px;
    background: rgba(255,255,255,.14);
}
.call-control.accept { background: #00a884; }
.call-control.danger { background: #ea0038; }
.call-control span { top: 70px; font-size: 12px; }
@media (max-width: 760px) {
    .call-card { width: 100vw; height: 100dvh; border-radius: 0; }
    .call-person { padding: 38px 18px 180px; align-content: start; padding-top: 13vh; }
    .call-avatar { width: 122px; height: 122px; }
    .active-call-actions { gap: 18px; width: 94%; }
    .active-call-actions .call-control { width: 58px; height: 58px; }
}


/* WhatsChat v1.3 */
.attach-sheet{position:absolute;z-index:30;left:48px;bottom:calc(62px + var(--safe-bottom));width:220px;padding:8px;border:1px solid var(--ink-200);border-radius:16px;background:#fff;box-shadow:0 16px 45px rgba(0,0,0,.18)}
.attach-sheet button{width:100%;padding:10px;display:flex;align-items:center;gap:11px;border-radius:12px;background:transparent;color:var(--ink-900);text-align:left}.attach-sheet button:hover{background:var(--ink-50)}
.attach-icon{width:38px;height:38px;display:grid;place-items:center;border-radius:50%;background:#7f66ff;color:#fff}.attach-icon.location{background:#18a36b}.attach-icon svg{width:21px;height:21px;fill:none;stroke:currentColor;stroke-width:1.8}
.location-card{min-width:min(300px,68vw);display:flex;gap:12px;align-items:center;color:inherit;text-decoration:none}.location-pin{width:58px;height:58px;flex:0 0 58px;display:grid;place-items:center;border-radius:12px;background:linear-gradient(135deg,#d9f4e8,#b9e8d1);color:#07835f}.location-pin svg{width:30px;height:30px;fill:none;stroke:currentColor;stroke-width:1.8}.location-card>span:last-child{min-width:0;display:grid;gap:3px}.location-card strong{font-size:13px}.location-card small{font-size:10px;color:var(--ink-500)}.location-card em{font-size:10px;color:var(--brand-700);font-style:normal;font-weight:700}
.status-footer{display:grid!important;gap:10px}.status-owner-actions{display:flex;align-items:center;justify-content:center;gap:22px}.status-owner-actions button{display:inline-flex;align-items:center;gap:7px;padding:7px 10px;border-radius:10px;color:#fff;background:rgba(255,255,255,.1)}.status-owner-actions svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.8}.status-owner-actions .danger-text{color:#ff7373}.compact-modal{max-height:min(620px,80dvh)}.status-viewers-list{min-height:140px;max-height:55dvh;overflow:auto;padding:8px 0}.viewer-row{cursor:default}
@media(max-width:820px){.composer textarea,.search-wrap input,.modal-field input,.modal-field textarea,.auth-form input,input[type=search]{font-size:16px!important}.chat-panel{height:calc(100dvh - 64px - var(--safe-bottom))}.app-shell.chat-open .chat-panel{height:100dvh;bottom:0}.chat-view{height:100%;min-height:0}.composer{flex:0 0 auto;position:relative;z-index:12;width:100%;min-width:0}.composer-input-wrap{min-width:0}.send-button,.composer-button{flex:0 0 43px}.attach-sheet{left:44px;bottom:calc(58px + var(--safe-bottom))}}
@supports(-webkit-touch-callout:none){html,body{width:100%;height:100%;overflow:hidden}body.app-page{position:fixed;inset:0}.composer textarea{font-size:16px!important}}
