/* ============================================================
   顶部菜单 · 统一样式（全站唯一一份）
   由 App.vue（电商生成/设置）与 canvas.html（工作流画布 iframe）共用。
   颜色全部走主题变量 --tbar-bg/--tbar-fg/--tbar-sub/--tbar-line + 强调色 --blue/--blue-soft，
   由 theme.ts 的 6 套主题在 :root 上设置。fallback 为浅色 —— 画布 iframe 无主题变量，自动浅色顶栏。
   改样式只改这一个文件。
   ============================================================ */
.tbar {
    display: flex; align-items: center; gap: 10px;
    height: 56px; padding: 0 20px;
    /* 毛玻璃悬浮：半透明底 + 背景模糊 + 顶部内高光营造玻璃厚度，硬分割线换成明显悬浮阴影 */
    background: var(--tbar-bg, #ffffff);
    background: color-mix(in srgb, var(--tbar-bg, #ffffff) 78%, transparent);
    -webkit-backdrop-filter: blur(18px) saturate(1.6);
    backdrop-filter: blur(18px) saturate(1.6);
    color: var(--tbar-fg, #1c1d24);
    border-bottom: 1px solid color-mix(in srgb, var(--tbar-fg, #1c1d24) 7%, transparent);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28), 0 6px 22px -10px rgba(0, 0, 0, .18);
    /* backdrop-filter 会让本元素成层叠上下文：必须给 z-index，否则下拉被靠后的主内容盖住 */
    position: relative; z-index: 100;
    /* 桌面必须 visible：overflow-x:auto 会连带把 overflow-y 变 auto，裁掉「创作/工作流」下拉；≤768 由媒体查询恢复横滑兜底 */
    flex-wrap: nowrap; overflow: visible;
    font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
    transition: background .25s, color .25s, border-color .25s;
}
.tbar::-webkit-scrollbar { height: 0; }

.tbar-logo { width: 28px; height: 28px; border-radius: 8px; object-fit: contain; flex-shrink: 0; box-shadow: 0 2px 10px -2px rgba(0, 0, 0, .22); }
.tbar-brand { font-size: 15.5px; font-weight: 650; letter-spacing: .3px; white-space: nowrap; flex-shrink: 0; color: inherit; }
/* logo/品牌名可点击回首页（仅 App.vue 挂了 @click 的元素加此类；画布页标签不加） */
.tbar-home { cursor: pointer; transition: opacity .15s; }
.tbar-home:hover { opacity: .8; }

.tbar-nav { display: flex; align-items: center; gap: 4px; flex-shrink: 0; margin-left: 10px; }
.tbar-nav a {
    display: flex; align-items: center; gap: 5px;
    color: var(--tbar-sub, #5b6070); text-decoration: none; font-size: 13.5px; font-weight: 500; line-height: 1;
    padding: 8px 13px; border-radius: 9px; white-space: nowrap; cursor: pointer;
    transition: background .18s cubic-bezier(.22, .61, .36, 1), color .18s;
}
/* 顶级导航项：hover=中性淡底（不再撞蓝），当前页=强调色文字 + 短下划线指示条，一眼可辨 */
.tbar-nav > a, .tbar-drop > a { position: relative; }
.tbar-nav > a:hover, .tbar-drop > a:hover { color: var(--tbar-fg, #1c1d24); background: color-mix(in srgb, var(--tbar-fg, #1c1d24) 6%, transparent); }
.tbar-nav > a.active, .tbar-drop > a.active { color: var(--blue, #2f7bff); font-weight: 600; background: var(--blue-soft, rgba(47, 123, 255, .12)); }
.tbar-nav > a.active::after, .tbar-drop > a.active::after {
    content: ''; position: absolute; left: 50%; transform: translateX(-50%); bottom: 1px;
    width: 16px; height: 2px; border-radius: 2px; background: var(--blue, #2f7bff);
    box-shadow: 0 0 8px color-mix(in srgb, var(--blue, #2f7bff) 55%, transparent);
}

/* 「管理」下拉（管理员后台入口收纳）：桌面 hover/键盘展开；≤1024 汉堡模式摊平成普通链接 */
.tbar-drop { position: relative; }
.tbar-drop > a .tb-caret { font-size: 9px; margin-left: 3px; opacity: .7; transition: transform .15s; }
.tbar-drop:hover > a .tb-caret { transform: rotate(180deg); }
.tbar-drop::after { content: ''; position: absolute; top: 100%; left: 0; right: 0; height: 8px; }  /* hover 桥，防移动到菜单途中断开 */
.tbar-drop-menu { display: none; position: absolute; top: calc(100% + 8px); left: 0; min-width: 138px;
    flex-direction: column; gap: 2px; padding: 8px;
    background: var(--tbar-bg, #fff);
    background: color-mix(in srgb, var(--tbar-bg, #fff) 88%, transparent);
    -webkit-backdrop-filter: blur(18px) saturate(1.5); backdrop-filter: blur(18px) saturate(1.5);
    border: 1px solid color-mix(in srgb, var(--tbar-fg, #1c1d24) 8%, transparent);
    border-radius: 14px; box-shadow: 0 20px 46px -22px rgba(0,0,0,.42), 0 2px 8px rgba(0,0,0,.05); z-index: 70; }
.tbar-drop:hover .tbar-drop-menu, .tbar-drop:focus-within .tbar-drop-menu { display: flex; }
.tbar-drop-menu a { padding: 9px 12px; }

/* ===== 「创作」mega 下拉：封面缩略图 + 标题 + 一句话说明（更方便选、更高级） ===== */
.tbar-mega { min-width: 296px; padding: 8px; gap: 4px; }
.tbar-drop:hover .tbar-mega, .tbar-drop:focus-within .tbar-mega { animation: tbar-mega-in .17s ease both; }
@keyframes tbar-mega-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.tbar-nav .tbar-mega-item { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 12px; }
.tbar-nav .tbar-mega-item:hover { background: var(--blue-soft, rgba(47,123,255,.10)); }
.tbar-nav .tbar-mega-item.active { background: var(--blue-soft, rgba(47,123,255,.12)); }
.tbar-mega-cover { position: relative; flex-shrink: 0; width: 54px; height: 54px; border-radius: 11px; display: grid; place-items: center; overflow: hidden;
    background: linear-gradient(135deg, var(--c1, #2f7bff), var(--c2, #21b8ff));
    box-shadow: 0 5px 14px color-mix(in srgb, var(--c2, #21b8ff) 38%, transparent); }
.tbar-mega-cover svg { width: 26px; height: 26px; color: #fff; }
.tbar-mega-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.tbar-mega-txt { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.tbar-mega-txt b { display: flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 600; color: var(--tbar-fg, #1c1d24); }
.tbar-mega-txt small { font-size: 11.5px; color: var(--tbar-sub, #8a90a0); line-height: 1.4; white-space: nowrap; }
.tbar-mega-item:hover .tbar-mega-txt b { color: var(--blue, #2f7bff); }
.tbar-mega-cur { font-size: 10px; font-weight: 600; color: var(--blue, #2f7bff); background: var(--blue-soft, rgba(47,123,255,.16)); padding: 1px 7px; border-radius: 999px; }

.tbar-sp { flex: 1; min-width: 8px; }

.tbar-right { display: flex; align-items: center; gap: 10px; white-space: nowrap; flex-shrink: 0; }
/* 统一胶囊族：同高 34、中性淡底 + 细描边，强调色只点在钻石/头像/登录主按钮上 */
.tbar-points {
    display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 13px;
    background: color-mix(in srgb, var(--tbar-fg, #1c1d24) 8%, transparent);
    border: 1px solid var(--tbar-line, #e6e9ef); color: var(--tbar-fg, #1c1d24);
    border-radius: 999px; font-size: 13px; font-weight: 600; cursor: pointer;
    transition: transform .14s cubic-bezier(.22, .61, .36, 1), box-shadow .14s, border-color .14s;
}
.tbar-points .tp-dia { color: var(--blue, #2f7bff); font-weight: 700; }
.tbar-points:hover { transform: translateY(-1px); border-color: color-mix(in srgb, var(--blue, #2f7bff) 45%, var(--tbar-line, #e6e9ef)); box-shadow: 0 7px 18px -9px rgba(0, 0, 0, .3); }
.tbar-user {
    display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 11px 0 5px;
    background: color-mix(in srgb, var(--tbar-fg, #1c1d24) 8%, transparent);
    border: 1px solid var(--tbar-line, #e6e9ef); border-radius: 999px;
    color: var(--tbar-fg, #1c1d24); cursor: pointer; font-size: 13.5px; outline: none;
    transition: transform .14s cubic-bezier(.22, .61, .36, 1), box-shadow .14s;
}
.tbar-user:hover { transform: translateY(-1px); box-shadow: 0 7px 18px -9px rgba(0, 0, 0, .3); }
.tbar-ava { width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center;
    color: #fff; font-size: 12px; font-weight: 700; text-transform: uppercase;
    background: linear-gradient(135deg, var(--blue, #2f7bff), color-mix(in srgb, var(--blue, #2f7bff) 55%, #a78bfa)); }
.tbar-uname { max-width: 8em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-style: normal; }
.tbar-login {
    display: inline-flex; align-items: center; height: 34px; padding: 0 18px; border-radius: 999px;
    font-weight: 600; font-size: 13.5px; color: #fff; background: var(--blue, #2f7bff); cursor: pointer;
    transition: transform .14s cubic-bezier(.22, .61, .36, 1), box-shadow .14s, filter .14s;
}
.tbar-login:hover { transform: translateY(-1px); filter: brightness(1.04); box-shadow: 0 9px 20px -9px color-mix(in srgb, var(--blue, #2f7bff) 70%, transparent); }
.tbar-points:active, .tbar-user:active, .tbar-login:active, .tbar-themebtn:active { transform: translateY(0) scale(.97); }

/* 主题按钮：点开弹出主题配色面板 */
.tbar-themebtn {
    position: relative; width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
    display: inline-grid; place-items: center; cursor: pointer; font-size: 15px;
    background: color-mix(in srgb, var(--tbar-fg, #1c1d24) 8%, transparent);
    border: 1px solid var(--tbar-line, #e6e9ef); color: var(--tbar-fg, #1c1d24);
    transition: transform .14s cubic-bezier(.22, .61, .36, 1), box-shadow .14s, border-color .14s;
}
.tbar-themebtn:hover { transform: translateY(-1px); box-shadow: 0 7px 18px -9px rgba(0, 0, 0, .3); }
.tbar-themebtn .tb-ico { display: block; }
.tbar-themebtn .tb-cur { position: absolute; bottom: -2px; right: -2px; width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--tbar-bg, #fff); }

/* 弹出面板（el-popover 在 body 级，靠 popper-class 命中） */
.tbar-theme-pop { padding: 14px 14px 12px !important; border-radius: 14px !important; }
.tbar-theme-pop .tp-title { font-size: 13px; font-weight: 600; color: var(--el-text-color-primary, #1c1d24); margin-bottom: 10px; }
.tbar-theme-pop .tp-swatches { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.tbar-theme-pop .tp-sw {
    position: relative; width: 26px; height: 26px; border-radius: 50%; padding: 0; justify-self: center;
    border: none; cursor: pointer; background: var(--sw); display: inline-grid; place-items: center;
    box-shadow: 0 1px 3px rgba(0,0,0,.18); transition: transform .14s, box-shadow .14s;
}
.tbar-theme-pop .tp-sw:hover { transform: scale(1.14); }
.tbar-theme-pop .tp-sw .tp-moon { font-size: 13px; color: #fff; opacity: .92; }
.tbar-theme-pop .tp-sw.on { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--sw), 0 1px 3px rgba(0,0,0,.2); }

.tbar-theme-pop .tp-custom { display: flex; align-items: center; gap: 9px; margin-top: 13px; padding-top: 12px; border-top: 1px solid var(--el-border-color-lighter, #eee); }
.tbar-theme-pop .tp-sw.cu { width: 22px; height: 22px; cursor: default; flex-shrink: 0; }
.tbar-theme-pop .tp-clabel { flex: 1; font-size: 13px; color: var(--el-text-color-regular, #5b6070); }

/* 工作流画布顶栏内嵌的控件（仅 /flows 有） */
.tbar .hsel, .tbar .hname, .tbar button { flex-shrink: 0; }
.tbar .t-status { font-size: 12px; color: var(--tbar-sub, #86909c); flex-shrink: 0; }
.tbar .t-cost {
    font-size: 12px; color: #d4690e; font-weight: 600;
    background: rgba(212,105,14,.10); border: 1px solid rgba(212,105,14,.25);
    border-radius: 6px; padding: 3px 9px; flex-shrink: 0;
}

/* ============================================================
   响应式：汉堡菜单（桌面零影响，仅 ≤860px 生效）
   ============================================================ */
/* 汉堡按钮：桌面隐藏 */
.tbar-burger { display: none; flex-shrink: 0; width: 36px; height: 36px; padding: 0;
    background: transparent; border: 1px solid var(--tbar-line, #e6e9ef); border-radius: 9px;
    cursor: pointer; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.tbar-burger span { display: block; width: 18px; height: 2px; border-radius: 2px;
    background: var(--tbar-fg, #1c1d24); transition: transform .2s, opacity .2s; }
.tbar-burger.on span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.tbar-burger.on span:nth-child(2) { opacity: 0; }
.tbar-burger.on span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
.tbar-mask { display: none; }

@media (max-width: 1024px) {
    /* 导航收进汉堡（管理员有5项导航，中宽屏会把右侧控件挤出，故提前到 1024 折叠）*/
    /* 汉堡态：backdrop-filter 会把 position:fixed 的下拉导航"关进"顶栏盒子，故窄屏取消模糊、回不透明底 */
    .tbar { overflow: visible; position: relative; z-index: auto; gap: 8px; padding: 0 12px;
        background: var(--tbar-bg, #fff); -webkit-backdrop-filter: none; backdrop-filter: none;
        box-shadow: 0 6px 20px -16px rgba(0, 0, 0, .3); }
    /* 竖列里下划线指示不合适，当前页改用淡强调胶囊底 */
    .tbar-nav > a.active::after, .tbar-drop > a.active::after { display: none; }
    .tbar-nav > a.active, .tbar-drop > a.active { background: var(--blue-soft, rgba(47, 123, 255, .12)); }
    .tbar-brand { font-size: 15px; }
    .tbar-burger { display: flex; order: 5; margin-left: auto; }
    /* 导航 → 绝对定位下拉面板，默认隐藏 */
    .tbar-nav { position: absolute; top: 56px; left: 0; right: 0; flex-direction: column;
        align-items: stretch; gap: 2px; margin: 0; padding: 8px;
        background: var(--tbar-bg, #fff); border-bottom: 1px solid var(--tbar-line, #e6e9ef);
        box-shadow: 0 10px 30px rgba(0,0,0,.12); z-index: 60; display: none; }
    .tbar-nav.open { display: flex; }
    .tbar-nav a { padding: 11px 14px; font-size: 14px; border-radius: 8px; }
    /* 汉堡模式：下拉摊平为普通链接列表（按钮隐藏，子项直接入列，hover 桥一并禁用） */
    .tbar-drop { display: contents; }
    .tbar-drop > a { display: none; }
    .tbar-drop::after { content: none; }
    .tbar-drop-menu { display: contents; }
    /* spacer 在小屏不抢空间（汉堡已用 margin-left:auto 顶到右侧） */
    .tbar-sp { display: none; }
    .tbar-right { gap: 10px; margin-left: 0; }
    /* 遮罩：点击空白关闭菜单 */
    .tbar-mask { display: block; position: fixed; inset: 56px 0 0 0; z-index: 55; background: transparent; }

    /* mega 在汉堡里恢复层级：「创作」显为分组标题，子项缩进 + 左竖线，封面缩小 */
    .tbar-drop > a { display: flex; color: var(--tbar-sub, #8a90a0); font-size: 12px; font-weight: 600; padding: 8px 10px 4px; }
    .tbar-drop > a .tb-caret { display: none; }
    .tbar-mega { min-width: 0; padding: 0; gap: 2px; }
    .tbar-nav .tbar-mega-item { margin-left: 10px; padding: 7px 10px; border-left: 2px solid var(--tbar-line, #e6e9ef); border-radius: 0 8px 8px 0; }
    .tbar-mega-cover { width: 40px; height: 40px; border-radius: 9px; }
    .tbar-mega-cover svg { width: 21px; height: 21px; }
    .tbar-mega-txt small { white-space: normal; }
}

/* 手机（≤768px）：顶栏自身可横滑兜底，绝不把页面撑宽；下拉导航改 fixed 不受裁剪 */
@media (max-width: 768px) {
    .tbar { overflow-x: auto; }
    .tbar-nav { position: fixed; top: 56px; left: 0; right: 0; }
    .tbar-uname { max-width: 5em; }
}

/* 超小屏：整体压缩，确保汉堡按钮不被挤出屏幕（390px 实测原规则下 burger 溢出 34px） */
@media (max-width: 480px) {
    .tbar { padding: 0 8px; gap: 6px; }
    .tbar-brand { font-size: 13px; }
    .tbar-right { gap: 6px; }
    .tbar-points { display: none; }
    .tbar-user { width: 32px; height: 32px; padding: 3px; border-radius: 10px; }
    .tbar-uname, .tbar-user > .el-icon { display: none; }
    .tbar-themebtn { width: 30px; height: 30px; }
    .tbar-burger { width: 32px; height: 32px; }
}
