/* ============================================================
   ChainOne · AI 能力演示中心
   面向售前演示：左「说明 + 输入」，右「AI 工作台」
   ============================================================ */

body.ai-body-page { background: #eef3f1; }

.ai-page {
    max-width: 1340px;
    margin: 0 auto;
    padding: 18px 22px 46px;
    position: relative;
    z-index: 1;
}

/* ---------------- 页头 ---------------- */
.ai-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 16px; flex-wrap: wrap; padding: 6px 2px 14px;
}
.ai-head-left { display: flex; align-items: center; gap: 16px; min-width: 0; }
.ai-brand { display: flex; align-items: center; gap: 9px; text-decoration: none; flex: 0 0 auto; }
.ai-brand:hover { text-decoration: none; }
.ai-brand-mark {
    width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
    background: linear-gradient(145deg, var(--brand-2), var(--brand-dark)); color: #fff;
    font-weight: 700; font-size: var(--fs-base); letter-spacing: .02em;
}
.ai-brand-text { display: flex; flex-direction: column; font-size: var(--fs-base); font-weight: 700; color: var(--brand); line-height: 1.3; }
.ai-brand-text small { font-size: var(--fs-sm); color: var(--muted); font-weight: 400; }
.ai-head-title h1 { font-size: var(--fs-h1); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ai-badge {
    display: inline-block; padding: 2px 9px; border-radius: 999px;
    background: var(--gold-soft); color: #8a5f14; font-size: var(--fs-sm); font-weight: 600;
    border: 1px solid #efdfbe; vertical-align: 2px;
}
.ai-sub { font-size: var(--fs-sm); color: var(--muted); margin-top: 3px; max-width: 760px; }
.ai-head-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ai-user {
    font-size: var(--fs-sm); color: var(--ink-2); background: #fff; border: 1px solid var(--line);
    border-radius: 999px; padding: 4px 11px; white-space: nowrap;
}

/* ---------------- 闭环条 ---------------- */
.ai-closed-loop {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    background: linear-gradient(100deg, #0f4b45, #0b3833);
    color: #d8e8e4; border-radius: 12px; padding: 9px 16px; margin-bottom: 14px;
    box-shadow: 0 8px 20px rgba(12, 55, 51, .14);
}
.ai-loop-title { font-size: var(--fs-sm); letter-spacing: .04em; color: var(--gold); font-weight: 600; }
.ai-closed-loop ol { display: flex; align-items: center; gap: 6px; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.ai-closed-loop li {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: var(--fs-sm); color: #e6f2ef; background: rgba(255, 255, 255, .08);
    border-radius: 999px; padding: 3px 10px 3px 4px; white-space: nowrap;
}
.ai-closed-loop li b {
    width: 17px; height: 17px; border-radius: 50%; display: grid; place-items: center;
    background: rgba(217, 178, 109, .9); color: #2c2109; font-size: var(--fs-xs); font-weight: 700;
}
.ai-loop-note { font-size: var(--fs-sm); color: #5c706b; margin-left: auto; }

/* ---------------- 场景 Tab ---------------- */
.ai-tabs {
    display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line-strong);
    padding-bottom: 0; margin-bottom: 14px;
}
.ai-tab {
    border: 0; background: transparent; padding: 9px 13px; font-size: var(--fs-base);
    color: #5a6a67; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
    font-family: inherit; border-radius: 8px 8px 0 0; transition: color .15s, background .15s;
    display: inline-flex; align-items: center; gap: 5px;
}
.ai-tab:hover { background: #fff; color: var(--brand); }
.ai-tab.on { color: var(--brand); font-weight: 700; border-bottom-color: var(--brand); background: #fff; }
.ai-tab .dot { font-size: var(--fs-xs); opacity: .55; }
.ai-tab.on .dot { opacity: 1; color: var(--gold); }

/* ---------------- 主体两栏 ---------------- */
.ai-main { display: grid; grid-template-columns: 372px minmax(0, 1fr); gap: 14px; align-items: start; }
.panel {
    background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
    box-shadow: 0 6px 18px rgba(15, 40, 36, .04);
}
.ai-left { padding: 16px 17px; position: sticky; top: 14px; }
.ai-left h2 { font-size: var(--fs-lg); margin-bottom: 2px; }
.ai-role { font-size: var(--fs-sm); color: var(--brand-2); margin: 0 0 9px; }
.ai-value { font-size: var(--fs-base); color: var(--ink-2); line-height: 1.75; margin: 0 0 10px; }
.ai-talk {
    background: #f0f8f5; border-left: 3px solid var(--brand-2); border-radius: 8px;
    padding: 9px 11px; margin: 10px 0 4px; font-size: var(--fs-sm); color: #1e4a42; line-height: 1.75;
}
.ai-talk b { display: block; color: var(--brand); font-size: var(--fs-sm); margin-bottom: 2px; letter-spacing: .03em; }
.ai-label { display: block; font-size: var(--fs-sm); font-weight: 700; color: #5a6a67; margin: 14px 0 6px; }
.ai-input {
    width: 100%; min-height: 92px; border: 1px solid var(--line-strong); border-radius: 10px;
    padding: 9px 10px; font-size: var(--fs-base); line-height: 1.75; font-family: inherit;
    resize: vertical; color: var(--ink); background: #fff;
}
.ai-input:focus { outline: none; border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(14, 124, 111, .08); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.chip {
    border: 1px solid var(--line-strong); background: #fff; border-radius: 999px;
    padding: 3px 10px; font-size: var(--fs-sm); cursor: pointer; color: var(--ink-2);
    font-family: inherit; transition: all .15s; text-align: left;
}
.chip:hover { border-color: var(--brand-2); color: var(--brand); background: var(--brand-soft); }
.ai-run { width: 100%; margin-top: 13px; height: 40px; font-size: var(--fs-md); font-weight: 700; }
.ai-run:disabled { opacity: .6; cursor: progress; }
.ai-note { font-size: var(--fs-sm); color: var(--muted); margin-top: 10px; line-height: 1.7; }
.ai-left-links { margin-top: 12px; padding-top: 11px; border-top: 1px dashed var(--line-strong); display: flex; flex-direction: column; gap: 5px; }
.ai-left-links a { font-size: var(--fs-sm); color: var(--brand-2); }
.ai-left-links span { font-size: var(--fs-sm); color: var(--muted); }

/* ---------------- 舞台 ---------------- */
.ai-stage { min-height: 620px; max-height: calc(100vh - 208px); display: flex; flex-direction: column; overflow: hidden; }
.ai-empty { margin: auto; text-align: center; color: var(--muted); padding: 60px 24px; }
.ai-empty .big { font-size: var(--fs-6xl); color: #cfdedb; line-height: 1; margin-bottom: 10px; }
.ai-empty h3 { font-size: var(--fs-lg); color: var(--ink-2); margin-bottom: 4px; }
.ai-empty p { font-size: var(--fs-base); }
.ai-empty .hint { margin-top: 14px; font-size: var(--fs-sm); color: var(--muted); }

.ai-scroll { padding: 16px 18px 20px; display: flex; flex-direction: column; gap: 11px; flex: 1; min-height: 0; overflow-y: auto; }

/* 舞台内滚动条更轻 */
.ai-scroll::-webkit-scrollbar { width: 8px; }
.ai-scroll::-webkit-scrollbar-thumb { background: #d5e2df; border-radius: 8px; }
.ai-scroll::-webkit-scrollbar-track { background: transparent; }

.msg { display: flex; gap: 9px; align-items: flex-start; }
.msg-av {
    width: 28px; height: 28px; border-radius: 8px; flex: none; display: grid; place-items: center;
    font-size: var(--fs-sm); font-weight: 700; color: #fff;
}
.msg.user .msg-av { background: #e3ebe9; color: var(--brand); }
.msg.ai .msg-av { background: linear-gradient(135deg, var(--brand-2), #0a3a35); }
.bubble {
    background: #eef4f3; border-radius: 4px 12px 12px 12px; padding: 9px 12px;
    font-size: var(--fs-base); white-space: pre-wrap; line-height: 1.8; color: #21322f; max-width: 720px;
}
.assistant {
    background: #fff; border: 1px solid var(--line); border-radius: 12px;
    padding: 11px 13px; flex: 1; min-width: 0;
}
.assistant.flush { border: 0; background: transparent; padding: 0; }

.steps { display: flex; flex-direction: column; gap: 6px; }
.step { display: flex; gap: 8px; align-items: flex-start; font-size: var(--fs-base); color: #6b7b78; }
.step .ico { width: 14px; text-align: center; flex: none; font-size: var(--fs-sm); line-height: 1.7; }
.step.done { color: #1c4942; }
.step.on { color: var(--ink); }
.step.on .ico { color: var(--brand-2); animation: ai-blink 1s infinite; }
.step .why { display: block; font-size: var(--fs-sm); color: var(--muted); }
@keyframes ai-blink { 50% { opacity: .32; } }

.stream { font-size: var(--fs-base); line-height: 1.9; color: #1d2b29; white-space: pre-wrap; }
.stream b, .stream strong { color: var(--brand); }
.stream .k { color: var(--gold); font-weight: 700; font-variant-numeric: tabular-nums; }
.caret { display: inline-block; width: 6px; height: 15px; background: var(--brand-2); vertical-align: -2px; animation: ai-blink 1s infinite; }

.out { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.out-title {
    font-weight: 700; font-size: var(--fs-base); padding: 8px 13px; border-bottom: 1px solid var(--line);
    color: var(--ink); background: #f8fbfa; display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.out-title small { font-weight: 400; color: var(--muted); font-size: var(--fs-sm); }
.out table { width: 100%; font-size: var(--fs-sm); }
.out th {
    background: #f2f7f5; color: #51635f; text-align: left; padding: 7px 12px;
    font-weight: 600; white-space: nowrap; border-bottom: 1px solid var(--line);
}
.out td { padding: 7px 12px; border-top: 1px solid #f0f4f3; vertical-align: top; }
.out tr:first-child td { border-top: 0; }
.out .r { text-align: right; font-variant-numeric: tabular-nums; }
.out .m { color: var(--brand); font-weight: 700; font-variant-numeric: tabular-nums; }
.out .neg { color: var(--danger); font-weight: 700; }
.out .pos { color: var(--ok); font-weight: 700; }
.out-foot { padding: 7px 13px; border-top: 1px solid var(--line); font-size: var(--fs-sm); color: var(--muted); background: #fcfdfd; }

.callout {
    background: var(--gold-soft); border: 1px solid #eddfc0; border-radius: 10px;
    padding: 9px 12px; font-size: var(--fs-sm); color: #6f5316; line-height: 1.8;
}
.callout.warn { background: var(--danger-soft); border-color: #f0cdcd; color: #8b2f2f; }
.callout.ok { background: var(--ok-soft); border-color: #c4e5d3; color: #1c6242; }
.callout.info { background: var(--brand-soft); border-color: #cbe3de; color: #12463f; }
.callout b { color: inherit; }

.kv { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 5px 10px; font-size: var(--fs-sm); }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--ink); }

.bars { display: flex; flex-direction: column; gap: 6px; }
.bar-row { display: grid; grid-template-columns: 118px minmax(0, 1fr) 74px; gap: 8px; align-items: center; font-size: var(--fs-sm); }
.bar-row .who { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .track { height: 9px; background: #edf3f1; border-radius: 999px; overflow: hidden; }
.bar-row .fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #35a894, var(--brand)); }
.bar-row .fill.gold { background: linear-gradient(90deg, #e3c076, var(--gold)); }
.bar-row .fill.red { background: linear-gradient(90deg, #e08d8d, var(--danger)); }
.bar-row .val { text-align: right; color: var(--ink-2); font-variant-numeric: tabular-nums; }

.ai-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.ai-actions .btn { font-size: var(--fs-sm); height: 32px; padding: 0 12px; }
.ai-actions .hint { font-size: var(--fs-sm); color: var(--muted); align-self: center; }

.ai-draft {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    border: 1px dashed var(--brand-2); background: #f4faf8; border-radius: 10px;
    padding: 9px 12px; font-size: var(--fs-sm); color: #1c4942;
}
.ai-draft .no { font-family: Consolas, monospace; font-weight: 700; color: var(--brand); letter-spacing: .02em; }
.ai-draft .tag {
    margin-left: auto; font-size: var(--fs-sm); background: var(--ok-soft); color: var(--ok);
    border-radius: 999px; padding: 2px 9px; border: 1px solid #cbe7d8;
}

.ai-foot { text-align: center; color: #5c706b; font-size: var(--fs-sm); margin-top: 20px; line-height: 1.8; }
.ai-foot-meta { font-size: var(--fs-sm); color: var(--muted); }
.ai-foot-meta a { color: var(--brand-2); }
.ai-foot-meta span { margin: 0 5px; opacity: .5; }

/* ---------------- 舞台工具条 ---------------- */
.ai-stage-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 8px 14px; border-bottom: 1px solid var(--line); background: #fbfdfc;
    flex-wrap: wrap;
}
.ai-stage-title { font-size: var(--fs-sm); color: var(--ink-2); display: inline-flex; align-items: center; gap: 7px; }
.ai-dot {
    width: 6px; height: 6px; border-radius: 50%; background: var(--brand-2);
    box-shadow: 0 0 0 3px rgba(14, 124, 111, .12);
}
.ai-stage-tools { display: flex; gap: 6px; }
.ai-mini {
    border: 1px solid var(--line-strong); background: #fff; color: var(--ink-2);
    border-radius: 8px; padding: 3px 10px; font-size: var(--fs-sm); cursor: pointer;
    font-family: inherit; transition: all .15s;
}
.ai-mini:hover { border-color: var(--brand-2); color: var(--brand); }
.ai-mini:disabled { opacity: .5; cursor: default; }
.ai-divider {
    display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: var(--fs-sm);
    margin: 4px 0;
}
.ai-divider::before, .ai-divider::after {
    content: ''; height: 1px; background: var(--line); flex: 1;
}

/* ---------------- 响应式 ---------------- */
@media (max-width: 1080px) {
    .ai-main { grid-template-columns: 320px minmax(0, 1fr); }
    .ai-closed-loop .ai-loop-note { display: none; }
}
@media (max-width: 900px) {
    .ai-page { padding: 12px 14px 40px; }
    .ai-main { grid-template-columns: 1fr; }
    .ai-left { position: static; }
    .ai-stage { min-height: 460px; max-height: none; }
    .ai-head { flex-direction: column; align-items: flex-start; }
    .ai-head-right { width: 100%; }
    .ai-tabs { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 0; }
    .ai-tab { white-space: nowrap; }
    .ai-closed-loop { gap: 8px; }
    .ai-loop-title { width: 100%; }
    .out { overflow-x: auto; }
    .out table { min-width: 520px; }
}
@media (max-width: 620px) {
    .ai-head-title h1 { font-size: var(--fs-xl); }
    .ai-sub { display: none; }
    .ai-brand-text small { display: none; }
    .ai-stage { min-height: 400px; }
    .ai-scroll { padding: 12px 12px 16px; }
    .bar-row { grid-template-columns: 92px minmax(0, 1fr) 60px; }
    .kv { grid-template-columns: 76px minmax(0, 1fr); }
    .ai-user { display: none; }
}

@media print {
    .ai-tabs, .ai-left, .ai-head-right, .ai-closed-loop, .ai-foot-meta { display: none !important; }
    .ai-main { grid-template-columns: 1fr; }
    .page-watermark { display: none !important; }
}
