/* 可配置工作台首页。所有选择器均以 hbd- 命名，避免与应用级 hb-workbench 页签冲突。 */
#page-dashboard {
  background: #f3f6fb !important;
  padding: 0 !important;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}
#hb-dashboard-root { min-width: 0; }
.hbd-shell { max-width: 1760px; margin: 0 auto; padding: 18px 20px 36px; min-width: 0; }
.hbd-hero {
  position: relative; overflow: hidden; color: #fff; border-radius: 16px;
  padding: 20px 22px; margin-bottom: 14px;
  background: linear-gradient(118deg, #10295f 0%, #184b9f 60%, #1677ff 100%);
  box-shadow: 0 10px 28px rgba(22, 73, 156, .18);
}
.hbd-hero::after {
  content: ""; position: absolute; width: 280px; height: 280px; right: 6%; top: -185px;
  border-radius: 50%; background: rgba(255,255,255,.09); box-shadow: 95px 80px 0 rgba(255,255,255,.045);
  pointer-events: none;
}
.hbd-hero-main { position: relative; z-index: 1; display: flex; align-items: center; gap: 18px; min-width: 0; }
.hbd-hero-copy { min-width: 220px; flex: 1; }
.hbd-title { margin: 0; font-size: 21px; line-height: 1.35; font-weight: 700; letter-spacing: .3px; }
.hbd-subtitle { margin-top: 5px; font-size: 12px; color: rgba(255,255,255,.73); line-height: 1.55; }
.hbd-hero-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.hbd-brand-list { display: flex; gap: 5px; padding: 4px; border-radius: 10px; background: rgba(5,23,58,.28); flex-wrap: wrap; }
.hbd-brand-btn, .hbd-btn, .hbd-icon-btn, .hbd-tab-btn, .hbd-size-btn {
  appearance: none; border: 0; font: inherit; cursor: pointer; transition: .15s ease;
}
.hbd-brand-btn { padding: 7px 11px; border-radius: 7px; color: rgba(255,255,255,.72); background: transparent; font-size: 12px; }
.hbd-brand-btn:hover { color: #fff; background: rgba(255,255,255,.1); }
.hbd-brand-btn.is-active { color: #174891; background: #fff; font-weight: 650; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.hbd-btn { min-height: 34px; padding: 7px 13px; border-radius: 8px; font-size: 12px; font-weight: 600; }
.hbd-btn-light { color: #fff; background: rgba(255,255,255,.13); border: 1px solid rgba(255,255,255,.24); }
.hbd-btn-light:hover { background: rgba(255,255,255,.22); }
.hbd-btn-primary { color: #fff; background: #1677ff; box-shadow: 0 4px 12px rgba(22,119,255,.2); }
.hbd-btn-primary:hover { background: #0969da; transform: translateY(-1px); }
.hbd-btn-secondary { color: #365171; background: #fff; border: 1px solid #dce5f0; }
.hbd-btn-secondary:hover { color: #1677ff; border-color: #a9c9fa; background: #f7faff; }
.hbd-btn-danger { color: #d4380d; background: #fff6f3; border: 1px solid #ffd7ca; }
.hbd-btn[disabled], .hbd-icon-btn[disabled] { opacity: .48; cursor: not-allowed; transform: none; }

.hbd-syncbar { display: flex; gap: 9px; align-items: center; min-height: 28px; margin: -4px 2px 10px; font-size: 11px; color: #728199; }
.hbd-sync-dot { width: 7px; height: 7px; border-radius: 50%; background: #21a665; box-shadow: 0 0 0 3px rgba(33,166,101,.11); }
.hbd-syncbar.is-offline .hbd-sync-dot { background: #fa8c16; box-shadow: 0 0 0 3px rgba(250,140,22,.12); }
.hbd-syncbar.is-error .hbd-sync-dot { background: #ef4444; box-shadow: 0 0 0 3px rgba(239,68,68,.12); }
.hbd-warning { margin-left: auto; color: #b26a00; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.hbd-tabs-wrap {
  display: flex; align-items: center; gap: 8px; margin-bottom: 14px; padding: 8px;
  border: 1px solid #e3eaf3; border-radius: 13px; background: rgba(255,255,255,.92);
  box-shadow: 0 2px 10px rgba(30,64,110,.045); min-width: 0;
}
.hbd-tabs { display: flex; align-items: center; gap: 5px; flex: 1; overflow-x: auto; scrollbar-width: thin; min-width: 0; }
.hbd-tab { position: relative; display: flex; align-items: center; gap: 7px; flex: 0 0 auto; padding: 0; border-radius: 9px; background: transparent; }
.hbd-tab-btn { min-height: 34px; padding: 7px 13px; border-radius: 8px; color: #596a82; background: transparent; white-space: nowrap; font-size: 13px; }
.hbd-tab-btn:hover { color: #1677ff; background: #f4f8fe; }
.hbd-tab.is-active .hbd-tab-btn { color: #0f5fc5; background: #eaf3ff; font-weight: 650; }
.hbd-default-star { color: #f0a500; font-size: 11px; }
.hbd-tab-tools { display: flex; align-items: center; gap: 2px; padding-right: 5px; }
.hbd-icon-btn { width: 27px; height: 27px; border-radius: 6px; color: #7b8ba2; background: transparent; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; }
.hbd-icon-btn:hover { color: #1677ff; background: #eaf3ff; }
.hbd-icon-btn.is-danger:hover { color: #d4380d; background: #fff0eb; }
.hbd-tab-add { flex: 0 0 auto; }

.hbd-editbar {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px; margin-bottom: 12px;
  border-radius: 11px; border: 1px dashed #9fc5f7; background: #f4f9ff; color: #45617f; font-size: 12px;
}
.hbd-editbar-spacer { flex: 1; }

.hbd-grid { display: grid; grid-template-columns: repeat(12, minmax(0,1fr)); gap: 14px; align-items: stretch; min-width: 0; }
.hbd-module { grid-column: span 12; min-width: 0; }
.hbd-size-third { grid-column: span 4; }
.hbd-size-half { grid-column: span 6; }
.hbd-size-twoThirds { grid-column: span 8; }
.hbd-size-full { grid-column: span 12; }
.hbd-card {
  height: 100%; min-height: 210px; min-width: 0; display: flex; flex-direction: column;
  background: #fff; border: 1px solid #e7edf5; border-radius: 14px;
  box-shadow: 0 3px 14px rgba(33,60,98,.052); overflow: hidden; transition: .18s ease;
}
.hbd-card:hover { border-color: #d5e2f2; box-shadow: 0 7px 22px rgba(33,60,98,.085); }
.hbd-editing .hbd-card { border-style: dashed; border-color: #b7cbe5; }
.hbd-module.is-dragging { opacity: .45; }
.hbd-module.is-drag-target .hbd-card { outline: 2px solid #1677ff; outline-offset: 2px; }
.hbd-module.is-hidden .hbd-card { opacity: .57; background: repeating-linear-gradient(135deg,#fff,#fff 12px,#f8fafc 12px,#f8fafc 24px); }
.hbd-card-head { min-height: 54px; display: flex; align-items: center; gap: 10px; padding: 13px 15px 10px; border-bottom: 1px solid #f0f3f7; }
.hbd-card-icon { width: 31px; height: 31px; flex: 0 0 31px; border-radius: 9px; display: flex; align-items: center; justify-content: center; color: #1677ff; background: #edf5ff; font-size: 15px; }
.hbd-card-heading { flex: 1; min-width: 0; }
.hbd-card-title { font-size: 14px; font-weight: 650; color: #1b2a40; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbd-card-desc { margin-top: 2px; font-size: 10px; color: #98a5b7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbd-card-tools { display: flex; align-items: center; gap: 2px; }
.hbd-drag-handle { cursor: grab; color: #92a3b8; letter-spacing: -2px; user-select: none; padding: 4px; }
.hbd-size-select { height: 27px; max-width: 76px; border: 1px solid #dce5ef; border-radius: 6px; color: #60718a; background: #fff; font-size: 11px; outline: none; }
.hbd-card-body { flex: 1; min-height: 0; padding: 14px 15px 16px; overflow: hidden; }
.hbd-card-footer { min-height: 31px; display: flex; align-items: center; padding: 6px 15px; border-top: 1px solid #f3f5f8; color: #9aa7b8; font-size: 10px; }

.hbd-state { min-height: 135px; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 10px; color: #8d9aad; }
.hbd-state-icon { width: 42px; height: 42px; border-radius: 13px; margin-bottom: 10px; display: flex; align-items: center; justify-content: center; background: #f1f5fa; color: #8ca0b8; font-size: 18px; }
.hbd-state-title { font-size: 13px; font-weight: 600; color: #6b7b90; }
.hbd-state-sub { margin-top: 4px; max-width: 280px; font-size: 11px; line-height: 1.6; color: #a1adbd; }
.hbd-state .hbd-btn { margin-top: 11px; }
.hbd-skeleton { display: grid; gap: 10px; width: 100%; }
.hbd-skeleton i { display: block; height: 13px; border-radius: 7px; background: linear-gradient(90deg,#eef2f7 25%,#f7f9fc 37%,#eef2f7 63%); background-size: 400% 100%; animation: hbdShimmer 1.25s ease infinite; }
.hbd-skeleton i:nth-child(1) { width: 56%; height: 25px; }
.hbd-skeleton i:nth-child(2) { width: 92%; }
.hbd-skeleton i:nth-child(3) { width: 78%; }
.hbd-skeleton i:nth-child(4) { width: 86%; }
@keyframes hbdShimmer { 0%{background-position:100% 0} 100%{background-position:0 0} }

.hbd-kpis { display: grid; grid-template-columns: repeat(6,minmax(110px,1fr)); gap: 10px; }
.hbd-kpi { position: relative; min-width: 0; padding: 12px 13px; border-radius: 11px; border: 1px solid #edf1f6; background: linear-gradient(145deg,#fff,#fbfcfe); overflow: hidden; }
.hbd-kpi::after { content:""; position:absolute; right:-22px; bottom:-26px; width:62px; height:62px; border-radius:50%; background:var(--hbd-accent-soft,#eef5ff); }
.hbd-kpi-label { position: relative; z-index:1; font-size: 11px; color: #8390a3; }
.hbd-kpi-value { position: relative; z-index:1; margin-top: 7px; color: var(--hbd-accent,#1677ff); font-weight: 720; font-size: 21px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbd-kpi-note { position: relative; z-index:1; margin-top: 5px; font-size: 10px; color: #a4afbd; }

.hbd-chart { width: 100%; height: 220px; min-width: 0; }
.hbd-chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.hbd-chart-legend { display: flex; gap: 14px; align-items: center; margin-bottom: 8px; color: #7e8da1; font-size: 10px; }
.hbd-legend-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-right: 5px; }
.hbd-bars { display: grid; gap: 11px; }
.hbd-bar-row { min-width: 0; }
.hbd-bar-meta { display: flex; gap: 8px; align-items: center; margin-bottom: 5px; min-width: 0; font-size: 11px; }
.hbd-bar-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #4b5d74; }
.hbd-bar-value { color: #25364d; font-weight: 650; white-space: nowrap; }
.hbd-bar-track { height: 7px; border-radius: 5px; background: #edf1f6; overflow: hidden; }
.hbd-bar-fill { height: 100%; min-width: 2px; border-radius: inherit; background: linear-gradient(90deg,#1677ff,#57a0ff); }

.hbd-list { display: grid; gap: 0; min-width: 0; }
.hbd-list-row { min-height: 42px; display: flex; align-items: center; gap: 9px; padding: 8px 2px; border-bottom: 1px solid #f0f3f6; min-width: 0; }
.hbd-list-row:last-child { border-bottom: 0; }
.hbd-rank { width: 23px; height: 23px; flex: 0 0 23px; display: flex; align-items: center; justify-content: center; border-radius: 7px; color: #6f8097; background: #eef3f8; font-size: 10px; font-weight: 700; }
.hbd-list-row:nth-child(1) .hbd-rank { color: #9b6900; background: #fff0bf; }
.hbd-list-row:nth-child(2) .hbd-rank { color: #5e7187; background: #e8eef4; }
.hbd-list-row:nth-child(3) .hbd-rank { color: #9a542c; background: #fae3d5; }
.hbd-list-main { flex: 1; min-width: 0; }
.hbd-list-title { color: #33465f; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbd-list-sub { margin-top: 2px; color: #9ca8b8; font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbd-list-value { color: #22344b; font-size: 12px; font-weight: 650; white-space: nowrap; text-align: right; }
.hbd-status-pill { display: inline-flex; align-items: center; padding: 3px 7px; border-radius: 999px; color: #526983; background: #eef3f8; font-size: 10px; }
.hbd-message-dot { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; background: #d0d8e3; }
.hbd-message-dot.is-unread { background: #1677ff; box-shadow: 0 0 0 3px #e7f1ff; }
.hbd-alert-dot { width: 25px; height: 25px; flex: 0 0 25px; border-radius: 8px; display:flex; align-items:center; justify-content:center; color:#d46b08; background:#fff3df; font-size:12px; }
.hbd-health { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
.hbd-health-item { padding: 11px; border-radius: 10px; background: #f7f9fc; border: 1px solid #edf1f6; }
.hbd-health-name { color:#6f7f94; font-size:10px; }
.hbd-health-value { margin-top:5px; color:#2f435d; font-size:13px; font-weight:650; }

.hbd-empty-dashboard { min-height: 360px; border: 1px dashed #cbd8e8; border-radius: 14px; background: rgba(255,255,255,.72); display:flex; flex-direction:column; align-items:center; justify-content:center; color:#8594a7; }
.hbd-empty-dashboard strong { color:#52667f; font-size:15px; margin-bottom:6px; }

.hbd-drawer { position: fixed; inset: 0; z-index: 12000; display: none; }
.hbd-drawer.is-open { display: block; }
.hbd-drawer-mask { position: absolute; inset: 0; background: rgba(17,28,45,.32); backdrop-filter: blur(1px); }
.hbd-drawer-panel { position: absolute; right: 0; top: 0; bottom: 0; width: min(460px,92vw); display:flex; flex-direction:column; background:#f7f9fc; box-shadow:-12px 0 36px rgba(20,42,72,.18); animation:hbdSlide .18s ease; }
@keyframes hbdSlide { from{transform:translateX(24px);opacity:.5} to{transform:none;opacity:1} }
.hbd-drawer-head { display:flex; align-items:center; gap:10px; padding:18px 18px 14px; background:#fff; border-bottom:1px solid #e8edf4; }
.hbd-drawer-title { flex:1; font-size:16px; font-weight:700; color:#21344c; }
.hbd-drawer-body { flex:1; overflow:auto; padding:14px; }
.hbd-library-group { margin-bottom:18px; }
.hbd-library-heading { margin:0 0 8px 3px; color:#7f8ea2; font-size:11px; font-weight:650; }
.hbd-library-item { display:flex; gap:11px; align-items:center; padding:12px; margin-bottom:8px; border:1px solid #e5ebf3; border-radius:11px; background:#fff; }
.hbd-library-icon { width:35px; height:35px; flex:0 0 35px; border-radius:10px; display:flex; align-items:center; justify-content:center; color:#1677ff; background:#edf5ff; }
.hbd-library-copy { flex:1; min-width:0; }
.hbd-library-name { color:#31455f; font-size:13px; font-weight:650; }
.hbd-library-desc { margin-top:3px; color:#98a5b5; font-size:10px; line-height:1.45; }
.hbd-library-item.is-added { opacity:.58; }

.hbd-toast { position: fixed; z-index: 13000; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(12px); padding: 10px 15px; border-radius: 9px; color:#fff; background:#20344f; box-shadow:0 8px 28px rgba(24,44,71,.24); font-size:12px; opacity:0; pointer-events:none; transition:.18s ease; }
.hbd-toast.is-show { opacity:1; transform:translateX(-50%) translateY(0); }
.hbd-toast.is-error { background:#bd2c20; }

.hb-brand-menu-badge { width:22px; height:22px; flex:0 0 22px; display:inline-flex; align-items:center; justify-content:center; border-radius:6px; color:#fff; font-size:12px; font-weight:700; }
.hbm-modal { position:fixed; inset:0; z-index:14000; display:flex; align-items:center; justify-content:center; padding:24px; }
.hbm-mask { position:absolute; inset:0; background:rgba(15,28,46,.48); backdrop-filter:blur(3px); }
.hbm-panel { position:relative; width:min(920px,96vw); max-height:90vh; display:flex; flex-direction:column; overflow:hidden; border:1px solid rgba(255,255,255,.7); border-radius:18px; background:#f5f8fc; box-shadow:0 24px 70px rgba(17,35,61,.28); }
.hbm-head { display:flex; align-items:flex-start; gap:20px; padding:22px 24px 18px; color:#fff; background:linear-gradient(120deg,#153b79,#1477e8); }
.hbm-head > div:first-child { flex:1; }
.hbm-title { margin:0; font-size:20px; }
.hbm-subtitle { margin:7px 0 0; color:rgba(255,255,255,.78); font-size:12px; line-height:1.6; }
.hbm-close { width:34px; height:34px; border:1px solid rgba(255,255,255,.38); border-radius:9px; color:#fff; background:rgba(255,255,255,.1); cursor:pointer; font-size:22px; }
.hbm-status { min-height:20px; padding:8px 24px 0; color:#16724b; font-size:12px; }
.hbm-status.is-error { color:#b42318; }
.hbm-body { overflow:auto; padding:14px 24px 24px; }
.hbm-create,.hbm-list { padding:16px; border:1px solid #e2e9f2; border-radius:14px; background:#fff; }
.hbm-list { margin-top:14px; }
.hbm-section-title { margin:0 0 12px; color:#263c58; font-size:14px; }
.hbm-create-grid { display:grid; grid-template-columns:1fr 1.2fr 120px auto; gap:10px; align-items:end; }
.hbm-field { display:grid; gap:5px; min-width:0; }
.hbm-label { color:#708198; font-size:10px; }
.hbm-input { width:100%; min-width:0; height:36px; box-sizing:border-box; border:1px solid #dbe4ef; border-radius:8px; padding:0 10px; color:#243952; background:#fbfcfe; outline:none; }
.hbm-input:focus { border-color:#1677ff; box-shadow:0 0 0 3px rgba(22,119,255,.11); }
.hbm-check { width:20px; height:20px; margin:7px 0 9px; accent-color:#1677ff; }
.hbm-primary,.hbm-secondary { height:36px; border-radius:8px; padding:0 15px; cursor:pointer; font-weight:650; }
.hbm-primary { border:0; color:#fff; background:#1677ff; }
.hbm-secondary { border:1px solid #bad2f2; color:#1265c6; background:#edf5ff; }
.hbm-primary:disabled,.hbm-secondary:disabled { opacity:.55; cursor:not-allowed; }
.hbm-row { display:grid; grid-template-columns:180px 1fr; gap:16px; align-items:end; padding:13px 0; border-top:1px solid #edf1f6; }
.hbm-row:first-of-type { border-top:0; }
.hbm-row.is-disabled { opacity:.62; }
.hbm-identity { display:flex; flex-wrap:wrap; gap:5px 8px; align-items:center; min-width:0; }
.hbm-identity strong { width:100%; color:#293e59; font-size:13px; }
.hbm-identity code { color:#73849a; font-size:11px; }
.hbm-built-in { padding:2px 6px; border-radius:999px; color:#57708d; background:#eaf0f7; font-size:9px; }
.hbm-row-controls { display:grid; grid-template-columns:minmax(150px,1fr) 100px 62px auto; gap:9px; align-items:end; }
.hbm-loading,.hbm-error { padding:30px; text-align:center; color:#71839a; }
.hbm-error { color:#b42318; }

@media (max-width: 1450px) {
  .hbd-kpis { grid-template-columns: repeat(3,minmax(120px,1fr)); }
}
@media (max-width: 1280px) {
  .hbd-shell { padding: 14px 14px 30px; }
  .hbd-size-third, .hbd-size-half { grid-column: span 6; }
  .hbd-size-twoThirds, .hbd-size-full { grid-column: span 12; }
  .hbd-kpis { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .hbd-hero-main { align-items: flex-start; flex-wrap: wrap; }
  .hbd-hero-actions { width: 100%; justify-content: flex-start; }
}
@media (max-width: 860px) {
  .hbd-shell { padding-left: 10px; padding-right: 10px; }
  .hbd-hero { padding: 16px; border-radius: 12px; }
  .hbd-title { font-size:18px; }
  .hbd-size-third, .hbd-size-half, .hbd-size-twoThirds, .hbd-size-full { grid-column: span 12; }
  .hbd-kpis { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .hbd-tabs-wrap { align-items:flex-start; }
  .hbd-editbar { align-items:flex-start; flex-wrap:wrap; }
  .hbd-editbar-spacer { display:none; }
  .hbm-modal { padding:8px; }
  .hbm-panel { max-height:96vh; border-radius:14px; }
  .hbm-head,.hbm-body { padding-left:15px; padding-right:15px; }
  .hbm-create-grid,.hbm-row,.hbm-row-controls { grid-template-columns:1fr; }
  .hbm-check { margin-bottom:2px; }
}
@media (prefers-reduced-motion: reduce) {
  .hbd-card, .hbd-btn, .hbd-brand-btn, .hbd-toast { transition:none; }
  .hbd-skeleton i { animation:none; }
}
