:root {
    --bg: #0f0f10;
    --surface: #18191b;
    --surface-soft: #232427;
    --surface-strong: #2b2d31;
    --text: #f3f4f6;
    --text-soft: #9ea3aa;
    --accent: #1396e8;
    --accent-press: #0f84cc;
    --seller: #2a2a2d;
    --user: #082f63;
    --border: #25272b;
    --success: #10c85b;
    --shadow: 0 6px 18px rgba(0, 0, 0, 0.26);
    --radius-xl: 24px;
    --radius-lg: 18px;
    --radius-md: 14px;
    --radius-sm: 10px;
    --header-height: 84px;
    --composer-height: 92px;
    --app-height: 100vh;
}

@supports (height: 100dvh) {
    :root {
        --app-height: 100dvh;
    }
}

@media (prefers-color-scheme: light) {
    :root {
        --bg: #f3f5f8;
        --surface: #ffffff;
        --surface-soft: #f1f4f8;
        --surface-strong: #e9edf3;
        --text: #16181c;
        --text-soft: #6d7480;
        --accent: #1396e8;
        --accent-press: #0f84cc;
        --seller: #ffffff;
        --user: #dcecff;
        --border: #dde3ec;
        --success: #0db45a;
        --shadow: 0 8px 24px rgba(16, 24, 40, 0.08);
    }
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    height: 100%;
    font-family: Manrope, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #0d0e10;
    color: var(--text);
}

@media (prefers-color-scheme: light) {
    html,
    body {
        background: #eef2f7;
    }
}

body {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: var(--app-height);
    padding: 0;
    overflow: hidden;
}

.phone-shell {
    width: 100%;
    max-width: 430px;
    height: var(--app-height);
    min-height: var(--app-height);
    background: #111214;
    border: 1px solid #1d1f23;
    border-radius: 0;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.45);
    overflow: hidden;
    position: relative;
}

@media (prefers-color-scheme: light) {
    .phone-shell {
        background: #f8fafc;
        border-color: #dbe2ea;
        box-shadow: 0 24px 70px rgba(15, 23, 42, 0.12);
    }
}

.app {
    height: 100%;
    min-height: 100%;
    max-width: 430px;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(circle at top right, rgba(19, 150, 232, 0.08), transparent 26%),
        linear-gradient(180deg, #101113 0%, #0c0d0f 100%);
}

@media (prefers-color-scheme: light) {
    .app {
        background:
            radial-gradient(circle at top right, rgba(19, 150, 232, 0.1), transparent 26%),
            linear-gradient(180deg, #f8fafc 0%, #eff3f8 100%);
    }
}

.header {
    min-height: calc(var(--header-height) + 18px);
    padding: calc(12px + env(safe-area-inset-top)) 14px 12px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: rgba(15, 16, 18, 0.96);
    border-bottom: 1px solid #22242a;
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 10;
    flex-shrink: 0;
    overflow: hidden;
}

@media (prefers-color-scheme: light) {
    .header {
        background: rgba(248, 250, 252, 0.94);
        border-bottom-color: #dde3ec;
    }
}

.header-profile {
    min-width: 0;
    flex: 1;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: transparent;
    border: 0;
    padding: 0;
    text-align: left;
    cursor: pointer;
    color: inherit;
    overflow: hidden;
}

.avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background:
        linear-gradient(135deg, rgba(45, 49, 56, 0.28), rgba(71, 77, 88, 0.08)),
        url("https://atlonfm.ru/media/pages/files/team/3a3ba11f0d-1722436704/vitaliy-ivanov.png") center top / cover no-repeat;
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 800;
    box-shadow: var(--shadow);
    flex: 0 0 auto;
    overflow: hidden;
    text-indent: -9999px;
}

@media (prefers-color-scheme: light) {
    .avatar {
        background:
            linear-gradient(135deg, rgba(22, 147, 230, 0.12), rgba(82, 185, 255, 0.04)),
            url("https://atlonfm.ru/media/pages/files/team/3a3ba11f0d-1722436704/vitaliy-ivanov.png") center top / cover no-repeat;
    }
}

.header-info {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    overflow: hidden;
}

.header-name {
    font-size: 17px;
    font-weight: 800;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.header-title {
    margin-top: 4px;
    color: var(--text-soft);
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.verified-badge {
    margin-top: 6px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 9px;
    border-radius: 999px;
    background: rgba(16, 200, 91, 0.14);
    color: #2ee176;
    font-size: 11px;
    font-weight: 800;
    width: fit-content;
}

.verified-icon {
    width: 14px;
    height: 14px;
    display: block;
}

.header-rating {
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-soft);
    font-size: 11px;
    font-weight: 700;
    flex-wrap: wrap;
}

.header-legal {
    margin-top: 6px;
    color: #8f949c;
    font-size: 10px;
    line-height: 1.35;
    white-space: normal;
}

@media (prefers-color-scheme: light) {
    .header-legal {
        color: #6f7783;
    }
}

.stars {
    display: inline-flex;
    gap: 2px;
    color: #ffc93d;
}

.star-icon {
    width: 12px;
    height: 12px;
    display: block;
}

.call-button {
    flex: 0 0 auto;
    border: 0;
    background: #1c1f24;
    color: #f3f4f6;
    font-weight: 800;
    border-radius: 14px;
    width: 46px;
    height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: var(--shadow);
    margin-top: 2px;
    align-self: flex-start;
}

@media (prefers-color-scheme: light) {
    .call-button {
        background: #e8f3ff;
        color: #0f84cc;
    }
}

.messages {
    flex: 1;
    min-height: 0;
    padding: 14px 12px 18px;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.loading-card {
    background: #191b1f;
    border-radius: 22px;
    padding: 16px 18px;
    box-shadow: var(--shadow);
    color: var(--text-soft);
    display: flex;
    align-items: center;
    gap: 12px;
}

@media (prefers-color-scheme: light) {
    .loading-card {
        background: rgba(255, 255, 255, 0.95);
    }
}

.dots {
    display: inline-flex;
    gap: 5px;
}

.dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #5f646d;
    animation: bounce 1.1s infinite ease-in-out;
}

.dots span:nth-child(2) {
    animation-delay: 0.15s;
}

.dots span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes bounce {
    0%,
    80%,
    100% {
        transform: translateY(0);
        opacity: 0.45;
    }

    40% {
        transform: translateY(-5px);
        opacity: 1;
    }
}

.day-separator {
    display: flex;
    justify-content: center;
    margin: 12px 0 14px;
}

.day-separator span {
    padding: 7px 12px;
    border-radius: 999px;
    background: rgba(44, 47, 53, 0.96);
    color: #888f99;
    font-size: 12px;
    font-weight: 700;
}

@media (prefers-color-scheme: light) {
    .day-separator span {
        background: rgba(231, 236, 243, 0.96);
        color: #6d7480;
    }
}

.message-row {
    display: flex;
    margin-bottom: 12px;
}

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

.bubble {
    max-width: 82%;
    border-radius: 22px;
    padding: 12px 14px 8px;
    box-shadow: var(--shadow);
    position: relative;
    line-height: 1.42;
    font-size: 14px;
}

.message-row.seller .bubble {
    background: var(--seller);
    border-top-left-radius: 8px;
    color: #eef1f5;
}

.message-row.user .bubble {
    background: var(--user);
    border-top-right-radius: 8px;
    color: #eef5ff;
}

@media (prefers-color-scheme: light) {
    .message-row.seller .bubble {
        color: #1a1f27;
    }

    .message-row.user .bubble {
        color: #17324d;
    }
}

.bubble-author {
    margin-bottom: 6px;
    font-size: 11px;
    font-weight: 800;
    color: #aeb3bb;
}

@media (prefers-color-scheme: light) {
    .bubble-author {
        color: #68707c;
    }
}

.bubble-time {
    margin-top: 6px;
    font-size: 11px;
    color: #979ca6;
    text-align: right;
}

@media (prefers-color-scheme: light) {
    .bubble-time {
        color: #6f7783;
    }
}

.bubble-text a {
    color: #59b7ff;
    text-decoration: none;
    font-weight: 800;
}

.bubble-text a:hover {
    text-decoration: underline;
}

.typing {
    display: inline-flex;
    gap: 5px;
    padding: 8px 0 4px;
    align-items: center;
}

.typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #8c919a;
    animation: bounce 1s infinite ease-in-out;
}

.typing span:nth-child(2) {
    animation-delay: 0.15s;
}

.typing span:nth-child(3) {
    animation-delay: 0.3s;
}

.composer {
    flex-shrink: 0;
    padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
    background: rgba(15, 16, 18, 0.96);
    border-top: 1px solid #22242a;
    position: sticky;
    bottom: 0;
}

@media (prefers-color-scheme: light) {
    .composer {
        background: rgba(248, 250, 252, 0.94);
        border-top-color: #dde3ec;
    }
}

.composer-inner {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    background: var(--surface);
    border-radius: 22px;
    padding: 8px;
    box-shadow: var(--shadow);
}

.composer textarea {
    flex: 1;
    resize: none;
    border: 0;
    outline: 0;
    min-height: 46px;
    max-height: 120px;
    padding: 12px 12px 10px;
    font: inherit;
    color: var(--text);
    background: var(--surface-soft);
    border-radius: 16px;
}

.composer textarea::placeholder {
    color: #8f949c;
}

@media (prefers-color-scheme: light) {
    .composer textarea::placeholder {
        color: #7c8592;
    }
}

.composer button {
    border: 0;
    background: var(--accent);
    color: white;
    min-width: 46px;
    height: 46px;
    border-radius: 16px;
    cursor: pointer;
    transition: background 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
}

.composer button:hover {
    background: var(--accent-press);
}

.profile-sheet {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, #111214 0%, #0d0e10 100%);
    display: block;
    padding: 0;
    z-index: 30;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
}

@media (prefers-color-scheme: light) {
    .profile-sheet {
        background: linear-gradient(180deg, #f8fafc 0%, #eef3f8 100%);
    }
}

.profile-sheet.open {
    opacity: 1;
    pointer-events: auto;
}

.profile-card {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    overflow-y: auto;
    background: linear-gradient(180deg, #111214 0%, #0d0e10 100%);
    border-radius: 0;
    box-shadow: none;
    transform: translateX(24px);
    transition: transform 0.22s ease;
    padding: calc(12px + env(safe-area-inset-top)) 16px calc(18px + env(safe-area-inset-bottom));
}

@media (prefers-color-scheme: light) {
    .profile-card {
        background: linear-gradient(180deg, #f8fafc 0%, #eef3f8 100%);
    }
}

.profile-sheet.open .profile-card {
    transform: translateX(0);
}

.profile-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.profile-nav-title {
    font-size: 17px;
    font-weight: 800;
    color: var(--text);
}

.profile-top {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.profile-name {
    font-size: 19px;
    font-weight: 800;
    line-height: 1.15;
    color: var(--text);
}

.profile-subtitle {
    margin-top: 4px;
    color: var(--text-soft);
    font-size: 13px;
}

.profile-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.badge {
    padding: 8px 12px;
    border-radius: 999px;
    background: #212328;
    color: #d5d8dd;
    font-size: 12px;
    font-weight: 700;
}

@media (prefers-color-scheme: light) {
    .badge {
        background: #e9edf3;
        color: #46505d;
    }
}

.profile-section {
    margin-top: 18px;
}

.profile-section h3 {
    margin: 0 0 10px;
    font-size: 15px;
    font-weight: 800;
}

.review-sort {
    margin-bottom: 12px;
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 700;
}

.review-toolbar {
    margin-bottom: 10px;
}

.review-filter {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 700;
}

.review-filter select {
    appearance: none;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    padding: 12px 14px;
    outline: 0;
    box-shadow: var(--shadow);
}

.review-list {
    display: grid;
    gap: 10px;
}

.review-card {
    background: #181a1e;
    border-radius: 18px;
    padding: 14px;
    box-shadow: var(--shadow);
}

@media (prefers-color-scheme: light) {
    .review-card {
        background: #ffffff;
    }
}

.review-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.review-name {
    font-size: 14px;
    font-weight: 800;
    color: var(--text);
}

.review-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.review-text {
    color: #d7dbe0;
    font-size: 14px;
    line-height: 1.45;
}

@media (prefers-color-scheme: light) {
    .review-text {
        color: #39424e;
    }
}

.review-date {
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 700;
}

.review-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
}

.review-badge.positive {
    background: rgba(16, 200, 91, 0.14);
    color: #2ee176;
}

.review-badge.mixed {
    background: rgba(255, 201, 61, 0.16);
    color: #ffc93d;
}

.review-badge.negative {
    background: rgba(255, 107, 107, 0.14);
    color: #ff7b7b;
}

.profile-stat {
    margin-top: 14px;
    background: #17191d;
    border-radius: 22px;
    padding: 16px;
    box-shadow: var(--shadow);
}

@media (prefers-color-scheme: light) {
    .profile-stat {
        background: #ffffff;
    }
}

.profile-stat-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.profile-stat-value {
    font-size: 28px;
    font-weight: 800;
    line-height: 1;
}

.profile-stat-label {
    color: var(--text-soft);
    font-size: 13px;
}

.sheet-close {
    border: 0;
    background: #1a1d22;
    color: #f3f4f6;
    min-width: 42px;
    height: 42px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow);
}

@media (prefers-color-scheme: light) {
    .sheet-close {
        background: #e8f3ff;
        color: #0f84cc;
    }
}

.icon {
    width: 22px;
    height: 22px;
    display: block;
}

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

@media (max-width: 390px) {
    .header {
        padding-left: 12px;
        padding-right: 12px;
    }

    .messages {
        padding-left: 10px;
        padding-right: 10px;
    }

    .composer {
        padding-left: 8px;
        padding-right: 8px;
    }

    .bubble {
        max-width: 86%;
    }
}

@media (min-width: 431px) {
    .phone-shell,
    .app {
        max-width: 430px;
    }

    .phone-shell {
        border-radius: 30px;
        margin: 0;
        border: 1px solid #1d1f23;
    }
}
