/* ============================================================================
   PICUI · 全站视觉统一层（design2.css · 2026-11-21）
   目标：把首页的设计语言（#070b11 画布 / 发丝边卡片 / 品牌蓝 #38bdf8）
        推广到所有页面；只做视觉，不动业务逻辑。整文件可删除回滚。
   加载顺序：必须在 theme3.css / design.css 之后。
   ========================================================================== */

/* ---------- 1. 画布与令牌 ---------- */
:root {
    --ds-bg: #f5f7fa;
    --ds-surface: #ffffff;
    --ds-surface-2: #f3f6fa;
    --ds-line: #e6ebf2;
    --ds-line-strong: #d7dfe9;
    --ds-ink: #0e1726;
    --ds-sub: #50617a;
    --ds-mut: #7d8da1;
    --ds-brand: #0284c7;
    --ds-brand-2: #38bdf8;
    --ds-on-brand: #ffffff;
    --ds-brand-soft: rgba(2, 132, 199, .10);
    --ds-ring: rgba(2, 132, 199, .18);
    --ds-ok: #0f9d76;
    --ds-warn: #b26a00;
    --ds-danger: #c0392b;
    --ds-r-sm: 10px;
    --ds-r: 14px;
    --ds-r-lg: 18px;
    --ds-sh: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .04);
    --ds-sh-pop: 0 18px 44px -20px rgba(11, 22, 38, .35);
}

html.dark {
    --ds-bg: #070b11;
    --ds-surface: #0f1926;
    --ds-surface-2: #0a121c;
    --ds-line: #1b2735;
    --ds-line-strong: #263649;
    --ds-ink: #e8eef6;
    --ds-sub: #9db0c4;
    --ds-mut: #74869a;
    --ds-brand: #38bdf8;
    --ds-brand-2: #7dd3fc;
    --ds-on-brand: #04121c;
    --ds-brand-soft: rgba(56, 189, 248, .13);
    --ds-ring: rgba(56, 189, 248, .22);
    --ds-ok: #34d399;
    --ds-warn: #e8b268;
    --ds-danger: #f08a76;
    --ds-sh: 0 1px 2px rgba(0, 0, 0, .35);
    --ds-sh-pop: 0 20px 48px -22px rgba(0, 0, 0, .75);
}

html, body { background: var(--ds-bg); }
html.dark body { background: var(--ds-bg) !important; color: var(--ds-ink); }
body.ud-canvas { background: var(--ds-bg) !important; }

/* 应用外壳：画布连续，消灭底部空带 */
.ud-scope { background: var(--ds-bg); }
.ud-page {
    --ud-canvas: var(--ds-bg);
    --ud-card: var(--ds-surface);
    --ud-soft: var(--ds-surface-2);
    --ud-ink: var(--ds-ink);
    --ud-sub: var(--ds-sub);
    --ud-mut: var(--ds-mut);
    --ud-line: var(--ds-line);
    --ud-line-strong: var(--ds-line-strong);
    --ud-accent: var(--ds-brand);
    --ud-accent-ink: var(--ds-brand-2);
    --ud-accent-soft: var(--ds-brand-soft);
    --ud-radius: var(--ds-r);
    --ud-radius-sm: var(--ds-r-sm);
}
.ud-page.h-full { background: var(--ds-bg) !important; }
.ud-wrap { max-width: 1180px; }

/* ---------- 2. 侧栏与顶栏 ---------- */
aside, .ud-sidebar { background: var(--ds-surface) !important; border-right: 1px solid var(--ds-line); }
html.dark aside, html.dark .ud-sidebar { background: #080e16 !important; border-right-color: var(--ds-line); }
.ud-brand { background: transparent !important; border-bottom: 1px solid var(--ds-line) !important; color: var(--ds-ink) !important; }
.ud-brand-logo {
    background: var(--ds-brand) !important;
    box-shadow: none !important;
    color: #fff !important;
    border-radius: 9px;
}
html.dark .ud-brand-logo { color: #04121c !important; }
.ud-brand-name { font-size: 14px !important; font-weight: 600 !important; letter-spacing: 0 !important; }
.ud-tabs { background: var(--ds-surface-2) !important; border: 1px solid var(--ds-line); }
.ud-tabs a { color: var(--ds-sub) !important; }
.ud-tabs a.ud-tab-active {
    background: var(--ds-brand) !important;
    color: var(--ds-on-brand) !important;
    font-weight: 500;
}
.ud-nav-item { color: var(--ds-sub) !important; border-radius: 9px; }
.ud-nav-item:hover { background: var(--ds-surface-2) !important; color: var(--ds-ink) !important; }
.ud-nav-item.ud-nav-active, .ud-nav-item.ud-nav-active:hover {
    background: var(--ds-brand-soft) !important; color: var(--ds-brand) !important;
}
.ud-nav-item i { color: var(--ds-mut) !important; }
.ud-nav-item.ud-nav-active i { color: var(--ds-brand) !important; }
.ud-nav-group { color: var(--ds-mut) !important; letter-spacing: .06em; }

.hd-bar,
html.dark .hd-bar,
html.dark .hd-bar.bg-white {
    background: color-mix(in srgb, var(--ds-bg) 88%, transparent) !important;
    border-bottom: 1px solid var(--ds-line) !important;
    backdrop-filter: saturate(1.4) blur(10px);
    -webkit-backdrop-filter: saturate(1.4) blur(10px);
}
.hd-btn { border-radius: var(--ds-r-sm); font-weight: 500; }
.hd-btn-primary { background: var(--ds-brand); color: var(--ds-on-brand); }
.hd-btn-primary:hover { background: var(--ds-brand-2); }
html.dark .hd-btn-primary { background: var(--ds-brand); color: var(--ds-on-brand); }
html.dark .hd-btn-primary:hover { background: var(--ds-brand-2); }
.hd-link { border-radius: 9px; }

/* ---------- 3. 卡片：单一层级，取消「所有卡片都悬浮」 ---------- */
.ud-card,
.ud-page :where(.shadow-custom) {
    background: var(--ds-surface);
    border: 1px solid var(--ds-line);
    border-radius: var(--ds-r);
    box-shadow: var(--ds-sh);
    overflow: hidden;
}
.ud-card:hover { transform: none; box-shadow: var(--ds-sh); border-color: var(--ds-line); }
a.ud-card:hover, .ud-card.is-interactive:hover {
    transform: translateY(-2px);
    border-color: var(--ds-line-strong);
    box-shadow: 0 6px 20px -14px rgba(0, 0, 0, .55);
}
.ud-card-head { padding: 14px 18px; border-bottom: 1px solid var(--ds-line); }
.ud-card-head h2 { font-size: 14px; letter-spacing: .01em; }

/* 统计卡数字统一等宽 */
.ud-stat, .ud-stat b, .ud-plan-num, table td, .num { font-variant-numeric: tabular-nums; }

/* ---------- 4. 按钮 ---------- */
.ud-btn { border-radius: var(--ds-r-sm); font-weight: 500; }
.ud-btn-primary {
    background: var(--ds-brand); color: var(--ds-on-brand);
    box-shadow: none;
}
.ud-btn-primary:hover { background: var(--ds-brand-2); color: var(--ds-on-brand); }
.ud-btn-ghost { background: transparent; border-color: var(--ds-line-strong); color: var(--ds-sub); }
.ud-btn-ghost:hover { background: var(--ds-surface-2); color: var(--ds-ink); border-color: var(--ds-line-strong); }
html.dark .ud-btn-primary { color: var(--ds-on-brand); }

/* ---------- 5. 表格 ---------- */
.ud-page table { width: 100%; font-size: 13px; }
.ud-page table thead th {
    padding: 10px 14px !important;
    font-size: 11.5px !important; font-weight: 600 !important;
    letter-spacing: .04em; white-space: nowrap;
    color: var(--ds-mut) !important;
    background: var(--ds-surface-2);
    border-bottom: 1px solid var(--ds-line) !important;
}
.ud-page table tbody td { padding: 11px 14px; border-bottom: 1px solid var(--ds-line); }
.ud-page table tbody tr:last-child td { border-bottom: 0; }
.ud-page table tbody tr:hover { background: var(--ds-brand-soft) !important; }
.ud-page table .ud-cell-wrap { line-height: 1.5; }

/* ---------- 6. 表单控件 ---------- */
.ud-page input[type=text], .ud-page input[type=email], .ud-page input[type=password],
.ud-page input[type=number], .ud-page input[type=search], .ud-page input[type=tel],
.ud-page input[type=url], .ud-page select, .ud-page textarea,
.ud-auth input[type=text], .ud-auth input[type=email], .ud-auth input[type=password] {
    background: var(--ds-surface-2);
    border: 1px solid var(--ds-line-strong);
    border-radius: var(--ds-r-sm);
    color: var(--ds-ink);
    min-height: 38px;
    padding: 8px 12px;
}
.ud-page input:focus, .ud-page select:focus, .ud-page textarea:focus,
.ud-auth input:focus {
    outline: none;
    border-color: var(--ds-brand);
    box-shadow: 0 0 0 3px var(--ds-ring);
}
.ud-auth label { font-size: 12.5px; font-weight: 500; color: var(--ds-sub); }

/* ---------- 7. 图库 / 相册 ---------- */
#objects-grid .item, .explore-card {
    border-radius: 12px;
    background: var(--ds-surface-2);
    box-shadow: none;
    border: 1px solid transparent;
}
#objects-grid .item:hover {
    transform: none;
    border-color: var(--ds-line-strong);
    box-shadow: 0 10px 26px -18px rgba(0, 0, 0, .7);
}
#objects-grid .item img { transition: transform .35s cubic-bezier(.2,.8,.2,1); }
#objects-grid .image-mask {
    opacity: 0; transition: opacity .18s ease;
    background: linear-gradient(180deg, rgba(4,10,18,0) 0%, rgba(4,10,18,.72) 55%, rgba(4,10,18,.92) 100%);
}
#objects-grid .item:hover .image-mask { opacity: 1; }
#objects-grid .filename { font-size: 12px; font-weight: 500; letter-spacing: .01em; }
#objects-grid .date { font-size: 11px; opacity: .7; }
#objects-grid .caption {
    font-size: 11.5px; line-height: 1.4; letter-spacing: .01em;
    padding: 20px 9px 7px;
    background: linear-gradient(180deg, rgba(4,10,18,0) 0%, rgba(4,10,18,.78) 62%, rgba(4,10,18,.9) 100%);
    opacity: 0; transition: opacity .18s ease;
}
#objects-grid .item:hover .caption { opacity: 1; }

/* ---------- 8. 工具栏 ---------- */
.ud-toolbar {
    display: flex; align-items: center; gap: 8px;
    background: var(--ds-surface) !important;
    border-bottom: 1px solid var(--ds-line) !important;
    padding: 8px 12px !important;
}
/* 不要给工具栏的直接子 div 强行 display:flex：下拉菜单的 relative 包裹层会因此变成满宽，
   绝对定位的菜单面板会被推到屏幕外（移动端「最新/全部」筛选菜单只剩半截就是这个原因） */
.ud-toolbar > div { min-width: 0; }
.ud-toolbar select, .ud-toolbar input[type=text], .ud-toolbar input[type=search] {
    height: 32px; min-height: 32px; padding: 4px 10px !important;
    font-size: 12.5px; border-radius: 8px !important;
    background: var(--ds-surface-2) !important;
    border: 1px solid var(--ds-line-strong) !important;
    color: var(--ds-ink) !important;
}
.ud-toolbar a:not(.hidden) { border-radius: 8px !important; }
.ud-toolbar .ud-btn, .ud-toolbar button { height: 32px; }

/* ---------- 9. 空状态 ---------- */
.ud-empty { padding: 44px 20px; gap: 6px; }
.ud-empty .ud-empty-ico {
    width: 56px; height: 56px; border-radius: 16px; font-size: 22px;
    background: var(--ds-brand-soft); color: var(--ds-brand);
}
.ud-empty .ud-empty-title { font-size: 14.5px; }
.ud-empty .ud-empty-desc { font-size: 12.5px; color: var(--ds-mut); }

/* ---------- 10. 套餐卡（价格与 CTA 对齐） ---------- */
.ud-plan-price { gap: 3px; }
.ud-plan-cur { font-size: 15px; font-weight: 600; color: var(--ds-sub); }
.ud-plan-num { font-size: 30px; font-weight: 700; letter-spacing: -.02em; }
.ud-plan-period { font-size: 12px; color: var(--ds-mut); }
.ud-plan-cta { background: var(--ds-brand); color: var(--ds-on-brand); box-shadow: none; }
.ud-plan-card:hover .ud-plan-cta { background: var(--ds-brand-2); color: var(--ds-on-brand); }

/* 套餐卡：取消满屏霓虹描边，只在悬停时提亮 */
.ud-page .ud-plan-card,
.ud-page .ud-plan-card:has(.ud-plan-badge) {
    border-color: var(--ds-line) !important;
    box-shadow: var(--ds-sh) !important;
}
.ud-page .ud-plan-card:hover {
    border-color: var(--ds-line-strong) !important;
    box-shadow: 0 12px 30px -22px rgba(0, 0, 0, .8) !important;
    transform: translateY(-2px);
}
.ud-page .ud-plan-badge { box-shadow: none !important; }

/* 统计卡图标：统一品牌色，避免一屏四色 */
.ud-stat .is-sky, .ud-stat .is-amber, .ud-stat .is-green, .ud-stat .is-violet,
.ud-page .ud-stat .is-sky, .ud-page .ud-stat .is-amber,
.ud-page .ud-stat .is-green, .ud-page .ud-stat .is-violet {
    background: var(--ds-brand-soft) !important;
    color: var(--ds-brand) !important;
}

/* ---------- 11. 徽标 / 标签 ---------- */
.ud-tag { border-radius: 999px; font-weight: 500; }

/* ---------- 12. 内容页（服务条款 / 隐私 / 接口文档 / 联系 / 下载） ---------- */
.ud-doc { padding: 28px 24px 72px; }
.ud-doc > .container { width: 100%; max-width: 760px; margin-left: auto; margin-right: auto; padding-left: 0; padding-right: 0; }
.ud-doc { color: var(--ds-ink); font-size: 15px; line-height: 1.9; letter-spacing: .01em; }
.ud-doc p { margin-bottom: 10px; }
.ud-doc h1, .ud-doc h2, .ud-doc h3 { color: var(--ds-ink); letter-spacing: -.01em; }
.ud-doc h1 { font-size: 26px; margin: 8px 0 16px; }
.ud-doc h2 { font-size: 19px; margin: 26px 0 10px; }
.ud-doc h3 { font-size: 16px; margin: 20px 0 8px; }
.ud-doc .bg-white, .ud-doc .bg-gray-50, .ud-doc .bg-gray-100 {
    background: var(--ds-surface) !important;
}
.ud-doc .shadow-custom, .ud-doc .rounded-md, .ud-doc .rounded-lg {
    border-radius: var(--ds-r) !important;
    border-color: var(--ds-line) !important;
}
.ud-doc .text-gray-800, .ud-doc .text-gray-700, .ud-doc .text-gray-900 { color: var(--ds-ink) !important; }
.ud-doc .text-gray-600, .ud-doc .text-gray-500 { color: var(--ds-sub) !important; }
.ud-doc a { color: var(--ds-brand); text-decoration: underline; text-underline-offset: 2px; }
.ud-doc table { width: 100%; border-collapse: collapse; font-size: 13.5px; margin: 12px 0; }
.ud-doc table th, .ud-doc table td { border: 1px solid var(--ds-line); padding: 8px 12px; text-align: left; }
.ud-doc table th { background: var(--ds-surface-2); color: var(--ds-sub); font-weight: 600; }
.ud-doc code, .ud-doc pre {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12.5px;
}
.ud-doc pre {
    background: var(--ds-surface-2); border: 1px solid var(--ds-line);
    border-radius: var(--ds-r-sm); padding: 14px 16px; overflow-x: auto; line-height: 1.65;
}
.ud-doc ul, .ud-doc ol { padding-left: 1.35em; margin: 10px 0; }
.ud-doc li { margin: 4px 0; }
/* 旧内容里的 </br> 造成双倍行距，这里收一下 */
.ud-doc br + br { display: none; }

/* 接口文档：去掉旧渐变横幅，改发丝边卡片 */
.ud-doc .ud-api-hero {
    background: var(--ds-surface) !important;
    background-image: none !important;
    color: var(--ds-ink) !important;
    border: 1px solid var(--ds-line);
    border-radius: var(--ds-r-lg);
    box-shadow: none !important;
    padding: 22px 24px;
}
.ud-doc .ud-api-hero h1 { color: var(--ds-ink); font-size: 22px; }
.ud-doc .ud-api-hero p { color: var(--ds-sub); }
.ud-doc .ud-api-pill {
    background: var(--ds-brand-soft) !important; color: var(--ds-brand) !important;
    border: 1px solid transparent !important; backdrop-filter: none;
}
.ud-doc .ud-api-cta {
    background: var(--ds-brand) !important; color: var(--ds-on-brand) !important;
    border-radius: var(--ds-r-sm); box-shadow: none !important;
}


/* ---------- 12b. 内容页组件（服务条款 / 隐私协议的结构化排版） ---------- */
.doc-head { margin: 4px 0 20px; }
.doc-head h1 { font-size: 28px; font-weight: 600; letter-spacing: -.02em; margin: 0 0 6px; }
.doc-meta { font-size: 12.5px; color: var(--ds-mut); margin: 0; }
.doc-card {
    background: var(--ds-surface);
    border: 1px solid var(--ds-line);
    border-radius: var(--ds-r);
    padding: 26px 28px;
    margin-bottom: 16px;
}
.doc-card h2 {
    font-size: 17px; font-weight: 600; letter-spacing: -.01em;
    margin: 0 0 14px; padding-bottom: 10px;
    border-bottom: 1px solid var(--ds-line);
}
.doc-lead { font-size: 14.5px; color: var(--ds-sub); line-height: 1.9; margin: 0 0 14px; }
.doc-list { list-style: none; padding: 0; margin: 0; }
.doc-list li {
    position: relative; padding-left: 18px; margin: 9px 0;
    font-size: 14px; line-height: 1.8; color: var(--ds-sub);
}
.doc-list li::before {
    content: ''; position: absolute; left: 2px; top: .74em;
    width: 5px; height: 5px; border-radius: 50%;
    background: var(--ds-brand); opacity: .6;
}
.doc-faq { margin: 0; }
.doc-faq dt { font-size: 14px; font-weight: 600; color: var(--ds-ink); margin: 18px 0 6px; }
.doc-faq dt:first-child { margin-top: 0; }
.doc-faq dd { margin: 0; font-size: 14px; line-height: 1.85; color: var(--ds-sub); }
.doc-faq dd + dt { border-top: 1px solid var(--ds-line); padding-top: 16px; }
.doc-sign {
    margin: 22px 0 0; padding-top: 16px;
    border-top: 1px solid var(--ds-line);
    font-size: 13px; color: var(--ds-mut); line-height: 1.9;
}

/* ---------- 12c. 上传页外壳 ---------- */
.ud-upload-shell .up-page { min-height: calc(100dvh - 64px); }

/* 后台图表：预构建的 Tailwind 里没有 h-[380px] 这类任意值，容器高度会塌成 0，图表只剩一行图例 */
#chart-spread-users, #chart-spread-images { height: 380px; width: 100%; }
@media (max-width: 767px) {
    #chart-spread-users, #chart-spread-images { height: 300px; }
}

/* ---------- 13. 后台 ---------- */
.ud-admin .ud-wrap { max-width: 1360px; }
.ud-admin .ud-title { font-size: 22px; }
.ud-admin table { font-size: 12.5px; }
.ud-admin table thead th { padding: 9px 12px !important; }
.ud-admin table tbody td { padding: 9px 12px; }
/* 宽表：保留原有横向滚动，但首列固定，滚动时不丢上下文 */
.ud-admin .overflow-x-auto { overflow-x: auto; scrollbar-width: thin; }
.ud-admin table { white-space: nowrap; }
.ud-admin table tbody tr:hover td:first-child { background: var(--ds-surface); }
.ud-admin table th:first-child, .ud-admin table td:first-child {
    position: sticky; left: 0; z-index: 2;
    background: var(--ds-surface);
    box-shadow: 10px 0 14px -14px rgba(0, 0, 0, .9);
}
.ud-admin table thead th:first-child { background: var(--ds-surface-2); z-index: 3; }
.ud-admin .ud-card { margin-bottom: 14px; }

/* 筛选栏：给右下角「高级搜索语法」小字留出行高，避免压到表头 */
.ud-page form:has(.absolute.-bottom-5) { margin-bottom: 16px; }
.ud-page form .absolute.-bottom-5 {
    right: 2px; bottom: -17px;
    font-size: 11px; color: var(--ds-mut);
    letter-spacing: .01em;
}
.ud-page form .absolute.-bottom-5 a { color: var(--ds-mut); text-decoration: none; }
.ud-page form .absolute.-bottom-5 a:hover { color: var(--ds-brand); }

/* ---------- 14. 上传页 ---------- */
.ud-upload { max-width: 820px; margin: 0 auto; padding: 28px 20px 80px; }
.ud-upload h1 { font-size: 24px; font-weight: 600; letter-spacing: -.01em; }

/* ---------- 15. 细节 ---------- */
html.dark ::selection { background: rgba(56, 189, 248, .28); }
html.dark img { color-scheme: dark; }
.ud-page hr, .ud-doc hr { border-color: var(--ds-line); }
.ud-page .rounded-xl, .ud-page .rounded-lg { border-radius: var(--ds-r); }

/* 移动端：工具栏换行不挤压 */
@media (max-width: 767px) {
    /* 只让「搜索表单」独占一行；其余子元素保持自然宽度，
       否则下拉菜单的 relative 包裹层会被拉满，面板跑到屏幕外 */
    .ud-toolbar { flex-wrap: wrap; row-gap: 6px; }
    .ud-toolbar > form { width: 100%; }
    .ud-toolbar .ud-toolbar-row { width: 100%; }
    .ud-toolbar select, .ud-toolbar input[type=text], .ud-toolbar input[type=search] {
        max-width: 100%;
    }
    /* 移动端工具栏：按钮一律做成 36px 药丸、左对齐，不再被 justify-between 甩到中间 */
    .ud-toolbar a:not(.hidden), .ud-toolbar button {
        min-height: 36px; padding: 0 12px !important;
        display: inline-flex; align-items: center; gap: 6px;
        border-radius: 10px;
        background: var(--ds-surface-2);
        border: 1px solid var(--ds-line);
    }
    .ud-toolbar a:not(.hidden):active { background: var(--ds-brand-soft); }
    .ud-toolbar > div {
        justify-content: flex-start !important;
        align-items: center;
        gap: 6px;
        flex-wrap: wrap;
    }
    .ud-toolbar > div > div, .ud-toolbar form > * { flex: none; }
    .ud-doc { padding: 18px 16px 56px; font-size: 14.5px; }

    /* 移动端主操作：撑满一行、居中，避免 88px 的小按钮贴在卡片右下角 */
    .ud-page .ud-btn { min-height: 40px; }
    .ud-head-actions { width: 100%; }
    .ud-head-actions .ud-btn { flex: 1 1 100%; justify-content: center; }
    .ud-page form .ud-btn-primary,
    .ud-page form button[type=submit].ud-btn { width: 100%; justify-content: center; }
}

/* ============================================================================
   16. 第三方内容页兜底（插件下载页自带内联样式、写死浅色）
   说明：这些页面的 <style> 在 body 里、晚于本文件，因此必须 !important
   ========================================================================== */
.dl-title, .dl-group-title, .dl-name { color: var(--ds-ink) !important; }
.dl-sub, .dl-desc, .dl-alt { color: var(--ds-sub) !important; }
.dl-card {
    background: var(--ds-surface) !important;
    border-color: var(--ds-line) !important;
    border-radius: var(--ds-r) !important;
}
/* 下载按钮：暗色用亮青底 + 深字（对比 9:1），亮色用品牌蓝底 + 白字 */
.dl-btn {
    background: var(--ds-brand) !important;
    color: var(--ds-on-brand) !important;
    font-weight: 600 !important;
    padding: 9px 16px !important;
    border-radius: var(--ds-r-sm) !important;
}
.dl-btn:hover, .dl-btn:focus { background: var(--ds-brand-2) !important; color: var(--ds-on-brand) !important; }
.dl-ver { color: var(--ds-brand) !important; background: var(--ds-brand-soft) !important; }
.dl-icon { background: var(--ds-brand-soft) !important; }
.dl-icon i { color: var(--ds-brand) !important; }

/* ============================================================================
   17. 下拉菜单条目：做成有高度的菜单行（原来「刷新」就是一行裸文字）
   ========================================================================== */
.ud-glass[role="menu"] { padding: 6px !important; border-radius: 14px !important; }
.ud-glass[role="menu"] a,
.ud-glass[role="menu"] button {
    display: flex; align-items: center; gap: 9px;
    margin: 1px 0; padding: 9px 12px !important;
    border-radius: 10px;
    font-size: 13px !important; line-height: 1.2;
    color: var(--ds-sub) !important;
    text-decoration: none;
}
.ud-glass[role="menu"] a:hover,
.ud-glass[role="menu"] button:hover {
    background: var(--ds-brand-soft) !important;
    color: var(--ds-brand) !important;
}
.ud-glass[role="menu"] a i,
.ud-glass[role="menu"] button i { width: 16px; text-align: center; font-size: 12px; opacity: .9; }
.ud-glass[role="menu"] a.danger,
.ud-glass[role="menu"] a[data-operate="delete"] { color: var(--ds-danger) !important; }

/* 移动端收尾：Tokens 的整行主按钮改回等宽次级；兑换码等表单提交按钮撑满 */
@media (max-width: 767px) {
    /* 页面头部只有一个「创建 Token」时，不要拉成一整条主色横幅 */
    .ud-head-actions .ud-btn-primary { flex: 0 1 auto; min-width: 132px; padding: 0 18px; }
    /* 表单里的提交按钮（兑换码「立即兑换」等）统一整行 */
    .ud-page form button[type="submit"],
    .ud-page form .btn,
    .ud-page form input[type="submit"] {
        width: 100% !important;
        justify-content: center;
    }
}

/* ============================================================================
   18. 后台「阶梯价格」表格：手机上改成竖排卡片
   表格 6 列（名称/时长/价格/容量/关联组/操作），390px 下横向滚动且字段被裁，
   这里用 nth-child 生成字段名，行变成卡片，操作按钮浮到右上角
   ========================================================================== */
@media (max-width: 767px) {
    #prices { display: block; width: 100%; border: 0 !important; }
    #prices thead { display: none; }
    #prices tbody { display: block; }
    #prices tr {
        display: block; position: relative;
        background: var(--ds-surface);
        border: 1px solid var(--ds-line) !important;
        border-radius: var(--ds-r);
        padding: 10px 12px 6px;
        margin-bottom: 10px;
    }
    #prices td {
        display: block; width: 100% !important;
        border: 0 !important; padding: 6px 0 !important;
        min-width: 0 !important;
    }
    #prices td::before {
        display: block; margin-bottom: 4px;
        font-size: 11.5px; font-weight: 600;
        color: var(--ds-mut); letter-spacing: .02em;
    }
    #prices td:nth-child(1)::before { content: "名称"; }
    #prices td:nth-child(2)::before { content: "有效时长（秒）"; }
    #prices td:nth-child(3)::before { content: "价格（0 为免费）"; }
    #prices td:nth-child(4)::before { content: "赠送容量（KB）"; }
    #prices td:nth-child(5)::before { content: "关联用户组"; }
    #prices td:nth-child(6) {
        position: absolute; right: 10px; top: 10px;
        width: auto !important; padding: 0 !important;
    }
    #prices td:nth-child(6)::before { content: none; }
    /* 表格外的横向滚动容器在手机上放开，交给卡片布局 */
    #prices:not(table) { overflow: visible; }
}

@media (max-width: 767px) {
    /* 让卡片能占满，不再被外层横向滚动容器裁掉 */
    .ud-admin form .overflow-x-auto, .ud-page form .overflow-x-auto { overflow-x: visible !important; }
}

@media (max-width: 767px) {
    /* 后台宽表：窄屏只保留前 4 列 + 最后一列（操作），中间列隐藏，避免横向拖拽 */
    .ud-admin table th:nth-child(n+5):not(:last-child),
    .ud-admin table td:nth-child(n+5):not(:last-child) { display: none !important; }
    .ud-admin table { white-space: nowrap; }
    .ud-admin table th, .ud-admin table td { padding: 8px 10px !important; font-size: 12px !important; }
}

/* 控制台「最近图片」：行高统一，避免第二行被拉高 */
.ud-recent-grid { grid-auto-rows: 1fr; align-items: stretch; }
.ud-recent-grid a { height: 100%; }

/* ============================================================================
   19. 后台/控制台 移动端收口 + 表单校验态
   ========================================================================== */
@media (max-width: 767px) {
    /* 宽表：保留关键列后仍溢出，是因为单元格 nowrap + min-width；
       窄屏允许换行并固定 100% 宽，彻底消除横向拖动 */
    .ud-admin table { table-layout: fixed; width: 100% !important; white-space: normal !important; }
    .ud-admin table th, .ud-admin table td {
        white-space: normal !important;
        word-break: break-word;
        min-width: 0 !important;
        padding: 8px 8px !important;
        font-size: 12px !important;
    }
    .ud-admin .overflow-x-auto { overflow-x: visible !important; }

    /* 控制台页头按钮：一行放不下时等分，不出现半截按钮 */
    .ud-head-actions { gap: 6px; }
    .ud-head-actions .ud-btn { flex: 1 1 calc(50% - 3px); justify-content: center; }
}

/* 表单校验态：输入不合法且已输入内容时给出红边 + 轻微底色，提交前就能看到 */
.ud-page input:invalid:not(:placeholder-shown),
.ud-admin input:invalid:not(:placeholder-shown),
.ud-page textarea:invalid:not(:placeholder-shown),
.ud-admin textarea:invalid:not(:placeholder-shown) {
    border-color: var(--ds-danger) !important;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, .12) !important;
}
.ud-page input:required:not(:placeholder-shown):valid,
.ud-admin input:required:not(:placeholder-shown):valid {
    border-color: var(--ds-ok, #10b981) !important;
}

@media (max-width: 767px) {
    /* 操作列：链接排成可点的行内块，避免一个词占一行 */
    .ud-admin table th:first-child, .ud-admin table td:first-child { width: 54px !important; }
    .ud-admin table th:last-child, .ud-admin table td:last-child { width: 96px !important; }
    .ud-admin table td:last-child a {
        display: inline-block; margin: 0 6px 5px 0;
        font-size: 11.5px; line-height: 1.3;
    }
}

@media (max-width: 767px) {
    /* 申诉等页面只挂了 .ud-page、没有 .ud-admin，这里用同等规则兜底 */
    .ud-page .overflow-x-auto { overflow-x: visible !important; }
    .ud-page table:not(.no-stack) {
        table-layout: fixed; width: 100% !important; white-space: normal !important;
    }
    .ud-page table:not(.no-stack) th,
    .ud-page table:not(.no-stack) td {
        white-space: normal !important; word-break: break-word;
        min-width: 0 !important; padding: 8px !important; font-size: 12px !important;
    }
    .ud-page table:not(.no-stack) td:last-child a {
        display: inline-block; margin: 0 6px 5px 0; font-size: 11.5px;
    }
}

@media (max-width: 767px) {
    /* 申诉页：表格外层带 id，单独兜底（该页没有 .ud-admin / .ud-page 祖先） */
    #appeal-table { overflow-x: visible !important; }
    #appeal-table > table {
        table-layout: fixed; width: 100% !important; white-space: normal !important;
    }
    #appeal-table > table th, #appeal-table > table td {
        white-space: normal !important; word-break: break-word;
        min-width: 0 !important; padding: 8px !important; font-size: 12px !important;
    }
}

/* ============================================================================
   20. 回滚：手机上强制压缩表格导致列内容（券码等）不可读
   恢复为「可横滑 + 12px 字号」，只保留换行，不再隐藏列、不再 fixed 布局
   ========================================================================== */
@media (max-width: 767px) {
    .ud-admin table th:nth-child(n+5):not(:last-child),
    .ud-admin table td:nth-child(n+5):not(:last-child) { display: table-cell !important; }

    .ud-admin table,
    .ud-page table:not(.no-stack),
    #appeal-table > table {
        table-layout: auto !important;
        width: auto !important;
        min-width: 640px !important;
        white-space: normal !important;
    }

    .ud-admin .overflow-x-auto,
    .ud-page .overflow-x-auto,
    #appeal-table { overflow-x: auto !important; -webkit-overflow-scrolling: touch; }

    #appeal-table { min-width: 0 !important; }

    .ud-admin table th, .ud-admin table td,
    .ud-page table:not(.no-stack) th,
    .ud-page table:not(.no-stack) td,
    #appeal-table > table th,
    #appeal-table > table td {
        padding: 9px 10px !important;
        font-size: 12.5px !important;
        min-width: 0 !important;
        word-break: normal !important;
        white-space: normal !important;
    }
}

@media (max-width: 767px) {
    /* 表格改为「不换行 + 横滑」：竖排断字更难读，横滑是后台宽表的通行做法 */
    .ud-admin table th, .ud-admin table td,
    .ud-page table:not(.no-stack) th,
    .ud-page table:not(.no-stack) td,
    #appeal-table > table th,
    #appeal-table > table td {
        white-space: nowrap !important;
        word-break: keep-all !important;
    }
    .ud-admin table, .ud-page table:not(.no-stack), #appeal-table > table {
        width: auto !important;
        min-width: 0 !important;
        table-layout: auto !important;
    }
    /* 第一列（勾选/序号）固定在左侧，横滑时看得见自己在看哪一行 */
    .ud-admin table td:first-child, .ud-admin table th:first-child {
        position: sticky; left: 0; z-index: 2;
        background: var(--ds-surface);
    }
}
