/**
 * 多点健康 · 工作台 —— 样式
 * 前半部分沿用 Demo 的设计（变量、布局、组件、间距保持一致），
 * 「正式版新增」之后为加载/错误状态、移动端抽屉、焦点样式、用户菜单等扩展。
 */
:root {
  --primary: #0E9F8E;
  --primary-dark: #0B7F72;
  --primary-light: #E6F6F4;
  --danger: #DC2626;
  --bg: #F5F7FA;
  --card: #FFFFFF;
  --text: #1F2937;
  --text-2: #6B7280;
  --text-3: #9CA3AF;
  --border: #E5E7EB;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-hover: 0 8px 24px rgba(15, 23, 42, .10);
  --sidebar-w: 220px;
  --header-h: 60px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.6;
  height: 100vh; overflow: hidden; /* 整页不滚动，只让内容区 .main 滚动 */
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }

/* ---------- 顶栏 ---------- */
.header {
  position: fixed; top: 0; left: 0; right: 0; height: var(--header-h); z-index: 20;
  background: #fff; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 24px; gap: 24px;
}
.brand { display: flex; align-items: center; gap: 10px; width: calc(var(--sidebar-w) - 24px); flex-shrink: 0; }
.brand-logo {
  width: 34px; height: 34px; border-radius: 9px; color: #fff; font-weight: 700; font-size: 16px;
  background: linear-gradient(135deg, var(--primary), #34C3B0); display: grid; place-items: center;
}
.brand-text .t1 { font-size: 15px; font-weight: 600; line-height: 1.2; }
.brand-text .t2 { font-size: 11px; color: var(--text-3); line-height: 1.2; }
.search { position: relative; flex: 1; max-width: 480px; }
.search input {
  width: 100%; height: 36px; border: 1px solid var(--border); border-radius: 18px;
  padding: 0 16px 0 38px; font-size: 13px; background: var(--bg); outline: none; transition: .2s;
}
.search input:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px var(--primary-light); }
.search .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.search-result {
  position: absolute; top: 42px; left: 0; right: 0; background: #fff; border-radius: 10px;
  box-shadow: var(--shadow-hover); border: 1px solid var(--border); max-height: 420px; overflow: auto; display: none;
}
.search-result.show { display: block; }
.sr-group { padding: 8px 14px 4px; font-size: 12px; color: var(--text-3); }
.sr-item { display: flex; gap: 10px; align-items: center; padding: 8px 14px; cursor: pointer; }
.sr-item:hover, .sr-item.active { background: var(--primary-light); }
.sr-item .n { font-weight: 500; }
.sr-item .d { font-size: 12px; color: var(--text-2); }
.sr-empty { padding: 20px; text-align: center; color: var(--text-3); }
.user { margin-left: auto; display: flex; align-items: center; gap: 8px; color: var(--text-2); }
.user .av { width: 30px; height: 30px; border-radius: 50%; background: var(--primary-light); color: var(--primary); display: grid; place-items: center; font-weight: 600; }

/* ---------- 侧栏 ---------- */
.sidebar {
  position: fixed; top: var(--header-h); left: 0; bottom: 0; width: var(--sidebar-w);
  background: #fff; border-right: 1px solid var(--border); padding: 16px 12px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 8px;
  color: var(--text-2); margin-bottom: 4px; transition: .15s; font-size: 14px;
}
.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.nav-item .ic { font-size: 17px; width: 20px; text-align: center; }
.nav-divider { height: 1px; background: var(--border); margin: 12px 14px; }
.nav-group { font-size: 12px; color: var(--text-3); padding: 0 14px 6px; }
.sidebar-foot { position: absolute; bottom: 16px; left: 12px; right: 12px; font-size: 12px; color: var(--text-3); padding: 0 14px; }

/* ---------- 主区域 ---------- */
.main {
  position: fixed; top: var(--header-h); left: var(--sidebar-w); right: 0; bottom: 0;
  overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  padding: 24px 32px 40px;
}
.page { display: none; max-width: 1240px; margin: 0 auto; animation: fade .25s ease; }
.page.active { display: block; }
.page.full { max-width: none; }
/* 数据看板铺满内容区，不产生外层滚动条 */
.page.full.active { display: flex; flex-direction: column; height: 100%; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.page-title { font-size: 22px; font-weight: 600; margin-bottom: 4px; }
.page-sub { color: var(--text-2); margin-bottom: 24px; }
.section-title { font-size: 16px; font-weight: 600; margin: 32px 0 14px; display: flex; align-items: center; justify-content: space-between; }
.section-title .more { font-size: 13px; color: var(--primary); font-weight: 400; cursor: pointer; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--border); }
.grid { display: grid; gap: 16px; }
.g4 { grid-template-columns: repeat(4, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g-auto { grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }
.empty { padding: 40px; text-align: center; color: var(--text-3); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 16px;
  border-radius: 8px; font-size: 13px; font-weight: 500; transition: .15s; white-space: nowrap;
}
.btn-sm { height: 30px; padding: 0 12px; font-size: 12px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #B91C1C; }
.btn-ghost.danger-text:hover { border-color: var(--danger); color: var(--danger); }

/* ---------- 首页 ---------- */
.hero {
  border-radius: 16px; padding: 28px 32px; color: #fff; position: relative; overflow: hidden;
  background: linear-gradient(120deg, #0B7F72 0%, #0E9F8E 45%, #34C3B0 100%);
}
.hero::after {
  content: ""; position: absolute; right: -60px; top: -80px; width: 320px; height: 320px; border-radius: 50%;
  background: rgba(255,255,255,.08);
}
.hero h1 { font-size: 24px; font-weight: 600; margin-bottom: 6px; }
.hero p { opacity: .9; }
.notice { margin-top: 18px; display: flex; flex-direction: column; gap: 6px; position: relative; z-index: 1; }
.notice-item { display: flex; gap: 8px; align-items: center; font-size: 13px; }
/* 标签不换行（Demo 在手机上会把「新上线」折成两行） */
.notice-item .tag { background: rgba(255,255,255,.22); padding: 1px 8px; border-radius: 4px; font-size: 12px; flex-shrink: 0; white-space: nowrap; }

.entry { padding: 22px; cursor: pointer; transition: .2s; position: relative; overflow: hidden; }
.entry:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.entry .eic { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 24px; margin-bottom: 14px; }
.entry .en { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.entry .ed { color: var(--text-2); font-size: 13px; }
.entry .arrow { position: absolute; right: 20px; top: 24px; color: var(--text-3); transition: .2s; }
.entry:hover .arrow { color: var(--primary); transform: translateX(3px); }

.mini { display: flex; gap: 12px; align-items: center; padding: 16px; cursor: pointer; transition: .2s; }
.mini:hover { box-shadow: var(--shadow-hover); }
.mini .n { font-weight: 600; }
.mini .d { font-size: 12px; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- 头像 ---------- */
.avatar { border-radius: 14px; display: grid; place-items: center; color: #fff; font-weight: 700; flex-shrink: 0; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- 知识库 ---------- */
.kb-banner { display: flex; align-items: center; gap: 24px; padding: 28px 32px; }
.kb-banner .big { font-size: 48px; }
.kb-banner .info { flex: 1; }
.kb-banner h2 { font-size: 20px; margin-bottom: 6px; }
.kb-banner p { color: var(--text-2); }
.kb-sec { padding: 18px 20px; display: flex; gap: 14px; align-items: flex-start; cursor: pointer; transition: .2s; }
.kb-sec:hover { box-shadow: var(--shadow-hover); border-color: var(--primary); }
.kb-sec .i { font-size: 26px; }
.kb-sec .n { font-weight: 600; margin-bottom: 2px; }
.kb-sec .d { font-size: 13px; color: var(--text-2); }

/* ---------- 智能体（精简卡片） ---------- */
.agent-card { padding: 20px; display: flex; flex-direction: column; gap: 12px; transition: .2s; }
.agent-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.agent-head { display: flex; gap: 12px; align-items: center; }
.agent-head .n { font-size: 16px; font-weight: 600; line-height: 1.3; margin-bottom: 4px; }
.agent-intro {
  flex: 1; color: var(--text-2); font-size: 13px; line-height: 1.7; min-height: calc(1.7em * 3);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.agent-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px dashed var(--border); padding-top: 12px; }
.contact { font-size: 12px; color: var(--text-3); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact a { color: var(--primary); cursor: pointer; }
.contact a:hover { text-decoration: underline; }
.status { display: inline-block; font-size: 11px; padding: 0 8px; border-radius: 10px; font-weight: 500; line-height: 18px; }
.status.online { background: #DCFCE7; color: #15803D; }
.status.beta { background: #FEF3C7; color: #B45309; }
.status.maintain { background: #F3F4F6; color: #6B7280; }

/* ---------- 数据看板 ---------- */
.dash-bar { display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin-bottom: 12px; }
.dash-bar .t { font-weight: 600; font-size: 15px; }
.dash-bar .u { font-size: 12px; color: var(--text-3); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-frame-wrap { position: relative; flex: 1; min-height: 420px; overflow: hidden; }
.dash-frame-wrap iframe { width: 100%; height: 100%; border: 0; display: block; }
.dash-tip {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); background: rgba(31,41,55,.92); color: #fff;
  padding: 8px 14px; border-radius: 8px; font-size: 12px; display: flex; gap: 12px; align-items: center;
}
.dash-tip a { color: #5EEAD4; cursor: pointer; }
.dash-tip .x { cursor: pointer; opacity: .7; }

/* ---------- 业务系统 ---------- */
.tabs { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.tab { padding: 6px 16px; border-radius: 16px; background: #fff; border: 1px solid var(--border); color: var(--text-2); font-size: 13px; }
.tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.sys-card { padding: 20px; display: flex; flex-direction: column; transition: .2s; }
.sys-card:hover { box-shadow: var(--shadow-hover); }
.sys-head { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.sys-head .i { width: 42px; height: 42px; border-radius: 10px; background: var(--primary-light); display: grid; place-items: center; font-size: 22px; }
.sys-head .n { font-weight: 600; font-size: 15px; }
.sys-head .c { font-size: 12px; color: var(--text-3); }
.sys-desc { color: var(--text-2); font-size: 13px; margin-bottom: 12px; flex: 1; }
.meta { font-size: 12px; color: var(--text-2); display: grid; grid-template-columns: 64px 1fr; row-gap: 4px; background: var(--bg); padding: 10px 12px; border-radius: 8px; margin-bottom: 14px; }
.meta .k { color: var(--text-3); }
.sys-foot { display: flex; gap: 8px; }
.sys-foot .btn { flex: 1; }

/* ---------- 配置管理 ---------- */
.admin-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.admin-actions { display: flex; gap: 8px; }
.admin-note { background: #FFFBEB; border: 1px solid #FDE68A; color: #92400E; padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; }
.admin-card { padding: 0 20px 20px; }
.atabs { display: flex; gap: 28px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.atab { padding: 14px 2px 12px; color: var(--text-2); font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.atab:hover { color: var(--text); }
.atab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.atab .cnt { background: var(--bg); color: var(--text-2); border-radius: 10px; padding: 0 7px; font-size: 12px; margin-left: 4px; font-weight: 400; }
.toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.toolbar input { height: 34px; width: 280px; border: 1px solid var(--border); border-radius: 8px; padding: 0 12px; font-size: 13px; outline: none; }
.toolbar input:focus { border-color: var(--primary); }
.toolbar .sp { flex: 1; }
.tbl-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
.tbl { width: 100%; border-collapse: collapse; min-width: 760px; }
.tbl th { text-align: left; font-weight: 500; color: var(--text-2); background: #F9FAFB; padding: 10px 14px; font-size: 13px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 12px 14px; border-bottom: 1px solid #F3F4F6; vertical-align: middle; font-size: 13px; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: #FAFBFC; }
.tbl .muted { color: var(--text-3); }
.cell-main { display: flex; align-items: center; gap: 10px; font-weight: 500; white-space: nowrap; }
.cell-main .emo { width: 32px; height: 32px; border-radius: 8px; background: var(--primary-light); display: grid; place-items: center; font-size: 17px; flex-shrink: 0; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--text-2); max-width: 380px; }
.link-ok { color: #15803D; white-space: nowrap; }
.link-ok:hover { text-decoration: underline; }
.link-miss { color: #D97706; white-space: nowrap; }
.ops { display: flex; gap: 2px; white-space: nowrap; }
.op { padding: 3px 8px; border-radius: 6px; color: var(--primary); font-size: 13px; }
.op:hover { background: var(--primary-light); }
.op.danger { color: var(--danger); }
.op.danger:hover { background: #FEE2E2; }
.op:disabled { color: #D1D5DB; cursor: not-allowed; background: none; }
.kb-base { background: var(--bg); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.kb-base-title { font-weight: 600; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; }

/* ---------- 表单 / 弹窗 ---------- */
.mask { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 50; display: none; align-items: center; justify-content: center; padding: 20px; }
.mask.show { display: flex; animation: fade .2s ease; }
.modal { background: #fff; border-radius: 14px; width: 580px; max-width: 100%; max-height: calc(100vh - 40px); display: flex; flex-direction: column; box-shadow: 0 20px 50px rgba(15,23,42,.25); }
.modal-hd { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; font-weight: 600; font-size: 16px; }
.modal-hd .x { font-size: 16px; color: var(--text-3); padding: 4px; }
.modal-hd .x:hover { color: var(--text); }
.modal-bd { padding: 20px; overflow-y: auto; }
.modal-ft { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.form { display: flex; flex-wrap: wrap; gap: 0 12px; }
.field { flex: 1 1 100%; margin-bottom: 16px; min-width: 0; }
.field.half { flex: 1 1 calc(50% - 6px); }
.field .fl { display: flex; justify-content: space-between; font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.field .req { color: var(--danger); margin-left: 2px; }
.field .counter { font-weight: 400; font-size: 12px; color: var(--text-3); }
.field input[type=text], .field input[type=password], .field textarea, .field select {
  width: 100%; height: 36px; border: 1px solid var(--border); border-radius: 8px; padding: 0 12px;
  font-size: 13px; font-family: inherit; outline: none; background: #fff; color: var(--text);
}
.field textarea { height: auto; min-height: 76px; padding: 8px 12px; resize: vertical; line-height: 1.6; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.field input[type=color] { width: 100%; height: 36px; border: 1px solid var(--border); border-radius: 8px; padding: 3px; background: #fff; cursor: pointer; }
.field .hint { font-size: 12px; color: var(--text-3); margin-top: 4px; word-break: break-all; }
.field.err input, .field.err textarea, .field.err select { border-color: var(--danger); }
.field .errmsg { font-size: 12px; color: var(--danger); margin-top: 4px; }
.img-field { display: flex; gap: 14px; align-items: center; }
.img-field .btns { display: flex; gap: 8px; margin-top: 8px; }
.confirm-title { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.confirm-text { color: var(--text-2); font-size: 13px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; top: 80px; left: 50%; transform: translate(-50%, -10px); opacity: 0; pointer-events: none;
  background: #1F2937; color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 13px; z-index: 100; transition: .25s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, 1fr); } .g3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 760px) {
  .main { left: 0; padding: 16px 16px 32px; }
  .g4, .g3 { grid-template-columns: 1fr; } .brand { width: auto; } .brand-text, .user .un, .user .caret { display: none; }
  .field.half { flex-basis: 100%; } .toolbar input { width: 100%; }
}

/* =====================================================================
 * 正式版新增
 * ===================================================================== */

/* ---------- 键盘焦点：Tab 操作时可见，鼠标点击不显示 ---------- */
a:focus-visible, button:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
:focus:not(:focus-visible) { outline: none; }
.nav-item:focus-visible, .um-item:focus-visible, .atab:focus-visible { outline-offset: -2px; }
.hero a:focus-visible { outline-color: #fff; }
.dash-tip a:focus-visible, .dash-tip button:focus-visible { outline-color: #5EEAD4; }
.main:focus, .modal:focus { outline: none; }
.brand { border-radius: 10px; }

/* ---------- 按钮状态 ---------- */
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary:disabled:hover { background: var(--primary); }
.btn-ghost:disabled:hover { border-color: var(--border); color: var(--text); }
.btn-danger:disabled:hover { background: var(--danger); }
.btn.is-busy { cursor: progress; }

/* 卡片/链接改为真正的 <a>/<button> 后，按钮版本保持与链接一致的外观 */
button.card, .link-btn { font: inherit; color: inherit; text-align: left; }
button.card { width: 100%; }
.link-btn { padding: 0; }
.contact .link-btn { color: var(--primary); cursor: pointer; }
.contact .link-btn:hover { text-decoration: underline; }

/* ---------- 加载 / 错误状态 ---------- */
.boot {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  min-height: 60vh; color: var(--text-3); text-align: center; padding: 24px; animation: fade .25s ease .15s both;
}
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--primary-light); border-top-color: var(--primary); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.boot .boot-ic { font-size: 36px; line-height: 1; }
.boot .boot-t { font-size: 16px; font-weight: 600; color: var(--text); }
.boot .boot-d { font-size: 13px; color: var(--text-2); max-width: 420px; }

/* ---------- 顶栏：汉堡按钮 / 搜索快捷键 / 用户菜单 ---------- */
.menu-btn { display: none; width: 36px; height: 36px; margin-left: -6px; border-radius: 8px; font-size: 20px; line-height: 1; color: var(--text); place-items: center; flex-shrink: 0; }
.menu-btn:hover { background: var(--bg); }
.search-kbd {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%); pointer-events: none;
  font: 500 11px/18px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--text-3);
  border: 1px solid var(--border); background: #fff; border-radius: 5px; padding: 0 6px;
}
.search input:focus ~ .search-kbd, .search input:not(:placeholder-shown) ~ .search-kbd { display: none; }
.sr-item > div { min-width: 0; }
.search-result mark { background: #FDE68A; color: inherit; border-radius: 3px; padding: 0 1px; }

.user { position: relative; }
.user-btn { display: flex; align-items: center; gap: 8px; padding: 3px 8px 3px 3px; border-radius: 20px; color: inherit; font-size: 14px; transition: .15s; }
.user-btn:hover, .user-btn[aria-expanded="true"] { background: var(--bg); color: var(--text); }
.user-btn .caret { font-size: 10px; color: var(--text-3); }
.user .av { overflow: hidden; flex-shrink: 0; }
.user .av img { width: 100%; height: 100%; object-fit: cover; }
.user-menu {
  position: absolute; top: calc(100% + 8px); right: 0; min-width: 148px; padding: 6px; z-index: 30;
  background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-hover); animation: fade .15s ease;
}
.um-who { padding: 4px 12px 8px; margin-bottom: 4px; font-size: 12px; color: var(--text-3); border-bottom: 1px solid var(--border); white-space: nowrap; }
.um-item { display: flex; width: 100%; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 6px; font-size: 13px; color: var(--text); text-align: left; white-space: nowrap; }
.um-item:hover, .um-item:focus { background: var(--primary-light); color: var(--primary); }

/* ---------- 首页公告：带链接的可点击 ---------- */
.notice:empty { display: none; }
a.notice-item { align-self: flex-start; }
a.notice-item:hover .nt { text-decoration: underline; }
.notice-item .ext { font-size: 12px; opacity: .75; }

/* ---------- 数据看板：混合内容提示 / 无法内嵌 ---------- */
.dash-tip { width: max-content; max-width: calc(100% - 32px); }
.dash-tip a { white-space: nowrap; }
.dash-tip .x { color: #fff; font-size: 12px; padding: 0 2px; }
.dash-tip .x:hover { opacity: 1; }
.dash-tip.warn { background: rgba(146,64,14,.95); }
.dash-tip.warn a { color: #FDE68A; }
.dash-blocked {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 24px 24px 72px; text-align: center; color: var(--text-2); font-size: 13px;
}
.dash-blocked .ic { font-size: 36px; line-height: 1.2; }
.dash-blocked .t { font-size: 16px; font-weight: 600; color: var(--text); }
.dash-blocked p { max-width: 460px; }

/* ---------- 配置管理：登录卡片 / 公告标签 / 上传状态 ---------- */
.login-card { max-width: 400px; margin: 48px auto 0; padding: 32px 28px 28px; text-align: center; }
.login-card .lc-ic { width: 56px; height: 56px; border-radius: 16px; background: var(--primary-light); display: grid; place-items: center; font-size: 26px; margin: 0 auto 14px; }
.login-card .lc-t { font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.login-card .lc-d { font-size: 13px; color: var(--text-2); margin-bottom: 20px; }
.login-card .form { text-align: left; }
.login-card .lc-btn { width: 100%; height: 38px; }
.admin-actions { flex-wrap: wrap; }
.notice-tag { display: inline-block; background: var(--primary-light); color: var(--primary); padding: 1px 8px; border-radius: 4px; font-size: 12px; white-space: nowrap; }
.tbl-busy .ops { opacity: .6; pointer-events: none; }
.img-field .is-uploading { position: relative; }
.img-field .is-uploading .avatar { filter: brightness(.75); }
.img-field .is-uploading::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px;
  border-radius: 50%; border: 3px solid rgba(255,255,255,.55); border-top-color: #fff; animation: spin .8s linear infinite;
}

/* ---------- 移动端：侧栏改为抽屉 ---------- */
.drawer-mask { display: none; }
@media (max-width: 760px) {
  .header { padding: 0 12px; gap: 10px; }
  .menu-btn { display: grid; }
  .search { min-width: 0; }
  .search-kbd { display: none; }
  .search-result { position: fixed; top: calc(var(--header-h) - 6px); left: 12px; right: 12px; max-height: calc(100vh - var(--header-h) - 24px); }
  .user-btn { padding: 3px; }
  .sidebar {
    z-index: 30; width: min(260px, 82vw); transform: translateX(-100%); visibility: hidden;
    transition: transform .25s ease, visibility 0s linear .25s;
  }
  .drawer-open .sidebar { transform: none; visibility: visible; box-shadow: 8px 0 24px rgba(15,23,42,.12); transition: transform .25s ease; }
  .drawer-mask {
    display: block; position: fixed; top: var(--header-h); left: 0; right: 0; bottom: 0; z-index: 25;
    background: rgba(15,23,42,.45); opacity: 0; visibility: hidden; transition: opacity .25s ease, visibility 0s linear .25s;
  }
  .drawer-open .drawer-mask { opacity: 1; visibility: visible; transition: opacity .25s ease; }
  .atabs { gap: 20px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .atabs::-webkit-scrollbar { display: none; }
  .atab { flex-shrink: 0; white-space: nowrap; }
  .kb-banner { flex-wrap: wrap; gap: 16px; padding: 22px 20px; }
  .kb-banner .big { font-size: 40px; }
  .dash-bar .u { display: none; }
  .dash-bar .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* ---------- [前台页面] 补充样式（views/home、kb、agents、dashboard、systems、search） ---------- */

/* 空状态占满整行（Demo 里只占第一列） */
.grid > .empty { grid-column: 1 / -1; }

/* 快捷入口说明最多 3 行：知识库目录很多时不把整行卡片撑高，完整内容见悬停提示 */
.entry .ed { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* 卡片：键盘聚焦时与鼠标悬停效果一致 */
.entry:focus-visible { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.entry:focus-visible .arrow { color: var(--primary); transform: translateX(3px); }
.mini:focus-visible { box-shadow: var(--shadow-hover); }
.kb-sec:focus-visible { box-shadow: var(--shadow-hover); border-color: var(--primary); }

/* 地址待配置时，#kbOpen / #dashOpen 是没有 href 的 role=button 链接 */
a[role="button"] { cursor: pointer; }

/* 智能体联系人：名字太长时省略显示，「@联系人」仍然可见可点
   （未配置链接时是 <button>，按 Demo 的行内写法超出时会被省略号整个隐藏） */
.agent-foot .contact { display: flex; align-items: baseline; gap: .28em; } /* 与原来的空格等宽 */
.agent-foot .contact > a, .agent-foot .contact > .link-btn { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 智能体：从首页预览 / 搜索结果跳过来时，短暂高亮目标卡片 */
@keyframes target-flash { 0%, 45% { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light), var(--shadow-hover); } }
.agent-card.is-target { animation: target-flash 1.6s ease; }

/* 数据看板：无法内嵌 / 待配置时的操作按钮 */
.dash-blocked .acts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 8px; }

/* ---------- [前台页面] 结束 ---------- */

/* ---------- [配置管理] 补充样式（views/admin、auth，ui/form） ---------- */

/* 用户菜单：当前登录信息 */
.um-who { line-height: 1.5; }
.um-name { font-size: 13px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 6px; }
.um-badge { font-size: 11px; font-weight: 500; color: var(--primary); background: var(--primary-light); border-radius: 4px; padding: 0 6px; }

/* 登录弹窗 / 登录卡片 */
.login-alt { flex: 1 1 100%; font-size: 13px; color: var(--text-2); margin-top: -4px; }
.login-alt .link-btn { color: var(--primary); cursor: pointer; }
.login-alt .link-btn:hover { text-decoration: underline; }
.login-card .lc-btn + .lc-btn { margin-top: 10px; }
.login-card .lc-id {
  display: flex; align-items: center; gap: 8px; margin: -4px 0 20px; padding: 8px 8px 8px 12px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px; text-align: left;
}
.login-card .lc-id code { flex: 1; min-width: 0; overflow-wrap: anywhere; font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--text); }

/* 配置管理表格 / 表单 */
.toolbar input[type=search] { -webkit-appearance: none; appearance: none; }
.kb-base .form { gap: 0 12px; }
.kb-base .field:last-child { margin-bottom: 0; }
.kb-base + .kb-base { margin-top: -4px; }
.btn.is-busy { pointer-events: none; }
.import-errors { margin: 12px 0 0 18px; font-size: 13px; color: var(--text); display: flex; flex-direction: column; gap: 6px; }
.import-errors .muted { color: var(--text-3); list-style: none; margin-left: -18px; }

/* ---------- [配置管理] 结束 ---------- */

/* ---------- 兼容与边界情况 ---------- */
/* 平台名称 / 公司名很长时不撑破顶栏 */
.brand-text { min-width: 0; }
.brand-text .t1, .brand-text .t2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 手机横屏等矮屏幕（仍是桌面布局）：侧栏内容放不下时可以滚动，页脚跟在导航后面而不是盖住它 */
.sidebar { display: flex; flex-direction: column; overflow-y: auto; overscroll-behavior: contain; }
.sidebar nav { flex: 1 0 auto; }
.sidebar-foot { position: static; padding: 16px 14px 0; flex-shrink: 0; }
/* 弹窗高度按实际可见区域算：iOS Safari 的 100vh 包含地址栏，底部按钮会被挡住 */
@supports (height: 100dvh) { .modal { max-height: calc(100dvh - 40px); } }
/* 移动端：收起中的遮罩（淡出动画期间）不拦截点击；顶栏（含搜索结果、用户菜单）在抽屉遮罩之上 */
@media (max-width: 760px) {
  .header { z-index: 35; }
  .drawer-mask { pointer-events: none; }
  .drawer-open .drawer-mask { pointer-events: auto; }
}
/* 很长、不带空格的内容（英文、链接）也能换行，不把卡片撑出屏幕 */
.grid > * { min-width: 0; }
.n, .d, .ed, .en, .sys-desc, .meta span, .agent-intro, .notice-item, .kb-banner h2, .kb-banner p, .page-title, .hero h1, .sr-item .d { overflow-wrap: anywhere; }
/* 手机上隐藏的文字只是视觉上隐藏，读屏软件仍能读到（品牌链接、头像按钮不会变成没有名字的按钮） */
@media (max-width: 760px) {
  .brand-text, .user .un {
    display: block; position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
  }
}
/* iOS 聚焦字号小于 16px 的输入框会自动放大页面，触屏设备上输入框统一 16px */
@media (hover: none) and (pointer: coarse) {
  .search input, .toolbar input, .field input[type=text], .field input[type=password], .field textarea, .field select { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
