:root {
    --bg: #fff4e8;
    --panel: rgba(255, 250, 245, 0.96);
    --text: #171717;
    --muted: #303030;
    --border: rgba(32, 32, 32, 0.08);
    --accent: #f67a13;
    --accent-soft: rgba(246, 122, 19, 0.14);
    --success: #9a5700;
    --error: #b44747;
    --bubble-self: #ffd6a6;
    --bubble-other: #ffffff;
    --shadow: 0 18px 38px rgba(105, 55, 0, 0.08);
    --mobile-nav-height: 0px;
    --mobile-browser-bar-gap: 0px;
    --mobile-nav-offset: 0px;
}

body.theme-friend {
    --bg: #edf4f0;
    --accent: #2d8d6d;
    --accent-soft: rgba(45, 141, 109, 0.14);
    --bubble-self: #dff5ec;
}

body.theme-business {
    --bg: #edf2f9;
    --accent: #446699;
    --accent-soft: rgba(68, 102, 153, 0.14);
    --bubble-self: #e0ebfb;
}

body.theme-family {
    --bg: #fff4e8;
    --accent: #cc8a24;
    --accent-soft: rgba(204, 138, 36, 0.14);
    --bubble-self: #fff0d9;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", "PingFang SC", sans-serif;
    background:
        linear-gradient(180deg, rgba(246, 248, 245, 0.35), rgba(233, 239, 230, 0.35));
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    color: var(--text);
    overflow: hidden;
}

body.has-media-preview {
    overflow: hidden;
}

body.page-install {
    overflow-x: hidden;
    overflow-y: auto;
}

html,
body {
    height: 100%;
}

a {
    color: var(--accent);
    text-decoration: none;
}

.page-shell {
    max-width: 1240px;
    margin: 0 auto;
    padding: 16px 16px 90px;
    height: 100vh;
}

.install-page-shell {
    height: auto;
    min-height: 100vh;
}

.app-frame {
    min-height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.site-header,
.user-pill,
.section-title,
.stats,
.chat-panel-header,
.composer-bar,
.copy-row,
.invite-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.site-header,
.card,
.chat-panel {
    background: var(--panel);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    backdrop-filter: blur(8px);
}

.site-header {
    padding: 18px 22px;
    border-radius: 24px;
}

.header-actions {
    gap: 8px;
}

.global-home-button {
    position: fixed;
    left: 24px;
    bottom: 24px;
    z-index: 80;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 18px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.96);
    color: #ea580c;
    border: 1px solid rgba(234, 88, 12, 0.16);
    box-shadow: 0 18px 34px rgba(15, 23, 42, 0.14);
    backdrop-filter: blur(10px);
    font-size: 14px;
    font-weight: 700;
}

.global-home-button:hover {
    background: #fff7ed;
    color: #c2410c;
}

.header-link-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 16px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--text);
    border: 1px solid var(--border);
}

.header-link-pill.is-accent {
    background: var(--accent);
    color: #fff;
    border-color: transparent;
}

.user-pill {
    gap: 10px;
}

.header-avatar {
    width: 34px;
    height: 34px;
}

.card {
    border-radius: 28px;
    padding: 24px;
}

.chat-shell {
    margin-top: 16px;
    min-height: 0;
    flex: 1;
    overflow: hidden;
    height: 100%;
}

.chat-panel {
    border-radius: 28px;
    padding: 18px 18px 14px;
    min-height: 0;
    height: 100%;
    position: relative;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    background: rgba(255, 255, 255, 0.54);
    overflow: hidden;
}

.login-shell {
    max-width: 520px;
    margin: 0 auto;
    min-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-panel {
    min-height: auto;
    width: min(100%, 460px);
}

.page-login .site-header {
    display: none;
}

.page-join .site-header {
    display: none;
}

.page-login .login-panel,
.page-join .login-panel {
    padding: 18px 20px 20px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 14px 32px rgba(28, 38, 28, 0.08);
    height: auto;
    min-height: 0;
    display: block;
    align-self: center;
}

.page-login .chat-panel-header,
.page-join .chat-panel-header {
    padding: 0;
    gap: 6px;
    align-items: flex-start;
    justify-content: flex-start;
}

.page-login .chat-panel-header h2,
.page-join .chat-panel-header h2 {
    margin: 0;
    font-size: 18px;
    line-height: 1.25;
}

.page-login .eyebrow,
.page-join .eyebrow {
    margin-bottom: 6px;
    font-size: 11px;
}

.page-login .login-copy,
.page-join .login-copy {
    margin-top: 10px;
}

.page-login .login-copy p,
.page-join .login-copy p {
    font-size: 13px;
    line-height: 1.65;
    color: #c93a3a;
}

.login-copy-tip {
    margin: 8px 0 0;
    font-size: 12px;
    line-height: 1.6;
    color: #c93a3a;
}

.page-login .form-grid,
.page-join .form-grid {
    gap: 10px;
    margin-top: 14px;
}

.page-login .chat-shell.login-shell,
.page-join .chat-shell.login-shell {
    min-height: calc(100vh - 32px);
    margin-top: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-login .form-grid label,
.page-join .form-grid label {
    font-size: 13px;
    color: #4d4d4d;
}

.page-login .form-grid input,
.page-login .form-grid button,
.page-join .form-grid input,
.page-join .form-grid button {
    min-height: 44px;
    padding: 10px 14px;
    border-radius: 16px;
}

.page-login .form-grid button,
.page-join .form-grid button {
    margin-top: 4px;
    font-weight: 600;
    box-shadow: 0 14px 26px rgba(20, 58, 37, 0.18);
}

.auth-action-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 6px;
}

.auth-action-row button,
.auth-action-row .auth-secondary-button {
    min-height: 44px;
    border-radius: 16px;
    width: 100%;
}

.auth-action-row button {
    justify-self: stretch;
    padding: 10px 14px;
    line-height: 1.2;
}

.auth-secondary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.96);
    color: #4a5a52;
    border: 1px solid rgba(31, 45, 36, 0.14);
    box-shadow: 0 14px 26px rgba(26, 40, 32, 0.1);
    font-weight: 600;
}

.auth-secondary-button:hover {
    color: #233028;
    background: #fff;
}

.chat-summary {
    text-align: right;
    color: var(--muted);
}

.chat-summary strong {
    display: block;
    font-size: 26px;
    color: var(--text);
}

.chat-summary span {
    font-size: 12px;
}

.chat-stream {
    margin-top: 20px;
    padding: 8px 4px 14px;
    min-height: 0;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    isolation: isolate;
    border-radius: 20px;
    background:
        radial-gradient(circle at 18% 20%, rgba(255, 223, 205, 0.66), transparent 32%),
        radial-gradient(circle at 82% 18%, rgba(255, 241, 202, 0.58), transparent 28%),
        radial-gradient(circle at 50% 82%, rgba(202, 234, 219, 0.5), transparent 32%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.36), rgba(247, 241, 235, 0.18));
}

.chat-stream > * {
    position: relative;
    z-index: 1;
}

.chat-stream::before,
.chat-stream::after {
    content: "";
    position: absolute;
    inset: -10%;
    pointer-events: none;
    z-index: 0;
}

.chat-stream::before {
    background:
        radial-gradient(circle at 20% 28%, rgba(255, 213, 193, 0.72), transparent 26%),
        radial-gradient(circle at 78% 22%, rgba(255, 237, 186, 0.66), transparent 24%),
        radial-gradient(circle at 54% 78%, rgba(203, 232, 222, 0.54), transparent 28%);
    filter: blur(32px);
    animation: cocoonWarmFloat 18s ease-in-out infinite alternate;
}

.chat-stream::after {
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0.08)),
        radial-gradient(circle at 60% 38%, rgba(255, 255, 255, 0.36), transparent 38%);
    backdrop-filter: blur(10px);
}

.chat-row {
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

.chat-row.is-self {
    flex-direction: row-reverse;
}

.chat-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    overflow: hidden;
    background: linear-gradient(135deg, var(--accent), #f1a893);
    flex-shrink: 0;
}

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

.chat-sender {
    width: 50px;
    display: grid;
    gap: 6px;
    justify-items: center;
    flex-shrink: 0;
}

.chat-sender-name {
    width: 100%;
    font-size: 12px;
    line-height: 1.2;
    text-align: center;
    color: var(--muted);
    word-break: break-word;
}

.chat-bubble-wrap {
    max-width: min(72%, 680px);
    display: grid;
    gap: 6px;
}

.chat-bubble-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 0;
}

.chat-row.is-self .chat-bubble-meta {
    justify-content: flex-end;
}

.chat-bubble {
    background: var(--bubble-other);
    border: 1px solid var(--border);
    border-radius: 6px 18px 18px 18px;
    padding: 12px 14px;
    display: grid;
    gap: 10px;
}

.chat-stream.has-custom-background {
    background-position: center;
    background-size: 100% auto;
    background-repeat: no-repeat;
    background-color: rgba(255, 255, 255, 0.18);
}

.chat-stream.has-custom-background::before {
    background:
        linear-gradient(180deg, rgba(239, 242, 240, 0.2), rgba(242, 236, 230, 0.1)),
        radial-gradient(circle at 22% 26%, rgba(255, 225, 211, 0.16), transparent 34%),
        radial-gradient(circle at 76% 24%, rgba(255, 242, 213, 0.14), transparent 30%);
    filter: blur(26px);
    animation: cocoonWarmFloat 18s ease-in-out infinite alternate;
}

.chat-stream.has-custom-background::after {
    background: linear-gradient(180deg, rgba(248, 250, 249, 0.18), rgba(255, 255, 255, 0.08));
}

.chat-row.is-self .chat-bubble {
    background: var(--bubble-self);
    border-radius: 18px 6px 18px 18px;
}

.chat-bubble p,
.moment-card p,
.login-copy p {
    margin: 0;
    line-height: 1.6;
}

.chat-inline-emoticon {
    display: inline-block;
    width: 24px;
    height: 24px;
    vertical-align: -5px;
    object-fit: contain;
}

.chat-composer {
    margin-top: 12px;
    padding: 10px 12px 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.04);
    display: grid;
    gap: 8px;
    align-self: end;
    background: rgba(236, 239, 238, 0.72);
    border-radius: 18px;
    backdrop-filter: blur(10px);
}

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

.chat-history-status {
    align-self: center;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.78);
    color: var(--muted);
    font-size: 12px;
    border: 1px solid var(--border);
}

.composer-preview-row[hidden] {
    display: none !important;
}

.emoji-panel {
    display: grid;
    gap: 10px;
    padding: 8px 0 2px;
}

.emoji-panel[hidden] {
    display: none !important;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 8px;
}

.emoji-option,
.emoji-trigger {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    background: #f1f1f1;
    color: #5f5f5f;
    border: 1px solid var(--border);
    font-size: 20px;
    line-height: 1;
}

.emoji-option {
    font-size: 18px;
}

.emoji-option-image {
    padding: 4px;
    background: rgba(255, 255, 255, 0.88);
}

.emoji-option-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.emoji-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.emoji-page-button {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.88);
    color: var(--muted);
    border: 1px solid var(--border);
}

.emoji-page-indicator {
    font-size: 12px;
    color: var(--muted);
}

.composer-preview-list {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    overflow: hidden;
    flex: 1;
}

.composer-preview-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 160px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--border);
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
}

.composer-preview-chip strong,
.composer-preview-chip span {
    overflow: hidden;
    text-overflow: ellipsis;
}

.composer-preview-chip strong {
    font-size: 11px;
    color: var(--accent);
}

.composer-preview-chip.is-overflow {
    justify-content: center;
    min-width: 44px;
}

.composer-send-bubble {
    width: auto;
    min-width: 74px;
    height: 38px;
    padding: 0 16px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 8px 18px rgba(7, 193, 96, 0.22);
}

.chat-input-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 40px 40px 64px;
    gap: 8px;
    align-items: center;
}

.attach-trigger {
    width: 40px;
    height: 40px;
    padding: 0;
    font-size: 24px;
    line-height: 1;
    border-radius: 50%;
    background: #f1f1f1;
    color: #5f5f5f;
    border: 1px solid var(--border);
}

.attach-menu {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.attach-menu[hidden] {
    display: none !important;
}

.attach-option {
    width: auto;
    padding: 10px 18px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--text);
}

.composer-status {
    min-height: 18px;
    color: var(--muted);
    font-size: 13px;
}

.chat-panel-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-panel-header {
    padding: 10px 12px;
    border-radius: 18px;
    background: rgba(236, 239, 238, 0.68);
    border: 1px solid rgba(255, 255, 255, 0.32);
    backdrop-filter: blur(10px);
}

.search-trigger {
    width: auto;
    min-width: 92px;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.88);
    color: var(--text);
    border: 1px solid var(--border);
    font-size: 13px;
}

.chat-title-block h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
}

.chat-search-panel {
    position: absolute;
    top: 18px;
    right: 18px;
    bottom: 18px;
    width: min(360px, calc(100% - 36px));
    border-radius: 24px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 18px 36px rgba(20, 24, 20, 0.12);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    z-index: 35;
    overflow: hidden;
}

.chat-search-panel[hidden] {
    display: none !important;
}

.chat-search-header,
.chat-search-input-row,
.chat-search-date-row,
.chat-search-item,
.chat-search-file,
.chat-search-meta {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-search-header {
    justify-content: space-between;
    padding: 16px 18px 12px;
    border-bottom: 1px solid var(--border);
}

.chat-search-body {
    min-height: 0;
    display: grid;
    grid-template-rows: auto auto auto minmax(0, 1fr) auto;
    gap: 10px;
    padding: 14px 16px 16px;
}

.chat-search-input-row input,
.chat-search-date-row input {
    border-radius: 16px;
    background: rgba(246, 246, 246, 0.94);
}

.chat-search-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
}

.search-tab,
.search-date-button,
.search-load-more,
.search-close {
    width: auto;
}

.search-tab {
    padding: 9px 12px;
    border-radius: 999px;
    background: rgba(242, 242, 242, 0.95);
    color: var(--muted);
    border: 1px solid var(--border);
    white-space: nowrap;
}

.search-tab.is-active {
    background: var(--accent-soft);
    color: var(--accent);
}

.search-date-button,
.search-load-more {
    border-radius: 999px;
    padding: 10px 14px;
}

.search-close {
    min-width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    background: rgba(242, 242, 242, 0.95);
    color: var(--muted);
    border: 1px solid var(--border);
    font-size: 24px;
    line-height: 1;
}

.chat-search-results {
    min-height: 0;
    overflow-y: auto;
    display: grid;
    align-content: start;
    gap: 10px;
    padding-right: 4px;
}

.chat-search-empty {
    padding: 22px 12px;
    border-radius: 18px;
    background: rgba(247, 247, 247, 0.92);
    color: var(--muted);
    text-align: center;
}

.chat-search-item,
.chat-search-file {
    align-items: flex-start;
    padding: 12px;
    border-radius: 18px;
    background: rgba(247, 247, 247, 0.94);
    border: 1px solid var(--border);
    cursor: pointer;
}

.chat-search-item strong,
.chat-search-file strong {
    display: block;
    margin-bottom: 4px;
}

.chat-search-item p,
.chat-search-file p {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
    word-break: break-word;
}

.chat-search-meta {
    justify-content: space-between;
    margin-top: 8px;
    color: var(--muted);
    font-size: 12px;
}

.chat-search-media-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.chat-search-media-card {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: rgba(240, 240, 240, 0.96);
    cursor: pointer;
}

.chat-search-media-card img,
.chat-search-media-card video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.chat-search-media-badge {
    position: absolute;
    right: 8px;
    bottom: 8px;
    padding: 4px 7px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.62);
    color: #fff;
    font-size: 11px;
}

.chat-row.is-focused .chat-bubble {
    box-shadow: 0 0 0 3px rgba(7, 193, 96, 0.22);
}

.profile-shortcut {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.85);
    color: var(--text);
    border: 1px solid var(--border);
    font-size: 13px;
}

.composer-shortcut {
    min-width: 52px;
    height: 40px;
    padding: 0 12px;
    white-space: nowrap;
    background: var(--accent);
    color: #fff;
    border-color: transparent;
    gap: 4px;
}

.composer-shortcut::after {
    content: '>';
    font-size: 14px;
    line-height: 1;
}

.admin-shortcut {
    background: rgba(7, 193, 96, 0.12);
    color: var(--accent);
}

.form-grid,
.moments-list,
.invite-list {
    display: grid;
    gap: 12px;
}

input,
textarea,
button,
select {
    width: 100%;
    border-radius: 16px;
    border: 1px solid var(--border);
    padding: 12px 14px;
    font: inherit;
}

textarea {
    resize: vertical;
    min-height: 44px;
}

.chat-input-wrap textarea {
    min-height: 40px;
    max-height: 120px;
    padding: 10px 14px;
    border-radius: 22px;
    resize: none;
    background: #fff;
}

.send-button {
    border-radius: 22px;
    background: var(--accent);
    font-weight: 600;
}

button {
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    border: none;
}

.copy-button {
    width: auto;
    min-width: 92px;
}

.invite-box,
.moment-card,
.invite-item,
.empty-state,
.version-box,
.storage-card {
    background: rgba(255, 255, 255, 0.65);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 14px 16px;
}

.chat-attachment {
    display: grid;
    gap: 10px;
}

.chat-attachment-preview,
.chat-attachment-video {
    display: block;
    width: 100%;
    border-radius: 16px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.06);
}

.chat-attachment-preview img,
.chat-attachment-video {
    width: 100%;
    max-height: 320px;
    object-fit: contain;
}

.chat-file-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid var(--border);
}

.chat-file-card small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
}

.chat-file-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: var(--accent-soft);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.chat-download-link {
    font-size: 14px;
    font-weight: 600;
}

.chat-media-preview-modal[hidden] {
    display: none !important;
}

.chat-media-preview-modal {
    position: fixed;
    inset: 0;
    z-index: 120;
}

.chat-media-preview-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 16, 13, 0.82);
    backdrop-filter: blur(6px);
}

.chat-media-preview-dialog {
    position: relative;
    z-index: 1;
    height: 100%;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-rows: minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
    padding: 28px 22px 20px;
}

.chat-media-preview-stage {
    min-width: 0;
    min-height: 0;
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
}

.chat-media-preview-image,
.chat-media-preview-video {
    max-width: min(100%, 1200px);
    max-height: min(100%, calc(100vh - 130px));
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 18px;
    background: rgba(0, 0, 0, 0.18);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}

.chat-media-preview-close,
.chat-media-preview-nav {
    width: auto;
    min-width: 96px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.24);
    backdrop-filter: blur(10px);
}

.chat-media-preview-close {
    position: absolute;
    top: 18px;
    right: 18px;
    min-width: 46px;
    width: 46px;
    height: 46px;
    padding: 0;
    font-size: 30px;
    line-height: 1;
}

.chat-media-preview-nav[hidden] {
    display: none !important;
}

.chat-media-preview-meta {
    grid-column: 1 / -1;
    display: grid;
    gap: 4px;
    justify-items: center;
    color: rgba(255, 255, 255, 0.92);
    text-align: center;
}

.chat-media-preview-meta strong {
    font-size: 16px;
    font-weight: 600;
}

.chat-media-preview-meta span {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
}

.version-box p,
.update-notes p {
    margin: 6px 0;
}

.update-notes {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.invite-item p {
    margin: 6px 0 0;
    word-break: break-all;
    color: var(--muted);
}

.copy-row input {
    flex: 1;
}

.layout-grid {
    margin-top: 20px;
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding-bottom: 12px;
}

.account-shell {
    margin-top: 16px;
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 16px;
    min-height: 0;
    flex: 1;
    overflow: hidden;
}

.account-sidebar {
    min-height: 0;
}

.account-sidebar-card {
    position: sticky;
    top: 12px;
    display: grid;
    gap: 10px;
    padding: 16px 16px 14px;
}

.account-sidebar-header h2 {
    margin: 0;
    font-size: 16px;
    line-height: 1.2;
}

.account-nav {
    display: grid;
    gap: 8px;
}

.account-nav-link {
    display: flex;
    align-items: center;
    min-height: 38px;
    padding: 9px 12px;
    border-radius: 12px;
    color: #426252;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(85, 118, 101, 0.12);
    box-shadow: 0 6px 14px rgba(34, 63, 49, 0.05);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.account-nav-link:hover {
    transform: translateY(-1px);
    color: #1f4232;
    background: rgba(244, 251, 247, 0.96);
    border-color: rgba(77, 131, 105, 0.22);
    box-shadow: 0 10px 20px rgba(34, 63, 49, 0.08);
}

.account-nav-link.is-active {
    background: linear-gradient(135deg, rgba(94, 177, 123, 0.14), rgba(255, 255, 255, 0.94));
    color: #1b6c43;
    border-color: rgba(74, 166, 109, 0.28);
    box-shadow: 0 8px 20px rgba(54, 125, 82, 0.1);
}

.account-content {
    min-width: 0;
    min-height: 0;
    display: grid;
    gap: 16px;
    align-content: start;
}

.profile-grid {
    align-items: start;
}

.profile-identity {
    display: flex;
    gap: 18px;
    align-items: center;
}

.profile-avatar-form,
.profile-background-form {
    margin: 0;
}

.profile-avatar-trigger,
.profile-background-trigger {
    display: grid;
    gap: 10px;
    justify-items: center;
    cursor: pointer;
    color: var(--muted);
}

.profile-avatar-large {
    width: 64px;
    height: 64px;
}

.profile-avatar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
}

.avatar-choice {
    display: grid;
    gap: 8px;
    justify-items: center;
    text-align: center;
    padding: 12px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.55);
}

.quick-avatar-form {
    margin: 0;
}

.avatar-choice-button {
    display: grid;
    gap: 8px;
    justify-items: center;
    text-align: center;
    padding: 12px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.55);
    color: var(--text);
}

.avatar-choice-button.is-active {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.avatar-choice img {
    width: 52px;
    height: 52px;
    border-radius: 50%;
}

.profile-background-preview {
    width: min(100%, 360px);
    aspect-ratio: 16 / 9;
    border-radius: 22px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.58);
    background-size: 100% auto;
    background-position: center;
    background-repeat: no-repeat;
    display: grid;
    place-items: center;
    text-align: center;
    padding: 18px;
    color: var(--muted);
    position: relative;
    overflow: hidden;
    isolation: isolate;
}

.profile-background-preview > * {
    position: relative;
    z-index: 1;
}

.profile-background-preview.is-default {
    background:
        radial-gradient(circle at 18% 22%, rgba(255, 220, 204, 0.64), transparent 34%),
        radial-gradient(circle at 80% 20%, rgba(255, 241, 198, 0.54), transparent 28%),
        radial-gradient(circle at 50% 82%, rgba(206, 234, 222, 0.48), transparent 34%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.58), rgba(249, 243, 238, 0.42));
}

.profile-background-preview.is-default::before,
.profile-background-preview.is-default::after {
    content: "";
    position: absolute;
    inset: -14%;
    pointer-events: none;
    z-index: 0;
}

.profile-background-preview.is-default::before {
    background:
        radial-gradient(circle at 24% 32%, rgba(255, 210, 193, 0.76), transparent 26%),
        radial-gradient(circle at 74% 24%, rgba(255, 236, 184, 0.72), transparent 24%),
        radial-gradient(circle at 54% 76%, rgba(197, 229, 217, 0.6), transparent 28%);
    filter: blur(26px);
    animation: cocoonWarmFloat 16s ease-in-out infinite alternate;
}

.profile-background-preview.is-default::after {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0.08));
    backdrop-filter: blur(8px);
}

.profile-return-bar {
    position: fixed;
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%);
    z-index: 25;
    display: flex;
    justify-content: center;
    width: min(100%, 420px);
    padding: 0 16px calc(env(safe-area-inset-bottom, 0px));
}

.profile-return-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 160px;
    padding: 12px 18px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    box-shadow: var(--shadow);
    gap: 6px;
}

.profile-return-button::before {
    content: '<';
    font-size: 16px;
    line-height: 1;
}

.storage-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
}

.storage-card {
    display: grid;
    gap: 10px;
}

.hero-card {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.92), var(--accent-soft));
}

.stats {
    flex-wrap: wrap;
    margin-top: 18px;
}

.stats div {
    min-width: 120px;
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.55);
}

.stats strong {
    display: block;
    font-size: 28px;
}

.alert,
.inline-error {
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: 16px;
}

.alert-success {
    background: rgba(47, 125, 87, 0.12);
    color: var(--success);
}

.alert-error,
.inline-error {
    background: rgba(180, 71, 71, 0.12);
    color: var(--error);
}

.admin-links-column {
    display: grid;
    gap: 12px;
}

.admin-message-toolbar {
    align-items: flex-start;
}

.admin-message-count {
    min-width: 110px;
    text-align: right;
    color: var(--muted);
}

.admin-message-count strong {
    display: block;
    font-size: 28px;
    color: var(--text);
}

.admin-message-filter,
.admin-message-edit-form,
.admin-message-delete-form,
.admin-message-pagination,
.admin-message-user,
.admin-message-head {
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-message-filter {
    margin-top: 16px;
}

.admin-message-filter input {
    flex: 1;
}

.admin-message-filter button {
    width: auto;
    min-width: 96px;
}

.visitor-page-size-select {
    width: auto;
    min-width: 112px;
    background: rgba(255, 255, 255, 0.88);
}

.visitor-records-shell .account-content {
    min-height: 0;
    overflow: hidden;
}

.visitor-records-card {
    min-height: 0;
    height: 100%;
    display: grid;
    grid-template-rows: auto auto auto minmax(0, 1fr) auto;
}

.admin-message-list {
    display: grid;
    gap: 14px;
    margin-top: 18px;
}

.visitor-log-list {
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 6px;
}

.admin-message-card {
    padding: 16px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid var(--border);
    display: grid;
    gap: 12px;
}

.admin-message-head {
    justify-content: space-between;
}

.admin-message-user {
    align-items: flex-start;
}

.admin-message-user p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.admin-message-preview {
    background: rgba(255, 255, 255, 0.9);
}

.admin-message-actions {
    display: grid;
    gap: 10px;
}

.admin-message-edit-form {
    align-items: flex-end;
}

.admin-message-edit-form textarea {
    flex: 1;
    min-height: 96px;
}

.admin-message-edit-form button,
.danger-button {
    width: auto;
    min-width: 120px;
}

.danger-button {
    background: #d65353;
}

.admin-message-pagination {
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.admin-message-pagination a {
    display: inline-flex;
    align-items: center;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid var(--border);
    color: var(--text);
}

.pagination-disabled {
    display: inline-flex;
    align-items: center;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(243, 243, 243, 0.88);
    border: 1px solid var(--border);
    color: var(--muted);
}

.visitor-log-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 16px;
}

.visitor-log-grid strong {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
}

.visitor-log-grid p {
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
    word-break: break-word;
}

.visitor-log-full {
    grid-column: 1 / -1;
}

.visitor-log-details {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.75);
    padding: 10px 12px;
}

.visitor-log-details summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--text);
    list-style: none;
}

.visitor-log-details summary::-webkit-details-marker {
    display: none;
}

.visitor-log-details summary::after {
    content: '展开';
    float: right;
    font-size: 12px;
    color: var(--accent);
}

.visitor-log-details[open] summary::after {
    content: '收起';
}

.visitor-log-details p {
    margin-top: 10px;
}

.table-wrap {
    overflow-x: auto;
    margin-top: 18px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    text-align: left;
    padding: 12px;
    border-bottom: 1px solid var(--border);
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 12px;
}

.site-footer {
    margin-top: 10px;
    text-align: center;
    color: var(--muted);
    padding-bottom: 6px;
}

.site-footer p {
    margin: 4px 0;
}

.bottom-nav {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: 0;
    width: min(1240px, 100%);
    padding: 8px 14px calc(8px + env(safe-area-inset-bottom, 0px));
    display: none;
    justify-content: center;
    gap: 10px;
    background: rgba(248, 248, 248, 0.95);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    backdrop-filter: blur(14px);
    z-index: 30;
}

.bottom-nav a {
    flex: 1;
    max-width: 140px;
    text-align: center;
    padding: 9px 8px;
    border-radius: 12px;
    color: var(--muted);
    font-weight: 600;
    font-size: 13px;
    line-height: 1.1;
}

.bottom-nav a.is-active {
    background: var(--accent-soft);
    color: var(--accent);
}

.settings-shell {
    margin-top: 16px;
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 16px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.settings-tabs {
    display: grid;
    gap: 10px;
    align-content: start;
}

.settings-tab {
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.58);
    color: var(--muted);
    border: 1px solid var(--border);
}

.settings-tab.is-active {
    background: var(--accent-soft);
    color: var(--accent);
}

.settings-panel {
    min-height: 0;
    overflow: auto;
}

.settings-card {
    min-height: 100%;
}

.compact-form {
    margin-top: 14px;
}

@media (max-width: 900px) {
    .page-shell {
        padding: 14px;
    }

    .chat-panel {
        min-height: calc(100vh - 170px);
        padding: 16px 14px 12px;
        border-radius: 22px;
    }

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

    .chat-media-preview-dialog {
        padding: 24px 14px 18px;
        gap: 10px;
    }

    .chat-media-preview-close {
        top: 12px;
        right: 12px;
    }
}

@media (max-width: 640px) {
    html,
    body,
    .app-frame {
        height: 100dvh;
        overflow: hidden;
    }

    body.page-dashboard {
        position: fixed;
        inset: 0;
        width: 100%;
        height: 100dvh;
        overflow: hidden;
    }

    body.page-install {
        position: static;
        width: auto;
        height: auto;
        overflow-y: auto;
    }

    body {
        background: linear-gradient(180deg, var(--bg), #f9f6f2);
    }

    .page-shell {
        padding: 0;
        height: 100dvh;
        min-height: 100dvh;
    }

    .install-page-shell {
        padding: 16px;
        height: auto;
        min-height: 100dvh;
    }

    .page-dashboard .page-shell {
        position: fixed;
        inset: 0;
        width: 100%;
        max-width: none;
        margin: 0;
        padding: 0;
        overflow: hidden;
        display: block;
    }

    .page-login .page-shell {
        padding: 0 16px;
    }

    .page-join .page-shell {
        padding: 0 16px;
    }

    .page-login .chat-shell.login-shell {
        margin-top: 0;
        min-height: calc(100dvh - 32px);
        align-items: center;
        justify-content: center;
    }

    .page-join .chat-shell.login-shell {
        margin-top: 0;
        min-height: calc(100dvh - 32px);
        align-items: center;
        justify-content: center;
    }

    .page-login .login-panel {
        border-radius: 24px;
        padding: 18px 16px 18px;
    }

    .page-join .login-panel {
        border-radius: 24px;
        padding: 18px 16px 18px;
    }

    .site-header,
    .chat-panel,
    .card {
        border-radius: 0;
        border-left: none;
        border-right: none;
        box-shadow: none;
    }

    .site-header,
    .card,
    .chat-panel {
        padding-left: 16px;
        padding-right: 16px;
    }

    .site-header,
    .chat-panel-header,
    .composer-bar,
    .invite-item,
    .copy-row,
    .stats {
        flex-direction: column;
        align-items: stretch;
    }

    .chat-panel {
        min-height: calc(100vh - 124px);
    }

    .chat-media-preview-dialog {
        grid-template-columns: 1fr;
        grid-template-rows: auto minmax(0, 1fr) auto auto;
        padding: 16px 12px 14px;
        gap: 10px;
    }

    .chat-media-preview-close {
        top: 10px;
        right: 10px;
        width: 40px;
        min-width: 40px;
        height: 40px;
        font-size: 26px;
    }

    .chat-media-preview-nav {
        min-width: 0;
        width: 100%;
        padding: 10px 14px;
    }

    .chat-media-preview-nav.is-prev {
        order: 3;
    }

    .chat-media-preview-nav.is-next {
        order: 4;
    }

    .chat-media-preview-stage {
        order: 2;
    }

    .chat-media-preview-meta {
        order: 5;
    }

    .chat-media-preview-image,
    .chat-media-preview-video {
        max-width: 100%;
        max-height: calc(100dvh - 200px);
        border-radius: 14px;
    }

    .page-dashboard .site-header {
        display: none;
    }

    .page-dashboard .chat-shell {
        position: absolute;
        inset: 0;
        margin-top: 0;
        overflow: hidden;
        min-height: 0;
    }

    .page-dashboard .chat-panel {
        height: 100%;
        min-height: 100%;
        width: 100%;
        padding-top: 8px;
        padding-bottom: 0;
        display: grid;
        grid-template-rows: auto minmax(0, 1fr) auto;
        gap: 0;
    }

    .page-dashboard .chat-panel-header {
        flex-direction: row;
        align-items: center;
        padding: 8px 10px;
        gap: 8px;
    }

    .page-dashboard .chat-title-block {
        flex: 1;
        text-align: center;
        padding-left: 40px;
    }

    .page-dashboard .chat-title-block h2 {
        font-size: 18px;
    }

    .page-dashboard .chat-panel-actions {
        width: auto;
        gap: 8px;
    }

    .page-dashboard .search-trigger {
        min-width: 78px;
        padding: 8px 12px;
        font-size: 12px;
    }

    .page-dashboard .chat-summary {
        display: block;
        min-width: 44px;
        text-align: center;
    }

    .page-dashboard .profile-shortcut {
        padding: 6px 10px;
        font-size: 12px;
    }

    .page-dashboard .chat-stream {
        margin-top: 8px;
        min-height: 0;
        height: 100%;
        overflow-y: auto;
        overflow-x: hidden;
        overscroll-behavior: contain;
        touch-action: pan-y;
        padding-bottom: 10px;
    }

    .page-dashboard .chat-composer {
        margin-top: 0;
        padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
        background: rgba(236, 239, 238, 0.72);
        flex-shrink: 0;
        border-radius: 18px 18px 0 0;
    }

    .page-dashboard .site-footer {
        display: none;
    }

    .page-dashboard .alert {
        display: none;
    }

    .site-footer {
        display: none;
    }

    .chat-bubble-wrap {
        max-width: calc(100% - 46px);
    }

    .chat-sender {
        width: 44px;
        gap: 4px;
    }

    .chat-sender-name {
        font-size: 11px;
    }

    .chat-input-wrap {
        grid-template-columns: minmax(0, 1fr) 36px 36px 58px;
    }

    .composer-status,
    .profile-identity {
        flex-direction: column;
        align-items: flex-start;
    }

    .profile-background-preview {
        width: 100%;
    }

    .composer-shortcut {
        min-width: 52px;
        font-size: 12px;
        padding: 0 8px;
    }

    .emoji-option,
    .emoji-trigger {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }

    .emoji-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }

    .chat-summary strong {
        font-size: 12px;
        line-height: 1.05;
    }

    .chat-summary span {
        display: block;
        font-size: 9px;
        line-height: 1.1;
        margin-top: 2px;
    }

    .chat-search-panel {
        top: 0;
        right: 0;
        bottom: 0;
        width: min(100%, 360px);
        border-radius: 18px 0 0 18px;
    }

    .chat-search-body {
        padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    }

    .composer-send-bubble {
        min-width: 68px;
        height: 36px;
        padding: 0 14px;
    }

    .profile-return-bar {
        bottom: 12px;
        padding: 0 16px calc(env(safe-area-inset-bottom, 0px));
        background: transparent;
    }

    .profile-return-button {
        width: min(220px, 100%);
    }

    .chat-panel-actions {
        width: 100%;
        justify-content: space-between;
    }

    .layout-grid {
        grid-template-columns: 1fr;
        gap: 0;
        margin-top: 0;
    }

    .account-shell {
        grid-template-columns: 1fr;
        gap: 10px;
        margin-top: 0;
        overflow: auto;
    }

    .account-sidebar-card {
        position: static;
        gap: 8px;
        padding: 10px 12px;
    }

    .account-sidebar-header h2 {
        font-size: 14px;
    }

    .account-nav {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
        overflow: visible;
    }

    .account-nav-link {
        min-height: 34px;
        padding: 7px 6px;
        justify-content: center;
        text-align: center;
        white-space: normal;
        font-size: 12px;
        line-height: 1.2;
        border-radius: 10px;
    }

    .settings-shell {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .admin-message-filter,
    .admin-message-edit-form,
    .admin-message-pagination,
    .admin-message-head {
        flex-direction: column;
        align-items: stretch;
    }

    .admin-message-count {
        text-align: left;
    }

    .admin-message-edit-form button,
    .danger-button,
    .admin-message-filter button {
        width: 100%;
    }

    .visitor-log-grid {
        grid-template-columns: 1fr;
    }

    .visitor-log-list {
        max-height: none;
        overflow-y: auto;
        padding-right: 0;
    }

    .settings-tabs {
        display: flex;
        overflow: auto;
    }

    .settings-tab {
        white-space: nowrap;
    }

    .bottom-nav {
        height: var(--mobile-nav-height);
        width: calc(100% - 20px);
        bottom: calc(env(safe-area-inset-bottom, 0px) + var(--mobile-nav-offset));
        gap: 6px;
        padding-top: 5px;
        padding-left: 10px;
        padding-right: 10px;
        padding-bottom: 5px;
        border: 1px solid rgba(0, 0, 0, 0.06);
        border-radius: 16px;
        box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
    }

.bottom-nav a {
        max-width: 120px;
        padding: 8px 6px;
        border-radius: 10px;
        font-size: 12px;
    }
}

body.page-kb,
body.page-kb-article {
    overflow-x: hidden;
    overflow-y: auto;
}

body.page-kb .page-shell,
body.page-kb-article .page-shell {
    height: auto;
    min-height: 100vh;
    padding-bottom: 120px;
}

.knowledge-shell {
    margin-top: 16px;
    display: grid;
    gap: 16px;
}

.knowledge-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(320px, .9fr);
    gap: 16px;
}

.knowledge-main,
.knowledge-side {
    display: grid;
    gap: 16px;
    align-content: start;
}

.knowledge-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(360px, .9fr);
    gap: 18px;
    padding: 28px;
    background:
        radial-gradient(circle at top left, rgba(255, 200, 142, 0.36), transparent 34%),
        linear-gradient(135deg, rgba(255, 248, 240, 0.98), rgba(255, 237, 218, 0.94));
}

.knowledge-hero-copy {
    display: grid;
    gap: 14px;
}

.knowledge-hero-copy h2,
.knowledge-section h3,
.knowledge-article-shell h2 {
    margin: 0;
    font-size: 32px;
    line-height: 1.15;
}

.knowledge-hero-text,
.section-subtitle,
.knowledge-side-text,
.knowledge-article-summary,
.knowledge-category-card p,
.knowledge-article-card p,
.knowledge-featured-item p {
    margin: 0;
    color: #2f2f2f;
    line-height: 1.7;
    font-size: 14px;
}

.knowledge-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.knowledge-stat-grid div {
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.74);
    border: 1px solid rgba(246, 122, 19, 0.12);
}

.knowledge-stat-grid strong {
    display: block;
    font-size: 28px;
    color: var(--text);
}

.knowledge-search-card {
    display: grid;
    gap: 10px;
    padding: 18px;
    border-radius: 24px;
    background: linear-gradient(180deg, #f67a13, #ff952f);
    color: #fff;
    box-shadow: 0 16px 32px rgba(246, 122, 19, 0.22);
}

.knowledge-search-form,
.knowledge-chat-search-form {
    display: grid;
    gap: 10px;
}

.knowledge-search-form input,
.knowledge-search-form select,
.knowledge-chat-search-form input {
    background: rgba(255, 255, 255, 0.96);
    color: #171717;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.knowledge-search-form button,
.knowledge-chat-search-form button,
.knowledge-primary-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    border-radius: 16px;
    background: #171717;
    color: #fff;
    padding: 0 16px;
    width: auto;
}

.knowledge-search-hint {
    font-size: 13px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.88);
}

.knowledge-section,
.knowledge-side-card,
.knowledge-article-shell {
    display: grid;
    gap: 18px;
}

.knowledge-category-grid,
.knowledge-article-list,
.knowledge-featured-list,
.knowledge-chat-search-results {
    display: grid;
    gap: 14px;
}

.knowledge-category-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.knowledge-category-card,
.knowledge-article-card,
.knowledge-featured-item,
.knowledge-chat-result-card {
    display: grid;
    gap: 10px;
    padding: 18px;
    border-radius: 22px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.78);
}

.knowledge-featured-item {
    color: inherit;
}

.knowledge-category-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 54px;
    height: 54px;
    border-radius: 18px;
    background: rgba(246, 122, 19, 0.12);
    color: var(--accent);
    font-weight: 700;
    text-transform: uppercase;
}

.knowledge-category-card h4,
.knowledge-article-card h4,
.knowledge-featured-item strong {
    margin: 0;
    font-size: 20px;
    line-height: 1.35;
    color: var(--text);
}

.knowledge-category-meta,
.knowledge-article-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
    color: #2f2f2f;
}

.knowledge-article-category {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: fit-content;
    min-height: 30px;
    padding: 0 12px;
    border-radius: 999px;
    background: rgba(246, 122, 19, 0.12);
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
}

.knowledge-article-shell {
    padding: 24px;
}

.knowledge-article-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.knowledge-article-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.knowledge-article-body {
    display: grid;
    gap: 16px;
    line-height: 1.8;
    color: #171717;
}

.knowledge-article-body p,
.knowledge-article-body ul,
.knowledge-article-body ol {
    margin: 0;
}

.knowledge-back-link {
    display: inline-flex;
    margin-bottom: 12px;
    color: #2f2f2f;
}

@media (max-width: 900px) {
    .knowledge-layout,
    .knowledge-hero {
        grid-template-columns: 1fr;
    }

    .knowledge-stat-grid,
    .knowledge-category-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    body.page-kb .page-shell,
    body.page-kb-article .page-shell {
        padding-bottom: 100px;
    }

    .knowledge-hero,
    .knowledge-section,
    .knowledge-side-card,
    .knowledge-article-shell {
        padding: 18px;
        border-radius: 22px;
    }

    .knowledge-stat-grid,
    .knowledge-category-grid {
        grid-template-columns: 1fr;
    }

    .knowledge-article-header,
    .knowledge-article-meta,
    .knowledge-category-meta {
        flex-direction: column;
        align-items: flex-start;
    }
}

@keyframes cocoonWarmFloat {
    0% {
        transform: translate3d(-2%, -1%, 0) scale(1);
    }

    50% {
        transform: translate3d(2%, 2%, 0) scale(1.04);
    }

    100% {
        transform: translate3d(-1%, 3%, 0) scale(0.98);
    }
}

.site-header {
    padding: 14px 20px;
    gap: 16px;
}

.header-brand h1 {
    margin: 0;
    font-size: 24px;
    line-height: 1.1;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    justify-content: center;
}

.header-nav a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 14px;
    border-radius: 999px;
    color: var(--muted);
    border: 1px solid transparent;
}

.header-nav a.is-active {
    color: var(--accent);
    background: var(--accent-soft);
    border-color: rgba(246, 122, 19, 0.15);
}

.knowledge-article-meta-row,
.content-admin-meta,
.content-admin-actions,
.content-filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.portal-module-grid,
.knowledge-dynamic-list {
    display: grid;
    gap: 14px;
}

.portal-module-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.portal-module-card,
.knowledge-dynamic-item {
    display: grid;
    gap: 10px;
    padding: 18px;
    border-radius: 22px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.78);
    color: var(--text);
}

.portal-module-card strong,
.knowledge-dynamic-item strong {
    font-size: 18px;
}

.portal-module-card p,
.knowledge-dynamic-item p {
    margin: 0;
    color: var(--muted);
    line-height: 1.65;
}

.portal-module-card span,
.knowledge-dynamic-item span,
.knowledge-article-publisher {
    font-size: 12px;
    color: var(--muted);
}

.content-admin-layout {
    margin-top: 16px;
    display: grid;
    grid-template-columns: minmax(360px, 0.95fr) minmax(0, 1.25fr);
    gap: 16px;
}

.content-editor-card,
.content-list-card,
.content-admin-list,
.content-admin-item,
.content-editor-form {
    display: grid;
    gap: 16px;
}

.content-admin-item {
    padding: 18px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid var(--border);
}

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

.content-admin-head h4 {
    margin: 10px 0 8px;
    font-size: 20px;
}

.content-admin-head p {
    margin: 0;
    color: var(--muted);
    line-height: 1.7;
}

.content-admin-actions form,
.content-admin-actions a {
    width: auto;
}

.content-admin-actions button,
.content-filter-bar button {
    width: auto;
}

.content-status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 0 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.status-published {
    color: #0f6c3d;
    background: rgba(30, 172, 101, 0.12);
}

.status-draft {
    color: #9a5700;
    background: rgba(246, 122, 19, 0.14);
}

.status-archived {
    color: #5c6370;
    background: rgba(92, 99, 112, 0.12);
}

@media (max-width: 900px) {
    .content-admin-layout,
    .portal-module-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .header-nav {
        display: none;
    }

    .content-admin-head,
    .content-admin-meta,
    .content-admin-actions,
    .content-filter-bar,
    .knowledge-article-meta-row {
        flex-direction: column;
        align-items: flex-start;
    }
}

body.page-kb {
    background: #fbfbfb;
}

body.page-kb .page-shell {
    max-width: 1920px;
    padding: 0 0 110px;
}

.site-header-knowledge {
    margin-top: 0;
    padding: 8px 28px;
    border-radius: 0;
    background: #ffffff;
    box-shadow: none;
    border: none;
}

.site-header-knowledge .header-brand .eyebrow {
    margin-bottom: 4px;
    color: #6b7280;
}

.site-header-knowledge .header-brand h1 {
    font-size: 18px;
    font-weight: 700;
    color: #f67a13;
}

.site-header-knowledge .header-nav a {
    min-height: 32px;
    padding: 0 12px;
    color: #475569;
    font-size: 14px;
}

.site-header-knowledge .header-nav a.is-active {
    background: rgba(246, 122, 19, 0.12);
    color: #f67a13;
}

.knowledge-home-shell {
    gap: 34px;
}

@media (max-width: 640px) {
    .global-home-button {
        left: 12px;
        right: 12px;
        bottom: calc(76px + env(safe-area-inset-bottom, 0px));
    }
}

.knowledge-reference-hero {
    padding: 0 0 10px;
}

.knowledge-reference-banner {
    margin: 0 auto;
    width: calc(100% - 20px);
    min-height: 280px;
    padding: 92px 24px 56px;
    border-radius: 24px;
    background: linear-gradient(180deg, #ff7e08 0%, #ff7a00 100%);
    box-shadow: 0 24px 50px rgba(246, 122, 19, 0.28);
    text-align: center;
}

.knowledge-reference-banner h2 {
    margin: 0 0 22px;
    color: #fff;
    font-size: 34px;
    font-weight: 500;
}

.knowledge-reference-search {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 72px;
    gap: 0;
    width: min(560px, 100%);
    margin: 0 auto;
    padding: 0;
    border-radius: 0;
    background: #fff;
    overflow: hidden;
}

.knowledge-reference-search input {
    min-height: 48px;
    border: none;
    border-radius: 0;
    background: #fff;
    padding: 0 16px;
}

.knowledge-reference-search button {
    min-height: 48px;
    border-radius: 0;
    background: #fff;
    color: #3b82f6;
    font-size: 22px;
    font-weight: 400;
}

.knowledge-reference-section {
    width: min(1100px, calc(100% - 48px));
    margin: 0 auto;
    display: grid;
    gap: 20px;
}

.knowledge-reference-heading h3 {
    margin: 0;
    font-size: 20px;
    color: #111827;
}

.knowledge-reference-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 26px 40px;
}

.knowledge-reference-card {
    display: grid;
    gap: 16px;
    min-height: 252px;
    padding: 22px 20px 18px;
    border-radius: 0;
    background: #fff;
    border: 1px solid #eef2f7;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

.knowledge-reference-card-head {
    display: flex;
    align-items: center;
    gap: 10px;
}

.knowledge-reference-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    font-size: 24px;
}

.knowledge-reference-card h4 {
    margin: 0;
    font-size: 17px;
    color: #ff7a00;
}

.knowledge-reference-list {
    margin: 0;
    padding-left: 18px;
    display: grid;
    gap: 10px;
    color: #111827;
    font-size: 14px;
    line-height: 1.65;
}

.knowledge-reference-list li a {
    color: #1f2937;
}

.knowledge-reference-more {
    margin-top: auto;
}

.knowledge-reference-more a {
    color: #2563eb;
    font-size: 14px;
    font-weight: 600;
}

.knowledge-detail-layout {
    width: min(1180px, calc(100% - 48px));
    margin: 0 auto;
    display: grid;
    grid-template-columns: 224px minmax(0, 1fr);
    gap: 48px;
    align-items: start;
}

.knowledge-detail-sidebar {
    min-height: 100%;
    padding-right: 6px;
    border-right: 1px solid #e5e7eb;
}

.knowledge-detail-side-current {
    margin-bottom: 14px;
    background: #fff;
    box-shadow: 0 14px 36px rgba(246, 122, 19, 0.12);
}

.knowledge-detail-side-title {
    min-height: 34px;
    padding: 0 14px;
    display: flex;
    align-items: center;
    background: #ff7a00;
    color: #fff;
    font-size: 14px;
}

.knowledge-detail-side-list {
    display: grid;
    gap: 2px;
    padding: 0 0 8px;
    background: #fff;
}

.knowledge-detail-side-link,
.knowledge-detail-group-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 30px;
    padding: 0 16px;
    color: #ff7a00;
    font-size: 14px;
}

.knowledge-detail-side-link.is-active {
    margin: 4px 8px;
    padding: 0 12px;
    border-radius: 6px;
    background: linear-gradient(180deg, #ffab4d, #ff8c24);
    color: #fff;
}

.knowledge-detail-side-groups {
    display: grid;
    gap: 4px;
}

.knowledge-detail-main {
    display: grid;
    gap: 22px;
}

.knowledge-detail-head h2 {
    margin: 0;
    font-size: 28px;
    color: #111827;
}

.knowledge-detail-body {
    min-height: 480px;
    line-height: 1.8;
    color: #1f2937;
    font-size: 15px;
    background: #fff;
    border: 1px solid rgba(244, 114, 28, 0.14);
    border-radius: 18px;
    padding: 28px 32px;
    box-shadow: 0 22px 60px rgba(15, 23, 42, 0.06);
}

.knowledge-detail-body > *:first-child {
    margin-top: 0;
}

.knowledge-detail-body > *:last-child {
    margin-bottom: 0;
}

.knowledge-detail-body p,
.knowledge-detail-body li {
    line-height: 1.9;
}

.knowledge-detail-body p {
    margin: 0 0 16px;
}

.knowledge-detail-body h1,
.knowledge-detail-body h2,
.knowledge-detail-body h3,
.knowledge-detail-body h4 {
    margin: 28px 0 12px;
    color: #111827;
    line-height: 1.45;
}

.knowledge-detail-body ul,
.knowledge-detail-body ol {
    margin: 0 0 18px 24px;
    padding: 0;
}

.knowledge-detail-body a {
    color: #ea580c;
    text-decoration: none;
    border-bottom: 1px solid rgba(234, 88, 12, 0.22);
}

.knowledge-detail-body img,
.knowledge-detail-body table {
    max-width: 100%;
}

.knowledge-detail-body img {
    display: block;
    margin: 18px auto;
    border-radius: 14px;
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.12);
}

.knowledge-detail-body table {
    border-collapse: collapse;
}

.knowledge-detail-body td,
.knowledge-detail-body th {
    border: 1px solid #fed7aa;
    padding: 10px 12px;
}

.knowledge-detail-file {
    margin-top: 18px;
    padding: 14px 18px;
    background: linear-gradient(135deg, rgba(255, 247, 237, 0.96), rgba(255, 237, 213, 0.85));
    border: 1px solid rgba(251, 146, 60, 0.2);
    border-radius: 14px;
}

.knowledge-detail-file a {
    color: #ff7a00;
    font-size: 14px;
    font-weight: 600;
}

.knowledge-detail-feedback {
    display: grid;
    justify-items: center;
    gap: 10px;
    padding: 20px 0 4px;
    border-top: 1px solid #eceff3;
    border-bottom: 1px solid #eceff3;
}

.knowledge-detail-feedback p {
    margin: 0;
    color: #111827;
    font-size: 14px;
}

.knowledge-detail-feedback-actions {
    display: flex;
    gap: 10px;
}

.knowledge-detail-feedback-actions button {
    width: auto;
    min-width: 64px;
    min-height: 28px;
    padding: 0 16px;
    border-radius: 2px;
    background: #fff;
    border: 1px solid #3b82f6;
    color: #2563eb;
}

.knowledge-detail-feedback a {
    color: #2563eb;
    font-size: 13px;
}

.knowledge-detail-pagination {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 18px;
}

.knowledge-detail-page-card {
    min-height: 78px;
    padding: 14px 18px;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    background: #fff;
    display: grid;
    gap: 8px;
}

.knowledge-detail-page-card span {
    color: #9ca3af;
    font-size: 13px;
}

.knowledge-detail-page-card a,
.knowledge-detail-page-card strong {
    color: #111827;
    font-size: 15px;
    font-weight: 600;
}

.knowledge-detail-page-card.is-next {
    text-align: right;
}

.knowledge-detail-meta-bottom {
    color: #9ca3af;
    font-size: 13px;
    padding-bottom: 24px;
}

.knowledge-home-stats,
.knowledge-home-section,
.knowledge-home-heading,
.knowledge-home-categories,
.knowledge-home-category,
.knowledge-home-category-icon,
.knowledge-home-category-copy,
.knowledge-home-featured,
.knowledge-home-featured-item,
.knowledge-home-recent,
.knowledge-home-recent-item,
.knowledge-home-date,
.knowledge-home-tools,
.knowledge-home-tool,
.knowledge-home-dynamics,
.knowledge-home-dynamic-item {
    display: none;
}

@media (max-width: 960px) {
    .knowledge-reference-grid {
        grid-template-columns: 1fr;
    }

    .knowledge-reference-section {
        width: calc(100% - 24px);
    }

    .knowledge-detail-layout,
    .knowledge-detail-pagination {
        grid-template-columns: 1fr;
    }

    .knowledge-detail-sidebar {
        border-right: none;
        padding-right: 0;
    }

    .knowledge-detail-body {
        padding: 22px 18px;
    }
}

@media (max-width: 640px) {
    body.page-kb .page-shell {
        padding-bottom: 90px;
    }

    .site-header-knowledge {
        padding: 10px 14px;
    }

    .knowledge-reference-banner {
        width: calc(100% - 12px);
        min-height: 220px;
        padding: 70px 16px 42px;
        border-radius: 20px;
    }

    .knowledge-reference-banner h2 {
        font-size: 28px;
    }

    .knowledge-reference-search {
        width: 100%;
    }
}

