/* AI精灵 · 问营况 / 帮生成 */
.tm-camp-ai-controls {
    margin-bottom: 8px;
}
.tm-camp-ai-mode-row,
.tm-camp-ai-sub-row,
.tm-camp-ai-extra-row,
.tm-camp-ai-examples {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 6px;
}
.tm-camp-ai-pill {
    border: 1px solid rgba(46, 134, 171, 0.35);
    background: rgba(46, 134, 171, 0.06);
    color: var(--text-color, #2c3e50);
    border-radius: 999px;
    padding: 3px 10px;
    font-size: 12px;
    line-height: 1.4;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.tm-camp-ai-pill:hover {
    border-color: rgba(46, 134, 171, 0.55);
    background: rgba(46, 134, 171, 0.12);
}
.tm-camp-ai-pill.active {
    background: var(--primary-color, #2e86ab);
    border-color: var(--primary-color, #2e86ab);
    color: #fff;
}
.tm-camp-ai-mode {
    font-weight: 600;
    padding: 4px 12px;
}
.tm-camp-ai-example {
    border: 1px dashed rgba(0, 0, 0, 0.18);
    background: transparent;
    color: var(--text-muted, #6c757d);
    border-radius: 999px;
    padding: 2px 10px;
    font-size: 11px;
    cursor: pointer;
}
.tm-camp-ai-example:hover {
    border-color: var(--primary-color, #2e86ab);
    color: var(--primary-color, #2e86ab);
}

.tm-goal-forge {
    width: 100%;
    padding: 8px 0 2px;
}
.tm-goal-forge-actions,
.tm-goal-forge-dock {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 6px;
}
.tm-goal-forge-dock {
    position: sticky;
    bottom: 0;
    z-index: 3;
    margin: 0 0 8px;
    padding: 8px 0 2px;
    background: var(--tm-rs-bg, var(--bg-card, #1a1d24));
}
.tm-goal-forge-dock[hidden] {
    display: none !important;
}
.tm-goal-forge-preview {
    font-weight: 700;
    border-color: rgba(214, 158, 46, 0.55);
    background: rgba(214, 158, 46, 0.12);
}
.tm-goal-forge-hint {
    flex: 1 1 100%;
    margin-top: 4px;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-muted, #c5c0b4);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
}
.tm-goal-forge-note {
    font-size: 11px;
    color: var(--text-muted, #6c757d);
    margin-bottom: 6px;
}
.tm-goal-forge-howto {
    margin: 0 0 8px;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid rgba(214, 158, 46, 0.22);
    background: rgba(214, 158, 46, 0.06);
    font-size: 12px;
    line-height: 1.55;
    color: var(--text-muted, #c5c0b4);
}
.tm-goal-forge-howto summary {
    cursor: pointer;
    font-weight: 650;
    color: #e4c37a;
    list-style: none;
}
.tm-goal-forge-howto summary::-webkit-details-marker {
    display: none;
}
.tm-goal-forge-howto-body {
    margin-top: 8px;
}
.tm-goal-forge-howto-body p {
    margin: 0 0 8px;
}
.tm-goal-forge-howto-body p:last-child {
    margin-bottom: 0;
}
.tm-camp-ai-explain .tm-goal-forge-howto {
    margin: 10px 0 0;
}
.tm-goal-forge-slots {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
    margin-bottom: 6px;
}
.tm-goal-forge-slot {
    font-size: 11px;
    color: var(--text-muted, #6c757d);
}
.tm-goal-forge-slot.is-on {
    color: var(--primary-color, #2e86ab);
}
.tm-goal-forge-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.tm-goal-forge-list .active {
    border-color: var(--primary-color, #2e86ab);
    color: var(--primary-color, #2e86ab);
}
.tm-goal-forge-chip {
    display: inline-flex;
    align-items: stretch;
    max-width: 100%;
}
.tm-goal-forge-chip .tm-camp-ai-example {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}
.tm-goal-forge-del {
    border: 1px solid rgba(214, 158, 46, 0.28);
    border-left: 0;
    background: rgba(0, 0, 0, 0.18);
    color: #c9b38a;
    padding: 0 8px;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    line-height: 1;
    font-size: 14px;
}
.tm-goal-forge-del:hover {
    color: #f3d9a0;
    background: rgba(180, 60, 40, 0.22);
}
.tm-camp-ai-ask {
    margin-top: 8px;
    padding: 10px;
    border-radius: 10px;
    background: rgba(214, 158, 46, 0.08);
    border: 1px solid rgba(214, 158, 46, 0.22);
    font-size: 12px;
}
.tm-camp-ai-ask-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tm-camp-ai-draft {
    margin-top: 8px;
    padding: 10px;
    border-radius: 10px;
    background: rgba(46, 134, 171, 0.08);
    border: 1px solid rgba(46, 134, 171, 0.18);
    font-size: 12px;
}
.tm-camp-ai-draft-title {
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--primary-color, #2e86ab);
}
.tm-camp-ai-draft-summary {
    color: var(--text-muted, #6c757d);
    margin-bottom: 8px;
}
.tm-camp-ai-refine-hint {
    margin: 0 0 12px;
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.55;
    color: #f3e2b0;
    background: rgba(214, 158, 46, 0.22);
    border: 1px solid rgba(228, 195, 122, 0.6);
    box-shadow: 0 0 0 1px rgba(214, 158, 46, 0.15);
}
.tm-camp-ai-refine-title {
    font-weight: 800;
    font-size: 14px;
    margin-bottom: 4px;
    color: #f6d27a;
}
.tm-camp-ai-refine-body {
    font-size: 13px;
}
.tm-camp-ai-field-hint {
    margin: -4px 0 10px;
    padding: 0 2px;
    font-size: 11px;
    line-height: 1.5;
    color: var(--text-muted, #9aa0a8);
}
.tm-camp-ai-explain {
    display: block;
    margin: 8px 0 10px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(214, 158, 46, 0.08);
    border: 1px solid rgba(214, 158, 46, 0.28);
    color: var(--text-color, #e8e0d0);
    line-height: 1.55;
}
.tm-camp-ai-explain-title {
    font-weight: 700;
    margin-bottom: 6px;
    color: #e4c37a;
}
.tm-camp-ai-explain-body {
    font-size: 12px;
    white-space: normal;
}
.tm-camp-ai-explain.is-flash {
    animation: tm-explain-flash 0.9s ease;
}
@keyframes tm-explain-flash {
    0% { box-shadow: 0 0 0 0 rgba(228, 195, 122, 0.55); }
    100% { box-shadow: 0 0 0 10px rgba(228, 195, 122, 0); }
}
.tm-camp-ai-explain[hidden] {
    display: none !important;
}
.tm-camp-ai-link {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(46, 134, 171, 0.1);
    border: 1px solid rgba(46, 134, 171, 0.28);
    font-size: 12px;
    line-height: 1.5;
    color: #e8eef2;
}
.tm-camp-ai-link.is-off {
    opacity: 0.72;
}
.tm-camp-ai-link.is-ready {
    opacity: 1;
    border-color: rgba(232, 196, 110, 0.55);
    background: rgba(214, 158, 46, 0.14);
}
.tm-camp-ai-link[hidden] {
    display: none !important;
}
.tm-camp-ai-link-title {
    font-weight: 700;
    margin-bottom: 4px;
    color: #f6e7b8;
}
.tm-camp-ai-link-check {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 8px 0;
    cursor: pointer;
}
.tm-camp-ai-link-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}
.tm-camp-ai-link-spawn,
.tm-camp-ai-draft button.tm-camp-ai-link-spawn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 6px 14px;
    border-radius: 8px;
    border: 1px solid #f0d48a !important;
    background: #e8c35a !important;
    color: #1c1408 !important;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.2;
    cursor: pointer;
    pointer-events: auto !important;
    opacity: 1 !important;
}
.tm-camp-ai-link-spawn:hover {
    background: #f3d56e !important;
    color: #111 !important;
}
.tm-camp-ai-link.is-off .tm-camp-ai-link-spawn {
    background: #c4a24a !important;
    color: #1c1408 !important;
}
.tm-camp-ai-link-today {
    font-size: 12px;
}
.tm-rs-chat-error {
    border: 1px solid rgba(214, 158, 46, 0.35);
    background: rgba(180, 80, 40, 0.12);
}
.tm-rs-chat-retry {
    margin-top: 8px;
    border: 1px solid rgba(214, 158, 46, 0.5);
    background: rgba(214, 158, 46, 0.16);
    color: #e4c37a;
}
.tm-camp-ai-link-status {
    margin-top: 6px;
    color: var(--text-muted, #6c757d);
}
.tm-rs-chat-error {
    border: 1px solid rgba(214, 158, 46, 0.35);
    background: rgba(180, 80, 40, 0.12);
}
.tm-rs-chat-retry {
    margin-top: 8px;
    border: 1px solid rgba(214, 158, 46, 0.5);
    background: rgba(214, 158, 46, 0.16);
    color: #e4c37a;
}
.tm-camp-ai-draft-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin: 10px 0 8px;
}
.tm-camp-ai-draft-actions .btn,
.tm-camp-ai-draft-actions .tm-camp-ai-link-spawn {
    margin: 0;
}
.tm-camp-ai-draft-explain {
    border: 1px solid rgba(214, 158, 46, 0.45);
    background: rgba(214, 158, 46, 0.12);
    color: #e4c37a;
}
.tm-camp-ai-draft-title small {
    font-weight: 400;
    color: var(--text-muted, #6c757d);
    font-size: 11px;
}
.tm-camp-ai-draft-item {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    padding: 6px 0;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    margin: 0;
}
.tm-camp-ai-draft-item--edit {
    display: block;
    padding: 10px 0;
}
.tm-camp-ai-draft-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    margin-bottom: 8px;
    cursor: pointer;
}
.tm-camp-ai-draft-fields {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-left: 2px;
}
.tm-camp-ai-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0;
    font-size: 12px;
    min-width: 0;
}
.tm-camp-ai-field > span {
    color: var(--text-muted, #6c757d);
    font-size: 11px;
}
.tm-camp-ai-field .form-control {
    font-size: 13px;
    line-height: 1.4;
}
.tm-camp-ai-field textarea.form-control {
    min-height: 52px;
    resize: vertical;
}
.tm-camp-ai-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
@media (max-width: 768px) {
    .tm-camp-ai-field-row {
        grid-template-columns: 1fr;
    }
    .tm-camp-ai-field .form-control {
        font-size: 16px;
        min-height: 40px;
    }
}
.tm-camp-ai-forge-part {
    margin: 10px 0 8px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(214, 158, 46, 0.28);
    background: rgba(214, 158, 46, 0.07);
}
.tm-camp-ai-forge-part-title {
    font-weight: 700;
    font-size: 13px;
    color: #e4c37a;
    margin-bottom: 4px;
}
.tm-camp-ai-forge-part-body {
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-muted, #c5c0b4);
    margin-bottom: 8px;
}
.tm-camp-ai-forge-part-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.tm-camp-ai-forge-act,
.tm-goal-forge-dock .tm-camp-ai-pill[data-act="preview-stages"],
.tm-goal-forge-dock .tm-camp-ai-pill[data-act="preview-metrics"] {
    color: #1c1408 !important;
    border-color: #f3d56e !important;
    background: #e8c35a !important;
    font-weight: 800;
}
.tm-camp-ai-forge-act:hover,
.tm-goal-forge-dock .tm-camp-ai-pill[data-act="preview-stages"]:hover,
.tm-goal-forge-dock .tm-camp-ai-pill[data-act="preview-metrics"]:hover {
    color: #fff6d4 !important;
    border-color: rgba(246, 220, 140, 0.8) !important;
    background: rgba(214, 158, 46, 0.32) !important;
}
.tm-camp-ai-draft-status {
    font-size: 11px;
    color: var(--text-muted, #6c757d);
}

.ai-assistant-body .tm-camp-ai-controls,
.tm-rs-panel[data-panel="chat"] .tm-camp-ai-controls {
    padding: 0 2px;
    flex-shrink: 0;
}
.tm-rs-panel[data-panel="chat"] > .d-flex,
.tm-rs-panel[data-panel="chat"] .tm-rs-chat-input-row,
.tm-rs-panel[data-panel="chat"] .tm-goal-forge-dock {
    flex-shrink: 0;
}
body.tm-rs-chat-expanded .tm-rs-panel[data-panel="chat"] .tm-rs-chat-messages,
.tm-rs-panel[data-panel="chat"] .tm-rs-chat-messages {
    min-height: 0;
}

/* 多行输入：侧栏 / 浮窗 / 专页 */
.tm-camp-ai-input,
textarea.tm-camp-ai-input {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    min-height: 36px;
    max-height: 120px;
    resize: none;
    overflow-y: hidden;
    line-height: 1.45;
    field-sizing: content;
    white-space: pre-wrap;
    word-break: break-word;
}
.tm-rs-chat-input-row {
    align-items: flex-end;
}
.tm-rs-chat-input-actions,
.tm-float-chat-input-actions,
.tm-page-chat-input-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}
.tm-rs-chat-input-actions .btn,
.tm-float-chat-input-actions .btn,
.tm-float-chat-input-actions .voice-btn,
.tm-page-chat-input-actions .btn,
.tm-page-chat-input-actions .voice-btn {
    min-width: 36px;
}
.tm-rs-chat-input-row .tm-rs-chat-voice {
    flex-shrink: 0;
}
.tm-rs-chat-input-row .tm-rs-chat-voice.recording {
    background: #c0392b;
    border-color: #c0392b;
    color: #fff;
    animation: tm-camp-ai-pulse 1s infinite;
}
.ai-assistant-body .chat-input-area {
    align-items: flex-end;
}
.ai-assistant-body .chat-input.tm-camp-ai-input {
    min-height: 38px;
    max-height: 140px;
}

@media (max-width: 1100px) {
    .tm-camp-ai-input,
    textarea.tm-camp-ai-input {
        max-height: 140px;
        font-size: 14px;
        min-height: 40px;
    }
}
@media (max-width: 768px) {
    .tm-camp-ai-input,
    textarea.tm-camp-ai-input {
        max-height: 160px;
        font-size: 16px; /* 避免 iOS 聚焦自动放大 */
        min-height: 44px;
        padding-top: 10px;
        padding-bottom: 10px;
    }
    .tm-rs-chat-input-actions {
        flex-direction: row;
    }
    .tm-rs-chat-input-actions .btn {
        min-height: 40px;
        min-width: 40px;
    }
}
@keyframes tm-camp-ai-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

html[data-tm-ui="dark"] .tm-camp-ai-pill {
    border-color: rgba(120, 180, 210, 0.35);
    background: rgba(120, 180, 210, 0.08);
    color: var(--text-color, #e8eef2);
}
html[data-tm-ui="dark"] .tm-camp-ai-pill.active {
    background: var(--primary-color, #3d9ec4);
    border-color: var(--primary-color, #3d9ec4);
    color: #fff;
}
html[data-tm-ui="dark"] .tm-camp-ai-draft {
    background: rgba(120, 180, 210, 0.1);
    border-color: rgba(120, 180, 210, 0.22);
}
