:root {
    --ink: #14345f;
    --ink-2: #4a6b96;
    --ink-3: #7b97ba;
    --blue: #2f7bff;
    --blue-deep: #1652d6;
    --green: #12a37f;
    --green-deep: #0d8a6a;
    --danger: #e2523f;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
    color: var(--ink);
    background: linear-gradient(152deg, #f3f8ff 0%, #dfeaff 42%, #eaf4ff 100%);
    -webkit-font-smoothing: antialiased;
}

.bg-deco {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(760px 420px at 8% -8%, rgba(120, 190, 255, 0.4), transparent 62%),
        radial-gradient(700px 400px at 96% 2%, rgba(150, 200, 255, 0.35), transparent 60%);
}

.app {
    position: relative;
    max-width: 1680px;
    margin: 0 auto;
    padding: 24px 28px 48px;
}

/* ---------- topbar ---------- */
.topbar {
    display: flex;
    align-items: center;
    gap: 26px;
    padding: 2px 4px 18px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 13px;
    flex-shrink: 0;
}

.brand-mark {
    width: 6px;
    height: 40px;
    border-radius: 4px;
    background: linear-gradient(180deg, #6fc3ff, #2f7bff);
    box-shadow: 0 0 16px rgba(47, 123, 255, 0.45);
}

.brand h1 {
    font-size: 21px;
    letter-spacing: 1px;
    color: #123a72;
}

.brand p {
    margin-top: 3px;
    font-size: 12px;
    color: var(--ink-3);
}

.search-box {
    position: relative;
    flex: 1;
    max-width: 620px;
}

.search-box svg {
    position: absolute;
    left: 14px;
    top: 50%;
    width: 17px;
    height: 17px;
    transform: translateY(-50%);
    stroke: var(--ink-3);
    stroke-width: 2;
    fill: none;
    stroke-linecap: round;
    pointer-events: none;
}

.search-box input {
    width: 100%;
    padding: 12px 16px 12px 41px;
    border-radius: 10px;
    border: 1px solid rgba(47, 123, 255, 0.22);
    background: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    font-family: inherit;
    color: var(--ink);
    outline: none;
    transition: border 0.2s, box-shadow 0.2s;
}

.search-box input:focus {
    border-color: rgba(47, 123, 255, 0.55);
    box-shadow: 0 0 0 3px rgba(47, 123, 255, 0.12);
}

.topbar-actions {
    display: flex;
    gap: 10px;
    margin-left: auto;
    flex-shrink: 0;
}

.btn {
    padding: 9px 18px;
    border-radius: 9px;
    border: 1px solid rgba(47, 123, 255, 0.28);
    background: #fff;
    color: var(--blue-deep);
    font-size: 13.5px;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.15s, box-shadow 0.2s, background 0.2s;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(47, 123, 255, 0.18);
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn.ghost {
    padding: 8px 16px;
    font-size: 13px;
}

/* ---------- 两栏布局 ---------- */
.layout {
    display: grid;
    grid-template-columns: 272px minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

/* ---------- 左栏 ---------- */
.sidebar {
    position: sticky;
    top: 18px;
    max-height: calc(100vh - 36px);
    display: flex;
    flex-direction: column;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.92);
    box-shadow: 0 12px 28px rgba(31, 91, 191, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.9);
    overflow: hidden;
}

.side-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 18px 18px 12px;
    border-bottom: 1px solid rgba(47, 123, 255, 0.1);
}

.side-head h2 {
    font-size: 15px;
    color: #123a72;
    letter-spacing: 0.5px;
}

.side-head span {
    font-size: 12px;
    color: var(--ink-3);
    font-variant-numeric: tabular-nums;
}

.side-list {
    padding: 10px;
    overflow: auto;
}

.s-item,
.s-sub {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    border: 0;
    background: transparent;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.16s, color 0.16s;
}

.s-item {
    padding: 10px 12px;
    border-radius: 9px;
    font-size: 14px;
    color: var(--ink-2);
}

.s-item:hover {
    background: rgba(47, 123, 255, 0.07);
    color: var(--blue-deep);
}

.s-item.active {
    background: linear-gradient(135deg, #5b9dff, #2f6bff 62%, #1652d6);
    color: #fff;
    box-shadow: 0 8px 18px rgba(47, 107, 255, 0.26);
}

.s-item b {
    font-size: 12.5px;
    font-weight: 600;
    opacity: 0.8;
    font-variant-numeric: tabular-nums;
}

.s-group {
    margin-bottom: 2px;
}

.s-subs {
    display: flex;
    flex-direction: column;
    gap: 1px;
    margin: 2px 0 8px 14px;
    padding-left: 8px;
    border-left: 2px solid rgba(47, 123, 255, 0.12);
}

.s-sub {
    padding: 7px 10px;
    border-radius: 7px;
    font-size: 12.5px;
    color: var(--ink-3);
}

.s-sub:hover {
    background: rgba(47, 123, 255, 0.07);
    color: var(--blue-deep);
}

.s-sub.active {
    background: rgba(47, 123, 255, 0.13);
    color: var(--blue-deep);
    font-weight: 600;
}

/* 国标系列（第三层） */
.s-series {
    display: flex;
    flex-direction: column;
    gap: 1px;
    margin: 1px 0 4px 6px;
    padding-left: 6px;
    border-left: 2px dashed rgba(47, 123, 255, 0.16);
}

.s-sub-deep {
    padding: 6px 10px;
    font-size: 12px;
}

.side-foot {
    padding: 12px 18px 16px;
    border-top: 1px solid rgba(47, 123, 255, 0.1);
    font-size: 11.5px;
    color: var(--ink-3);
}

/* ---------- 右侧 ---------- */
.main {
    min-width: 0;
}

/* 最近发布 / 最近实施 / 最近废止 */
.tabbar {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    margin-top: 18px;
    border-bottom: 2px solid rgba(47, 123, 255, 0.16);
}

.tab {
    position: relative;
    margin-bottom: -2px;
    padding: 11px 26px;
    border: 0;
    border-radius: 9px 9px 0 0;
    background: transparent;
    font-family: inherit;
    font-size: 13px;
    color: var(--ink-2);
    cursor: pointer;
    transition: background 0.18s, color 0.18s;
}

.tab:hover {
    color: var(--blue-deep);
    background: rgba(47, 123, 255, 0.07);
}

.tab.active {
    color: #fff;
    font-weight: 600;
    background: linear-gradient(135deg, #59a0ff, #2f6bff 70%);
    box-shadow: 0 -3px 14px rgba(47, 107, 255, 0.3);
}

/* 标签上的数量 */
.tab b {
    margin-left: 5px;
    font-size: 10.5px;
    font-weight: 600;
    color: inherit;
    opacity: 0.72;
    font-variant-numeric: tabular-nums;
}

/* 标准状态多选 */
.filterbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.92);
    box-shadow: 0 8px 20px rgba(31, 91, 191, 0.07);
}

/* 排序控件 */
.sortbox {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    white-space: nowrap;
}

.sort-label {
    font-size: 12.5px;
    color: var(--ink-3);
}

/* 排序：两个按钮切换维度，点当前按钮翻转升降 */
.sort-tabs {
    display: flex;
    gap: 2px;
    padding: 3px;
    border-radius: 9px;
    background: rgba(47, 123, 255, 0.08);
}

.sort-tab {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 6px 13px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    font-family: inherit;
    font-size: 13px;
    color: var(--ink-2);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.16s, color 0.16s, box-shadow 0.16s;
}

.sort-tab:hover {
    color: var(--blue-deep);
}

.sort-tab.active {
    background: #fff;
    color: var(--blue-deep);
    font-weight: 600;
    box-shadow: 0 3px 9px rgba(31, 91, 191, 0.14);
}

.sort-tab .dir {
    font-size: 11px;
    font-style: normal;
    line-height: 1;
    opacity: 0.85;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.st-chip {
    padding: 7px 17px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    font-family: inherit;
    font-size: 15px;
    color: var(--ink-2);
    cursor: pointer;
    transition: all 0.16s;
}

.st-chip:hover {
    background: rgba(47, 123, 255, 0.09);
    color: var(--blue-deep);
}

.st-chip.active {
    color: #fff;
    background: linear-gradient(135deg, #59a0ff, #2f6bff 70%);
    box-shadow: 0 6px 14px rgba(47, 107, 255, 0.26);
}

.st-chip b {
    margin-left: 5px;
    font-size: 13px;
    font-weight: 600;
    opacity: 0.9;
    font-variant-numeric: tabular-nums;
}

.st-chip.disabled {
    opacity: 0.35;
    pointer-events: none;
}

.filter-hint {
    margin-left: auto;
    align-self: center;
    padding-bottom: 9px;
    font-size: 12px;
    color: var(--ink-3);
    white-space: nowrap;
}

/* 结果条 */
.resultbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 16px 2px 10px;
}

.result-count {
    font-size: 13px;
    color: var(--ink-2);
    font-variant-numeric: tabular-nums;
}

.result-count b {
    color: var(--blue-deep);
    font-size: 17px;
    margin-right: 3px;
}

.result-summary {
    font-size: 12.5px;
    color: var(--ink-3);
    text-align: right;
}

/* 列表 */
.list {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 20px;
    padding: 14px 18px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.95);
    box-shadow: 0 8px 20px rgba(31, 91, 191, 0.06);
    transition: transform 0.15s, box-shadow 0.2s, border-color 0.2s;
}

.row:hover {
    transform: translateY(-1px);
    border-color: rgba(47, 123, 255, 0.32);
    box-shadow: 0 14px 28px rgba(31, 91, 191, 0.13);
}

.row-code {
    font-size: 13px;
    font-weight: 700;
    color: var(--blue-deep);
    letter-spacing: 0.3px;
    font-variant-numeric: tabular-nums;
}

.row-code span {
    font-weight: 400;
    font-size: 12px;
    color: var(--ink-3);
    margin-left: 8px;
}

.row-name {
    margin-top: 5px;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.45;
    color: var(--ink);
}

.row-name.muted {
    color: var(--ink-3);
    font-weight: 400;
}

.row-sub {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    margin-top: 7px;
    font-size: 12px;
    color: var(--ink-3);
}

.row-sub i {
    font-style: normal;
    color: #a8bcd6;
}

.row-sub .file-none {
    color: #b6bfcc;
}

.row-sub .file-link {
    color: #1f5fa8;
    text-decoration: none;
    border-bottom: 1px solid rgba(31, 95, 168, 0.35);
    padding-bottom: 1px;
}

.row-sub .file-link:hover {
    color: #0d3f7a;
    border-bottom-color: #0d3f7a;
}

.row-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 9px;
    min-width: 216px;
}

.row-tags {
    display: flex;
    gap: 6px;
}

.row-dates {
    font-size: 12px;
    color: var(--ink-3);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.row-dates .hot {
    color: var(--blue-deep);
    font-weight: 700;
}

.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 11.5px;
    white-space: nowrap;
    border: 1px solid transparent;
}

.badge.lv {
    color: #2f6bff;
    background: rgba(47, 123, 255, 0.09);
    border-color: rgba(47, 123, 255, 0.24);
}

.badge.ok {
    color: #0d8a6a;
    background: rgba(18, 163, 127, 0.1);
    border-color: rgba(18, 163, 127, 0.3);
}

.badge.dead {
    color: var(--danger);
    background: rgba(226, 82, 63, 0.09);
    border-color: rgba(226, 82, 63, 0.26);
}

.badge.soon {
    color: #b06a00;
    background: rgba(240, 160, 32, 0.12);
    border-color: rgba(240, 160, 32, 0.32);
}

.badge.unknown {
    color: var(--ink-3);
    background: rgba(123, 151, 186, 0.1);
    border-color: rgba(123, 151, 186, 0.28);
}

.badge.flag {
    color: #7b5bd6;
    background: rgba(123, 91, 214, 0.09);
    border-color: rgba(123, 91, 214, 0.26);
}

.badge.review {
    color: #b06a00;
    background: rgba(240, 160, 32, 0.14);
    border-color: rgba(240, 160, 32, 0.4);
    font-weight: 600;
}

.review-chip {
    margin-left: 10px;
    border: 1px dashed rgba(240, 160, 32, 0.55);
    color: #b06a00;
}

.review-chip.active {
    color: #fff;
    border-color: transparent;
    background: linear-gradient(135deg, #f0a020, #d9820a 70%);
    box-shadow: 0 6px 14px rgba(217, 130, 10, 0.26);
}

/* 空状态 / 分页 */
.empty {
    display: none;
    padding: 70px 0;
    text-align: center;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.6);
    border: 1px dashed rgba(47, 123, 255, 0.22);
}

.empty.show {
    display: block;
}

.empty p {
    font-size: 15px;
    color: var(--ink-2);
}

.empty span {
    display: block;
    margin-top: 8px;
    font-size: 12.5px;
    color: var(--ink-3);
}

.pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 18px;
}

.page-info {
    font-size: 13px;
    color: var(--ink-2);
    font-variant-numeric: tabular-nums;
    margin-left: 6px;
}

/* 中间页码下拉 */
.page-select {
    height: 34px;
    min-width: 104px;
    padding: 0 26px 0 12px;
    border-radius: 9px;
    border: 1px solid rgba(47, 123, 255, 0.28);
    background: #fff url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232f6bff' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 8px center / 12px 12px;
    font-family: inherit;
    font-size: 13px;
    color: var(--blue-deep);
    font-variant-numeric: tabular-nums;
    text-align: left;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    outline: none;
    transition: border-color 0.16s;
}

.page-select:hover,
.page-select:focus {
    border-color: rgba(47, 123, 255, 0.55);
}

/* ---------- 响应式 ---------- */
@media (max-width: 1180px) {
    .layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        max-height: none;
    }
}

/* 只看有文件 */
.file-chip {
    margin-left: 10px;
    border: 1px dashed rgba(47, 123, 255, 0.5);
    color: #2f7bff;
}

.file-chip.active {
    color: #fff;
    border-color: transparent;
    background: linear-gradient(135deg, #2f7bff, #1a5fd8 70%);
    box-shadow: 0 6px 14px rgba(47, 123, 255, 0.26);
}

/* 文件预览弹层 */
.viewer {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999;
    background: rgba(12, 22, 38, 0.62);
    backdrop-filter: blur(2px);
    padding: 26px;
}

.viewer.show {
    display: flex;
    align-items: stretch;
    justify-content: center;
}

.viewer-panel {
    display: flex;
    flex-direction: column;
    width: min(1180px, 100%);
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(8, 18, 34, 0.4);
}

.viewer-bar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 14px;
    background: #1f4e79;
    color: #fff;
    font-size: 13px;
}

.viewer-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.viewer-acts {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: none;
}

.viewer-acts a,
.viewer-acts button {
    font-size: 12.5px;
    color: #fff;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    padding: 4px 10px;
    cursor: pointer;
    text-decoration: none;
}

.viewer-acts a:hover,
.viewer-acts button:hover {
    background: rgba(255, 255, 255, 0.3);
}

#viewerFrame {
    flex: 1;
    width: 100%;
    border: 0;
    background: #eef1f6;
}

.viewer-tip {
    display: none;
    padding: 70px 24px;
    text-align: center;
    color: #555;
    font-size: 14px;
}

.viewer-hint {
    display: none;
    padding: 7px 14px;
    font-size: 12.5px;
    color: #7a5c1e;
    background: #fff8e6;
    border-bottom: 1px solid #f0e0bb;
}

.viewer-acts .primary {
    background: #ffb02e;
    border-color: #ffb02e;
    color: #3a2a05;
    font-weight: 600;
}

.viewer-acts .primary:hover {
    background: #ffc157;
}

/* 缺文件 */
.miss-chip {
    margin-left: 8px;
    border: 1px dashed rgba(214, 132, 90, 0.6);
    color: #b4623a;
}

.miss-chip.active {
    color: #fff;
    border-color: transparent;
    background: linear-gradient(135deg, #d98457, #c26a3c 70%);
    box-shadow: 0 6px 14px rgba(194, 106, 60, 0.26);
}

/* 名称即入口：有文件时名称可点 */
.row-name .name-link {
    color: inherit;
    text-decoration: none;
    display: inline;
}

.row-name .name-link:hover {
    color: #2f7bff;
}

.row-name .name-btn {
    display: inline-block;
    margin-left: 8px;
    padding: 0 7px;
    font-size: 11.5px;
    font-style: normal;
    line-height: 18px;
    vertical-align: 1px;
    color: #2f7bff;
    background: rgba(47, 123, 255, 0.1);
    border: 1px solid rgba(47, 123, 255, 0.32);
    border-radius: 5px;
    transition: all .15s;
}

.row-name .name-link:hover .name-btn {
    color: #fff;
    background: #2f7bff;
    border-color: #2f7bff;
}

/* 公网查询版：原文不在本机，按钮不可点，只作标记 */
.row-name .name-btn.off {
    color: #8a94a6;
    background: rgba(138, 148, 166, 0.1);
    border-color: rgba(138, 148, 166, 0.28);
}

/* 公网查询版顶部说明条 */
.local-tip {
    display: block;
    margin: 0 0 16px;
    padding: 10px 16px;
    font-size: 13px;
    line-height: 1.7;
    color: #8a5a00;
    background: rgba(255, 176, 32, 0.13);
    border: 1px solid rgba(255, 176, 32, 0.38);
    border-radius: 9px;
}

.local-tip b {
    color: #a86a00;
    margin-right: 2px;
}

.local-tip a {
    margin-left: 6px;
    color: #a86a00;
    text-decoration: underline;
    white-space: nowrap;
}

/* ================= 手机 / 窄屏 ================= */
.side-toggle {
    display: none;
}

@media (max-width: 820px) {
    .app {
        padding: 10px 10px 30px;
    }

    .topbar {
        flex-wrap: wrap;
        gap: 10px;
        padding: 12px 14px;
    }

    .brand h1 {
        font-size: 18px;
    }

    .brand p {
        font-size: 12px;
    }

    .search-box {
        width: 100%;
    }

    .layout {
        display: block;
    }

    /* 分类默认收起，点「分类」展开 */
    .sidebar {
        display: none;
        margin-bottom: 10px;
    }

    .sidebar.open {
        display: flex;
        position: static;
        max-height: 52vh;
    }

    .side-toggle {
        display: inline-flex;
    }

    .side-toggle.active {
        color: #fff;
        border-color: transparent;
        background: linear-gradient(135deg, #2f7bff, #1a5fd8 70%);
    }

    .filterbar {
        flex-wrap: wrap;
        gap: 8px;
        padding: 9px 11px;
    }

    .chips {
        flex-wrap: wrap;
        gap: 6px;
    }

    .st-chip,
    .review-chip,
    .file-chip,
    .miss-chip {
        margin-left: 0;
        padding: 5px 9px;
        font-size: 12px;
    }

    .sortbox {
        margin-left: 0;
        width: 100%;
        justify-content: space-between;
    }

    .tabbar {
        overflow-x: auto;
        white-space: nowrap;
    }

    .resultbar {
        flex-wrap: wrap;
        gap: 4px;
    }

    .row {
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 12px 13px;
    }

    .row-code {
        font-size: 15px;
        flex-wrap: wrap;
        gap: 6px;
    }

    .row-name {
        font-size: 14px;
        line-height: 1.5;
    }

    .row-sub {
        gap: 4px 10px;
    }

    .row-right {
        display: flex;
        align-items: center;
        gap: 10px;
        text-align: left;
    }

    .row-tags {
        justify-content: flex-start;
    }

    .row-dates {
        font-size: 12px;
    }

    .pager {
        flex-wrap: wrap;
        gap: 6px;
    }

    /* 预览弹层占满屏幕 */
    .viewer {
        padding: 0;
    }

    .viewer-panel {
        border-radius: 0;
        height: 100%;
    }

    .viewer-bar {
        padding: 8px 10px;
        font-size: 12px;
        gap: 8px;
    }

    .viewer-name {
        max-width: 40%;
    }

    .viewer-hint {
        font-size: 11.5px;
        padding: 6px 10px;
    }
}

@media (max-width: 820px) {
    html,
    body {
        overflow-x: hidden;
    }

    .topbar .search-box {
        flex: 1 1 100%;
        width: auto;
        min-width: 0;
    }

    .sortbox {
        flex-wrap: wrap;
    }

    .sort-tabs {
        flex-wrap: wrap;
        gap: 6px;
    }

    .sort-tab {
        padding: 4px 9px;
        font-size: 12px;
    }

    .tab {
        padding: 6px 10px;
        font-size: 12.5px;
    }

    .result-count {
        font-size: 15px;
    }
}

/* 窄屏防溢出：grid/flex 子项默认 min-width:auto 会把容器撑宽 */
@media (max-width: 820px) {
    .app,
    .topbar,
    .filterbar,
    .tabbar,
    .resultbar,
    .list,
    .pager,
    .row,
    .row-main,
    .row-right {
        min-width: 0;
        max-width: 100%;
    }

    .row {
        grid-template-columns: minmax(0, 1fr);
    }

    .row-name,
    .row-code,
    .row-sub,
    .row-sub span,
    .viewer-name {
        min-width: 0;
        overflow-wrap: anywhere;
    }

    .sort-tabs,
    .chips {
        min-width: 0;
    }
}

/* 窄屏：强制不横向溢出 */
@media (max-width: 820px) {
    body {
        width: 100%;
        max-width: 100%;
    }

    .app {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .filterbar {
        flex-wrap: wrap;
        gap: 8px;
    }

    .chips {
        flex: 1 1 100%;
        min-width: 0;
    }

    .sortbox {
        flex: 1 1 100%;
        min-width: 0;
        flex-wrap: wrap;
        gap: 6px;
    }

    .row-sub {
        display: flex;
        flex-wrap: wrap;
        gap: 3px 12px;
        min-width: 0;
    }

    .row-sub > span {
        display: inline-block;
        max-width: 100%;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .row-name,
    .row-name a {
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .resultbar,
    .tabbar {
        min-width: 0;
    }
}
