/* ===========================================================================
   技能管理页（Ekko 品牌层 · 第八模块）
   ---------------------------------------------------------------------------
   视觉基线：官方 Ekko Studio 0.7.39（naive-ui + 官方令牌）
     · 顶栏 = 官方 .page-header：min-height 64 / padding 14 20 / 1px 下边线
     · 左栏 = 官方 .skills-sidebar：280 宽 / 1px 右边线 / 页面底色
     · 右栏 = 官方 .skills-main：padding 16 20
     · 字号 = 官方 14 基准：标题 16、卡片名 14、正文 13、元信息 12、标签 12
     · 图标 = 官方同款 Feather 线性图标（24 viewBox / stroke currentColor）
   所有选择器锁在 #ekko-skills 下，官方升级不会互相影响。
   =========================================================================== */

html.es-lock,
html.es-lock body {
  overflow: hidden !important;
}

#ekko-skills {
  --es-hover: rgba(var(--text-primary-rgb, 26, 26, 26), 0.045);
  --es-active: rgba(var(--text-primary-rgb, 26, 26, 26), 0.075);
  --es-on: rgba(var(--es-accent-rgb), 0.1);
  --es-accent-rgb: var(--accent-primary-rgb, 35, 49, 118);
  --es-danger-rgb: 209, 67, 67;
  --es-ok-rgb: 47, 125, 82;
  --es-warn-rgb: 184, 134, 11;
  --es-info-rgb: 74, 111, 212;
  --es-line: var(--border-light, #ebebeb);
  --es-strong: var(--border-color, #e0e0e0);
  --es-secondary: var(--bg-secondary, #f0f0f0);
  --es-dim: var(--text-secondary, #666);
  --es-muted: var(--text-muted, #999);
  --es-danger: #d14343;
  --es-ok: #2f7d52;
  --es-warn: #b8860b;
  --es-radius: 8px;
  --es-radius-sm: 6px;

  position: fixed;
  inset: 0;
  /* 官方 studio-page-header 是 1001、web-pet 1200，必须盖在它们上面 */
  z-index: 1400;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary, #fafafa);
  color: var(--text-primary, #1a1a1a);
  font-family: var(--font-ui, "Inter", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
  font-size: var(--font-size-base, 14px);
  line-height: var(--line-height, 1.5);
  -webkit-font-smoothing: antialiased;
}

html.dark #ekko-skills,
#ekko-skills.dark {
  --es-danger: #f07272;
  --es-ok: #7fc39b;
  --es-warn: #d8b25a;
  --es-danger-rgb: 240, 114, 114;
  --es-ok-rgb: 127, 195, 155;
  --es-warn-rgb: 216, 178, 90;
  --es-info-rgb: 147, 170, 232;
}

/* 官方同款线性图标 */
#ekko-skills .es-ic {
  display: inline-block;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -0.2em;
  pointer-events: none;
}

/* ───────────────────────────  顶栏（官方 .page-header）  ─────────────────────────── */

#ekko-skills .es-top {
  flex: 0 0 auto;
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: var(--bg-primary, #fafafa);
  border-bottom: 1px solid var(--es-strong);
}

#ekko-skills .es-iconbtn {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: var(--es-radius-sm);
  background: transparent;
  color: var(--es-dim);
  font: inherit;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
#ekko-skills .es-iconbtn:hover {
  background: var(--es-hover);
  color: var(--text-primary, #1a1a1a);
}
#ekko-skills .es-iconbtn:disabled { opacity: 0.4; cursor: default; }
#ekko-skills .es-sidebtn { display: none; }

#ekko-skills .es-tabs {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: var(--es-radius-sm);
  background: var(--es-active);
}
#ekko-skills .es-tab {
  height: 28px;
  padding: 0 14px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--es-dim);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s;
}
#ekko-skills .es-tab:hover { color: var(--text-primary, #1a1a1a); }
#ekko-skills .es-tab.on {
  background: var(--bg-card, #fff);
  color: var(--text-primary, #1a1a1a);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

#ekko-skills .es-crumb {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  line-height: 1.3;
}
#ekko-skills .es-crumb b {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#ekko-skills .es-crumb span {
  font-size: 12px;
  color: var(--es-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#ekko-skills .es-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

#ekko-skills .es-btn {
  flex: 0 0 auto;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 14px;
  border: 1px solid var(--es-strong);
  border-radius: var(--es-radius-sm);
  background: var(--bg-card, #fff);
  color: var(--text-primary, #1a1a1a);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, opacity 0.12s;
}
#ekko-skills .es-btn .es-ic { width: 15px; height: 15px; }
#ekko-skills .es-btn:hover:not(:disabled) {
  background: var(--es-hover);
  border-color: var(--es-strong);
}
#ekko-skills .es-btn:disabled { opacity: 0.42; cursor: default; }

#ekko-skills .es-btn.es-primary {
  border-color: transparent;
  background: var(--accent-primary, #233176);
  color: #fff;
  font-weight: 600;
}
#ekko-skills .es-btn.es-primary:hover:not(:disabled) {
  background: var(--accent-primary, #233176);
  filter: brightness(0.92);
}

#ekko-skills .es-btn.small {
  height: 28px;
  gap: 5px;
  padding: 0 10px;
  font-size: 12px;
  border-radius: 4px;
}
#ekko-skills .es-btn.small .es-ic { width: 13px; height: 13px; }
#ekko-skills .es-btn.danger { color: var(--es-danger); }
#ekko-skills .es-btn.danger:hover:not(:disabled) {
  border-color: rgba(var(--es-danger-rgb), 0.45);
  background: rgba(var(--es-danger-rgb), 0.06);
}

/* ───────────────────────────  主体  ─────────────────────────── */

#ekko-skills .es-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: stretch;
  /* 手机端抽屉相对主体定位，别压到顶栏 */
  position: relative;
}

/* 官方 .skills-sidebar：280 / 1px 右边线 / 不铺卡片色 */
#ekko-skills .es-side {
  flex: 0 0 280px;
  width: 280px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 12px 24px;
  background: var(--bg-primary, #fafafa);
  border-right: 1px solid var(--es-strong);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

#ekko-skills .es-sidehead {
  height: 30px;
  padding: 0 10px;
  margin-top: 12px;
  display: flex;
  align-items: center;
  color: var(--es-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
#ekko-skills .es-sidehead:first-child { margin-top: 0; }
#ekko-skills .es-sidehint {
  padding: 2px 10px 8px;
  color: var(--es-muted);
  font-size: 12px;
  line-height: 1.6;
}

/* 外部技能目录的绝对路径：等宽 + 可换行，长路径不至于把左栏撑开 */
#ekko-skills .es-sidepath {
  margin-top: 2px;
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 11px;
  word-break: break-all;
}

#ekko-skills .es-sideitem {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--es-radius-sm);
  background: transparent;
  color: var(--text-primary, #1a1a1a);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s;
}
#ekko-skills .es-sideitem:hover { background: var(--es-hover); }
#ekko-skills .es-sideitem.on {
  background: var(--es-on);
  color: var(--accent-primary, #233176);
  font-weight: 600;
}
html.dark #ekko-skills .es-sideitem.on { color: var(--text-primary, #e0e0e0); }
#ekko-skills .es-sideicon {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  color: var(--es-muted);
}
#ekko-skills .es-sideicon .es-ic { width: 16px; height: 16px; }
#ekko-skills .es-sideitem.on .es-sideicon { color: inherit; }
#ekko-skills .es-sideitem-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#ekko-skills .es-sideitem-count {
  flex: 0 0 auto;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--es-hover);
  color: var(--es-dim);
  font-size: 11px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
#ekko-skills .es-sideitem.on .es-sideitem-count {
  background: rgba(var(--es-accent-rgb), 0.12);
  color: inherit;
}
#ekko-skills .es-warn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  color: var(--es-warn);
  cursor: help;
}
#ekko-skills .es-warn .es-ic { width: 15px; height: 15px; }

/* ───────────────────────────  右侧主区（官方 .skills-main）  ─────────────────────────── */

#ekko-skills .es-main {
  flex: 1 1 auto;
  min-width: 0;
  position: relative;
  display: flex;
  flex-direction: column;
}
#ekko-skills .es-maininner {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#ekko-skills .es-toolbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px 12px;
}

#ekko-skills .es-search {
  flex: 1 1 auto;
  min-width: 0;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--es-strong);
  border-radius: var(--es-radius-sm);
  background: var(--bg-card, #fff);
  color: var(--text-primary, #1a1a1a);
  font: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}
#ekko-skills .es-search::placeholder { color: var(--es-muted); }
#ekko-skills .es-search:focus {
  border-color: var(--accent-primary, #233176);
  box-shadow: 0 0 0 2px rgba(var(--es-accent-rgb), 0.14);
}

#ekko-skills .es-select {
  flex: 0 0 auto;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--es-strong);
  border-radius: var(--es-radius-sm);
  background: var(--bg-card, #fff);
  color: var(--text-primary, #1a1a1a);
  font: inherit;
  font-size: 13px;
  outline: none;
}
#ekko-skills .es-select:focus { border-color: var(--accent-primary, #233176); }
#ekko-skills .es-select.wide { width: 100%; margin-bottom: 12px; }

#ekko-skills .es-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 20px 28px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
  align-content: start;
  scrollbar-width: thin;
}

/* 卡片：官方卡片语言 —— 1px 边线、8px 圆角、16 内边距、无重阴影 */
#ekko-skills .es-card {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--es-line);
  border-radius: var(--es-radius);
  background: var(--bg-card, #fff);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, box-shadow 0.12s;
}
#ekko-skills .es-card:hover {
  border-color: var(--es-strong);
  background: var(--bg-card, #fff);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

#ekko-skills .es-cardhead {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  min-width: 0;
}
#ekko-skills .es-cardname {
  flex: 0 1 auto;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#ekko-skills .es-cardsub {
  margin-top: 3px;
  font-size: 12px;
  color: var(--es-muted);
  font-family: var(--font-code, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#ekko-skills .es-carddesc {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--es-dim);
  word-break: break-word;
}
#ekko-skills .es-cardmeta {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--es-line);
  font-size: 12px;
  color: var(--es-muted);
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 标签：对齐官方 n-tag 的尺寸与圆角 */
#ekko-skills .es-badge {
  flex: 0 0 auto;
  height: 20px;
  padding: 0 7px;
  display: inline-flex;
  align-items: center;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}
#ekko-skills .es-badge.shared {
  background: rgba(var(--es-info-rgb), 0.12);
  color: #3a5cb8;
}
#ekko-skills .es-badge.own {
  background: var(--es-hover);
  color: var(--es-dim);
}
#ekko-skills .es-badge.cat {
  background: var(--es-hover);
  color: var(--es-dim);
  border-radius: 10px;
}
#ekko-skills .es-badge.broken {
  background: rgba(var(--es-danger-rgb), 0.12);
  color: var(--es-danger);
}
#ekko-skills .es-badge.pending {
  background: rgba(var(--es-warn-rgb), 0.14);
  color: var(--es-warn);
}
#ekko-skills .es-badge.ok {
  background: rgba(var(--es-ok-rgb), 0.13);
  color: var(--es-ok);
}
#ekko-skills .es-badge.limit {
  background: rgba(var(--es-warn-rgb), 0.13);
  color: var(--es-warn);
}
/* 只读：编码框架自己的技能目录（~/.claude/skills 这类），本页不给改 */
#ekko-skills .es-badge.ro {
  background: transparent;
  color: var(--es-dim);
  box-shadow: inset 0 0 0 1px var(--es-line);
}
html.dark #ekko-skills .es-badge.shared { color: #93aae8; }

#ekko-skills .es-empty {
  grid-column: 1 / -1;
  padding: 48px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--es-muted);
  line-height: 1.7;
}
#ekko-skills .es-empty.small { padding: 20px 12px; font-size: 12px; }
#ekko-skills .es-empty.bad { color: var(--es-danger); }

/* ───────────────────────────  详情 / 编辑器  ─────────────────────────── */

#ekko-skills .es-detail {
  display: none;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
  padding: 16px 20px 20px;
}
#ekko-skills .es-detail.on { display: flex; }

#ekko-skills .es-doc {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* 提示条：官方 alert 语言 */
#ekko-skills .es-banner {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid rgba(var(--es-warn-rgb), 0.4);
  border-radius: var(--es-radius);
  background: rgba(var(--es-warn-rgb), 0.07);
  font-size: 13px;
  line-height: 1.6;
}
#ekko-skills .es-banner b { flex: 0 0 auto; color: var(--es-warn); font-weight: 600; }
#ekko-skills .es-banner span { flex: 1 1 auto; min-width: 0; }
#ekko-skills .es-banner .es-btn { height: 30px; font-size: 12px; }

/* 「可见范围」：官方 section 卡片 —— 灰底 section header + 白底 body */
#ekko-skills .es-grants {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--es-line);
  border-radius: var(--es-radius);
  background: var(--bg-card, #fff);
  overflow: hidden;
}
#ekko-skills .es-grantshead {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--es-line);
  background: var(--es-secondary);
  font-size: 13px;
  line-height: 1.5;
}
#ekko-skills .es-grantshead b { font-weight: 600; }
#ekko-skills .es-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px 0;
}
#ekko-skills .es-chip {
  height: 28px;
  padding: 0 12px;
  border: 1px solid var(--es-strong);
  border-radius: 14px;
  background: var(--bg-card, #fff);
  color: var(--text-primary, #1a1a1a);
  font: inherit;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
#ekko-skills .es-chip:hover { border-color: var(--accent-primary, #233176); }
#ekko-skills .es-chip.on {
  border-color: transparent;
  background: var(--accent-primary, #233176);
  color: #fff;
  font-weight: 500;
}
#ekko-skills .es-grantshint {
  padding: 8px 16px 12px;
  margin: 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--es-muted);
}

#ekko-skills .es-dochead {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  gap: 16px;
}
#ekko-skills .es-doctitle {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.01em;
}
#ekko-skills .es-docpath {
  margin-top: 4px;
  font-size: 12px;
  color: var(--es-muted);
  font-family: var(--font-code, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
  word-break: break-all;
}
#ekko-skills .es-docmeta {
  flex: 0 0 auto;
  margin-left: auto;
  font-size: 12px;
  color: var(--es-muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
  line-height: 1.6;
}

/* 官方 textarea：13px / 1.6 / 1px 边线 / 6px 圆角 */
#ekko-skills .es-editor {
  flex: 1 1 auto;
  min-height: 180px;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--es-strong);
  border-radius: var(--es-radius);
  background: var(--bg-card, #fff);
  color: var(--text-primary, #1a1a1a);
  font-family: var(--font-code, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
  font-size: 13px;
  line-height: 1.65;
  tab-size: 4;
  resize: none;
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}
#ekko-skills .es-editor:focus {
  border-color: var(--accent-primary, #233176);
  box-shadow: 0 0 0 2px rgba(var(--es-accent-rgb), 0.12);
}
#ekko-skills .es-editor[readonly] {
  background: var(--es-secondary);
  cursor: default;
}

#ekko-skills .es-files {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  max-height: 104px;
  overflow-y: auto;
}
#ekko-skills .es-fileshead {
  flex: 0 0 100%;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--es-muted);
}
#ekko-skills .es-file {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--es-line);
  border-radius: var(--es-radius-sm);
  background: var(--bg-card, #fff);
  color: var(--text-primary, #1a1a1a);
  font: inherit;
  font-size: 12px;
  font-family: var(--font-code, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
  cursor: pointer;
}
#ekko-skills .es-file:hover {
  border-color: var(--es-strong);
  background: var(--es-hover);
}
#ekko-skills .es-fileic {
  display: inline-flex;
  flex: 0 0 auto;
  color: var(--es-muted);
}
#ekko-skills .es-fileic .es-ic { width: 14px; height: 14px; }

#ekko-skills .es-dim { color: var(--es-muted); }

/* 版本抽屉 */
#ekko-skills .es-versions {
  position: absolute;
  top: 16px;
  right: 20px;
  width: min(360px, calc(100% - 40px));
  max-height: calc(100% - 40px);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--es-strong);
  border-radius: var(--es-radius);
  background: var(--bg-card, #fff);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14);
  z-index: 2;
  overflow: hidden;
}
#ekko-skills .es-versionshead {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 10px 0 16px;
  border-bottom: 1px solid var(--es-line);
  font-size: 13px;
}
#ekko-skills .es-versionshead b { flex: 1 1 auto; font-weight: 600; }
#ekko-skills .es-versions { overflow-y: auto; }
#ekko-skills .es-version {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--es-line);
  font-size: 13px;
}
#ekko-skills .es-version:last-child { border-bottom: 0; }
#ekko-skills .es-version > div:first-child { flex: 1 1 auto; min-width: 0; }
#ekko-skills .es-versionname {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}
#ekko-skills .es-version .es-dim { font-size: 12px; }

/* ───────────────────────────  审核  ─────────────────────────── */

#ekko-skills .es-proposals {
  display: none;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 20px 28px;
  gap: 12px;
  flex-direction: column;
}
#ekko-skills .es-proposals.on { display: flex; }

#ekko-skills .es-procard {
  padding: 16px;
  border: 1px solid var(--es-line);
  border-radius: var(--es-radius);
  background: var(--bg-card, #fff);
}
#ekko-skills .es-procard.open { border-left: 3px solid var(--es-warn); }
#ekko-skills .es-procard.approved { border-left: 3px solid var(--es-ok); }
#ekko-skills .es-procard.rejected { border-left: 3px solid var(--es-strong); opacity: 0.78; }

#ekko-skills .es-prohead {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
#ekko-skills .es-probtns {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

/* ───────────────────────────  弹层（官方 n-modal）  ─────────────────────────── */

#ekko-skills .es-mask {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.45);
}

#ekko-skills .es-modalbox {
  width: min(640px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  border-radius: 10px;
  background: var(--bg-card, #fff);
  color: var(--text-primary, #1a1a1a);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  animation: es-pop 0.14s ease-out;
}
@keyframes es-pop {
  from { transform: translateY(6px) scale(0.99); opacity: 0; }
  to { transform: none; opacity: 1; }
}

#ekko-skills .es-modalhead {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 56px;
  padding: 0 12px 0 20px;
  border-bottom: 1px solid var(--es-line);
}
#ekko-skills .es-modalhead b {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 16px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#ekko-skills .es-modalbody {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 20px;
}

#ekko-skills .es-modalinfo {
  margin-bottom: 12px;
  font-size: 13px;
  line-height: 1.7;
}
#ekko-skills .es-modalinfo p { margin: 0 0 8px; }
#ekko-skills .es-modalinfo p:last-child { margin-bottom: 0; }

#ekko-skills .es-modaltext {
  width: 100%;
  height: 40vh;
  min-height: 200px;
  padding: 12px 14px;
  border: 1px solid var(--es-strong);
  border-radius: var(--es-radius-sm);
  background: var(--bg-card, #fff);
  color: var(--text-primary, #1a1a1a);
  font-family: var(--font-code, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
  outline: none;
}
#ekko-skills .es-modaltext:focus { border-color: var(--accent-primary, #233176); }
#ekko-skills .es-modalinput {
  width: 100%;
  height: 34px;
  margin-top: 10px;
  padding: 0 12px;
  border: 1px solid var(--es-strong);
  border-radius: var(--es-radius-sm);
  background: var(--bg-card, #fff);
  color: var(--text-primary, #1a1a1a);
  font: inherit;
  font-size: 13px;
  outline: none;
}
#ekko-skills .es-modalinput:focus { border-color: var(--accent-primary, #233176); }

#ekko-skills .es-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  line-height: 1.6;
  cursor: pointer;
}
#ekko-skills .es-check input { margin-top: 3px; accent-color: var(--accent-primary, #233176); }

#ekko-skills .es-viewer {
  margin: 0;
  padding: 12px 14px;
  border-radius: var(--es-radius-sm);
  background: var(--es-secondary);
  font-family: var(--font-code, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 60vh;
  overflow: auto;
}

#ekko-skills .es-modalfoot {
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--es-line);
}

/* ───────────────────────────  提示条  ─────────────────────────── */

#ekko-skills .es-toast {
  position: absolute;
  left: 50%;
  bottom: 32px;
  transform: translate(-50%, 8px);
  max-width: min(560px, 88vw);
  padding: 10px 18px;
  border-radius: var(--es-radius);
  background: var(--text-primary, #1a1a1a);
  color: var(--bg-primary, #fff);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  z-index: 11;
}
#ekko-skills .es-toast.on { opacity: 1; transform: translate(-50%, 0); }
#ekko-skills .es-toast.bad { background: var(--es-danger); color: #fff; }

/* ───────────────────────────  窄屏  ─────────────────────────── */

@media (max-width: 820px) {
  #ekko-skills .es-top {
    min-height: 56px;
    gap: 6px;
    padding: 10px 12px;
  }
  #ekko-skills .es-sidebtn { display: inline-flex; }
  #ekko-skills .es-crumb b { font-size: 15px; }
  #ekko-skills .es-crumb span { display: none; }
  /* 进详情后把页签腾出来给「保存 / 转换」按钮 */
  #ekko-skills.in-detail .es-tabs { display: none; }
  #ekko-skills .es-actions { gap: 6px; }
  #ekko-skills .es-btn { height: 32px; padding: 0 11px; font-size: 12px; }
  /* 按钮里可省的几个字（如「复制[到 Agent]」）：窄屏只留动词，把宽度让给技能名 */
  #ekko-skills .es-wide { display: none; }
  /* 返回列表改由左上角返回箭头承担 */
  #ekko-skills .es-toList { display: none; }

  /* 抽屉：官方移动端 sidebar 用卡片底色 + 2px 阴影 */
  #ekko-skills .es-side {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 5;
    width: min(84vw, 300px);
    background: var(--bg-card, #fff);
    transform: translateX(-100%);
    transition: transform 0.18s ease;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.12);
  }
  #ekko-skills.side-open .es-side { transform: none; }
  #ekko-skills.side-open .es-sidebtn { background: var(--es-active); }

  /* 遮罩用伪元素：点它时 ev.target 正好是 root，JS 里现成的收起逻辑就能用 */
  #ekko-skills.side-open::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 4;
    background: rgba(0, 0, 0, 0.32);
  }

  #ekko-skills .es-toolbar { padding: 12px 12px 10px; }
  #ekko-skills .es-list {
    padding: 0 12px 92px;
    grid-template-columns: 1fr;
    gap: 10px;
  }
  #ekko-skills .es-detail { padding: 12px 12px 12px; }
  #ekko-skills .es-doctitle { font-size: 16px; }
  #ekko-skills .es-docmeta { display: none; }
  #ekko-skills .es-editor { min-height: 140px; font-size: 13px; }
  #ekko-skills .es-versions { top: 12px; right: 12px; }
  #ekko-skills .es-proposals { padding: 12px 12px 92px; }
  #ekko-skills .es-toast { bottom: 84px; }
  #ekko-skills .es-grantshead { padding: 10px 12px; }
  #ekko-skills .es-chips { padding: 10px 12px 0; }
  #ekko-skills .es-grantshint { padding: 8px 12px 10px; }
}

@media (prefers-reduced-motion: reduce) {
  #ekko-skills .es-modalbox { animation: none; }
  #ekko-skills .es-side { transition: none; }
}
