* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f0f2f5;
    color: #1a1a2e;
    font-size: 14px;
}

/* Login */
.login-container {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}
.login-card {
    background: #fff; padding: 40px; border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3); width: 400px;
}
.login-card h1 { text-align: center; margin-bottom: 30px; color: #1a1a2e; font-size: 22px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 500; color: #555; }
.form-group input {
    width: 100%; padding: 10px 14px; border: 1px solid #ddd; border-radius: 8px;
    font-size: 14px; outline: none; transition: border-color 0.2s;
}
.form-group input:focus { border-color: #4361ee; }
.error-msg { color: #e74c3c; margin-bottom: 12px; font-size: 13px; }

/* Buttons */
.btn {
    padding: 8px 16px; border: none; border-radius: 6px; cursor: pointer;
    font-size: 13px; font-weight: 500; transition: all 0.15s;
}
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-full { width: 100%; padding: 12px; font-size: 15px; }
.btn-primary { background: #4361ee; color: #fff; }
.btn-primary:hover { background: #3a56d4; }
.btn-success { background: #2ecc71; color: #fff; }
.btn-success:hover { background: #27ae60; }
.btn-danger { background: #e74c3c; color: #fff; }
.btn-danger:hover { background: #c0392b; }
.btn-outline { background: transparent; border: 1px solid #ccc; color: #555; }
.btn-outline:hover { border-color: #999; color: #333; }

/* Top bar */
.topbar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 20px; background: #1a1a2e; color: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
.topbar h2 { font-size: 16px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.user-info { font-size: 13px; opacity: 0.8; }
.topbar .btn-outline { border-color: rgba(255,255,255,0.3); color: #fff; }

/* Dashboard */
.dashboard {
    display: grid; grid-template-columns: 280px 1fr 360px;
    height: calc(100vh - 50px); gap: 0;
}

.panel {
    display: flex; flex-direction: column;
    border-right: 1px solid #e0e0e0; background: #fff;
    overflow: hidden;
}
.panel:last-child { border-right: none; }
.panel-header {
    padding: 12px 16px; border-bottom: 1px solid #e8e8e8;
    background: #fafafa; flex-shrink: 0;
}
.panel-header h3 { font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.filter-row { display: flex; gap: 6px; }
.filter-row select {
    padding: 4px 8px; border: 1px solid #ddd; border-radius: 4px;
    font-size: 12px; background: #fff;
}

.panel-left #dialog-list,
.panel-center #evaluations-panel,
.panel-right #task-list,
.panel-right #task-detail-panel {
    overflow-y: auto; flex: 1;
}

/* Dialog items */
.dialog-item {
    padding: 10px 16px; border-bottom: 1px solid #f0f0f0;
    cursor: pointer; transition: background 0.15s;
}
.dialog-item:hover { background: #f7f8fc; }
.dialog-item.active { background: #eef2ff; border-left: 3px solid #4361ee; }
.dialog-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.dialog-id { font-size: 12px; color: #888; font-weight: 500; }
.dialog-name { font-weight: 500; font-size: 13px; margin-bottom: 4px; }
.dialog-meta { display: flex; gap: 6px; align-items: center; }
.dialog-date { font-size: 11px; color: #999; }

/* Score badges */
.score-badge {
    display: inline-block; padding: 2px 8px; border-radius: 10px;
    font-size: 11px; font-weight: 700; color: #fff;
}
.score-big { padding: 4px 14px; font-size: 16px; border-radius: 12px; }
.score-green { background: #2ecc71; }
.score-yellow { background: #f39c12; }
.score-red { background: #e74c3c; }

/* Status tags */
.status-tag {
    display: inline-block; padding: 2px 8px; border-radius: 4px;
    font-size: 11px; font-weight: 500; text-transform: capitalize;
}
.status-monitoring { background: #eef2ff; color: #4361ee; }
.status-evaluated { background: #e8f5e9; color: #2e7d32; }
.status-finished { background: #f5f5f5; color: #757575; }
.status-new { background: #e3f2fd; color: #1565c0; }
.status-in_progress { background: #fff3e0; color: #ef6c00; }
.status-done { background: #e8f5e9; color: #2e7d32; }
.status-rejected { background: #fce4ec; color: #c62828; }

/* Priority badges */
.priority-badge {
    display: inline-block; padding: 2px 6px; border-radius: 4px;
    font-size: 10px; font-weight: 700;
}
.priority-high { background: #fce4ec; color: #c62828; }
.priority-med { background: #fff3e0; color: #ef6c00; }
.priority-low { background: #e8f5e9; color: #2e7d32; }
.agent-badge {
    display: inline-block; padding: 2px 6px; border-radius: 4px;
    font-size: 10px; font-weight: 700; background: #ede7f6; color: #5e35b1;
}

/* Evaluations */
.evaluation-header { padding: 12px 16px; border-bottom: 1px solid #e8e8e8; }
.evaluation-header h4 { font-size: 14px; }
.dialog-info { font-size: 12px; color: #888; margin-top: 4px; }
.dialog-info span { margin-right: 12px; }
.evaluation-list { padding: 8px; }
.evaluation-card {
    padding: 14px; margin-bottom: 8px; border-radius: 8px;
    background: #fafafa; border: 1px solid #eee;
}
.eval-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.eval-date { font-size: 12px; color: #888; }
.eval-comment { font-size: 13px; line-height: 1.5; white-space: pre-wrap; color: #333; }

/* Tasks */
.task-item {
    padding: 10px 14px; border-bottom: 1px solid #f0f0f0;
    cursor: pointer; transition: background 0.15s;
}
.task-item:hover { background: #f7f8fc; }
.task-title { font-size: 13px; font-weight: 500; line-height: 1.3; }
.task-meta { display: flex; gap: 6px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.task-date { font-size: 11px; color: #999; }

/* Task detail */
.task-detail-card {
    padding: 16px; border-top: 2px solid #4361ee; background: #fafbff;
}
.task-detail-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.task-detail-header h4 { font-size: 14px; line-height: 1.4; }
.task-detail-info { margin-bottom: 12px; }
.info-row { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; font-size: 13px; }
.info-row .label { color: #888; min-width: 80px; }
.task-description { margin-bottom: 12px; padding: 10px; background: #fff; border-radius: 6px; border: 1px solid #eee; }
.task-description p { font-size: 13px; line-height: 1.5; white-space: pre-wrap; margin-top: 4px; }
.task-actions { display: flex; gap: 6px; margin-bottom: 12px; }
.task-assign { margin-bottom: 12px; }
.task-assign label { font-size: 12px; color: #888; margin-right: 6px; }
.task-assign select { padding: 4px 8px; border: 1px solid #ddd; border-radius: 4px; font-size: 12px; }

/* Comments */
.task-comments h5 { font-size: 13px; margin-bottom: 8px; color: #555; }
.comment { padding: 8px 10px; margin-bottom: 6px; border-radius: 6px; background: #fff; border: 1px solid #eee; }
.comment-system { background: #f3e5f5; border-color: #e1bee7; }
.comment-header { display: flex; justify-content: space-between; margin-bottom: 4px; }
.comment-author { font-size: 12px; font-weight: 600; color: #555; }
.comment-date { font-size: 11px; color: #999; }
.comment-text { font-size: 13px; line-height: 1.4; }
.comment-form { display: flex; gap: 6px; margin-top: 8px; }
.comment-form textarea {
    flex: 1; padding: 8px; border: 1px solid #ddd; border-radius: 6px;
    font-size: 13px; resize: vertical; font-family: inherit;
}

/* Empty state */
.empty-state { padding: 40px 20px; text-align: center; color: #999; font-size: 13px; }
.loading { padding: 40px 20px; text-align: center; color: #999; }

/* Evaluation dialog info */
.eval-dialog-info {
    display: flex; gap: 8px; align-items: center; margin-bottom: 6px;
    font-size: 12px; color: #888;
}
.eval-contact { color: #666; }
.evaluation-card { cursor: pointer; }
.evaluation-card:hover { border-color: #ccc; background: #f5f5f5; }

/* Date inputs in filters */
.filter-row input[type="date"] {
    padding: 3px 6px; border: 1px solid #ddd; border-radius: 4px;
    font-size: 11px; background: #fff; flex: 1; max-width: 120px;
}

/* Modal */
.modal {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.modal-content {
    background: #fff; padding: 24px; border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3); width: 380px;
}
.modal-content h3 { margin-bottom: 16px; font-size: 16px; }
.modal-actions { display: flex; gap: 8px; margin-top: 16px; }
.info-msg { padding: 8px 12px; border-radius: 6px; font-size: 13px; margin-top: 8px; background: #e3f2fd; color: #1565c0; }
.success-msg { background: #e8f5e9; color: #2e7d32; }

/* Topbar center */
.topbar-center { display: flex; gap: 8px; align-items: center; }

/* External links */
.ext-link {
    display: inline-block; padding: 1px 5px; border-radius: 3px;
    font-size: 10px; font-weight: 700; text-decoration: none;
    background: #e3f2fd; color: #1565c0; transition: background 0.15s;
}
.ext-link:hover { background: #bbdefb; }
.ext-link-bx { background: #fff3e0; color: #e65100; }
.ext-link-bx:hover { background: #ffe0b2; }

/* Eval checkbox & top-left */
.eval-top-left { display: flex; align-items: center; gap: 8px; }
.eval-checkbox { width: 16px; height: 16px; cursor: pointer; accent-color: #4361ee; }

/* Dialog header right */
.dialog-header-right { display: flex; align-items: center; gap: 4px; }

/* Evaluation detail modal */
.modal-wide { width: 800px; max-width: 90vw; max-height: 85vh; overflow-y: auto; }
.eval-detail { padding: 0; }
.eval-detail-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 12px;
}
.eval-detail-header h3 { display: flex; align-items: center; gap: 10px; font-size: 16px; }
.eval-detail-meta {
    display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
    margin-bottom: 16px; padding: 8px 12px; background: #f7f8fc;
    border-radius: 6px; font-size: 12px; color: #666;
}

.eval-detail-section { border: 1px solid #e8e8e8; border-radius: 6px; margin-bottom: 8px; }
.eval-detail-section-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 12px; cursor: pointer; background: #fafafa;
    border-radius: 6px; user-select: none;
}
.eval-detail-section-header:hover { background: #f0f0f0; }
.eval-detail-section-header h4 { font-size: 13px; font-weight: 600; }
.section-meta { font-size: 11px; color: #999; margin-left: auto; margin-right: 8px; }
.toggle-icon { font-size: 10px; color: #999; }
.eval-detail-section-body {
    display: none; padding: 12px; border-top: 1px solid #e8e8e8;
}
.eval-detail-section-body.open { display: block; }

.eval-log-content {
    font-family: 'SF Mono', Monaco, 'Consolas', monospace;
    font-size: 12px; line-height: 1.5; white-space: pre-wrap; word-break: break-word;
    background: #fafafa; padding: 10px; border-radius: 4px;
    max-height: 400px; overflow-y: auto; color: #333;
}
.eval-log-note { font-size: 13px; color: #999; font-style: italic; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #aaa; }
