html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

/* 视口级不出现纵向/横向滚动；滚动交给主区或页面内表格容器 */
html {
    height: 100%;
    overflow: hidden;
}

body {
    height: 100%;
    margin: 0;
    overflow: hidden;
}

/* 移动端：与 MainLayout 中 .page 的 100dvh 对齐，避免 100% 高度链在部分浏览器失效 */
@media (max-width: 640.98px) {
    html, body {
        height: 100vh;
        max-height: 100vh;
        height: 100dvh;
        max-height: 100dvh;
        overflow: hidden;
    }

    /* 主区滚动条略加宽，便于在触控屏上察觉可滚动 */
    main > article.content > :first-child:not(.layout-vue-page-fill)::-webkit-scrollbar {
        width: 6px;
    }
}

a, .btn-link {
    color: #006bb7;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding-top: 1.1rem;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTF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UyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* 主区/表格内滚动条细样式（视口 html 不滚动，条出现在主列首子节点或表格视口） */
main > article.content > :first-child:not(.layout-vue-page-fill),
.page-table-scroll,
.layout-vue-table-panel {
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: rgba(30, 41, 59, 0.32) transparent;
}

main > article.content > :first-child:not(.layout-vue-page-fill):hover,
.page-table-scroll:hover,
.layout-vue-table-panel:hover {
    scrollbar-color: rgba(30, 41, 59, 0.48) transparent;
}

main > article.content > :first-child:not(.layout-vue-page-fill)::-webkit-scrollbar,
.page-table-scroll::-webkit-scrollbar,
.layout-vue-table-panel::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

main > article.content > :first-child:not(.layout-vue-page-fill)::-webkit-scrollbar-track,
.page-table-scroll::-webkit-scrollbar-track,
.layout-vue-table-panel::-webkit-scrollbar-track {
    background: transparent;
}

main > article.content > :first-child:not(.layout-vue-page-fill)::-webkit-scrollbar-thumb,
.page-table-scroll::-webkit-scrollbar-thumb,
.layout-vue-table-panel::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.1), rgba(15, 23, 42, 0.26));
    border-radius: 100px;
}

main > article.content > :first-child:not(.layout-vue-page-fill)::-webkit-scrollbar-thumb:hover,
.page-table-scroll::-webkit-scrollbar-thumb:hover,
.layout-vue-table-panel::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.18), rgba(15, 23, 42, 0.4));
}

main > article.content > :first-child:not(.layout-vue-page-fill)::-webkit-scrollbar-corner,
.page-table-scroll::-webkit-scrollbar-corner,
.layout-vue-table-panel::-webkit-scrollbar-corner {
    background: transparent;
}

/* 云管理等：表格视口（横+纵滚动均在表格区域） */
.layout-vue-page-fill {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.layout-vue-page-inner {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.layout-vue-page-header,
.layout-vue-page-footer {
    flex-shrink: 0;
}

/* 列表页头部结构（桌面默认）；移动端细则见下方 @media */
.layout-vue-header-stack {
    margin-top: 30px;
}

.layout-vue-query {
    margin-bottom: 20px;
}

.layout-vue-query-form .layout-vue-query-input {
    width: 280px;
}

.layout-vue-query-tags {
    margin-top: 15px;
    padding: 10px;
    background-color: #f5f7fa;
    border-radius: 4px;
}

.layout-vue-query-tags .el-tag {
    margin-right: 8px;
    margin-bottom: 8px;
}

.layout-vue-toolbar {
    margin-bottom: 15px;
}

.layout-vue-toolbar .el-button + .el-button {
    margin-left: 10px;
}

.layout-vue-query-control {
    width: 220px;
}

.layout-vue-query-control--sm {
    width: 160px;
}

/* 折叠条仅移动端显示，由 dt-mobile-adaptive.js 注入 */
.layout-vue-query-toggle-bar {
    display: none;
}

.layout-vue-table-panel {
    flex: 1;
    min-height: 0;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    -webkit-overflow-scrolling: touch;
}

/* 表体滚动条与原先面板滚动条风格一致（表头固定后条在 el-table 内部） */
.layout-vue-table-panel .el-table__body-wrapper {
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: rgba(30, 41, 59, 0.32) transparent;
}

.layout-vue-table-panel .el-table__body-wrapper:hover {
    scrollbar-color: rgba(30, 41, 59, 0.48) transparent;
}

.layout-vue-table-panel .el-table__body-wrapper::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

.layout-vue-table-panel .el-table__body-wrapper::-webkit-scrollbar-track {
    background: transparent;
}

.layout-vue-table-panel .el-table__body-wrapper::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.1), rgba(15, 23, 42, 0.26));
    border-radius: 100px;
}

.layout-vue-table-panel .el-table__body-wrapper::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.18), rgba(15, 23, 42, 0.4));
}

.layout-vue-table-panel .el-table__body-wrapper::-webkit-scrollbar-corner {
    background: transparent;
}

/* =====================================================================
 * 全局移动端自适应（≤768px）
 * 覆盖所有 layout-vue / Element UI 列表页：表格可横向滑动、表单堆叠、抽屉全宽等。
 * 根因：fixed 操作列过宽时在窄屏几乎占满视口，主表数据列被挤出且无法滚动。
 * ===================================================================== */
@media (max-width: 768px) {
    /* 主内容区内边距收紧 */
    main > article.content {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
        padding-top: 0.75rem;
    }

    /* 列表页：整页可纵向滚动，避免表头+工具栏堆叠后表格高度被压成一条 */
    .layout-vue-page-fill,
    .layout-vue-page-inner {
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: contain;
    }

    .layout-vue-page-header {
        padding-bottom: 2px;
    }

    /* 去掉桌面端大顶距，压缩首屏占用 */
    .layout-vue-page-header .layout-vue-header-stack,
    .layout-vue-page-header > div[style*="margin-top"] {
        margin-top: 0 !important;
    }

    /* ---------- 搜索区：多条件默认可折叠，为列表腾高度 ---------- */
    .layout-vue-query,
    .layout-vue-page-header .el-card {
        margin-bottom: 8px !important;
        border-radius: 10px !important;
        border: 1px solid #ebeef5 !important;
        box-shadow: none !important;
    }

    .layout-vue-query .el-card__body,
    .layout-vue-page-header .el-card__body {
        padding: 8px 10px !important;
    }

    .layout-vue-query-toggle-bar {
        display: flex;
        align-items: center;
        width: 100%;
        gap: 8px;
        margin: 0;
        padding: 8px 4px;
        border: 0;
        background: transparent;
        color: #303133;
        font-size: 14px;
        text-align: left;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }

    .layout-vue-query-toggle-main {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        font-weight: 600;
        flex-shrink: 0;
    }

    .layout-vue-query-toggle-main .el-icon-s-operation {
        color: #409eff;
    }

    .layout-vue-query-toggle-hint {
        flex: 1 1 auto;
        min-width: 0;
        color: #909399;
        font-size: 12px;
        font-weight: 400;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .layout-vue-query-toggle-caret {
        color: #c0c4cc;
        transition: transform 0.2s ease;
        flex-shrink: 0;
    }

    .layout-vue-query.dt-query-collapsible:not(.is-collapsed) .layout-vue-query-toggle-caret {
        transform: rotate(180deg);
    }

    .layout-vue-query.dt-query-collapsible.has-active-filters .layout-vue-query-toggle-hint {
        color: #409eff;
    }

    /* 收起：只保留折叠条 + 已选标签 */
    .layout-vue-query.dt-query-collapsible.is-collapsed .el-form {
        display: none !important;
    }

    .layout-vue-query.dt-query-collapsible.is-collapsed .layout-vue-query-tags {
        margin-top: 2px;
        padding-top: 0;
    }

    .layout-vue-query.dt-query-collapsible:not(.is-collapsed) .layout-vue-query-toggle-bar {
        margin-bottom: 6px;
        padding-bottom: 8px;
        border-bottom: 1px solid #ebeef5;
    }

    /* 展开后：紧凑堆叠，控件拉满宽 */
    .layout-vue-query-form.el-form--inline,
    .layout-vue-page-header .el-form--inline {
        display: flex;
        flex-wrap: wrap;
        align-items: stretch;
        gap: 0;
    }

    .layout-vue-query-form.el-form--inline .el-form-item,
    .layout-vue-page-header .el-form--inline .el-form-item {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        margin-right: 0 !important;
        margin-bottom: 8px !important;
    }

    .layout-vue-query-form.el-form--inline .el-form-item__label,
    .layout-vue-page-header .el-form--inline .el-form-item__label {
        width: auto !important;
        text-align: left;
        line-height: 1.3;
        padding: 0 0 4px;
        float: none;
        font-size: 12px;
        color: #909399;
    }

    .layout-vue-query-form.el-form--inline .el-form-item__content,
    .layout-vue-page-header .el-form--inline .el-form-item__content {
        margin-left: 0 !important;
        line-height: normal;
        width: 100%;
    }

    .layout-vue-query-keyword .el-form-item__label {
        display: none !important;
    }

    .layout-vue-query-input,
    .layout-vue-query-input.el-input,
    .layout-vue-query-control,
    .layout-vue-query-control.el-select,
    .layout-vue-page-header .el-input,
    .layout-vue-page-header .el-select,
    .layout-vue-page-header .el-date-editor,
    .layout-vue-page-header .el-cascader {
        width: 100% !important;
        max-width: 100%;
    }

    .layout-vue-query-actions {
        width: 100%;
        margin-bottom: 0 !important;
        margin-top: 2px !important;
    }

    .layout-vue-query-actions .el-form-item__content {
        display: flex !important;
        align-items: center;
        gap: 8px;
    }

    .layout-vue-query-actions .el-button {
        flex: 1 1 0;
        margin: 0 !important;
        min-height: 36px;
        padding: 8px 10px;
    }

    /* 单条件页（不可折叠）：保持「输入 + 按钮」同一行 */
    .layout-vue-query:not(.dt-query-collapsible) .layout-vue-query-form.el-form--inline {
        flex-wrap: nowrap;
        align-items: center;
        gap: 8px;
    }

    .layout-vue-query:not(.dt-query-collapsible) .layout-vue-query-form .el-form-item {
        flex-direction: row;
        width: auto;
        margin-bottom: 0 !important;
    }

    .layout-vue-query:not(.dt-query-collapsible) .layout-vue-query-keyword {
        flex: 1 1 auto;
        min-width: 0;
        width: auto;
    }

    .layout-vue-query:not(.dt-query-collapsible) .layout-vue-query-actions {
        flex: 0 0 auto;
        width: auto;
    }

    .layout-vue-query:not(.dt-query-collapsible) .layout-vue-query-actions .el-button {
        flex: 0 0 auto;
    }

    .layout-vue-query-tags {
        margin-top: 8px;
        padding: 0;
        background: transparent;
    }

    .layout-vue-query-tags .el-tag {
        margin: 0 6px 4px 0;
        max-width: 100%;
    }

    /* ---------- 工具栏：更矮的胶囊条，横向滑动 ---------- */
    .layout-vue-toolbar,
    .layout-vue-page-header .layout-vue-toolbar,
    .layout-vue-page-header div[style*="margin-bottom"]:has(> .el-button) {
        display: flex;
        flex-wrap: nowrap;
        align-items: stretch;
        gap: 6px;
        margin: 0 0 8px !important;
        padding: 0 0 2px;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        overscroll-behavior-x: contain;
    }

    .layout-vue-toolbar::-webkit-scrollbar,
    .layout-vue-page-header div[style*="margin-bottom"]:has(> .el-button)::-webkit-scrollbar {
        display: none;
        height: 0;
    }

    .layout-vue-toolbar .el-button,
    .layout-vue-page-header .layout-vue-toolbar .el-button,
    .layout-vue-page-header div[style*="margin-bottom"]:has(> .el-button) > .el-button {
        flex: 1 1 0;
        min-width: 0;
        margin: 0 !important;
        padding: 6px 10px !important;
        min-height: 32px;
        height: 32px;
        border-radius: 16px !important;
        font-size: 12px;
    }

    .layout-vue-toolbar .el-button + .el-button,
    .layout-vue-page-header .el-button + .el-button {
        margin-left: 0 !important;
    }

    /* 表格区域：允许横向滑动，保证能看到全部列 */
    .layout-vue-table-panel {
        flex: 0 0 auto;
        min-height: 220px;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-x pan-y;
    }

    .layout-vue-table-panel::before {
        content: '左右滑动可查看更多列';
        display: block;
        margin: 0 0 6px;
        font-size: 12px;
        line-height: 1.2;
        color: #909399;
        text-align: right;
    }

    /*
     * 取消 Element UI 固定列（fixed left/right）。
     * 固定列在窄屏会独占可视区，主表单元格被标为 is-hidden，表现为“只剩操作列”。
     */
    .el-table__fixed,
    .el-table__fixed-right,
    .el-table__fixed-left,
    .el-table__fixed-right-patch {
        display: none !important;
    }

    .el-table th.is-hidden,
    .el-table td.is-hidden,
    .el-table th.is-hidden > *,
    .el-table td.is-hidden > * {
        visibility: visible !important;
    }

    .el-table__body-wrapper,
    .el-table__header-wrapper,
    .el-table__footer-wrapper {
        margin-right: 0 !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    .layout-vue-table-panel .el-table__body-wrapper::-webkit-scrollbar,
    .el-table__body-wrapper::-webkit-scrollbar {
        height: 6px;
        width: 6px;
    }

    /* 操作列按钮允许换行，避免单列过宽 */
    .el-table .el-table__body .cell {
        white-space: normal;
        line-height: 1.4;
    }

    .el-table .el-button--mini,
    .el-table .el-button--small {
        padding: 5px 7px;
        margin: 2px 4px 2px 0;
    }

    /* 分页：允许换行并居中 */
    .layout-vue-page-footer {
        padding-top: 4px;
        padding-bottom: 12px;
    }

    .layout-vue-page-footer > div {
        text-align: center !important;
        margin-top: 12px !important;
    }

    .el-pagination {
        white-space: normal !important;
        text-align: center;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        row-gap: 8px;
        padding: 0 2px;
    }

    .el-pagination .el-pagination__total,
    .el-pagination .el-pagination__sizes,
    .el-pagination .el-pagination__jump {
        margin: 0 4px !important;
    }

    .el-pagination .el-pager li {
        min-width: 28px;
    }

    /* 抽屉 / 对话框：窄屏全宽 */
    .el-drawer.rtl,
    .el-drawer.ltr,
    .el-drawer.ttb,
    .el-drawer.btt {
        width: 100% !important;
        max-width: 100vw !important;
    }

    .el-dialog {
        width: 94% !important;
        margin-top: 6vh !important;
    }

    .el-dialog__body {
        padding: 12px 14px !important;
    }

    .el-message-box {
        width: 92% !important;
    }

    /* 表单项标签在窄屏可换行，避免裁切 */
    .el-drawer .el-form-item__label,
    .el-dialog .el-form-item__label {
        float: none;
        display: block;
        text-align: left;
        padding: 0 0 6px;
        line-height: 1.4;
        width: auto !important;
    }

    .el-drawer .el-form-item__content,
    .el-dialog .el-form-item__content {
        margin-left: 0 !important;
    }
}