/* ============================================================================
   PlatformAI · Design System (ds.css)
   统一设计系统：暗色优先，支持浅色。组件类名统一以 ds- 前缀，
   与既有页面的 --var 主题变量兼容（--bg / --surface / --accent / --border …）。
   ============================================================================ */

:root {
  /* ---- 调色板（暗色为默认） ---- */
  --bg:            #0c0e14;
  --bg-2:          #11141d;
  --surface:       #161a25;
  --surface-2:     #1c2130;
  --bg-card:       #161a25;
  --bg-secondary:  #11141d;
  --bg-input:      #1a1f2c;
  --bg-hover:      #1f2533;

  --border:        #2a3142;
  --border-2:      #353e52;

  --text-primary:  #e8ebf2;
  --text-secondary:#aab2c5;
  --text-muted:    #6b7385;
  --text-faint:    #4a5163;

  --accent:        #5b8cff;
  --accent-2:      #7c5cff;
  --accent-ink:    #ffffff;
  --accent-bg:     rgba(91,140,255,.12);
  --accent-soft:   rgba(91,140,255,.08);

  --ok:   #3fb950;
  --ok-bg:rgba(63,185,80,.12);
  --warn: #d99a22;
  --warn-bg:rgba(217,154,34,.12);
  --bad:  #f0594c;
  --bad-bg:rgba(240,89,76,.12);
  --run:  #58a6ff;
  --info: #39b9e6;

  /* ---- 尺度 ---- */
  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --gap:       16px;
  --gap-sm:    10px;
  --shadow:    0 10px 34px rgba(0,0,0,.36);
  --shadow-sm: 0 4px 14px rgba(0,0,0,.28);
  --ring:      0 0 0 3px var(--accent-soft);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: "SF Mono", ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;

  --sidebar-w: 248px;
  --topbar-h:  58px;
}

[data-theme="light"] {
  --bg:    #f5f7fb;
  --bg-2:  #ffffff;
  --surface:#ffffff;
  --surface-2:#f1f4f9;
  --bg-card:#ffffff;
  --bg-secondary:#f5f7fb;
  --bg-input:#eef1f6;
  --bg-hover:#e9edf4;
  --border:#dde3ec;
  --border-2:#cbd3e0;
  --text-primary:#161c28;
  --text-secondary:#4c5468;
  --text-muted:#7b8499;
  --text-faint:#a6aebe;
  --accent:#2f6fe0;
  --accent-2:#6a45e8;
  --accent-ink:#ffffff;
  --accent-bg:rgba(47,111,224,.10);
  --accent-soft:rgba(47,111,224,.10);
  --shadow:0 10px 30px rgba(20,30,60,.10);
  --shadow-sm:0 4px 14px rgba(20,30,60,.08);
}

/* ============================== 基础 ============================== */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text-primary);
  font: 14px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1,h2,h3,h4 { margin: 0; font-weight: 650; letter-spacing: .2px; }
::selection { background: var(--accent-bg); }

/* 滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); background-clip: padding-box; }

/* ============================== 应用骨架 ============================== */
.ds-app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  grid-template-areas: "brand topbar" "side main";
  height: 100vh;
}
.ds-topbar {
  grid-area: topbar;
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 30;
}
.ds-brand {
  grid-area: brand;
  display: flex; align-items: center; gap: 11px;
  padding: 0 18px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  font-weight: 700; font-size: 15px; letter-spacing: .3px;
}
.ds-brand .ds-logo {
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid; place-items: center; color: #fff; font-size: 16px;
  box-shadow: 0 4px 14px rgba(91,140,255,.4);
}
.ds-brand small { display:block; font-weight: 500; font-size: 11px; color: var(--text-muted); letter-spacing: .5px; }

.ds-search {
  flex: 1; max-width: 460px; display: flex; align-items: center; gap: 9px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 13px; color: var(--text-muted);
}
.ds-search input { flex: 1; background: none; border: none; outline: none; color: var(--text-primary); font-size: 13px; }
.ds-search kbd {
  font: 11px var(--font-mono); background: var(--surface-2); border: 1px solid var(--border);
  padding: 1px 6px; border-radius: 6px; color: var(--text-muted);
}
.ds-top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.ds-health { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-muted); }
.ds-health .pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 var(--ok-bg); animation: ds-pulse 1.9s infinite; }
@keyframes ds-pulse { 0%,100%{opacity:1; box-shadow:0 0 0 0 var(--ok-bg);} 50%{opacity:.4; box-shadow:0 0 0 6px transparent;} }

.ds-side {
  grid-area: side;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  padding: 14px 11px; overflow: auto;
}
.ds-nav-group {
  font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--text-faint); margin: 16px 12px 7px; font-weight: 600;
}
.ds-nav-group:first-child { margin-top: 4px; }
.ds-nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: 10px;
  color: var(--text-secondary); cursor: pointer; font-size: 13px;
  transition: background .14s, color .14s; user-select: none;
}
.ds-nav-item svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.8; flex: none; }
.ds-nav-item:hover { background: var(--surface); color: var(--text-primary); text-decoration: none; }
.ds-nav-item.active { background: var(--accent-bg); color: var(--text-primary); box-shadow: inset 2px 0 0 var(--accent); }
.ds-nav-item .badge {
  margin-left: auto; font-size: 11px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 999px; padding: 1px 7px; color: var(--text-muted);
}
.ds-nav-item .dot { margin-left: auto; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }

.ds-main { grid-area: main; overflow: auto; }
.ds-main-inner { padding: 26px 30px 60px; max-width: 1240px; margin: 0 auto; }

/* ============================== 排版工具 ============================== */
.ds-page-head { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 6px; }
.ds-page-head h1 { font-size: 23px; }
.ds-page-head .ds-sub { color: var(--text-muted); font-size: 13.5px; }
.ds-section { margin-top: 34px; }
.ds-section-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.ds-section-head h2 { font-size: 16px; }
.ds-section-head .ds-sub { color: var(--text-muted); font-size: 12.5px; }
.ds-section-head .ds-line { flex: 1; height: 1px; background: var(--border); }
.ds-muted { color: var(--text-muted); }
.ds-eyebrow { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); font-weight: 700; }
.ds-center { text-align: center; }

/* ============================== 卡片 ============================== */
.ds-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.ds-card.hover:hover { border-color: var(--border-2); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.ds-card h3 { font-size: 14.5px; display: flex; align-items: center; gap: 9px; }
.ds-card .ds-card-sub { color: var(--text-muted); font-size: 12.5px; margin-top: 6px; }

.ds-grid { display: grid; gap: var(--gap); }
.ds-grid.c2 { grid-template-columns: repeat(2, 1fr); }
.ds-grid.c3 { grid-template-columns: repeat(3, 1fr); }
.ds-grid.c4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1100px){ .ds-grid.c4 { grid-template-columns: repeat(2,1fr);} .ds-grid.c3 { grid-template-columns: repeat(2,1fr);} }
@media (max-width: 720px){ .ds-grid.c2,.ds-grid.c3,.ds-grid.c4 { grid-template-columns: 1fr; } }

/* 能力图标块 */
.ds-cap-ic {
  width: 38px; height: 38px; border-radius: 11px; flex: none;
  display: grid; place-items: center; font-size: 19px;
  background: var(--accent-soft); color: var(--accent);
  border: 1px solid var(--accent-bg);
}
.ds-cap-ic.b2 { background: rgba(124,92,255,.10); color: var(--accent-2); border-color: rgba(124,92,255,.18); }
.ds-cap-ic.g  { background: var(--ok-bg); color: var(--ok); border-color: rgba(63,185,80,.2); }
.ds-cap-ic.w  { background: var(--warn-bg); color: var(--warn); border-color: rgba(217,154,34,.2); }
.ds-cap-ic.i  { background: rgba(57,185,230,.12); color: var(--info); border-color: rgba(57,185,230,.2); }

/* ============================== 统计 ============================== */
.ds-stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 17px;
}
.ds-stat .k { color: var(--text-muted); font-size: 12px; display: flex; align-items: center; gap: 7px; }
.ds-stat .v { font-size: 27px; font-weight: 750; margin-top: 7px; letter-spacing: .3px; }
.ds-stat .d { font-size: 12px; margin-top: 4px; }
.ds-stat .d.up { color: var(--ok); } .ds-stat .d.down { color: var(--bad); }

/* ============================== 徽章 / 标签 ============================== */
.ds-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; padding: 2px 9px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--text-muted); background: var(--surface-2);
}
.ds-badge.ok { background: var(--ok-bg); color: var(--ok); border-color: rgba(63,185,80,.25); }
.ds-badge.warn { background: var(--warn-bg); color: var(--warn); border-color: rgba(217,154,34,.25); }
.ds-badge.bad { background: var(--bad-bg); color: var(--bad); border-color: rgba(240,89,76,.25); }
.ds-badge.run { background: rgba(88,166,255,.12); color: var(--run); border-color: rgba(88,166,255,.25); }
.ds-badge.acc { background: var(--accent-bg); color: var(--accent); border-color: var(--accent-bg); }
.ds-badge .d { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ============================== 按钮 ============================== */
.ds-btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-primary); border-radius: 9px;
  padding: 8px 14px; font-size: 13px; cursor: pointer;
  transition: background .14s, border-color .14s, color .14s; white-space: nowrap;
}
.ds-btn:hover { background: var(--bg-hover); border-color: var(--border-2); text-decoration: none; }
.ds-btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.ds-btn.primary:hover { filter: brightness(1.07); }
.ds-btn.ghost { background: transparent; }
.ds-btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.ds-btn:disabled { opacity: .5; cursor: not-allowed; }
.ds-btn svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.9; }

/* ============================== 表单 ============================== */
.ds-input, .ds-select, .ds-textarea {
  width: 100%; background: var(--bg-input); border: 1px solid var(--border);
  color: var(--text-primary); border-radius: 9px; padding: 9px 12px;
  font: 13px var(--font); outline: none; transition: border-color .14s, box-shadow .14s;
}
.ds-input:focus, .ds-select:focus, .ds-textarea:focus { border-color: var(--accent); box-shadow: var(--ring); }
.ds-textarea { resize: vertical; min-height: 90px; font-family: var(--font); }
.ds-label { display: block; font-size: 12px; color: var(--text-secondary); margin: 0 0 6px; font-weight: 600; }
.ds-field { margin-bottom: 14px; }

/* ============================== 表格 ============================== */
.ds-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ds-table th {
  text-align: left; color: var(--text-muted); font-weight: 600; font-size: 12px;
  padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.ds-table td { padding: 11px 14px; border-bottom: 1px solid var(--border); color: var(--text-secondary); vertical-align: middle; }
.ds-table tr:hover td { background: var(--bg-hover); }
.ds-table td .ds-strong { color: var(--text-primary); font-weight: 600; }

/* ============================== 标签 / 选项卡 ============================== */
.ds-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; flex-wrap: wrap; }
.ds-tab {
  padding: 9px 14px; font-size: 13px; color: var(--text-muted); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; border-radius: 7px 7px 0 0;
}
.ds-tab:hover { color: var(--text-primary); }
.ds-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ============================== 进度 ============================== */
.ds-progress { height: 7px; background: var(--bg-input); border-radius: 999px; overflow: hidden; }
.ds-progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 999px; }

/* ============================== 时间线 ============================== */
.ds-timeline { display: flex; flex-direction: column; }
.ds-tl-item { display: grid; grid-template-columns: 20px 1fr; gap: 13px; padding-bottom: 16px; position: relative; }
.ds-tl-item:before { content: ""; position: absolute; left: 9px; top: 20px; bottom: -2px; width: 2px; background: var(--border); }
.ds-tl-item:last-child:before { display: none; }
.ds-tl-dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border); background: var(--surface); z-index: 1; display: grid; place-items: center; }
.ds-tl-dot.ok { border-color: var(--ok); background: var(--ok); }
.ds-tl-dot.ok:after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #fff; }
.ds-tl-dot.pending { border-color: var(--warn); background: var(--warn); }
.ds-tl-dot.run { border-color: var(--run); background: var(--run); animation: ds-pulse 1.6s infinite; }
.ds-tl-body { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.ds-tl-head { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.ds-tl-meta { color: var(--text-muted); font-size: 12px; margin-top: 5px; }

/* ============================== Hero ============================== */
.ds-hero {
  position: relative; overflow: hidden;
  background:
    radial-gradient(900px 380px at 88% -10%, rgba(124,92,255,.18), transparent 60%),
    radial-gradient(700px 360px at 4% 0%, rgba(91,140,255,.16), transparent 55%),
    var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 34px 36px;
}
.ds-hero h1 { font-size: 30px; line-height: 1.25; letter-spacing: .2px; }
.ds-hero p { color: var(--text-secondary); font-size: 14.5px; max-width: 660px; margin: 14px 0 0; }
.ds-hero .ds-actions { margin-top: 22px; display: flex; gap: 11px; flex-wrap: wrap; }
.ds-hero .ds-chip-row { margin-top: 20px; display: flex; gap: 8px; flex-wrap: wrap; }

/* 能力/应用卡片中的小结构 */
.ds-kv { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; padding: 7px 0; border-bottom: 1px dashed var(--border); }
.ds-kv:last-child { border-bottom: none; }
.ds-kv .k { color: var(--text-muted); }
.ds-kv .v { color: var(--text-primary); font-weight: 600; text-align: right; }

.ds-pill-row { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.ds-pill { font-size: 11.5px; padding: 3px 10px; border-radius: 999px; background: var(--bg-input); border: 1px solid var(--border); color: var(--text-secondary); }

.ds-num { font-size: 13px; color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; }

/* 模态 */
.ds-modal-mask {
  position: fixed; inset: 0; display: none; align-items: center; justify-content: center;
  background: rgba(0,0,0,.45); z-index: 9999; padding: 20px;
}
.ds-modal-mask.open { display: flex; }
.ds-modal {
  width: min(560px, 94vw); max-height: 86vh; overflow: auto;
  background: var(--surface); border: 1px solid var(--border-2);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
}
.ds-modal-head { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); font-weight: 650; font-size: 15px; }
.ds-modal-body { padding: 20px; }
.ds-modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* 空态 */
.ds-empty { text-align: center; color: var(--text-muted); padding: 40px 20px; }
.ds-empty .ic { font-size: 30px; opacity: .5; }

/* 顶栏头像 / 主题按钮 */
.ds-icon-btn {
  width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-secondary);
  cursor: pointer; font-size: 15px;
}
.ds-icon-btn:hover { color: var(--text-primary); border-color: var(--border-2); }
.ds-avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-bg); color: var(--accent); border: 1px solid var(--accent-bg); font-weight: 700; font-size: 13px;
}

/* 小工具：分隔 / 间距 */
.ds-row { display: flex; gap: var(--gap); align-items: center; flex-wrap: wrap; }
.ds-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ds-mt { margin-top: var(--gap); }
.ds-mt-lg { margin-top: 28px; }
.ds-mb { margin-bottom: var(--gap); }
.ds-tag-list { display: flex; flex-wrap: wrap; gap: 6px; }

/* 主题切换浮标（无 JS 时隐藏） */
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
