@font-face {
    font-family: "Inter";
    src: url("/assets/fonts/InterVariable.woff2") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

html {
    touch-action: pan-x pan-y;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    overscroll-behavior: none;
}

html:has(.app) {
    overflow: hidden;
}

:root,
[data-theme="light"] {
    color-scheme: light;
    --bg: #F7F4EF;
    --bg-deep: #F0EBE2;
    --surface: #FCFAF6;
    --surface-soft: #EFEAE1;
    --ink: #1A1A1A;
    --ink-hover: #333333;
    --ink-soft: #3A3833;
    --muted: #8A857D;
    --line: #D9D4CB;
    --line-strong: #BEB6AA;
    --strength-weak: #C0392B;
    --strength-medium: #B8860B;
    --strength-strong: #2E7D32;
    --own-bubble: #1A1A1A;
    --own-ink: #F7F4EF;
    --other-bubble: #FCFAF6;
    --other-ink: #1A1A1A;
    --hover: rgba(26, 26, 26, 0.045);
    --active: rgba(26, 26, 26, 0.075);
    --overlay: rgba(26, 26, 26, 0.34);
    --shadow-color: rgba(0, 0, 0, 0.04);
    --shadow-strong: rgba(0, 0, 0, 0.08);
    --scroll: #D9D4CB;
    --selection: rgba(26, 26, 26, 0.14);
    --preview-light-bg: #F7F4EF;
    --preview-dark-bg: #171614;
    --preview-paper-bg: #F2EBDC;
    --pattern-rules: url("/assets/patterns/rules-light.svg");
    --pattern-grain: url("/assets/patterns/grain-light.svg");
}

[data-theme="dark"] {
    color-scheme: dark;
    --bg: #151412;
    --bg-deep: #100F0E;
    --surface: #1E1C19;
    --surface-soft: #272420;
    --ink: #F2EEE7;
    --ink-hover: #D8D2C8;
    --ink-soft: #D8D2C8;
    --muted: #9D968B;
    --line: #3A3630;
    --line-strong: #555048;
    --strength-weak: #FF6B5B;
    --strength-medium: #F5C451;
    --strength-strong: #6BD48A;
    --own-bubble: #EDE8DF;
    --own-ink: #1A1A1A;
    --other-bubble: #211F1B;
    --other-ink: #F2EEE7;
    --hover: rgba(242, 238, 231, 0.05);
    --active: rgba(242, 238, 231, 0.09);
    --overlay: rgba(0, 0, 0, 0.62);
    --shadow-color: rgba(0, 0, 0, 0.26);
    --shadow-strong: rgba(0, 0, 0, 0.4);
    --scroll: #4A453E;
    --selection: rgba(242, 238, 231, 0.18);
    --preview-light-bg: #F7F4EF;
    --preview-dark-bg: #171614;
    --preview-paper-bg: #F2EBDC;
    --pattern-rules: url("/assets/patterns/rules-dark.svg");
    --pattern-grain: url("/assets/patterns/grain-dark.svg");
}

[data-theme="paper"] {
    color-scheme: light;
    --bg: #F2EBDC;
    --bg-deep: #E9E0CE;
    --surface: #FBF6EA;
    --surface-soft: #ECE2CF;
    --ink: #1A1A1A;
    --ink-hover: #333333;
    --ink-soft: #3A3833;
    --muted: #887F71;
    --line: #D7CBB6;
    --line-strong: #BFB29C;
    --strength-weak: #B5382A;
    --strength-medium: #A97B0A;
    --strength-strong: #2E7D32;
    --own-bubble: #1A1A1A;
    --own-ink: #F7F1E4;
    --other-bubble: #FBF6EA;
    --other-ink: #1A1A1A;
    --hover: rgba(26, 26, 26, 0.045);
    --active: rgba(26, 26, 26, 0.075);
    --overlay: rgba(26, 26, 26, 0.34);
    --shadow-color: rgba(0, 0, 0, 0.04);
    --shadow-strong: rgba(0, 0, 0, 0.08);
    --scroll: #D7CBB6;
    --selection: rgba(26, 26, 26, 0.14);
    --preview-light-bg: #F7F4EF;
    --preview-dark-bg: #171614;
    --preview-paper-bg: #F2EBDC;
    --pattern-rules: url("/assets/patterns/rules-paper.svg");
    --pattern-grain: url("/assets/patterns/grain-paper.svg");
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    overscroll-behavior: none;
    background: var(--bg);
    color: var(--ink);
    font-family: "Inter", "PingFang SC", "Source Han Sans SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
    font-size: 15px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body:has(.app) {
    overflow: hidden;
}

::selection {
    background: var(--selection);
}

a {
    color: inherit;
    text-decoration: none;
}

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

button {
    border: 0;
    padding: 0;
    background: none;
    cursor: pointer;
}

button:disabled {
    cursor: default;
    opacity: 0.42;
}

input,
textarea {
    border-radius: 0;
}

input::placeholder,
textarea::placeholder {
    color: var(--muted);
    opacity: 0.78;
}

:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 2px;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--scroll);
    border-radius: 8px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--line-strong);
}

[hidden] {
    display: none !important;
}

.icon {
    --icon-size: 20px;
    width: var(--icon-size);
    height: var(--icon-size);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: calc(var(--icon-size) * 0.8);
    line-height: 1;
    flex: 0 0 auto;
}

.eyebrow {
    margin: 0;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.muted {
    color: var(--muted);
}

.signature {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.8;
}

.wordmark {
    display: inline-flex;
    align-items: baseline;
    gap: 3px;
    font-size: 21px;
    font-weight: 600;
    letter-spacing: -0.045em;
    line-height: 1;
}

.wordmark-lg {
    font-size: 27px;
}

.wordmark-mark {
    width: 6px;
    height: 6px;
    border-radius: 2px;
    background: var(--ink);
    display: inline-block;
}

.icon-button {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    transition: background-color 160ms ease, color 160ms ease, opacity 160ms ease;
}

.icon-button:hover {
    background: var(--hover);
    color: var(--ink);
}

.icon-button .icon {
    --icon-size: 19px;
    
}

.text-button {
    color: var(--muted);
    font-size: 12.5px;
    padding: 4px 2px;
    border-bottom: 1px solid transparent;
    transition: color 160ms ease, border-color 160ms ease;
}

.text-button:hover {
    color: var(--ink);
    border-color: var(--ink);
}

.primary-button,
.secondary-button,
.small-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 10px;
    white-space: nowrap;
    transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease, opacity 160ms ease;
}

.primary-button {
    min-height: 46px;
    padding: 0 22px;
    background: var(--ink);
    color: var(--bg);
    font-size: 14px;
    font-weight: 500;
}

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

.secondary-button {
    min-height: 42px;
    padding: 0 18px;
    border: 1px solid var(--line);
    background: transparent;
    color: var(--ink);
    font-size: 13.5px;
}

.secondary-button:hover {
    border-color: var(--ink);
    background: var(--hover);
}

.small-button {
    min-height: 34px;
    padding: 0 14px;
    background: var(--ink);
    color: var(--bg);
    font-size: 12.5px;
}

.small-button:hover {
    background: var(--ink-hover);
}

.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--surface-soft);
    color: var(--ink);
    font-size: 14px;
    font-weight: 600;
    overflow: hidden;
    letter-spacing: -0.02em;
}

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

.avatar-xs {
    width: 28px;
    height: 28px;
    border-radius: 9px;
    font-size: 11px;
}

.avatar-sm {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    font-size: 12px;
}

.avatar-md {
    width: 40px;
    height: 40px;
}

.avatar-lg {
    width: 72px;
    height: 72px;
    border-radius: 16px;
    font-size: 22px;
}

.avatar-xl {
    width: 88px;
    height: 88px;
    border-radius: 18px;
    font-size: 28px;
}

.avatar.assistant-avatar .icon {
    width: 55%;
    height: 55%;
    font-size: 1em;
}

.app {
    position: fixed;
    top: var(--app-top, 0px);
    left: 0;
    right: 0;
    display: grid;
    grid-template-columns: 68px 260px minmax(0, 1fr);
    height: 100dvh;
    height: var(--app-height, 100dvh);
    min-height: 0;
    overflow: hidden;
    background: var(--bg);
}

.desktop-rail {
    width: 68px;
    height: 100dvh;
    border-right: 1px solid var(--line);
    background: var(--bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 18px 0 16px;
    gap: 22px;
    z-index: 22;
}

.rail-avatar-button {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 12px;
    overflow: hidden;
    border: 0;
    background: transparent;
}

.rail-avatar {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    font-size: 15px;
}

.rail-avatar:hover {
    border-color: var(--line-strong);
}

.rail-nav,
.rail-bottom {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.rail-bottom {
    margin-top: auto;
}

.rail-button {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    transition: background-color 160ms ease, color 160ms ease;
}

.rail-button:hover {
    background: var(--hover);
    color: var(--ink);
}

.rail-button.is-active {
    background: var(--active);
    color: var(--ink);
}

.rail-button .icon {
    --icon-size: 22px;
    
}

.rail-device {
    position: relative;
}

.rail-device-dot {
    position: absolute;
    right: 9px;
    bottom: 9px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    border: 1px solid var(--bg);
    background: var(--line-strong);
}

.rail-device.is-online .rail-device-dot {
    background: var(--ink);
}

.rail-menu {
    position: fixed;
    left: 78px;
    bottom: 16px;
    z-index: 70;
    width: 168px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: 0 4px 24px var(--shadow-color);
}

.rail-menu[hidden] {
    display: none;
}

.rail-menu-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 8px;
    color: var(--ink);
    font-size: 13.5px;
    text-align: left;
}

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

.rail-menu-item .icon {
    --icon-size: 18px;
    
    color: var(--muted);
}

.rail-device-menu {
    bottom: 70px;
    width: 212px;
    padding: 12px;
}

.rail-device-head {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 11.5px;
    letter-spacing: 0.06em;
    color: var(--muted);
}

.rail-device-head .icon {
    --icon-size: 15px;
    
}

.rail-device-state {
    display: block;
    margin-top: 9px;
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
}

.rail-device-state.is-offline {
    color: var(--muted);
}

.rail-device-note {
    margin: 5px 0 0;
    font-size: 11.5px;
    line-height: 1.55;
    color: var(--muted);
}

.rail-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 5px;
    border: 1px solid var(--bg);
    background: var(--ink);
    color: var(--bg);
    font-size: 9.5px;
    font-weight: 600;
    line-height: 15px;
    text-align: center;
}

.sidebar-tabs,
.sidebar-bottom {
    display: none !important;
}

.sidebar {
    width: 260px;
    height: 100dvh;
    height: var(--app-height, 100dvh);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--line);
    background: var(--bg);
    min-width: 0;
    z-index: 20;
}

.sidebar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 26px 16px 20px 24px;
    gap: 12px;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 1px;
}

.sidebar-search {
    margin: 0 20px 20px 24px;
    height: 40px;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    transition: border-color 160ms ease;
}

.sidebar-search:focus-within {
    border-color: var(--ink);
}

.sidebar-search .icon {
    --icon-size: 16px;
    
    color: var(--muted);
}

.sidebar-search input {
    width: 100%;
    border: 0;
    background: transparent;
    outline: 0;
    font-size: 13px;
}

.sidebar-search input::-webkit-search-cancel-button {
    display: none;
}

.sidebar-tabs {
    display: flex;
    align-items: center;
    gap: 26px;
    padding: 0 24px;
    border-bottom: 1px solid var(--line);
}

.tab {
    position: relative;
    padding: 8px 0 12px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
    transition: color 160ms ease;
}

.tab:hover {
    color: var(--ink);
}

.tab.is-active {
    color: var(--ink);
}

.tab.is-active::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 1px;
    background: var(--ink);
}

.sidebar-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px 18px;
    min-height: 0;
}

.list-empty {
    padding: 56px 18px;
    color: var(--muted);
    font-size: 13px;
    text-align: center;
    line-height: 1.9;
}

.list-section-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 12px 8px;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.list-section-label::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line);
    opacity: 0.65;
}

.quick-action {
    grid-template-columns: 34px minmax(0, 1fr) auto;
    padding-top: 9px;
    padding-bottom: 9px;
}

.quick-action-icon {
    width: 34px;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    background: transparent;
}

.quick-action-icon .icon {
    --icon-size: 17px;
    
}

.quick-action .conversation-side {
    flex-direction: row;
    align-items: center;
    gap: 7px;
    align-self: center;
}

.quick-action .conversation-side > .icon {
    --icon-size: 16px;
    
}

.conversation-item,
.contact-item {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) auto;
    gap: 11px;
    align-items: center;
    padding: 11px 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: background-color 160ms ease;
    margin-bottom: 1px;
    width: 100%;
    text-align: left;
}

.conversation-item:hover,
.contact-item:hover {
    background: var(--hover);
}

.conversation-item.is-active,
.contact-item.is-active {
    background: var(--active);
}

.conversation-main,
.contact-main {
    min-width: 0;
}

.conversation-name,
.contact-name {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--ink);
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-preview,
.contact-meta {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.55;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

.conversation-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
    align-self: stretch;
    justify-content: center;
}

.conversation-time {
    color: var(--muted);
    font-size: 10.5px;
    line-height: 1;
    white-space: nowrap;
}

.conversation-flags {
    display: flex;
    align-items: center;
    gap: 4px;
    min-height: 16px;
}

.conversation-flags .icon {
    --icon-size: 12px;
    
    color: var(--muted);
}

.unread-badge {
    min-width: 19px;
    height: 18px;
    padding: 0 5px;
    border-radius: 6px;
    background: var(--ink);
    color: var(--bg);
    font-size: 10px;
    font-weight: 600;
    line-height: 18px;
    text-align: center;
}

.unread-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ink);
    margin-right: 3px;
}

.contact-item.is-blocked {
    opacity: 0.56;
}

.contact-action {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
}

.contact-action:hover {
    background: var(--hover);
    color: var(--ink);
}

.contact-action .icon {
    --icon-size: 16px;
    
}

.sidebar-bottom {
    border-top: 1px solid var(--line);
    padding: 13px 14px;
}

.me-card {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 7px;
    border-radius: 10px;
    text-align: left;
    transition: background-color 160ms ease;
}

.me-card:hover {
    background: var(--hover);
}

.me-card-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.45;
}

.me-card-text strong {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.me-card-text span {
    color: var(--muted);
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

.connection-state {
    margin-left: auto;
    color: var(--muted);
    font-size: 10px;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.connection-state.is-online {
    color: var(--ink);
}

.main-panel {
    min-width: 0;
    display: flex;
    overflow: hidden;
    background: var(--bg);
}

.chat-panel {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    height: 100dvh;
    height: var(--app-height, 100dvh);
}

.chat-header {
    height: 72px;
    flex: 0 0 72px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 24px;
    border-bottom: 1px solid var(--line);
    background: var(--bg);
    z-index: 5;
}

.mobile-back {
    display: none;
}

.chat-identity {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
    text-align: left;
    border-radius: 10px;
    padding: 4px 6px 4px 4px;
    margin-left: -4px;
    transition: background-color 160ms ease;
}

.chat-identity:hover {
    background: var(--hover);
}

.chat-identity-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.45;
}

.chat-identity-text strong {
    font-size: 14px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-identity-text span {
    color: var(--muted);
    font-size: 11.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 420px;
}

.chat-tools {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 2px;
}

.chat-plugin-tools {
    display: contents;
}

.typing-indicator {
    color: var(--muted);
    font-size: 11px;
    margin-right: 8px;
    white-space: nowrap;
    animation: fade-in 160ms ease;
}

.messages-wrap {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-anchor: none;
    position: relative;
    padding: 26px 0 18px;
    background-color: var(--bg);
    background-repeat: repeat;
    background-size: 160px 160px;
}

body[data-chat-bg="grain"] .messages-wrap {
    background-image: var(--pattern-grain);
}

body[data-chat-bg="rules"] .messages-wrap {
    background-image: var(--pattern-rules);
}

.messages {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0 32px 18px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.empty-state {
    min-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--muted);
    text-align: center;
    padding: 40px;
}

.empty-state p {
    margin: 0;
    font-size: 13px;
}

.empty-mark {
    color: var(--line-strong);
    font-size: 44px;
    font-weight: 600;
    letter-spacing: -0.06em;
    line-height: 1;
}

.empty-rule {
    width: 42px;
    height: 1px;
    background: var(--line);
    margin-top: 6px;
}

.date-divider {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 24px 0 16px;
    color: var(--muted);
    font-size: 10.5px;
    letter-spacing: 0.04em;
}

.date-divider::before,
.date-divider::after {
    content: "";
    height: 1px;
    flex: 1;
    background: var(--line);
    opacity: 0.55;
}

.load-more {
    align-self: center;
    color: var(--muted);
    font-size: 12px;
    padding: 8px 14px;
    margin-bottom: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    transition: color 160ms ease, border-color 160ms ease;
}

.load-more:hover {
    color: var(--ink);
    border-color: var(--ink);
}

.message-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 4px 0;
    max-width: 100%;
    animation: message-in 160ms ease both;
}

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

.message-row.own + .message-row.own,
.message-row:not(.own) + .message-row:not(.own) {
    margin-top: 1px;
}

.message-avatar {
    margin-top: 18px;
}

.message-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    max-width: 70%;
    min-width: 0;
}

.message-row.own .message-stack {
    align-items: flex-end;
}

.message-sender {
    margin: 0 0 4px 5px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.4;
}

.bubble {
    position: relative;
    padding: 9px 14px;
    border-radius: 16px;
    border: 1px solid transparent;
    background: var(--other-bubble);
    color: var(--other-ink);
    font-size: var(--chat-font-size, 15px);
    line-height: 1.65;
    word-break: break-word;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
    max-width: 100%;
}

.message-row:not(.own) .bubble {
    border-color: var(--line);
}

.message-row.own .bubble {
    background: var(--own-bubble);
    color: var(--own-ink);
    border-color: var(--own-bubble);
}

.bubble a {
    text-decoration: underline;
    text-underline-offset: 2px;
}

.bubble .mention {
    font-weight: 600;
    border-bottom: 1px solid currentColor;
}

.bubble-quote {
    display: flex;
    flex-direction: column;
    gap: 1px;
    width: 100%;
    margin: 0 0 7px;
    padding: 6px 10px;
    border: 0;
    border-left: 2px solid var(--line-strong);
    border-radius: 6px;
    background: var(--surface-soft);
    text-align: left;
    white-space: normal;
}

.bubble-quote-name {
    font-size: 11.5px;
    color: var(--muted);
}

.bubble-quote-text {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12.5px;
    color: var(--ink-soft);
}

.message-row.own .bubble-quote {
    background: var(--ink-hover);
    border-left-color: var(--line);
}

.message-row.own .bubble-quote-name {
    color: var(--line);
}

.message-row.own .bubble-quote-text {
    color: var(--own-ink);
}

.message-meta {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 4px;
    padding: 0 4px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
    opacity: 0.9;
}

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

.message-meta .read-state {
    color: var(--ink);
    opacity: 0.66;
}

.message-row.is-highlighted .bubble {
    outline: 1px solid var(--ink);
    outline-offset: 2px;
}

.message-row.system {
    justify-content: center;
    margin: 14px 0;
}

.system-note {
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.6;
    text-align: center;
    padding: 3px 12px;
    background: var(--bg);
    border-radius: 6px;
}

.bubble-image {
    padding: 0;
    overflow: hidden;
    cursor: zoom-in;
    background: var(--other-bubble);
    border: 1px solid var(--line);
}

.message-row.own .bubble-image {
    border-color: var(--own-bubble);
    background: var(--own-bubble);
}

.bubble-image img {
    display: block;
    max-width: 300px;
    max-height: 300px;
    width: auto;
    height: auto;
    object-fit: cover;
}

.bubble-file {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 210px;
    text-align: left;
}

.file-glyph {
    width: 36px;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    flex: 0 0 auto;
}

.message-row.own .file-glyph {
    border-color: var(--own-ink);
    color: var(--own-ink);
    opacity: 0.72;
}

.file-glyph .icon {
    --icon-size: 17px;
    
}

.file-copy {
    min-width: 0;
    line-height: 1.5;
}

.file-name {
    font-size: 13px;
    white-space: normal;
    word-break: break-all;
}

.file-size {
    display: block;
    color: var(--muted);
    font-size: 10.5px;
    margin-top: 2px;
}

.message-row.own .file-size {
    color: var(--own-ink);
    opacity: 0.62;
}

.bubble-voice {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 108px;
    cursor: pointer;
    user-select: none;
}

.bubble-voice .icon {
    --icon-size: 17px;
    
}

.voice-bars {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 18px;
}

.voice-bars span {
    display: block;
    width: 2px;
    border-radius: 1px;
    background: currentColor;
    opacity: 0.68;
}

.voice-bars span:nth-child(1) { height: 7px; }
.voice-bars span:nth-child(2) { height: 12px; }
.voice-bars span:nth-child(3) { height: 16px; }
.voice-bars span:nth-child(4) { height: 9px; }
.voice-bars span:nth-child(5) { height: 14px; }
.voice-bars span:nth-child(6) { height: 6px; }
.voice-bars span:nth-child(7) { height: 11px; }

.voice-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.voice-duration {
    font-size: 11px;
    opacity: 0.7;
    margin-left: auto;
    white-space: nowrap;
}

.typing-dots {
    display: inline-flex;
    gap: 3px;
    align-items: center;
    margin-left: 5px;
}

.typing-dots span {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.45;
    animation: typing 1200ms ease-in-out infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 160ms; }
.typing-dots span:nth-child(3) { animation-delay: 320ms; }

.scroll-bottom {
    position: absolute;
    right: 26px;
    bottom: 22px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    color: var(--muted);
    box-shadow: 0 4px 24px var(--shadow-color);
    transition: color 160ms ease, border-color 160ms ease, opacity 160ms ease;
}

.scroll-bottom:hover {
    color: var(--ink);
    border-color: var(--ink);
}

.scroll-bottom .icon {
    transform: rotate(180deg);
    --icon-size: 17px;
    
}

.composer {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 10px;
    align-items: flex-end;
    padding: 14px 32px 20px;
    border-top: 1px solid var(--line);
    background: var(--bg);
}

.composer-tools {
    display: flex;
    align-items: center;
    gap: 1px;
    height: 44px;
}

.composer-tools .icon-button {
    width: 32px;
    height: 32px;
}

.composer-plugin-tools {
    display: contents;
}

#composer-plugin-panels {
    display: contents;
}

.composer-panel {
    grid-column: 2 / 3;
    grid-row: 2;
    justify-self: start;
    width: min(100%, 420px);
    margin-top: 4px;
}

.composer-panel[hidden] {
    display: none;
}

.emoji-cell img {
    width: 26px;
    height: 26px;
    object-fit: contain;
}

.emoji-cell.emoji-upload {
    border: 1px dashed var(--line);
    font-size: 18px;
    color: var(--muted);
}

.composer-input {
    position: relative;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--bg);
    transition: border-color 160ms ease;
}

.composer-input:focus-within {
    border-color: var(--ink);
}

.composer-input textarea {
    display: block;
    width: 100%;
    min-height: 44px;
    max-height: 160px;
    resize: none;
    border: 0;
    outline: 0;
    background: transparent;
    padding: 11px 14px;
    font-size: 14px;
    line-height: 1.55;
}

.composer-quote {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 8px 8px 12px;
    border-bottom: 1px solid var(--line);
    border-radius: 9px 9px 0 0;
    background: var(--surface-soft);
}

.composer-quote[hidden] {
    display: none;
}

.composer-quote-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.4;
}

.composer-quote-main strong {
    font-size: 11.5px;
    font-weight: 500;
    color: var(--muted);
}

.composer-quote-main span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12.5px;
    color: var(--ink);
}

.composer-quote .icon-button {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    color: var(--muted);
}

.forward-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 46vh;
    overflow-y: auto;
    margin: 4px -6px 0;
}

.forward-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 6px;
    border-radius: 8px;
    cursor: pointer;
}

.forward-row:hover {
    background: var(--hover);
}

.forward-row input {
    width: 16px;
    height: 16px;
    accent-color: var(--ink);
}

.forward-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13.5px;
}

.forward-kind {
    flex: 0 0 auto;
    font-size: 11px;
    color: var(--muted);
}

.favorites-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 50vh;
    overflow-y: auto;
    margin: 4px -6px 0;
}

.favorite-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 8px;
    border-radius: 8px;
    text-align: left;
}

.favorite-row:hover {
    background: var(--hover);
}

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

.favorite-main strong {
    font-size: 13px;
    font-weight: 600;
}

.favorite-main span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    color: var(--muted);
}

.favorite-time {
    flex: 0 0 auto;
    font-size: 11px;
    color: var(--muted);
}

.send-button {
    height: 38px;
    min-width: 60px;
    padding: 0 18px;
    border-radius: 9px;
    background: var(--ink);
    color: var(--bg);
    font-size: 13px;
    font-weight: 500;
    align-self: end;
    transition: background-color 160ms ease, opacity 160ms ease;
}

.send-button:hover {
    background: var(--ink-hover);
}

.record-panel {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 6px 0 6px;
    border-radius: 10px;
    background: var(--bg);
    border: 1px solid var(--line);
    font-size: 12px;
}

.voice-hold {
    flex: 1;
    min-width: 0;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
    color: var(--ink);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease;
}

.voice-hold:hover {
    border-color: var(--line-strong);
}

.record-panel.is-holding .voice-hold,
.record-panel.is-recording .voice-hold {
    background: var(--ink);
    color: var(--bg);
    border-color: var(--ink);
}

.record-panel.is-cancel .voice-hold {
    border-style: dashed;
}

.record-panel.is-recording .record-label,
.record-panel.is-holding .record-label {
    color: currentColor;
}

.record-time {
    font-variant-numeric: tabular-nums;
    opacity: 0.78;
}

.record-panel .text-button {
    flex: 0 0 auto;
    margin-left: 0;
}

.composer.is-voice .send-button {
    visibility: hidden;
}

.composer.is-voice #record-voice {
    color: var(--ink);
    background: var(--hover);
}

.record-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ink);
    animation: pulse 1300ms ease-in-out infinite;
}

.record-label {
    color: var(--muted);
}

.record-panel .text-button {
    margin-left: auto;
}

.mention-menu {
    position: absolute;
    left: 0;
    bottom: calc(100% + 8px);
    width: 260px;
    max-height: 240px;
    overflow-y: auto;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    box-shadow: 0 4px 24px var(--shadow-color);
    z-index: 30;
}

.mention-option {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 8px;
    border-radius: 7px;
    text-align: left;
    font-size: 12.5px;
}

.mention-option:hover,
.mention-option.is-active {
    background: var(--hover);
}

.mention-option .avatar {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    font-size: 10px;
}

.mention-hint {
    padding: 10px;
    color: var(--muted);
    font-size: 12px;
}

.details-panel {
    display: none;
    width: 320px;
    height: 100dvh;
    height: var(--app-height, 100dvh);
    overflow-y: auto;
    border-left: 1px solid var(--line);
    background: var(--bg);
    padding: 28px 24px 40px;
}

.app.has-details .details-panel {
    display: block;
}

.details-close {
    position: absolute;
    top: 0;
    right: 0;
}

.details-head {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 9px;
    padding: 8px 0 26px;
    border-bottom: 1px solid var(--line);
}

.details-name {
    margin: 4px 0 0;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.details-username {
    color: var(--muted);
    font-size: 12px;
}

.details-signature {
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.7;
    max-width: 240px;
}

.details-section {
    padding: 22px 0;
    border-bottom: 1px solid var(--line);
}

.details-section:last-child {
    border-bottom: 0;
}

.details-section-title {
    margin: 0 0 12px;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.details-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    font-size: 13px;
}

.details-row .muted {
    font-size: 11.5px;
}

.details-action-list {
    display: flex;
    flex-direction: column;
    margin: 10px -8px 0;
}

.details-action-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 13px 10px;
    border-bottom: 1px solid var(--line);
    color: var(--ink);
    font-size: 13px;
    text-align: left;
    transition: background-color 160ms ease;
}

.details-action-row:hover {
    background: var(--hover);
}

.details-action-row .icon {
    flex: 0 0 auto;
    --icon-size: 18px;
    
    color: var(--muted);
}

.details-action-row span {
    flex: 1;
    min-width: 0;
}

.details-action-row .details-action-chevron {
    margin-left: auto;
    width: 16px;
    height: 16px;
}

.details-input {
    width: 100%;
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: transparent;
    padding: 7px 10px;
    font-size: 13px;
    outline: 0;
}

.details-input:focus {
    border-color: var(--ink);
}

.details-textarea {
    min-height: 90px;
    resize: vertical;
    line-height: 1.6;
}

.details-inline-form {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.details-inline-form .details-input {
    flex: 1;
}

.member-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.member-row {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 4px;
    border-radius: 8px;
}

.member-row:hover {
    background: var(--hover);
}

.member-row .avatar {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    font-size: 11px;
}

.member-name {
    min-width: 0;
    flex: 1;
    font-size: 12.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.member-name small {
    display: block;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 400;
}

.role-badge {
    color: var(--muted);
    font-size: 9.5px;
    letter-spacing: 0.06em;
    border: 1px solid var(--line);
    border-radius: 5px;
    padding: 1px 5px;
    white-space: nowrap;
}

.announcement-box {
    font-size: 12.5px;
    line-height: 1.8;
    color: var(--ink-soft);
    background: var(--surface-soft);
    border-radius: 8px;
    padding: 12px 14px;
    white-space: pre-wrap;
}

.overlay-root:empty {
    display: none;
}

.mobile-page {
    position: fixed;
    top: var(--app-top, 0px);
    left: 0;
    right: 0;
    height: var(--app-height, 100dvh);
    z-index: 95;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    animation: fade-in 160ms ease;
}

.mobile-page-head {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 6px;
    height: calc(52px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 12px 0 4px;
    border-bottom: 1px solid var(--line);
    background: var(--bg);
}

.mobile-page-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.mobile-page-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 16px 16px 22px;
}

.mobile-page-foot {
    flex: 0 0 auto;
    display: flex;
    gap: 10px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: var(--bg);
}

.mobile-page-foot .primary-button,
.mobile-page-foot .secondary-button {
    flex: 1;
    min-height: 42px;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--overlay);
    animation: fade-in 160ms ease;
}

.modal {
    width: min(560px, 100%);
    max-height: min(86dvh, 860px);
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 4px 24px var(--shadow-strong);
    overflow: hidden;
    animation: modal-in 180ms ease;
}

.modal-wide {
    width: min(700px, 100%);
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 22px;
    border-bottom: 1px solid var(--line);
}

.modal-title {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.modal-body {
    padding: 22px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 15px 22px;
    border-top: 1px solid var(--line);
}

.modal-subtitle {
    margin: -8px 0 0;
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.7;
}

.form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-width: 0;
}

.field label {
    color: var(--muted);
    font-size: 11px;
    letter-spacing: 0.05em;
}

.label-note {
    color: var(--muted);
    opacity: 0.66;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: transparent;
    padding: 0 13px;
    font-size: 13.5px;
    outline: 0;
    transition: border-color 160ms ease;
}

.field textarea {
    padding: 10px 13px;
    min-height: 96px;
    resize: vertical;
    line-height: 1.65;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    border-color: var(--ink);
}

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.code-row {
    display: flex;
    align-items: stretch;
    gap: 8px;
}

.code-row input {
    flex: 1;
    min-width: 0;
}

.code-row .secondary-button {
    min-height: 44px;
    white-space: nowrap;
}

.field-hint {
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.6;
    min-height: 18px;
}

.field-hint.is-error {
    color: var(--ink);
}

.field-hint.is-success {
    color: var(--muted);
}

.verify-phone-value {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 0 13px;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--ink);
    font-size: 15px;
    letter-spacing: 0.04em;
    background: var(--surface-soft);
}

.verify-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 22px;
    font-size: 12px;
}

.phone-input-group {
    display: flex;
    align-items: center;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: transparent;
    transition: border-color 160ms ease;
}

.phone-input-group:focus-within {
    border-color: var(--ink);
}

.phone-prefix,
.verify-phone-prefix {
    color: var(--muted);
    font-size: 13.5px;
    letter-spacing: 0.03em;
}

.phone-prefix {
    padding: 0 10px 0 13px;
    border-right: 1px solid var(--line);
    margin-right: 2px;
    line-height: 22px;
}

.phone-input-group input {
    flex: 1;
    min-width: 0;
    min-height: 42px;
    border: 0;
    border-radius: 0;
    background: transparent;
    padding: 0 13px 0 10px;
    outline: 0;
}

.phone-input-group input:focus {
    border: 0;
}

.verify-phone-prefix {
    margin-right: 7px;
}

.field-error {
    color: var(--ink);
    font-size: 11.5px;
    border-left: 2px solid var(--ink);
    padding-left: 7px;
    line-height: 1.5;
}

.password-meter {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.password-meter-bars {
    display: flex;
    gap: 4px;
}

.password-meter-bars span {
    flex: 1;
    height: 4px;
    border-radius: 2px;
    background: var(--line);
}

.password-meter-bars span.is-filled {
    background: var(--ink);
}

.password-meter.is-weak .password-meter-bars span.is-filled {
    background: var(--strength-weak);
}

.password-meter.is-medium .password-meter-bars span.is-filled {
    background: var(--strength-medium);
}

.password-meter.is-strong .password-meter-bars span.is-filled {
    background: var(--strength-strong);
}

.password-meter-text {
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.6;
}

.password-meter.is-weak .password-meter-text {
    color: var(--strength-weak);
}

.password-meter.is-medium .password-meter-text {
    color: var(--strength-medium);
}

.password-meter.is-strong .password-meter-text {
    color: var(--strength-strong);
}

.check-row {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 12.5px;
    cursor: pointer;
}

.check-row input {
    accent-color: var(--ink);
}

.switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    font-size: 13px;
}

.switch {
    position: relative;
    width: 38px;
    height: 22px;
    border: 1px solid var(--line-strong);
    border-radius: 11px;
    background: transparent;
    transition: background-color 160ms ease, border-color 160ms ease;
}

.switch::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--muted);
    transition: transform 160ms ease, background-color 160ms ease;
}

.switch.is-on {
    border-color: var(--ink);
    background: var(--ink);
}

.switch.is-on::after {
    transform: translateX(16px);
    background: var(--bg);
}

.theme-list {
    display: flex;
    flex-direction: column;
    margin: 0 -10px;
}

.theme-row,
.settings-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 13px 10px;
    border-bottom: 1px solid var(--line);
    color: var(--ink);
    font-size: 13px;
    text-align: left;
    transition: background-color 160ms ease;
}

.theme-row:hover,
.settings-row:hover {
    background: var(--hover);
}

.settings-row > .icon {
    flex: 0 0 auto;
    --icon-size: 18px;
    
    color: var(--muted);
}

.settings-row > .icon:last-child {
    width: 16px;
    height: 16px;
}

.settings-row-label {
    flex: 1;
    min-width: 0;
}

.settings-row-check {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    color: var(--ink);
    visibility: hidden;
}

.settings-row.is-active .settings-row-check {
    visibility: visible;
}

.settings-row-meta {
    flex: 0 0 auto;
    max-width: 46%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--muted);
    font-size: 11.5px;
}

.settings-group {
    display: flex;
    flex-direction: column;
}

.settings-back-row .settings-row-label {
    color: var(--muted);
}

.settings-group .settings-block {
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}

.settings-group .settings-block:last-child {
    border-bottom: 0;
}

.login-history-list {
    display: flex;
    flex-direction: column;
}

.login-history-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.login-history-item:last-child {
    border-bottom: 0;
}

.login-history-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.login-history-method {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ink);
}

.login-history-time {
    font-size: 11.5px;
    color: var(--muted);
}

.login-history-meta {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.login-history-line {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12.5px;
    color: var(--ink-soft);
    word-break: break-all;
}

.login-history-line .icon {
    flex: 0 0 auto;
    --icon-size: 15px;
    
    color: var(--muted);
}

.theme-dot {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1px solid var(--line-strong);
    background: var(--bg);
}

.theme-dot-dark {
    background: var(--ink);
    border-color: var(--ink);
}

.theme-dot-paper {
    background: var(--bg-deep);
}

.theme-row-label {
    flex: 1;
    min-width: 0;
}

.theme-row-check {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    color: var(--ink);
    visibility: hidden;
}

.theme-row.is-active .theme-row-check {
    visibility: visible;
}

.range-row {
    display: flex;
    align-items: center;
    gap: 14px;
}

.range-row input[type="range"] {
    flex: 1;
    accent-color: var(--ink);
}

.range-value {
    width: 34px;
    color: var(--muted);
    font-size: 12px;
    text-align: right;
}

.settings-name {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}

.settings-block {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.settings-label {
    color: var(--muted);
    font-size: 10.5px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.profile-edit-row {
    display: flex;
    align-items: center;
    gap: 16px;
}

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

.qr-frame {
    width: 220px;
    max-width: 100%;
    aspect-ratio: 1;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
}

.qr-frame img,
.qr-frame svg {
    width: 100%;
    height: 100%;
    display: block;
}

.qr-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;
}

.qr-block p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.7;
}

.search-result {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 2px;
    border-bottom: 1px solid var(--line);
}

.search-result:last-child {
    border-bottom: 0;
}

.search-result-main {
    flex: 1;
    min-width: 0;
}

.search-result-main strong {
    display: block;
    font-size: 13px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-result-main span {
    display: block;
    color: var(--muted);
    font-size: 11.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-highlight {
    border-bottom: 1px solid currentColor;
}

.people-row {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}

.people-row:last-child {
    border-bottom: 0;
}

.people-main {
    flex: 1;
    min-width: 0;
}

.people-main strong {
    display: block;
    font-size: 13px;
    font-weight: 600;
}

.people-main span {
    display: block;
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.6;
}

.people-main .relationship {
    color: var(--muted);
    font-size: 10.5px;
    letter-spacing: 0.03em;
}

.empty-note {
    padding: 22px 4px;
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.8;
    text-align: center;
}

.invite-list {
    max-height: 260px;
    overflow-y: auto;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.invite-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 2px;
    border-bottom: 1px solid var(--line);
    cursor: pointer;
    font-size: 13px;
}

.invite-row:last-child {
    border-bottom: 0;
}

.invite-row .avatar {
    width: 30px;
    height: 30px;
    flex: none;
    border-radius: 9px;
    font-size: 11px;
}

.field .invite-row {
    color: var(--ink);
    font-size: 13px;
    letter-spacing: 0;
}

.invite-row span {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.invite-row input[type="checkbox"] {
    appearance: none;
    position: relative;
    flex: none;
    width: 18px;
    height: 18px;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 1px solid var(--line-strong);
    border-radius: 5px;
    background: transparent;
    accent-color: var(--ink);
    cursor: pointer;
    transition: background 140ms ease, border-color 140ms ease;
}

.invite-row input[type="checkbox"]:checked {
    border-color: var(--ink);
    background: var(--ink);
}

.invite-row input[type="checkbox"]:checked::after {
    content: "";
    position: absolute;
    left: 5px;
    top: 2px;
    width: 5px;
    height: 9px;
    border: solid var(--bg);
    border-width: 0 1.5px 1.5px 0;
    transform: rotate(45deg);
}

.invite-row input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 2px;
}

.tabs-inline {
    display: flex;
    gap: 20px;
    border-bottom: 1px solid var(--line);
}

.tabs-inline button {
    position: relative;
    color: var(--muted);
    font-size: 12.5px;
    padding: 6px 0 10px;
}

.tabs-inline button.is-active {
    color: var(--ink);
}

.tabs-inline button.is-active::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 1px;
    background: var(--ink);
}

.file-drop {
    border: 1px dashed var(--line-strong);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    color: var(--muted);
    font-size: 12.5px;
}

.context-menu {
    position: fixed;
    z-index: 80;
    min-width: 168px;
    padding: 6px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 4px 24px var(--shadow-strong);
    animation: fade-in 120ms ease;
}

.context-menu button {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 8px;
    padding: 8px 9px;
    border-radius: 7px;
    color: var(--ink);
    font-size: 12.5px;
    text-align: left;
}

.context-menu button:hover {
    background: var(--hover);
}

.context-menu .icon {
    --icon-size: 15px;
    
    color: var(--muted);
}

.toast-root {
    position: fixed;
    left: 50%;
    bottom: 26px;
    transform: translateX(-50%);
    z-index: 90;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}

.toast {
    max-width: min(420px, calc(100vw - 32px));
    padding: 10px 15px;
    border-radius: 9px;
    background: var(--ink);
    color: var(--bg);
    font-size: 12.5px;
    line-height: 1.6;
    box-shadow: 0 4px 24px var(--shadow-strong);
    animation: toast-in 180ms ease;
    pointer-events: auto;
}

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: var(--overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    animation: fade-in 160ms ease;
}

.bubble-video {
    padding: 0;
    overflow: hidden;
    cursor: pointer;
    background: #111;
    border: 1px solid var(--line);
    position: relative;
}

.message-row.own .bubble-video {
    border-color: var(--own-bubble);
}

.bubble-video video {
    display: block;
    max-width: 300px;
    max-height: 300px;
    width: auto;
    height: auto;
}

.video-play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.18);
    color: #fff;
    pointer-events: none;
}

.video-play-overlay .icon {
    --icon-size: 36px;
    
    filter: drop-shadow(0 1px 4px rgba(0,0,0,0.5));
}

.bubble-sticker {
    padding: 0;
    overflow: hidden;
    cursor: zoom-in;
    background: var(--other-bubble);
    border: 1px solid var(--line);
}

.message-row.own .bubble-sticker {
    border-color: var(--own-bubble);
    background: var(--own-bubble);
}

.bubble-sticker img {
    display: block;
    max-width: 200px;
    max-height: 200px;
    width: auto;
    height: auto;
}

.drop-overlay {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--overlay);
    color: var(--ink);
    pointer-events: none;
}

.drop-overlay-icon {
    width: 48px;
    height: 48px;
    opacity: 0.7;
}

.drop-overlay-text {
    font-size: 13px;
    font-weight: 500;
}

.lightbox video {
    max-width: min(1100px, 92vw);
    max-height: 88dvh;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: #000;
}

.emoji-panel {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 2px;
    padding: 8px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-top: 4px;
}

.emoji-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    font-size: 20px;
    border: 0;
    border-radius: 6px;
    cursor: pointer;
    background: transparent;
    transition: background 120ms;
}

.emoji-cell:hover {
    background: var(--hover);
}

.mention-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    color: #fff;
    background: #E53935;
    border-radius: 8px;
    padding: 1px 5px;
    margin-left: 4px;
    vertical-align: middle;
}

.lightbox-close {
    position: absolute;
    top: 22px;
    right: 24px;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-body {
    min-height: 100dvh;
    background: var(--bg);
    overflow-y: auto;
}

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

.auth-aside {
    border-right: 1px solid var(--line);
    padding: 48px 4.5vw 40px;
    display: flex;
    flex-direction: column;
    background-color: var(--bg);
    background-image: var(--pattern-rules);
    background-size: 160px 160px;
    overflow: hidden;
}

.auth-statement {
    margin: auto 0;
    padding: 40px 0;
    max-width: 620px;
}

.auth-statement h1 {
    margin: 16px 0 20px;
    font-size: clamp(42px, 5.6vw, 76px);
    font-weight: 600;
    letter-spacing: -0.065em;
    line-height: 1.02;
}

.auth-lede {
    margin: 0;
    max-width: 460px;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.9;
}

.auth-foot {
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--muted);
    font-size: 9.5px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.auth-rule {
    height: 1px;
    flex: 1;
    background: var(--line);
}

.auth-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 42px;
    background: var(--bg);
}

.auth-form-wrap {
    width: min(390px, 100%);
}

.auth-title {
    margin: 12px 0 4px;
    font-size: 29px;
    font-weight: 600;
    letter-spacing: -0.04em;
    line-height: 1.2;
}

.auth-subtitle {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.auth-form-wrap .form {
    margin-top: 30px;
}

.auth-form-wrap .primary-button {
    width: 100%;
    margin-top: 4px;
}

.auth-switch {
    margin: 22px 0 0;
    color: var(--muted);
    font-size: 12.5px;
}

.auth-tabs {
    display: flex;
    gap: 24px;
    margin: 0 0 20px;
    border-bottom: 1px solid var(--line);
}

.auth-tabs-sub {
    gap: 20px;
    margin: 0 0 18px;
}

.auth-tabs-sub .auth-tab {
    font-size: 12px;
    padding-bottom: 8px;
}

.auth-tab {
    position: relative;
    padding: 0 0 10px;
    border: 0;
    background: none;
    color: var(--muted);
    font-size: 13px;
    cursor: pointer;
    transition: color 160ms ease;
}

.auth-tab::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 1px;
    background: transparent;
}

.auth-tab:hover,
.auth-tab.is-active {
    color: var(--ink);
}

.auth-tab.is-active::after {
    background: var(--ink);
}

.auth-switch a {
    color: var(--ink);
    border-bottom: 1px solid var(--line-strong);
    padding-bottom: 1px;
    transition: border-color 160ms ease;
}

.auth-switch a:hover {
    border-color: var(--ink);
}

.scan-body {
    min-height: 100dvh;
    background: var(--bg);
}

.scan-top {
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 0 4vw;
    border-bottom: 1px solid var(--line);
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--muted);
    font-size: 12px;
    transition: color 160ms ease;
}

.back-link:hover {
    color: var(--ink);
}

.back-link .icon {
    --icon-size: 16px;
    
}

.scan-status {
    color: var(--muted);
    font-size: 11px;
    letter-spacing: 0.03em;
    min-width: 110px;
    text-align: right;
}

.scan-shell {
    max-width: 1240px;
    margin: 0 auto;
    padding: 44px 4vw 60px;
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
    gap: 44px;
    align-items: start;
}

.scan-stage {
    min-width: 0;
}

.scan-viewport {
    position: relative;
    width: 100%;
    max-width: 620px;
    aspect-ratio: 1 / 1;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--bg-deep);
    overflow: hidden;
}

.scan-viewport video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.scan-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 32px;
    background-color: var(--bg-deep);
    background-image: var(--pattern-rules);
    background-size: 160px 160px;
}

.scan-placeholder h1 {
    margin: 12px 0 8px;
    font-size: clamp(26px, 3vw, 38px);
    font-weight: 600;
    letter-spacing: -0.05em;
    line-height: 1.25;
}

.scan-placeholder p:last-child {
    margin: 0;
    color: var(--muted);
    font-size: 12.5px;
}

.scan-frame {
    position: absolute;
    inset: 11%;
    pointer-events: none;
}

.scan-viewport-modal {
    max-width: 520px;
    margin: 0 auto;
}

.scan-frame span {
    position: absolute;
    width: 34px;
    height: 34px;
    border-color: var(--ink);
    border-style: solid;
    opacity: 0.8;
}

.scan-frame span:nth-child(1) {
    top: 0;
    left: 0;
    border-width: 1px 0 0 1px;
}

.scan-frame span:nth-child(2) {
    top: 0;
    right: 0;
    border-width: 1px 1px 0 0;
}

.scan-frame span:nth-child(3) {
    bottom: 0;
    left: 0;
    border-width: 0 0 1px 1px;
}

.scan-frame span:nth-child(4) {
    bottom: 0;
    right: 0;
    border-width: 0 1px 1px 0;
}

.scan-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin-top: 16px;
}

.scan-note {
    margin: 14px 0 0;
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.7;
}

.scan-result {
    border-left: 1px solid var(--line);
    padding-left: 44px;
    min-height: 420px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.scan-result h2 {
    margin: 4px 0 0;
    font-size: 24px;
    font-weight: 600;
    letter-spacing: -0.04em;
    line-height: 1.25;
}

.scan-result p {
    margin: 0;
}

.scan-person {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 4px 0 8px;
}

.scan-person h2 {
    margin: 0;
    font-size: 22px;
}

.scan-person .muted {
    font-size: 12px;
}

.scan-link {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    font-size: 12.5px;
    word-break: break-all;
    line-height: 1.7;
    color: var(--muted);
}

.scan-result .primary-button,
.scan-result .secondary-button {
    width: 100%;
}

.error-page {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    padding: 32px;
    text-align: center;
    background-color: var(--bg);
    background-image: var(--pattern-rules);
    background-size: 160px 160px;
}

.error-code {
    margin: 0;
    color: var(--line-strong);
    font-size: clamp(72px, 12vw, 140px);
    font-weight: 600;
    letter-spacing: -0.08em;
    line-height: 1;
}

.error-page h1 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.error-page p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modal-in {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes message-in {
    from { opacity: 0; transform: translateY(3px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes typing {
    0%, 100% { opacity: 0.22; transform: translateY(0); }
    50% { opacity: 0.72; transform: translateY(-2px); }
}

@keyframes pulse {
    0%, 100% { opacity: 0.35; }
    50% { opacity: 1; }
}




.mobile-tabbar {
    display: none;
}

.mobile-tab {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 52px;
    color: var(--muted);
    font-size: 10.5px;
    letter-spacing: 0.02em;
    transition: color 160ms ease;
}

.mobile-tab .icon {
    --icon-size: 21px;
    
}

.mobile-tab.is-active {
    color: var(--ink);
}

.mobile-tab.is-active::before {
    content: "";
    position: absolute;
    top: 0;
    width: 18px;
    height: 1px;
    background: var(--ink);
}

.mobile-me-page {
    padding: 18px 8px 34px;
}

.mobile-me-head {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 10px 12px 26px;
    border-bottom: 1px solid var(--line);
    text-align: center;
}

.mobile-me-name {
    margin: 6px 0 0;
    font-size: 19px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.mobile-me-username {
    color: var(--muted);
    font-size: 12px;
}

.mobile-me-signature {
    margin: 2px 0 0;
    max-width: 260px;
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.7;
}

.mobile-me-list {
    margin-top: 10px;
}

.mobile-me-row {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 12px;
    padding: 15px 10px;
    border-bottom: 1px solid var(--line);
    color: var(--ink);
    font-size: 13px;
    text-align: left;
    transition: background-color 160ms ease;
}

.mobile-me-row:hover {
    background: var(--hover);
}

.mobile-me-row .icon {
    --icon-size: 18px;
    
    color: var(--muted);
}

.mobile-me-row .mobile-me-meta {
    margin-left: auto;
    color: var(--muted);
    font-size: 11.5px;
    white-space: nowrap;
}

.mobile-me-row .mobile-me-chevron {
    margin-left: auto;
    width: 16px;
    height: 16px;
}

.mobile-me-row.is-danger {
    color: var(--ink);
}



.app.rail-page {
    grid-template-columns: 68px minmax(0, 1fr);
}

.app.rail-page .sidebar {
    display: none;
}

.app.rail-page .chat-panel,
.app.rail-page .details-panel {
    display: none !important;
}

.desktop-page {
    display: none;
    flex: 1;
    min-width: 0;
    height: 100dvh;
    height: var(--app-height, 100dvh);
    overflow-y: auto;
    background: var(--bg);
}

.app.rail-page .desktop-page {
    display: block;
}

.desktop-page-inner {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    padding: 48px 56px 64px;
}

.desktop-page-head {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-bottom: 26px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 30px;
}

.desktop-page-head h1 {
    margin: 0;
    font-size: 40px;
    font-weight: 600;
    letter-spacing: -0.055em;
    line-height: 1.08;
}

.desktop-page-head p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.8;
    max-width: 520px;
}

.desktop-page-search {
    margin-top: 14px;
    width: min(360px, 100%);
    height: 40px;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    transition: border-color 160ms ease;
}

.desktop-page-search:focus-within {
    border-color: var(--ink);
}

.desktop-page-search .icon {
    --icon-size: 16px;
    
    color: var(--muted);
}

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

.desktop-quick-grid {
    display: flex;
    flex-direction: column;
    margin-bottom: 30px;
    border-top: 1px solid var(--line);
}

.desktop-quick-card {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px 6px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    transition: background-color 160ms ease;
}

.desktop-quick-card:hover {
    background: var(--hover);
}

.desktop-quick-icon {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
}

.desktop-quick-icon .icon {
    --icon-size: 18px;
    
}

.desktop-quick-copy {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.desktop-quick-copy strong {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ink);
}

.desktop-quick-copy span {
    color: var(--muted);
    font-size: 11.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.desktop-quick-card > .icon {
    --icon-size: 16px;
    
    color: var(--muted);
    flex: 0 0 auto;
}

.desktop-contact-group {
    margin-top: 26px;
}

.desktop-group-letter {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.desktop-group-letter::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line);
}

.desktop-friend-grid {
    display: flex;
    flex-direction: column;
}

.desktop-friend-card {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 12px;
    padding: 11px 6px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    transition: background-color 160ms ease;
}

.desktop-friend-card:hover {
    background: var(--hover);
}

.desktop-friend-card .avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    font-size: 12px;
}

.desktop-friend-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.desktop-friend-main strong {
    font-size: 13px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.desktop-friend-main span {
    color: var(--muted);
    font-size: 11.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.desktop-friend-card > .icon {
    --icon-size: 15px;
    
    color: var(--muted);
    flex: 0 0 auto;
}

.desktop-page-empty {
    padding: 54px 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.8;
    text-align: center;
    border-top: 1px solid var(--line);
}

.desktop-settings-grid {
    display: flex;
    flex-direction: column;
}

@media (max-width: 1120px) {
    .desktop-page-inner {
        padding: 36px 32px 48px;
    }
}

@media (max-width: 1120px) {
    .details-panel {
        width: 300px;
        padding-left: 20px;
        padding-right: 20px;
    }

    .auth-shell {
        grid-template-columns: minmax(0, 1fr) minmax(390px, 0.85fr);
    }
}

@media (max-width: 900px) {
    .app,
    .app.has-details,
    .sidebar {
        grid-template-columns: minmax(0, 1fr);
        width: 100%;
        height: 100dvh;
        height: var(--app-height, 100dvh);
    }

    .desktop-rail {
        display: none;
    }

    .app.rail-page {
        grid-template-columns: minmax(0, 1fr);
    }

    .app.rail-page .sidebar {
        display: flex;
    }

    .desktop-page {
        display: none !important;
    }

    .top-actions {
        display: none;
    }

    .sidebar-top {
        padding-top: calc(26px + env(safe-area-inset-top));
    }

    .mobile-tabbar {
        position: fixed;
        left: 0;
        right: 0;
        top: calc(var(--app-top, 0px) + var(--app-height, 100dvh));
        transform: translateY(-100%);
        z-index: 45;
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        padding-bottom: env(safe-area-inset-bottom);
        border-top: 1px solid var(--line);
        background: var(--bg);
    }

    .app.chat-open + .mobile-tabbar {
        display: none;
    }

    .app.has-details + .mobile-tabbar {
        display: none;
    }

    .sidebar-tabs,
    .sidebar-bottom {
        display: none;
    }

    .sidebar-list {
        padding-bottom: 82px;
    }

    .sidebar.is-me .sidebar-search {
        display: none;
    }

    .main-panel {
        width: 100%;
        min-width: 0;
    }

    .app:not(.chat-open) .main-panel {
        display: none;
    }

    .app.chat-open .main-panel {
        display: flex;
    }

    .app.chat-open .sidebar {
        display: none;
    }

    .chat-panel {
        display: none;
        width: 100%;
    }

    .app.chat-open .chat-panel {
        display: flex;
    }

    .mobile-back {
        display: inline-flex;
    }

    .chat-header {
        height: calc(72px + env(safe-area-inset-top));
        flex: 0 0 calc(72px + env(safe-area-inset-top));
        padding: env(safe-area-inset-top) 12px 0;
        gap: 6px;
    }

    .chat-identity-text span {
        max-width: 180px;
    }

    .messages {
        padding: 0 16px;
    }

    .messages-wrap {
        padding-top: 18px;
    }

    .message-stack {
        max-width: 78%;
    }

    .message-row:not(.own) .message-stack {
        margin-left: 0;
    }

    .composer {
        grid-template-columns: auto minmax(0, 1fr) auto;
        padding: 10px 12px calc(14px + env(safe-area-inset-bottom));
        gap: 6px;
    }

    .composer-tools .icon-button {
        width: 28px;
        height: 28px;
    }

    .composer-tools .icon {
        --icon-size: 17px;
        
    }

    .composer-panel {
        grid-column: 1 / -1;
        justify-self: stretch;
        width: 100%;
    }

    .send-button {
        height: 44px;
        min-width: 0;
        padding: 0 16px;
        border-radius: 10px;
        font-size: 13.5px;
    }

    .details-panel {
        position: fixed;
        top: var(--app-top, 0px);
        left: 0;
        right: 0;
        bottom: auto;
        height: var(--app-height, 100dvh);
        z-index: 60;
        width: 100%;
        padding: calc(env(safe-area-inset-top) + 18px) 20px calc(env(safe-area-inset-bottom) + 32px);
        box-shadow: none;
        border-left: 0;
        display: none;
    }

    .rail-menu {
        display: none;
    }

    .app.has-details .details-panel {
        display: block;
    }

    .auth-shell {
        grid-template-columns: 1fr;
    }

    .auth-aside {
        display: none;
    }

    .auth-form-wrap .eyebrow,
    .auth-subtitle {
        display: none;
    }

    .auth-panel {
        padding-top: calc(48px + env(safe-area-inset-top));
    }

    .scan-shell {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .scan-result {
        border-left: 0;
        border-top: 1px solid var(--line);
        padding: 28px 0 0;
        min-height: 0;
    }
}

@media (max-width: 560px) {
    .field-row {
        grid-template-columns: 1fr;
    }

    .modal-backdrop {
        padding: 12px;
    }

    .modal {
        max-height: 92dvh;
    }

    .auth-aside {
        min-height: 240px;
    }

    .auth-statement h1 {
        font-size: 38px;
    }

    .auth-statement {
        padding-bottom: 6px;
    }

    .scan-top {
        padding: 0 18px;
    }

    .scan-status {
        display: none;
    }

    .scan-shell {
        padding: 26px 18px 44px;
    }

    .scan-actions .primary-button,
    .scan-actions .secondary-button {
        flex: 1;
    }
}

.captcha-overlay {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--overlay);
    touch-action: none;
    animation: fade-in 160ms ease;
}

.captcha-dialog {
    width: min(340px, 100%);
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 4px 24px var(--shadow-strong);
}

.captcha-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.captcha-head .eyebrow {
    margin: 0 0 5px;
}

.captcha-head h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.captcha-close {
    width: 28px;
    height: 28px;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
}

.captcha-close:hover {
    color: var(--ink);
    border-color: var(--line-strong);
}

.captcha-sub {
    margin: 8px 0 14px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.65;
}

.captcha-stage {
    position: relative;
    width: 100%;
    aspect-ratio: 280 / 150;
    overflow: hidden;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 10px;
    user-select: none;
}

.captcha-bg {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: fill;
    pointer-events: none;
}

.captcha-piece {
    position: absolute;
    left: 0;
    top: 0;
    z-index: 1;
    pointer-events: none;
    transition: transform 90ms ease-out;
}

.captcha-track {
    position: relative;
    height: 42px;
    margin-top: 14px;
    overflow: hidden;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 10px;
}

.captcha-fill {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 21px;
    background: var(--line);
}

.captcha-hint {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-left: 32px;
    color: var(--muted);
    font-size: 12px;
    pointer-events: none;
}

.captcha-handle {
    position: absolute;
    left: 0;
    top: 0;
    z-index: 2;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: -4px 0 0 -1px;
    padding: 0;
    border: 0;
    border-radius: 9px;
    background: var(--ink);
    color: var(--bg);
    cursor: grab;
    touch-action: none;
    transition: transform 90ms ease-out, background 160ms ease;
}

.captcha-dialog.is-dragging .captcha-handle,
.captcha-dialog.is-dragging .captcha-piece {
    transition: none;
}

.captcha-handle.is-dragging {
    cursor: grabbing;
}

.captcha-handle:disabled {
    opacity: 0.42;
    cursor: not-allowed;
}

.captcha-handle svg {
    width: 18px;
    height: 18px;
}

.captcha-status {
    margin: 10px 0 0;
    min-height: 18px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

.captcha-status.is-error {
    color: var(--ink);
}

.captcha-status.is-success {
    color: var(--ink);
    font-weight: 600;
}

.captcha-retry {
    margin: 2px 0 0;
    padding: 0 0 1px;
    border: 0;
    border-bottom: 1px solid var(--ink);
    background: none;
    color: var(--ink);
    font-size: 12px;
    cursor: pointer;
}

.captcha-dialog.is-passed .captcha-track {
    border-color: var(--ink);
}

.captcha-dialog.is-passed .captcha-hint {
    color: var(--ink);
}

.captcha-dialog.is-shaking {
    animation: captcha-shake 380ms ease;
}

body.captcha-open {
    overflow: hidden;
}

@keyframes captcha-shake {
    0%,
    100% {
        transform: translateX(0);
    }
    20% {
        transform: translateX(-6px);
    }
    40% {
        transform: translateX(5px);
    }
    60% {
        transform: translateX(-3px);
    }
    80% {
        transform: translateX(2px);
    }
}

@media (max-width: 380px) {
    .captcha-dialog {
        padding: 16px;
    }

    .captcha-sub {
        margin-bottom: 12px;
    }
}

.call-layer {
    position: fixed;
    inset: 0;
    z-index: 110;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--overlay);
}

.call-layer[hidden] {
    display: none;
}

.call-card {
    width: min(340px, 100%);
    padding: 28px 24px 22px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
    color: var(--ink);
    text-align: center;
}

.call-eyebrow {
    margin: 0;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 560;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.call-avatar-slot {
    display: flex;
    justify-content: center;
    margin: 22px 0 16px;
}

.call-avatar {
    width: 96px;
    height: 96px;
    font-size: 30px;
}

.call-layer[data-state="incoming"] .call-avatar,
.call-layer[data-state="outgoing"] .call-avatar {
    animation: call-pulse 2s ease-in-out infinite;
}

@keyframes call-pulse {
    0%, 100% {
        outline: 1px solid var(--line);
        outline-offset: 5px;
    }
    50% {
        outline: 1px solid var(--line-strong);
        outline-offset: 12px;
    }
}

.call-name {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.02em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.call-status {
    margin: 8px 0 0;
    min-height: 20px;
    color: var(--muted);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.call-layer[data-state="active"] .call-status {
    color: var(--ink);
    font-size: 15px;
    font-weight: 560;
    letter-spacing: 0.02em;
}

.call-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 26px;
    margin-top: 26px;
}

.call-actions:empty {
    display: none;
}

.call-action {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    padding: 0;
    border: 1px solid var(--ink);
    border-radius: 50%;
    background: var(--ink);
    color: var(--bg);
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    touch-action: manipulation;
}

.call-action:hover {
    background: var(--ink-hover);
    border-color: var(--ink-hover);
}

.call-action .icon {
    --icon-size: 22px;
    
}

.call-layer[data-state="incoming"] .call-action.is-decline {
    background: transparent;
    border-color: var(--line-strong);
    color: var(--ink);
}

.call-layer[data-state="incoming"] .call-action.is-decline:hover {
    background: var(--hover);
    border-color: var(--ink);
}

.call-action.call-mute {
    background: transparent;
    border-color: var(--line-strong);
    color: var(--ink);
}

.call-action.call-mute:hover {
    background: var(--hover);
    border-color: var(--ink);
}

.call-action.call-mute.is-muted {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--bg);
}

.call-hint {
    margin: 22px 0 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.6;
}

.call-audio {
    display: none;
}

.call-card.is-video {
    position: relative;
    width: min(92vw, 760px);
    height: min(72vh, 540px);
    padding: 0;
    overflow: hidden;
    border-color: var(--ink);
    background: var(--ink);
    color: var(--bg);
    text-align: left;
}

.call-card.is-video .call-face {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.call-card.is-video .call-eyebrow,
.call-card.is-video .call-name {
    color: var(--bg);
}

.call-layer[data-media="video"] .call-status {
    position: absolute;
    left: 20px;
    top: 18px;
    margin: 0;
    z-index: 2;
    color: var(--bg);
}

.call-layer[data-media="video"][data-state="active"] .call-status {
    color: var(--bg);
    font-size: 14px;
}

.call-video-remote {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: var(--ink);
}

.call-video-local {
    position: absolute;
    right: 14px;
    bottom: 96px;
    z-index: 3;
    width: 92px;
    height: 124px;
    object-fit: cover;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    background: var(--ink);
    transform: scaleX(-1);
}

.call-video-local.is-off {
    visibility: hidden;
}

.call-card.is-video .call-actions {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 18px;
    margin: 0;
    z-index: 4;
}

.call-card.is-video .call-action {
    border-color: var(--bg);
    background: var(--bg);
    color: var(--ink);
}

.call-card.is-video .call-action.is-decline {
    border-color: var(--bg);
    background: var(--bg);
    color: var(--ink);
}

.call-card.is-video .call-action.call-mute,
.call-card.is-video .call-action.call-camera {
    background: transparent;
    border-color: var(--line-strong);
    color: var(--bg);
}

.call-card.is-video .call-action.call-mute.is-muted,
.call-card.is-video .call-action.call-camera.is-off {
    background: var(--bg);
    border-color: var(--bg);
    color: var(--ink);
}

.call-card.is-video .call-hint {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 80px;
    z-index: 2;
    margin: 0;
    text-align: center;
    color: var(--line);
}

.call-action.call-camera {
    background: transparent;
    border-color: var(--line-strong);
    color: var(--ink);
}

.call-action.call-camera:hover {
    background: var(--hover);
    border-color: var(--ink);
}

.call-action.call-camera.is-off {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--bg);
}

@media (hover: none) {
    .message-row,
    .bubble {
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
    }
}

@media (max-width: 900px) {
    .call-layer {
        padding: 16px;
    }

    .call-card {
        width: min(320px, 100%);
        padding: 24px 20px 20px;
    }

    .call-card.is-video {
        width: 100%;
        height: min(74vh, 620px);
        padding: 0;
    }

    .call-avatar {
        width: 84px;
        height: 84px;
        font-size: 26px;
    }

    .call-video-local {
        right: 12px;
        bottom: 92px;
        width: 78px;
        height: 106px;
    }
}

/* 后台管理入口（a 标签复用条目样式） */
.mobile-me-row[href], .rail-menu-item[href] { text-decoration: none; color: inherit; }
