.chat-view {
    --bg-color: #ffffff;
    --secondary-bg-color: #f5f5f5;
    --border-color: #e0e0e0;
    --dialog-surface-color: #f1f2f4;
    --dialog-muted-color: #e5e6e9;
    --dialog-control-color: #fafafa;
    --text-color-dark: #333333;
    --text-color-light: #999999;
    --accent-color: #ffffff;
    --accent-color-dark: #333333;
    position: fixed;
    inset: 0;
    z-index: 1200;
    width: 100%;
    min-width: 280px;
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    background-color: var(--bg-color);
    color: var(--text-color-dark);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    -webkit-overflow-scrolling: touch;
}

.chat-view,
.chat-view * {
    box-sizing: border-box;
    letter-spacing: 0;
    -webkit-tap-highlight-color: transparent;
}

.chat-view button,
.chat-view input {
    color: inherit;
    font: inherit;
}

.chat-view button {
    background: transparent;
}

body.is-chat-open .desktop-container,
body.is-chat-open .pagination,
body.is-chat-open .dock-container,
body.is-chat-open .system-status-bar {
    visibility: hidden;
    pointer-events: none;
}

.chat-view .header {
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: calc(58px + var(--safe-top));
    padding: calc(10px + var(--safe-top)) max(20px, var(--safe-right)) 10px max(20px, var(--safe-left));
    background-color: var(--bg-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.chat-view .header h1 {
    position: absolute;
    left: 50%;
    color: var(--text-color-dark);
    font-size: 20px;
    font-weight: 600;
    transform: translateX(-50%);
}

.chat-view .header-icon {
    color: var(--text-color-dark);
    font-size: 24px;
}

.chat-view .chat-exit {
    width: 63px;
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    font-size: 24px;
    line-height: 1.6;
}

.chat-view .header-actions {
    min-width: 63px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 15px;
}

.chat-view .header-actions button {
    display: grid;
    place-items: center;
    font-size: 24px;
    line-height: 1.6;
}

.chat-view .content {
    min-height: calc(100% - 58px);
    padding-bottom: calc(90px + var(--safe-bottom));
}

.chat-view .page-container {
    display: none;
}

.chat-view .page-container.active {
    display: block;
}

.chat-view .hero {
    display: flex;
    align-items: center;
    padding: 20px 25px;
}

.chat-view .hero-avatar,
.chat-view .msg-hero-avatar {
    width: 70px;
    height: 70px;
    overflow: hidden;
    border-radius: 50%;
    background-color: #ffffff;
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.15);
}

.chat-view .hero-avatar {
    flex-shrink: 0;
    margin-right: 15px;
}

.chat-view .hero-avatar img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.chat-view .hero-info {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.chat-view .username-section {
    display: flex;
    align-items: center;
    align-self: flex-start;
    gap: 4px;
    min-width: 0;
    margin-bottom: 4px;
    padding: 2px 4px 2px 0;
    border-radius: 6px;
}

.chat-view .username {
    max-width: min(48vw, 220px);
    overflow: hidden;
    color: var(--text-color-dark);
    font-size: 16px;
    font-weight: bold;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-view .persona-chevron {
    flex: 0 0 auto;
    color: var(--text-color-light);
    font-size: 16px;
    transition: transform 160ms ease;
}

.chat-view .username-section[aria-expanded="true"] .persona-chevron {
    transform: rotate(180deg);
}

.chat-view .username-section:focus-visible {
    outline: 2px solid var(--text-color-dark);
    outline-offset: 2px;
}

.chat-view .user-dropdown-menu {
    position: absolute;
    top: 32px;
    left: 0;
    z-index: 100;
    width: min(190px, calc(100vw - 130px));
    min-width: 150px;
    padding: 5px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-color);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
}

.chat-view .dropdown-item {
    width: 100%;
    min-height: 40px;
    display: flex;
    align-items: center;
    padding: 8px 10px;
    border-radius: 6px;
    color: var(--text-color-dark);
    font-size: 13px;
    text-align: left;
    transition: background-color 160ms ease;
}

.chat-view .dropdown-item > i:first-child {
    width: 14px;
    margin-right: 10px;
    color: var(--text-color-light);
    text-align: center;
}

.chat-view .dropdown-item > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-view .dropdown-item:hover,
.chat-view .dropdown-item[aria-checked="true"] {
    background-color: var(--secondary-bg-color);
}

.chat-view .dropdown-item:focus-visible {
    outline: 2px solid var(--text-color-dark);
    outline-offset: -2px;
}

.chat-view .dropdown-item:disabled {
    color: var(--text-color-light);
    cursor: default;
}

.chat-view .dropdown-item:disabled:hover {
    background-color: transparent;
}

.chat-view .persona-add-item {
    margin-top: 4px;
    border-top: 1px solid var(--border-color);
    border-radius: 0 0 6px 6px;
}

.chat-view .persona-check {
    width: 14px;
    margin-left: auto;
    color: var(--text-color-dark);
    text-align: right;
}

.chat-view .hero-text {
    max-width: 100%;
    color: var(--text-color-light);
    font-size: 12px;
    text-align: left;
}

.chat-view .msg-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px 0;
}

.chat-view .msg-hero-avatar {
    margin-bottom: 10px;
}

.chat-view .msg-hero-avatar img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.chat-view .msg-hero-text {
    max-width: 80%;
    color: var(--text-color-light);
    font-size: 14px;
    text-align: center;
}

.chat-view .tabs {
    display: flex;
    justify-content: space-around;
    margin-bottom: 5px;
    padding: 10px 20px;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--secondary-bg-color);
}

.chat-view .tab {
    color: var(--text-color-light);
    font-size: 14px;
}

.chat-view .tab i {
    margin-left: 4px;
    font-size: 10px;
}

.chat-view .tab.active {
    color: var(--text-color-dark);
    font-weight: bold;
}

.chat-view .chat-list {
    padding: 0 20px;
    background-color: var(--secondary-bg-color);
}

.chat-view .chat-item {
    width: 100%;
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    border-radius: 10px;
    background: transparent;
    cursor: pointer;
    text-align: left;
    transition: background-color 160ms ease, transform 160ms ease;
}

.chat-view .item-avatar-wrapper {
    position: relative;
    margin-right: 12px;
}

.chat-view .tape {
    position: absolute;
    top: -6px;
    left: 50%;
    z-index: 10;
    width: 22px;
    height: 10px;
    background-color: rgba(200, 200, 200, 0.5);
    rotate: 10deg;
    transform: translateX(-50%);
}

.chat-view .item-avatar {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    background-color: var(--bg-color);
    color: var(--text-color-light);
    font-size: 16px;
}

.chat-view .item-avatar img {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: inherit;
    object-fit: cover;
}

.chat-view .item-info {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.chat-view .item-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2px;
}

.chat-view .item-name {
    overflow: hidden;
    font-size: 14px;
    font-weight: bold;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-view .item-time,
.chat-view .item-status {
    color: var(--text-color-light);
    font-size: 10px;
}

.chat-view .info-card {
    display: flex;
    align-items: center;
    margin: 15px 20px;
    padding: 10px;
    border-radius: 15px;
    background-color: var(--bg-color);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.chat-view .card-details {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--text-color-light);
    font-size: 12px;
}

.chat-view .card-details i {
    margin-right: 4px;
}

.chat-view .category-nav {
    display: flex;
    justify-content: space-around;
    margin: 10px 20px 0;
    padding: 15px 0 0;
    border-bottom: 1px solid var(--border-color);
}

.chat-view .category-item {
    position: relative;
    width: 33%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-bottom: 12px;
    color: var(--text-color-light);
}

.chat-view .category-item i {
    margin-bottom: 6px;
    font-size: 18px;
}

.chat-view .category-item span {
    font-size: 12px;
    font-weight: 500;
}

.chat-view .category-item.active {
    color: var(--text-color-dark);
}

.chat-view .category-item.active::after {
    position: absolute;
    bottom: -1px;
    left: 50%;
    width: 30px;
    height: 3px;
    border-radius: 3px 3px 0 0;
    background-color: var(--text-color-dark);
    content: "";
    transform: translateX(-50%);
}

.chat-view .placeholder-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 40px 20px;
    color: var(--text-color-light);
    font-size: 14px;
    text-align: center;
}

.chat-view .placeholder-content i {
    font-size: 24px;
    opacity: 0.5;
}

.chat-view .navbar {
    position: fixed;
    right: max(20px, var(--safe-right));
    bottom: calc(20px + var(--safe-bottom));
    left: max(20px, var(--safe-left));
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 12px;
    border-radius: 25px;
    background-color: var(--secondary-bg-color);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.chat-view .nav-item {
    color: var(--text-color-light);
    font-size: 22px;
}

.chat-view .nav-item.active {
    color: var(--text-color-dark);
}

.chat-view .discover-header {
    position: relative;
}

.chat-view .discover-bg-wrapper {
    position: relative;
    width: 100%;
    height: 300px;
    cursor: pointer;
}

.chat-view .discover-bg-img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.chat-view .discover-avatar {
    position: absolute;
    right: 20px;
    bottom: -30px;
    width: 70px;
    height: 70px;
    padding: 3px;
    border-radius: 10px;
    background-color: var(--bg-color);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.chat-view .discover-avatar img {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 8px;
    object-fit: cover;
}

@supports (height: 100dvh) {
    .chat-view {
        height: 100dvh;
    }
}
.chat-view .hero {
    gap: 14px;
    align-items: center;
}

.chat-view .hero-avatar {
    position: relative;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    cursor: pointer;
    overflow: hidden;
}

.chat-view .hero-avatar img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.chat-view .hero-avatar-placeholder {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
}

.chat-view .hero-avatar:focus-visible {
    outline: 2px solid var(--text-color-dark);
    outline-offset: 3px;
}

.chat-view #chat-page-messages .card-details,
.chat-view #chat-page-contacts .card-details {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
}

.chat-view #chat-page-messages .card-details > span,
.chat-view #chat-page-contacts .card-details > span {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0 8px;
    overflow: hidden;
}

.chat-view #chat-page-messages .card-details > span + span,
.chat-view #chat-page-contacts .card-details > span + span {
    border-left: 1px solid var(--border-color);
}

.chat-view #chat-page-messages .card-details > span > span,
.chat-view #chat-page-contacts .card-details > span > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-view .user-dropdown-menu {
    width: min(230px, calc(100vw - 130px));
}

.chat-view .persona-menu-item {
    min-height: 46px;
    gap: 10px;
}

.chat-view .persona-menu-avatar {
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 50%;
    background: var(--secondary-bg-color);
    color: var(--text-color-light);
    font-size: 14px;
}

.chat-view .persona-menu-avatar img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.chat-view .persona-menu-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-view .persona-add-item {
    margin-top: 4px;
    border-top: 1px solid var(--border-color);
    border-radius: 0 0 6px 6px;
}

.chat-view .persona-check {
    width: 14px;
    margin-left: auto;
    color: var(--text-color-dark);
    text-align: right;
}

.chat-view .persona-editor-page {
    min-height: calc(100dvh - 58px);
    padding-bottom: calc(120px + var(--safe-bottom));
    background-color: var(--bg-color);
}

.chat-view .persona-editor-shell {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px 20px 0;
}

.chat-view .persona-field-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-view .persona-field {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chat-view .persona-field-label {
    color: var(--text-color-dark);
    font-size: 12px;
    font-weight: 600;
}

.chat-view .persona-field-hint {
    color: var(--text-color-light);
    font-size: 11px;
    line-height: 1.5;
}

.chat-view .persona-field input,
.chat-view .persona-field textarea,
.chat-view .persona-field select {
    width: 100%;
    min-width: 0;
    padding: 9px 12px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--secondary-bg-color);
    color: var(--text-color-dark);
    outline: 0;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92), 0 3px 8px rgba(0, 0, 0, 0.07);
    transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.chat-view .persona-field input,
.chat-view .persona-field select {
    min-height: 40px;
}

.chat-view .persona-field textarea {
    height: 64px;
    min-height: 64px;
    resize: vertical;
}

.chat-view .persona-field textarea[rows="4"] {
    height: 84px;
    min-height: 84px;
}

.chat-view .persona-field input:focus,
.chat-view .persona-field textarea:focus,
.chat-view .persona-gender-field:focus-visible,
.chat-view .persona-birthday-field:focus-visible,
.chat-view .persona-avatar-button:focus-visible,
.chat-view .persona-lockface-button:focus-visible {
    border-color: var(--accent-color-dark);
    background-color: #eeeeee;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95), 0 0 0 2px rgba(51, 51, 51, 0.16), 0 6px 14px rgba(0, 0, 0, 0.08);
}

.chat-view .persona-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px;
}

.chat-view .persona-inline-field {
    min-width: 0;
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0 10px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--secondary-bg-color);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92), 0 3px 8px rgba(0, 0, 0, 0.07);
}

.chat-view .persona-inline-field .persona-field-label {
    flex: 0 0 auto;
    font-size: 13px;
}

.chat-view .persona-birthday-field {
    cursor: pointer;
    text-align: left;
}

.chat-view .persona-birthday-field .persona-field-value {
    min-width: 0;
    margin-left: auto;
    overflow: hidden;
    color: var(--text-color-dark);
    font-size: 13px;
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-view .persona-gender-field {
    cursor: pointer;
    text-align: left;
}

.chat-view .persona-gender-value-wrap {
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    color: var(--text-color-dark);
}

.chat-view .persona-gender-field .persona-field-value {
    font-size: 13px;
    font-weight: 500;
}

.chat-view .persona-gender-value-wrap i {
    color: #696a70;
    font-size: 17px;
}

.chat-view .persona-image-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 4px;
}

.chat-view .persona-image-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.chat-view .persona-avatar-button,
.chat-view .persona-lockface-button {
    position: relative;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid var(--border-color);
    background: var(--secondary-bg-color);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95), 0 8px 18px rgba(0, 0, 0, 0.09);
}

.chat-view .persona-avatar-button {
    width: 104px;
    height: 104px;
    margin-inline: auto;
    overflow: visible;
    border-radius: 50%;
}

.chat-view .persona-lockface-button {
    width: min(42vw, 148px);
    aspect-ratio: 4 / 5;
    overflow: hidden;
    border-radius: 16px;
}

.chat-view .persona-avatar-button img,
.chat-view .persona-lockface-button img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.chat-view .persona-avatar-button img {
    border-radius: inherit;
}

.chat-view .persona-avatar-placeholder,
.chat-view .persona-lockface-placeholder {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    gap: 6px;
    color: var(--text-color-light);
    text-align: center;
}

.chat-view .persona-avatar-placeholder {
    font-size: 18px;
}

.chat-view .persona-lockface-placeholder {
    font-size: 14px;
}

.chat-view .persona-avatar-overlay {
    position: absolute;
    right: -5px;
    bottom: 5px;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border: 2px solid var(--bg-color);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    color: var(--text-color-dark);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    font-size: 14px;
}

.chat-view .persona-lockface-button .persona-lockface-placeholder {
    padding: 16px;
}
.chat-view .persona-action-dialog,
.chat-view .persona-media-dialog,
.chat-view .persona-birthday-dialog,
.chat-view .persona-gender-dialog {
    width: min(calc(100% - 32px), 460px);
    max-width: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: 22px;
    background: var(--dialog-surface-color);
    color: var(--text-color-dark);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.22);
    opacity: 0;
    transform: translateY(18px) scale(0.98);
    transition: opacity 180ms ease, transform 180ms cubic-bezier(0.2, 0.8, 0.2, 1), overlay 180ms allow-discrete, display 180ms allow-discrete;
}

.chat-view .persona-action-dialog[open],
.chat-view .persona-media-dialog[open],
.chat-view .persona-birthday-dialog[open],
.chat-view .persona-gender-dialog[open] {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.chat-view .persona-action-dialog::backdrop,
.chat-view .persona-media-dialog::backdrop,
.chat-view .persona-birthday-dialog::backdrop,
.chat-view .persona-gender-dialog::backdrop {
    background: rgba(10, 12, 16, 0.46);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

.chat-view .persona-action-shell,
.chat-view .persona-media-shell,
.chat-view .persona-birthday-shell,
.chat-view .persona-gender-shell {
    display: flex;
    flex-direction: column;
    background: var(--dialog-surface-color);
}

.chat-view .persona-action-header,
.chat-view .persona-media-header,
.chat-view .persona-birthday-header,
.chat-view .persona-gender-header {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 36px;
    align-items: center;
    gap: 12px;
    padding: 18px 18px 16px;
    border-bottom: 1px solid #d6d7da;
    background: var(--dialog-muted-color);
}

.chat-view .persona-action-icon,
.chat-view .persona-media-icon,
.chat-view .persona-birthday-icon,
.chat-view .persona-gender-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--text-color-dark);
    color: #ffffff;
    font-size: 18px;
}

.chat-view .persona-action-copy,
.chat-view .persona-media-copy,
.chat-view .persona-birthday-copy,
.chat-view .persona-gender-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.chat-view .persona-action-kicker,
.chat-view .persona-media-kicker,
.chat-view .persona-birthday-kicker,
.chat-view .persona-gender-kicker {
    overflow: hidden;
    color: var(--text-color-light);
    font-size: 10px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-view .persona-action-copy h2,
.chat-view .persona-media-copy h2,
.chat-view .persona-birthday-copy h2,
.chat-view .persona-gender-copy h2 {
    overflow-wrap: anywhere;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.3;
}

.chat-view .persona-action-close,
.chat-view .persona-media-close,
.chat-view .persona-birthday-close,
.chat-view .persona-gender-close {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    padding: 0;
    border-radius: 50%;
    background: #ececef;
    color: #5f5f65;
    font-size: 20px;
}

.chat-view .persona-action-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px 18px 18px;
    background: var(--dialog-surface-color);
}

.chat-view .persona-action-item {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 46px;
    padding: 12px 14px;
    border: 1px solid #d3d4d8;
    border-radius: 14px;
    background: var(--dialog-control-color);
    color: var(--text-color-dark);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95), 0 4px 12px rgba(0, 0, 0, 0.06);
    font-size: 14px;
    font-weight: 600;
    text-align: left;
}

.chat-view .persona-action-item.is-danger {
    border-color: rgba(180, 74, 80, 0.2);
    background: #f4e9eb;
    color: #b53e46;
}

.chat-view .persona-action-item i {
    font-size: 18px;
}

.chat-view .persona-media-shell {
    gap: 16px;
}

.chat-view .persona-media-preview {
    position: relative;
    display: grid;
    place-items: center;
    overflow: hidden;
    min-height: 220px;
    margin: 18px 18px 0;
    border: 1px solid var(--border-color);
    border-radius: 18px;
    background: var(--secondary-bg-color);
}

.chat-view .persona-media-preview img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.chat-view .persona-media-placeholder {
    display: grid;
    place-items: center;
    gap: 8px;
    color: var(--text-color-light);
    font-size: 14px;
    text-align: center;
}

.chat-view .persona-media-placeholder i {
    font-size: 26px;
    opacity: 0.6;
}

.chat-view .persona-media-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 0 18px;
}

.chat-view .persona-media-button,
.chat-view .persona-media-link-button,
.chat-view .persona-birthday-button {
    min-height: 44px;
    padding: 11px 14px;
    border: 1px solid #d3d4d8;
    border-radius: 14px;
    background: var(--dialog-control-color);
    color: var(--text-color-dark);
    font-size: 13px;
    font-weight: 600;
}

.chat-view .persona-media-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.chat-view .persona-media-button i {
    font-size: 16px;
}

.chat-view .persona-media-url-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 0 18px;
}

.chat-view .persona-media-url-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chat-view .persona-media-url-form input {
    width: 100%;
    min-width: 0;
    min-height: 46px;
    padding: 12px 14px;
    border: 1px solid #d3d4d8;
    border-radius: 14px;
    background: var(--dialog-control-color);
    color: var(--text-color-dark);
    outline: 0;
}

.chat-view .persona-media-submit {
    min-height: 44px;
    padding: 11px 14px;
    border-radius: 14px;
    background: var(--text-color-dark);
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
}

.chat-view .persona-media-message {
    padding: 0 18px;
    color: #d9363e;
    font-size: 12px;
}

.chat-view .persona-media-footer {
    display: flex;
    justify-content: flex-end;
    padding: 0 18px 18px;
}

.chat-view .persona-media-link-button {
    border-color: rgba(217, 54, 62, 0.18);
    color: #d9363e;
}

.chat-view .persona-birthday-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 18px;
    background: var(--dialog-surface-color);
}

.chat-view .persona-calendar-toolbar {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) 40px;
    align-items: center;
    gap: 10px;
}

.chat-view .persona-calendar-nav {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid #d4d5d8;
    border-radius: 12px;
    background: var(--dialog-muted-color);
    color: var(--text-color-dark);
    font-size: 20px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.chat-view .persona-calendar-period {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 17px;
    font-weight: 700;
}

.chat-view .persona-calendar-year-trigger {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 9px;
    border: 1px solid #cfd0d4;
    border-radius: 10px;
    background: var(--dialog-control-color);
    color: var(--text-color-dark);
    font-size: 15px;
    font-weight: 700;
}

.chat-view .persona-calendar-year-trigger i {
    color: #77787e;
    font-size: 14px;
}

.chat-view .persona-calendar-year-editor {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    padding: 10px;
    border: 1px solid #d1d2d6;
    border-radius: 12px;
    background: var(--dialog-muted-color);
}

.chat-view .persona-calendar-year-editor[hidden] {
    display: none;
}

.chat-view .persona-calendar-year-editor label {
    font-size: 12px;
    font-weight: 700;
}

.chat-view .persona-calendar-year-editor input {
    width: 100%;
    min-width: 0;
    height: 38px;
    padding: 7px 10px;
    border: 1px solid #c9cacf;
    border-radius: 9px;
    background: var(--dialog-control-color);
    color: var(--text-color-dark);
    font-size: 15px;
    font-weight: 600;
    outline: 0;
}

.chat-view .persona-calendar-year-editor button {
    min-height: 38px;
    padding: 7px 12px;
    border-radius: 9px;
    background: var(--text-color-dark);
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
}

.chat-view .persona-calendar-weekdays,
.chat-view .persona-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 4px;
}

.chat-view .persona-calendar-weekdays span {
    display: grid;
    place-items: center;
    min-height: 24px;
    color: #7b7c82;
    font-size: 11px;
    font-weight: 700;
}

.chat-view .persona-calendar-day,
.chat-view .persona-calendar-blank {
    min-width: 0;
    aspect-ratio: 1;
}

.chat-view .persona-calendar-day {
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 9px;
    color: var(--text-color-dark);
    font-size: 13px;
    font-weight: 600;
}

.chat-view .persona-calendar-day.is-today {
    border-color: #aeb0b6;
    background: #e3e4e7;
}

.chat-view .persona-calendar-day[aria-selected="true"] {
    border-color: var(--text-color-dark);
    background: var(--text-color-dark);
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.16);
}

.chat-view .persona-calendar-selection {
    min-height: 18px;
    color: #696a70;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
}

.chat-view .persona-birthday-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 0 18px 18px;
    background: var(--dialog-surface-color);
}

.chat-view .persona-birthday-button.is-primary {
    border-color: var(--text-color-dark);
    background: var(--text-color-dark);
    color: #ffffff;
}

.chat-view .persona-birthday-button:disabled {
    opacity: 0.42;
}

.chat-view .persona-gender-options {
    display: grid;
    gap: 10px;
    padding: 16px 18px 18px;
    background: var(--dialog-surface-color);
}

.chat-view .persona-gender-option {
    min-height: 54px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 14px 9px 10px;
    border: 1px solid #d2d3d7;
    border-radius: 14px;
    background: var(--dialog-control-color);
    color: var(--text-color-dark);
    font-size: 14px;
    font-weight: 700;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95), 0 4px 12px rgba(0, 0, 0, 0.05);
}

.chat-view .persona-gender-option > span {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.chat-view .persona-gender-option > span i {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--dialog-muted-color);
    color: #5e5f65;
    font-size: 17px;
}

.chat-view .persona-gender-option[aria-checked="true"] {
    border-color: #aeb0b6;
    background: #dfe0e3;
}

.chat-view .persona-gender-check {
    visibility: hidden;
    font-size: 19px;
}

.chat-view .persona-gender-option[aria-checked="true"] .persona-gender-check {
    visibility: visible;
}

.chat-view .persona-action-close:focus-visible,
.chat-view .persona-media-close:focus-visible,
.chat-view .persona-birthday-close:focus-visible,
.chat-view .persona-gender-close:focus-visible,
.chat-view .persona-action-item:focus-visible,
.chat-view .persona-media-button:focus-visible,
.chat-view .persona-media-link-button:focus-visible,
.chat-view .persona-media-submit:focus-visible,
.chat-view .persona-birthday-button:focus-visible,
.chat-view .persona-calendar-nav:focus-visible,
.chat-view .persona-calendar-year-trigger:focus-visible,
.chat-view .persona-calendar-year-editor input:focus-visible,
.chat-view .persona-calendar-year-editor button:focus-visible,
.chat-view .persona-calendar-day:focus-visible,
.chat-view .persona-gender-option:focus-visible {
    outline: 2px solid var(--text-color-dark);
    outline-offset: 2px;
}

@media (hover: hover) and (pointer: fine) {
    .chat-view .hero-avatar:hover {
        transform: translateY(-1px);
    }

    .chat-view .persona-action-close:hover,
    .chat-view .persona-media-close:hover,
    .chat-view .persona-birthday-close:hover,
    .chat-view .persona-gender-close:hover {
        background: #dedee3;
        color: #222226;
    }

    .chat-view .persona-action-item:hover,
    .chat-view .persona-media-button:hover,
    .chat-view .persona-media-link-button:hover,
    .chat-view .persona-birthday-button:hover,
    .chat-view .persona-calendar-nav:hover,
    .chat-view .persona-calendar-year-trigger:hover,
    .chat-view .persona-calendar-day:hover,
    .chat-view .persona-gender-option:hover {
        background: #f4f4f5;
    }

    .chat-view .persona-action-item.is-danger:hover,
    .chat-view .persona-media-link-button:hover {
        background: #eddfe1;
    }
}

@media (max-width: 540px) {
    .chat-view .persona-action-dialog,
    .chat-view .persona-media-dialog,
    .chat-view .persona-birthday-dialog,
    .chat-view .persona-gender-dialog {
        width: 100%;
        max-height: calc(100dvh - 12px);
        overflow-y: auto;
        overscroll-behavior: contain;
        border-width: 1px 1px 0;
        border-radius: 22px 22px 0 0;
        transform: translateY(18px);
        inset: auto 0 0;
    }

    .chat-view .persona-action-dialog[open],
    .chat-view .persona-media-dialog[open],
    .chat-view .persona-birthday-dialog[open],
    .chat-view .persona-gender-dialog[open] {
        transform: translateY(0);
    }

    .chat-view .persona-action-body,
    .chat-view .persona-media-preview,
    .chat-view .persona-media-actions,
    .chat-view .persona-media-url-form,
    .chat-view .persona-media-message,
    .chat-view .persona-media-footer,
    .chat-view .persona-birthday-body,
    .chat-view .persona-birthday-actions,
    .chat-view .persona-gender-options {
        padding-inline: 16px;
    }

    .chat-view .persona-action-body,
    .chat-view .persona-birthday-actions,
    .chat-view .persona-gender-options {
        padding-bottom: calc(18px + var(--safe-bottom));
    }

    .chat-view .persona-media-preview {
        margin-inline: 16px;
    }

    .chat-view .persona-row {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 10px;
    }

    .chat-view .persona-avatar-button {
        width: 96px;
        height: 96px;
    }

}
.chat-view.is-conversation-open {
    overflow: hidden;
}

.chat-view.is-conversation-open .header,
.chat-view.is-conversation-open .navbar {
    display: none;
}

.chat-view.is-conversation-open .content {
    height: 100%;
    min-height: 0;
    padding-bottom: 0;
    overflow: hidden;
}

.chat-view .conversation-page {
    width: 100%;
    height: 100%;
    min-height: 100dvh;
    flex-direction: column;
    overflow: hidden;
    background: #ffffff;
    color: #000000;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: normal;
}

.chat-view .conversation-page.active {
    display: flex;
}

.chat-view .conversation-header {
    position: relative;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 0 0 auto;
    padding: max(40px, calc(12px + var(--safe-top))) 16px 12px;
    background: #ffffff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.chat-view .conversation-header-left,
.chat-view .conversation-profile,
.chat-view .conversation-header-actions {
    display: flex;
    align-items: center;
}

.chat-view .conversation-header-left {
    min-width: 0;
    gap: 12px;
}

.chat-view .conversation-close {
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    flex: 0 0 24px;
    padding: 0;
    color: #000000;
}

.chat-view .conversation-close svg {
    display: block;
}

.chat-view .conversation-profile {
    min-width: 0;
    gap: 8px;
}

.chat-view .conversation-avatar {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 36px;
    overflow: hidden;
    border-radius: 50%;
    background: #d1d1d1;
}

.chat-view .conversation-avatar img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.chat-view .conversation-user-details {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.chat-view .conversation-user-name {
    overflow: hidden;
    color: #000000;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-view .conversation-user-status {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #666666;
    font-size: 9px;
    line-height: 1.25;
    white-space: nowrap;
}

@keyframes conversation-breathe {
    0% {
        opacity: 0.8;
        box-shadow: 0 0 0 0 rgba(52, 199, 89, 0.4);
        transform: scale(1);
    }

    50% {
        opacity: 1;
        box-shadow: 0 0 0 4px rgba(52, 199, 89, 0);
        transform: scale(1.1);
    }

    100% {
        opacity: 0.8;
        box-shadow: 0 0 0 0 rgba(52, 199, 89, 0);
        transform: scale(1);
    }
}

.chat-view .conversation-status-dot {
    width: 8px;
    height: 8px;
    flex: 0 0 8px;
    border-radius: 50%;
    background: #34c759;
    animation: conversation-breathe 2s infinite ease-in-out;
}

.chat-view .conversation-header-actions {
    flex: 0 0 auto;
    gap: 16px;
    margin-left: 12px;
}

.chat-view .conversation-header-actions button {
    width: 22px;
    height: 28px;
    display: grid;
    place-items: center;
    padding: 0;
    color: #333333;
}

.chat-view .conversation-header-actions svg {
    display: block;
}

.chat-view .conversation-body {
    min-height: 0;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    background: #ffffff;
    -webkit-overflow-scrolling: touch;
}

.chat-view .conversation-time-divider {
    align-self: center;
    margin: 8px 0;
    padding: 4px 12px;
    border-radius: 12px;
    background: #e8e8e8;
    color: #333333;
    font-size: 12px;
    line-height: 1.35;
    white-space: nowrap;
}

.chat-view .conversation-message-row {
    width: 100%;
    min-width: 0;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.chat-view .conversation-message-row.is-outgoing {
    justify-content: flex-end;
}

.chat-view .conversation-message-row.is-incoming {
    justify-content: flex-start;
}

.chat-view .conversation-message-row.has-spacing {
    margin-top: 10px;
}

.chat-view .conversation-bubble {
    max-width: 90%;
    min-width: 0;
    flex: 0 1 auto;
    padding: 8px 12px;
    color: #000000;
    font-size: 13px;
    line-height: 1.4;
    overflow-wrap: anywhere;
    word-wrap: break-word;
}

.chat-view .conversation-message-row.is-outgoing .conversation-bubble {
    border-radius: 20px 4px 20px 20px;
    background: #f0f0f0;
}

.chat-view .conversation-message-row.is-incoming .conversation-bubble {
    border-radius: 4px 20px 20px 20px;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.chat-view .conversation-message-meta {
    align-self: stretch;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    flex: 0 0 auto;
    padding-top: 4px;
    padding-bottom: 2px;
    color: #888888;
    font-size: 10px;
    line-height: 1.2;
    white-space: nowrap;
}

.chat-view .conversation-message-row.is-outgoing .conversation-message-meta {
    align-items: flex-end;
    margin-right: 4px;
}

.chat-view .conversation-message-row.is-incoming .conversation-message-meta {
    align-items: flex-start;
    margin-left: 4px;
}

.chat-view .conversation-avatar.is-placeholder {
    visibility: hidden;
}

.chat-view .conversation-footer {
    min-width: 0;
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    gap: 12px;
    padding: 12px 16px max(24px, calc(12px + var(--safe-bottom)));
    background: #ffffff;
}

.chat-view .conversation-footer-button,
.chat-view .conversation-send {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    flex: 0 0 32px;
    padding: 0;
    border-radius: 50%;
}

.chat-view .conversation-footer-button {
    background: #e5e5e5;
    color: #333333;
}

.chat-view .conversation-input-wrapper {
    min-width: 0;
    height: 40px;
    display: flex;
    align-items: center;
    flex: 1 1 auto;
    padding: 0 8px 0 16px;
    border-radius: 20px;
    background: #ffffff;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1), 0 2px 6px rgba(0, 0, 0, 0.05);
}

.chat-view .conversation-input-wrapper input {
    min-width: 0;
    height: 100%;
    flex: 1 1 auto;
    border: 0;
    outline: 0;
    background: transparent;
    color: #333333;
    font-size: 14px;
}

.chat-view .conversation-input-wrapper input::placeholder {
    color: #b0b0b0;
}

.chat-view .conversation-voice-button {
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    flex: 0 0 24px;
    margin-left: 8px;
    padding: 0;
    border-radius: 50%;
    background: #e5e5e5;
    color: #666666;
}

.chat-view .conversation-send {
    background: #333333;
    color: #000000;
}

.chat-view .conversation-footer svg,
.chat-view .conversation-voice-button svg {
    display: block;
}

.chat-view .conversation-close:focus-visible,
.chat-view .conversation-header-actions button:focus-visible,
.chat-view .conversation-footer-button:focus-visible,
.chat-view .conversation-voice-button:focus-visible,
.chat-view .conversation-send:focus-visible,
.chat-view .chat-item:focus-visible {
    outline: 2px solid #333333;
    outline-offset: 3px;
}

@media (hover: hover) and (pointer: fine) {
    .chat-view .chat-item:hover {
        background: rgba(0, 0, 0, 0.04);
        transform: translateY(-1px);
    }

    .chat-view .conversation-header-actions button:hover {
        color: #000000;
    }

    .chat-view .conversation-footer-button:hover,
    .chat-view .conversation-voice-button:hover {
        background: #dddddd;
    }

    .chat-view .conversation-send:hover {
        background: #1f1f1f;
    }
}

@media (max-width: 359px) {
    .chat-view .conversation-footer {
        gap: 8px;
        padding-inline: 12px;
    }

    .chat-view .conversation-input-wrapper {
        padding-left: 12px;
    }

    .chat-view .conversation-header,
    .chat-view .conversation-body {
        padding-inline: 12px;
    }
}
