/*
Template Name: 半梦黑金V2
Thumbnail: 01.jpg
*/
:root {
    --app-height: 100vh;

    --color-bg-device: #050505;
    --color-bg-panel: rgba(17, 17, 21, .84);
    --color-bg-overlay: rgba(255, 255, 255, .065);
    --color-bg-mask: rgba(0, 0, 0, .58);

    --color-border: rgba(212, 175, 55, .2);
    --color-primary-border: rgba(212, 175, 55, .32);
    --color-primary: #d4af37;
    --color-primary-light: #f7d774;

    --color-text-main: #f7f0d2;
    --color-text-primary: rgba(247, 240, 210, .78);
    --color-text-muted: rgba(247, 240, 210, .48);

    --color-shadow-primary: rgba(212, 175, 55, .24);
    --color-shadow-soft: rgba(0, 0, 0, .42);
    --color-danger: #fa5151;

    --primary: var(--color-primary);
    --text-main: var(--color-text-main);
    --bg-panel: var(--color-bg-panel);
    --glass-border: var(--color-border);
}

* {
    -webkit-tap-highlight-color: transparent;
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
    background: #050505;
    color: var(--color-text-main);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
    background:
        radial-gradient(circle at 50% -10%, rgba(212, 175, 55, .18), transparent 30%),
        #050505;
    -webkit-user-select: none;
    user-select: none;
}
button,
textarea,
input {
    font: inherit;
}
textarea,
input {
    -webkit-user-select: text;
    user-select: text;
}

button {
    border: 0;
    cursor: pointer;
}

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

.hidden {
    display: none !important;
}

.ios-device #system-status-bar {
    display: none !important;
    height: 0 !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
}

.ambient-glow {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 50% 8%, rgba(212, 175, 55, .12), transparent 34%),
        linear-gradient(to bottom, rgba(255, 255, 255, .025), transparent 32%);
    z-index: 0;
}

.glass-panel {
    background: rgba(17, 17, 21, .94);
    border: 1px solid var(--color-border);
    box-shadow: 0 8px 18px rgba(0, 0, 0, .28);
}

.soft-panel {
    background: rgba(255, 255, 255, .07);
    border: 1px solid rgba(255, 255, 255, .09);
}

.gold-text {
    color: var(--color-primary-light);
    text-shadow: 0 0 14px rgba(212, 175, 55, .18);
}

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

.gold-btn {
    background: linear-gradient(135deg, #f8df82, #b88724 58%, #6b4714);
    color: #120d05;
    box-shadow:
        0 8px 20px rgba(212, 175, 55, .22),
        inset 0 1px 0 rgba(255, 255, 255, .42);
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary-light);
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(212, 175, 55, .18);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
    transition: transform .16s ease, background .16s ease;
}

.icon-btn:active {
    transform: scale(.92);
    background: rgba(212, 175, 55, .14);
}

/* 登录页 */
.login-page {
    position: relative;
    z-index: 5;
    width: 100%;
    min-height: var(--app-height);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    width: min(92vw, 390px);
    border-radius: 32px;
    padding: 30px 24px 24px;
    text-align: center;
}

.login-avatar-wrap {
    width: 96px;
    height: 96px;
    margin: 0 auto 18px;
    padding: 3px;
    border-radius: 32px;
    background: linear-gradient(135deg, rgba(248, 223, 130, .95), rgba(184, 135, 36, .6), rgba(107, 71, 20, .5));
    box-shadow: 0 0 34px rgba(212, 175, 55, .22);
}

.login-avatar {
    width: 100%;
    height: 100%;
    border-radius: 29px;
    object-fit: cover;
    display: block;
}

.login-kicker {
    font-size: 11px;
    letter-spacing: .32em;
    color: var(--color-text-muted);
    font-weight: 800;
}

.login-card h1 {
    margin: 8px 0 8px;
    color: var(--color-primary-light);
    font-size: 28px;
    letter-spacing: .12em;
    text-shadow: 0 0 18px rgba(212, 175, 55, .18);
}

.login-card p {
    margin: 0;
    color: var(--color-text-muted);
    font-size: 13px;
    line-height: 1.8;
}

.login-error {
    margin-top: 16px;
    border-radius: 16px;
    padding: 10px 12px;
    color: #ffd5d5;
    background: rgba(250, 81, 81, .12);
    border: 1px solid rgba(250, 81, 81, .28);
    font-size: 13px;
}

.login-form {
    margin-top: 22px;
}

.login-form input {
    width: 100%;
    height: 48px;
    border-radius: 18px;
    padding: 0 16px;
    outline: none;
    color: var(--color-text-main);
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(255, 255, 255, .1);
}

.login-form input::placeholder {
    color: rgba(247, 240, 210, .35);
}

.login-submit {
    width: 100%;
    height: 48px;
    border-radius: 18px;
    margin-top: 12px;
    font-weight: 900;
    letter-spacing: .08em;
}

/* 主应用 */
#chat-app {
    position: relative;
    z-index: 5;
    width: 100%;
    height: var(--app-height);
    overflow: hidden;
    background: rgba(5, 5, 5, .68);
    display: flex;
    flex-direction: column;
}
.portrait-background {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background-position: center center;
    background-repeat: no-repeat;
    background-size: cover;
    opacity: 0;
    filter: saturate(.95) contrast(1.05);
}
.portrait-background.active {
    opacity: .26;
}

#system-status-bar {
    height: 38px;
    padding: 0 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--color-primary-light);
    font-size: 13px;
    font-weight: 600;
    position: relative;
    z-index: 20;
    pointer-events: none;
    flex-shrink: 0;
}

#chat-header {
    position: relative;
    z-index: 18;
    margin: 4px 14px 0;
    border-radius: 28px;
    padding: 12px;
    flex-shrink: 0;
}

.header-avatar {
    height: 48px;
    width: 48px;
    border-radius: 18px;
    border: 1px solid rgba(212, 175, 55, .4);
    object-fit: cover;
    box-shadow: 0 0 20px rgba(212, 175, 55, .2);
    cursor: pointer;
}

.online-badge {
    border-radius: 999px;
    background: rgba(52, 211, 153, .15);
    padding: 2px 8px;
    color: #6ee7b7;
    font-size: 10px;
    font-weight: 800;
}

.mini-stat-row {
    margin-top: 8px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
}
.stat-card {
    min-width: 0;
    height: 28px;
    border-radius: 999px;
    padding: 0 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
}
.stat-value {
    min-width: 0;
    color: var(--color-primary-light);
    font-weight: 400;
    font-size: 11px;
    line-height: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}
.stat-label {
    flex-shrink: 0;
    color: var(--color-text-muted);
    font-size: 11px;
    line-height: 1;
}

/* 聊天区 */
#chat-history {
    position: relative;
    z-index: 6;
    flex: 1;
    height: auto;
    overflow-y: auto;
    padding: 16px 15px calc(var(--bottom-input-height, 96px) + 18px);
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    contain: layout paint style;
}

#chat-history::-webkit-scrollbar,
.sheet-body::-webkit-scrollbar {
    display: none;
}

.initial-loading {
    text-align: center;
    color: var(--color-text-muted);
    margin-top: 54px;
    font-size: 13px;
}

.loading-orb {
    font-size: 34px;
    margin-bottom: 8px;
    filter: drop-shadow(0 0 14px rgba(212, 175, 55, .25));
}

.empty-hint {
    color: var(--color-text-muted);
    text-align: center;
    font-size: 13px;
    line-height: 1.8;
    padding: 22px 12px;
}

.empty-hint.big {
    margin-top: 54px;
}

.msg-row {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.msg-row.user {
    justify-content: flex-end;
}

.msg-row.ai {
    justify-content: flex-start;
}

.ai-avatar-wrap {
    width: 42px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.ai-avatar-chat {
    width: 42px;
    height: 42px;
    border-radius: 16px;
    object-fit: cover;
    border: 1px solid rgba(212, 175, 55, .38);
}

.ai-badge {
    margin-top: 4px;
    padding: 2px 4px;
    border-radius: 5px;
    background: rgba(255, 255, 255, .08);
    color: var(--color-text-muted);
    font-size: 9px;
    line-height: 1;
    white-space: nowrap;
}

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

.bubble {
    border-radius: 20px;
    padding: 11px 14px;
    font-size: 14px;
    line-height: 1.68;
    word-break: break-word;
}

.msg-row.ai .bubble {
    border-top-left-radius: 6px;
    color: var(--color-text-main);
    background: rgba(17, 17, 21, .9);
    border: 1px solid rgba(212, 175, 55, .15);
}

.msg-row.user .bubble {
    border-top-right-radius: 6px;
    color: #110b03;
    font-weight: 700;
    background: linear-gradient(135deg, #f8df82, #b88724);
}

.bubble p {
    margin: 0 0 8px;
}

.bubble p:last-child {
    margin-bottom: 0;
}

.bubble img {
    max-width: 100%;
    border-radius: 14px;
    display: block;
}

.bubble pre {
    overflow-x: auto;
    border-radius: 14px;
    padding: 12px;
    background: rgba(0, 0, 0, .28);
    border: 1px solid rgba(255, 255, 255, .08);
}

.bubble code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: .9em;
}

.msg-status {
    margin-top: 6px;
    font-size: 11px;
    color: var(--color-text-muted);
}

.msg-row.user .msg-status {
    text-align: right;
}

.msg-actions {
    margin-top: 8px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 11px;
    color: var(--color-text-muted);
}

.action-btn {
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0 10px;
    color: rgba(247, 215, 116, .78);
    background: rgba(255, 255, 255, .045);
    border: 1px solid rgba(212, 175, 55, .12);
}

.suggest-action {
    color: #f7d774 !important;
    font-weight: 800;
}

.system-task {
    justify-content: center;
}

.system-task span {
    display: inline-flex;
    max-width: 86%;
    border-radius: 999px;
    padding: 6px 13px;
    background: rgba(255, 255, 255, .055);
    border: 1px solid rgba(255, 255, 255, .08);
    color: var(--color-text-muted);
    font-size: 11px;
    line-height: 1.5;
}

/* 底部输入栏 */
#bottom-input-bar {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: max(10px, env(safe-area-inset-bottom));
    z-index: 24;
    border-radius: 26px;
    padding: 9px;
}

#quick-status-row {
    display: flex;
    gap: 7px;
    overflow-x: auto;
    padding: 0 1px 8px;
}

#quick-status-row::-webkit-scrollbar {
    display: none;
}

.quick-chip {
    flex-shrink: 0;
    min-height: 28px;
    border-radius: 999px;
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: var(--color-text-primary);
    background: rgba(255, 255, 255, .055);
    border: 1px solid rgba(212, 175, 55, .14);
}

.quick-chip strong {
    color: var(--color-primary-light);
    font-weight: 800;
}

.input-shell {
    display: flex;
    align-items: flex-end;
    gap: 7px;
}

#message-input {
    flex: 1;
    min-height: 40px;
    max-height: 104px;
    resize: none;
    outline: none;
    border-radius: 17px;
    padding: 10px 12px;
    color: var(--color-text-main);
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(255, 255, 255, .1);
    font-size: 14px;
    line-height: 1.45;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

#message-input::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

#message-input::placeholder {
    color: rgba(247, 240, 210, .35);
}

.send-btn {
    width: 40px;
    height: 40px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.send-btn:disabled {
    opacity: .75;
    cursor: not-allowed;
}

/* 图片预览 */
.image-preview {
    width: 84px;
    height: 84px;
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid rgba(212, 175, 55, .24);
    position: relative;
    margin-bottom: 10px;
    display: none;
}

.image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-preview button {
    position: absolute;
    right: 5px;
    top: 5px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(0, 0, 0, .58);
    color: #fff;
    font-size: 12px;
}

/* Sheet 面板 */
.sheet-mask {
    position: absolute;
    inset: 0;
    z-index: 80;
    background: rgba(0, 0, 0, .58);
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease;
}

.sheet-mask.active {
    opacity: 1;
    pointer-events: auto;
}

.bottom-sheet-card {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    max-height: 74%;
    overflow: hidden;
    border-radius: 28px;
    transform: translateY(18px) scale(.97);
    transition: transform .22s ease;
}

.active .bottom-sheet-card {
    transform: translateY(0) scale(1);
}

.sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
}

.sheet-kicker {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .28em;
    color: var(--color-text-muted);
}

.sheet-title {
    margin-top: 4px;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: .12em;
}

.sheet-body {
    max-height: calc(74vh - 88px);
    overflow-y: auto;
    padding: 0 16px 16px;
    -webkit-overflow-scrolling: touch;
}

/* Profile */
.profile-card {
    border-radius: 28px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 28px;
    border: 1px solid rgba(212, 175, 55, .4);
    object-fit: cover;
    box-shadow: 0 0 24px rgba(212, 175, 55, .2);
}

.profile-name {
    color: var(--color-primary-light);
    font-size: 20px;
    font-weight: 800;
    letter-spacing: .12em;
}

.profile-desc {
    margin-top: 4px;
    color: var(--color-text-muted);
    font-size: 14px;
}

.sync-pill {
    margin-top: 12px;
    display: inline-flex;
    border-radius: 999px;
    border: 1px solid rgba(52, 211, 153, .2);
    background: rgba(52, 211, 153, .1);
    padding: 5px 12px;
    color: #6ee7b7;
    font-size: 12px;
}

.profile-stat {
    border-radius: 16px;
    padding: 12px 6px;
    text-align: center;
}

/* 列表按钮 */
.sheet-list-item,
.voice-item,
.suggest-item,
.history-item {
    width: 100%;
    min-height: 48px;
    border-radius: 18px;
    padding: 0 14px;
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--color-text-primary);
    background: rgba(255, 255, 255, .055);
    border: 1px solid rgba(255, 255, 255, .085);
    font-size: 13px;
    text-align: left;
}

.sheet-list-item i,
.history-item i {
    font-size: 10px;
    color: var(--color-text-muted);
}

.voice-item small {
    max-width: 45%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--color-text-muted);
    font-size: 11px;
}

.voice-item.active {
    color: #0d0903;
    background: linear-gradient(135deg, #f8df82, #b88724);
    font-weight: 800;
}

.voice-item.active small {
    color: rgba(13, 9, 3, .72);
}

.danger-text {
    color: #ff7777 !important;
}

.danger-icon {
    color: #ff7777 !important;
}

/* 工具网格 */
.tool-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px 8px;
}

.tool-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    color: var(--color-text-primary);
    font-size: 11px;
    letter-spacing: .08em;
    background: transparent;
}

.tool-icon {
    width: 54px;
    height: 54px;
    border-radius: 19px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary-light);
    font-size: 21px;
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(212, 175, 55, .18);
    box-shadow: 0 0 14px rgba(212, 175, 55, .06);
}

/* 消息菜单 */
.message-action-menu {
    position: fixed;
    z-index: 160;
    min-width: 116px;
    padding: 6px;
    border-radius: 16px;
    background: rgba(17, 17, 21, .96);
    border: 1px solid rgba(212, 175, 55, .24);
    box-shadow: 0 16px 40px rgba(0, 0, 0, .45);
    opacity: 0;
    pointer-events: none;
    transform: scale(.96);
    transition: opacity .14s ease, transform .14s ease;
}
.message-action-menu.active {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
}
.message-action-menu button {
    width: 100%;
    height: 38px;
    border-radius: 12px;
    display: block;
    color: var(--color-text-primary);
    background: transparent;
    font-size: 13px;
    text-align: center;
}
.message-action-menu button:active {
    background: rgba(255, 255, 255, .08);
}
.message-action-menu button.danger {
    color: #ff7777;
}


/* 确认弹窗 */
.confirm-mask {
    position: absolute;
    inset: 0;
    z-index: 150;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 22px;
    background: rgba(0, 0, 0, .62);
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease;
}
.confirm-mask.active {
    opacity: 1;
    pointer-events: auto;
}
.confirm-card {
    width: min(88vw, 340px);
    border-radius: 26px;
    padding: 22px;
    transform: scale(.94) translateY(10px);
    transition: transform .18s ease;
}
.confirm-mask.active .confirm-card {
    transform: scale(1) translateY(0);
}
.confirm-title {
    font-size: 20px;
    font-weight: 900;
    letter-spacing: .08em;
    text-align: center;
}
.confirm-message {
    margin-top: 14px;
    color: var(--color-text-primary);
    font-size: 14px;
    line-height: 1.8;
    text-align: center;
    white-space: pre-line;
}
.confirm-actions {
    margin-top: 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.confirm-cancel,
.confirm-ok {
    height: 44px;
    border-radius: 16px;
    font-weight: 900;
}
.confirm-cancel {
    color: var(--color-text-primary);
    background: rgba(255, 255, 255, .07);
    border: 1px solid rgba(255, 255, 255, .1);
}
/* 日历弹窗 */
.calendar-modal-mask {
    position: absolute;
    inset: 0;
    z-index: 145;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: var(--color-bg-mask);
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease;
}
.calendar-modal-mask.active {
    opacity: 1;
    pointer-events: auto;
}
.calendar-modal-card {
    width: min(92vw, 360px);
    border-radius: 28px;
    padding: 18px;
    transform: scale(.94) translateY(10px);
    transition: transform .18s ease;
}
.calendar-modal-mask.active .calendar-modal-card {
    transform: scale(1) translateY(0);
}
.calendar-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.calendar-month-title {
    flex: 1;
    text-align: center;
    font-size: 18px;
    font-weight: 900;
    letter-spacing: .08em;
}
.calendar-nav-btn {
    width: 38px;
    height: 38px;
    border-radius: 14px;
    color: var(--color-primary-light);
    background: var(--color-bg-overlay);
    border: 1px solid var(--color-border);
}
.calendar-week-row {
    margin-top: 14px;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    color: var(--color-text-muted);
    font-size: 12px;
    text-align: center;
}
.calendar-grid {
    margin-top: 8px;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}
.calendar-day {
    position: relative;
    height: 38px;
    border-radius: 14px;
    color: var(--color-text-primary);
    background: var(--color-bg-overlay);
    border: 1px solid transparent;
    font-size: 13px;
}
.calendar-day.empty {
    background: transparent;
    border-color: transparent;
    pointer-events: none;
}
.calendar-day.disabled {
    opacity: .32;
}
.calendar-day.today {
    border-color: var(--color-primary-border);
}
.calendar-day.has-record {
    opacity: 1;
    color: var(--color-primary-light);
    border-color: var(--color-primary-border);
    background: color-mix(in srgb, var(--color-primary) 16%, transparent);
    font-weight: 900;
}
.calendar-day.has-record::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 5px;
    width: 4px;
    height: 4px;
    border-radius: 999px;
    background: var(--color-primary-light);
    transform: translateX(-50%);
}
.calendar-day.selected {
    color: var(--color-bg-device);
    background: linear-gradient(135deg, var(--color-primary-light), var(--color-primary));
    border-color: var(--color-primary);
    font-weight: 900;
}
.calendar-day.selected::after {
    background: var(--color-bg-device);
}
.calendar-modal-actions {
    margin-top: 16px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
.calendar-action-btn {
    height: 38px;
    border-radius: 14px;
    color: var(--color-text-primary);
    background: var(--color-bg-overlay);
    border: 1px solid var(--color-border);
    font-size: 12px;
    font-weight: 800;
}
/* Toast */
.toast {
    position: absolute;
    left: 50%;
    top: 58px;
    z-index: 120;
    transform: translateX(-50%) translateY(-12px);
    opacity: 0;
    pointer-events: none;
    padding: 10px 16px;
    border-radius: 999px;
    background: rgba(17, 17, 21, .88);
    border: 1px solid rgba(212, 175, 55, .22);
    color: var(--color-primary-light);
    font-size: 13px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, .35);
    transition: all .22s ease;
    white-space: nowrap;
    max-width: 86vw;
    overflow: hidden;
    text-overflow: ellipsis;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* loading */
.sheet-loading {
    min-height: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--color-primary-light);
    text-align: center;
}

.sheet-loading i {
    font-size: 28px;
}

.sheet-loading b {
    font-size: 15px;
}

.sheet-loading span {
    color: var(--color-text-muted);
    font-size: 12px;
}

/* 工具运行卡 */
.tool-running-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 13px;
    border-radius: 18px;
    overflow: hidden;
    color: var(--color-text-main);
    background:
        radial-gradient(circle at 16% 0%, rgba(247, 215, 116, .18), transparent 34%),
        linear-gradient(135deg, rgba(255, 255, 255, .09), rgba(255, 255, 255, .035));
    border: 1px solid rgba(212, 175, 55, .22);
    box-shadow:
        0 12px 28px rgba(0, 0, 0, .26),
        inset 0 1px 0 rgba(255, 255, 255, .08);
}
.tool-running-card.lookup-card {
    border-color: rgba(147, 197, 253, .25);
    background:
        radial-gradient(circle at 16% 0%, rgba(147, 197, 253, .2), transparent 34%),
        linear-gradient(135deg, rgba(31, 41, 55, .82), rgba(15, 23, 42, .72));
}
.tool-running-card.send-card {
    border-color: rgba(247, 215, 116, .28);
    background:
        radial-gradient(circle at 16% 0%, rgba(247, 215, 116, .22), transparent 34%),
        linear-gradient(135deg, rgba(55, 39, 13, .82), rgba(17, 17, 21, .78));
}
.tool-running-shine {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(110deg, transparent 0%, rgba(255, 255, 255, .1) 38%, transparent 58%);
    transform: translateX(-120%);
    animation: toolCardShine 2.4s ease-in-out infinite;
}
.tool-running-icon {
    position: relative;
    z-index: 1;
    width: 42px;
    height: 42px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, .1);
    border: 1px solid rgba(255, 255, 255, .12);
    box-shadow: 0 0 18px rgba(212, 175, 55, .12);
    flex-shrink: 0;
    font-size: 20px;
}
.tool-running-content {
    position: relative;
    z-index: 1;
    min-width: 0;
    flex: 1;
}
.tool-running-kicker {
    margin-bottom: 3px;
    color: var(--color-primary-light);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .16em;
    opacity: .82;
}
.tool-running-title {
    color: var(--color-text-main);
    font-size: 13px;
    font-weight: 800;
    line-height: 1.45;
}
.tool-running-desc {
    margin-top: 3px;
    color: var(--color-text-muted);
    font-size: 11px;
    line-height: 1.45;
}
.tool-running-loader {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
}
.tool-running-loader i {
    width: 4px;
    height: 4px;
    border-radius: 999px;
    background: var(--color-primary-light);
    opacity: .35;
    animation: toolDotPulse 1.1s ease-in-out infinite;
}
.tool-running-loader i:nth-child(2) {
    animation-delay: .16s;
}
.tool-running-loader i:nth-child(3) {
    animation-delay: .32s;
}
@keyframes toolCardShine {
    0% {
        transform: translateX(-120%);
    }
    58%, 100% {
        transform: translateX(120%);
    }
}
@keyframes toolDotPulse {
    0%, 100% {
        opacity: .28;
        transform: translateY(0);
    }
    50% {
        opacity: 1;
        transform: translateY(-3px);
    }
}

/* 语音消息 */
.voice-play-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 132px;
    max-width: 220px;
    border: 0;
    cursor: pointer;
    padding: 0;
    border-radius: 0;
    background: transparent;
    color: inherit;
    text-align: left;
    box-shadow: none;
    line-height: 1;
}
.voice-play-btn:disabled {
    opacity: .75;
}
.voice-play-icon {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 13px;
}
.voice-bars {
    display: flex;
    align-items: center;
    gap: 3px;
    flex: 1;
    height: 14px;
    overflow: hidden;
}
.voice-bars i {
    display: block;
    width: 3px;
    border-radius: 999px;
    background: currentColor;
    opacity: .85;
    transition: height .18s ease, opacity .18s ease;
}
.voice-bars i:nth-child(1) { height: 6px; }
.voice-bars i:nth-child(2) { height: 10px; }
.voice-bars i:nth-child(3) { height: 13px; }
.voice-bars i:nth-child(4) { height: 8px; }
.voice-bars i:nth-child(5) { height: 11px; }
.voice-bars i:nth-child(6) { height: 5px; }
.voice-label {
    font-size: 12px;
    opacity: .9;
    flex-shrink: 0;
}

.cursor-blink {
    display: inline-block;
    width: 6px;
    height: 1em;
    margin-left: 2px;
    vertical-align: -2px;
    background: currentColor;
    animation: cursorBlink 1s infinite;
}

@keyframes cursorBlink {
    0%, 45% { opacity: 1; }
    46%, 100% { opacity: 0; }
}

/* flatpickr 暗色适配 */
.flatpickr-calendar {
    background: rgba(17, 17, 21, .98) !important;
    border: 1px solid rgba(212, 175, 55, .28) !important;
    box-shadow: 0 18px 50px rgba(0, 0, 0, .5) !important;
    color: var(--color-text-main) !important;
}

.flatpickr-months,
.flatpickr-weekdays {
    color: var(--color-primary-light) !important;
}

.flatpickr-day {
    color: var(--color-text-primary) !important;
}

.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange {
    background: #d4af37 !important;
    border-color: #d4af37 !important;
    color: #130d05 !important;
}

.flatpickr-day:hover {
    background: rgba(212, 175, 55, .18) !important;
    border-color: rgba(212, 175, 55, .28) !important;
}

/* 响应式 */
@media (max-height: 720px) {
    #chat-header {
        padding: 10px;
    }
    .mini-stat-row {
        margin-top: 6px;
    }
    #quick-status-row {
        display: flex;
    }
}

@media (max-width: 360px) {
    #chat-header {
        margin-left: 10px;
        margin-right: 10px;
    }

    #bottom-input-bar {
        left: 10px;
        right: 10px;
    }

    .icon-btn {
        width: 38px;
        height: 38px;
        border-radius: 14px;
    }

    .send-btn {
        width: 38px;
        height: 38px;
    }

    .bubble {
        font-size: 13px;
    }

    .tool-grid {
        gap: 10px 6px;
    }

    .tool-icon {
        width: 50px;
        height: 50px;
    }
}

@media (min-width: 768px) {
    #chat-app {
        width: 430px;
        height: var(--app-height);
        margin: 0 auto;
        box-shadow:
            0 0 0 1px rgba(212, 175, 55, .16),
            0 30px 90px rgba(0, 0, 0, .52);
    }

    .login-card {
        box-shadow:
            0 0 0 1px rgba(212, 175, 55, .16),
            0 30px 90px rgba(0, 0, 0, .52);
    }
}

        #chat-header {
            position: relative;
        }
        #confirmModal {
            z-index: 10050;
        }
        .call-header-btn {
            position: absolute;
            top: 14px;
            right: 14px;
            width: 38px;
            height: 38px;
            border-radius: 999px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #f7d774;
            background: rgba(255, 255, 255, 0.08);
            border: 1px solid rgba(247, 215, 116, 0.28);
            box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
        }
        .voice-call-mask {
            position: fixed;
            inset: 0;
            z-index: 9999;
            display: none;
            flex-direction: column;
            align-items: center;
            justify-content: space-between;
            padding: calc(env(safe-area-inset-top) + 34px) 20px calc(env(safe-area-inset-bottom) + 22px);
            background:
                radial-gradient(circle at 50% 24%, rgba(247, 215, 116, 0.18), transparent 34%),
                linear-gradient(180deg, #111111 0%, #050505 100%);
        }
        .voice-call-mask.active {
            display: flex;
        }
        .voice-call-top {
            width: 100%;
            text-align: center;
        }
        .voice-call-kicker {
            font-size: 12px;
            letter-spacing: 4px;
            color: rgba(247, 215, 116, 0.72);
        }
        .voice-call-name {
            margin-top: 10px;
            font-size: 26px;
            font-weight: 700;
            color: #f7d774;
        }
        .voice-call-status {
            margin-top: 8px;
            font-size: 13px;
            color: rgba(255, 255, 255, 0.62);
        }
        .voice-call-avatar-wrap {
            position: relative;
            width: 178px;
            height: 178px;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .voice-call-avatar-wrap::before,
        .voice-call-avatar-wrap::after {
            content: "";
            position: absolute;
            inset: 0;
            border-radius: 999px;
            border: 1px solid rgba(247, 215, 116, 0.34);
            opacity: 0;
            transform: scale(0.86);
        }
        .voice-call-mask.speaking .voice-call-avatar-wrap::before {
            animation: voiceCallWave 1.45s infinite;
        }
        .voice-call-mask.speaking .voice-call-avatar-wrap::after {
            animation: voiceCallWave 1.45s infinite 0.45s;
        }
        .voice-call-avatar {
            width: 132px;
            height: 132px;
            border-radius: 999px;
            object-fit: cover;
            border: 2px solid rgba(247, 215, 116, 0.62);
            box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
            transition: transform 0.2s ease, box-shadow 0.2s ease;
        }
        .voice-call-mask.speaking .voice-call-avatar {
            animation: voiceCallPulse 0.75s infinite alternate;
        }
        .voice-call-subtitle {
            width: 100%;
            min-height: 58px;
            padding: 0 10px;
            text-align: center;
            color: rgba(255, 255, 255, 0.86);
            font-size: 15px;
            line-height: 1.7;
        }
        .voice-call-bottom {
            width: 100%;
            max-width: 520px;
        }
        .voice-call-input-row {
            display: flex;
            gap: 10px;
            align-items: center;
            padding: 10px;
            border-radius: 22px;
            background: rgba(255, 255, 255, 0.08);
            border: 1px solid rgba(255, 255, 255, 0.12);
        }
        .voice-call-input-row input {
            flex: 1;
            min-width: 0;
            height: 42px;
            padding: 0 12px;
            border: 0;
            outline: 0;
            color: #fff;
            background: transparent;
            font-size: 15px;
        }
        .voice-call-input-row input::placeholder {
            color: rgba(255, 255, 255, 0.42);
        }
        .voice-call-send {
            width: 42px;
            height: 42px;
            border-radius: 999px;
            color: #111;
            background: #f7d774;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .voice-call-send.sending i {
            animation: voiceSendSpin 0.8s linear infinite;
        }
        .voice-call-send:disabled,
        .voice-call-input-row input:disabled {
            opacity: 0.72;
        }
        .voice-call-input-row input:disabled {
            cursor: not-allowed;
        }
        .voice-call-hangup {
            width: 58px;
            height: 58px;
            margin: 18px auto 0;
            border-radius: 999px;
            color: #fff;
            background: #ef4444;
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: 0 14px 36px rgba(239, 68, 68, 0.28);
        }
        @keyframes voiceCallWave {
            0% {
                opacity: 0.72;
                transform: scale(0.82);
            }
            100% {
                opacity: 0;
                transform: scale(1.32);
            }
        }
        @keyframes voiceCallPulse {
            from {
                transform: scale(1);
                box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
            }
            to {
                transform: scale(1.045);
                box-shadow: 0 20px 58px rgba(247, 215, 116, 0.24);
            }
        }
        .call-summary-card {
            display: flex;
            gap: 12px;
            align-items: flex-start;
            padding: 14px;
            border-radius: 18px;
            background: rgba(247, 215, 116, 0.1);
            border: 1px solid rgba(247, 215, 116, 0.28);
            box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
        }
        .call-summary-icon {
            width: 38px;
            height: 38px;
            border-radius: 999px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #111;
            background: #f7d774;
            flex-shrink: 0;
        }
        .call-summary-content {
            min-width: 0;
            flex: 1;
        }
        .call-summary-kicker {
            font-size: 11px;
            letter-spacing: 3px;
            color: rgba(247, 215, 116, 0.82);
        }
        .call-summary-title {
            margin-top: 4px;
            font-size: 15px;
            font-weight: 700;
            color: #f7d774;
        }
        .call-summary-text {
            margin-top: 8px;
            font-size: 14px;
            line-height: 1.7;
            color: rgba(255, 255, 255, 0.84);
        }
        @keyframes voiceSendSpin {
            from {
                transform: rotate(0deg);
            }
            to {
                transform: rotate(360deg);
            }
        }
.voice-section-title {
    margin: 16px 4px 9px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 2px;
    color: var(--color-primary-light, var(--color-primary, currentColor));
    opacity: 0.86;
}

.voice-clone-box {
    margin: 8px 0 14px;
    padding: 13px;
    border: 1px solid var(--color-primary-border, var(--color-border, rgba(255, 255, 255, .16)));
    border-radius: 18px;
    background: var(--color-bg-overlay, rgba(255, 255, 255, .055));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .045);
}

.voice-clone-form {
    display: grid;
    gap: 10px;
}

.voice-clone-form input[type="text"],
.voice-clone-form input[type="file"] {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--color-border, rgba(255, 255, 255, .14));
    border-radius: 13px;
    padding: 10px 12px;
    background: rgba(0, 0, 0, .16);
    color: var(--color-text-main, inherit);
    font-size: 13px;
    outline: none;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.voice-clone-form input[type="text"]:focus,
.voice-clone-form input[type="file"]:focus {
    border-color: var(--color-primary-border, var(--color-primary, currentColor));
    box-shadow: 0 0 0 3px var(--color-shadow-primary, rgba(255, 255, 255, .08));
    background: rgba(0, 0, 0, .22);
}

.voice-clone-form input::placeholder {
    color: var(--color-text-muted, currentColor);
    opacity: 1;
}

.voice-clone-form input[type="file"] {
    cursor: pointer;
    color: var(--color-text-primary, inherit);
}

.voice-clone-form input[type="file"]::file-selector-button {
    margin-right: 10px;
    border: 1px solid var(--color-primary-border, var(--color-border, rgba(255, 255, 255, .16)));
    border-radius: 10px;
    padding: 7px 12px;
    background: var(--color-bg-overlay, rgba(255, 255, 255, .06));
    color: var(--color-primary-light, var(--color-text-main, inherit));
    font: inherit;
    font-size: 12px;
    cursor: pointer;
    transition: border-color .18s ease, background .18s ease, transform .18s ease;
}

.voice-clone-form input[type="file"]::file-selector-button:hover {
    border-color: var(--color-primary, currentColor);
    background: rgba(255, 255, 255, .09);
    transform: translateY(-1px);
}

.voice-clone-form input[type="file"]::-webkit-file-upload-button {
    margin-right: 10px;
    border: 1px solid var(--color-primary-border, var(--color-border, rgba(255, 255, 255, .16)));
    border-radius: 10px;
    padding: 7px 12px;
    background: var(--color-bg-overlay, rgba(255, 255, 255, .06));
    color: var(--color-primary-light, var(--color-text-main, inherit));
    font: inherit;
    font-size: 12px;
    cursor: pointer;
    transition: border-color .18s ease, background .18s ease, transform .18s ease;
}

.voice-clone-form input[type="file"]::-webkit-file-upload-button:hover {
    border-color: var(--color-primary, currentColor);
    background: rgba(255, 255, 255, .09);
    transform: translateY(-1px);
}

.voice-clone-submit {
    width: 100%;
    min-height: 42px;
    justify-content: center;
    border-radius: 13px;
}

        #toast.toast {
            position: fixed !important;
            left: 50% !important;
            top: 50% !important;
            right: auto !important;
            bottom: auto !important;
            transform: translate(-50%, -50%) !important;
            z-index: 99999 !important;
            max-width: min(82vw, 360px) !important;
            text-align: center !important;
            pointer-events: none !important;
        }