/* web-kefu 工作台 base.css —— 基础排版 / 按钮 / 表单 / 通用状态。只引用 ../shared/tokens.css 的变量。 */
html, body { height: 100%; }
body { overflow: hidden; font-size: var(--fs-md); }
#app { height: 100%; }
[v-cloak] { display: none !important; }
a { color: var(--brand-600); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.3; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button { border: 0; background: none; padding: 0; }
input, textarea, select { margin: 0; }
svg { flex-shrink: 0; }
::selection { background: var(--brand-100); }
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--r-full); border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* 启动占位（Vue 挂载后由 app.js 移除） */
.boot { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--bg); z-index: 1; }
.boot-card { display: flex; flex-direction: column; align-items: center; gap: var(--sp-3); }
.boot-brand { width: 48px; height: 48px; border-radius: var(--r-card); background: var(--brand-600); color: var(--brand-contrast); display: flex; align-items: center; justify-content: center; font-size: var(--fs-xl); font-weight: 600; }

/* 按钮 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: var(--h-control-sm); padding: 0 14px; border-radius: var(--r-btn); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font-weight: 500; font-size: var(--fs-md); line-height: 1; white-space: nowrap; user-select: none; cursor: pointer; transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease); }
.btn:hover { background: var(--bg-sunken); }
.btn:active { transform: translateY(0.5px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--brand-600); border-color: var(--brand-600); color: var(--brand-contrast); }
.btn-primary:hover { background: var(--brand-700); border-color: var(--brand-700); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger-soft); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-sunken); color: var(--text); }
.btn-sm { height: 30px; padding: 0 10px; font-size: var(--fs-sm); border-radius: 8px; }
.btn-sm svg { width: 14px; height: 14px; }
.btn-block { width: 100%; }
.btn-lg { height: var(--h-control); font-size: var(--fs-lg); }
.icon-btn { width: var(--h-control-sm); height: var(--h-control-sm); padding: 0; border-radius: var(--r-btn); border: 1px solid transparent; background: transparent; color: var(--text-secondary); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; cursor: pointer; transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease); }
.icon-btn:hover { background: var(--bg-sunken); color: var(--text); }
.icon-btn.is-active { background: var(--brand-50); color: var(--brand-600); }
.icon-btn:disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn-sm { width: 30px; height: 30px; border-radius: 8px; }
.icon-btn-sm svg { width: 16px; height: 16px; }

/* 表单 */
.field { display: flex; flex-direction: column; gap: 6px; }
.field + .field { margin-top: var(--sp-4); }
.label { font-size: var(--fs-sm); font-weight: 500; color: var(--text-secondary); }
.input, .textarea, .select { width: 100%; height: var(--h-control-sm); padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--r-btn); background: var(--surface); color: var(--text); font-size: var(--fs-md); transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease); }
.textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; line-height: var(--lh); }
.select { appearance: none; -webkit-appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2357534E' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>"); background-repeat: no-repeat; background-position: right 10px center; }
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--brand-500); box-shadow: var(--focus-ring); }
.input::placeholder, .textarea::placeholder { color: var(--text-muted); }
.input:disabled, .textarea:disabled, .select:disabled { background: var(--bg-sunken); color: var(--text-muted); cursor: not-allowed; }
.input.is-invalid, .textarea.is-invalid { border-color: var(--danger); }
.input-lg { height: var(--h-control); font-size: var(--fs-lg); }
.hint { font-size: var(--fs-xs); color: var(--text-muted); }
.error-text { font-size: var(--fs-sm); color: var(--danger); }
.checkbox { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: var(--fs-md); }
.checkbox input { width: 16px; height: 16px; accent-color: var(--brand-600); margin: 0; }
.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: var(--sp-2); margin-top: var(--sp-5); }

/* 搜索框 */
.search { position: relative; }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-muted); pointer-events: none; }
.search .input { padding-left: 32px; height: 34px; border-radius: var(--r-btn); background: var(--bg-sunken); border-color: transparent; }
.search .input:focus { background: var(--surface); border-color: var(--brand-500); }

/* 徽标 / 标签 / 头像 / 在线点 */
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--r-full); background: var(--accent); color: #fff; font-size: 11px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.tag { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: var(--r-sm); font-size: var(--fs-xs); font-weight: 500; background: var(--bg-sunken); color: var(--text-secondary); white-space: nowrap; }
.tag-success { background: var(--success-soft); color: var(--success); }
.tag-brand { background: var(--brand-50); color: var(--brand-700); }
.tag-danger { background: var(--danger-soft); color: var(--danger); }
.tag-accent { background: var(--accent-soft); color: var(--text); }
.avatar { width: var(--avatar); height: var(--avatar); border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: var(--fs-md); color: #fff; background: var(--brand-500); flex-shrink: 0; user-select: none; }
.avatar.c1 { background: var(--brand-700); }
.avatar.c2 { background: var(--text-secondary); }
.avatar.c3 { background: var(--warning); }
.avatar.c4 { background: var(--brand-600); }
.avatar-sm { width: 28px; height: 28px; font-size: var(--fs-xs); }
.avatar-lg { width: 56px; height: 56px; font-size: var(--fs-xl); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); display: inline-block; flex-shrink: 0; }
.dot.is-online { background: var(--success); }

/* 空态 / 骨架 / 错误态 */
.state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: var(--sp-8) var(--sp-4); text-align: center; color: var(--text-muted); font-size: var(--fs-sm); min-height: 160px; }
.state-icon { width: 40px; height: 40px; color: var(--border-strong); }
.state-title { color: var(--text-secondary); font-weight: 500; font-size: var(--fs-md); }
.state.is-error .state-icon { color: var(--danger); }
.state .btn { margin-top: 4px; }
.skeleton { background: linear-gradient(90deg, var(--bg-sunken) 25%, var(--border) 50%, var(--bg-sunken) 75%); background-size: 200% 100%; animation: kf-shimmer 1.4s linear infinite; border-radius: var(--r-sm); }
.skeleton-line { height: 12px; }
.skeleton-circle { border-radius: 50%; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--border); border-top-color: var(--brand-600); border-radius: 50%; animation: kf-spin .7s linear infinite; flex-shrink: 0; }
.spinner-lg { width: 24px; height: 24px; }

/* 卡片 / 表格 / 布局工具 */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--shadow-sm); }
.card-body { padding: var(--sp-5); }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-md); }
.table th { text-align: left; font-weight: 500; color: var(--text-muted); font-size: var(--fs-xs); padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-hover); }
.row { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; }
.col { display: flex; flex-direction: column; min-width: 0; }
.grow { flex: 1 1 auto; min-width: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.muted { color: var(--text-muted); }
.secondary { color: var(--text-secondary); }
.text-sm { font-size: var(--fs-sm); }
.text-xs { font-size: var(--fs-xs); }
.tnum { font-variant-numeric: tabular-nums; }
.divider { height: 1px; background: var(--border); }
.hidden { display: none !important; }

@keyframes kf-spin { to { transform: rotate(360deg); } }
@keyframes kf-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes kf-fade-up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes kf-pulse-ring { 0% { box-shadow: 0 0 0 0 rgba(249, 115, 22, .45); } 70% { box-shadow: 0 0 0 10px rgba(249, 115, 22, 0); } 100% { box-shadow: 0 0 0 0 rgba(249, 115, 22, 0); } }
