:root {
    --primary-color: #1890ff;
    --primary-hover: #40a9ff;
    --text-main: #333333;
    --text-sub: #666666;
    --bg-color: #f0f2f5;
    --card-bg: #ffffff;
    --border-color: #e8e8e8;
    --border-radius: 6px;
    --duplicate-red: #ff4d4f; 
}

html { scroll-behavior: smooth; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; background-color: var(--bg-color); color: var(--text-main); margin: 0; line-height: 1.6; font-size: 14px; }
* { box-sizing: border-box; }

.login-container { display: flex; align-items: center; justify-content: center; height: 100vh; background: #fff; }
.login-box { width: 100%; max-width: 380px; padding: 40px; border: 1px solid var(--border-color); border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.08); text-align: center; }
.login-box h1 { margin-top: 0; margin-bottom: 30px; font-size: 1.8em; color: var(--primary-color); }

.app-container { max-width: 1200px; margin: 0 auto; padding: 20px; }
.app-header { display: flex; justify-content: space-between; align-items: center; padding: 15px 25px; background: var(--card-bg); border-radius: var(--border-radius); margin-bottom: 20px; box-shadow: 0 1px 4px rgba(0,0,0,0.05); }
.logo { font-size: 1.4em; font-weight: bold; color: var(--primary-color); }

.card { background: var(--card-bg); border-radius: var(--border-radius); padding: 24px; margin-bottom: 24px; border: 1px solid var(--border-color); }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; padding-bottom: 12px; border-bottom: 1px solid var(--border-color); }
.card-header h2 { margin: 0; font-size: 16px; font-weight: 600; color: var(--text-main); }

.btn { display: inline-block; border: 1px solid transparent; padding: 6px 16px; border-radius: 4px; font-size: 14px; cursor: pointer; transition: all 0.3s; outline: none; background: #fff; }
.btn:hover { opacity: 0.8; }
.btn-primary { background-color: #1890ff; color: #fff; } 
.btn-secondary { border-color: #d9d9d9; color: var(--text-main); } .btn-secondary:hover { color: var(--primary-color); border-color: var(--primary-color); }
.btn-danger { background-color: #ff4d4f; color: #fff; }
.btn-success { background-color: #52c41a; color: #fff; } 
.btn-warning { background-color: #faad14; color: #fff; border: 1px solid #faad14; } 
.btn-sm { padding: 4px 12px; font-size: 12px; }

.create-job-container { display: grid; grid-template-columns: 1fr; gap: 20px; }
.create-job-grid { display: contents; }
.create-job-actions { display: flex; gap: 15px; padding-top: 0px; margin-top: -10px; }
.create-job-actions .btn { padding: 6px 16px; font-size: 14px; }

.form-group { margin-bottom: 20px; }
label { display: block; font-weight: 500; margin-bottom: 8px; }
input, textarea { width: 100%; padding: 8px 12px; border: 1px solid #d9d9d9; border-radius: 4px; transition: all 0.3s; outline: none; }
input:focus, textarea:focus { border-color: var(--primary-color); box-shadow: 0 0 0 2px rgba(24,144,255,0.2); }
textarea { resize: vertical; }

.dashboard-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; text-align: center; }
.dashboard-stat { padding: 24px; background: #fbfbfb; border-radius: var(--border-radius); border: 1px solid #f0f0f0; }
.dashboard-value { font-size: 30px; font-weight: bold; color: var(--primary-color); line-height: 1.2; }
.dashboard-label { font-size: 14px; color: var(--text-sub); margin-top: 8px; }

.main-nav { display: flex; border-bottom: 1px solid var(--border-color); margin-bottom: 20px; }
.nav-btn { background: none; border: none; padding: 10px 20px; cursor: pointer; font-size: 14px; color: var(--text-main); position: relative; bottom: -1px; }
.nav-btn.active { color: var(--primary-color); font-weight: 600; border-bottom: 2px solid var(--primary-color); }
.view { display: none; } .view.active { display: block; }

.job-item { border: 1px solid var(--border-color); border-radius: var(--border-radius); margin-bottom: 16px; background: #fff; transition: box-shadow 0.3s, opacity 0.2s; }
.job-item.dragging { opacity: 0.5; box-shadow: 0 8px 16px rgba(0,0,0,0.1); border: 2px dashed var(--primary-color); background: #fafafa; }
.job-item:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.05); }
.job-item-header { display: flex; justify-content: space-between; align-items: center; padding: 20px; }
.job-header-left { display: flex; flex-direction: column; gap: 8px; }
.job-title { font-size: 16px; font-weight: 600; color: var(--primary-color); cursor: grab; display: inline-block; padding-right: 20px; }
.job-title:active { cursor: grabbing; }
.job-stats-info { font-size: 12px; color: #999; display: flex; gap: 15px; }
.job-header-right { display: flex; align-items: center; gap: 12px; }
.job-status-tag { font-size: 12px; padding: 2px 8px; border-radius: 4px; background: #f5f5f5; border: 1px solid #d9d9d9; color: #666; }
.job-actions { display: flex; gap: 8px; }
.job-texts-container { display: none; padding: 24px; background: #fafafa; border-top: 1px solid var(--border-color); }
.job-item.open .job-texts-container { display: block; }

.texts-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.text-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
.text-card { background: #fff; border: 1px solid var(--border-color); border-radius: var(--border-radius); padding: 16px; position: relative; transition: all 0.3s; }
.text-card.duplicate { border: 1px solid #ffccc7; box-shadow: 0 0 12px rgba(255, 77, 79, 0.15); z-index: 1; }
.badge-duplicate { position: absolute; top: 0; left: 0; background: var(--duplicate-red); color: white; font-size: 12px; padding: 2px 8px; border-radius: var(--border-radius) 0 6px 0; font-weight: bold; z-index: 10; }
.text-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; margin-top: 5px; }
.text-card-title { font-weight: 600; color: var(--text-main); font-size: 14px; margin-left: 5px; }

/* 彻底清理外层滚动条与晃动 */
.text-card-content { 
    background: #fff; 
    border: 1px solid #f5f5f5; 
    border-radius: 4px; 
    padding: 12px; 
    font-size: 13px; 
    color: #555; 
    line-height: 1.6; 
    white-space: pre-wrap; 
    word-break: break-all; 
    margin-bottom: 12px; 
    height: 260px; 
    overflow: hidden; 
}

/* 音频卡片内部优雅排版，滚动条完全收敛在内部，极细半透明 */
.audio-card-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
}
.audio-player-bar {
    width: 100%;
    margin-bottom: 10px;
}
.audio-transcription-box {
    flex: 1;
    width: 100%;
    padding: 8px 10px;
    overflow-y: auto;
    font-size: 13px;
    line-height: 1.6;
    color: #334155;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    text-align: left;
    white-space: pre-wrap;
    word-break: break-word;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.4) transparent;
}
.audio-transcription-box::-webkit-scrollbar {
    width: 4px;
}
.audio-transcription-box::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.4);
    border-radius: 4px;
}
.audio-transcription-box::-webkit-scrollbar-track {
    background: transparent;
}

.text-card-footer { display: flex; justify-content: space-between; font-size: 12px; color: #999; }
.assigned-devices-wrapper { margin-top: 12px; padding-top: 12px; border-top: 1px dashed #f0f0f0; }
.assigned-devices-wrapper strong { display: block; font-size: 12px; color: #333; margin-bottom: 6px; font-weight: 600; }
.assigned-devices-list { display: flex; flex-wrap: wrap; gap: 6px; }
.assigned-devices-list code { background: #f5f5f5; color: #666; padding: 2px 8px; border-radius: 2px; font-size: 12px; cursor: pointer; transition: all 0.2s; }
.assigned-devices-list code:hover { background: var(--primary-color); color: #fff; }

.table-wrapper { overflow-x: auto; margin-top: 10px; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th { background-color: #fafafa; font-weight: 600; color: var(--text-main); padding: 12px; border-bottom: 1px solid var(--border-color); }
td { padding: 12px; border-bottom: 1px solid var(--border-color); color: #666; }
tbody tr.highlight { animation: highlight-row 2s ease-out; }
@keyframes highlight-row { 0% { background-color: #fffbe6; } 100% { background-color: transparent; } }
.device-id { font-family: monospace; background: #f0f2f5; padding: 2px 6px; border-radius: 4px; color: #333; }

.modal-overlay { position: fixed; inset: 0; background-color: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal-content { background: #fff; width: 500px; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.modal-header { padding: 16px 24px; border-bottom: 1px solid #f0f0f0; display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: 24px; max-height: 70vh; overflow-y: auto; }
.modal-footer { padding: 16px 24px; border-top: 1px solid #f0f0f0; }
.close-btn { border: none; background: none; font-size: 20px; cursor: pointer; color: #999; }
.loading-overlay { position: fixed; inset: 0; background: rgba(255,255,255,0.7); display: flex; align-items: center; justify-content: center; z-index: 2000; }
.spinner { width: 32px; height: 32px; border: 3px solid #e8e8e8; border-top-color: var(--primary-color); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#toast-container { position: fixed; top: 20px; right: 20px; z-index: 3000; display: flex; flex-direction: column; gap: 10px; }
.toast { padding: 10px 20px; border-radius: 4px; color: #fff; background: rgba(0,0,0,0.8); animation: slideIn 0.3s, fadeOut 0.3s 3s forwards; }
.toast.success { background: #52c41a; } .toast.error { background: #ff4d4f; } .toast.warning { background: #faad14; }
@keyframes slideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes fadeOut { to { opacity: 0; transform: translateX(100%); } }
.hidden { display: none !important; }

#text-modal-content { transition: all 0.2s ease; }
#text-modal-content.drag-over { border: 2px dashed var(--primary-color) !important; background: rgba(24,144,255,0.05); }

#image-preview-container { position: relative; display: inline-block; margin-top: 8px; border: 1px dashed var(--border-color); padding: 8px; border-radius: 4px; background: #fafafa; width: 100%; text-align: center; }
#image-preview-img { max-width: 100%; max-height: 250px; object-fit: contain; border-radius: 4px; box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
#remove-image-btn { position: absolute; top: -10px; right: -10px; border-radius: 50%; width: 28px; height: 28px; padding: 0; display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: bold; box-shadow: 0 2px 4px rgba(0,0,0,0.2); }
