/* PhotoAI 聊天生图简易模式 */
:root { --chat-bg:#fff; --chat-side:#f7f7f7; --chat-soft:#f1f1f1; --chat-selected:#e9e9e9; --chat-text:#202020; --chat-muted:#626262; --chat-line:#e5e5e5; --chat-ink:#171717; }
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font: 14px/1.6 -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--chat-bg);
    color: var(--chat-text);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-topbar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 16px;
    background: var(--chat-bg);
    border-bottom: 1px solid var(--chat-line);
    flex: 0 0 auto;
}
.chat-back {
    color: var(--chat-text);
    text-decoration: none;
    font-weight: 700;
    font-size: 13px;
    white-space: nowrap;
}
.chat-title {
    font-weight: 800;
    font-size: 16px;
    color: var(--chat-text);
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}
.chat-title small { font-weight: 500; font-size: 11px; color: var(--chat-muted); }
.chat-topbar .photoai-account-slot { margin-left: auto; }

.chat-blocked {
    background: rgba(248,113,113,.1);
    color: #b91c1c;
    font-weight: 600;
    padding: 8px 16px;
    border-bottom: 1px solid #fecaca;
    flex: 0 0 auto;
}
.chat-blocked.hidden { display: none; }

.chat-layout {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
}

.chat-side {
    width: 230px;
    flex: 0 0 auto;
    background: var(--chat-side);
    border-right: 1px solid #e2e8e4;
    display: flex;
    flex-direction: column;
    padding: 10px;
    gap: 8px;
}
.side-new {
    border: 1px dashed #86b89a;
    background: var(--chat-bg);
    color: var(--chat-text);
    border-radius: 10px;
    padding: 9px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}
.side-new:hover { background: var(--chat-soft); }
.session-list { flex: 1 1 auto; overflow: auto; display: flex; flex-direction: column; gap: 4px; }
.session-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border-radius: 9px;
    cursor: pointer;
    color: var(--chat-text);
    font-size: 13px;
}
.session-item:hover { background: var(--chat-soft); }
.session-item.active { background: var(--chat-selected); font-weight: 700; color: var(--chat-text); }
.session-item .session-title { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-item .session-del {
    border: 0; background: transparent; color: var(--chat-line); cursor: pointer;
    font-size: 14px; padding: 0 2px; border-radius: 5px; visibility: hidden;
}
.session-item:hover .session-del { visibility: visible; }
.session-item .session-del:hover { color: #dc2626; background: rgba(248,113,113,.15); }
.chat-side-foot { display: flex; gap: 6px; }
.chat-side-foot button {
    flex: 1 1 50%;
    border: 1px solid #dbe6df;
    background: var(--chat-bg);
    border-radius: 9px;
    padding: 8px 4px;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
    color: var(--chat-text);
}
.chat-side-foot button:hover { background: var(--chat-soft); }
.usage-line {
    font-size: 11px;
    color: var(--chat-muted);
    text-align: center;
    min-height: 14px;
}

.chat-main {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
}
.chat-messages {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 18px 18px 8px;
    scroll-behavior: smooth;
}
.chat-welcome { text-align: center; color: var(--chat-muted); padding: 40px 12px; }
.chat-welcome h2 { color: var(--chat-text); margin: 0 0 8px; }
.chat-welcome p { margin: 0; font-size: 13px; }

.msg-row { display: flex; margin: 10px 0; }
.msg-row.user { justify-content: flex-end; }
.msg-row.assistant { justify-content: flex-start; }
.bubble {
    max-width: min(78%, 640px);
    border-radius: 14px;
    padding: 10px 14px;
    white-space: pre-wrap;
    word-break: break-word;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
    position: relative;
}
.msg-row.user .bubble { background: var(--chat-ink); color: #fff; border-bottom-right-radius: 4px; }
.msg-row.assistant .bubble { background: var(--chat-bg); color: var(--chat-text); border-bottom-left-radius: 4px; }
.bubble .bubble-meta {
    display: block;
    margin-top: 6px;
    font-size: 10px;
    opacity: 0.55;
    text-align: right;
}
.bubble.error { background: rgba(248,113,113,.1); color: #b91c1c; border: 1px solid #fecaca; }
.bubble img.chat-image {
    display: block;
    max-width: min(100%, 320px);
    border-radius: 10px;
    margin-top: 8px;
    cursor: zoom-in;
    border: 1px solid var(--chat-line);
}
.bubble .gen-loading { display: inline-flex; gap: 6px; align-items: center; color: var(--chat-muted); font-size: 13px; }
.bubble .gen-loading::before {
    content: '';
    width: 12px; height: 12px;
    border: 2px solid var(--chat-line);
    border-top-color: var(--chat-ink);
    border-radius: 50%;
    animation: chat-spin 0.9s linear infinite;
}
@keyframes chat-spin { to { transform: rotate(360deg); } }
.chat-history-gap { text-align: center; color: var(--chat-muted); font-size: 12px; margin: 8px 0; }

.chat-composer {
    flex: 0 0 auto;
    display: flex;
    gap: 8px;
    padding: 10px 14px calc(12px + env(safe-area-inset-bottom));
    background: var(--chat-bg);
    border-top: 1px solid var(--chat-line);
    align-items: flex-end;
}
.chat-tools-bar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px 0;
    background: var(--chat-bg);
    border-top: 1px solid var(--chat-soft);
}
.gen-options-summary { color: var(--chat-muted); font-size: 12px; }
#chatInput {
    flex: 1 1 520px;
    resize: none;
    border: 1px solid var(--chat-line);
    border-radius: 12px;
    padding: 10px 12px;
    font: inherit;
    background: var(--chat-soft);
    color: var(--chat-text);
    caret-color: var(--chat-text);
    min-height: 78px;
    max-height: 160px;
    outline: none;
}
#chatInput:focus { border-color: var(--chat-ink); }
.composer-actions { display: flex; gap: 8px; align-items: stretch; }
.btn-send, .btn-gen {
    border: 0;
    border-radius: 12px;
    padding: 10px 16px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}
.btn-send { background: var(--chat-ink); color: #fff; }
.btn-send:disabled { background: #94b8a3; cursor: not-allowed; }
.btn-gen { background: var(--chat-soft); color: var(--chat-text); border: 1px solid var(--chat-line); }
.btn-gen:hover { background: #d8f3e3; }
.btn-gen:disabled { opacity: 0.6; cursor: not-allowed; }

.chat-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
    padding: 18px;
}
.chat-overlay.hidden { display: none; }
.overlay-card {
    background: var(--chat-bg);
    border-radius: 16px;
    width: min(680px, 94vw);
    max-height: 86vh;
    display: flex;
    flex-direction: column;
    padding: 16px;
    gap: 10px;
}
.image-options-card {
    background: var(--chat-bg);
    border-radius: 16px;
    width: min(600px, 94vw);
    padding: 18px;
    box-shadow: 0 18px 55px rgba(15, 23, 42, 0.2);
}
.image-options-intro { margin: 0; color: var(--chat-muted); font-size: 13px; }
.image-options-card .chat-options-bar {
    border: 1px solid var(--chat-line);
    border-radius: 12px;
    padding: 14px;
    margin-top: 2px;
}
.image-options-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 4px;
}
.image-options-cancel {
    border: 1px solid #dbe6df;
    background: var(--chat-bg);
    color: #475569;
    border-radius: 10px;
    padding: 9px 16px;
    font: inherit;
    cursor: pointer;
}
.image-options-cancel:hover { background: var(--chat-soft); }
.overlay-head { display: flex; justify-content: space-between; align-items: center; }
.overlay-head strong { font-size: 16px; color: var(--chat-text); }
.overlay-close {
    border: 0; background: var(--chat-soft); border-radius: 8px;
    width: 30px; height: 30px; font-size: 16px; cursor: pointer; color: #475569;
}
.overlay-tools { display: flex; gap: 8px; }
.overlay-tools input {
    flex: 1 1 auto;
    border: 1px solid var(--chat-line);
    border-radius: 10px;
    padding: 9px 12px;
    font: inherit;
    outline: none;
}
.overlay-tools input:focus { border-color: var(--chat-ink); }
.overlay-tools button {
    border: 0; background: var(--chat-ink); color: #fff;
    border-radius: 10px; padding: 9px 16px; font: inherit; font-weight: 700; cursor: pointer;
}
.overlay-body { overflow-y: auto; flex: 1 1 auto; min-height: 120px; }
.overlay-more {
    border: 1px solid #dbe6df; background: var(--chat-bg); border-radius: 10px;
    padding: 8px; font: inherit; cursor: pointer; color: var(--chat-text); font-weight: 700;
}
.overlay-more.hidden { display: none; }
.result-item {
    padding: 10px 12px;
    border-bottom: 1px solid var(--chat-soft);
    cursor: pointer;
    font-size: 13px;
}
.result-item:hover { background: #f6faf7; }
.result-item .result-meta { color: var(--chat-muted); font-size: 11px; margin-top: 2px; }
.result-item .result-content { color: var(--chat-text); }
.result-empty { text-align: center; color: var(--chat-muted); padding: 26px 0; }
.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
}
.image-grid img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 10px;
    cursor: zoom-in;
    border: 1px solid var(--chat-line);
    background: var(--chat-soft);
}

@media (max-width: 720px) {
    .chat-side { position: fixed; inset: 0 auto 0 0; width: 250px; z-index: 400; transform: translateX(-100%); transition: transform 0.2s; }
    .chat-side.open { transform: none; box-shadow: 0 0 40px rgba(15,23,42,0.25); }
    .chat-layout { position: relative; }
    .chat-title small { display: none; }
}

/* 计划模式：可点选的选择题组件 */
.choice-groups { margin-top: 8px; display: flex; flex-direction: column; gap: 12px; }
.choice-q-label { font-weight: 700; font-size: 13px; color: var(--chat-text); margin-bottom: 6px; }
.choice-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.choice-chip {
    border: 1.5px solid #bcd8c6;
    background: var(--chat-bg);
    color: var(--chat-text);
    border-radius: 999px;
    padding: 6px 13px;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: all .12s;
}
.choice-chip:hover { border-color: var(--chat-ink); background: var(--chat-soft); }
.choice-chip.selected { background: var(--chat-ink); border-color: var(--chat-ink); color: #fff; font-weight: 700; }
.choice-groups.answered .choice-chip { cursor: default; opacity: 0.65; }
.choice-groups.answered .choice-chip.selected { opacity: 1; background: var(--chat-ink); }
.choice-custom {
    margin-top: 6px;
    border: 1px solid var(--chat-line);
    border-radius: 9px;
    padding: 7px 10px;
    font: inherit;
    font-size: 13px;
    width: 100%;
    outline: none;
}
.choice-custom:focus { border-color: var(--chat-ink); }
.choice-custom.hidden { display: none; }
.choice-send {
    align-self: flex-start;
    border: 0;
    background: var(--chat-ink);
    color: #fff;
    border-radius: 10px;
    padding: 8px 16px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}
.choice-send:disabled { background: #b6c8bd; cursor: not-allowed; }
.bubble-fill {
    display: inline-block;
    margin-top: 8px;
    border: 1px solid var(--chat-line);
    background: var(--chat-soft);
    color: var(--chat-text);
    border-radius: 9px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}
.bubble-fill:hover { background: #d8f3e3; }
.btn-plan {
    border: 1.5px dashed #86b89a;
    background: var(--chat-bg);
    color: var(--chat-text);
    border-radius: 12px;
    padding: 10px 13px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}
.btn-plan:hover { background: var(--chat-soft); }
.btn-plan:disabled { opacity: 0.6; cursor: not-allowed; }

/* 出图选项：清晰度 + 比例（在生成图片弹层中显示） */
.chat-options-bar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}
.opt-label { font-size: 11px; color: var(--chat-muted); font-weight: 700; }
.opt-sep { width: 1px; height: 14px; background: #e2e8e4; margin: 0 4px; }
.opt-pill {
    border: 1.5px solid #dbe6df;
    background: var(--chat-bg);
    color: var(--chat-text);
    border-radius: 999px;
    padding: 3px 10px;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
    transition: all .12s;
}
.opt-pill:hover { border-color: var(--chat-ink); }
.opt-pill.selected { background: var(--chat-ink); border-color: var(--chat-ink); color: #fff; font-weight: 700; }
.opt-hint { font-size: 11px; color: #b45309; width: 100%; }
@media (max-width: 720px) {
    .chat-tools-bar { padding: 8px 10px 0; }
    .chat-composer { padding: 8px 10px calc(10px + env(safe-area-inset-bottom)); flex-wrap: wrap; }
    #chatInput { flex: 1 1 100%; min-height: 88px; width: 100%; }
    .composer-actions { width: 100%; }
    .composer-actions button { flex: 1 1 0; }
    .image-options-card { width: min(520px, calc(100vw - 20px)); padding: 14px; }
    .image-options-card .chat-options-bar { padding: 12px 10px; }
    .opt-pill { padding: 3px 8px; font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ---------- 聊天传图与多图结果(2026-09-05 vision v1) ---------- */
.btn-attach {
  border: 1px solid var(--line, #e2e8f0);
  background: #fff;
  border-radius: 9px;
  min-width: 40px;
  height: 40px;
  font-size: 16px;
  cursor: pointer;
  transition: background .2s, border-color .2s, transform .18s;
}
.btn-attach:hover { background: #f0fdf4; border-color: #16a34a; transform: translateY(-1px); }
.chat-upload-thumbs { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 4px 8px; }
.chat-upload-thumbs .thumb { position: relative; width: 64px; height: 64px; border-radius: 10px; overflow: hidden; border: 1px solid #e2e8f0; box-shadow: 0 1px 3px rgba(15,23,42,.08); }
.chat-upload-thumbs .thumb img { width: 100%; height: 100%; object-fit: cover; }
.chat-upload-thumbs .thumb-x { position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; border: 0; border-radius: 50%; background: rgba(15,23,42,.62); color: #fff; font-size: 11px; line-height: 18px; text-align: center; cursor: pointer; padding: 0; }
.chat-upload-thumbs .thumb-x:hover { background: #dc2626; }
.msg-images { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.msg-images img { width: 92px; height: 92px; object-fit: cover; border-radius: 10px; border: 1px solid rgba(15,23,42,.12); cursor: zoom-in; }
.gen-result { margin-top: 10px; }
.gen-result .gen-stage { position: relative; border-radius: 14px; overflow: hidden; background: #f1f5f9; }
.gen-result .gen-stage img { width: 100%; max-height: 460px; object-fit: contain; display: block; cursor: zoom-in; }
.gen-result .gen-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border: 0; border-radius: 50%; background: rgba(15,23,42,.55); color: #fff; font-size: 16px; cursor: pointer; display: none; }
.gen-result .gen-nav:hover { background: rgba(15,23,42,.78); }
.gen-result .gen-nav.prev { left: 10px; }
.gen-result .gen-nav.next { right: 10px; }
.gen-result.multi .gen-nav { display: block; }
.gen-result .gen-dots { display: flex; gap: 6px; justify-content: center; padding: 9px 0 2px; }
.gen-result .gen-dot { width: 34px; height: 34px; padding: 0; border: 2px solid #e2e8f0; border-radius: 8px; overflow: hidden; cursor: pointer; background: #fff; opacity: .75; }
.gen-result .gen-dot img { width: 100%; height: 100%; object-fit: cover; }
.gen-result .gen-dot.active { border-color: #16a34a; opacity: 1; }
.gen-result .gen-count { text-align: center; color: #94a3b8; font-size: 11.5px; padding-bottom: 4px; }
.bubble-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.bubble-actions button { border: 1px solid rgba(22,163,74,.35); background: #f0fdf4; color: #166534; border-radius: 8px; padding: 5px 12px; font-size: 12.5px; font-weight: 700; cursor: pointer; transition: background .2s, transform .18s; }
.bubble-actions button:hover { background: #dcfce7; transform: translateY(-1px); }
.bubble-actions button.btn-fill { background: transparent; color: #475569; border-color: #cbd5e1; }
/* 「用我的原文生成」：用虚线边表示「原样不改写」，与方案版按钮并列供用户选择 */
.bubble-actions button.bubble-gen-raw { border-style: dashed; }
@media (prefers-reduced-motion: reduce) { .btn-attach, .bubble-actions button, .gen-result .gen-nav { transition: none; } .btn-attach:hover, .bubble-actions button:hover { transform: none; } }

/* 统一聊天布局：内容居中，输入框与消息共用阅读宽度。 */
body { height:100dvh; font:16px/1.75 system-ui,'PingFang SC','Microsoft YaHei',sans-serif; }
button,a,input,textarea { -webkit-tap-highlight-color:transparent; }
button { min-height:44px; }
button:focus-visible,a:focus-visible,textarea:focus-visible,input:focus-visible { outline:2px solid #166534; outline-offset:3px; }
svg { width:22px; height:22px; flex-shrink:0; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; }
.icon-button { display:inline-flex; align-items:center; justify-content:center; width:44px; height:44px; padding:0; border:0; border-radius:50%; background:transparent; color:var(--chat-text); cursor:pointer; }
.icon-button:hover { background:var(--chat-soft); }
.chat-topbar { height:64px; padding:8px 20px; gap:12px; border:0; }
.chat-title { font-size:18px; font-weight:600; color:var(--chat-text); }
.chat-title small { font-size:14px; color:var(--chat-muted); }
.chat-back { margin-left:auto; display:flex; align-items:center; min-height:44px; font-size:14px; font-weight:500; color:var(--chat-muted); }
.chat-side { width:252px; padding:16px 12px; border:0; gap:12px; }
.side-new { display:flex; align-items:center; gap:12px; border:0; padding:12px; background:transparent; color:var(--chat-text); text-align:left; font-weight:500; border-radius:12px; }
.session-item { color:var(--chat-text); font-size:14px; padding:4px 8px 4px 12px; min-height:44px; }
.session-item:hover,.side-new:hover { background:var(--chat-soft); }
.session-item.active { background:var(--chat-selected); color:var(--chat-text); font-weight:500; }
.session-item:focus-within .session-del { visibility:visible; }
.session-item .session-del { min-width:44px; color:var(--chat-muted); }
.chat-side-foot { display:grid; grid-template-columns:1fr 1fr; gap:4px; }
.chat-side-foot button,.chat-side-foot a { display:flex; align-items:center; justify-content:flex-start; gap:8px; min-height:44px; padding:8px!important; border:0; background:transparent; font-size:14px!important; border-radius:10px; color:var(--chat-muted); white-space:nowrap; }
.chat-side-foot a:hover,.chat-side-foot button:hover { background:var(--chat-selected); }
.usage-card { margin:0 2px; padding:12px; border:1px solid var(--chat-line); border-radius:14px; background:var(--chat-bg); color:var(--chat-text); box-shadow:0 2px 8px rgba(0,0,0,.04); }
.usage-card-head,.usage-card-meta { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.usage-card-head { font-size:13px; font-weight:600; }
.usage-card-head strong { color:#166534; font-size:15px; font-variant-numeric:tabular-nums; }
.usage-progress { height:7px; margin:9px 0 8px; overflow:hidden; border-radius:999px; background:#e8eee9; }
.usage-progress span { display:block; width:0; height:100%; border-radius:inherit; background:#16a34a; transition:width .3s ease; }
.usage-card-meta { color:var(--chat-muted); font-size:11px; line-height:1.4; white-space:nowrap; }
.usage-card.is-full { border-color:#fecaca; background:#fff7f7; }
.usage-card.is-full .usage-card-head strong { color:#b91c1c; }
.usage-card.is-full .usage-progress span { background:#dc2626; }
.usage-card:focus-within { outline:2px solid rgba(22,163,74,.25); outline-offset:2px; }
body .chat-side .photoai-auth-bar { display:flex; flex-wrap:wrap; width:100%; gap:8px; border:0; box-shadow:none; background:transparent; padding:8px; font-size:14px; }
body .chat-side .photoai-auth-user-copy { flex:1 1 100%; order:-1; }
body .chat-side .photoai-auth-user-copy strong,body .chat-side .photoai-auth-user-copy small { font-size:14px; }
body .chat-side .photoai-auth-bar .photoai-auth-site-pill { background:var(--chat-soft); color:var(--chat-muted); border:0; font-size:14px; }
body .chat-side .photoai-auth-bar .photoai-auth-balance { background:var(--chat-soft); color:var(--chat-text); font-size:14px; }
body .chat-side .photoai-auth-bar .photoai-auth-balance.is-low { background:#fff7ed; color:#9a3412; }
.chat-upload-thumbs.hidden { display:none; }
.chat-messages { padding:24px max(24px,calc((100% - 800px)/2)) 32px; overscroll-behavior:contain; }
.chat-welcome { max-width:640px; margin:10vh auto 0; padding:32px 16px; }
.chat-welcome h2 { font-size:32px; font-weight:600; letter-spacing:-.8px; color:var(--chat-text); margin-bottom:16px; }
.chat-welcome p { font-size:16px; line-height:1.8; }
.msg-row { margin:0 0 32px; }
.bubble { max-width:100%; padding:0; border-radius:0; box-shadow:none; white-space:normal; }
.msg-row.user .bubble { max-width:82%; border-radius:24px; padding:12px 20px; background:var(--chat-ink); color:#fff; white-space:pre-wrap; }
.msg-row.assistant .bubble { width:100%; background:transparent; color:var(--chat-text); border-radius:0; }
.bubble .bubble-meta { font-size:14px; opacity:1; color:var(--chat-muted); margin-top:12px; text-align:left; }
.msg-row.user .bubble-meta { color:#d4d4d4; text-align:right; }
.bubble.error { padding:16px; background:#fef2f2; color:#b91c1c; border-radius:16px; }
.generation-progress { display:flex; align-items:center; flex-wrap:wrap; gap:10px; min-height:48px; padding:12px 0; color:var(--chat-text); }
.generation-progress strong { font-weight:500; }
.progress-elapsed { width:100%; padding-left:28px; color:var(--chat-muted); font-size:14px; }
.progress-spinner { width:18px; height:18px; border:2px solid var(--chat-line); border-top-color:var(--chat-ink); border-radius:50%; animation:chat-spin .9s linear infinite; }
.chat-generation-cancel { margin-left:28px; min-height:44px; padding:0 14px; border:1px solid var(--chat-line); border-radius:12px; background:var(--chat-soft); color:var(--chat-text); font-size:14px; cursor:pointer; transition:background .2s, border-color .2s; }
.chat-generation-cancel:hover { background:var(--chat-line); }
.chat-generation-cancel:disabled { opacity:.65; cursor:wait; }
.assistant-copy p { margin:0 0 16px; white-space:pre-wrap; }
.assistant-copy h3 { font-size:18px; line-height:1.5; margin:24px 0 12px; }
.assistant-copy ul,.assistant-copy ol { padding-left:24px; margin:12px 0 20px; }
.assistant-copy li { padding:4px 0; }
.assistant-copy blockquote { border-left:3px solid var(--chat-line); margin:16px 0; padding-left:16px; color:var(--chat-muted); }
.gen-result { width:min(100%,480px); margin-top:16px; }
.gen-result .gen-stage { border-radius:24px; background:var(--chat-soft); }
.gen-result .gen-stage img { max-height:none; width:100%; height:auto; }
.gen-result .gen-nav { width:44px; height:44px; }
.gen-result .gen-dot { width:44px; height:44px; }
.gen-result .gen-count { font-size:14px; color:var(--chat-muted); }
.gen-result:not(.multi) .gen-count,.gen-result:not(.multi) .gen-dots { display:none; }
.bubble img.chat-image { max-width:min(100%,480px); border-radius:24px; }
.bubble-actions button,.bubble-fill { min-height:44px; border:0; background:var(--chat-soft); color:var(--chat-text); font-size:14px; font-weight:500; border-radius:12px; }
.chat-composer { flex-direction:column; align-items:stretch; flex-wrap:nowrap; width:calc(100% - 48px); max-width:800px; margin:0 auto max(16px,env(safe-area-inset-bottom)); padding:12px; gap:8px; border:1px solid var(--chat-line); border-radius:28px; background:var(--chat-bg); box-shadow:0 2px 12px rgba(0,0,0,.06); }
.chat-composer:focus-within { border-color:#c9c9c9; box-shadow:0 2px 16px rgba(0,0,0,.08); }
#chatInput { flex:none; width:100%; min-height:40px; max-height:160px; padding:4px 12px; border:0; border-radius:0; background:transparent; color:var(--chat-text); caret-color:var(--chat-text); font-size:16px; line-height:1.7; }
#chatInput::placeholder { color:var(--chat-muted); }
#chatInput:focus { border:0; }
.composer-actions { width:100%; align-items:center; gap:8px; }
.composer-actions button { flex:none; }
.btn-attach { border:0; background:var(--chat-soft); width:44px; height:44px; }
.btn-plan { display:inline-flex; align-items:center; min-height:44px; border:1px solid var(--chat-line); border-radius:999px; padding:8px 14px; font-size:14px; background:var(--chat-soft); color:var(--chat-text); font-weight:500; cursor:pointer; transition:background .2s,border-color .2s,box-shadow .2s; }
.btn-plan:hover { background:#e8e8e8; border-color:#d0d0d0; }
.gen-options-summary { display:inline-flex; align-items:center; min-height:44px; border:1px solid var(--chat-line); padding:8px 14px; background:var(--chat-soft); font:inherit; font-size:14px; color:var(--chat-text); cursor:pointer; text-align:left; border-radius:999px; transition:background .2s,border-color .2s,box-shadow .2s; }
.gen-options-summary:hover { background:#e8e8e8; border-color:#d0d0d0; }
.composer-actions .btn-gen { margin-left:auto; background:var(--chat-soft); border:0; color:var(--chat-text); font-size:14px; font-weight:500; border-radius:999px; padding:8px 16px; }
.btn-send { background:var(--chat-ink); color:#fff; border-radius:50%; }
.btn-send:hover { background:#333; }
.btn-send:disabled { background:#ddd; color:#666; }
.image-options-card,.overlay-card { color:var(--chat-text); background:var(--chat-bg); max-height:calc(100dvh - 32px); overflow:auto; }
.overlay-head strong,.choice-q-label { color:var(--chat-text); }
.overlay-close { width:44px; height:44px; }
.opt-pill,.choice-chip,.choice-custom,.image-options-intro,.opt-label,.opt-hint,.result-item { font-size:14px; }
.choice-chip.selected,.opt-pill.selected,.choice-groups.answered .choice-chip.selected { color:#fff; background:var(--chat-ink); }
.sidebar-backdrop { position:fixed; inset:64px 0 0; z-index:390; border:0; background:rgba(0,0,0,.25); }
.sidebar-backdrop[hidden] { display:none; }
@media(min-width:721px) { body.sidebar-collapsed .chat-side { display:none; } }
@media(max-width:1000px) { .gen-options-summary { display:none; } }
@media(max-width:720px) {
 .chat-topbar { height:56px; padding:6px 12px; gap:8px; }
 .chat-title { font-size:16px; }
 .chat-side { top:56px; bottom:0; width:min(300px,86vw); }
 .sidebar-backdrop { top:56px; }
 .session-item .session-del { visibility:visible; }
 .chat-messages { padding:24px 20px 16px; }
 .chat-welcome { margin:8vh auto 0; padding:24px 0; }
 .chat-welcome h2 { font-size:26px; }
 .msg-row { margin-bottom:28px; }
 .msg-row.user .bubble { max-width:90%; padding:10px 16px; border-radius:22px; }
 .gen-result { width:100%; }
 .gen-result .gen-stage { border-radius:24px; }
 .chat-composer { width:calc(100% - 24px); margin-bottom:max(12px,env(safe-area-inset-bottom)); padding:10px; gap:4px; border-radius:26px; }
 #chatInput { min-height:40px; max-height:120px; padding:4px 8px; flex:none; }
 .composer-actions { gap:4px; }
 .composer-actions .btn-gen { padding:8px 12px; }
 .btn-plan { padding:8px; }
 .chat-upload-thumbs .thumb-x { width:44px; height:44px; line-height:44px; }
}


/* PhotoAI Chat v3 — 与向导统一的浅色工作流界面 */
:root {
  --chat-bg: #ffffff;
  --chat-side: #f7faf8;
  --chat-soft: #f1f7f3;
  --chat-selected: #e5f3e9;
  --chat-text: #172033;
  --chat-muted: #667085;
  --chat-line: #e1e9e3;
  --chat-ink: #166534;
}
body { background: var(--chat-bg); color: var(--chat-text); }
.chat-topbar { min-height: 68px; padding: 10px clamp(16px, 3vw, 32px); border-bottom: 1px solid var(--chat-line); box-shadow: 0 1px 8px rgba(16, 24, 40, .04); }
.chat-title { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.chat-title::before { content: 'P'; display: inline-grid; place-items: center; width: 30px; height: 30px; margin-right: 9px; border-radius: 9px; background: #16a34a; color: #fff; font-size: 14px; font-weight: 800; }
.chat-title small { color: var(--chat-muted); font-size: 12px; font-weight: 500; }
.chat-back { color: var(--chat-ink); font-weight: 650; padding: 8px 12px; border-radius: 10px; }
.chat-back:hover { background: var(--chat-soft); color: #14532d; }
.chat-side { width: 264px; padding: 18px 14px; background: var(--chat-side); border-right: 1px solid var(--chat-line); }
.side-new { border: 1px solid #b7ddc2; background: #fff; color: #14532d; border-radius: 12px; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.side-new:hover { background: #effaf2; border-color: #86c99b; }
.session-item { color: var(--chat-text); border-radius: 11px; }
.session-item:hover { background: #edf7f0; }
.session-item.active { background: var(--chat-selected); color: #14532d; }
.chat-side-foot button, .chat-side-foot a { color: var(--chat-muted); }
.chat-side-foot a:hover, .chat-side-foot button:hover { background: var(--chat-selected); color: #14532d; }
.usage-card { border-color: #d6e7da; background: #fff; box-shadow: 0 4px 14px rgba(16,24,40,.05); }
.usage-card-head strong { color: #15803d; }
.usage-progress { background: #e5f1e8; }
.usage-progress span { background: #16a34a; }
.chat-messages { padding-top: 36px; }
.chat-welcome h2 { color: #172033; font-weight: 650; }
.chat-welcome p { color: var(--chat-muted); }
.msg-row.user .bubble { background: #166534; color: #fff; }
.msg-row.assistant .bubble { color: var(--chat-text); }
.bubble .bubble-meta { color: var(--chat-muted); }
.msg-row.user .bubble-meta { color: #d7f4df; }
.bubble.error { border-color: #fecaca; background: #fff7f7; color: #b91c1c; }
.chat-composer { border-color: #cfe1d4; box-shadow: 0 5px 22px rgba(16, 24, 40, .07); }
.chat-composer:focus-within { border-color: #6fbb85; box-shadow: 0 0 0 3px rgba(22,163,74,.12), 0 8px 24px rgba(16,24,40,.08); }
#chatInput::placeholder { color: #98a2b3; }
.btn-attach, .btn-plan, .gen-options-summary { background: #f5faf6; border-color: #d7e8dc; color: #344054; }
.btn-attach:hover, .btn-plan:hover, .gen-options-summary:hover { background: #e9f7ed; border-color: #9bd0a8; color: #14532d; }
.composer-actions .btn-gen { background: #e8f6ec; color: #166534; }
.composer-actions .btn-gen:hover { background: #d8f0df; }
.btn-send { background: #16a34a; color: #fff; }
.btn-send:hover { background: #15803d; }
.btn-send:disabled { background: #b7d9c0; color: #fff; }
.choice-chip.selected, .opt-pill.selected, .choice-groups.answered .choice-chip.selected { background: #166534; border-color: #166534; color: #fff; }
.bubble-actions button, .bubble-fill { background: #eff9f1; color: #166534; border: 1px solid #c9e6d0; }
.bubble-actions button:hover, .bubble-fill:hover { background: #ddf3e3; }
.overlay-card, .image-options-card { border: 1px solid var(--chat-line); box-shadow: 0 24px 70px rgba(16,24,40,.16); }
.overlay-close { color: var(--chat-muted); }
.overlay-close:hover { background: #eaf5ed; color: #14532d; }
@media (max-width: 720px) { .chat-topbar { min-height: 58px; } .chat-title::before { width: 27px; height: 27px; margin-right: 6px; } .chat-side { background: #f7faf8; box-shadow: 12px 0 32px rgba(16,24,40,.12); } }


/* Chat v4 — 回到克制的 ChatGPT 黑色消息气泡，绿色只做品牌点缀 */
.chat-title::before { display: none; }
.chat-title { color: #171717; }
.msg-row.user .bubble { background: #171717; color: #fff; }
.msg-row.user .bubble-meta { color: #d4d4d4; }
.btn-send { background: #171717; color: #fff; }
.btn-send:hover { background: #2f2f2f; }
.btn-send:disabled { background: #d0d5d2; color: #fff; }
.choice-chip.selected, .opt-pill.selected, .choice-groups.answered .choice-chip.selected { background: #16a34a; border-color: #16a34a; color: #fff; }
.session-item.active { background: #e8f6ec; color: #166534; }
.side-new { color: #166534; }
.composer-actions .btn-gen { background: #ecfdf3; color: #166534; border: 1px solid #c8e8d0; }
.composer-actions .btn-gen:hover { background: #dcf7e5; border-color: #a6d9b3; }
@media (max-width: 720px) { .chat-title::before { display: none; } }


/* Shared template theme tokens: NAS red, VPS green. */
html[data-photoai-mode="main"] {
  --chat-accent: #e11d48;
  --chat-accent-strong: #be123c;
  --chat-theme-soft: #fff1f2;
  --chat-theme-line: #fecdd3;
  --chat-theme-focus: rgba(225,29,72,.14);
}
html[data-photoai-mode="distribution"] {
  --chat-accent: #16a34a;
  --chat-accent-strong: #15803d;
  --chat-theme-soft: #ecfdf3;
  --chat-theme-line: #a7f3d0;
  --chat-theme-focus: rgba(22,163,74,.14);
}
.chat-back { color: var(--chat-accent-strong); }
.chat-back:hover { background: var(--chat-theme-soft); color: var(--chat-accent-strong); }
.side-new { border-color: var(--chat-theme-line); color: var(--chat-accent-strong); }
.side-new:hover { background: var(--chat-theme-soft); border-color: var(--chat-accent); }
.session-item.active { background: var(--chat-theme-soft); color: var(--chat-accent-strong); }
.chat-side-foot a:hover, .chat-side-foot button:hover { background: var(--chat-theme-soft); color: var(--chat-accent-strong); }
.usage-card-head strong { color: var(--chat-accent-strong); }
.usage-progress span { background: var(--chat-accent); }
.chat-composer:focus-within { border-color: var(--chat-accent); box-shadow: 0 0 0 3px var(--chat-theme-focus), 0 8px 24px rgba(16,24,40,.08); }
.btn-attach:hover, .btn-plan:hover, .gen-options-summary:hover { background: var(--chat-theme-soft); border-color: var(--chat-theme-line); color: var(--chat-accent-strong); }
.composer-actions .btn-gen { background: var(--chat-theme-soft); color: var(--chat-accent-strong); border-color: var(--chat-theme-line); }
.composer-actions .btn-gen:hover { background: #f4f8f5; border-color: var(--chat-accent); }
.choice-chip.selected, .opt-pill.selected, .choice-groups.answered .choice-chip.selected { background: var(--chat-accent); border-color: var(--chat-accent); color: #fff; }
.bubble-actions button, .bubble-fill { background: var(--chat-theme-soft); color: var(--chat-accent-strong); border-color: var(--chat-theme-line); }
.bubble-actions button:hover, .bubble-fill:hover { background: #f4f8f5; }

/* 2026-10-15 拖图入窗提示层:文件拖入窗口时整窗高亮,提示松手即上传 */
.chat-drop-overlay { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; background: rgba(22,24,31,.28); backdrop-filter: blur(1.5px); pointer-events: none; }
.chat-drop-overlay[hidden] { display: none; }
.chat-drop-box { border: 2px dashed var(--chat-accent, #dc2626); border-radius: 16px; background: #fff; color: var(--chat-accent-strong, #b91c1c); font-weight: 700; padding: 26px 34px; font-size: 16px; box-shadow: 0 12px 40px rgba(0,0,0,.16); }

/* 2026-10-15 上传占位反馈:图片压缩期间立即显示占位+转圈,不再几十秒无反应 */
.chat-upload-thumbs .thumb.is-loading { display: grid; place-items: center; background: #f1f5f9; }
.chat-upload-thumbs .thumb.is-loading img { display: none; }
.chat-upload-thumbs .thumb-loading { width: 22px; height: 22px; border: 3px solid #e2e8f0; border-top-color: var(--chat-accent, #dc2626); border-radius: 50%; animation: chat-thumb-spin .8s linear infinite; }
@keyframes chat-thumb-spin { to { transform: rotate(360deg); } }
