/* ===== 知识管理中台 - 全局样式(浅色主题) ===== */
:root {
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --brand-soft: #eff4ff;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --border: #e6e9f0;
  --text: #1f2637;
  --text-sub: #64748b;
  --text-mute: #94a3b8;
  --ok: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 10px 30px rgba(16, 24, 40, .12);
  --sidebar-w: 220px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}
a { color: var(--brand); text-decoration: none; }
[v-cloak] { display: none; }

/* ===== 布局 ===== */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  background: #ffffff;
  color: #334155;
  border-right: 1px solid #e2e8f0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 20;
}
.sidebar .logo {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 20px;
  font-size: 16px; font-weight: 700; color: #0f172a;
  border-bottom: 1px solid #e2e8f0;
}
.sidebar .logo img { width: 28px; height: 28px; border-radius: 6px; object-fit: cover; background:#fff; }
.sidebar .logo .dot { width: 28px; height: 28px; border-radius: 7px; background: var(--brand); display:flex; align-items:center; justify-content:center; font-size:15px; }
.nav { flex: 1; padding: 10px 0; overflow-y: auto; }
.nav-group { padding: 14px 20px 6px; font-size: 11px; letter-spacing: .08em; color: #94a3b8; text-transform: uppercase; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px; color: #475569; font-size: 14px;
  border-left: 3px solid transparent; transition: .15s;
}
.nav a:hover { background: rgba(37,99,235,.06); color: #1d4ed8; }
.nav a.active { background: rgba(37,99,235,.10); color: #1d4ed8; font-weight: 600; border-left-color: var(--brand); }
.nav a .ico { width: 18px; text-align: center; opacity: .85; }
.sidebar .foot { padding: 14px 20px; border-top: 1px solid #e2e8f0; font-size: 12px; color: #94a3b8; }

.main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 60px; background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; position: sticky; top: 0; z-index: 10;
}
.topbar .crumb { font-size: 15px; font-weight: 600; }
.topbar .user { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--text-sub); }
.topbar .user .avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color:#fff; display:flex; align-items:center; justify-content:center; font-weight:600; }
.content { padding: 24px; flex: 1; }

/* ===== 卡片 / 面板 ===== */
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-hd { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.panel-hd h3 { margin: 0; font-size: 15px; }
.panel-bd { padding: 20px; }
.page-title { font-size: 20px; font-weight: 700; margin: 0 0 4px; }
.page-desc { color: var(--text-sub); margin: 0 0 20px; font-size: 13px; }

/* ===== 统计卡 ===== */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.stat .k { color: var(--text-sub); font-size: 13px; }
.stat .v { font-size: 28px; font-weight: 700; margin-top: 6px; }
.stat .ico { float: right; font-size: 24px; opacity: .9; }
.stat .ico .fa-solid, .stat .ico .fa-regular { color: var(--brand); }

/* ===== 单色蓝色图标（Font Awesome） ===== */
.fa-solid, .fa-regular, .fa-brands { color: var(--brand); }
.ico .fa-solid, .ico .fa-regular, .ico .fa-brands { vertical-align: middle; }
.btn .fa-solid, .tab .fa-solid, .panel-hd h3 .fa-solid { margin-right: 6px; }
.hint .fa-solid { margin-right: 4px; }
.sidebar .logo .dot .fa-solid { color: #fff; }
/* 主按钮(brand 蓝底)内图标用纯白,避免被全局蓝色规则染色看不清 */
.btn-primary .fa-solid, .btn-primary .fa-regular, .btn-primary .fa-brands { color: #fff; }

/* ===== 表格 ===== */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
table.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
table.grid th, table.grid td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); }
table.grid th { background: #f8fafc; color: var(--text-sub); font-weight: 600; white-space: nowrap; }
table.grid tbody tr:hover { background: #fafbfe; }
table.grid td { vertical-align: middle; }
.empty { text-align: center; color: var(--text-mute); padding: 48px 0; }

/* ===== 徽章 ===== */
.tag { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 500; }
.tag-green { background: #dcfce7; color: #15803d; }
.tag-red { background: #fee2e2; color: #b91c1c; }
.tag-gray { background: #eef1f6; color: #64748b; }
.tag-blue { background: var(--brand-soft); color: var(--brand-dark); }
.tag-amber { background: #fef3c7; color: #b45309; }

/* ===== 按钮 ===== */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 8px; border: 1px solid var(--border); background: #fff; color: var(--text); cursor: pointer; font-size: 13px; transition: .15s; }
.btn:hover { border-color: #cbd5e1; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-danger { background: #fff; border-color: #fecaca; color: var(--danger); }
.btn-danger:hover { background: #fef2f2; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-link { border: none; background: none; color: var(--brand); padding: 4px 8px; cursor: pointer; font-size: 13px; }
.btn-link.danger { color: var(--danger); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ===== 表单 ===== */
.field { margin-bottom: 16px; }
.field label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--text-sub); font-weight: 500; }
.field label .req { color: var(--danger); }
.input, .select, textarea.input {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; color: var(--text); background: #fff; outline: none; transition: .15s; font-family: inherit;
}
.input:focus, .select:focus, textarea.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.input.sm { width: 220px; }
.hint { font-size: 12px; color: var(--text-mute); margin-top: 5px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 20px; }
.form-grid .full { grid-column: 1 / -1; }

/* ===== 分页 ===== */
.pager { display: flex; align-items: center; gap: 8px; justify-content: flex-end; margin-top: 16px; font-size: 13px; color: var(--text-sub); }
.pager button { padding: 6px 12px; }

/* ===== 标签页 ===== */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tabs .tab { padding: 10px 18px; cursor: pointer; font-size: 14px; color: var(--text-sub); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs .tab.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }

/* ===== 弹窗 ===== */
.modal-mask { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal { background: #fff; border-radius: 12px; width: 480px; max-width: 92vw; max-height: 88vh; overflow: auto; box-shadow: var(--shadow-lg); }
.modal-hd { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-hd h3 { margin: 0; font-size: 16px; }
.modal-hd .x { cursor: pointer; color: var(--text-mute); font-size: 20px; line-height: 1; }
.modal-bd { padding: 22px; }
.modal-ft { padding: 16px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ===== Toast ===== */
.toast-wrap { position: fixed; top: 20px; right: 20px; z-index: 999; display: flex; flex-direction: column; gap: 10px; }
.toast { padding: 12px 18px; border-radius: 8px; color: #fff; box-shadow: var(--shadow-lg); font-size: 14px; animation: slideIn .2s; }
.toast.ok { background: var(--ok); }
.toast.err { background: var(--danger); }
.toast.info { background: #334155; }
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ===== 登录页 ===== */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1e3a8a, #2563eb 60%, #3b82f6); }
.login-card { background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg); width: 380px; max-width: 92vw; padding: 36px 34px; }
.login-card .brand { text-align: center; margin-bottom: 26px; }
.login-card .brand .mk { width: 52px; height: 52px; border-radius: 13px; background: var(--brand); color:#fff; display:inline-flex; align-items:center; justify-content:center; font-size:26px; margin-bottom: 12px; }
.login-card .brand .mk-logo { width: 52px; height: 52px; border-radius: 13px; object-fit: contain; background: #fff; margin-bottom: 12px; }
.login-card .brand h1 { font-size: 20px; margin: 0; }
.login-card .brand p { color: var(--text-mute); font-size: 13px; margin: 4px 0 0; }
.login-card .btn-primary { width: 100%; justify-content: center; padding: 11px; font-size: 15px; margin-top: 6px; }

.muted { color: var(--text-mute); }
.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12px; }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.flex { display: flex; align-items: center; gap: 8px; }

/* ===== COS 连通性测试结果 ===== */
.cos-test-bar { margin-top: 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cos-test {
  margin-top: 14px; padding: 14px 16px; border-radius: var(--radius); font-size: 13px; line-height: 1.7;
  border: 1px solid var(--border); background: #fafbfe;
}
.cos-test.is-ok { border-color: #bbf7d0; background: #f0fdf4; }
.cos-test.is-err { border-color: #fecaca; background: #fef2f2; }
.cos-test-hd { font-weight: 600; display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.cos-test.is-ok .cos-test-hd { color: var(--ok); }
.cos-test.is-ok .cos-test-hd .fa-solid { color: var(--ok); }
.cos-test.is-err .cos-test-hd { color: var(--danger); }
.cos-test.is-err .cos-test-hd .fa-solid { color: var(--danger); }
.cos-test-msg { color: var(--text-sub); }
.cos-test-steps { margin: 8px 0 0; padding-left: 4px; list-style: none; }
.cos-test-steps li { color: var(--text-sub); }
.cos-test-steps li .fa-solid { color: var(--brand); margin-right: 6px; }

/* === 资源选择器网格 === */
.picker-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(120px,1fr)); gap:12px; }
.picker-item { position:relative; border:2px solid var(--border); border-radius:var(--radius); overflow:hidden; cursor:pointer; background:#f7f8fc; text-align:center; padding:4px; }
.picker-item.active { border-color:var(--brand); }
.picker-item img { width:100%; height:90px; object-fit:contain; }
.picker-check { position:absolute; top:4px; right:4px; width:22px; height:22px; border-radius:50%; background:var(--brand); color:#fff; font-size:14px; font-weight:bold; display:flex; align-items:center; justify-content:center; }
.picker-id { font-size:11px; color:var(--text-mute); margin-top:4px; }
.modal-ft { padding:12px 20px; border-top:1px solid var(--border); display:flex; justify-content:flex-end; gap:8px; }
.field .radio-inline,
.radio-inline { display:inline-flex; align-items:center; gap:4px; margin-right:16px; font-size:13px; cursor:pointer; }

/* === 资源管理页 === */
.resource-grid { display:flex; flex-wrap:wrap; gap:14px; }
.res-card { display:flex; flex-direction:column; align-items:center; width:120px; padding:10px; background:var(--panel); border:1px solid var(--border); border-radius:var(--radius); }
.thumb-wrap { position:relative; width:100px; height:100px; border-radius:8px; background:#f7f8fc; flex-shrink:0; overflow:hidden; }
.thumb-wrap img { width:100px; height:100px; object-fit:contain; display:block; }
.del-btn { position:absolute; bottom:0; right:0; width:20px; height:20px; border-radius:4px 0 0 0; background:rgba(220,38,38,0.85); color:#fff; border:none; font-size:14px; line-height:1; cursor:pointer; display:flex; align-items:center; justify-content:center; z-index:10; }
.del-btn:hover { background:var(--danger); }
.res-meta { display:flex; align-items:center; gap:8px; margin-top:8px; width:100%; justify-content:center; }
.badge { display:inline-block; padding:2px 8px; border-radius:4px; background:var(--brand); color:#fff; font-size:11px; }

/* === 通用模态框 === */
.modal-overlay { position:fixed; inset:0; z-index:1000; background:rgba(0,0,0,0.45); display:flex; align-items:center; justify-content:center; }
.modal { background:#fff; border-radius:12px; box-shadow:0 12px 40px rgba(0,0,0,0.2); width:420px; max-width:90vw; max-height:80vh; overflow-y:auto; }
.modal-hd { display:flex; justify-content:space-between; align-items:center; padding:16px 20px; border-bottom:1px solid var(--border); font-weight:600; font-size:15px; }
.modal-hd .x { cursor:pointer; font-size:22px; color:var(--text-mute); line-height:1; }
.modal-hd .x:hover { color:var(--text); }
.modal-bd { padding:20px; }
.radio-group { display:flex; gap:16px; }
