/* =====================================================================
   MTC 智能计算中心 · 新版界面 (2026-10-05)
   - 设计令牌：浅色 / 深色两套，html[data-theme]
   - 语言：html[data-ui-lang] 控制 [data-l] 文本显隐
   - 外壳：.ui-topbar / .ui-drawer / .ui-footer；首页 .hp-*
   - Bootstrap 4 组件统一换肤（只改颜色、圆角、阴影，不改布局尺寸）
   回退：cookie mtc_ui=classic 或 settings.UI_DEFAULT_SKIN='classic'
   ===================================================================== */

:root,
html[data-theme="light"] {
    --ui-bg: #f5f7fa;
    --ui-surface: #ffffff;
    --ui-surface-2: #f8fafc;
    --ui-surface-3: #eef2f6;
    --ui-border: #e3e8ef;
    --ui-border-strong: #cbd3de;
    --ui-text: #172033;
    --ui-text-2: #465267;
    --ui-muted: #687387;
    --ui-primary: #1d5fd1;
    --ui-primary-hover: #174eae;
    --ui-primary-soft: #e8effc;
    --ui-primary-text: #ffffff;
    --ui-accent: #0d9488;
    --ui-accent-soft: #e2f5f2;
    --ui-danger: #c93a3a;
    --ui-danger-soft: #fbeaea;
    --ui-success: #1f8a4c;
    --ui-success-soft: #e6f4ec;
    --ui-warning: #a86400;
    --ui-warning-soft: #fdf2e0;
    --ui-info-soft: #e6f2f8;
    --ui-link: #1d5fd1;
    --ui-topbar: rgba(255, 255, 255, .88);
    --ui-topbar-border: #e3e8ef;
    --ui-shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
    --ui-shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 4px 12px rgba(16, 24, 40, .05);
    --ui-shadow-lg: 0 12px 32px rgba(16, 24, 40, .14), 0 2px 6px rgba(16, 24, 40, .06);
    --ui-scrim: rgba(15, 20, 30, .42);
    --ui-focus: 0 0 0 3px rgba(29, 95, 209, .28);
    --ui-code-bg: #f1f3f6;
    color-scheme: light;
}

html[data-theme="dark"] {
    --ui-bg: #0d1117;
    --ui-surface: #151b23;
    --ui-surface-2: #1a212b;
    --ui-surface-3: #222a35;
    --ui-border: #29313d;
    --ui-border-strong: #39424f;
    --ui-text: #e4e8ee;
    --ui-text-2: #bcc4cf;
    --ui-muted: #8b95a5;
    --ui-primary: #5b8ff0;
    --ui-primary-hover: #7ba5f4;
    --ui-primary-soft: #1b2a44;
    --ui-primary-text: #0b1220;
    --ui-accent: #3cc9b8;
    --ui-accent-soft: #15302d;
    --ui-danger: #f07a7a;
    --ui-danger-soft: #3a1f22;
    --ui-success: #5fcf8f;
    --ui-success-soft: #183327;
    --ui-warning: #f0b55a;
    --ui-warning-soft: #3a2e17;
    --ui-info-soft: #17303b;
    --ui-link: #7ba5f4;
    --ui-topbar: rgba(16, 21, 28, .88);
    --ui-topbar-border: #222a35;
    --ui-shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --ui-shadow: 0 1px 3px rgba(0, 0, 0, .45), 0 4px 12px rgba(0, 0, 0, .25);
    --ui-shadow-lg: 0 16px 40px rgba(0, 0, 0, .55), 0 2px 6px rgba(0, 0, 0, .3);
    --ui-scrim: rgba(0, 0, 0, .58);
    --ui-focus: 0 0 0 3px rgba(91, 143, 240, .35);
    --ui-code-bg: #1d232d;
    color-scheme: dark;
}

/* ---------- 语言切换 ---------- */
html[data-ui-lang="zh"] [data-l="en"],
html:not([data-ui-lang]) [data-l="en"],
html[data-ui-lang="en"] [data-l="zh"] { display: none !important; }

/* ---------- 基础 ---------- */
body.ui-modern {
    background: var(--ui-bg);
    color: var(--ui-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
                 "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
/* 链接色：只与 Bootstrap 的 a{} 同级，页面自定义的链接色优先 */
:where(body.ui-modern) a { color: var(--ui-link); }
:where(body.ui-modern) a:hover { color: var(--ui-primary-hover); }
body.ui-modern ::selection { background: var(--ui-primary-soft); }
body.ui-modern :focus-visible { outline: none; box-shadow: var(--ui-focus); border-radius: 6px; }

.ui-skip {
    position: absolute; left: 12px; top: -40px; z-index: 100001;
    background: var(--ui-primary); color: var(--ui-primary-text) !important;
    padding: 8px 12px; border-radius: 8px; transition: top .15s;
}
.ui-skip:focus { top: 8px; }
.ui-topbar button:focus:not(:focus-visible), .ui-drawer button:focus:not(:focus-visible),
.ui-footer button:focus:not(:focus-visible), .ui-drawer summary:focus:not(:focus-visible) { outline: none; }

/* ---------- 顶栏 ---------- */
.ui-topbar {
    position: sticky; top: 0; z-index: 1030;
    background: var(--ui-topbar);
    -webkit-backdrop-filter: saturate(160%) blur(14px);
    backdrop-filter: saturate(160%) blur(14px);
    border-bottom: 1px solid var(--ui-topbar-border);
}
.ui-topbar__inner {
    position: relative;
    display: flex; align-items: center; gap: 8px;
    height: 62px; padding: 0 20px;
    max-width: 1680px; margin: 0 auto;
}
.ui-brand {
    display: inline-flex; align-items: center; gap: 10px;
    color: var(--ui-text) !important; text-decoration: none !important;
    white-space: nowrap; margin-right: 14px; min-width: 0;
}
.ui-brand__mark {
    width: 34px; height: 34px; flex: none; border-radius: 9px; padding: 2px;
    background: #fff; box-shadow: 0 0 0 1px var(--ui-border), var(--ui-shadow-sm);
}
.ui-brand__text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.ui-brand__name { font-weight: 700; font-size: 16px; letter-spacing: .01em; overflow: hidden; text-overflow: ellipsis; }
.ui-brand__sub { font-size: 11.5px; color: var(--ui-muted); font-weight: 500; letter-spacing: .02em; }

.ui-nav { display: flex; align-items: center; gap: 2px; flex: 1 1 auto; min-width: 0; }
.ui-nav__link {
    display: inline-flex; align-items: center; gap: 6px;
    height: 38px; padding: 0 12px; border-radius: 9px;
    font-size: 14.5px; font-weight: 500; line-height: 1;
    color: var(--ui-text-2) !important; text-decoration: none !important;
    background: transparent; border: 0; cursor: pointer; white-space: nowrap;
    transition: background-color .15s, color .15s;
}
.ui-nav__link:hover { background: var(--ui-surface-3); color: var(--ui-text) !important; }
.ui-nav__link.is-active { color: var(--ui-primary) !important; background: var(--ui-primary-soft); }
.ui-caret { font-size: 11px; opacity: .6; transition: transform .2s; }
[aria-expanded="true"] > .ui-caret, details[open] > summary .ui-caret { transform: rotate(180deg); }

.ui-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; flex: none; }
.ui-iconbtn {
    position: relative;
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: 10px; flex: none;
    border: 0; background: transparent; cursor: pointer;
    color: var(--ui-text-2) !important; font-size: 18px; text-decoration: none !important;
    transition: background-color .15s, color .15s;
}
.ui-iconbtn:hover { background: var(--ui-surface-3); color: var(--ui-text) !important; }
#uiNavToggle { font-size: 24px; }
.ui-langbtn { font-size: 13px; font-weight: 700; letter-spacing: .02em; }
html[data-theme="dark"] .ui-show-light, html:not([data-theme="dark"]) .ui-show-dark { display: none; }
.ui-badge {
    position: absolute; top: 3px; right: 2px;
    min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
    background: var(--ui-danger); color: #fff; font-size: 10.5px; font-weight: 700; line-height: 17px; text-align: center;
    box-shadow: 0 0 0 2px var(--ui-surface);
}
html[data-theme="dark"] .ui-badge { background: #e5484d; }

.ui-user {
    display: inline-flex; align-items: center; gap: 8px;
    height: 40px; padding: 0 10px 0 4px; border-radius: 20px;
    border: 1px solid var(--ui-border); background: var(--ui-surface);
    color: var(--ui-text) !important; cursor: pointer; font-size: 14px; font-weight: 500;
    margin-left: 4px;
}
.ui-user:hover { border-color: var(--ui-border-strong); }
.ui-user__name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ui-points {
    display: inline-flex; align-items: center; gap: 3px;
    padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 650;
    background: var(--ui-accent-soft); color: var(--ui-accent);
}
.ui-avatar {
    width: 32px; height: 32px; border-radius: 50%; flex: none; object-fit: cover;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--ui-primary-soft); color: var(--ui-primary); font-weight: 700; font-size: 13px;
}
.ui-avatar--lg { width: 44px; height: 44px; font-size: 18px; }

.ui-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 40px; padding: 0 18px; border-radius: 10px; border: 1px solid transparent;
    font-size: 14.5px; font-weight: 600; text-decoration: none !important; cursor: pointer; white-space: nowrap;
    transition: background-color .15s, border-color .15s, transform .15s;
}
.ui-btn--sm { height: 36px; padding: 0 14px; font-size: 14px; }
.ui-btn--primary { background: var(--ui-primary); color: var(--ui-primary-text) !important; }
.ui-btn--primary:hover { background: var(--ui-primary-hover); }
.ui-btn--ghost { background: var(--ui-surface); border-color: var(--ui-border); color: var(--ui-text) !important; }
.ui-btn--ghost:hover { border-color: var(--ui-border-strong); background: var(--ui-surface-2); }

/* ---------- 下拉 / 超级菜单 ---------- */
.ui-dd { position: relative; }
.ui-dd--mega { position: static; }
.ui-dd__panel {
    position: absolute; top: calc(100% + 8px); left: 0; z-index: 1040;
    min-width: 248px; padding: 6px;
    background: var(--ui-surface); color: var(--ui-text);
    border: 1px solid var(--ui-border); border-radius: 12px; box-shadow: var(--ui-shadow-lg);
    opacity: 0; visibility: hidden; transform: translateY(-4px);
    transition: opacity .15s, transform .15s, visibility 0s linear .15s;
    max-height: calc(100vh - 80px); overflow-y: auto; overscroll-behavior: contain;
}
.ui-dd.is-open > .ui-dd__panel { opacity: 1; visibility: visible; transform: none; transition: opacity .15s, transform .15s; }
.ui-dd--right > .ui-dd__panel { left: auto; right: 0; }
/* 计算平台：多栏瀑布流，组不拆开 */
.ui-dd__panel--mega {
    left: 50%; top: calc(100% - 4px);
    transform: translate(-50%, -4px);
    width: min(1240px, calc(100vw - 32px));
    column-count: 4; column-gap: 14px;
    padding: 14px;
}
.ui-dd.is-open > .ui-dd__panel--mega { transform: translate(-50%, 0); }
.ui-dd__panel--mega .ui-dd__group { break-inside: avoid; padding-bottom: 8px; }
.ui-dd__panel--wide { width: 520px; display: grid; grid-template-columns: 1fr 1fr; gap: 0 8px; }
.ui-dd__panel--menu { width: 272px; }
.ui-dd__title {
    display: flex; align-items: center; gap: 7px;
    padding: 8px 10px 6px; font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
    color: var(--ui-muted);
}
.ui-dd__title .bi { color: var(--ui-accent); font-size: 13px; }
.ui-dd__item {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 7px 10px; border-radius: 8px; border: 0; background: transparent; text-align: left;
    color: var(--ui-text) !important; text-decoration: none !important; font-size: 14px; line-height: 1.35; cursor: pointer;
}
.ui-dd__item:hover, .ui-dd__item:focus-visible { background: var(--ui-surface-3); }
.ui-dd__item.is-soon, .ui-drawer__item.is-soon { cursor: default; color: var(--ui-muted) !important; }
.ui-dd__item.is-soon:hover, .ui-drawer__item.is-soon:hover { background: transparent; }
.ui-dd__item--danger, .ui-dd__item--danger .ui-dd__ic { color: var(--ui-danger) !important; }
.ui-dd__ic { width: 18px; text-align: center; color: var(--ui-muted); font-size: 15px; flex: none; }
.ui-dd__item:hover .ui-dd__ic { color: var(--ui-primary); }
.ui-dd__item.is-soon .ui-dd__ic { color: var(--ui-muted); }
.ui-dd__label { flex: 1 1 auto; min-width: 0; }
.ui-ext { font-size: 11px; color: var(--ui-muted); opacity: .7; }
.ui-tag {
    flex: none; font-size: 10.5px; font-weight: 700; letter-spacing: .03em;
    padding: 2px 6px; border-radius: 5px; background: var(--ui-surface-3); color: var(--ui-muted);
}
.ui-tag--danger { background: var(--ui-danger-soft); color: var(--ui-danger); }
.ui-count { font-size: 12px; color: var(--ui-muted); margin-left: auto; }
.ui-dd__sep { height: 1px; background: var(--ui-border); margin: 6px 4px; }
.ui-dd__head { padding: 10px 10px 8px; border-bottom: 1px solid var(--ui-border); margin-bottom: 6px; }
.ui-dd__head-name { font-weight: 650; }
.ui-dd__head-sub { font-size: 12.5px; color: var(--ui-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 抽屉（平板 / 手机） ---------- */
.ui-scrim {
    position: fixed; inset: 0; z-index: 1050; background: var(--ui-scrim);
    opacity: 0; transition: opacity .2s;
}
.ui-scrim.is-open { opacity: 1; }
.ui-drawer {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 1060;
    width: min(360px, 88vw); display: flex; flex-direction: column;
    background: var(--ui-surface); color: var(--ui-text);
    border-right: 1px solid var(--ui-border); box-shadow: var(--ui-shadow-lg);
    transform: translateX(-102%); transition: transform .25s cubic-bezier(.2, .8, .2, 1);
    padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom);
    visibility: hidden;
}
.ui-drawer.is-open { transform: none; visibility: visible; }
.ui-drawer:focus { outline: none; }
.ui-drawer__head {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 14px 12px 12px 16px; border-bottom: 1px solid var(--ui-border);
}
.ui-drawer__user { display: flex; align-items: center; gap: 12px; color: var(--ui-text) !important; text-decoration: none !important; min-width: 0; }
.ui-drawer__user > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.ui-drawer__name { font-weight: 650; font-size: 16px; }
.ui-drawer__sub { font-size: 12.5px; color: var(--ui-muted); }
.ui-drawer__body { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; padding: 8px 10px 12px; }
.ui-drawer__section { padding-bottom: 6px; margin-bottom: 6px; border-bottom: 1px solid var(--ui-border); }
.ui-drawer__link {
    display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 10px; border-radius: 10px;
    color: var(--ui-text) !important; text-decoration: none !important; font-size: 15px; font-weight: 500; cursor: pointer;
}
.ui-drawer__link:hover { background: var(--ui-surface-3); }
.ui-drawer__link.is-active { background: var(--ui-primary-soft); color: var(--ui-primary) !important; }
.ui-drawer__link.is-active .ui-dd__ic { color: var(--ui-primary); }
.ui-acc > summary { list-style: none; }
.ui-acc > summary::-webkit-details-marker { display: none; }
.ui-acc__sum .ui-dd__ic { color: var(--ui-accent); }
.ui-acc__sum .ui-caret { margin-left: auto; }
.ui-acc__sum .ui-tag { margin-left: auto; }
.ui-acc__sum .ui-count + .ui-caret, .ui-acc__sum .ui-tag + .ui-caret { margin-left: 8px; }
.ui-acc__body { padding: 2px 0 8px 8px; }
.ui-drawer__grid { display: grid; grid-template-columns: 1fr; gap: 2px; }
.ui-drawer__item {
    display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 6px 10px; border-radius: 8px;
    color: var(--ui-text-2) !important; text-decoration: none !important; font-size: 14px;
}
.ui-drawer__item:hover { background: var(--ui-surface-3); color: var(--ui-text) !important; }
.ui-drawer__foot { border-top: 1px solid var(--ui-border); padding: 12px 14px; display: grid; gap: 10px; }
.ui-seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 3px; border-radius: 10px; background: var(--ui-surface-3); }
.ui-seg button {
    height: 36px; border: 0; border-radius: 8px; background: transparent; color: var(--ui-text-2);
    font-size: 13.5px; font-weight: 600; cursor: pointer;
}
.ui-seg button.is-on { background: var(--ui-surface); color: var(--ui-text); box-shadow: var(--ui-shadow-sm); }
.ui-drawer__row { display: flex; justify-content: space-between; align-items: center; }
.ui-linkbtn {
    border: 0; background: none; padding: 4px 0; cursor: pointer; font-size: 13.5px;
    color: var(--ui-muted) !important; text-decoration: none !important;
}
.ui-linkbtn:hover { color: var(--ui-primary) !important; }
.ui-linkbtn--danger:hover { color: var(--ui-danger) !important; }
body.ui-drawer-open { overflow: hidden; }

/* 平板：抽屉更宽、条目两列 */
@media (min-width: 640px) and (max-width: 1099.98px) {
    .ui-drawer { width: 440px; }
    .ui-drawer__grid { grid-template-columns: 1fr 1fr; }
}

/* 断点：≥1100 桌面导航；<1100 汉堡 + 抽屉 */
@media (min-width: 1100px) {
    .ui-only-compact { display: none !important; }
    .ui-drawer, .ui-scrim { display: none !important; }
}
@media (max-width: 1099.98px) {
    .ui-only-wide, .ui-only-wide-flex { display: none !important; }
    .ui-topbar__inner { padding: 0 10px; gap: 4px; height: 58px; }
    .ui-brand { margin-right: 0; }
}
@media (min-width: 1100px) and (max-width: 1365.98px) {
    .ui-dd__panel--mega { column-count: 3; }
    .ui-brand__sub { display: none; }
    .ui-user__name { display: none; }
}
@media (max-width: 380px) {
    .ui-brand__name { font-size: 15px; }
    .ui-iconbtn { width: 36px; }
}

/* ---------- 页脚 ---------- */
.ui-footer {
    margin-top: 32px; border-top: 1px solid var(--ui-border); background: var(--ui-surface);
    color: var(--ui-muted); font-size: 13px; flex: none;
}
.ui-footer__inner {
    max-width: 1680px; margin: 0 auto; padding: 20px 24px calc(20px + env(safe-area-inset-bottom));
    display: flex; flex-wrap: wrap; gap: 16px 28px; justify-content: space-between; align-items: center;
}
.ui-footer__brand { display: flex; align-items: center; gap: 14px; }
.ui-footer__logo { border-radius: 10px; background: #fff; padding: 3px; box-shadow: 0 0 0 1px var(--ui-border); flex: none; }
.ui-footer__title { color: var(--ui-text); font-weight: 650; font-size: 14.5px; }
.ui-footer__motto { color: var(--ui-text-2); margin: 2px 0 4px; letter-spacing: .02em; }
.ui-footer__meta { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.ui-footer a, .ui-footer .ui-linkbtn { color: var(--ui-muted) !important; font-size: 13px; }
.ui-footer a:hover, .ui-footer .ui-linkbtn:hover { color: var(--ui-primary) !important; }
.ui-footer__side { display: flex; align-items: center; gap: 20px; }
.ui-footer__qr { display: flex; align-items: center; gap: 10px; }
.ui-footer__qr img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; background: #fff; padding: 3px; box-shadow: 0 0 0 1px var(--ui-border); }
.ui-footer__qr span { max-width: 6.5em; line-height: 1.4; }
@media (max-width: 767.98px) {
    .ui-footer__inner { flex-direction: column; text-align: center; padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
    .ui-footer__brand { flex-direction: column; }
    .ui-footer__meta { justify-content: center; }
    .ui-footer__side { flex-direction: column; gap: 10px; }
}

/* 回到顶部按钮跟随主题 */
body.ui-modern .toTop-arrow { background: var(--ui-text) !important; opacity: .55; border-radius: 12px !important; }
body.ui-modern .toTop-arrow:hover { opacity: .8; }
html[data-theme="dark"] body.ui-modern .toTop-arrow::before,
html[data-theme="dark"] body.ui-modern .toTop-arrow::after { border-color: var(--ui-bg) !important; background: var(--ui-bg) !important; }


/* =====================================================================
   首页（templates/ui/home_modern_body.html），前缀 .hp-
   ===================================================================== */
.hp { max-width: 1280px; margin: 0 auto; padding-top: 28px; }
.hp-hero {
    position: relative; overflow: hidden;
    display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 32px; align-items: center;
    padding: 44px 48px; border-radius: 20px;
    background:
        radial-gradient(900px 300px at 0% 0%, rgba(29, 95, 209, .10), transparent 70%),
        radial-gradient(700px 300px at 100% 100%, rgba(13, 148, 136, .10), transparent 70%),
        var(--ui-surface);
    border: 1px solid var(--ui-border); box-shadow: var(--ui-shadow);
}
.hp-eyebrow {
    display: inline-block; font-size: 12.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
    color: var(--ui-muted); padding: 5px 12px; border-radius: 999px; background: var(--ui-surface-3); margin-bottom: 16px;
}
.hp-eyebrow span { color: var(--ui-primary); font-weight: 800; }
.hp-title { font-size: clamp(24px, 3.2vw, 40px); font-weight: 750; letter-spacing: -.01em; line-height: 1.2; margin: 0 0 14px; color: var(--ui-text); }
.hp-lead { font-size: 16.5px; line-height: 1.7; color: var(--ui-text-2); max-width: 46em; margin: 0 0 24px; }
.hp-cta { display: flex; flex-wrap: wrap; gap: 10px; }
.hp-hero__art { position: relative; display: flex; align-items: center; justify-content: center; height: 260px; }
.hp-hero__art img { position: relative; width: 210px; height: 210px; filter: drop-shadow(0 10px 30px rgba(29, 95, 209, .25)); }
.hp-orb {
    position: absolute; width: 250px; height: 250px; border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #ffffff 0%, #eef4ff 45%, #dff3f0 100%);
    box-shadow: inset 0 0 0 1px rgba(29, 95, 209, .12);
}
html[data-theme="dark"] .hp-orb { background: radial-gradient(circle at 35% 35%, #f4f7fb 0%, #dfe8f7 55%, #cfe9e5 100%); }

.hp-stats {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 16px 0 8px;
}
.hp-stat {
    display: flex; flex-direction: column; gap: 2px; padding: 16px 20px; border-radius: 14px;
    background: var(--ui-surface); border: 1px solid var(--ui-border);
    color: var(--ui-muted); font-size: 13.5px;
}
.hp-stat b { font-size: 26px; font-weight: 750; color: var(--ui-text); letter-spacing: -.01em; font-variant-numeric: tabular-nums; }

.hp-section { margin-top: 36px; }
.hp-section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.hp-section__head h2, .hp-vision h2 { font-size: 21px; font-weight: 700; margin: 0; color: var(--ui-text); }
.hp-section__hint { font-size: 13px; color: var(--ui-muted); }

.hp-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.hp-tile {
    display: grid; grid-template-columns: 40px 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center;
    padding: 14px 16px; border-radius: 14px; text-decoration: none !important;
    background: var(--ui-surface); border: 1px solid var(--ui-border); color: var(--ui-text) !important;
    transition: border-color .15s, box-shadow .15s, transform .15s;
}
.hp-tile:hover { border-color: var(--ui-primary); box-shadow: var(--ui-shadow); transform: translateY(-1px); }
.hp-tile > .bi {
    grid-row: 1 / 3; width: 40px; height: 40px; border-radius: 11px; display: flex; align-items: center; justify-content: center;
    font-size: 19px; background: var(--ui-primary-soft); color: var(--ui-primary);
}
.hp-tile:nth-child(3n+2) > .bi { background: var(--ui-accent-soft); color: var(--ui-accent); }
.hp-tile b { font-size: 14.5px; font-weight: 650; line-height: 1.3; }
.hp-tile small { font-size: 12.5px; color: var(--ui-muted); line-height: 1.3; }

.hp-caps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.hp-cap {
    display: flex; flex-direction: column; padding: 18px; border-radius: 16px; text-decoration: none !important;
    background: var(--ui-surface); border: 1px solid var(--ui-border); color: var(--ui-text) !important;
    transition: border-color .15s, box-shadow .15s;
}
.hp-cap:hover { border-color: var(--ui-border-strong); box-shadow: var(--ui-shadow); }
.hp-cap__img {
    height: 140px; border-radius: 12px; margin-bottom: 14px; background: #fff;
    display: flex; align-items: center; justify-content: center; overflow: hidden; box-shadow: inset 0 0 0 1px var(--ui-border);
}
.hp-cap__img img { max-width: 80%; max-height: 120px; object-fit: contain; }
.hp-cap h3 { font-size: 16.5px; font-weight: 700; margin: 0 0 8px; }
.hp-cap ul { margin: 0 0 14px; padding-left: 18px; color: var(--ui-text-2); font-size: 14px; line-height: 1.75; flex: 1 1 auto; }
.hp-cap__more { font-size: 13.5px; font-weight: 600; color: var(--ui-primary); }
.hp-cap:hover .hp-cap__more .bi { transform: translateX(3px); }
.hp-cap__more .bi { display: inline-block; transition: transform .15s; }

.hp-vision {
    display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 28px; align-items: center;
    padding: 28px; border-radius: 18px; background: var(--ui-surface); border: 1px solid var(--ui-border);
}
.hp-vision p { color: var(--ui-text-2); line-height: 1.8; font-size: 15px; text-align: justify; margin: 12px 0 0; }
.hp-vision p b { color: var(--ui-primary); }
.hp-vision__goal {
    display: flex; gap: 10px; padding: 12px 14px; border-radius: 12px;
    background: var(--ui-primary-soft); color: var(--ui-text) !important; font-weight: 600;
}
.hp-vision__goal .bi { color: var(--ui-primary); margin-top: 3px; }
.hp-vision__fig { margin: 0; }
.hp-vision__fig img { width: 100%; height: auto; border-radius: 12px; background: #fff; box-shadow: inset 0 0 0 1px var(--ui-border); }
.hp-vision__fig figcaption { font-size: 12.5px; color: var(--ui-muted); text-align: center; margin-top: 8px; }

@media (max-width: 1099.98px) {
    .hp-caps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .hp-vision { grid-template-columns: 1fr; }
}
@media (max-width: 767.98px) {
    .hp { padding-top: 14px; }
    .hp-hero { grid-template-columns: 1fr; padding: 26px 20px; gap: 8px; border-radius: 16px; }
    .hp-hero__art { display: none; }
    .hp-lead { font-size: 15px; }
    .hp-title { font-size: 24px; }
    .hp-cta .ui-btn { flex: 1 1 auto; }
    .hp-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .hp-stat { padding: 12px 14px; }
    .hp-stat b { font-size: 21px; }
    .hp-section { margin-top: 26px; }
    .hp-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .hp-tile { grid-template-columns: 1fr; row-gap: 6px; padding: 12px; }
    .hp-tile > .bi { grid-row: auto; width: 34px; height: 34px; font-size: 16px; }
    .hp-caps { grid-template-columns: 1fr; }
    .hp-vision { padding: 18px; }
}

/* 首页通知弹框（新版） */
.hp-notice.notice-overlay {
    position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center;
    background: var(--ui-scrim); transition: opacity .3s; padding: 16px;
}
.hp-notice .notice-modal {
    position: relative; width: 100%; max-width: 520px; padding: 28px 28px 20px; border-radius: 18px;
    background: var(--ui-surface); color: var(--ui-text); border: 1px solid var(--ui-border); box-shadow: var(--ui-shadow-lg);
    animation: hpSlide .3s ease-out;
}
@keyframes hpSlide { from { transform: translateY(-24px); opacity: 0; } to { transform: none; opacity: 1; } }
.hp-notice__icon {
    width: 46px; height: 46px; border-radius: 13px; display: flex; align-items: center; justify-content: center;
    background: var(--ui-primary-soft); color: var(--ui-primary); font-size: 22px; margin-bottom: 12px;
}
.hp-notice h3 { font-size: 20px; font-weight: 700; margin: 0 0 10px; }
.hp-notice p { color: var(--ui-text-2); line-height: 1.7; margin: 0 0 10px; }
.hp-notice .hp-notice__lead { color: var(--ui-text); }
.hp-notice__muted { font-size: 13px; color: var(--ui-muted) !important; }
.hp-notice__link a { font-weight: 600; word-break: break-all; }
.hp-notice__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--ui-border); }
.hp-notice .notice-countdown { font-size: 13px; color: var(--ui-muted); }
.hp-notice .notice-close {
    position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; border-radius: 9px; border: 0;
    background: transparent; color: var(--ui-muted); font-size: 16px; cursor: pointer;
}
.hp-notice .notice-close:hover { background: var(--ui-surface-3); color: var(--ui-text); }
/* =====================================================================
   Bootstrap 4 组件换肤（两套主题共用变量）
   ===================================================================== */
:where(body.ui-modern) h1, :where(body.ui-modern) h2, :where(body.ui-modern) h3,
:where(body.ui-modern) h4, :where(body.ui-modern) h5, :where(body.ui-modern) h6 { color: inherit; }
:where(body.ui-modern) hr { border-top-color: var(--ui-border); }
:where(body.ui-modern) .text-muted { color: var(--ui-muted) !important; }
:where(body.ui-modern) .text-dark { color: var(--ui-text) !important; }
:where(body.ui-modern) .border, :where(body.ui-modern) .border-top, :where(body.ui-modern) .border-bottom,
:where(body.ui-modern) .border-left, :where(body.ui-modern) .border-right { border-color: var(--ui-border) !important; }

/* 按钮 */
:where(body.ui-modern) .btn { border-radius: 8px; font-weight: 500; }
:where(body.ui-modern) .btn-primary { background-color: var(--ui-primary); border-color: var(--ui-primary); color: var(--ui-primary-text); }
:where(body.ui-modern) .btn-primary:hover, :where(body.ui-modern) .btn-primary:focus { background-color: var(--ui-primary-hover); border-color: var(--ui-primary-hover); color: var(--ui-primary-text); }
:where(body.ui-modern) .btn-outline-primary { color: var(--ui-primary); border-color: var(--ui-primary); }
:where(body.ui-modern) .btn-outline-primary:hover { background: var(--ui-primary); color: var(--ui-primary-text); }
:where(body.ui-modern) .btn-light, :where(body.ui-modern) .btn-outline-secondary {
    background: var(--ui-surface); border-color: var(--ui-border-strong); color: var(--ui-text);
}
:where(body.ui-modern) .btn-light:hover, :where(body.ui-modern) .btn-outline-secondary:hover { background: var(--ui-surface-3); color: var(--ui-text); }
:where(body.ui-modern) .btn-link { color: var(--ui-link); }
:where(body.ui-modern) .btn:focus, :where(body.ui-modern) .btn.focus { box-shadow: var(--ui-focus); }

/* 表单 */
:where(body.ui-modern) .form-control, :where(body.ui-modern) .custom-select {
    border-radius: 8px; border-color: var(--ui-border-strong);
    background-color: var(--ui-surface); color: var(--ui-text);
}
:where(body.ui-modern) .form-control::placeholder { color: var(--ui-muted); opacity: 1; }
:where(body.ui-modern) .form-control:focus, :where(body.ui-modern) .custom-select:focus {
    border-color: var(--ui-primary); box-shadow: var(--ui-focus); background-color: var(--ui-surface); color: var(--ui-text);
}
:where(body.ui-modern) .form-control:disabled, :where(body.ui-modern) .form-control[readonly] { background-color: var(--ui-surface-3); }
:where(body.ui-modern) .input-group-text { background: var(--ui-surface-3); border-color: var(--ui-border-strong); color: var(--ui-text-2); }

/* 卡片 / 列表 / 巨幕 */
:where(body.ui-modern) .card { background-color: var(--ui-surface); border-color: var(--ui-border); border-radius: 12px; }
:where(body.ui-modern) .card-header, :where(body.ui-modern) .card-footer { background-color: var(--ui-surface-2); border-color: var(--ui-border); }
:where(body.ui-modern) .list-group-item { background-color: var(--ui-surface); border-color: var(--ui-border); color: var(--ui-text); }
:where(body.ui-modern) .list-group-item-action:hover { background-color: var(--ui-surface-3); color: var(--ui-text); }
:where(body.ui-modern) .list-group-item.active { background-color: var(--ui-primary); border-color: var(--ui-primary); color: var(--ui-primary-text); }
:where(body.ui-modern) .jumbotron { background-color: var(--ui-surface); border: 1px solid var(--ui-border); border-radius: 14px; }

/* 表格 */
:where(body.ui-modern) .table { color: var(--ui-text); }
:where(body.ui-modern) .table th, :where(body.ui-modern) .table td, :where(body.ui-modern) .table thead th { border-color: var(--ui-border); }
:where(body.ui-modern) .table thead th { color: var(--ui-text-2); }
:where(body.ui-modern) .table-bordered, :where(body.ui-modern) .table-bordered th, :where(body.ui-modern) .table-bordered td { border-color: var(--ui-border); }
:where(body.ui-modern) .table-striped tbody tr:nth-of-type(odd) { background-color: var(--ui-surface-2); }
:where(body.ui-modern) .table-hover tbody tr:hover { background-color: var(--ui-surface-3); color: var(--ui-text); }
:where(body.ui-modern) .thead-light th, :where(body.ui-modern) .table-light, :where(body.ui-modern) .table-light > td, :where(body.ui-modern) .table-light > th {
    background-color: var(--ui-surface-3); color: var(--ui-text); border-color: var(--ui-border);
}

/* 分页 / 面包屑 / 标签页 */
:where(body.ui-modern) .page-link { background-color: var(--ui-surface); border-color: var(--ui-border); color: var(--ui-link); }
:where(body.ui-modern) .page-link:hover { background-color: var(--ui-surface-3); border-color: var(--ui-border); }
:where(body.ui-modern) .page-item.active .page-link { background-color: var(--ui-primary); border-color: var(--ui-primary); color: var(--ui-primary-text); }
:where(body.ui-modern) .page-item.disabled .page-link { background-color: var(--ui-surface-2); color: var(--ui-muted); border-color: var(--ui-border); }
:where(body.ui-modern) .breadcrumb { background-color: var(--ui-surface-3); border-radius: 10px; }
:where(body.ui-modern) .breadcrumb-item.active, :where(body.ui-modern) .breadcrumb-item + .breadcrumb-item::before { color: var(--ui-muted); }
:where(body.ui-modern) .nav-tabs { border-bottom-color: var(--ui-border); }
:where(body.ui-modern) .nav-tabs .nav-link.active, :where(body.ui-modern) .nav-tabs .nav-item.show .nav-link {
    background-color: var(--ui-surface); color: var(--ui-text); border-color: var(--ui-border) var(--ui-border) var(--ui-surface);
}
:where(body.ui-modern) .nav-tabs .nav-link:hover { border-color: var(--ui-border); }
:where(body.ui-modern) .nav-pills .nav-link.active { background-color: var(--ui-primary); color: var(--ui-primary-text); }

/* 弹层 */
:where(body.ui-modern) .dropdown-menu {
    background-color: var(--ui-surface); border-color: var(--ui-border); border-radius: 10px; box-shadow: var(--ui-shadow-lg); color: var(--ui-text);
}
:where(body.ui-modern) .dropdown-item { color: var(--ui-text); }
:where(body.ui-modern) .dropdown-item:hover, :where(body.ui-modern) .dropdown-item:focus { background-color: var(--ui-surface-3); color: var(--ui-text); }
:where(body.ui-modern) .dropdown-divider { border-top-color: var(--ui-border); }
:where(body.ui-modern) .modal-content { background-color: var(--ui-surface); color: var(--ui-text); border-color: var(--ui-border); border-radius: 14px; }
:where(body.ui-modern) .modal-header, :where(body.ui-modern) .modal-footer { border-color: var(--ui-border); }
:where(body.ui-modern) .close { color: var(--ui-text); text-shadow: none; }
:where(body.ui-modern) .popover { background-color: var(--ui-surface); border-color: var(--ui-border); }
:where(body.ui-modern) .popover-body { color: var(--ui-text); }

/* 提示 / 徽章 */
:where(body.ui-modern) .alert { border-radius: 10px; }
:where(body.ui-modern) .badge { font-weight: 600; border-radius: 6px; }
:where(body.ui-modern) .badge-primary { background-color: var(--ui-primary); color: var(--ui-primary-text); }

/* 代码 */
:where(body.ui-modern) code { color: #c7254e; }
:where(html[data-theme="dark"] body.ui-modern) code { color: #f29bb4; }

/* ---------- 深色主题：仅深色下需要的补丁 ---------- */
:where(html[data-theme="dark"] body.ui-modern) .bg-white,
:where(html[data-theme="dark"] body.ui-modern) .bg-light { background-color: var(--ui-surface) !important; }
:where(html[data-theme="dark"] body.ui-modern) .text-black-50 { color: var(--ui-muted) !important; }
:where(html[data-theme="dark"] body.ui-modern) .text-body { color: var(--ui-text) !important; }
:where(html[data-theme="dark"] body.ui-modern) .table-dark { background-color: var(--ui-surface-3); }
:where(html[data-theme="dark"] body.ui-modern) .alert-primary { background: var(--ui-primary-soft); border-color: #2a3e66; color: #b9cdf7; }
:where(html[data-theme="dark"] body.ui-modern) .alert-info { background: var(--ui-info-soft); border-color: #24495a; color: #a9d8ea; }
:where(html[data-theme="dark"] body.ui-modern) .alert-success { background: var(--ui-success-soft); border-color: #22533a; color: #a6e3bf; }
:where(html[data-theme="dark"] body.ui-modern) .alert-warning { background: var(--ui-warning-soft); border-color: #5a4720; color: #f3d39b; }
:where(html[data-theme="dark"] body.ui-modern) .alert-danger { background: var(--ui-danger-soft); border-color: #5a2a2e; color: #f5b5b5; }
:where(html[data-theme="dark"] body.ui-modern) .alert-secondary, :where(html[data-theme="dark"] body.ui-modern) .alert-light {
    background: var(--ui-surface-3); border-color: var(--ui-border); color: var(--ui-text);
}
:where(html[data-theme="dark"] body.ui-modern) .badge-light, :where(html[data-theme="dark"] body.ui-modern) .badge-secondary {
    background: var(--ui-surface-3); color: var(--ui-text);
}
:where(html[data-theme="dark"] body.ui-modern) .table-primary, :where(html[data-theme="dark"] body.ui-modern) .table-primary > td { background-color: #1c2a45; }
:where(html[data-theme="dark"] body.ui-modern) .table-success, :where(html[data-theme="dark"] body.ui-modern) .table-success > td { background-color: #183327; }
:where(html[data-theme="dark"] body.ui-modern) .table-warning, :where(html[data-theme="dark"] body.ui-modern) .table-warning > td { background-color: #3a2e17; }
:where(html[data-theme="dark"] body.ui-modern) .table-danger, :where(html[data-theme="dark"] body.ui-modern) .table-danger > td { background-color: #3a1f22; }
:where(html[data-theme="dark"] body.ui-modern) .table-info, :where(html[data-theme="dark"] body.ui-modern) .table-info > td { background-color: #17303b; }
:where(html[data-theme="dark"] body.ui-modern) .table-secondary, :where(html[data-theme="dark"] body.ui-modern) .table-active,
:where(html[data-theme="dark"] body.ui-modern) .table-secondary > td { background-color: var(--ui-surface-3); }
:where(html[data-theme="dark"] body.ui-modern) .btn-dark { background: #e4e8ee; border-color: #e4e8ee; color: #0e1218; }
:where(html[data-theme="dark"] body.ui-modern) .btn-outline-dark { color: var(--ui-text); border-color: var(--ui-border-strong); }
:where(html[data-theme="dark"] body.ui-modern) .btn-outline-dark:hover { background: var(--ui-surface-3); }
:where(html[data-theme="dark"] body.ui-modern) select option { background: var(--ui-surface); color: var(--ui-text); }
:where(html[data-theme="dark"] body.ui-modern) img:not([src$=".svg"]) { filter: brightness(.94); }
:where(html[data-theme="dark"] body.ui-modern) .layui-layer { background-color: var(--ui-surface); color: var(--ui-text); }
:where(html[data-theme="dark"] body.ui-modern) .layui-layer-title { background-color: var(--ui-surface-2); color: var(--ui-text); border-bottom-color: var(--ui-border); }
:where(html[data-theme="dark"] body.ui-modern) ::-webkit-scrollbar { width: 10px; height: 10px; }
:where(html[data-theme="dark"] body.ui-modern) ::-webkit-scrollbar-thumb { background: #333b48; border-radius: 6px; }
:where(html[data-theme="dark"] body.ui-modern) ::-webkit-scrollbar-track { background: transparent; }

/* mtc-ui.js 的「深色适配器」标记：旧页面里写死的白底容器 → 深色表面 */
html[data-theme="dark"] .ui-auto-surface { background-color: var(--ui-surface) !important; border-color: var(--ui-border) !important; }
html[data-theme="dark"] .ui-auto-surface-grad { background-image: none !important; background-color: var(--ui-surface) !important; }
html[data-theme="dark"] #content > .ui-auto-surface-grad, html[data-theme="dark"] #content > * > .ui-auto-surface-grad { background-color: var(--ui-bg) !important; }
/* 个人资料页（templates/userprofile/edit.html）头部白色弧形 */
html[data-theme="dark"] body.ui-modern .profile-header::before { background: var(--ui-surface); }
html[data-theme="dark"] body.ui-modern .profile-avatar, html[data-theme="dark"] body.ui-modern .profile-avatar-placeholder { border-color: var(--ui-surface); }
html[data-theme="dark"] .ui-auto-surface-2 { background-color: var(--ui-surface-2) !important; border-color: var(--ui-border) !important; }

@media (prefers-reduced-motion: reduce) {
    .ui-drawer, .ui-scrim, .ui-dd__panel, .ui-caret { transition: none !important; }
}
@media print {
    .ui-topbar, .ui-drawer, .ui-scrim, .ui-footer, .ui-skip { display: none !important; }
    :where(body.ui-modern) { background: #fff; color: #000; }
}
