/* --- LAYOUT CHUNG --- */
#talk-ai-saas-dashboard { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; max-width: 1200px; margin: 0 auto; padding: 20px; color: #1c1e21; }

/* TOP BAR */
.dash-top-bar { display: flex; justify-content: space-between; align-items: center; background: #fff; padding: 15px 20px; border-radius: 12px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); margin-bottom: 25px; }
.user-welcome { font-size: 18px; font-weight: 600; }
.user-balance-box { display: flex; align-items: center; gap: 15px; }
.balance-text { font-size: 15px; color: #555; background: #f0f2f5; padding: 8px 15px; border-radius: 20px; font-weight: 500; border: 1px solid #eee; }
.btn-recharge { background: #2ecc71; color: white !important; text-decoration: none !important; padding: 8px 20px; border-radius: 20px; font-weight: 600; font-size: 14px; box-shadow: 0 4px 10px rgba(46, 204, 113, 0.3); }

/* TABS */
.dash-tabs { display: flex; gap: 20px; margin-bottom: 25px; border-bottom: 2px solid #f0f0f0; }
.tab-btn { background: none; border: none; font-size: 16px; padding: 10px 0; cursor: pointer; color: #888; font-weight: 600; position: relative; margin-bottom: -2px; }
.tab-btn.active { color: #0866ff; border-bottom: 3px solid #0866ff; }
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.3s; }
@keyframes fadeIn { from{opacity:0; transform:translateY(10px);} to{opacity:1; transform:translateY(0);} }

/* HEADER ACTIONS */
.dash-header-actions { margin-bottom: 25px; text-align: right; }
#btn-create-agent { 
    background: #0866ff; color: white; border: none; padding: 12px 25px; 
    border-radius: 8px; font-weight: bold; font-size: 15px; cursor: pointer; 
    box-shadow: 0 4px 12px rgba(8, 102, 255, 0.3); display: inline-flex; align-items: center; gap: 8px;
}
#btn-create-agent:hover { transform: translateY(-2px); }

/* AGENT CARD */
.agent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 25px; }
.agent-card { background: white; border-radius: 16px; box-shadow: 0 10px 30px rgba(0,0,0,0.05); overflow: hidden; border: 1px solid #f0f0f0; transition: transform 0.2s; display: flex; flex-direction: column; }
.agent-card:hover { transform: translateY(-5px); box-shadow: 0 15px 35px rgba(0,0,0,0.1); }
.agent-img { height: 200px; width: 100%; object-fit: cover; background: #f0f2f5; }
.agent-body { padding: 20px; flex: 1; display: flex; flex-direction: column; }
.agent-title { font-size: 18px; margin: 0 0 5px; font-weight: 700; color: #333; }
.agent-desc { font-size: 13px; color: #888; margin-bottom: 20px; }

/* BUTTONS IN CARD */
.btn-main-action { 
    width: 100%; background: #0866ff; color: white; border: none; padding: 12px; 
    border-radius: 8px; font-weight: bold; font-size: 15px; cursor: pointer; margin-bottom: 12px;
    display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-main-action:hover { background: #005ce6; }
.agent-actions-row { display: flex; gap: 8px; margin-bottom: 10px; }
.btn-sub { 
    flex: 1; background: #f0f2f5; border: none; padding: 10px; border-radius: 8px; 
    font-size: 13px; font-weight: 600; cursor: pointer; color: #555; display: flex; align-items: center; justify-content: center; gap: 5px;
}
.btn-sub:hover { background: #e4e6eb; color: #000; }
.btn-delete-wrap { margin-top: auto; border-top: 1px solid #eee; padding-top: 15px; text-align: right; }
.btn-delete { background: none; border: 1px solid #fee2e2; color: #e74c3c; padding: 6px 15px; border-radius: 20px; font-size: 12px; font-weight: 600; cursor: pointer; }
.btn-delete:hover { background: #fee2e2; }

/* MODAL & FORM FIX */
.dash-modal { position: fixed; z-index: 99999; left: 0; top: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); backdrop-filter: blur(5px); display: flex; justify-content: center; align-items: center; }
.modal-content { background: #fff; padding: 30px; border-radius: 16px; width: 550px; max-width: 90%; max-height: 90vh; overflow-y: auto; position: relative; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.close-modal { position: absolute; right: 20px; top: 20px; font-size: 30px; cursor: pointer; color: #aaa; width: 30px; height: 30px; line-height: 30px; text-align: center; }
.form-group { margin-bottom: 20px; position: relative; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 600; color: #333; font-size: 14px; }
.form-group input[type="text"], .form-group textarea { width: 100%; padding: 12px; border: 1px solid #ddd; border-radius: 8px; box-sizing: border-box; font-size: 14px; }
.form-group input:focus { border-color: #0866ff; outline: none; box-shadow: 0 0 0 3px rgba(8,102,255,0.1); }

/* THEME BUILDER ROW */
.theme-row { display: flex; gap: 15px; align-items: center; background: #f9f9f9; padding: 10px; border-radius: 8px; border: 1px solid #eee; }
.color-picker-wrap { 
    width: 40px; height: 40px; border-radius: 50%; overflow: hidden; 
    border: 2px solid #fff; box-shadow: 0 2px 5px rgba(0,0,0,0.1); cursor: pointer; position: relative; flex-shrink: 0;
}
.color-picker-wrap input[type="color"] { 
    position: absolute; top: -50%; left: -50%; width: 200%; height: 200%; 
    padding: 0; margin: 0; border: none; cursor: pointer; 
}

/* UPLOAD BOX */
.upload-box { border: 2px dashed #ddd; padding: 20px; text-align: center; border-radius: 8px; cursor: pointer; background: #fafafa; position: relative; transition: 0.2s; }
.upload-box:hover { border-color: #0866ff; background: #f0f7ff; }
.upload-box label { position: absolute; top: 0; left: 0; width: 100%; height: 100%; cursor: pointer; margin: 0; z-index: 5; }

/* VOICE LIST & SVG BUTTONS */
.voice-list-grid { display: grid; gap: 10px; max-height: 250px; overflow-y: auto; border: 1px solid #eee; padding: 10px; border-radius: 8px; }
.voice-item { display: flex; align-items: center; padding: 10px; border-radius: 8px; cursor: pointer; border: 1px solid transparent; justify-content: space-between; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.voice-item:hover { border-color: #0866ff; background: #f9f9f9; }
.voice-item.selected { border-color: #0866ff; background: #eef7ff; }
.btn-preview-voice {
    width: 36px; height: 36px; border-radius: 50%; border: none;
    background: #2ecc71; color: white; cursor: pointer;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
    padding: 0; transition: 0.2s;
}
.btn-preview-voice svg { width: 14px; height: 14px; fill: white; display: block; }
.btn-preview-voice.playing { background: #e74c3c; animation: pulse 1s infinite; }

/* STATS */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 30px; }
.stat-card { background: #fff; padding: 20px; border-radius: 8px; border: 1px solid #dddfe2; text-align: center; }
.dash-table { width: 100%; border-collapse: collapse; background: #fff; }
.dash-table th, .dash-table td { padding: 12px; border-bottom: 1px solid #eee; text-align: left; }
@media (max-width: 768px) { .stats-grid { grid-template-columns: 1fr 1fr; } }