:root {
  --primary: #667eea; --text-1: #1f2937; --text-2: #4b5563; --text-3: #6b7280; --text-4: #9ca3af;
  --bg-1: #fff; --bg-2: #f9fafb; --bg-3: #f3f4f6; --border: #e5e7eb;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; background: var(--bg-2); color: var(--text-1); font-size: 14px; }
.toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); background: rgba(31,41,55,.95); color: #fff; padding: 10px 20px; border-radius: 8px; font-size: 13px; z-index: 9999; display: none; }
.toast.success { background: #10b981; } .toast.error { background: #ef4444; } .toast.warning { background: #f59e0b; }

.agent-page { max-width: 1100px; margin: 0 auto; padding: 0 20px 40px; }
.top-bar { display: flex; align-items: center; justify-content: space-between; padding: 16px 0; border-bottom: 1px solid var(--border); margin-bottom: 20px; position: sticky; top: 0; background: var(--bg-2); z-index: 10; }
.top-left { display: flex; align-items: center; gap: 16px; }
.back-link { display: flex; align-items: center; gap: 6px; color: var(--text-3); text-decoration: none; font-size: 13px; }
.back-link:hover { color: var(--primary); }
.page-title { font-size: 20px; font-weight: 600; }
.top-right { display: flex; align-items: center; gap: 12px; }
.admin-name { color: var(--text-2); font-size: 13px; }

.btn { border: 1px solid var(--border); background: var(--bg-1); color: var(--text-2); padding: 7px 14px; border-radius: 8px; font-size: 13px; cursor: pointer; transition: all .2s; }
.btn:hover { background: var(--bg-2); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: #5a6fd6; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-danger { color: #dc2626; border-color: #fecaca; }
.btn-danger:hover { background: #fef2f2; }
.btn-link { border: none; background: none; color: var(--primary); padding: 4px 8px; cursor: pointer; font-size: 13px; }
.btn-link:hover { text-decoration: underline; }

.form-input { border: 1px solid var(--border); border-radius: 8px; padding: 7px 12px; font-size: 13px; background: var(--bg-1); color: var(--text-1); outline: none; width: 100%; }
.form-input:focus { border-color: var(--primary); }

.toolbar { display: flex; align-items: center; justify-content: space-between; background: var(--bg-1); padding: 14px 18px; border-radius: 12px 12px 0 0; border: 1px solid var(--border); border-bottom: none; }
.toolbar h3 { font-size: 15px; font-weight: 600; }
.table-wrap { background: var(--bg-1); border: 1px solid var(--border); border-radius: 0 0 12px 12px; overflow: hidden; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th, .data-table td { padding: 11px 16px; text-align: left; vertical-align: middle; }
.data-table th { color: var(--text-3); font-weight: 500; background: var(--bg-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table td { border-bottom: 1px solid var(--border); color: var(--text-2); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg-2); }
.nick-cell .nick { color: var(--text-1); font-weight: 500; }
.nick-cell .uname { color: var(--text-4); font-size: 12px; }
.nick-cell { display: flex; align-items: center; gap: 10px; }
.nick-cell .nick-wrap { min-width: 0; }

/* 头像上传（编辑弹窗） */
.avatar-upload-row { display: flex; align-items: center; gap: 14px; }
.avatar-preview {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--bg-3); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; flex: none;
  color: var(--text-4); font-size: 12px;
}
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; }
.avatar-upload-actions { display: flex; flex-direction: column; gap: 8px; }

/* 列表头像缩略图 */
.agent-avatar-sm {
  width: 34px; height: 34px; border-radius: 50%;
  overflow: hidden; flex: none;
  border: 1px solid var(--border);
  background: var(--bg-3);
}
.agent-avatar-sm img { width: 100%; height: 100%; object-fit: cover; display: block; }
.role-tag { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; }
.role-super { background: #eef2ff; color: #4f46e5; }
.role-agent { background: #f0fdf4; color: #16a34a; }
.site-tags { display: flex; flex-wrap: wrap; gap: 4px; max-width: 320px; }
.site-chip { font-size: 11px; padding: 2px 7px; border-radius: 8px; background: var(--bg-3); color: var(--text-3); }
.status-tag { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; }
.status-on { background: #d1fae5; color: #059669; }
.status-off { background: #fee2e2; color: #dc2626; }
.act-cell { white-space: nowrap; vertical-align: middle; }
.act-cell .btn-link + .btn-link { margin-left: 4px; }

.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal { background: var(--bg-1); border-radius: 12px; width: 480px; max-height: 85vh; overflow: hidden; display: flex; flex-direction: column; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close { border: none; background: none; font-size: 18px; color: var(--text-4); cursor: pointer; }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-footer { padding: 14px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.form-row { margin-bottom: 14px; display: flex; flex-direction: column; gap: 6px; }
.form-row label { font-size: 12px; color: var(--text-3); }
.site-checks { display: flex; flex-wrap: wrap; gap: 8px; }
.site-check { display: flex; align-items: center; gap: 5px; font-size: 13px; color: var(--text-2); padding: 5px 10px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; }
.site-check input { margin: 0; }
.site-check.checked { background: #eef2ff; border-color: var(--primary); color: var(--primary); }
.site-check.disabled { opacity: .5; cursor: not-allowed; }
.site-check.disabled input { cursor: not-allowed; }
.site-hint { font-size: 12px; color: #f59e0b; background: #fffbeb; border: 1px solid #fde68a; padding: 8px 12px; border-radius: 8px; margin-bottom: 8px; }

/* ========== 多语言标签页编辑 ========== */
.i18n-tabs { width: 100%; }
.i18n-tab-bar { display: flex; flex-wrap: wrap; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 0; }
.i18n-tab { border: 1px solid var(--border); border-bottom: none; background: var(--bg-2); color: var(--text-3); padding: 6px 14px; font-size: 12px; cursor: pointer; border-radius: 8px 8px 0 0; transition: all .15s; font-family: inherit; }
.i18n-tab:hover { background: var(--bg-1); color: var(--text-2); }
.i18n-tab.active { background: var(--bg-1); color: var(--primary); border-color: var(--border); position: relative; }
.i18n-tab.active::after { content: ""; position: absolute; left: -1px; right: -1px; bottom: -1px; height: 2px; background: var(--bg-1); }
.i18n-tab:disabled { cursor: not-allowed; opacity: .6; }
.i18n-default-mark { display: inline-block; font-size: 10px; padding: 0 5px; border-radius: 8px; background: #eef2ff; color: var(--primary); margin-left: 4px; vertical-align: middle; }
.i18n-panes { border: 1px solid var(--border); border-top: none; border-radius: 0 0 8px 8px; overflow: hidden; }
.i18n-pane { display: none; padding: 0; }
.i18n-pane.active { display: block; }
.i18n-textarea { width: 100%; border: none !important; border-radius: 0 !important; min-height: 60px; padding: 8px 12px; font-size: 13px; font-family: inherit; line-height: 1.5; background: var(--bg-1); color: var(--text-1); outline: none; resize: vertical; }
.i18n-textarea:focus { box-shadow: inset 0 0 0 1px var(--primary); }
