@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Noto+Sans+SC:wght@400;500;600;700&display=swap');

:root {
    --ink: #17243a;
    --muted: #8793a6;
    --line: #e9edf3;
    --blue: #3569e8;
    --pale: #f4f7fc
}

* {
    box-sizing: border-box
}

body {
    margin: 0;
    background: #f4f6fa;
    color: var(--ink);
    font-family: 'DM Sans', 'Noto Sans SC', sans-serif;
    font-size: 14px
}

.hidden {
    display: none !important
}

.login-screen {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: radial-gradient(circle at 18% 18%, #e4edff 0, transparent 34%), radial-gradient(circle at 85% 80%, #e8eefa 0, transparent 30%), #f7f9fc
}

.login-card {
    width: min(430px, 100%);
    background: #fff;
    border: 1px solid #edf0f5;
    border-radius: 22px;
    padding: 42px 44px;
    box-shadow: 0 24px 80px #263b6212
}

.brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 15px;
    background: linear-gradient(145deg, #4f82f5, #2857ce);
    display: grid;
    place-items: center;
    color: #fff;
    font-weight: 700;
    font-size: 24px;
    box-shadow: 0 8px 18px #3569e833
}

.eyebrow {
    font-size: 10px;
    letter-spacing: 2px;
    color: #7e91b2;
    font-weight: 700;
    margin-top: 26px
}

.login-card h1 {
    font-size: 27px;
    margin: 10px 0 7px;
    letter-spacing: -.5px
}

.muted {
    color: var(--muted);
    margin: 0 0 30px
}

.login-card label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin: 17px 0 8px
}

.login-card input {
    width: 100%;
    height: 48px;
    border: 1px solid #e4e9f1;
    border-radius: 9px;
    padding: 0 14px;
    outline: none;
    font: inherit
}

.login-card input:focus, textarea:focus {
    border-color: #8eacf5;
    box-shadow: 0 0 0 3px #3569e814
}

.primary {
    border: 0;
    background: var(--blue);
    color: #fff;
    border-radius: 9px;
    padding: 12px 19px;
    font: 600 13px inherit;
    cursor: pointer;
    box-shadow: 0 5px 12px #3569e82a
}

.primary:hover {
    background: #2859d2
}

.primary span {
    margin-left: 12px
}

.full {
    width: 100%;
    margin-top: 25px;
    height: 48px
}

.error {
    color: #d64d55;
    font-size: 12px;
    margin-top: 12px;
    min-height: 16px
}

.login-foot {
    border-top: 1px solid var(--line);
    padding-top: 20px;
    margin-top: 26px;
    text-align: center;
    color: #a1aaba;
    font-size: 11px
}

.app-shell {
    height: 100vh;
    min-height: 560px;
    display: flex;
    padding: 20px;
    gap: 16px;
    max-width: 1600px;
    margin: auto
}

.sidebar, .chat-panel {
    background: #fff;
    border: 1px solid #e9edf3;
    border-radius: 15px;
    box-shadow: 0 5px 24px #1c31500a
}

.sidebar {
    width: 290px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    padding: 20px 14px 13px
}

.side-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 0 7px 25px
}

.brand-mark.small {
    width: 37px;
    height: 37px;
    border-radius: 11px;
    font-size: 19px
}

.side-brand b {
    display: block;
    font-size: 15px
}

.side-brand small {
    display: block;
    color: #9aa5b5;
    font-size: 10px;
    margin-top: 3px
}

.online-dot {
    width: 7px;
    height: 7px;
    background: #39bd88;
    border-radius: 50%;
    margin-left: auto;
    margin-right: 5px
}

.section-caption {
    font-size: 10px;
    letter-spacing: 1.2px;
    color: #a1aaba;
    font-weight: 700;
    padding: 0 9px 12px
}

.search-wrap {
    height: 38px;
    background: #f6f8fb;
    border: 1px solid #eff2f6;
    border-radius: 8px;
    display: flex;
    align-items: center;
    padding: 0 10px;
    gap: 8px;
    color: #9aa6b8
}

.search-wrap input {
    border: 0;
    background: none;
    outline: 0;
    width: 100%;
    font: 12px inherit
}

.section-title {
    display: flex;
    justify-content: space-between;
    padding: 24px 9px 10px;
    font-size: 11px;
    font-weight: 700;
    color: #6f7d91
}

.section-title span + span {
    color: #a4afbf;
    font-weight: 500
}

.user-list {
    overflow: auto;
    flex: 1
}

.user-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 9px;
    border-radius: 9px;
    cursor: pointer;
    margin: 2px 0
}

.user-item:hover, .user-item.active {
    background: #f1f5ff
}

.avatar {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border-radius: 12px;
    background: #eaf0ff;
    color: #456ed1;
    display: grid;
    place-items: center;
    font-weight: 700
}

.user-item:nth-child(3n) .avatar {
    background: #e8f5f1;
    color: #369579
}

.user-item:nth-child(3n+2) .avatar {
    background: #f5edf9;
    color: #9868b3
}

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

.user-meta b {
    display: block;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.user-meta small {
    display: block;
    color: #a2adbc;
    font-size: 10px;
    margin-top: 5px
}

.profile {
    border-top: 1px solid var(--line);
    padding: 14px 5px 0;
    display: flex;
    align-items: center;
    gap: 9px
}

.avatar.self {
    background: #e9eef9;
    color: #536b9d
}

.profile-info {
    flex: 1
}

.profile-info b {
    font-size: 11px;
    display: block
}

.profile-info small {
    font-size: 10px;
    color: #39ae82;
    display: block;
    margin-top: 4px
}

.profile button {
    border: 0;
    background: #f5f7fa;
    color: #8a96a8;
    border-radius: 8px;
    width: 31px;
    height: 31px;
    cursor: pointer
}

.chat-panel {
    flex: 1;
    min-width: 0;
    position: relative;
    overflow: hidden
}

.empty-state {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #9aa6b7
}

.empty-icon {
    width: 65px;
    height: 65px;
    border-radius: 21px;
    background: #f0f4ff;
    color: #6e8de0;
    display: grid;
    place-items: center;
    font-size: 28px;
    margin-bottom: 17px
}

.empty-state h2 {
    font-size: 17px;
    color: #526078;
    margin: 0 0 8px
}

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

.chat-view {
    height: 100%;
    display: flex;
    flex-direction: column
}

.chat-header {
    height: 76px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    padding: 0 27px;
    gap: 12px;
    flex-shrink: 0
}

.chat-heading {
    flex: 1
}

.chat-heading b {
    font-size: 13px
}

.chat-heading small {
    display: block;
    color: #9aa6b6;
    font-size: 10px;
    margin-top: 6px
}

.chat-heading small i {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #3cbd8c;
    margin-right: 5px
}

.header-tag {
    font-size: 10px;
    color: #8d9bb0;
    background: #f7f9fc;
    padding: 7px 10px;
    border-radius: 6px
}

.messages {
    flex: 1;
    overflow: auto;
    padding: 26px clamp(18px, 5vw, 70px);
    background: linear-gradient(#fff, #fdfdfe)
}

.day-divider {
    text-align: center;
    color: #b0bac8;
    font-size: 10px;
    margin: 8px 0 24px
}

.message-row {
    display: flex;
    gap: 9px;
    margin: 16px 0;
    align-items: flex-end
}

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

.msg-avatar {
    width: 27px;
    height: 27px;
    border-radius: 9px;
    background: #edf1fa;
    color: #657da9;
    display: grid;
    place-items: center;
    font-size: 10px;
    flex-shrink: 0
}

.bubble-wrap {
    max-width: min(68%, 540px)
}

.msg-name {
    font-size: 10px;
    color: #9ba6b6;
    margin: 0 0 6px 3px
}

.bubble {
    background: #f1f4f9;
    border-radius: 4px 13px 13px 13px;
    padding: 11px 14px;
    color: #334158;
    line-height: 1.65;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-size: 13px
}

.mine .bubble {
    background: #386ce8;
    color: #fff;
    border-radius: 13px 4px 13px 13px
}

.msg-time {
    font-size: 9px;
    color: #aab4c2;
    margin: 5px 3px 0
}

.mine .msg-time {
    text-align: right
}

.bubble a {
    color: inherit
}

.bubble img {
    max-width: 260px;
    max-height: 220px;
    border-radius: 8px;
    display: block
}

.file-link {
    display: flex;
    align-items: center;
    gap: 9px;
    color: inherit;
    text-decoration: none;
    min-width: 180px
}

.file-icon {
    width: 32px;
    height: 36px;
    background: #ffffff35;
    border-radius: 6px;
    display: grid;
    place-items: center;
    font-size: 16px
}

.file-link small {
    display: block;
    opacity: .7;
    font-size: 10px;
    margin-top: 3px
}

.composer {
    border-top: 1px solid var(--line);
    padding: 15px 25px 18px;
    background: #fff
}

.compose-tools {
    display: flex;
    align-items: center;
    gap: 9px;
    color: #a0abba;
    font-size: 10px;
    margin-bottom: 8px
}

.compose-tools button {
    width: 27px;
    height: 27px;
    border: 1px solid #e8edf4;
    border-radius: 7px;
    background: #fff;
    color: #6e7d94;
    font-size: 19px;
    cursor: pointer
}

.composer textarea {
    width: 100%;
    resize: none;
    border: 1px solid #e7ebf2;
    border-radius: 9px;
    padding: 12px 14px;
    outline: 0;
    font: 13px/1.6 inherit;
    color: #344158
}

.compose-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 9px
}

.compose-bottom > span {
    font-size: 10px;
    color: #b0bac7
}

.compose-bottom .primary {
    padding: 9px 17px
}

@media (max-width: 700px) {
    .app-shell {
        padding: 0;
        gap: 0;
        height: 100dvh
    }

    .sidebar {
        width: 105px;
        border-radius: 0;
        padding: 12px 7px
    }

    .side-brand {
        padding: 4px 4px 20px;
        justify-content: center
    }

    .side-brand > div:not(.brand-mark), .online-dot, .section-caption, .search-wrap, .section-title, .user-meta, .profile-info, .profile button {
        display: none
    }

    .user-item {
        justify-content: center;
        padding: 9px 0
    }

    .profile {
        justify-content: center;
        padding-top: 12px
    }

    .chat-panel {
        border-radius: 0;
        border-left: 0
    }

    .chat-header {
        padding: 0 14px
    }

    .header-tag {
        display: none
    }

    .messages {
        padding: 18px 12px
    }

    .bubble-wrap {
        max-width: 82%
    }

    .composer {
        padding: 12px
    }

    .login-card {
        padding: 32px 25px
    }
}

/* ---- 联系人增强：在线状态 / 未读 / 最近消息 ---- */
.avatar {
    position: relative
}

.avatar.is-online::after {
    content: '';
    position: absolute;
    right: -1px;
    bottom: -1px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #35bd88;
    border: 2px solid #fff
}

.avatar::after {
    content: '';
    position: absolute;
    right: -1px;
    bottom: -1px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #c3cbd6;
    border: 2px solid #fff
}

.user-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
    flex-shrink: 0
}

.user-side time {
    font-size: 9px;
    color: #aab4c2
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: #ef4b5b;
    color: #fff;
    font: 600 9px/1 'DM Sans', sans-serif;
    font-style: normal
}

.section-title .badge {
    margin-left: 4px;
    vertical-align: 1px
}

.list-empty {
    padding: 18px 9px;
    color: #aab4c2;
    font-size: 11px;
    text-align: center
}

.user-meta small {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%
}

.chat-heading small em {
    font-style: normal;
    color: #7f8ea8;
    margin-left: 6px
}

#chatStatus.offline {
    color: #a4afbf
}

.chat-heading small:has(#chatStatus.offline) i {
    background: #c3cbd6
}

/* ---- 安全中心 / 修改密码 ---- */
.profile button + button {
    margin-left: 6px
}

.modal {
    position: fixed;
    inset: 0;
    background: #17243a55;
    backdrop-filter: blur(2px);
    display: grid;
    place-items: center;
    padding: 20px;
    z-index: 50
}

.modal-card {
    width: min(460px, 100%);
    max-height: 92vh;
    overflow: auto;
    background: #fff;
    border-radius: 18px;
    padding: 30px 32px;
    box-shadow: 0 30px 90px #1b2b4a33
}

.modal-card.wide {
    width: min(920px, 100%)
}

.modal-card h2 {
    font-size: 19px;
    margin: 0 0 8px
}

.modal-sub {
    color: #8793a6;
    font-size: 12px;
    line-height: 1.6;
    margin: 0 0 18px
}

.modal-card label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin: 14px 0 7px
}

.modal-card input {
    width: 100%;
    height: 44px;
    border: 1px solid #e4e9f1;
    border-radius: 9px;
    padding: 0 13px;
    outline: none;
    font: inherit
}

.modal-card input:focus {
    border-color: #8eacf5;
    box-shadow: 0 0 0 3px #3569e814
}

.rules {
    list-style: none;
    padding: 0;
    margin: 10px 0 4px;
    display: grid;
    gap: 4px
}

.rules li {
    font-size: 11px;
    color: #a0abba
}

.rules li.ok {
    color: #2f9e73
}

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

.ghost-btn {
    border: 1px solid #e4e9f1;
    background: #fff;
    color: #5d6b80;
    border-radius: 9px;
    padding: 10px 16px;
    font: 600 13px inherit;
    cursor: pointer
}

.ghost-btn:hover {
    background: #f6f8fb
}

.sub-title {
    font-size: 13px;
    margin: 22px 0 10px;
    color: #3f4d63
}

.table-wrap {
    border: 1px solid #edf0f5;
    border-radius: 11px;
    overflow: auto;
    max-height: 280px
}

.audit-wrap {
    max-height: 200px
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11.5px;
    white-space: nowrap
}

.admin-table th {
    position: sticky;
    top: 0;
    background: #f7f9fc;
    color: #6f7d91;
    text-align: left;
    padding: 9px 11px;
    font-weight: 600;
    border-bottom: 1px solid #edf0f5
}

.admin-table td {
    padding: 9px 11px;
    border-bottom: 1px solid #f2f5f9;
    color: #41506a
}

.admin-table tr:last-child td {
    border-bottom: 0
}

.pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    background: #f1f4f9;
    color: #7d8a9d;
    font-size: 10px;
    margin-right: 4px
}

.pill-ok {
    background: #e8f7f0;
    color: #2f9e73
}

.pill-danger {
    background: #fdecee;
    color: #d64d55
}

.pill-warn {
    background: #fff5e6;
    color: #c98a2b
}

.ops {
    display: flex;
    gap: 6px
}

.mini-btn {
    border: 1px solid #e4e9f1;
    background: #fff;
    color: #4d6bd6;
    border-radius: 6px;
    padding: 4px 9px;
    font: 600 11px inherit;
    cursor: pointer
}

.mini-btn:hover {
    background: #f1f5ff
}

.mini-btn.danger {
    color: #d64d55
}

.mini-btn.danger:hover {
    background: #fdeff0
}

.temp-box {
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: 10px;
    background: #f4f8ff;
    border: 1px dashed #b9cdf7;
    font-size: 12px;
    color: #37466a;
    display: grid;
    gap: 6px
}

.temp-box code {
    font-family: 'DM Sans', monospace;
    font-size: 15px;
    letter-spacing: .5px;
    color: #2857ce;
    background: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid #dde6f8;
    justify-self: start
}

.temp-box small {
    color: #8793a6;
    font-size: 11px
}

/* ---- 删除账号弹窗 ---- */
.del-options {
    display: grid;
    gap: 10px;
    margin: 6px 0 4px
}

.del-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border: 1px solid #e6ebf3;
    border-radius: 11px;
    padding: 13px 14px;
    cursor: pointer;
    background: #fff;
    transition: border-color .15s, background .15s
}

.del-option:hover {
    border-color: #c9d6ea;
    background: #fafcff
}

.del-option input {
    width: 15px;
    height: 15px;
    margin: 2px 0 0;
    flex-shrink: 0;
    accent-color: #3569e8;
    padding: 0;
    border: 0
}

.del-option:has(input:checked) {
    border-color: #3569e8;
    background: #f5f8ff
}

.del-body {
    display: grid;
    gap: 4px;
    line-height: 1.55
}

.del-body b {
    font-size: 12.5px;
    color: #33415a
}

.del-body small {
    font-size: 11px;
    color: #8793a6
}

.danger-text {
    color: #d64d55 !important
}

.danger-btn {
    background: #d64d55 !important;
    border-color: #d64d55 !important;
    color: #fff !important
}

.danger-btn:hover {
    background: #c33f48 !important
}

.danger-btn:disabled {
    opacity: .6;
    cursor: not-allowed
}

#delConfirmWrap label {
    font-weight: 500;
    color: #5d6b80
}

#delConfirmWrap code {
    background: #f4f6fa;
    border: 1px solid #e6ebf3;
    border-radius: 5px;
    padding: 1px 6px;
    color: #d64d55;
    font-size: 12px
}
