/* ============================================================
   机房巡检管理系统 - 全局样式
   适配：PC / 手机 / 微信内置浏览器 H5
   ============================================================ */

:root {
    --primary: #2f6bff;
    --primary-dark: #1e4fc4;
    --primary-light: #e8efff;
    --success: #16a34a;
    --success-light: #e7f7ed;
    --warning: #f59e0b;
    --warning-light: #fff5e3;
    --danger: #e5484d;
    --danger-light: #fdecec;
    --purple: #7c5cff;
    --purple-light: #efeaff;
    --cyan: #0891b2;
    --cyan-light: #e3f6fa;
    --text: #1f2a44;
    --text-sub: #64708a;
    --text-light: #98a2b3;
    --border: #e5eaf3;
    --bg: #f2f5fa;
    --card: #ffffff;
    --radius: 14px;
    --shadow-sm: 0 2px 8px rgba(31, 42, 68, 0.06);
    --shadow: 0 6px 20px rgba(31, 42, 68, 0.08);
    --shadow-lg: 0 12px 36px rgba(31, 42, 68, 0.14);
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue",
        "Microsoft YaHei", "Hiragino Sans GB", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--primary);
    text-decoration: none;
}

img {
    max-width: 100%;
}

/* ---------------- 顶部导航 ---------------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: linear-gradient(120deg, #1b3fa0 0%, #2f6bff 55%, #4d8dff 100%);
    box-shadow: 0 4px 16px rgba(30, 79, 196, 0.25);
    padding-top: env(safe-area-inset-top);
}

.topbar-inner {
    max-width: 1240px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-weight: 700;
    font-size: 17px;
    letter-spacing: .5px;
    white-space: nowrap;
}

.brand-logo {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.brand-sub {
    display: block;
    font-size: 11px;
    font-weight: 400;
    opacity: .8;
    letter-spacing: 1px;
    line-height: 1;
    margin-top: 2px;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-size: 13px;
    white-space: nowrap;
}

.avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .22);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
}

.logout-link {
    color: rgba(255, 255, 255, .9);
    border: 1px solid rgba(255, 255, 255, .4);
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 12px;
    transition: .2s;
}

.logout-link:hover {
    background: rgba(255, 255, 255, .18);
    color: #fff;
}

/* ---------------- 导航菜单 ---------------- */
.navbar {
    background: #fff;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 10px rgba(31, 42, 68, .04);
    position: sticky;
    top: 52px;
    z-index: 45;
}

.nav-inner {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 12px;
    display: flex;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.nav-inner::-webkit-scrollbar {
    display: none;
}

.nav-item {
    flex: 0 0 auto;
    padding: 12px 18px;
    font-size: 14px;
    color: var(--text-sub);
    border-bottom: 2px solid transparent;
    transition: .18s;
    white-space: nowrap;
}

.nav-item:hover {
    color: var(--primary);
}

.nav-item.active {
    color: var(--primary);
    font-weight: 600;
    border-bottom-color: var(--primary);
    background: linear-gradient(180deg, rgba(47, 107, 255, 0) 0%, rgba(47, 107, 255, .07) 100%);
}

/* ---------------- 容器 ---------------- */
.container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 22px 20px 48px;
    padding-bottom: calc(48px + env(safe-area-inset-bottom));
}

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

.page-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.page-title .bar {
    width: 4px;
    height: 20px;
    border-radius: 3px;
    background: linear-gradient(180deg, #2f6bff, #4d8dff);
}

.page-desc {
    color: var(--text-light);
    font-size: 13px;
    margin: 4px 0 0;
}

/* ---------------- 卡片 ---------------- */
.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(229, 234, 243, .9);
    margin-bottom: 18px;
    overflow: hidden;
}

.card-head {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    background: linear-gradient(180deg, #fbfcff, #fff);
}

.card-head h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
}

.card-head h3::before {
    content: "";
    width: 3px;
    height: 14px;
    border-radius: 2px;
    background: var(--primary);
    display: inline-block;
}

.card-body {
    padding: 18px 20px;
}

.card-body.tight {
    padding: 0;
}

/* ---------------- 看板 KPI ---------------- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 18px;
}

.kpi-card {
    position: relative;
    border-radius: var(--radius);
    padding: 16px 18px;
    color: #fff;
    overflow: hidden;
    box-shadow: var(--shadow);
    min-height: 96px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.kpi-card::after {
    content: "";
    position: absolute;
    right: -22px;
    bottom: -28px;
    width: 92px;
    height: 92px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .16);
}

.kpi-card::before {
    content: "";
    position: absolute;
    right: 22px;
    top: -34px;
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .12);
}

.kpi-label {
    font-size: 13px;
    opacity: .92;
    display: flex;
    align-items: center;
    gap: 6px;
    position: relative;
    z-index: 2;
}

.kpi-value {
    font-size: 30px;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: .5px;
    position: relative;
    z-index: 2;
    font-family: "DIN Alternate", "Helvetica Neue", Arial, sans-serif;
}

.kpi-unit {
    font-size: 12px;
    font-weight: 400;
    margin-left: 4px;
    opacity: .85;
}

.kpi-foot {
    font-size: 11px;
    opacity: .8;
    position: relative;
    z-index: 2;
}

.kpi-blue {
    background: linear-gradient(135deg, #2f6bff, #5c95ff);
}

.kpi-purple {
    background: linear-gradient(135deg, #7c5cff, #a18cff);
}

.kpi-green {
    background: linear-gradient(135deg, #16a34a, #34c96a);
}

.kpi-cyan {
    background: linear-gradient(135deg, #0891b2, #22b8d8);
}

.kpi-orange {
    background: linear-gradient(135deg, #f59e0b, #fbbf24);
}

.kpi-red {
    background: linear-gradient(135deg, #dc2626, #f2616a);
}

.kpi-rose {
    background: linear-gradient(135deg, #be1c5c, #e34d84);
}

/* ---------------- 按钮 ---------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 16px;
    height: 38px;
    border-radius: 9px;
    border: 1px solid transparent;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: .18s;
    background: #fff;
    color: var(--text);
    white-space: nowrap;
    line-height: 1;
    font-family: inherit;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, #2f6bff, #4d8dff);
    color: #fff;
    box-shadow: 0 4px 12px rgba(47, 107, 255, .3);
}

.btn-primary:hover {
    box-shadow: 0 6px 18px rgba(47, 107, 255, .4);
}

.btn-success {
    background: linear-gradient(135deg, #16a34a, #34c96a);
    color: #fff;
    box-shadow: 0 4px 12px rgba(22, 163, 74, .28);
}

.btn-danger {
    background: linear-gradient(135deg, #e5484d, #f2616a);
    color: #fff;
    box-shadow: 0 4px 12px rgba(229, 72, 77, .28);
}

.btn-orange {
    background: linear-gradient(135deg, #f59e0b, #fbbf24);
    color: #fff;
    box-shadow: 0 4px 12px rgba(245, 158, 11, .3);
}

.btn-ghost {
    background: #fff;
    color: var(--text-sub);
    border-color: var(--border);
}

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

.btn-sm {
    height: 30px;
    padding: 0 11px;
    font-size: 12.5px;
    border-radius: 7px;
}

.btn-block {
    width: 100%;
}

.btn-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

/* ---------------- 徽标 ---------------- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 9px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.6;
}

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

.badge-danger {
    background: var(--danger-light);
    color: var(--danger);
}

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

.badge-info {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.badge-gray {
    background: #f1f3f8;
    color: var(--text-sub);
}

.badge-purple {
    background: var(--purple-light);
    color: var(--purple);
}

/* ---------------- 表单 ---------------- */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 7px;
}

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

.form-control {
    width: 100%;
    height: 42px;
    padding: 0 13px;
    border: 1px solid var(--border);
    border-radius: 9px;
    font-size: 14px;
    color: var(--text);
    background: #fff;
    transition: .18s;
    font-family: inherit;
    -webkit-appearance: none;
    appearance: none;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(47, 107, 255, .12);
}

textarea.form-control {
    height: auto;
    min-height: 88px;
    padding: 11px 13px;
    line-height: 1.6;
    resize: vertical;
}

select.form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2364708a' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 13px center;
    padding-right: 34px;
}

.form-hint {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 5px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0 18px;
}

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

.input-unit {
    flex: 0 0 auto;
    font-size: 12px;
    color: var(--text-light);
    min-width: 28px;
}

.input-group .form-control {
    max-width: 260px;
}

/* 单选组（正常/异常） */
.radio-group {
    display: flex;
    gap: 10px;
}

.radio-item {
    flex: 1;
    position: relative;
}

.radio-item input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.radio-item label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: 9px;
    font-size: 13.5px;
    color: var(--text-sub);
    cursor: pointer;
    transition: .18s;
    background: #fff;
}

.radio-item label:hover {
    border-color: #b9c9ea;
}

.radio-item input[value="正常"]:checked + label {
    background: var(--success-light);
    border-color: #7ed9a3;
    color: var(--success);
    font-weight: 600;
}

.radio-item input[value="异常"]:checked + label {
    background: var(--danger-light);
    border-color: #f4a6a9;
    color: var(--danger);
    font-weight: 600;
}

/* ---------------- 表格 ---------------- */
.table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    min-width: 640px;
}

table.data-table thead th {
    background: #f6f9ff;
    color: var(--text);
    font-weight: 600;
    font-size: 13px;
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 2;
}

table.data-table tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid #f2f5fa;
    color: var(--text-sub);
    vertical-align: middle;
}

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

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

.td-main {
    color: var(--text);
    font-weight: 600;
}

.td-nowrap {
    white-space: nowrap;
}

.td-ellipsis {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---------------- 空状态 ---------------- */
.empty {
    padding: 46px 20px;
    text-align: center;
    color: var(--text-light);
}

.empty-icon {
    font-size: 40px;
    opacity: .55;
    margin-bottom: 8px;
    display: block;
}

.empty-title {
    font-size: 14px;
    color: var(--text-sub);
    margin-bottom: 4px;
}

.empty-desc {
    font-size: 12.5px;
}

/* ---------------- 提示条 ---------------- */
.flash-area {
    max-width: 1240px;
    margin: 14px auto 0;
    padding: 0 20px;
}

.flash {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 11px 15px;
    border-radius: 10px;
    font-size: 13.5px;
    margin-bottom: 10px;
    box-shadow: var(--shadow-sm);
    animation: flashIn .3s ease;
}

@keyframes flashIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: none; }
}

.flash-success {
    background: var(--success-light);
    color: #12703a;
    border-left: 3px solid var(--success);
}

.flash-error {
    background: var(--danger-light);
    color: #a32226;
    border-left: 3px solid var(--danger);
}

.flash-warning {
    background: var(--warning-light);
    color: #91500a;
    border-left: 3px solid var(--warning);
}

.tip-bar {
    display: flex;
    gap: 9px;
    align-items: flex-start;
    background: linear-gradient(96deg, #fff8e6, #fffdf7);
    border: 1px solid #ffe0a3;
    color: #8a5a09;
    border-radius: 10px;
    padding: 11px 14px;
    font-size: 13px;
    line-height: 1.6;
    margin-bottom: 14px;
}

.tip-bar .tip-icon {
    flex: 0 0 auto;
    font-size: 15px;
}

/* ---------------- 7 天图表 ---------------- */
.chart-box {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 8px;
    height: 180px;
    padding: 10px 4px 0;
}

.chart-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
    gap: 6px;
}

.chart-val {
    font-size: 12px;
    color: var(--text-sub);
    font-weight: 600;
}

.chart-bar-wrap {
    width: 100%;
    max-width: 34px;
    height: calc(100% - 52px);
    flex: 0 0 auto;
    display: flex;
    align-items: flex-end;
    border-radius: 6px 6px 0 0;
    background: #f6f8fd;
}

.chart-bar {
    width: 100%;
    border-radius: 6px 6px 0 0;
    background: linear-gradient(180deg, #ff9f43, #f2616a);
    min-height: 3px;
    transition: height .5s ease;
}

.chart-bar.zero {
    background: #dfe6f3;
}

.chart-label {
    font-size: 11px;
    color: var(--text-light);
    white-space: nowrap;
}

/* ---------------- 图片上传 ---------------- */
.upload-box {
    border: 2px dashed #d5deee;
    border-radius: 12px;
    padding: 22px 16px;
    text-align: center;
    background: #fafcff;
    cursor: pointer;
    transition: .2s;
}

.upload-box:hover,
.upload-box.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.upload-box .up-icon {
    font-size: 30px;
    display: block;
    margin-bottom: 6px;
    opacity: .8;
}

.upload-box .up-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.upload-box .up-desc {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 4px;
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 10px;
    margin-top: 14px;
}

.preview-item {
    position: relative;
    padding-top: 100%;
    border-radius: 10px;
    overflow: hidden;
    background: #f4f6fb;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.preview-item img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-item .del {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(229, 72, 77, .92);
    color: #fff;
    border: none;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    padding: 0;
}

.preview-item .fname {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(0deg, rgba(0, 0, 0, .62), rgba(0, 0, 0, 0));
    color: #fff;
    font-size: 10px;
    padding: 12px 5px 4px;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    z-index: 2;
}

/* ---------------- 巡检项填报 ---------------- */
.item-row {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 12px;
    background: #fff;
    transition: .2s;
}

.item-row.abnormal {
    border-color: #f4a6a9;
    background: #fffafa;
    box-shadow: 0 0 0 3px rgba(229, 72, 77, .06);
}

.item-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 11px;
    flex-wrap: wrap;
}

.item-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.item-index {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.item-type-tag {
    font-size: 11px;
    padding: 1px 7px;
    border-radius: 4px;
    background: #f0f4fd;
    color: #5a6b8c;
    font-weight: 400;
}

.item-remark-wrap {
    margin-top: 10px;
    display: none;
}

.item-remark-wrap.show {
    display: block;
}

.item-remark-wrap textarea {
    min-height: 64px;
    font-size: 13px;
}

.remark-toggle {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 12.5px;
    cursor: pointer;
    padding: 4px 0 0;
    font-family: inherit;
}

.remark-toggle:hover {
    color: var(--primary);
}

/* ---------------- 弹窗 ---------------- */
.modal-mask {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .52);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

.modal-mask.show {
    display: flex;
}

.modal {
    background: #fff;
    width: 100%;
    max-width: 780px;
    max-height: 92vh;
    border-radius: 18px 18px 0 0;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    animation: modalUp .28s cubic-bezier(.2, .8, .3, 1);
    overflow: hidden;
}

@keyframes modalUp {
    from { transform: translateY(40px); opacity: .6; }
    to { transform: none; opacity: 1; }
}

.modal-head {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex: 0 0 auto;
    padding-top: calc(15px + env(safe-area-inset-top));
}

.modal-title {
    font-size: 16px;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #f1f4fa;
    color: var(--text-sub);
    font-size: 17px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    background: var(--danger-light);
    color: var(--danger);
}

.modal-body {
    padding: 18px 20px 26px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1 1 auto;
    padding-bottom: calc(26px + env(safe-area-inset-bottom));
}

/* 详情信息块 */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.detail-cell {
    background: #f7f9fd;
    border-radius: 10px;
    padding: 10px 13px;
}

.detail-cell .k {
    font-size: 11.5px;
    color: var(--text-light);
    display: block;
    margin-bottom: 2px;
}

.detail-cell .v {
    font-size: 13.5px;
    color: var(--text);
    font-weight: 600;
    word-break: break-all;
}

.section-title {
    font-size: 14px;
    font-weight: 700;
    margin: 18px 0 10px;
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--text);
}

.section-title::before {
    content: "";
    width: 3px;
    height: 13px;
    background: var(--primary);
    border-radius: 2px;
}

/* 巡检明细表 */
.detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 0 0 1px var(--border);
}

.detail-table thead th {
    background: #f6f9ff;
    padding: 9px 11px;
    text-align: left;
    font-weight: 600;
    font-size: 12.5px;
    color: var(--text);
}

.detail-table tbody td {
    padding: 9px 11px;
    border-top: 1px solid #f2f5fa;
    color: var(--text-sub);
    vertical-align: top;
}

.detail-table tbody tr.abn td {
    background: #fff8f8;
}

/* 图片画廊 */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 9px;
}

.gallery-item {
    position: relative;
    padding-top: 100%;
    border-radius: 10px;
    overflow: hidden;
    background: #f2f5fa;
    cursor: zoom-in;
    box-shadow: var(--shadow-sm);
}

.gallery-item img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .25s;
}

.gallery-item:hover img {
    transform: scale(1.06);
}

/* 大图浏览 */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(8, 12, 24, .94);
    z-index: 400;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.lightbox.show {
    display: flex;
}

.lightbox img {
    max-width: 94vw;
    max-height: 82vh;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .6);
}

.lightbox-close {
    position: absolute;
    top: calc(16px + env(safe-area-inset-top));
    right: 18px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .16);
    color: #fff;
    border: none;
    font-size: 20px;
    cursor: pointer;
    z-index: 2;
    padding: 0;
    line-height: 1;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .14);
    color: #fff;
    border: none;
    font-size: 18px;
    cursor: pointer;
    z-index: 2;
    padding: 0;
    line-height: 1;
}

.lightbox-prev { left: 12px; }
.lightbox-next { right: 12px; }

.lightbox-count {
    position: absolute;
    bottom: calc(20px + env(safe-area-inset-bottom));
    left: 0;
    right: 0;
    text-align: center;
    color: rgba(255, 255, 255, .8);
    font-size: 13px;
}

/* ---------------- 模板列表 ---------------- */
.tpl-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}

.tpl-card {
    background: #fff;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 15px 17px;
    box-shadow: var(--shadow-sm);
    transition: .2s;
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.tpl-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
    border-color: #c7d8f7;
}

.tpl-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.tpl-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 7px;
}

.tpl-icon {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: var(--primary-light);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex: 0 0 auto;
}

.tpl-desc {
    font-size: 12.5px;
    color: var(--text-light);
    min-height: 34px;
    line-height: 1.5;
}

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

.tpl-actions {
    display: flex;
    gap: 8px;
    margin-top: 2px;
    padding-top: 10px;
    border-top: 1px dashed var(--border);
}

.tpl-actions .btn {
    flex: 1;
}

.cat-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    margin: 20px 0 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cat-title .bar {
    width: 4px;
    height: 16px;
    border-radius: 2px;
    background: linear-gradient(180deg, #2f6bff, #4d8dff);
}

.cat-count {
    font-size: 12px;
    color: var(--text-light);
    font-weight: 400;
}

/* ---------------- 巡检项编辑行 ---------------- */
.edit-item-row {
    display: grid;
    grid-template-columns: 38px 1fr 120px 78px 1.2fr 36px;
    gap: 8px;
    align-items: center;
    margin-bottom: 9px;
    padding: 8px;
    border-radius: 9px;
    background: #fafbfe;
    border: 1px solid #f0f3f9;
}

.edit-item-row .idx {
    text-align: center;
    color: var(--text-light);
    font-size: 12px;
}

.edit-item-row .form-control {
    height: 36px;
    font-size: 13px;
}

.edit-item-row .btn-del {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid #f4c9cb;
    background: #fff;
    color: var(--danger);
    cursor: pointer;
    font-size: 15px;
    padding: 0;
    line-height: 1;
}

.edit-item-row .btn-del:hover {
    background: var(--danger-light);
}

/* ---------------- 登录页 ---------------- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 18px;
    background: linear-gradient(135deg, #14275c 0%, #1e4fc4 45%, #2f6bff 100%);
    position: relative;
    overflow: hidden;
}

.login-page::before,
.login-page::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, .08);
}

.login-page::before {
    width: 420px;
    height: 420px;
    top: -160px;
    right: -120px;
}

.login-page::after {
    width: 320px;
    height: 320px;
    bottom: -140px;
    left: -100px;
    background: rgba(255, 255, 255, .06);
}

.login-card {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 480px;
    background: rgba(255, 255, 255, .98);
    border-radius: 20px;
    padding: 32px 26px 26px;
    box-shadow: 0 24px 60px rgba(8, 20, 60, .4);
}

.login-logo {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: linear-gradient(135deg, #2f6bff, #4d8dff);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 27px;
    margin: 0 auto 14px;
    box-shadow: 0 8px 20px rgba(47, 107, 255, .35);
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
}
.login-brand-text { flex: 1 1 auto; min-width: 0; }
.login-title {
    text-align: left;
    font-size: clamp(15px, 3.6vw, 19px);
    font-weight: 700;
    margin: 0;
    color: var(--text);
    line-height: 1.32;
    letter-spacing: 0;
    text-wrap: balance;
}

.login-sub {
    text-align: left;
    font-size: 12px;
    color: var(--text-light);
    margin: 4px 0 0;
    letter-spacing: .4px;
}

.login-form .form-control {
    height: 46px;
    border-radius: 11px;
    background: #f8fafe;
}

.login-form .btn {
    height: 46px;
    border-radius: 11px;
    font-size: 15px;
    margin-top: 6px;
}

.login-foot {
    text-align: center;
    font-size: 11.5px;
    color: var(--text-light);
    margin-top: 22px;
    line-height: 1.7;
}

/* ---------------- 工具类 ---------------- */
.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-0 { margin-bottom: 0; }
.text-sub { color: var(--text-sub); }
.text-light { color: var(--text-light); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-sm { font-size: 12.5px; }
.text-center { text-align: center; }
.fw-600 { font-weight: 600; }

.filter-bar {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.filter-item .form-label {
    margin: 0;
    font-size: 12.5px;
}

.filter-item .form-control {
    height: 38px;
    min-width: 150px;
}

/* 日期筛选在手机端占满整行 */
@media (max-width: 760px) {
    .filter-item {
        flex: 1 1 calc(50% - 12px);
    }
    .filter-item .form-control {
        min-width: 0;
        width: 100%;
    }
}

/* ---------------- 响应式 ---------------- */
@media (max-width: 1024px) {
    .kpi-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    .kpi-value {
        font-size: 26px;
    }
}

@media (max-width: 860px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .form-grid {
        grid-template-columns: 1fr;
    }
    .detail-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 760px) {
    .container {
        padding: 16px 13px 40px;
        padding-bottom: calc(40px + env(safe-area-inset-bottom));
    }

    .topbar-inner {
        padding: 10px 14px;
    }

    .topbar-inner {
        flex-wrap: nowrap;
    }

    .brand {
        font-size: 15px;
        min-width: 0;
        flex: 1 1 auto;
        overflow: hidden;
    }

    .brand {
        white-space: normal;
    }

    .brand-text {
        display: block;
        font-size: 13px;
        line-height: 1.3;
        white-space: normal;
        overflow: hidden;
    }

    .brand-sub {
        display: none;
    }

    .brand-logo {
        width: 26px;
        height: 26px;
        flex: 0 0 26px;
        font-size: 14px;
    }

    .topbar-user {
        flex: 0 0 auto;
        gap: 6px;
        font-size: 12px;
    }

    .topbar-user .avatar {
        width: 26px;
        height: 26px;
        font-size: 12px;
    }

    .logout-link {
        padding: 4px 9px;
        font-size: 12px;
    }

    .topbar-user .username {
        max-width: 68px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .navbar {
        position: static;
    }

    .nav-item {
        padding: 11px 14px;
        font-size: 13.5px;
    }

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

    .page-title .bar {
        height: 17px;
    }

    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .kpi-card {
        min-height: 88px;
        padding: 13px 15px;
        border-radius: 12px;
    }

    .kpi-value {
        font-size: 24px;
    }

    .kpi-label {
        font-size: 12px;
    }

    .card-body {
        padding: 14px 14px;
    }

    .card-head {
        padding: 13px 14px;
    }

    .btn {
        height: 40px;
        padding: 0 14px;
    }

    .btn-sm {
        height: 32px;
        font-size: 12.5px;
        padding: 0 10px;
    }

    table.data-table {
        min-width: 780px;
        font-size: 13px;
    }

    /* 手机端隐藏次要列，避免必须横向滑动才能看到操作按钮 */
    table.data-table.log-table,
    table.data-table.asset-table,
    table.data-table.user-table {
        min-width: 0;
        width: 100%;
    }

    table.data-table .col-hide {
        display: none;
    }

    table.data-table thead th,
    table.data-table tbody td {
        padding: 10px 11px;
    }

    .detail-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .modal-mask {
        align-items: flex-end;
        padding: 0;
    }

    .modal {
        border-radius: 16px 16px 0 0;
        max-height: 94vh;
    }

    .modal-body {
        padding: 15px 14px 20px;
    }

    .gallery {
        grid-template-columns: repeat(3, 1fr);
        gap: 7px;
    }

    .preview-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .edit-item-row {
        grid-template-columns: 28px 1fr 34px;
        grid-template-areas:
            "idx name del"
            ". type type"
            ". unit unit";
        gap: 7px;
    }

    .edit-item-row .idx { grid-area: idx; }
    .edit-item-row .i-name { grid-area: name; }
    .edit-item-row .i-type { grid-area: type; }
    .edit-item-row .i-unit { grid-area: unit; }
    .edit-item-row .btn-del { grid-area: del; }

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

    .chart-box {
        height: 150px;
        gap: 5px;
    }

    .chart-label {
        font-size: 10px;
        transform: scale(.92);
    }

    .filter-bar .btn {
        flex: 1 1 calc(50% - 6px);
    }

    .chart-val {
        font-size: 11px;
    }

    .td-ellipsis {
        max-width: 140px;
    }
}

@media (max-width: 400px) {
    .kpi-value {
        font-size: 22px;
    }
    .modal-head {
        padding: 13px 14px;
    }
    .gallery {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ---------------- 打印 ---------------- */
@media print {
    .topbar, .navbar, .flash-area, .btn-row, .no-print {
        display: none !important;
    }
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* ================= v8 新增：可点击 KPI / 签到 / 闭环 ================= */
.kpi-card {
    text-decoration: none;
    color: inherit;
    transition: transform .15s ease, box-shadow .15s ease;
}
.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(47, 107, 255, .16);
}
.kpi-card:active { transform: translateY(0); }
.kpi-card .kpi-foot { font-size: 12px; }

.kpi-teal { background: linear-gradient(135deg, #0fb9a5, #14a08f); }
.kpi-slate { background: linear-gradient(135deg, #64748b, #55637a); }

.standard-chip {
    display: inline-block;
    margin-top: 6px;
    padding: 3px 9px;
    border-radius: 20px;
    background: #eef3ff;
    color: #2f6bff;
    font-size: 12px;
    border: 1px solid #dbe6ff;
}
.standard-chip.strict { background: #fff4e8; color: #d97706; border-color: #ffe2c2; }

.item-standard-line {
    margin: 4px 0 10px;
    font-size: 12px;
    color: var(--text-light);
}

/* 签到页 */
.checkin-wrap { max-width: 720px; margin: 0 auto; }
.camera-box {
    position: relative;
    width: 100%;
    border-radius: 14px;
    overflow: hidden;
    background: #0f172a;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 220px;
}
.camera-box img { width: 100%; display: block; }
.camera-placeholder { color: #94a3b8; text-align: center; padding: 40px 16px; }
.camera-placeholder .big { font-size: 40px; display: block; margin-bottom: 10px; }
.shutter-btn {
    width: 100%;
    margin-top: 14px;
    padding: 15px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, #2f6bff, #4b83ff);
    color: #fff;
    cursor: pointer;
}
.shutter-btn.retake { background: #fff; color: #2f6bff; border: 1px solid #cddcff; }
.location-row { margin-top: 16px; }
.geo-hint { font-size: 12px; color: var(--text-light); margin-top: 6px; }

.checkin-banner {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 12px 14px;
    border-radius: 12px;
    background: #edf7f1;
    border: 1px solid #c9e9d6;
    margin-bottom: 16px;
}
.checkin-banner img {
    width: 72px; height: 72px; object-fit: cover; border-radius: 9px; cursor: zoom-in;
}
.checkin-banner > div { flex: 1 1 auto; min-width: 0; }
.checkin-banner .btn { flex: 0 0 auto; }
.checkin-banner .t { font-size: 13px; color: #15803d; font-weight: 600; }
.checkin-banner .d { font-size: 12px; color: #4b5563; margin-top: 4px; }

/* 闭环列表 */
.handle-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.handle-tab {
    padding: 7px 14px; border-radius: 20px; font-size: 13px;
    background: #fff; border: 1px solid #e6ebf5; color: #4b5563; text-decoration: none;
}
.handle-tab.active { background: #2f6bff; color: #fff; border-color: #2f6bff; }
.handle-tab .n { font-weight: 700; margin-left: 4px; }

.level-tag { padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; }
.level-一般 { background: #eef3ff; color: #2f6bff; }
.level-较重 { background: #fff4e8; color: #d97706; }
.level-严重 { background: #fdeaea; color: #dc2626; }

.status-tag { padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; }
.status-待处理 { background: #fdeaea; color: #dc2626; }
.status-整改中 { background: #fff4e8; color: #d97706; }
.status-待复查 { background: #eef3ff; color: #2f6bff; }
.status-已关闭 { background: #e9f7ef; color: #15803d; }

.flow-steps { display: flex; gap: 6px; margin: 14px 0 18px; }
.flow-step {
    flex: 1; text-align: center; font-size: 12px; padding: 8px 4px;
    border-radius: 8px; background: #f4f6fb; color: #94a3b8; border: 1px solid #eef1f7;
}
.flow-step.done { background: #eef7ff; color: #2f6bff; border-color: #cfe2ff; font-weight: 600; }

.review-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; margin-top: 10px; }
.review-grid a { display: block; }
.review-grid img { width: 100%; height: 96px; object-fit: cover; border-radius: 8px; border: 1px solid #eef1f7; }
.review-item { position: relative; }
.review-item form { position: absolute; top: 4px; right: 4px; }
.review-item button {
    width: 22px; height: 22px; border-radius: 50%; border: none; cursor: pointer;
    background: rgba(15,23,42,.7); color: #fff; font-size: 12px; line-height: 1;
}

/* 系统设置页 */
.plain-list {
    margin: 0;
    padding-left: 18px;
    font-size: 13px;
    color: #4b5563;
    line-height: 2;
}

/* 小屏顶栏：名称最多两行，避免把按钮挤出去 */
@media (max-width: 480px) {
    .brand-text {
        font-size: 12.5px;
        line-height: 1.3;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    .topbar-user .username { display: none; }
    .logout-link { padding: 4px 8px; font-size: 11.5px; }
}

/* 巡检执行：分组折叠 + 紧凑资产卡片 */
.asset-groups { display: flex; flex-direction: column; gap: 12px; }

.asset-group {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(31, 42, 68, .04);
}
.asset-group > summary {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    cursor: pointer;
    background: #f7f9ff;
    border-bottom: 1px solid transparent;
    font-size: 14px;
    user-select: none;
}
.asset-group > summary::-webkit-details-marker { display: none; }
.asset-group[open] > summary { border-bottom-color: var(--border); }
.asset-group > summary::before {
    content: '▸';
    color: #2f6bff;
    font-size: 13px;
    transition: transform .18s;
}
.asset-group[open] > summary::before { transform: rotate(90deg); }
.asset-group .g-name { font-weight: 700; color: var(--text); }
.asset-group .g-count { font-size: 12px; color: #6b7280; }
.asset-group .g-hint { margin-left: auto; font-size: 12px; color: #9aa4b8; }

.asset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 10px;
    padding: 12px;
}

.asset-card {
    border: 1px solid #e8edf7;
    border-radius: 10px;
    padding: 10px 12px;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: .18s;
}
.asset-card:hover { border-color: #b9c9ea; box-shadow: 0 4px 14px rgba(31, 42, 68, .08); }
.asset-card .ac-top { display: flex; align-items: center; gap: 8px; }
.asset-card .ac-top .badge { flex: 0 0 auto; white-space: nowrap; font-size: 11px; padding: 2px 6px; }
.asset-card .ac-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1 1 auto;
    min-width: 0;
}
.asset-card .ac-sub {
    font-size: 12px;
    color: #6b7280;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.asset-card .ac-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 2px;
}
.asset-card .ac-last { font-size: 11.5px; color: #9aa4b8; }
.asset-card .btn { padding: 5px 12px; font-size: 12.5px; }

@media (max-width: 480px) {
    .asset-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; padding: 10px; }
    .asset-card { padding: 9px 10px; }
    .asset-card .ac-name { font-size: 13px; }
}

/* 分类管理 */
.cat-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.cat-row .form-control { max-width: 320px; }
.cat-row > form { margin: 0; display: flex; align-items: center; }
.cat-count { font-size: 12px; color: #6b7280; min-width: 74px; }
.cat-add-form { display: flex; gap: 10px; align-items: center; }
.cat-add-form .form-control { max-width: 320px; }

/* 照片选择组件：拍照 / 相册双入口 */
.upload-area { position: relative; }
.file-hidden {
    position: absolute;
    width: 1px; height: 1px;
    opacity: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    border: 0; padding: 0; margin: 0;
    pointer-events: none;
}
.upload-box .up-btns {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 10px 0 6px;
}
.upload-box .up-btns .btn { position: relative; z-index: 2; }

/* ===== 手机端适配：列表卡片化 / 头部排布 / 顶栏单行 ===== */
:root { color-scheme: light; }

.list-cards { display: none; }

@media (max-width: 768px) {
    /* 列表页：隐藏宽表格，改用卡片 */
    .table-wrap-list { display: none; }
    .list-cards {
        display: block;
        padding: 12px;
        background: #fff;
    }

    .lc-item {
        border: 1px solid #e8edf7;
        border-radius: 12px;
        padding: 12px;
        margin-bottom: 10px;
        background: #fff;
    }
    .lc-item:last-child { margin-bottom: 0; }

    .lc-head {
        display: flex;
        align-items: center;
        gap: 8px;
    }
    .lc-title {
        flex: 1 1 auto;
        min-width: 0;
        font-size: 14.5px;
        font-weight: 600;
        color: var(--text);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .lc-head .badge { flex: 0 0 auto; font-size: 11.5px; }

    .lc-sub {
        margin-top: 6px;
        font-size: 12.5px;
        color: #6b7280;
        line-height: 1.7;
        word-break: break-all;
    }
    .lc-sub b { color: #374151; font-weight: 500; }

    .lc-foot {
        display: flex;
        gap: 8px;
        margin-top: 10px;
    }
    .lc-foot .btn { flex: 1 1 auto; }

    /* 页面头部：窄屏改为竖排，按钮独占一行 */
    .page-head { flex-direction: column; align-items: stretch; }
    .page-head .btn-row { width: 100%; flex-wrap: wrap; }
    .page-head .btn-row .btn { flex: 0 0 auto; justify-content: center; }

    /* 顶栏系统名：单行省略，不再换两行 */
    .brand-text {
        display: block;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 13px;
        line-height: 1.3;
        -webkit-line-clamp: unset;
        -webkit-box-orient: unset;
    }
}

/* ===== v8.7 修复：卡片溢出 / 状态标签折行 / 异常清单表格化 ===== */
.status-tag, .level-tag, .badge { white-space: nowrap; }

/* 巡检执行页资产卡片：列宽可压缩，内容不再把网格撑出屏幕 */
.asset-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.asset-card { min-width: 0; }
.asset-card .ac-name, .asset-card .ac-sub { min-width: 0; }
.asset-card .ac-last { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-card .ac-foot { min-width: 0; }

@media (max-width: 480px) {
    .asset-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 10px; }
    .asset-card .ac-foot { flex-wrap: wrap; gap: 6px; }
    .asset-card .ac-last { flex: 1 1 100%; }
    .asset-card .btn { flex: 0 0 auto; margin-left: auto; }
}

/* 异常项清单：一行一条，自适应不挤表格 */
.abn-list { display: flex; flex-direction: column; gap: 8px; }
.abn-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "head act" "sub act";
    gap: 3px 10px;
    align-items: center;
    border: 1px solid #eef2f9;
    border-radius: 10px;
    padding: 10px 12px;
    background: #fff;
}
.abn-row .abn-head { grid-area: head; display: flex; align-items: center; gap: 8px; min-width: 0; }
.abn-row .abn-name {
    font-size: 14px; font-weight: 600; color: var(--text);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.abn-row .abn-sub { grid-area: sub; font-size: 12.5px; color: #6b7280; line-height: 1.6; }
.abn-row .abn-btn { grid-area: act; }

@media (max-width: 480px) {
    .abn-row { grid-template-columns: 1fr; grid-template-areas: "head" "sub" "act"; }
    .abn-row .abn-btn { justify-self: start; margin-top: 4px; }
}

/* 详情页/弹窗里的小表格：窄屏不挤压 */
@media (max-width: 480px) {
    .detail-table th, .detail-table td { padding: 8px 6px; font-size: 12.5px; }
    .detail-table th { white-space: nowrap; }
}

/* 巡检明细：逐项列表，替代手机上被裁的表格 */
.item-list { display: flex; flex-direction: column; gap: 6px; }
.item-row {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
    border: 1px solid #f0f3fa; border-radius: 8px; padding: 8px 10px; background: #fff;
}
.item-row.abn { background: #fff8f8; border-color: #fde3e3; }
.item-row .item-name {
    flex: 1 1 40%; min-width: 0; font-size: 13.5px; color: var(--text);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.item-row .item-remark { flex: 1 1 100%; font-size: 12.5px; color: #d6336c; line-height: 1.5; }

/* ===== v8.8 手机端导航与首页优化 ===== */
@media (max-width: 768px) {
    /* 导航可横向滑动，右侧渐隐提示「还有内容」（sticky 元素本身可作定位参照，不能改成 relative，否则会盖住页面标题） */
    .navbar::after {
        content: ''; position: absolute; right: 0; top: 0; bottom: 0; width: 26px;
        background: linear-gradient(90deg, rgba(255,255,255,0) 0%, #fff 78%);
        pointer-events: none;
    }
    .nav-item { padding: 11px 13px; font-size: 13.5px; }
}

@media (max-width: 480px) {
    .hide-sm { display: none; }
    .page-desc { font-size: 12.5px; line-height: 1.6; }
    .kpi-grid { gap: 10px; }
    .kpi-value { font-size: 22px; }
    .kpi-foot { font-size: 11.5px; }
}

/* ===== v8.8 首页按轮次趋势 ===== */
.chart-bar { background: linear-gradient(180deg, #6d9bff, #2f6bff); }
.chart-bar.has-abn { background: linear-gradient(180deg, #ffb253, #f2616a); }
.chart-bar.gap-warn { background: linear-gradient(180deg, #ffcf70, #f08a2b); }
.chart-sub { font-size: 11px; color: #9aa4b8; white-space: nowrap; }
.chart-gap { font-size: 10.5px; color: #b6bfd0; white-space: nowrap; }
.chart-gap.warn { color: #e8590c; font-weight: 600; }
.chart-box { height: 200px; }
.chart-bar-wrap { height: calc(100% - 74px); }

/* 资产页：折叠分组内的表格与卡片 */
.asset-groups-list { padding: 12px; gap: 10px; }
.asset-groups-list .asset-group { box-shadow: none; }
.asset-groups-list .table-wrap { border: none; border-radius: 0; }
.asset-groups-list .list-cards-flat { padding: 10px; }
.td-sub { font-size: 11.5px; color: #9aa4b8; margin-top: 2px; }
.td-sn { max-width: 170px; overflow: hidden; text-overflow: ellipsis; }

/* 通用列表搜索栏 */
.list-search {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px;
}
.list-search input[type="text"] {
    flex: 1 1 220px; min-width: 0;
    height: 38px; padding: 0 12px; font-size: 13.5px;
    border: 1px solid var(--border); border-radius: 8px; background: #fff; color: var(--text);
}
.list-search input[type="text"]:focus { outline: none; border-color: #2f6bff; }

@media (max-width: 480px) {
    .chart-box { height: 175px; gap: 4px; }
    .chart-bar-wrap { max-width: 22px; height: calc(100% - 70px); }
    .chart-val { font-size: 10.5px; }
    .chart-label, .chart-sub, .chart-gap { font-size: 9.5px; }
    .asset-groups-list { padding: 8px; }
    .list-search input[type="text"] { flex: 1 1 100%; }
    .td-sn { max-width: none; }
}

/* v8.9 资产列表：机柜号以小字显示在 U 位上方 */
.td-sub2 {
    font-size: 12px;
    color: #8a94a6;
    line-height: 1.35;
    margin-bottom: 1px;
}

/* v8.9 资产表格：操作列不换行，型号列不撑宽 */
.asset-group table th:last-child,
.asset-group table td:last-child { white-space: nowrap; }
.asset-group table td:last-child .btn { margin-left: 4px; }
.asset-group table td:last-child .btn:first-child { margin-left: 0; }
.asset-group table td:nth-child(3) { max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
.asset-group table td:nth-child(4),
.asset-group table td:nth-child(5) { max-width: 150px; overflow: hidden; text-overflow: ellipsis; }

/* v8.9 巡检选择卡片：窄屏下资产名最多两行，避免长名称被截成「硬盘录像机（…」分不清 */
@media (max-width: 480px) {
    .asset-card .ac-top { align-items: flex-start; }
    .asset-card .ac-name {
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        font-size: 12.5px;
        line-height: 1.3;
    }
    .asset-card .ac-sub {
        font-size: 11.5px;
        line-height: 1.4;
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }
    .asset-card .badge { flex: 0 0 auto; font-size: 11px; padding: 1px 6px; }
}

/* v9.0 巡检分组切换 */
.group-switch {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 14px;
    flex-wrap: wrap;
}
.gs-item {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid var(--border, #e8edf7);
    color: #4b5563;
    font-size: 13px;
    text-decoration: none;
}
.gs-item.on {
    background: #2f6bff;
    border-color: #2f6bff;
    color: #fff;
    font-weight: 600;
}
.gs-hint { font-size: 12px; color: #9aa4b8; margin-left: 4px; }
@media (max-width: 480px) {
    .gs-hint { display: none; }
    .gs-item { padding: 5px 12px; font-size: 12.5px; }
}

/* v9.0 设置页复选行 */
.form-check {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13.5px;
    color: #374151;
    cursor: pointer;
    line-height: 1.5;
}
.form-check input[type=checkbox] {
    width: 16px;
    height: 16px;
    margin: 2px 0 0;
    flex: 0 0 auto;
}

/* v9.0 巡检表单：正常/异常按钮不折字 */
.radio-item label,
.radio-group label { white-space: nowrap; }
