/* =============================================
   AI服务话术工具 - 主样式
   主题色：蓝色 #0ea5e9 / AI绿 #10b981
   ============================================= */

/* ========== 容器 ========== */
.ass-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);
    min-height: 620px;
    background: #f8fafc;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
}

.ass-container.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999;
    border-radius: 0;
    margin: 0;
}

/* ========== 顶部工具栏 ========== */
.ass-toolbar {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: linear-gradient(135deg, #0ea5e9 0%, #3b82f6 100%);
    color: white;
    flex-wrap: wrap;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.3);
    flex-shrink: 0;
    min-height: 44px;
}

.toolbar-group {
    display: flex;
    gap: 5px;
    align-items: center;
}

.toolbar-group--right {
    margin-left: auto;
}

.ass-toolbar-btn {
    padding: 5px 10px;
    background: rgba(255, 255, 255, 0.92);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: #0369a1;
    transition: all 0.2s;
    white-space: nowrap;
    line-height: 1.5;
}

.ass-toolbar-btn:hover {
    background: #fff;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
}

.ass-toolbar-btn:active {
    transform: translateY(0);
    box-shadow: none;
}

/* AI生成按钮 - 绿色强调 */
.ass-toolbar-btn--ai {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    font-weight: 600;
    padding: 5px 14px;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.4);
}

.ass-toolbar-btn--ai:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: white;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.45);
}

/* ========== 主内容区 ========== */
.ass-main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    background: #f8fafc;
}

/* ========== 左侧历史面板 ========== */
.ass-history-panel {
    width: 200px;
    min-width: 160px;
    background: white;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 9px 12px;
    background: linear-gradient(to bottom, #fafafa, #f5f5f5);
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.panel-header h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
}

.history-clear-btn {
    background: #fff0f0;
    border: none;
    color: #ef4444;
    font-size: 11px;
    cursor: pointer;
    padding: 2px 7px;
    border-radius: 3px;
    transition: all 0.2s;
}

.history-clear-btn:hover {
    background: #fde8e8;
    color: #dc2626;
}

.history-search {
    padding: 8px;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
}

.history-search input {
    width: 100%;
    padding: 5px 9px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 12px;
    outline: none;
    transition: all 0.2s;
    box-sizing: border-box;
    color: #334155;
}

.history-search input:focus {
    border-color: #0ea5e9;
    box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.1);
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px;
}

.history-empty {
    text-align: center;
    color: #94a3b8;
    font-size: 12px;
    padding: 28px 12px;
    line-height: 1.6;
}

.history-empty-icon { font-size: 28px; margin-bottom: 8px; }
.history-empty-sub  { font-size: 11px; color: #94a3b8; margin-top: 4px; }

.history-item {
    padding: 9px 10px;
    margin-bottom: 5px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.18s;
    position: relative;
    animation: assItemFadeIn 0.2s ease;
}

@keyframes assItemFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.history-item:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    transform: translateX(2px);
}

.history-item.active {
    background: #e0f2fe;
    border-color: #0ea5e9;
    box-shadow: 0 1px 4px rgba(14, 165, 233, 0.15);
}

.history-item-title {
    font-size: 12px;
    font-weight: 600;
    color: #1e293b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 3px;
    padding-right: 18px;
}

.history-item-meta {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.history-type-badge {
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 3px;
    background: #e0f2fe;
    color: #0369a1;
    font-weight: 500;
    white-space: nowrap;
}

.history-item-time {
    font-size: 10px;
    color: #94a3b8;
    white-space: nowrap;
}

.history-item-delete {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 16px;
    height: 16px;
    background: #fde8e8;
    color: #ef4444;
    border: none;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
    opacity: 0;
    transition: all 0.18s;
    padding: 0;
    line-height: 1;
}

.history-item:hover .history-item-delete {
    opacity: 1;
}

.history-item-delete:hover {
    background: #ef4444;
    color: white;
}

/* ========== 中间：编辑/配置面板 ========== */
.ass-editor-panel {
    width: 360px;
    min-width: 300px;
    background: white;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
}

.editor-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: linear-gradient(to bottom, #fafafa, #f5f5f5);
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.editor-panel-title {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
}

.editor-panel-meta {
    font-size: 11px;
    color: #94a3b8;
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 3px;
}

.ass-form {
    flex: 1;
    overflow-y: auto;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* 表单元素 */
.ass-form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.ass-form-row {
    display: flex;
    gap: 8px;
}

.ass-form-group--half {
    flex: 1;
    min-width: 0;
}

.ass-label {
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 5px;
}

.required-mark {
    color: #ef4444;
    font-size: 13px;
    line-height: 1;
}

.ass-label-hint {
    font-weight: 400;
    color: #94a3b8;
    font-size: 11px;
}

.ass-input,
.ass-select,
.ass-textarea {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 5px;
    font-size: 13px;
    color: #334155;
    background: #fafafa;
    outline: none;
    transition: all 0.2s;
    box-sizing: border-box;
    font-family: inherit;
}

.ass-input:focus,
.ass-select:focus,
.ass-textarea:focus {
    border-color: #0ea5e9;
    background: white;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.08);
}

.ass-textarea {
    resize: vertical;
    min-height: 70px;
    line-height: 1.55;
}

.ass-textarea::placeholder,
.ass-input::placeholder {
    color: #cbd5e1;
    font-size: 12px;
}

.ass-select {
    cursor: pointer;
    appearance: auto;
}

/* 话术组件复选框组 */
.ass-checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.ass-checkbox-item {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-size: 12px;
    color: #475569;
    padding: 5px 9px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    background: #fafafa;
    transition: all 0.18s;
    user-select: none;
}

.ass-checkbox-item:hover {
    border-color: #0ea5e9;
    background: #f0f9ff;
}

.ass-checkbox-item input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: #0ea5e9;
    cursor: pointer;
    flex-shrink: 0;
}

.ass-checkbox-item:has(input:checked) {
    border-color: #0ea5e9;
    background: #e0f2fe;
    color: #0369a1;
    font-weight: 500;
}

/* 复选框快捷操作区 */
.ass-checkbox-quick {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 7px;
    font-size: 11px;
    color: #94a3b8;
}

.ass-checkbox-quick-btn {
    background: none;
    border: none;
    color: #0ea5e9;
    font-size: 11px;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
    transition: color 0.15s;
}

.ass-checkbox-quick-btn:hover {
    color: #0369a1;
}

/* 元信息提醒状态 */
.editor-meta--warn {
    color: #d97706 !important;
    background: #fefce8 !important;
}

/* 表单操作按钮 */
.ass-form-actions {
    display: flex;
    gap: 10px;
    padding-top: 2px;
    padding-bottom: 2px;
}

.ass-btn {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.ass-btn--primary {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.35);
}

.ass-btn--primary:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.4);
}

.ass-btn--primary:active {
    transform: translateY(0);
}

.ass-btn--primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.ass-btn--secondary {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.ass-btn--secondary:hover {
    background: #e2e8f0;
    color: #334155;
}

/* 字符计数器 */
.ass-char-counter {
    font-size: 11px;
    color: #94a3b8;
    text-align: right;
    padding: 1px 0;
    transition: color 0.2s;
}
.ass-char-counter.near-limit { color: #f59e0b; }
.ass-char-counter.at-limit   { color: #ef4444; font-weight: 600; }

/* ========== 右侧：话术预览面板 ========== */
.ass-preview-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    overflow: hidden;
    min-width: 320px;
    position: relative;
}

.preview-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: linear-gradient(to bottom, #fafafa, #f5f5f5);
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.preview-panel-header h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
}

.preview-panel-actions {
    display: flex;
    gap: 6px;
}

.preview-action-btn {
    padding: 4px 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 11px;
    color: #64748b;
    cursor: pointer;
    transition: all 0.18s;
    white-space: nowrap;
}

.preview-action-btn:hover {
    border-color: #0ea5e9;
    color: #0ea5e9;
    background: #f0f9ff;
}

.preview-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    position: relative;
}

/* 空状态 */
.preview-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 300px;
    color: #94a3b8;
    text-align: center;
}

.preview-empty-icon {
    font-size: 52px;
    margin-bottom: 14px;
    opacity: 0.5;
    animation: assFloatEmoji 3s ease-in-out infinite;
}

@keyframes assFloatEmoji {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-8px); }
}

.preview-empty-title {
    font-size: 15px;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 8px;
}

.preview-empty-title--error { color: #ef4444; }

.preview-empty-hint {
    font-size: 13px;
    color: #94a3b8;
    line-height: 1.7;
}

/* 加载状态 */
.preview-loading {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    z-index: 10;
    backdrop-filter: blur(2px);
}

.loading-spinner {
    width: 44px;
    height: 44px;
    border: 3px solid #e2e8f0;
    border-top-color: #10b981;
    border-radius: 50%;
    animation: assSpin 0.8s linear infinite;
}

@keyframes assSpin {
    to { transform: rotate(360deg); }
}

.loading-title {
    font-size: 15px;
    font-weight: 600;
    color: #334155;
}

.loading-hint {
    font-size: 12px;
    color: #94a3b8;
}

.cancel-generate-btn {
    padding: 7px 18px;
    background: #fff0f0;
    border: 1px solid #fecaca;
    border-radius: 5px;
    color: #ef4444;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
    margin-top: 4px;
}

.cancel-generate-btn:hover {
    background: #fde8e8;
    border-color: #ef4444;
}

/* ========== 话术预览卡片 ========== */
.ass-preview-result {
    animation: assPreviewIn 0.32s ease forwards;
}

@keyframes assPreviewIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.preview-meta-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid #bae6fd;
    border-radius: 7px;
    margin-bottom: 14px;
    font-size: 12px;
    color: #0369a1;
    flex-wrap: wrap;
}

.preview-meta-bar .meta-tag {
    background: white;
    border: 1px solid #bae6fd;
    padding: 2px 8px;
    border-radius: 3px;
    font-weight: 500;
    white-space: nowrap;
}

/* 话术段落 */
.script-section {
    margin-bottom: 16px;
    border: 1px solid #e2e8f0;
    border-radius: 7px;
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.script-section:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.section-header {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 12px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}

.section-header:hover {
    background: #f1f5f9;
}

.section-icon {
    font-size: 16px;
    line-height: 1;
}

.section-title {
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    flex: 1;
}

.section-count {
    font-size: 11px;
    color: #94a3b8;
    background: #e2e8f0;
    padding: 1px 6px;
    border-radius: 8px;
}

.section-toggle {
    color: #94a3b8;
    font-size: 12px;
    transition: transform 0.2s;
}

.section-toggle.collapsed {
    transform: rotate(-90deg);
}

/* ─── 各段落着色主题 ─── */
.script-section[data-section="greeting"]    > .section-header { border-left: 3px solid #06b6d4; }
.script-section[data-section="acknowledge"] > .section-header { border-left: 3px solid #f59e0b; }
.script-section[data-section="empathy"]     > .section-header { border-left: 3px solid #ec4899; }
.script-section[data-section="solution"]    > .section-header { border-left: 3px solid #10b981; }
.script-section[data-section="closing"]     > .section-header { border-left: 3px solid #8b5cf6; }
.script-section[data-section="alternative"] > .section-header { border-left: 3px solid #f97316; }

.script-section[data-section="greeting"]    .section-count { background: #cffafe; color: #0e7490; }
.script-section[data-section="acknowledge"] .section-count { background: #fef3c7; color: #92400e; }
.script-section[data-section="empathy"]     .section-count { background: #fce7f3; color: #9d174d; }
.script-section[data-section="solution"]    .section-count { background: #d1fae5; color: #065f46; }
.script-section[data-section="closing"]     .section-count { background: #ede9fe; color: #4c1d95; }
.script-section[data-section="alternative"] .section-count { background: #ffedd5; color: #9a3412; }

.section-body {
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: white;
}

/* 单条话术条目 */
.script-item {
    border: 1px solid #f1f5f9;
    border-radius: 6px;
    padding: 8px 10px;
    background: #fafafa;
    position: relative;
    transition: all 0.18s;
}

.script-item:hover {
    border-color: #0ea5e9;
    background: #f0f9ff;
    box-shadow: 0 1px 4px rgba(14, 165, 233, 0.1);
}

/* 话术条目左侧色条（modern browsers） */
.script-item:has(.script-label--primary) { border-left: 3px solid #10b981; }
.script-item:has(.script-label--alt)     { border-left: 3px solid #f59e0b; }
.script-item:has(.script-label--scene)   { border-left: 3px solid #8b5cf6; }

.script-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.script-label {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 3px;
    letter-spacing: 0.3px;
}

.script-label--primary {
    background: #dcfce7;
    color: #166534;
}

.script-label--alt {
    background: #fef9c3;
    color: #854d0e;
}

.script-label--scene {
    background: #ede9fe;
    color: #5b21b6;
}

.copy-item-btn {
    padding: 3px 8px;
    background: transparent;
    border: 1px solid #e2e8f0;
    border-radius: 3px;
    color: #94a3b8;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.18s;
    white-space: nowrap;
}

.copy-item-btn:hover {
    border-color: #0ea5e9;
    color: #0ea5e9;
    background: #f0f9ff;
}

.copy-item-btn:active {
    transform: scale(0.95);
}

.script-text {
    font-size: 13px;
    color: #334155;
    line-height: 1.65;
    white-space: pre-wrap;
    word-break: break-word;
}

/* 原始文本降级展示 */
.raw-script-block {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 14px 16px;
    font-size: 13px;
    color: #334155;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ========== Toast 通知 ========== */
.ass-toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(60px);
    background: #1e293b;
    color: white;
    padding: 10px 22px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    z-index: 100010;
    opacity: 0;
    transition: all 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
    white-space: nowrap;
    max-width: 90vw;
}

.ass-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.ass-toast--success { background: #059669; }
.ass-toast--error   { background: #dc2626; }
.ass-toast--info    { background: #0369a1; }

/* ========== 模态框 ========== */
.ass-modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 100000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(2px);
}

.ass-modal.show {
    display: flex;
}

.ass-modal-content {
    background: white;
    border-radius: 8px;
    max-width: 640px;
    width: 100%;
    max-height: 82vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.14);
    animation: assModalIn 0.22s ease-out;
}

@keyframes assModalIn {
    from { opacity: 0; transform: translateY(-16px); }
    to   { opacity: 1; transform: translateY(0); }
}

.ass-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.ass-modal-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
}

.ass-modal-close {
    width: 28px;
    height: 28px;
    background: #f1f5f9;
    border: none;
    color: #64748b;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ass-modal-close:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.ass-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.template-modal-hint {
    font-size: 12px;
    color: #94a3b8;
    margin: 0 0 14px 0;
}

.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
}

.template-card {
    padding: 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.template-card:hover {
    border-color: #0ea5e9;
    background: #f0f9ff;
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(14, 165, 233, 0.12);
}

.template-card-icon {
    font-size: 24px;
    margin-bottom: 8px;
    line-height: 1;
}

.template-card-name {
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 4px;
}

.template-card-desc {
    font-size: 11px;
    color: #94a3b8;
    line-height: 1.5;
}

/* ========== 暗黑模式 ========== */
body.theme-dark .ass-container {
    background: #1e293b;
}

body.theme-dark .ass-history-panel,
body.theme-dark .ass-editor-panel,
body.theme-dark .ass-preview-panel {
    background: #0f172a;
    border-color: rgba(148, 163, 184, 0.15);
}

body.theme-dark .panel-header,
body.theme-dark .editor-panel-header,
body.theme-dark .preview-panel-header {
    background: #1a2332;
    border-color: rgba(148, 163, 184, 0.15);
}

body.theme-dark .panel-header h3,
body.theme-dark .editor-panel-title,
body.theme-dark .preview-panel-header h3 {
    color: #cbd5e1;
}

body.theme-dark .editor-panel-meta {
    background: #1e293b;
    color: #64748b;
}

body.theme-dark .history-search input {
    background: #0f172a;
    border-color: #334155;
    color: #e2e8f0;
}

body.theme-dark .history-search input::placeholder {
    color: #475569;
}

body.theme-dark .history-item {
    background: #1a2332;
    border-color: rgba(148, 163, 184, 0.12);
}

body.theme-dark .history-item:hover {
    background: #1e293b;
    border-color: rgba(148, 163, 184, 0.25);
}

body.theme-dark .history-item.active {
    background: #0c2340;
    border-color: #0ea5e9;
}

body.theme-dark .history-item-title {
    color: #e2e8f0;
}

body.theme-dark .ass-toolbar {
    background: linear-gradient(135deg, #0c4a6e 0%, #1e3a5f 100%);
}

body.theme-dark .ass-toolbar-btn {
    background: rgba(255,255,255,0.1);
    color: #bae6fd;
}

body.theme-dark .ass-toolbar-btn:hover {
    background: rgba(255,255,255,0.18);
}

body.theme-dark .ass-input,
body.theme-dark .ass-select,
body.theme-dark .ass-textarea {
    background: #0f172a;
    border-color: #334155;
    color: #e2e8f0;
}

body.theme-dark .ass-input:focus,
body.theme-dark .ass-select:focus,
body.theme-dark .ass-textarea:focus {
    border-color: #0ea5e9;
    background: #0c1627;
}

body.theme-dark .ass-input::placeholder,
body.theme-dark .ass-textarea::placeholder {
    color: #475569;
}

body.theme-dark .ass-label {
    color: #94a3b8;
}

body.theme-dark .ass-checkbox-item {
    background: #1a2332;
    border-color: #334155;
    color: #94a3b8;
}

body.theme-dark .ass-checkbox-item:has(input:checked) {
    background: #0c2340;
    border-color: #0ea5e9;
    color: #bae6fd;
}

body.theme-dark .ass-btn--secondary {
    background: #1e293b;
    color: #94a3b8;
    border-color: #334155;
}

body.theme-dark .preview-content {
    background: #0f172a;
}

body.theme-dark .preview-empty-title {
    color: #64748b;
}

body.theme-dark .script-section {
    border-color: rgba(148, 163, 184, 0.15);
}

body.theme-dark .section-header {
    background: #1a2332;
    border-color: rgba(148, 163, 184, 0.15);
}

body.theme-dark .section-title {
    color: #cbd5e1;
}

body.theme-dark .section-count {
    background: #334155;
    color: #94a3b8;
}

body.theme-dark .section-body {
    background: #0f172a;
}

body.theme-dark .script-item {
    background: #1a2332;
    border-color: #334155;
}

body.theme-dark .script-item:hover {
    background: #0c2340;
    border-color: #0ea5e9;
}

body.theme-dark .script-text {
    color: #cbd5e1;
}

body.theme-dark .copy-item-btn {
    border-color: #334155;
    color: #64748b;
}

body.theme-dark .copy-item-btn:hover {
    border-color: #0ea5e9;
    color: #0ea5e9;
    background: #0c2340;
}

body.theme-dark .preview-loading {
    background: rgba(15, 23, 42, 0.96);
}

body.theme-dark .loading-title {
    color: #e2e8f0;
}

body.theme-dark .ass-modal-content {
    background: #0f172a;
}

body.theme-dark .ass-modal-header {
    background: #1a2332;
    border-color: rgba(148, 163, 184, 0.15);
}

body.theme-dark .ass-modal-header h3 {
    color: #e2e8f0;
}

body.theme-dark .ass-modal-close {
    background: #1e293b;
    color: #94a3b8;
}

body.theme-dark .template-card {
    background: #1a2332;
    border-color: #334155;
}

body.theme-dark .template-card:hover {
    background: #0c2340;
    border-color: #0ea5e9;
}

body.theme-dark .template-card-name {
    color: #e2e8f0;
}

body.theme-dark .preview-meta-bar {
    background: #0c2340;
    border-color: #1e4060;
    color: #7dd3fc;
}

body.theme-dark .preview-meta-bar .meta-tag {
    background: #1e293b;
    border-color: #334155;
}

body.theme-dark .raw-script-block {
    background: #1a2332;
    border-color: #334155;
    color: #cbd5e1;
}

/* 暗黑模式 — 段落著色主题 */
body.theme-dark .script-section[data-section="greeting"]    > .section-header { border-left-color: #0891b2; }
body.theme-dark .script-section[data-section="acknowledge"] > .section-header { border-left-color: #d97706; }
body.theme-dark .script-section[data-section="empathy"]     > .section-header { border-left-color: #db2777; }
body.theme-dark .script-section[data-section="solution"]    > .section-header { border-left-color: #059669; }
body.theme-dark .script-section[data-section="closing"]     > .section-header { border-left-color: #7c3aed; }
body.theme-dark .script-section[data-section="alternative"] > .section-header { border-left-color: #ea580c; }

body.theme-dark .ass-char-counter { color: #475569; }

/* ========== 滚动条美化 ========== */
.ass-form::-webkit-scrollbar,
.history-list::-webkit-scrollbar,
.preview-content::-webkit-scrollbar,
.ass-modal-body::-webkit-scrollbar {
    width: 5px;
}

.ass-form::-webkit-scrollbar-track,
.history-list::-webkit-scrollbar-track,
.preview-content::-webkit-scrollbar-track {
    background: transparent;
}

.ass-form::-webkit-scrollbar-thumb,
.history-list::-webkit-scrollbar-thumb,
.preview-content::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.ass-form::-webkit-scrollbar-thumb:hover,
.preview-content::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

body.theme-dark .ass-checkbox-quick-btn { color: #38bdf8; }
body.theme-dark .ass-checkbox-quick-btn:hover { color: #7dd3fc; }
body.theme-dark .editor-meta--warn { color: #fbbf24 !important; background: #2d1a00 !important; }

body.theme-dark .ass-form::-webkit-scrollbar-thumb,
body.theme-dark .history-list::-webkit-scrollbar-thumb,
body.theme-dark .preview-content::-webkit-scrollbar-thumb {
    background: #334155;
}
