:root {
    --primary: #0064C8;
    --primary-hover: #0052A3;
    --primary-light: #E8F2FC;
    --bg: #F5F7FA;
    --card: #FFFFFF;
    --text: #1F2329;
    --text-secondary: #646A73;
    --text-tertiary: #8F959E;
    --border: #E5E6EB;
    --danger: #D54941;
    --success: #2EA121;
    --warning: #D89614;
    --radius: 6px;
    --shadow: 0 1px 2px rgba(0, 0, 0, .03), 0 2px 8px rgba(0, 0, 0, .04);
}

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    line-height: 1.6;
}

/* ---------------- 管理端框架 ---------------- */
.admin-header {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    padding: 0 24px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 0 rgba(31, 35, 41, .02), 0 2px 8px rgba(31, 35, 41, .02);
}

.admin-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
}

.admin-brand .logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 7px;
    background: var(--primary);
    color: #fff;
    font-size: 15px;
}

.admin-user {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
}

.admin-user .avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 12px;
    font-weight: 600;
}

.admin-user-name {
    padding: 4px 2px;
    border: 0;
    background: none;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: color .15s;
}

.admin-user-name:hover {
    color: var(--primary);
}

.logout-btn {
    height: 28px;
    padding: 0 10px;
    border: none;
    border-radius: var(--radius);
    background: none;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: all .15s;
}

.logout-btn:hover {
    background: #F2F3F5;
    color: var(--danger);
}

.password-modal {
    width: 420px;
    max-width: 100%;
}

.password-message {
    min-height: 20px;
    color: var(--danger);
    font-size: 12px;
}

.password-message.success {
    color: var(--success);
}

.confirm-modal {
    width: 420px;
    max-width: 100%;
}

.confirm-message {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.7;
}

.admin-sidebar {
    position: fixed;
    top: 56px;
    bottom: 0;
    left: 0;
    width: 220px;
    padding: 8px 10px;
    background: #fff;
    border-right: 1px solid var(--border);
}

.side-section {
    padding: 12px 12px 5px;
    color: #B0B5BD;
    font-size: 11px;
    letter-spacing: .6px;
}

.side-section:first-child {
    padding-top: 6px;
}

.side-menu {
    display: flex;
    align-items: center;
    height: 38px;
    padding: 0 12px;
    margin-bottom: 2px;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 14px;
    text-decoration: none;
    transition: background .15s, color .15s;
}

.side-menu:hover {
    background: #F5F7FA;
    color: var(--text);
}

.side-menu.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 500;
}

.side-icon {
    display: none;
}

.admin-main {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 56px);
    min-height: 0;
    margin-left: 220px;
    padding: 72px 24px 32px;
    overflow: hidden;
}

.admin-main > main {
    display: flex;
    flex: 1;
    flex-direction: column;
    width: 100%;
    max-width: 1680px;
    min-height: 0;
    margin: 0 auto;
}

.page-title {
    margin: 0 0 4px;
    font-size: 20px;
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: -.2px;
}

.page-desc {
    margin: 0 0 16px;
    color: var(--text-secondary);
    font-size: 12px;
}

.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.page-head .page-title {
    margin: 0 0 4px;
}

.page-head .page-desc {
    margin: 0;
}

.table-wrap {
    overflow: visible;
}

.toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ---------------- 菜单树表格 ---------------- */
.tree-cell {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tree-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    padding: 0;
    border: none;
    border-radius: 3px;
    background: none;
    color: var(--text-tertiary);
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
}

.tree-toggle:hover {
    background: #F2F3F5;
    color: var(--primary);
}

.tree-toggle.placeholder {
    visibility: hidden;
}

.tree-name {
    color: var(--text);
    font-weight: 500;
}

.data-table tbody tr:hover .tree-name {
    color: var(--primary);
}

.tree-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: #F2F3F5;
    color: var(--text-tertiary);
    font-size: 11px;
}

.type-tag {
    display: inline-block;
    padding: 0 6px;
    border-radius: 3px;
    font-size: 11px;
    line-height: 18px;
}

.type-dir {
    background: #F2F3F5;
    color: var(--text-secondary);
}

.type-menu {
    background: var(--primary-light);
    color: var(--primary);
}

.type-button {
    background: #FFF7E8;
    color: var(--warning);
}

/* ---------------- 卡片/布局 ---------------- */
.card {
    overflow: visible;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.org-layout {
    display: grid;
    flex: 1;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 16px;
    align-items: stretch;
    min-height: 0;
}

.org-layout > .card {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.org-layout > .card > .card-header {
    flex-shrink: 0;
}

#org-detail {
    overflow: auto;
}

#org-detail .detail-head {
    position: static;
}

#org-detail .data-table thead th {
    top: 0;
    z-index: 3;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 48px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-size: 14px;
    font-weight: 600;
}

.card-count {
    margin-left: 4px;
    color: var(--text-tertiary);
    font-size: 12px;
    font-weight: 400;
}

.card-body {
    padding: 12px 16px;
}

.org-tree {
    flex: 1;
    min-height: 0;
    padding: 6px;
    overflow: auto;
}

.tree-node {
    position: relative;
    display: flex;
    align-items: center;
    gap: 7px;
    min-height: 36px;
    padding: 7px 10px;
    margin: 1px 0;
    border-radius: var(--radius);
    color: var(--text-secondary);
    white-space: nowrap;
    cursor: pointer;
    transition: background .15s, color .15s;
}

.tree-node::before {
    display: none;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border-radius: 4px;
    background: #F2F3F5;
    color: var(--text-tertiary);
    font-size: 9px;
    font-weight: 600;
    content: '·';
}

.tree-node.type-REGION::before {
    background: var(--primary-light);
    color: var(--primary);
    content: '区';
}

.tree-node.type-SUPERVISE_DEPT::before {
    background: #FFF7E8;
    color: var(--warning);
    content: '局';
}

.tree-node.type-OFFICE::before {
    background: #F2F3F5;
    color: var(--text-secondary);
    content: '科';
}

.tree-node.type-ENTERPRISE::before {
    background: #E8F8E8;
    color: var(--success);
    content: '企';
}

.tree-node:hover {
    background: #F5F7FA;
}

.tree-node.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 500;
}

.tree-node.active::after {
    position: absolute;
    top: 8px;
    bottom: 8px;
    left: 0;
    width: 3px;
    border-radius: 0 2px 2px 0;
    background: var(--primary);
    content: '';
}

.tree-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tree-more {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--text-tertiary);
    font-family: inherit;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    opacity: .4;
}

.tree-node:hover .tree-more,
.tree-node.active .tree-more,
.tree-more:focus-visible {
    opacity: 1;
}

.tree-more:hover {
    background: #EAF2FF;
    color: var(--primary);
}

.tree-action-menu {
    position: fixed;
    z-index: 1100;
    min-width: 116px;
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #fff;
    box-shadow: 0 8px 22px rgba(31, 35, 41, .14);
}

.tree-action-menu button {
    display: block;
    width: 100%;
    padding: 8px 10px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 13px;
    text-align: left;
    white-space: nowrap;
    cursor: pointer;
}

.tree-action-menu button:hover {
    background: #F5F8FC;
    color: var(--primary);
}

.tree-action-menu button.danger {
    color: var(--danger);
}

.tree-action-menu button.danger:hover {
    background: #FFF1F0;
}

.tree-badge {
    flex-shrink: 0;
    padding: 1px 6px;
    border-radius: 3px;
    background: #F2F3F5;
    color: var(--text-tertiary);
    font-size: 10.5px;
    line-height: 18px;
}

.tree-node.active .tree-badge {
    background: #fff;
    color: var(--primary);
}

/* ---------------- 详情 ---------------- */
.detail-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.detail-head-main {
    min-width: 0;
}

.detail-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 600;
}

.detail-sub {
    margin-top: 4px;
    color: var(--text-secondary);
    font-size: 13px;
}

.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    margin-top: 8px;
}

.meta-item {
    display: flex;
    align-items: baseline;
    gap: 6px;
    min-width: 0;
}

.meta-label {
    color: var(--text-tertiary);
    font-size: 12px;
}

.meta-value {
    color: var(--text-secondary);
    font-size: 12.5px;
}

.detail-actions {
    display: flex;
    flex-shrink: 0;
    gap: 8px;
}

.section {
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.section:last-child {
    border-bottom: none;
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 600;
}

.section-title > span:first-child {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.section-title > span:first-child::before {
    width: 3px;
    height: 13px;
    border-radius: 2px;
    background: var(--primary);
    content: '';
}

.industry-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    color: var(--text-secondary);
    font-size: 12.5px;
    cursor: pointer;
    user-select: none;
    transition: border-color .15s, background .15s, color .15s;
}

.checkbox:hover {
    border-color: var(--primary);
    color: var(--text);
}

.checkbox:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 500;
}

.checkbox:has(input:disabled) {
    opacity: .65;
    cursor: not-allowed;
}

.checkbox input {
    width: 15px;
    height: 15px;
    margin: 0;
    accent-color: var(--primary);
}

.checkbox-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---------------- 按钮 ---------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 32px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    transition: all .15s;
}

.btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-primary {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
    box-shadow: 0 1px 2px rgba(0, 100, 200, .16);
}

.btn-primary:hover {
    border-color: var(--primary-hover);
    background: var(--primary-hover);
    color: #fff;
    box-shadow: 0 2px 6px rgba(0, 100, 200, .2);
}

.btn-danger {
    border-color: #F7D5D3;
    color: var(--danger);
}

.btn-danger:hover {
    border-color: var(--danger);
    background: #FFF1F0;
    color: var(--danger);
}

.btn-sm {
    height: 28px;
    padding: 0 10px;
    font-size: 12px;
}

.btn-link {
    padding: 0 4px;
    border: none;
    background: none;
    color: var(--primary);
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
}

.btn-link:hover {
    text-decoration: underline;
}

.btn-link.danger {
    color: var(--danger);
}

.btn[disabled] {
    opacity: .5;
    cursor: not-allowed;
}

/* ---------------- 表格 ---------------- */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead th {
    position: sticky;
    top: 56px;
    z-index: 20;
    background: #F7F8FA;
    box-shadow: inset 0 -1px 0 var(--border);
}

/* 角色/菜单页：表格区域内部滚动，表头固定在卡片顶部 */
.card.table-page {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
}

.card.table-page > .card-header {
    flex-shrink: 0;
}

.card.table-page > .table-wrap {
    flex: 1;
    min-height: 0;
    overflow: auto;
}

.card.table-page .data-table thead th {
    top: 0;
    z-index: 3;
}

.data-table th {
    padding: 11px 16px;
    border-bottom: 1px solid var(--border);
    background: #F7F8FA;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    text-align: left;
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr:hover td {
    background: #F7F9FC;
}

.data-table td .btn-link + .btn-link {
    margin-left: 8px;
}

.data-table code {
    padding: 1px 5px;
    border-radius: 3px;
    background: #F5F7FA;
    color: #4E5969;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 12px;
}

.industry-remarks {
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---------------- 行业：左行业列表 / 右企业列表 ---------------- */
.industry-layout {
    display: grid;
    flex: 1;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 16px;
    min-height: 0;
}

.industry-side,
.industry-main {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.industry-list {
    flex: 1;
    min-height: 0;
    padding: 8px;
    overflow: auto;
}

.industry-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 9px 10px;
    margin: 1px 0;
    border-radius: var(--radius);
    color: var(--text-secondary);
    cursor: pointer;
    transition: background .15s, color .15s;
}

.industry-item:hover {
    background: #F5F7FA;
}

.industry-item.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 500;
}

.industry-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.industry-count {
    flex-shrink: 0;
    color: var(--text-tertiary);
    font-size: 12px;
}

.industry-item.active .industry-count {
    color: var(--primary);
}

.industry-more-wrap {
    position: relative;
    flex-shrink: 0;
}

.industry-more {
    width: 22px;
    height: 22px;
    padding: 0;
    border: none;
    border-radius: 4px;
    background: none;
    color: var(--text-tertiary);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    opacity: .55;
    transition: opacity .15s, background .15s;
}

.industry-item:hover .industry-more,
.industry-more.open {
    opacity: 1;
}

.industry-more:hover {
    background: #fff;
    color: var(--primary);
}

.industry-more-menu {
    position: absolute;
    top: 26px;
    right: 0;
    z-index: 20;
    min-width: 84px;
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: 0 4px 12px rgba(31, 35, 41, .12);
}

.industry-more-menu.hidden {
    display: none;
}

.industry-more-menu button {
    display: block;
    width: 100%;
    padding: 6px 8px;
    border: none;
    border-radius: 4px;
    background: none;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 12px;
    text-align: left;
    cursor: pointer;
}

.industry-more-menu button:hover {
    background: #F5F7FA;
    color: var(--primary);
}

.industry-more-menu button.danger {
    color: var(--danger);
}

.industry-side-footer {
    flex-shrink: 0;
    padding: 10px;
    border-top: 1px solid var(--border);
}

.industry-add-btn {
    width: 100%;
    border-style: dashed;
    color: var(--text-secondary);
}

.industry-add-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.industry-main-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-shrink: 0;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.industry-title {
    font-size: 16px;
    font-weight: 600;
}

.industry-sub {
    margin-top: 4px;
    color: var(--text-tertiary);
    font-size: 12px;
}

.industry-toolbar {
    display: flex;
    flex-shrink: 0;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.industry-toolbar .industry-search {
    width: 240px;
    height: 32px;
}

.industry-table-wrap {
    flex: 1;
    min-height: 0;
    overflow: auto;
}

.industry-table-wrap .data-table thead th {
    top: 0;
    z-index: 3;
}

.industry-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    color: var(--text-tertiary);
    font-size: 12px;
}

/* 部门弹窗 */
.org-modal {
    width: 460px;
    max-width: 100%;
}

/* 管理员关联组织 */
.admin-org-options {
    width: 100%;
    padding: 9px;
    overflow: visible;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #FAFBFD;
    box-sizing: border-box;
}

.admin-org-option {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    padding: 5px 9px;
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
}

.admin-org-option:hover {
    background: #F0F5FC;
    color: var(--text);
}

.admin-org-option input {
    width: 15px;
    height: 15px;
    margin: 0;
    accent-color: var(--primary);
}

.admin-org-option .org-option-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 管理员关联角色 */
.admin-role-options {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    width: 100%;
    padding: 9px;
    overflow: visible;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #FAFBFD;
    box-sizing: border-box;
}

.admin-role-option {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    width: 100%;
    min-height: 38px;
    padding: 7px 10px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: #fff;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    box-sizing: border-box;
}

.admin-role-option:hover {
    border-color: #CFE2FA;
    color: var(--text);
}

.admin-role-option:has(input:checked) {
    border-color: #9BC3FF;
    background: var(--primary-light);
    color: var(--primary);
}

.admin-role-option input {
    flex: 0 0 auto;
    width: 15px;
    height: 15px;
    margin: 2px 0 0;
    accent-color: var(--primary);
}

.admin-role-content {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.admin-role-name {
    min-width: 0;
    overflow-wrap: anywhere;
    white-space: normal;
}

.admin-role-remark {
    min-width: 0;
    color: var(--text-tertiary);
    font-size: 11px;
    line-height: 1.5;
    overflow-wrap: anywhere;
    white-space: normal;
    word-break: break-word;
}

/* 新增管理员右侧抽屉 */
#admin-modal {
    align-items: stretch;
    justify-content: flex-end;
    padding: 0;
    overflow: hidden;
}

#admin-modal .modal.admin-drawer {
    display: flex;
    flex-direction: column;
    width: 560px;
    max-width: 100%;
    height: 100vh;
    border-radius: 0;
    animation: admin-drawer-in .2s ease-out;
}

#admin-modal .modal form {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
}

#admin-modal .modal-header,
#admin-modal .modal-footer {
    flex: 0 0 auto;
}

#admin-modal .modal-body {
    flex: 1;
    min-height: 0;
    padding: 24px;
    overflow-y: auto;
}

#admin-modal .modal-footer {
    padding: 16px 24px;
}

@keyframes admin-drawer-in {
    from {
        transform: translateX(24px);
        opacity: .6;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.form-tip {
    margin-top: 6px;
    color: var(--text-tertiary);
    font-size: 12px;
}

.org-modal .modal-header {
    padding: 16px 24px;
}

.org-modal .modal-body {
    padding: 24px;
}

.org-modal .modal-footer {
    padding: 14px 24px;
}

.org-modal .org-check-tree {
    max-height: 320px;
    padding: 8px;
}

.org-modal .org-check-item {
    min-height: 38px;
    padding: 6px 10px;
    gap: 10px;
    font-size: 14px;
}

.org-modal .org-check-item input {
    width: 16px;
    height: 16px;
}

.org-modal .form-item {
    margin-bottom: 20px;
}

.org-modal .form-label {
    margin-bottom: 8px;
}

.org-modal .form-control {
    height: 38px;
}

/* ---------------- 行业监管部门树 ---------------- */
.org-check-tree {
    max-height: 220px;
    padding: 6px;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.org-check-item {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 32px;
    padding: 4px 8px;
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
}

.org-check-item:hover {
    background: #F5F7FA;
    color: var(--text);
}

.org-check-item input {
    width: 15px;
    height: 15px;
    margin: 0;
    accent-color: var(--primary);
}

.org-check-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 行业新增/编辑：右侧抽屉 */
#industry-modal {
    align-items: stretch;
    justify-content: flex-end;
    padding: 0;
    overflow: hidden;
}

#industry-modal .modal.industry-modal {
    display: flex;
    flex-direction: column;
    width: 600px;
    max-width: 100%;
    height: 100vh;
    border-radius: 0;
    animation: admin-drawer-in .2s ease-out;
}

#industry-modal .modal form {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
}

#industry-modal .modal-header,
#industry-modal .modal-footer {
    flex: 0 0 auto;
}

#industry-modal .modal-body {
    flex: 1;
    min-height: 0;
    padding: 24px;
    overflow-y: auto;
}

.industry-modal .modal-header {
    padding: 16px 24px;
}

.industry-modal .modal-footer {
    padding: 14px 24px;
}

.industry-modal .form-row {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 18px;
}

.industry-modal .form-row:last-child {
    margin-bottom: 0;
}

.industry-modal .form-row > .form-label {
    width: 72px;
    flex-shrink: 0;
    margin: 0;
    padding-top: 9px;
    font-size: 13px;
}

.industry-modal .form-row > .form-control {
    flex: 1;
    height: 36px;
}

.industry-modal .org-check-tree {
    flex: 1;
    max-height: none;
    padding: 8px;
    overflow: visible;
}

.industry-modal .org-check-row {
    display: flex;
    align-items: center;
    gap: 2px;
}

.industry-modal .org-check-row .org-check-item {
    flex: 1;
    min-height: 38px;
    padding: 6px 10px 6px 2px;
    gap: 10px;
    font-size: 14px;
}

.industry-modal .org-expand-btn {
    flex: 0 0 24px;
    width: 24px;
    height: 24px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--text-tertiary);
    font-family: inherit;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
}

.industry-modal .org-expand-btn:hover {
    color: var(--primary);
}

.industry-modal .org-expand-placeholder {
    flex: 0 0 24px;
    width: 24px;
}

.industry-modal .org-check-item input {
    width: 16px;
    height: 16px;
}

@media (max-width: 600px) {
    #industry-modal .modal.industry-modal {
        width: 100%;
    }

    .industry-modal .form-row {
        flex-direction: column;
        gap: 6px;
    }

    .industry-modal .form-row > .form-label {
        width: auto;
        padding-top: 0;
    }

    .industry-modal .org-check-tree {
        width: 100%;
    }
}

/* ---------------- 选择企业弹窗 ---------------- */
.enterprise-picker-toolbar {    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.enterprise-picker-toolbar .form-control {
    flex: 1;
    height: 32px;
}

.enterprise-picker-count {
    flex-shrink: 0;
    color: var(--text-tertiary);
    font-size: 12px;
}

.enterprise-picker-select-all {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    user-select: none;
}

.enterprise-picker-select-all input {
    width: 15px;
    height: 15px;
    margin: 0;
    accent-color: var(--primary);
}

.enterprise-picker-list {
    max-height: 380px;
    padding: 6px;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.enterprise-picker-item {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    padding: 6px 10px;
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
}

.enterprise-picker-item:hover {
    background: #F5F7FA;
    color: var(--text);
}

.enterprise-picker-item input {
    width: 15px;
    height: 15px;
    margin: 0;
    accent-color: var(--primary);
}

.enterprise-picker-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.badge {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 8px;
    border-radius: 4px;
    font-size: 12px;
}

.badge::before {
    width: 5px;
    height: 5px;
    margin-right: 5px;
    border-radius: 50%;
    background: currentColor;
    content: '';
    opacity: .9;
}

.badge-success {
    background: #E8F8E8;
    color: var(--success);
}

.badge-default {
    background: #F2F3F5;
    color: var(--text-secondary);
}

.empty {
    padding: 32px;
    color: var(--text-tertiary);
    text-align: center;
}

.text-muted {
    color: var(--text-tertiary);
}

/* ---------------- 弹窗 ---------------- */
.modal-mask {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 12vh 16px 16px;
    overflow-y: auto;
    background: rgba(0, 0, 0, .45);
}

.modal-mask.hidden {
    display: none;
}

.modal {
    width: 480px;
    max-width: 100%;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .16);
}

.modal-lg {
    width: 600px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
}

.modal-close {
    padding: 0;
    border: none;
    background: none;
    color: var(--text-tertiary);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid var(--border);
}

.form-item {
    margin-bottom: 16px;
}

.form-item:last-child {
    margin-bottom: 0;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
}

.form-label .required {
    margin-left: 2px;
    color: var(--danger);
}

.form-control {
    width: 100%;
    height: 32px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    outline: none;
    background: #fff;
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(0, 100, 200, .12);
}

/* 按钮 loading */
button.is-loading {
    position: relative;
    color: transparent !important;
    cursor: wait;
    pointer-events: none;
}

button.is-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 14px;
    height: 14px;
    margin: -7px 0 0 -7px;
    border: 2px solid rgba(255, 255, 255, .45);
    border-top-color: #fff;
    border-radius: 50%;
    animation: button-spin .7s linear infinite;
}

button.btn:not(.btn-primary).is-loading::after,
button.page-btn.is-loading::after,
button.btn-link.is-loading::after,
button.login-code-btn.is-loading::after,
button.logout-btn.is-loading::after {
    border-color: rgba(0, 100, 200, .2);
    border-top-color: var(--primary);
}

@keyframes button-spin {
    to {
        transform: rotate(360deg);
    }
}

textarea.form-control {
    height: 72px;
    padding: 8px 10px;
    resize: vertical;
}

.role-remarks-cell {
    max-width: 260px;
    overflow: hidden;
    color: var(--text-secondary);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* ---------------- 角色-菜单授权树 ---------------- */
.checkbox-tree {
    max-height: 420px;
    padding: 10px 12px;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.checkbox-tree ul {
    margin: 0;
    padding-left: 20px;
    list-style: none;
}

.checkbox-tree > ul {
    padding-left: 0;
}

.checkbox-tree li {
    margin: 2px 0;
}

.checkbox-tree label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    color: var(--text-secondary);
    cursor: pointer;
}

.checkbox-tree label:hover {
    color: var(--text);
}

.checkbox-tree input {
    accent-color: var(--primary);
}

.checkbox-tree .node-badge {
    padding: 0 5px;
    border-radius: 3px;
    background: #F2F3F5;
    color: var(--text-tertiary);
    font-size: 11px;
}

.checkbox-tree .node-perm {
    color: var(--text-tertiary);
    font-size: 11px;
}

/* ---------------- 轻提示 ---------------- */
.toast-wrap {
    position: fixed;
    top: 72px;
    left: 50%;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transform: translateX(-50%);
}

.toast {
    min-width: 180px;
    padding: 8px 16px;
    border-left: 3px solid var(--success);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .12);
    font-size: 13px;
}

.toast.error {
    border-left-color: var(--danger);
}

/* ---------------- 登录页 ---------------- */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
    background: linear-gradient(135deg, #EEF5FF 0%, #F5F7FA 60%, #E9F2FB 100%);
}

.login-card {
    width: 380px;
    max-width: 100%;
    padding: 32px;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 8px 30px rgba(31, 35, 41, .08);
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.login-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
}

.login-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.login-sub {
    margin: 6px 0 24px;
    color: var(--text-secondary);
    font-size: 13px;
}

.login-card .form-control {
    height: 38px;
}

.login-btn {
    width: 100%;
    height: 38px;
    margin-top: 8px;
}

.login-alert {
    padding: 8px 12px;
    margin-bottom: 16px;
    border-radius: var(--radius);
    font-size: 13px;
}

.login-alert.error {
    background: #FFF1F0;
    color: var(--danger);
}

.login-alert.info {
    background: #E8F8E8;
    color: var(--success);
}

.login-footer {
    margin-top: 20px;
    color: var(--text-tertiary);
    font-size: 12px;
    text-align: center;
}

/* ---------------- 新版登录页 ---------------- */
.login-page {
    flex-direction: column;
    gap: 18px;
    min-height: 100vh;
    padding: 30px 24px;
    background:
        radial-gradient(circle at 12% 16%, rgba(173, 207, 255, .45), transparent 28%),
        radial-gradient(circle at 88% 82%, rgba(197, 222, 255, .55), transparent 30%),
        linear-gradient(135deg, #EAF3FF 0%, #F4F8FF 48%, #E8F2FF 100%);
}

.login-shell {
    display: grid;
    grid-template-columns: 42% 58%;
    width: min(960px, 100%);
    min-height: 540px;
    overflow: hidden;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(40, 91, 160, .16);
}

.login-visual {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    padding: 34px 36px 30px;
    background: linear-gradient(155deg, #F3F8FF 0%, #E4F0FF 55%, #DDEBFF 100%);
}

.login-visual::before {
    content: "";
    position: absolute;
    top: -90px;
    right: -100px;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .5);
}

.login-visual::after {
    content: "";
    position: absolute;
    bottom: -120px;
    left: -80px;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    background: rgba(167, 204, 255, .2);
}

.login-visual-brand {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.login-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: linear-gradient(145deg, #3D8BFF, #0757D9);
    box-shadow: 0 5px 12px rgba(31, 112, 230, .28);
    color: #fff;
    font-size: 18px;
    font-weight: 700;
}

.login-brand-name {
    color: #1E5DAE;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: .5px;
}

.login-brand-sub {
    margin-top: 1px;
    color: #7F9FC5;
    font-size: 11px;
}

.login-visual-art {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 286px;
    margin: 4px 0 0;
}

.login-visual-art svg {
    width: 100%;
    max-width: 320px;
    height: auto;
    overflow: visible;
}

.login-visual-copy {
    position: relative;
    z-index: 1;
    text-align: center;
}

.login-visual-copy h1 {
    margin: 0;
    color: #1D5AA5;
    font-size: 18px;
    font-weight: 500;
    letter-spacing: .5px;
}

.login-visual-copy p {
    margin: 8px 0 0;
    color: #7A9CC2;
    font-size: 12px;
}

.login-panel {
    display: flex;
    flex-direction: column;
    padding: 38px 52px 26px;
    background: #fff;
}

.login-panel-head {
    display: flex;
    align-items: baseline;
    margin-bottom: 22px;
}

.login-panel-title {
    margin: 0;
    color: #23364F;
    font-size: 19px;
    font-weight: 500;
    line-height: 1.4;
}

.login-panel-brand {
    color: var(--primary);
    font-size: 15px;
    font-weight: 600;
}

.login-tabs {
    display: flex;
    gap: 32px;
    border-bottom: 1px solid #EDF1F6;
}

.login-tab {
    position: relative;
    padding: 0 2px 12px;
    border: 0;
    background: none;
    color: #5D6B7C;
    font-family: inherit;
    font-size: 16px;
    cursor: pointer;
}

.login-tab.active {
    color: var(--primary);
    font-weight: 500;
}

.login-tab.active::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: -1px;
    left: 0;
    height: 2px;
    border-radius: 2px;
    background: var(--primary);
}

.login-form-panel {
    padding-top: 22px;
}

.login-field {
    display: flex;
    align-items: center;
    height: 46px;
    margin-bottom: 14px;
    border: 1px solid #E3E9F2;
    border-radius: 6px;
    background: #F8FAFD;
    transition: border-color .15s, background .15s, box-shadow .15s;
}

.login-field:focus-within {
    border-color: #9BC3FF;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(0, 100, 200, .06);
}

.login-field-icon {
    display: flex;
    flex: 0 0 42px;
    align-items: center;
    justify-content: center;
    color: #9AA8BA;
}

.login-field-icon svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.6;
}

.login-field input {
    flex: 1;
    min-width: 0;
    height: 100%;
    padding: 0 12px 0 0;
    border: 0;
    outline: none;
    background: transparent;
    color: #27374D;
    font-family: inherit;
    font-size: 14px;
}

.login-field input::placeholder {
    color: #AAB6C6;
}

.login-eye {
    display: flex;
    flex: 0 0 40px;
    align-items: center;
    justify-content: center;
    height: 100%;
    border: 0;
    background: none;
    color: #A6B3C3;
    cursor: pointer;
}

.login-eye svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.5;
}

.login-captcha-row {
    display: flex;
    align-items: stretch;
    gap: 10px;
}

.login-captcha-field {
    flex: 1;
    min-width: 0;
    margin-bottom: 0;
}

.login-captcha {
    flex: 0 0 120px;
    width: 120px;
    height: 46px;
    border: 1px solid #E3E9F2;
    border-radius: 6px;
    background: #F7F9FC;
    cursor: pointer;
    object-fit: cover;
}

.login-submit {
    width: 100%;
    height: 46px;
    margin-top: 20px;
    border: 0;
    border-radius: 5px;
    background: linear-gradient(90deg, #2E7CF6 0%, #0757D9 100%);
    box-shadow: 0 8px 18px rgba(18, 92, 214, .2);
    color: #fff;
    font-family: inherit;
    font-size: 16px;
    font-weight: 500;
    letter-spacing: 1px;
    cursor: pointer;
    transition: filter .15s, transform .15s;
}

.login-submit:hover {
    filter: brightness(1.04);
}

.login-submit:active {
    transform: translateY(1px);
}

.login-code-row {
    display: flex;
    gap: 10px;
}

.login-code-field {
    flex: 1;
    min-width: 0;
    margin-bottom: 0;
}

.login-code-btn {
    flex: 0 0 118px;
    height: 46px;
    border: 1px solid #C9DEF8;
    border-radius: 6px;
    background: #F3F8FF;
    color: var(--primary);
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
}

.login-code-btn:hover:not(:disabled) {
    border-color: var(--primary);
}

.login-code-btn:disabled {
    color: #9FAEBF;
    cursor: default;
}

.login-inline-message {
    min-height: 18px;
    margin-top: 7px;
    color: var(--danger);
    font-size: 12px;
}

.login-inline-message.success {
    color: var(--success);
}

.login-copyright {
    color: #8C9BAD;
    font-size: 12px;
    text-align: center;
}

@media (max-width: 820px) {
    .login-page {
        padding: 20px 14px;
    }

    .login-shell {
        grid-template-columns: 1fr;
        width: min(460px, 100%);
        min-height: auto;
    }

    .login-visual {
        display: none;
    }

    .login-panel {
        padding: 30px 26px 24px;
    }
}

@media (max-width: 420px) {
    .login-captcha {
        flex-basis: 105px;
        width: 105px;
    }

    .login-code-btn {
        flex-basis: 108px;
    }

    .login-panel-head h2 {
        font-size: 17px;
    }
}

.forbidden-card {
    width: 420px;
    max-width: 100%;
    padding: 40px 32px;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 8px 30px rgba(31, 35, 41, .08);
    text-align: center;
}

.forbidden-code {
    margin: 0;
    color: var(--primary);
    font-size: 48px;
    font-weight: 700;
    line-height: 1;
}

.forbidden-title {
    margin: 12px 0 8px;
    font-size: 18px;
    font-weight: 600;
}

.forbidden-desc {
    margin: 0 0 24px;
    color: var(--text-secondary);
    font-size: 13px;
}

.forbidden-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
}

/* ---------------- 总览 / 企业统计 ---------------- */
.admin-main > main.page-scroll {
    display: block;
    min-height: 0;
    overflow-y: auto;
    padding-right: 4px;
}

.page-scroll .data-table thead th {
    top: 0;
}

/* 监管总览 / 企业数据统计：页面固定，表头和分页固定，只滚动表格 */
.admin-main > main.stats-page {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 统计页尽量占满可视高度，减少底部留白 */
.admin-main:has(> main.stats-page) {
    padding-bottom: 0;
}

.stats-page .page-head {
    flex: 0 0 auto;
    margin-bottom: 6px;
}

.stats-page .stats-layout {
    flex: 1;
    height: 100%;
    min-height: 0;
    align-items: stretch;
}

.stats-page .stats-side {
    align-self: stretch;
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.stats-page .stats-tabs {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.stats-page .stats-main {
    flex: 1;
    height: 100%;
    min-height: 0;
    gap: 8px;
}

.stats-page .kpi-grid {
    gap: 8px;
}

.stats-page .kpi-card {
    padding: 9px 12px;
}

.stats-page .kpi-label {
    font-size: 11px;
}

.stats-page .kpi-value {
    margin-top: 2px;
    font-size: 22px;
}

.stats-page .kpi-sub {
    margin-top: 1px;
    font-size: 11px;
}

.stats-page .data-table th {
    padding-top: 8px;
    padding-bottom: 8px;
}

.stats-page .data-table td {
    padding-top: 9px;
    padding-bottom: 9px;
}

.stats-page .stats-main > .card {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
}

.stats-page .stats-main > .card > .card-header,
.stats-page .stats-main > .card > .filter-bar,
.stats-page .stats-main > .card > .pagination,
.stats-page .stats-main > .card > .stats-body > .kpi-grid,
.stats-page .stats-main > .card > .stats-body > .section-head,
.stats-page .stats-main > .card > .stats-body > .filter-bar,
.stats-page .stats-main > .card > .stats-body > .pagination {
    flex-shrink: 0;
}

.company-kpi-strip {
    flex-shrink: 0;
    margin: -16px -16px 12px;
    padding: 16px;
    background: var(--bg);
}

.stats-page .stats-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
}

.stats-page .pagination {
    padding-top: 8px;
    padding-bottom: 8px;
}

.stats-page .stats-main > .card > .table-wrap,
.stats-page .stats-main > .card > .stats-body > .table-wrap {
    flex: 1;
    min-height: 0;
    overflow: auto;
}

.filter-bar.stats-list-toolbar {
    background: #fff;
}

.stats-list-toolbar {
    padding: 8px 16px;
    background: #fff;
}

.stats-list-toolbar .stats-export-btn {
    margin-left: auto;
}

.stats-page .table-wrap .data-table thead th {
    top: 0;
}

.stats-page .table-wrap {
    padding-bottom: 1px;
}

.stats-page .data-table tr:last-child td {
    border-bottom: 1px solid var(--border);
}

.stats-layout {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.stats-layout.no-side {
    grid-template-columns: minmax(0, 1fr);
}

.stats-side {
    position: sticky;
    top: 0;
}

.stats-tabs {
    padding: 8px;
}

.stats-tab {
    padding: 9px 12px;
    margin: 2px 0;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: background .15s, color .15s;
}

.stats-tab:hover {
    background: #F5F7FA;
    color: var(--text);
}

.stats-tab.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 500;
}

.stats-main {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

.kpi-grid {
    display: grid;
    gap: 12px;
}

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

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

.kpi-card {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
}

.kpi-label {
    color: var(--text-secondary);
    font-size: 12px;
}

.kpi-value {
    margin-top: 6px;
    color: var(--text);
    font-size: 28px;
    font-weight: 600;
    line-height: 1.2;
}

.kpi-sub {
    margin-top: 4px;
    color: var(--text-tertiary);
    font-size: 12px;
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: #F7F8FA;
}

.filter-input {
    width: 240px;
    height: 32px;
}

.stats-card-header {
    justify-content: flex-start;
    gap: 14px;
}

.company-picker {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 12px;
}

.company-combobox {
    position: relative;
    flex: 1;
    min-width: 260px;
    max-width: 620px;
}

.company-input {
    width: 100%;
    height: 32px;
    padding: 0 30px 0 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    outline: none;
    background: #fff;
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
}

.company-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(0, 100, 200, .12);
}

.company-input:disabled {
    background: #F5F7FA;
    color: var(--text-tertiary);
    cursor: not-allowed;
}

.company-arrow {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    font-size: 12px;
    pointer-events: none;
}

.company-options {
    position: absolute;
    top: 36px;
    right: 0;
    left: 0;
    z-index: 60;
    max-height: 280px;
    padding: 4px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: 0 8px 22px rgba(31, 35, 41, .14);
}

.company-option {
    display: block;
    width: 100%;
    padding: 8px 10px;
    overflow: hidden;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 13px;
    text-align: left;
    white-space: nowrap;
    text-overflow: ellipsis;
    cursor: pointer;
}

.company-option:hover,
.company-option.selected {
    background: var(--primary-light);
    color: var(--primary);
}

.company-empty {
    padding: 10px;
    color: var(--text-tertiary);
    font-size: 12px;
    text-align: center;
}

.company-picker select {
    min-width: 160px;
    height: 32px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    outline: none;
    background: #fff;
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
}

.stats-body {
    padding: 16px;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0 12px;
    border-top: 1px solid var(--border);
}

.stats-filter-bar {
    padding: 0 0 12px;
    border-bottom: 0;
    background: transparent;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    color: var(--text-tertiary);
    font-size: 12px;
}

.page-buttons {
    display: flex;
    align-items: center;
    gap: 4px;
}

.page-btn {
    min-width: 28px;
    height: 28px;
    padding: 0 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: #fff;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
}

.page-btn:hover,
.page-btn.active {
    border-color: var(--primary);
    color: var(--primary);
}

.badge-warning {
    background: #FFF7E8;
    color: var(--warning);
}

.hidden {
    display: none !important;
}

/* ---------------- 响应式 ---------------- */
@media (max-width: 1100px) {
    .admin-main {
        padding: 76px 20px 32px;
    }

    .org-layout {
        grid-template-columns: 260px minmax(0, 1fr);
    }
}

@media (max-width: 960px) {
    .admin-main {
        display: block;
        height: auto;
        min-height: 0;
        margin-left: 0;
        padding: 76px 16px 24px;
        overflow: visible;
    }

    .admin-main > main {
        display: block;
        min-height: 0;
    }

    .admin-main > main.page-scroll {
        overflow: visible;
    }

    .stats-layout {
        grid-template-columns: 1fr;
    }

    .stats-side {
        position: static;
    }

    .kpi-grid-3,
    .kpi-grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .filter-input {
        flex: 1;
        width: auto;
        min-width: 180px;
    }

    .company-picker {
        flex-wrap: wrap;
    }

    .admin-sidebar {
        display: none;
    }

    .org-layout {
        display: grid;
        flex: none;
        grid-template-columns: 1fr;
        min-height: 0;
    }

    .org-layout > .card {
        height: auto;
    }

    .org-tree {
        flex: none;
        max-height: 320px;
    }

    #org-detail {
        overflow: visible;
    }

    #org-detail .detail-head {
        position: static;
    }

    .detail-head {
        flex-direction: column;
    }

    .detail-actions {
        margin-top: 12px;
    }

    .page-head {
        flex-direction: column;
        align-items: stretch;
    }

    .page-head > .btn {
        align-self: flex-start;
    }

    .page-title {
        font-size: 20px;
    }

    .industry-options {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .industry-layout {
        display: grid;
        flex: none;
        grid-template-columns: 1fr;
    }

    .industry-side {
        max-height: 340px;
    }

    .industry-main {
        min-height: 420px;
    }

    .industry-more {
        opacity: 1;
    }

    .industry-toolbar {
        flex-wrap: wrap;
    }

    .industry-toolbar .industry-search {
        width: 100%;
    }

    .data-table {
        min-width: 760px;
    }

    .table-wrap {
        overflow-x: auto;
    }

    .card.table-page {
        display: block;
        flex: none;
    }

    .card.table-page > .table-wrap {
        max-height: calc(100vh - 260px);
        overflow: auto;
    }

    .data-table.org-admin-table {
        min-width: 560px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .admin-header {
        padding: 0 16px;
    }
}

@media (max-width: 480px) {
    .kpi-grid-3,
    .kpi-grid-4 {
        grid-template-columns: 1fr;
    }

    .industry-options {
        grid-template-columns: 1fr;
    }
}

/* 小屏统计页：压缩上方区域，表格占满剩余高度 */
@media (max-width: 960px) {
    .admin-main:has(> main.stats-page) {
        display: flex;
        height: calc(100vh - 56px);
        padding: 12px;
        overflow: hidden;
    }

    .admin-main > main.stats-page {
        display: flex;
        flex: 1;
        min-height: 0;
        overflow: hidden;
    }

    .stats-page .page-head {
        margin-bottom: 6px;
    }

    .stats-page .stats-layout {
        grid-template-columns: 1fr;
        gap: 8px;
        overflow: hidden;
    }

    .stats-page .stats-side {
        position: static;
        display: block;
        flex: 0 0 auto;
        height: auto;
    }

    .stats-page .stats-side .card-header {
        display: none;
    }

    .stats-page .stats-tabs {
        display: flex;
        gap: 4px;
        padding: 5px;
        overflow-x: auto;
        overflow-y: hidden;
    }

    .stats-page .stats-tab {
        flex: 0 0 auto;
        margin: 0;
        white-space: nowrap;
    }

    .stats-page .stats-main {
        flex: 1;
        height: auto;
        min-height: 0;
        gap: 6px;
    }

    .stats-page .kpi-grid {
        display: flex;
        gap: 6px;
        overflow-x: auto;
        overflow-y: hidden;
    }

    .stats-page .kpi-card {
        flex: 0 0 145px;
    }

    .stats-page .kpi-value {
        font-size: 20px;
    }

    .stats-page .kpi-sub {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .stats-page .data-table th,
    .stats-page .data-table td {
        padding-left: 12px;
        padding-right: 12px;
    }
}
