/* 开放能力 OPC 面板层（opc.js 配套）——苹果风 + 动效（2026-10-29 重做）
   红线：① 只用 console.css 既有变量，两套主题自动成立，不写死单主题色值；
        ② 品牌蓝（--brand / --brand-2）只上可交互件（按钮 / 链接 / hover / focus），不做装饰底；
           装饰与数据图形走中性灰（--panel-3 / --muted-2），两蓝不互串；
        ③ 类名一律 .opc- 前缀，不串味其它面板；动效纯 CSS + 原生 JS，零第三方库；
        ④ prefers-reduced-motion: reduce 全部降级为静态终态（文件末尾统一降级块）。 */

/* ---------------- 排版（大标题紧行距 / 正文行高 1.7 / 间距慷慨） ---------------- */
.opc-page {
  display: flex; flex-direction: column; gap: 18px;
  line-height: 1.7;
}
.opc-page > .panel { margin-bottom: 0; }
.opc-page .panel-hd h3 { letter-spacing: -0.02em; font-size: 16px; font-weight: 680; }
.opc-page .panel-hd .sub { line-height: 1.7; }
.opc-page .opc-cap-t { letter-spacing: -0.02em; font-size: 14px; font-weight: 680; }
.opc-page .hint, .opc-page .sub2 { line-height: 1.7; }

/* ---------------- 卡片（大圆角 18px / 弱边框 / 多层柔和阴影 / 悬停微抬） ---------------- */
.opc-page .panel {
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06);
  transition: transform .28s cubic-bezier(0.32, 0.72, 0, 1), box-shadow .28s cubic-bezier(0.32, 0.72, 0, 1);
}
.opc-page .panel:hover {
  transform: translateY(-2px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06), 0 18px 44px rgba(0, 0, 0, 0.12);
}
/* 表头 / 面板头：毛玻璃（backdrop-filter 支持才上半透明，@supports 兜底吃纯色） */
.opc-page .panel-hd {
  position: sticky; top: 0; z-index: 2;
  background: var(--panel);
  transition: background .2s ease;
}
@supports ((backdrop-filter: blur(20px) saturate(180%)) or (-webkit-backdrop-filter: blur(20px) saturate(180%))) {
  .opc-page .panel-hd {
    background: var(--panel); /* 兜底：color-mix 不支持时保持纯色 */
    background: color-mix(in srgb, var(--panel) 72%, transparent);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    backdrop-filter: blur(20px) saturate(180%);
  }
}

/* 接入提示三卡 */
.opc-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.opc-cap {
  display: flex; flex-direction: column; gap: 7px;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 16px; padding: 16px 18px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06);
  transition: transform .28s cubic-bezier(0.32, 0.72, 0, 1), box-shadow .28s cubic-bezier(0.32, 0.72, 0, 1);
}
.opc-cap:hover {
  transform: translateY(-2px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06), 0 18px 44px rgba(0, 0, 0, 0.12);
}
.opc-cap-p {
  display: block; background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 6px 10px; font-size: 11.5px;
  word-break: break-all;
}
.opc-cap-n { margin-top: 3px; }

/* ---------------- 一次性明文（secret / key）：出场仪式感 —— 顶部细渐变条 + 轻微发光 + 显影 ---------------- */
.opc-once {
  position: relative; overflow: hidden;
  border: 1px solid rgba(210, 153, 34, 0.45); /* 兜底（不支持 color-mix 时） */
  border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent);
  border-left: 3px solid var(--warn);
  background: rgba(210, 153, 34, 0.10);
  background: color-mix(in srgb, var(--warn) 10%, transparent);
  border-radius: 18px;
  padding: 15px 18px;
  margin: 0 0 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06);
}
/* 顶部细渐变条（“只此一次”视觉仪式） */
.opc-once::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg,
    transparent 0%,
    var(--warn) 50%,
    transparent 100%);
  background: linear-gradient(90deg,
    transparent 0%,
    color-mix(in srgb, var(--warn) 70%, transparent) 22%,
    color-mix(in srgb, var(--warn) 92%, transparent) 50%,
    color-mix(in srgb, var(--warn) 70%, transparent) 78%,
    transparent 100%);
  opacity: .9;
}
.opc-once-h { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.opc-once-h b { color: var(--warn); font-size: 13.5px; letter-spacing: -0.01em; }
.opc-once-v { display: flex; align-items: center; gap: 10px; margin: 10px 0 8px; flex-wrap: wrap; }
.opc-once-v code {
  flex: 1 1 260px; min-width: 0; word-break: break-all;
  background: var(--panel-2); border: 1px solid var(--line-2);
  border-radius: 12px; padding: 10px 12px; font-size: 12.5px;
}
/* 高亮淡入：已由 [data-anim] 显影接管（500ms），这里只补一次柔和发光呼吸 */
@keyframes opcOnceGlow {
  0% { box-shadow: 0 0 0 color-mix(in srgb, var(--warn) 0%, transparent); }
  45% { box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06),
    0 0 34px color-mix(in srgb, var(--warn) 34%, transparent); }
  100% { box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06),
    0 0 24px color-mix(in srgb, var(--warn) 22%, transparent); }
}
.opc-once.is-in { animation: opcOnceGlow 1.1s cubic-bezier(0.32, 0.72, 0, 1) .25s 1 both; }

/* ---------------- 入场显影（JS 加 .opc-anim 起始态 → 进视口加 .is-in） ----------------
   opacity 0→1 + translateY(12px→0)，500ms cubic-bezier(0.32, 0.72, 0, 1)，同级错峰 --i * 50ms。
   起始态挂在 .opc-anim（JS 同任务内加类，先于绘制）；JS 未跑时 [data-anim] 保持可见，不白屏。 */
.opc-anim {
  opacity: 0;
  transform: translateY(12px);
  transition:
    opacity .5s cubic-bezier(0.32, 0.72, 0, 1),
    transform .5s cubic-bezier(0.32, 0.72, 0, 1);
  transition-delay: calc(var(--i, 0) * 50ms);
}
.opc-anim.is-in { opacity: 1; transform: none; }
/* 行淡出（通过 / 驳回后换场，别硬切）——必须压过 .opc-anim.is-in 的终态 */
.opc-fade-out, .opc-anim.opc-fade-out, .opc-anim.is-in.opc-fade-out {
  opacity: 0 !important;
  transform: translateX(-6px) !important;
  transition: opacity .22s ease, transform .22s ease !important;
  transition-delay: 0s !important;
}

/* ---------------- 按钮（hover 抬起 + 阴影；active scale(.97) 按下反馈） ---------------- */
.opc-page .btn, .opc-modal .btn {
  border-radius: 11px;
  transition:
    transform .18s cubic-bezier(0.32, 0.72, 0, 1),
    box-shadow .18s cubic-bezier(0.32, 0.72, 0, 1),
    background .12s ease, border-color .12s ease, color .12s ease;
}
.opc-page .btn:hover, .opc-modal .btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06), 0 10px 24px rgba(0, 0, 0, 0.10);
}
.opc-page .btn:active, .opc-modal .btn:active {
  transform: scale(0.97);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* ---------------- 审核台：行卡 + 浮层（通过发额度 / 驳回必写原因） ---------------- */
.opc-rev-name { font-weight: 650; letter-spacing: -0.01em; }
/* 浮层遮罩 + 毛玻璃（@supports 兜底：无 blur 时纯 --bg 半透明） */
.opc-modal {
  position: fixed; inset: 0; z-index: 80;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.opc-modal::before {
  content: ''; position: absolute; inset: 0;
  background: var(--bg); opacity: .52;
}
@supports ((backdrop-filter: blur(20px) saturate(180%)) or (-webkit-backdrop-filter: blur(20px) saturate(180%))) {
  .opc-modal::before {
    opacity: .30;
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    backdrop-filter: blur(20px) saturate(180%);
  }
}
.opc-modal-card {
  position: relative;
  width: min(440px, calc(100vw - 32px));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px 20px 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06), 0 28px 64px rgba(0, 0, 0, 0.18);
  max-height: calc(100vh - 48px);
  overflow: auto;
}
/* 2026-11-08：弹窗卡片保持不透明底——此前半透明 + 背景模糊，在不合成 backdrop-filter 的
   环境（部分内嵌浏览器/旧内核）里会「透出页面文字」，看起来像没加载样式。 */
.opc-modal-card {
  background: var(--panel);
}
@keyframes opcModalIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.opc-modal.is-in .opc-modal-card { animation: opcModalIn .32s cubic-bezier(0.32, 0.72, 0, 1) both; }
.opc-modal-h {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  margin-bottom: 12px;
}
.opc-modal-h b { font-size: 15px; letter-spacing: -0.02em; }
.opc-modal-b .fld { margin-bottom: 12px; }
.opc-modal-b .fld input, .opc-modal-b .fld textarea {
  width: 100%; padding: 9px 12px;
  background: var(--bg-2); color: var(--text);
  border: 1px solid var(--line-2); border-radius: 11px;
  font-family: inherit; font-size: 13.5px;
}
.opc-modal-b .fld input:focus, .opc-modal-b .fld textarea:focus {
  outline: none; border-color: var(--brand);
}
.opc-modal-f {
  display: flex; justify-content: flex-end; gap: 8px;
  margin-top: 14px;
}
.opc-modal-f .btn:disabled {
  opacity: .45; cursor: not-allowed; transform: none; box-shadow: none;
}

/* ---------------- 应用详情键值表 ---------------- */
.opc-kv { display: flex; flex-direction: column; }
.opc-kv-r {
  display: flex; align-items: baseline; gap: 14px;
  padding: 10px 0; border-bottom: 1px dashed var(--line);
}
.opc-kv-r:last-child { border-bottom: none; }
.opc-kv-k { flex: 0 0 168px; color: var(--muted); font-size: 12.5px; }
.opc-kv-v { flex: 1; min-width: 0; font-size: 13.5px; word-break: break-all; }
.opc-num { font-variant-numeric: tabular-nums; }

.opc-key { word-break: break-all; }
.opc-key + .btn { margin-left: 8px; }

/* ---------------- 用量柱图（中性灰数据图形；蓝只留可交互件） ---------------- */
.opc-chart { display: flex; flex-direction: column; gap: 10px; }
.opc-bars {
  display: flex; align-items: flex-end; gap: 6px;
  height: 148px; padding: 8px 2px 0; border-bottom: 1px solid var(--line);
}
.opc-bar {
  flex: 1 1 0; min-width: 0; height: 100%;
  display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; gap: 4px;
}
.opc-bar-f {
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, var(--muted-2), var(--panel-3));
  min-height: 0;
  transition: height .5s cubic-bezier(0.32, 0.72, 0, 1);
}
.opc-bar:hover .opc-bar-f { background: linear-gradient(180deg, var(--muted), var(--muted-2)); }
.opc-bar-x {
  font-size: 10px; color: var(--muted-2); text-align: center;
  overflow: hidden; text-overflow: clip; white-space: nowrap;
}

/* 表格小屏不横向溢出：只在自己的包装里滚 */
.opc-tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 0 0 18px 18px; }
.opc-tbl-wrap .tbl th, .opc-tbl-wrap .tbl td { white-space: nowrap; }
.opc-tbl-wrap .tbl td:first-child, .opc-tbl-wrap .tbl td:nth-child(2) { white-space: normal; }

/* ---------------- 发布文件编辑器 ---------------- */
.opc-file-row {
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--bg-2); padding: 12px; margin-bottom: 12px;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.opc-file-row:focus-within {
  border-color: var(--line-2);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06);
}
.opc-file-top { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.opc-file-path {
  flex: 1; min-width: 0; height: 34px; padding: 0 12px;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--line-2); border-radius: 10px; font-size: 12.5px;
}
.opc-file-path:focus, .opc-file-text:focus, .opc-json:focus {
  outline: none; border-color: var(--brand);
}
.opc-file-text, .opc-json {
  width: 100%; padding: 9px 12px; resize: vertical;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--line-2); border-radius: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; line-height: 1.6;
}
.opc-json { margin-top: 6px; }

/* ---------------- 用量按能力分项 ---------------- */
.opc-ep-break { margin-top: 14px; }
.opc-ep-row {
  display: flex; align-items: center; gap: 10px; margin-top: 7px;
}
.opc-ep-name { flex: 0 0 120px; font-size: 12.5px; color: var(--text); }
.opc-ep-bar {
  flex: 1; height: 8px; background: var(--bg-2); border-radius: 999px; overflow: hidden;
}
.opc-ep-fill {
  height: 100%; background: var(--muted-2); border-radius: 999px; min-width: 2px;
  transition: width .5s cubic-bezier(0.32, 0.72, 0, 1);
}

/* ---------------- 我的应用（2026-11-09 温和人文） ---------------- */
.opc-page .ma-welcome {
  margin: 0 18px 16px;
  padding: 10px 14px;
  border-left: 2px solid color-mix(in srgb, var(--brand) 58%, transparent);
  border-radius: 0 10px 10px 0;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.75;
}
.opc-page .ma-journey-wrap { padding-bottom: 0; }
.opc-page .ma-journey {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 5%, var(--panel)), var(--panel));
}
.opc-page .ma-journey-k {
  display: block;
  margin-bottom: 5px;
  color: var(--brand-2);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .06em;
}
.opc-page .ma-journey b { display: block; font-size: 14px; font-weight: 650; }
.opc-page .ma-journey p { margin: 5px 0 0; color: var(--muted); font-size: 12.5px; line-height: 1.75; }
.opc-page .ma-journey .btn { margin-top: 10px; }
.opc-page .ma-status-note-wrap { padding-top: 10px; padding-bottom: 0; }
.opc-page .ma-status-note {
  padding: 10px 14px;
  border: 1px solid color-mix(in srgb, var(--warn) 44%, var(--line));
  border-left: 3px solid var(--warn);
  border-radius: 10px;
  background: color-mix(in srgb, var(--warn) 7%, var(--panel));
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.75;
}
.opc-page .ma-next-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.opc-page .ma-metric-grid,
.opc-page .ma-visit-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 0 0 16px; }
.opc-page .ma-quiet-card { padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); }
.opc-page .ma-quiet-value { margin-top: 4px; font-size: 17px; font-variant-numeric: tabular-nums; }
.opc-page .ma-detail-fold { margin: 0 0 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.opc-page .ma-detail-fold > summary {
  cursor: pointer;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.8;
}
.opc-page .ma-detail-fold > summary::marker { color: var(--brand-2); }
.opc-page .ma-detail-body { padding: 12px 0 4px; }
.opc-page .ma-section-title { margin: 8px 0 10px; font-size: 13px; font-weight: 600; color: var(--muted); }
.opc-page .ma-detail-foot { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.opc-page .ma-domain-head { display: flex; align-items: flex-start; gap: 12px; margin: 0 0 14px; }
.opc-page .ma-domain-head .ma-journey { flex: 1; min-width: 0; }
.opc-page .ma-domain-head .ma-journey b { overflow-wrap: anywhere; }
@media (max-width: 720px) {
  .opc-page { gap: 14px; }
  .opc-cards { grid-template-columns: 1fr; }
  .opc-kv-r { flex-direction: column; gap: 3px; }
  .opc-kv-k { flex: none; }
  .opc-bars { height: 118px; gap: 3px; }
  .opc-bar-x { display: none; }
  .opc-once-v code { flex-basis: 100%; }
  .opc-ep-name { flex-basis: 90px; font-size: 11.5px; }
  .opc-modal { padding: 12px; }
  .opc-modal-card { padding: 16px 14px 14px; }
  .opc-page .ma-domain-head { flex-direction: column; }
}

/* ---------------- 快速导入：选文件 / 选文件夹 / ZIP（口径见 opc-import.js） ---------------- */
.opc-pick-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 2px 0 10px; }
.opc-pick-row .btn { cursor: pointer; }
.opc-pick-row input[type="file"] { display: none; }

.opc-import-report { margin-top: 10px; font-size: 12.5px; line-height: 1.6; }
.opc-import-head { color: var(--muted); }
.opc-import-err {
  color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 34%, transparent);
  border-radius: 10px; padding: 8px 11px; margin-bottom: 8px;
}
.opc-import-warn {
  margin: 8px 0 0; padding: 8px 11px 8px 26px; list-style: disc;
  color: var(--warn); background: color-mix(in srgb, var(--warn) 9%, transparent);
  border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); border-radius: 10px;
}
.opc-import-excl {
  margin-top: 10px; padding: 10px 12px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px;
}
.opc-import-excl-t { color: var(--text); margin-bottom: 6px; }
.opc-import-excl-list { margin: 0; padding: 0; list-style: none; max-height: 240px; overflow: auto; }
.opc-import-excl-list li {
  display: flex; gap: 10px; align-items: baseline; justify-content: space-between;
  padding: 4px 0; border-top: 1px solid var(--line);
}
.opc-import-excl-list li:first-child { border-top: none; }
.opc-import-excl-list code { word-break: break-all; }
.opc-import-why { flex: 0 0 auto; color: var(--muted); font-size: 11.5px; }
.opc-import-ack {
  display: flex; align-items: center; gap: 8px; margin-top: 10px;
  padding-top: 9px; border-top: 1px dashed var(--line-2); cursor: pointer; color: var(--text);
}
.opc-import-ack input { width: 15px; height: 15px; accent-color: var(--brand); }

.opc-app-edit { margin-top: 16px; }
.opc-app-edit textarea {
  width: 100%; min-height: 76px; resize: vertical;
  font-family: var(--mono, monospace); font-size: 12.5px; line-height: 1.5;
  padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg-2); color: var(--text);
}

/* ---------------- prefers-reduced-motion：全部降级静态终态（站规硬要求） ---------------- */
@media (prefers-reduced-motion: reduce) {
  .opc-anim, .opc-anim.is-in {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
    animation: none !important;
  }
  .opc-once.is-in { animation: none !important; }
  .opc-once { box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06),
    0 0 24px color-mix(in srgb, var(--warn) 22%, transparent); }
  .opc-fade-out { transition: none !important; }
  .opc-page .panel, .opc-cap { transition: none !important; }
  .opc-page .panel:hover, .opc-cap:hover { transform: none !important; }
  .opc-page .btn, .opc-modal .btn { transition: background .12s ease, border-color .12s ease, color .12s ease !important; }
  .opc-page .btn:hover, .opc-modal .btn:hover,
  .opc-page .btn:active, .opc-modal .btn:active {
    transform: none !important;
    box-shadow: none !important;
  }
  .opc-modal.is-in .opc-modal-card { animation: none !important; }
  .opc-bar-f, .opc-ep-fill { transition: none !important; }
}
