/* =========================================================
   天禧聊天室 - 全局样式
   ========================================================= */

:root {
    --green: #07c160;
    --green-dark: #059e4e;
    --green-soft: #e8f8ef;
    --green-bubble: #95ec69;
    --bg: #eef2f5;
    --panel: #ffffff;
    --sidebar: #f7f8fa;
    --text: #1f252b;
    --text-soft: #5d6670;
    --muted: #969da5;
    --border: #e7eaed;
    --danger: #e5484d;
    --danger-soft: #fff3f3;
    --shadow-lg: 0 24px 80px rgba(24, 36, 48, 0.14);
    --shadow-md: 0 12px 34px rgba(24, 36, 48, 0.12);
    --radius: 16px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a {
    color: var(--green-dark);
}

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

button {
    cursor: pointer;
}

.hidden {
    display: none !important;
}

.mobile-only {
    display: none !important;
}

.icon {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex: none;
}

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

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

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

::-webkit-scrollbar-thumb {
    background: #cfd6dc;
    border-radius: 8px;
}

::-webkit-scrollbar-thumb:hover {
    background: #b6bfc7;
}

/* =========================================================
   登录 / 注册
   ========================================================= */

.auth-page {
    min-height: 100vh;
    background:
        radial-gradient(circle at 6% 8%, rgba(7, 193, 96, 0.16), transparent 34%),
        radial-gradient(circle at 94% 92%, rgba(7, 193, 96, 0.12), transparent 36%),
        linear-gradient(135deg, #f3f6f4 0%, #e9f1ec 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
    position: relative;
    overflow: hidden;
}

.auth-decor {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.decor-1 {
    width: 420px;
    height: 420px;
    right: -160px;
    top: -170px;
    background: radial-gradient(circle, rgba(7, 193, 96, 0.14), transparent 68%);
}

.decor-2 {
    width: 360px;
    height: 360px;
    left: -130px;
    bottom: -160px;
    background: radial-gradient(circle, rgba(7, 193, 96, 0.1), transparent 68%);
}

.auth-shell {
    width: min(1060px, 100%);
    min-height: 640px;
    display: grid;
    grid-template-columns: 1.04fr 0.96fr;
    background: #fff;
    border-radius: 26px;
    overflow: hidden;
    box-shadow: 0 30px 90px rgba(24, 46, 34, 0.16);
    position: relative;
    z-index: 1;
}

.auth-brand {
    background:
        radial-gradient(circle at 85% 8%, rgba(255, 255, 255, 0.12), transparent 34%),
        radial-gradient(circle at 0% 100%, rgba(0, 0, 0, 0.16), transparent 46%),
        linear-gradient(150deg, #073d2a 0%, #075c37 48%, #07994b 100%);
    color: #fff;
    padding: 48px 52px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.auth-brand::after {
    content: "";
    position: absolute;
    width: 280px;
    height: 280px;
    right: -110px;
    bottom: -120px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 50%;
    box-shadow: 0 0 0 46px rgba(255, 255, 255, 0.04), 0 0 0 92px rgba(255, 255, 255, 0.03);
}

.brand-mark {
    display: flex;
    align-items: center;
    gap: 13px;
    margin-bottom: 54px;
    position: relative;
    z-index: 1;
}

.brand-logo {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.24);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 21px;
    font-weight: 700;
    backdrop-filter: blur(8px);
}

.brand-logo.small {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    font-size: 17px;
    background: var(--green);
    border: 0;
}

.brand-name {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.auth-brand h1 {
    font-size: 42px;
    line-height: 1.28;
    margin: 0 0 20px;
    letter-spacing: 1px;
    font-weight: 700;
    position: relative;
    z-index: 1;
}

.brand-desc {
    font-size: 14px;
    line-height: 1.9;
    color: rgba(255, 255, 255, 0.76);
    margin: 0 0 26px;
    max-width: 380px;
    position: relative;
    z-index: 1;
}

.brand-features {
    display: flex;
    gap: 9px;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

.brand-features span {
    padding: 6px 12px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.16);
    font-size: 12px;
    color: rgba(255, 255, 255, 0.86);
}

.brand-chat {
    margin-top: auto;
    padding-top: 38px;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.demo-bubble {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 100%;
    animation: floatUp 0.6s ease both;
}

.demo-bubble.demo-right {
    justify-content: flex-end;
}

.demo-bubble .demo-avatar {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex: none;
}

.demo-bubble .demo-avatar.demo-green {
    background: var(--green);
}

.demo-text {
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.94);
    padding: 9px 13px;
    border-radius: 12px 12px 12px 4px;
    font-size: 13px;
    line-height: 1.5;
    backdrop-filter: blur(6px);
}

.demo-right .demo-text {
    background: rgba(149, 236, 105, 0.92);
    color: #143d1f;
    border-color: transparent;
    border-radius: 12px 12px 4px 12px;
}

.demo-card {
    display: flex;
    align-items: center;
    gap: 11px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    padding: 10px 13px;
    margin-left: 38px;
    backdrop-filter: blur(6px);
    animation: floatUp 0.65s 0.1s ease both;
}

.demo-file-icon {
    width: 38px;
    height: 38px;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.demo-file-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 12px;
    flex: 1;
}

.demo-file-info small {
    color: rgba(255, 255, 255, 0.55);
    font-size: 10.5px;
}

.demo-file-down {
    color: rgba(255, 255, 255, 0.7);
    font-size: 16px;
}

.auth-panel {
    padding: 48px 54px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: #fff;
}

.auth-card {
    width: 100%;
    max-width: 390px;
    margin: 0 auto;
}

.auth-mobile-brand {
    display: none;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: #264033;
    margin-bottom: 24px;
}

.auth-card-head h2 {
    font-size: 30px;
    margin: 0 0 8px;
    letter-spacing: 0.5px;
    font-weight: 700;
}

.auth-card-head p {
    color: var(--muted);
    font-size: 13.5px;
    margin: 0 0 26px;
}

.auth-alert {
    padding: 10px 13px;
    border-radius: 9px;
    font-size: 13px;
    line-height: 1.6;
    margin-bottom: 17px;
}

.auth-alert.error {
    background: #fff4f4;
    border: 1px solid #ffd9d9;
    color: #b42318;
}

.auth-alert.success {
    background: #f0fbf5;
    border: 1px solid #c9f0d9;
    color: #087a43;
}

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

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.auth-field > span {
    font-size: 13px;
    color: #535c66;
    font-weight: 600;
}

.auth-field input,
.form-field input,
.form-field textarea,
.form-field select,
.admin-create-form input,
.admin-create-form select,
.add-member-row select {
    width: 100%;
    border: 1px solid #dfe4e8;
    background: #fafcfb;
    border-radius: 10px;
    font-size: 14px;
    color: var(--text);
    outline: none;
    transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}

.auth-field input {
    height: 47px;
    padding: 0 14px;
}

.auth-field input:focus,
.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus,
.admin-create-form input:focus,
.admin-create-form select:focus,
.add-member-row select:focus,
#messageInput:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(7, 193, 96, 0.12);
    background: #fff;
}

.auth-show-pass {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    color: #8a929b;
    cursor: pointer;
    user-select: none;
    margin-top: -3px;
}

.auth-show-pass input {
    accent-color: var(--green);
    width: 14px;
    height: 14px;
}

.auth-submit {
    height: 48px;
    border: 0;
    border-radius: 10px;
    background: var(--green);
    color: #fff;
    font-size: 15.5px;
    font-weight: 600;
    letter-spacing: 3px;
    margin-top: 4px;
    box-shadow: 0 12px 28px rgba(7, 193, 96, 0.26);
    transition: transform 0.16s, background 0.16s, box-shadow 0.16s;
}

.auth-submit:hover {
    background: var(--green-dark);
    transform: translateY(-1px);
    box-shadow: 0 15px 32px rgba(7, 193, 96, 0.3);
}

.auth-submit:active {
    transform: translateY(0);
}

.auth-links {
    margin-top: 22px;
    text-align: center;
    font-size: 13px;
    color: #8d949c;
}

.auth-links a {
    color: var(--green-dark);
    font-weight: 600;
    text-decoration: none;
}

.auth-links a:hover {
    text-decoration: underline;
}

.auth-foot {
    text-align: center;
    font-size: 11.5px;
    color: #b0b6bd;
    margin: 28px auto 0;
}

/* =========================================================
   聊天主界面
   ========================================================= */

.chat-page {
    height: 100vh;
    overflow: hidden;
    background:
        radial-gradient(circle at 0% 0%, rgba(7, 193, 96, 0.08), transparent 28%),
        radial-gradient(circle at 100% 100%, rgba(7, 193, 96, 0.07), transparent 30%),
        #e9eef2;
}

.app-shell {
    width: min(1320px, calc(100% - 32px));
    height: calc(100vh - 32px);
    margin: 16px auto;
    display: flex;
    background: #fff;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.7);
    position: relative;
}

/* 侧边栏 */

.sidebar {
    width: 312px;
    flex: 0 0 312px;
    background: var(--sidebar);
    border-right: 1px solid #e8ebee;
    display: flex;
    flex-direction: column;
    min-height: 0;
    position: relative;
    z-index: 20;
}

.sidebar-top {
    padding: 18px 15px 12px;
    flex: none;
}

.me-card {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px;
    border-radius: 13px;
    background: linear-gradient(135deg, #ffffff, #f1faf5);
    border: 1px solid #e5f1e9;
    cursor: pointer;
    transition: box-shadow 0.18s, transform 0.18s;
    outline: none;
}

.me-card:hover,
.me-card:focus-visible {
    box-shadow: 0 8px 22px rgba(7, 120, 65, 0.1);
    transform: translateY(-1px);
}

.me-info {
    min-width: 0;
    flex: 1;
}

.me-name {
    font-size: 14.5px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.me-sub {
    font-size: 11.5px;
    color: #8e979f;
    margin-top: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.me-edit {
    color: #a3abb3;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    border-radius: 8px;
    transition: color 0.16s, background 0.16s;
}

.me-card:hover .me-edit {
    color: var(--green-dark);
    background: #e9f8ef;
}

.new-group-btn {
    width: 100%;
    height: 40px;
    margin-top: 12px;
    border: 0;
    border-radius: 9px;
    background: var(--green);
    color: #fff;
    font-size: 13.5px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    box-shadow: 0 8px 18px rgba(7, 193, 96, 0.2);
    transition: background 0.16s, transform 0.16s;
}

.new-group-btn .icon {
    width: 17px;
    height: 17px;
}

.new-group-btn:hover {
    background: var(--green-dark);
    transform: translateY(-1px);
}

.group-search {
    margin-top: 12px;
    position: relative;
    display: flex;
    align-items: center;
}

.group-search .search-icon {
    position: absolute;
    left: 10px;
    width: 16px;
    height: 16px;
    color: #a0a7af;
    pointer-events: none;
}

.group-search input {
    width: 100%;
    height: 36px;
    padding: 0 32px 0 33px;
    border-radius: 8px;
    border: 1px solid #e3e7ea;
    background: #fff;
    font-size: 12.5px;
    outline: none;
    transition: border-color 0.16s, box-shadow 0.16s;
}

.group-search input:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(7, 193, 96, 0.1);
}

.search-clear {
    position: absolute;
    right: 6px;
    width: 22px;
    height: 22px;
    border: 0;
    background: transparent;
    color: #a6adb4;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.search-clear .icon {
    width: 13px;
    height: 13px;
}

.search-clear:hover {
    background: #eef1f3;
    color: #6c757e;
}

.group-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 2px 9px 12px;
}

.group-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 11px;
    cursor: pointer;
    position: relative;
    transition: background 0.16s;
    user-select: none;
}

.group-item + .group-item {
    margin-top: 2px;
}

.group-item:hover {
    background: #eef1f3;
}

.group-item.active {
    background: #e5f8ed;
}

.group-item.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 14px;
    bottom: 14px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--green);
}

.group-item-avatar {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 17px;
    font-weight: 700;
    background: linear-gradient(135deg, #10b981, #059669);
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.2);
}

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

.group-item-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.group-item-name {
    font-size: 13.8px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.group-item-time {
    font-size: 10.5px;
    color: #a5acb4;
    flex: none;
}

.group-item-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 4px;
}

.group-item-preview {
    font-size: 11.8px;
    color: #99a1a9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.unread-badge {
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: #fa5151;
    color: #fff;
    font-size: 10.5px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    box-shadow: 0 2px 6px rgba(250, 81, 81, 0.3);
}

.list-loading,
.group-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: #a0a7af;
    font-size: 12.5px;
    padding: 46px 16px;
    text-align: center;
    line-height: 1.7;
}

.group-empty .empty-mark {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    background: #eef3f0;
    color: #a4b2a9;
    display: flex;
    align-items: center;
    justify-content: center;
}

.group-empty .empty-mark .icon {
    width: 26px;
    height: 26px;
}

.spinner {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid #d9e6de;
    border-top-color: var(--green);
    animation: spin 0.8s linear infinite;
}

.sidebar-bottom {
    flex: none;
    padding: 9px 12px 12px;
    border-top: 1px solid #e8ebee;
    background: #f7f8fa;
}

.logout-form {
    margin: 0;
}

.side-action {
    width: 100%;
    height: 35px;
    border: 0;
    background: transparent;
    border-radius: 8px;
    color: #7b848d;
    font-size: 12.5px;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 0 10px;
    text-align: left;
    transition: background 0.16s, color 0.16s;
}

.side-action .icon {
    width: 17px;
    height: 17px;
}

.side-action:hover {
    background: #eef1f3;
    color: #3f4851;
}

.sidebar-mask {
    display: none;
}

/* 聊天主区 */

.chat-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    position: relative;
    background: #f2f4f6;
}

.chat-head {
    flex: 0 0 70px;
    height: 70px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid #e9ecef;
    position: relative;
    z-index: 10;
}

.group-avatar {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 17px;
    font-weight: 700;
    background: linear-gradient(135deg, #10b981, #059669);
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.18);
}

.group-avatar-lg {
    width: 44px;
    height: 44px;
}

.chat-title {
    min-width: 0;
    flex: 1;
}

.chat-title h1 {
    font-size: 15.5px;
    margin: 0;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-title p {
    margin: 4px 0 0;
    font-size: 11.5px;
    color: #969da5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-actions {
    display: flex;
    gap: 6px;
    flex: none;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border: 0;
    background: transparent;
    border-radius: 9px;
    color: #7d858e;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.16s, color 0.16s;
}

.icon-btn:hover {
    background: #f0f3f5;
    color: #303840;
}

.icon-btn.danger:hover {
    background: #fff0f0;
    color: var(--danger);
}

.message-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 18px 22px 20px;
    display: flex;
    flex-direction: column;
    gap: 13px;
    position: relative;
}

.message-list.is-empty {
    justify-content: center;
}

.chat-state {
    align-self: center;
    margin: auto;
    color: #98a0a8;
    font-size: 13px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;
    line-height: 1.7;
}

.chat-state .icon {
    width: 30px;
    height: 30px;
    color: #b3bac1;
}

.chat-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 30px;
}

.chat-empty h2 {
    margin: 24px 0 8px;
    font-size: 20px;
    font-weight: 700;
}

.chat-empty p {
    margin: 0 0 22px;
    color: #939ba3;
    font-size: 13.5px;
}

.empty-illustration {
    width: 210px;
    height: 140px;
    position: relative;
}

.empty-avatar {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 74px;
    height: 74px;
    border-radius: 22px;
    background: linear-gradient(135deg, #07c160, #059e4e);
    color: #fff;
    font-size: 30px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 18px 36px rgba(7, 193, 96, 0.25);
    z-index: 2;
}

.empty-bubble {
    position: absolute;
    padding: 9px 14px;
    border-radius: 12px 12px 12px 4px;
    background: #fff;
    box-shadow: 0 8px 22px rgba(30, 44, 55, 0.09);
    font-size: 12.5px;
    color: #666f78;
    animation: float 4s ease-in-out infinite;
}

.empty-bubble.b1 {
    left: 2px;
    top: 16px;
}

.empty-bubble.b2 {
    right: 0;
    bottom: 16px;
    border-radius: 12px 12px 4px 12px;
    background: var(--green-bubble);
    color: #24521f;
    animation-delay: 1.2s;
}

/* 消息 */

.date-divider {
    align-self: center;
    font-size: 11px;
    color: #9aa2aa;
    background: rgba(255, 255, 255, 0.65);
    padding: 4px 11px;
    border-radius: 20px;
    margin: 4px 0;
}

.msg-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    max-width: 100%;
    animation: msgIn 0.18s ease both;
}

.msg-row.self {
    flex-direction: row-reverse;
}

.msg-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    flex: none;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    background: linear-gradient(135deg, #5da9e9, #3a7bd5);
    box-shadow: 0 3px 8px rgba(31, 55, 80, 0.14);
}

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

.msg-body {
    max-width: min(78%, 860px);
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.self .msg-body {
    align-items: flex-end;
}

.msg-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: #9da5ad;
    padding: 0 2px;
}

.msg-name {
    color: #6f7982;
    font-weight: 600;
}

.msg-bubble {
    background: #fff;
    border-radius: 4px 12px 12px 12px;
    padding: 9px 12px;
    font-size: 14px;
    line-height: 1.68;
    color: #20252b;
    box-shadow: 0 1px 3px rgba(20, 30, 40, 0.06);
    word-break: break-word;
    overflow-wrap: anywhere;
}

.msg-bubble a {
    color: #0b7f45;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.msg-bubble.has-code {
    width: 100%;
    padding: 8px 10px;
    background: #fff;
}

.self .msg-bubble.has-code {
    background: #fff;
    color: #20252b;
}

.code-block {
    margin: 3px 0;
    border-radius: 9px;
    overflow: hidden;
    background: #1e242c;
    box-shadow: 0 6px 18px rgba(15, 23, 32, 0.18);
    text-align: left;
}

.msg-bubble.has-code .code-block:first-child {
    margin-top: 0;
}

.msg-bubble.has-code .code-block:last-child {
    margin-bottom: 0;
}

.code-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 10px;
    background: #262e38;
    border-bottom: 1px solid #333c47;
    color: #9aa8b8;
    font-size: 10.5px;
    letter-spacing: 0.3px;
}

.code-lang {
    font-weight: 700;
    text-transform: uppercase;
}

.code-copy {
    border: 0;
    background: transparent;
    color: #9aa8b8;
    font-size: 10.5px;
    padding: 2px 7px;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.code-copy:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.code-copy.copied {
    color: #5ed69a;
}

.code-block pre {
    margin: 0;
    padding: 10px 12px;
    overflow-x: auto;
    max-height: 420px;
    overflow-y: auto;
}

.code-block code {
    display: block;
    font-family: "Cascadia Code", "JetBrains Mono", Consolas, "Courier New", monospace;
    font-size: 12.5px;
    line-height: 1.62;
    color: #d7e0ea;
    white-space: pre;
    word-break: normal;
    overflow-wrap: normal;
    tab-size: 4;
}

.tok-comment {
    color: #7d8b9c;
    font-style: italic;
}

.tok-string {
    color: #9cdc8f;
}

.tok-keyword {
    color: #c792ea;
    font-weight: 600;
}

.tok-number {
    color: #f2b36b;
}

.tok-function {
    color: #74b8f5;
}

.self .msg-bubble {
    background: var(--green-bubble);
    border-radius: 12px 4px 12px 12px;
    color: #1b341c;
    box-shadow: 0 1px 3px rgba(40, 100, 30, 0.08);
}

.msg-bubble.media {
    padding: 4px;
    background: #fff;
    box-shadow: 0 2px 10px rgba(20, 30, 40, 0.08);
}

.self .msg-bubble.media {
    background: #fff;
}

.msg-image {
    display: block;
    max-width: 300px;
    max-height: 280px;
    width: auto;
    height: auto;
    border-radius: 8px;
    cursor: zoom-in;
    object-fit: contain;
    background: #f5f7f8;
}

.msg-bubble.image-loading {
    position: relative;
}

.image-fallback {
    width: 180px;
    height: 120px;
    border-radius: 8px;
    background: #f1f4f5;
    color: #9aa2aa;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.msg-file {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 230px;
    max-width: 340px;
    padding: 10px 12px;
    background: #fff;
    border-radius: 11px;
    text-decoration: none;
    color: var(--text);
    box-shadow: 0 2px 10px rgba(20, 30, 40, 0.07);
    transition: background 0.16s, transform 0.16s;
}

.msg-file:hover {
    background: #f9fcfb;
    transform: translateY(-1px);
}

.file-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: #eef4ff;
    color: #3b6fe0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.3px;
    flex: none;
    text-transform: uppercase;
}

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

.file-name {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    font-size: 10.5px;
    color: #99a1a9;
}

.file-download {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: #f1f6f3;
    color: #5c8f70;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
}

.file-download .icon {
    width: 16px;
    height: 16px;
}

/* 输入区 */

.composer {
    flex: none;
    background: #fff;
    border-top: 1px solid #e9ecef;
    padding: 9px 18px 14px;
    position: relative;
    z-index: 15;
}

.composer-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
}

.tool-group {
    display: flex;
    gap: 2px;
}

.tool-btn {
    width: 32px;
    height: 32px;
    border: 0;
    background: transparent;
    border-radius: 8px;
    color: #7d858e;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.16s, color 0.16s;
}

.tool-btn:hover,
.tool-btn.active {
    background: #eef8f2;
    color: var(--green-dark);
}

.tool-btn .icon {
    width: 19px;
    height: 19px;
}

.composer-hint {
    font-size: 11px;
    color: #b0b6bd;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.composer-input-row {
    display: flex;
    align-items: flex-end;
    gap: 10px;
}

#messageInput {
    flex: 1;
    min-height: 42px;
    max-height: 132px;
    resize: none;
    border: 1px solid #e2e7ea;
    background: #f8faf9;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
    line-height: 1.55;
    color: var(--text);
    outline: none;
    transition: border-color 0.16s, box-shadow 0.16s, background 0.16s;
}

.send-btn {
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 10px;
    background: var(--green);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    box-shadow: 0 7px 16px rgba(7, 193, 96, 0.24);
    transition: background 0.16s, transform 0.16s, opacity 0.16s;
}

.send-btn .icon {
    width: 19px;
    height: 19px;
    transform: translateX(-1px);
}

.send-btn:hover {
    background: var(--green-dark);
    transform: translateY(-1px);
}

.send-btn:disabled {
    background: #b9c9c0;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

.upload-status {
    margin-top: 8px;
    background: #f1faf5;
    border: 1px solid #d9f0e2;
    border-radius: 8px;
    padding: 7px 10px 8px;
}

.upload-info {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 11.5px;
    color: #3e7d5a;
    margin-bottom: 5px;
}

.upload-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.upload-track {
    height: 4px;
    border-radius: 4px;
    background: #dcece2;
    overflow: hidden;
}

.upload-bar {
    width: 0;
    height: 100%;
    border-radius: 4px;
    background: var(--green);
    transition: width 0.2s ease;
}

.emoji-panel {
    position: absolute;
    left: 16px;
    bottom: 88px;
    width: 344px;
    max-height: 286px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #e8ebee;
    border-radius: 13px;
    box-shadow: var(--shadow-md);
    padding: 10px;
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 2px;
    z-index: 40;
    animation: popIn 0.15s ease both;
}

.emoji-btn {
    border: 0;
    background: transparent;
    border-radius: 7px;
    height: 32px;
    font-size: 21px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.12s, transform 0.12s;
}

.emoji-btn:hover {
    background: #eef8f2;
    transform: scale(1.15);
}

.drop-overlay {
    position: absolute;
    inset: 7px;
    pointer-events: none;
    border: 2px dashed var(--green);
    border-radius: 12px;
    background: rgba(234, 249, 241, 0.95);
    color: #078c49;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 35;
    backdrop-filter: blur(2px);
}

/* =========================================================
   通用按钮 / 表单 / 弹窗
   ========================================================= */

.btn-primary,
.btn-ghost,
.btn-danger {
    height: 38px;
    padding: 0 16px;
    border-radius: 9px;
    border: 0;
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background 0.16s, color 0.16s, transform 0.16s, box-shadow 0.16s;
    white-space: nowrap;
}

.btn-primary {
    background: var(--green);
    color: #fff;
    box-shadow: 0 6px 16px rgba(7, 193, 96, 0.2);
}

.btn-primary:hover {
    background: var(--green-dark);
    transform: translateY(-1px);
}

.btn-ghost {
    background: #f1f4f5;
    color: #4d5862;
}

.btn-ghost:hover {
    background: #e6ebee;
}

.btn-danger {
    background: #fff0f0;
    color: #c0353b;
}

.btn-danger:hover {
    background: #ffe3e3;
}

.btn-primary .icon,
.btn-ghost .icon,
.btn-danger .icon {
    width: 16px;
    height: 16px;
}

.btn-primary:disabled,
.btn-ghost:disabled,
.btn-danger:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.show {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(16, 24, 32, 0.48);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.16s ease both;
}

.modal-card {
    position: relative;
    z-index: 1;
    width: min(520px, 100%);
    max-height: 90vh;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 30px 90px rgba(12, 22, 30, 0.28);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalIn 0.2s cubic-bezier(0.2, 0.9, 0.3, 1) both;
}

.modal-sm {
    width: min(440px, 100%);
}

.modal-xs {
    width: min(390px, 100%);
}

.modal-lg {
    width: min(760px, 100%);
}

.modal-head {
    flex: none;
    padding: 20px 22px 14px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    border-bottom: 1px solid #eef1f3;
}

.modal-head h2 {
    font-size: 17px;
    margin: 0;
    font-weight: 700;
}

.modal-sub {
    font-size: 11.8px;
    color: #969da5;
    margin: 5px 0 0;
}

.modal-close {
    width: 30px;
    height: 30px;
    border: 0;
    background: #f3f5f6;
    color: #7d858e;
    border-radius: 8px;
    font-size: 20px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    transition: background 0.15s, color 0.15s;
}

.modal-close:hover {
    background: #e8ecef;
    color: #333b43;
}

.modal-tabs {
    flex: none;
    display: flex;
    gap: 4px;
    padding: 12px 22px 0;
    border-bottom: 1px solid #eef1f3;
}

.modal-tab {
    border: 0;
    background: transparent;
    padding: 9px 13px 11px;
    font-size: 13px;
    color: #7e8790;
    font-weight: 600;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.modal-tab:hover {
    color: #3d4650;
}

.modal-tab.active {
    color: var(--green-dark);
    border-bottom-color: var(--green);
}

.modal-body {
    padding: 20px 22px;
    overflow-y: auto;
}

.modal-foot {
    flex: none;
    padding: 14px 22px;
    border-top: 1px solid #eef1f3;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

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

.form-grid.single {
    grid-template-columns: 1fr;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12.5px;
    color: #5c6570;
    font-weight: 600;
}

.form-field.full {
    grid-column: 1 / -1;
}

.form-field input,
.form-field textarea,
.form-field select {
    height: 40px;
    padding: 0 12px;
    font-weight: 400;
    background: #fbfcfd;
}

.form-field textarea {
    height: auto;
    min-height: 74px;
    padding: 10px 12px;
    resize: vertical;
    line-height: 1.6;
}

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

.form-actions.compact {
    margin-top: 12px;
}

.avatar {
    border-radius: 10px;
    background: linear-gradient(135deg, #5da9e9, #3a7bd5);
    background-size: cover;
    background-position: center;
    color: #fff;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex: none;
    position: relative;
}

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

.avatar-lg {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    font-size: 17px;
}

.avatar-xxl {
    width: 88px;
    height: 88px;
    border-radius: 22px;
    font-size: 32px;
}

.avatar-editor {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 4px 0 20px;
    border-bottom: 1px dashed #edf0f2;
    margin-bottom: 18px;
}

.avatar-editor-info {
    min-width: 0;
}

.avatar-editor-info p {
    margin: 8px 0 0;
    font-size: 11.5px;
    color: #a0a7af;
    line-height: 1.6;
}

.file-button {
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.confirm-message {
    margin: 0 0 4px;
    font-size: 13.5px;
    line-height: 1.8;
    color: #5f6872;
    white-space: pre-wrap;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 22px 0 10px;
    padding-top: 18px;
    border-top: 1px solid #eef1f3;
}

.modal-body > .section-head:first-child {
    border-top: 0;
    padding-top: 0;
    margin-top: 0;
}

.section-head h3 {
    font-size: 13.5px;
    margin: 0;
    font-weight: 700;
}

.section-head span {
    font-size: 11.5px;
    color: #9aa2aa;
}

.member-list {
    display: flex;
    flex-direction: column;
    max-height: 230px;
    overflow-y: auto;
    padding-right: 2px;
}

.member-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 2px;
    border-bottom: 1px solid #f2f4f5;
}

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

.member-avatar {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    flex: none;
    font-size: 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    background: linear-gradient(135deg, #5da9e9, #3a7bd5);
}

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

.member-info {
    flex: 1;
    min-width: 0;
}

.member-name {
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
}

.member-name > span:first-child {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.member-sub {
    margin-top: 2px;
    font-size: 10.5px;
    color: #a0a7af;
    display: flex;
    align-items: center;
    gap: 6px;
}

.online-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green);
    display: inline-block;
    flex: none;
}

.member-badge {
    font-size: 9.5px;
    padding: 1px 6px;
    border-radius: 20px;
    background: #e8f8ef;
    color: #078a48;
    font-weight: 600;
    flex: none;
}

.member-badge.admin {
    background: #eef3ff;
    color: #3b6fe0;
}

.member-remove {
    border: 0;
    background: transparent;
    color: #adb4bb;
    width: 28px;
    height: 28px;
    border-radius: 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
}

.member-remove:hover {
    background: #fff0f0;
    color: var(--danger);
}

.member-remove .icon {
    width: 15px;
    height: 15px;
}

.add-member-row {
    display: flex;
    gap: 9px;
    margin-top: 12px;
    align-items: center;
}

.add-member-row select {
    flex: 1;
    height: 38px;
    padding: 0 10px;
    background: #fbfcfd;
    font-size: 13px;
}

.danger-zone {
    margin-top: 24px;
    padding: 15px 16px;
    border-radius: 11px;
    border: 1px solid #ffdcdc;
    background: #fffafa;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.danger-zone strong {
    display: block;
    font-size: 13px;
    color: #a92f35;
    margin-bottom: 3px;
}

.danger-zone p {
    margin: 0;
    font-size: 11.5px;
    color: #a77a7c;
    line-height: 1.6;
}

.admin-create-form {
    display: grid;
    grid-template-columns: 1fr 1fr 1.2fr 120px auto;
    gap: 8px;
    align-items: center;
}

.admin-create-form input,
.admin-create-form select {
    height: 38px;
    padding: 0 10px;
    font-size: 12.5px;
    background: #fbfcfd;
}

.admin-settings-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.admin-settings-form > .form-field {
    max-width: 380px;
}

.switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 11px 14px;
    border: 1px solid #e8ecef;
    border-radius: 10px;
    background: #fbfcfd;
}

.switch-copy {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.switch-copy strong {
    font-size: 12.8px;
    color: #3f4954;
}

.switch-copy small {
    font-size: 11px;
    color: #9aa2aa;
}

.switch {
    position: relative;
    display: inline-flex;
    flex: none;
    cursor: pointer;
}

.switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-track {
    width: 42px;
    height: 24px;
    border-radius: 20px;
    background: #d9dfe5;
    position: relative;
    transition: background 0.18s;
}

.switch-track::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 4px rgba(20, 30, 40, 0.22);
    transition: transform 0.18s;
}

.switch input:checked + .switch-track {
    background: var(--green);
}

.switch input:checked + .switch-track::after {
    transform: translateX(18px);
}

.switch input:focus-visible + .switch-track {
    box-shadow: 0 0 0 3px rgba(7, 193, 96, 0.18);
}

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

#codeInput {
    min-height: 230px;
    font-family: "Cascadia Code", "JetBrains Mono", Consolas, "Courier New", monospace;
    font-size: 13px;
    line-height: 1.6;
    white-space: pre;
    overflow-x: auto;
}

.admin-user-list {
    display: flex;
    flex-direction: column;
    max-height: 330px;
    overflow-y: auto;
}

.admin-user-row {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 0;
    border-bottom: 1px solid #f1f3f5;
}

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

.admin-user-main {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-user-info {
    min-width: 0;
}

.admin-user-name {
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.admin-user-meta {
    margin-top: 2px;
    font-size: 10.5px;
    color: #9aa2aa;
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
}

.status-badge {
    font-size: 9.5px;
    padding: 1px 6px;
    border-radius: 20px;
    background: #e8f8ef;
    color: #078a48;
    font-weight: 600;
}

.status-badge.off {
    background: #f1f3f5;
    color: #9aa2aa;
}

.admin-user-actions {
    display: flex;
    align-items: center;
    gap: 5px;
    flex: none;
}

.sound-picker {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sound-picker select {
    flex: 1;
    min-width: 0;
}

.sound-picker .mini-btn {
    height: 40px;
    flex: none;
    padding: 0 16px;
}

.form-hint {
    font-size: 11px;
    font-weight: 400;
    color: #9aa2aa;
    line-height: 1.5;
}

.login-log-table {
    border: 1px solid #edf0f2;
    border-radius: 10px;
    overflow-x: auto;
    background: #fff;
}

.login-log-table table {
    width: 100%;
    min-width: 560px;
    border-collapse: collapse;
    font-size: 12px;
}

.login-log-table th,
.login-log-table td {
    padding: 9px 12px;
    text-align: left;
    border-bottom: 1px solid #f1f3f5;
    white-space: nowrap;
}

.login-log-table th {
    background: #f8fafb;
    color: #7b858f;
    font-size: 11px;
    font-weight: 600;
}

.login-log-table tbody tr:last-child td {
    border-bottom: 0;
}

.login-log-table tbody tr:hover {
    background: #fafcfb;
}

.log-ip {
    font-family: "Cascadia Code", "JetBrains Mono", Consolas, monospace;
    color: #3f4954;
}

.log-pager {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 10px;
    font-size: 11.5px;
    color: #8a929b;
}

.log-pager .mini-btn {
    height: 30px;
}

.mini-btn {
    height: 28px;
    padding: 0 9px;
    border: 0;
    border-radius: 7px;
    background: #f1f4f5;
    color: #5c6670;
    font-size: 11.5px;
    transition: background 0.15s, color 0.15s;
}

.mini-btn:hover {
    background: #e7ecef;
    color: #2e373f;
}

.mini-btn.danger:hover {
    background: #fff0f0;
    color: var(--danger);
}

.mini-btn:disabled,
.role-select:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.role-select {
    height: 28px;
    border-radius: 7px;
    border: 1px solid #e2e7ea;
    background: #fff;
    font-size: 11.5px;
    padding: 0 5px;
    color: #5c6670;
}

/* 图片灯箱 */

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 150;
    background: rgba(8, 12, 16, 0.93);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 44px;
}

.lightbox.show {
    display: flex;
}

.lightbox img {
    max-width: 92vw;
    max-height: 78vh;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
    user-select: none;
}

.lightbox-close {
    position: absolute;
    top: 18px;
    right: 24px;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 25px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lightbox-foot {
    margin-top: 16px;
    display: flex;
    gap: 22px;
}

.lightbox-foot a {
    color: rgba(255, 255, 255, 0.72);
    font-size: 12.5px;
    text-decoration: none;
}

.lightbox-foot a:hover {
    color: #fff;
    text-decoration: underline;
}

/* Toast */

.toast-container {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 300;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
    width: max-content;
    max-width: 92vw;
}

.toast {
    background: rgba(28, 36, 45, 0.95);
    color: #fff;
    padding: 10px 18px;
    border-radius: 9px;
    font-size: 12.8px;
    line-height: 1.5;
    box-shadow: 0 12px 30px rgba(15, 24, 32, 0.24);
    animation: toastIn 0.2s ease both;
    max-width: 92vw;
    word-break: break-word;
}

.toast.success {
    background: #0a7f44;
}

.toast.error {
    background: #c0392b;
}

/* =========================================================
   动画
   ========================================================= */

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(12px) scale(0.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes popIn {
    from { opacity: 0; transform: translateY(5px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes msgIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

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

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

@keyframes floatUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =========================================================
   响应式
   ========================================================= */

@media (max-width: 980px) {
    .auth-shell {
        grid-template-columns: 1fr;
        max-width: 480px;
        min-height: 0;
    }

    .auth-brand {
        display: none;
    }

    .auth-panel {
        padding: 36px 30px 30px;
    }

    .auth-mobile-brand {
        display: flex;
    }

    .admin-create-form {
        grid-template-columns: 1fr 1fr;
    }

    .admin-create-form button {
        grid-column: 1 / -1;
    }
}

@media (max-width: 900px) {
    .chat-page {
        height: 100dvh;
    }

    .app-shell {
        width: 100%;
        height: 100dvh;
        margin: 0;
        border-radius: 0;
        border: 0;
    }

    .mobile-only {
        display: inline-flex !important;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 292px;
        max-width: 86vw;
        transform: translateX(-102%);
        transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.3, 1);
        box-shadow: 18px 0 50px rgba(15, 25, 34, 0.18);
        z-index: 70;
    }

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

    .sidebar-mask {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(12, 20, 27, 0.38);
        z-index: 65;
        backdrop-filter: blur(1px);
    }

    .app-shell.sidebar-open .sidebar-mask {
        display: block;
    }

    .chat-head {
        padding: 0 12px;
        gap: 9px;
    }

    .message-list {
        padding: 14px 12px 16px;
        gap: 12px;
    }

    .msg-body {
        max-width: calc(100% - 58px);
    }

    .composer {
        padding: 7px 10px 10px;
    }

    .composer-hint {
        display: none;
    }

    .emoji-panel {
        left: 8px;
        width: calc(100% - 16px);
        bottom: 76px;
    }

    .chat-empty {
        padding: 20px;
    }

    .empty-illustration {
        transform: scale(0.88);
    }

    .modal {
        padding: 12px;
    }

    .modal-card {
        max-height: 92vh;
    }

    .danger-zone {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 560px) {
    .auth-page {
        padding: 16px;
        align-items: flex-start;
    }

    .auth-shell {
        margin: 12px auto;
        border-radius: 20px;
    }

    .auth-panel {
        padding: 28px 22px 24px;
    }

    .auth-card-head h2 {
        font-size: 26px;
    }

    .msg-row {
        gap: 8px;
    }

    .msg-avatar {
        width: 32px;
        height: 32px;
        border-radius: 9px;
    }

    .msg-body {
        max-width: calc(100% - 48px);
    }

    .msg-bubble {
        font-size: 13.5px;
        padding: 8px 11px;
    }

    .msg-image {
        max-width: 230px;
        max-height: 230px;
    }

    .msg-file {
        min-width: 200px;
        padding: 9px 10px;
    }

    .chat-head {
        flex-basis: 62px;
        height: 62px;
    }

    .chat-title h1 {
        font-size: 14.5px;
    }

    .group-avatar-lg {
        width: 40px;
        height: 40px;
        border-radius: 11px;
        font-size: 15px;
    }

    .composer-top {
        margin-bottom: 4px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-grid .form-field {
        grid-column: 1 / -1;
    }

    .admin-create-form {
        grid-template-columns: 1fr;
    }

    .admin-create-form button {
        grid-column: 1 / -1;
    }

    .admin-user-row {
        flex-direction: column;
        align-items: stretch;
        gap: 7px;
    }

    .admin-user-actions {
        justify-content: flex-end;
    }

    .add-member-row {
        flex-direction: column;
        align-items: stretch;
    }

    .emoji-panel {
        grid-template-columns: repeat(8, 1fr);
    }

    .lightbox {
        padding: 18px;
    }

    .lightbox img {
        max-width: 96vw;
        max-height: 76vh;
    }
}
