﻿/* ========== 全局样式 ========== */
:root {
    --primary: #87CEEB;
    --primary-light: #a0d8ef;
    --primary-dark: #5ba4cf;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg: #f1f5f9;
    --surface: #ffffff;
    --border: #e2e8f0;
    --text: #1e293b;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: 0.2s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* ========== 顶部导航 ========== */
.header {
    background: linear-gradient(135deg, #5ba4cf, #87CEEB);
    color: white;
    padding: 0 24px;
    height: 50px;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    position: sticky;
    top: 0;
    z-index: 100;
}

/* 小程序环境下隐藏网页 logo/标题，由微信导航栏统一显示 */
.in-miniprogram .header .logo,
.in-miniprogram .header h1,
.in-miniprogram .header .logo-img {
    display: none !important;
}
.in-miniprogram .auth-logo,
.in-miniprogram #loginPage .auth-card h2 {
    display: none !important;
}
.in-miniprogram .sidebar-logo {
    display: none !important;
}

.header-content {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo .logo-img {
    width: 56px;
    height: 56px;
    object-fit: contain;
}

.logo h1 {
    font-size: 28px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.header-stats {
    display: flex;
    gap: 12px;
    align-items: center;
}

.btn-header {
    background: rgba(255,255,255,0.15);
    color: white;
    border: 1px solid rgba(255,255,255,0.25);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    font-weight: 500;
}

.btn-header:hover {
    background: rgba(255,255,255,0.3);
}

.stat-badge {
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(10px);
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

/* ========== 导航标签栏 ========== */
.tab-nav {
    display: flex;
    background: white;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    position: sticky;
    top: 50px;
    z-index: 99;
}

.tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    white-space: nowrap;
}

.tab-btn::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 3px;
    background: var(--primary);
    border-radius: 3px 3px 0 0;
    transition: width 0.25s ease;
}

.tab-btn:hover {
    color: var(--primary);
    background: rgba(37, 99, 235, 0.04);
}

.tab-btn.active {
    color: var(--primary);
    font-weight: 600;
}

.tab-btn.active::after {
    width: 60%;
}

.tab-btn svg {
    flex-shrink: 0;
}

/* ========== 主容器 ========== */
.main-container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 24px;
    animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========== 设备管理页 ========== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-header h2 {
    font-size: 22px;
    font-weight: 700;
}

.page-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box svg {
    position: absolute;
    left: 14px;
    color: var(--text-secondary);
    pointer-events: none;
}

.search-box input {
    padding: 10px 14px 10px 38px;
    border: 1px solid var(--border);
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    width: 260px;
    background: var(--surface);
    transition: var(--transition);
}

.search-box input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

/* 筛选栏 */
.filter-bar {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 20px;
    padding: 16px 20px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    flex-wrap: wrap;
    border: 1px solid var(--border);
}

.filter-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-item label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-item select {
    padding: 8px 32px 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    background: var(--bg);
    cursor: pointer;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    min-width: 150px;
    transition: var(--transition);
}

.filter-item select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

#btnClearFilter,
#btnClearInspectionFilter {
    align-self: flex-end;
    padding: 8px 16px !important;
    font-size: 14px !important;
    font-family: inherit !important;
    font-weight: 500 !important;
    border-radius: var(--radius-sm) !important;
    background: var(--bg) !important;
    border: 1px solid var(--border) !important;
    color: var(--text) !important;
    cursor: pointer !important;
    line-height: normal !important;
}

#btnClearFilter:hover,
#btnClearInspectionFilter:hover {
    background: #e2e8f0 !important;
    border-color: #94a3b8 !important;
}

/* 设备卡片网格 */
.device-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

/* 空状态 */
.empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    color: var(--text-secondary);
    text-align: center;
}

.empty-state svg {
    margin-bottom: 16px;
}

.empty-state p {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

.empty-state span {
    font-size: 13px;
}

/* 设备卡片 */
.device-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 10px 20px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.device-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    border-radius: var(--radius) var(--radius) 0 0;
}

.device-card.status-normal::before { background: #87CEEB; }
.device-card.status-warning::before { background: var(--warning); }
.device-card.status-error::before { background: var(--danger); }

.device-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

.device-card .card-header {
    margin-bottom: 12px;
}

.card-name-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.device-card .card-name {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.4;
}

.device-card .card-status {
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 12px;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: auto;
}

.device-card .card-status.normal { background: #ecfdf5; color: #059669; }
.device-card .card-status.warning { background: #fffbeb; color: #d97706; }
.device-card .card-status.error { background: #fef2f2; color: #dc2626; }

.device-card .card-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.device-card .card-meta-inline {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.device-card .meta-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: var(--text-secondary);
}

.device-card .meta-tag svg {
    flex-shrink: 0;
}

.device-card .meta-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.device-card .meta-row svg {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
}

.device-card .card-footer {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.device-card .last-inspect {
    font-size: 12px;
    color: var(--text-secondary);
}




.device-card .arrow-icon {
    color: var(--primary);
    opacity: 0;
    transform: translateX(-4px);
    transition: var(--transition);
}

.device-card:hover .arrow-icon {
    opacity: 1;
    transform: translateX(0);
}

/* ========== 设备详情页 ========== */
.back-bar {
    margin-bottom: 20px;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    background: var(--surface);
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: var(--transition);
    font-family: inherit;
}

.back-btn:hover {
    color: var(--primary);
    box-shadow: var(--shadow-md);
}

/* 设备信息卡片 */
.detail-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    overflow: hidden;
    position: relative;
}

.detail-card-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 24px 24px 16px;
    min-width: 0;
    overflow: hidden;
}

.detail-title {
    line-height: 1.4;
    word-break: break-word;
    overflow-wrap: break-word;
    min-width: 0;
    flex: 1;
}

.back-btn-topright {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 10;
    border-radius: 0 0 0 var(--radius-sm);
}

.detail-title h2 {
    display: inline;
    font-size: 22px;
    font-weight: 700;
    vertical-align: middle;
}

.device-status {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    vertical-align: middle;
    margin-left: 8px;
}

.device-status.normal { background: #ecfdf5; color: #059669; }
.device-status.warning { background: #fffbeb; color: #d97706; }
.device-status.error { background: #fef2f2; color: #dc2626; }

.detail-actions {
    display: flex;
    gap: 8px;
}

.detail-info-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 0 24px 24px;
    transition: all 0.25s ease;
    overflow: hidden;
    max-height: 2000px;
    opacity: 1;
}

.detail-info-grid.collapsed {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
    margin: 0;
}

/* 折叠按钮图标旋转 */
#btnToggleInfo svg {
    transition: transform 0.25s ease;
}

#btnToggleInfo.expanded svg {
    transform: rotate(180deg);
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.info-item .info-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-item .info-value {
    font-size: 14px;
    font-weight: 500;
}

.info-item-full {
    grid-column: 1 / -1;
}

.detail-site-photos-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}

.detail-photo-thumb {
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
    border: 2px solid var(--border);
    transition: var(--transition);
}

.detail-photo-thumb:hover {
    border-color: var(--primary);
    transform: scale(1.03);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.detail-photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* 设备弹窗内站点照片按钮自适应10张，保持正方形 */
.photo-add-btn.device-photo-add-btn {
    width: calc((100% - 30px) / 4);
    aspect-ratio: 1;
}

@media (max-width: 768px) {
    .photo-add-btn.device-photo-add-btn {
        width: calc((100% - 20px) / 4);
        aspect-ratio: 1;
    }
    .detail-site-photos-gallery {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 8px;
    }
}

/* ========== 巡检表单 ========== */
.inspection-form {
    background: var(--surface);
    padding: 15px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

/* 温度输入行 */
.temp-input-row {
    display: flex;
    gap: 16px;
    flex-wrap: nowrap;
    align-items: center;
}

.temp-input-item {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.temp-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    flex-shrink: 0;
}

.temp-input-item input {
    width: 28px !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    outline: none;
    padding: 0 !important;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    font-family: inherit;
    text-align: left;
    background: transparent;
    border-bottom: 1.5px solid #999 !important;
    flex-shrink: 0;
}

.temp-input-item input:focus {
    outline: none;
    box-shadow: none !important;
    border-bottom: 2px solid var(--primary) !important;
}

.temp-unit {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    flex-shrink: 0;
}

.temp-input-item select {
    width: 42px !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    outline: none;
    padding: 0 !important;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    font-family: inherit;
    text-align: left;
    background: transparent;
    border-bottom: 1.5px solid #999 !important;
    flex-shrink: 0;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.temp-input-item select:focus {
    outline: none;
    box-shadow: none !important;
    border-bottom: 2px solid var(--primary) !important;
}

.inspection-form h3,
.inspection-history h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
}

.history-count {
    font-size: 13px;
    font-weight: 400;
    color: #94a3b8;
    margin-left: 4px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}

.form-group textarea,
.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="date"],
.form-group input[type="number"],
.form-group input[type="datetime-local"],
.form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: var(--transition);
    resize: vertical;
}

.form-group textarea:focus,
.form-group input:focus,
.form-group select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}










.form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

/* 巡检时间自定义显示 */
.time-display-wrapper {
    display: flex;
    align-items: center;
}

.time-display {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    width: 100%;
    display: inline-block;
    user-select: none;
}

.time-display .time-year {
    cursor: pointer;
}

.required {
    color: var(--danger);
}

/* 状态选择器 */
.status-selector {
    display: flex;
    gap: 8px;
}

.status-option {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: var(--transition);
    user-select: none;
}

.status-option:hover {
    border-color: #94a3b8;
}

.status-option.selected {
    border-color: var(--primary);
    background: #eff6ff;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.green { background: var(--success); }
.status-dot.yellow { background: var(--warning); }
.status-dot.red { background: var(--danger); }

/* 图片上传 */
.photo-upload-area {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-start;
}

.photo-item {
    width: calc((100% - 30px) / 16);
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    position: relative;
    border: 2px solid var(--border);
}

.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-item .photo-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--danger);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
}

.photo-item:hover .photo-remove {
    opacity: 1;
}

/* 图片上传 loading 转圈 */
.photo-loading-spinner {
    width: 100%;
    height: 100%;
    background: #f0f4f8;
    display: flex;
    align-items: center;
    justify-content: center;
}
.photo-loading-spinner::after {
    content: '';
    width: 24px;
    height: 24px;
    border: 3px solid #e0e0e0;
    border-top-color: var(--primary, #4f46e5);
    border-radius: 50%;
    animation: photo-spin 0.8s linear infinite;
}
@keyframes photo-spin {
    to { transform: rotate(360deg); }
}

/* 图片上传失败 */
.photo-error-icon {
    width: 100%;
    height: 100%;
    background: #fff2f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    color: #ff4d4f;
    border: 2px dashed #ff4d4f;
}

/* 上传中的照片项：一直显示 X 按钮 */
.photo-item.uploading .photo-remove,
.photo-item.error .photo-remove {
    opacity: 1;
}

.photo-add-btn {
    width: calc((100% - 30px) / 16);
    aspect-ratio: 1;
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
    font-size: 10px;
    padding: 2px;
}

.photo-add-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #f8fafc;
}

/* 巡检表单（提交/修改）中的照片按钮和缩略图，固定正方形尺寸 */
#photoUploadArea .photo-add-btn,
#editPhotoUploadArea .photo-add-btn {
    width: 80px;
    aspect-ratio: 1;
    font-size: 11px;
    gap: 3px;
    padding: 4px;
}

#photoUploadArea .photo-item,
#editPhotoUploadArea .photo-item {
    width: 80px;
    aspect-ratio: 1;
}

/* 定位行 */
.location-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.location-text {
    font-size: 14px;
    color: var(--text-secondary);
}



.location-input {
    font-size: 14px;
    color: var(--text);
    border: 1px solid #d1d5db;
    border-radius: 4px;
    padding: 2px 8px;
    width: 100%;
    max-width: 260px;
    outline: none;
    background: transparent;
    box-shadow: none !important;
}

.location-input:focus {
    border-color: #d1d5db !important;
    box-shadow: none !important;
    outline: none !important;
    background: transparent !important;
}

/* 巡检人员显示 */
.inspector-display {
    padding: 10px 14px;
    font-size: 15px;
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-weight: 500;
}

/* ========== 巡检历史 ========== */
.inspection-history {
    background: var(--surface);
    padding: 15px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* 巡检历史 - 筛选行 */
.history-filter-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.history-filter-label {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.history-filter-select {
    flex: 1;
    max-width: 200px;
    padding: 6px 10px;
    font-size: 13px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #fff;
    color: var(--text-primary);
    outline: none;
    cursor: pointer;
}

.history-filter-select:focus {
    border-color: var(--primary);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-list .empty-hint {
    text-align: center;
    color: var(--text-secondary);
    padding: 24px;
    font-size: 14px;
}

.history-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    cursor: pointer;
    transition: var(--transition);
}

.history-card:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow);
}

.history-card .hc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.history-card .hc-time {
    font-size: 13px;
    color: var(--text-secondary);
}

.history-card .hc-status {
    font-size: 12px;
    padding: 2px 10px;
    border-radius: 12px;
    font-weight: 600;
}

.history-card .hc-status.normal { background: #ecfdf5; color: #059669; }
.history-card .hc-status.warning { background: #fffbeb; color: #d97706; }
.history-card .hc-status.error { background: #fef2f2; color: #dc2626; }

.history-card .hc-desc {
    font-size: 13px;
    color: var(--text);
    line-height: 1.5;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

.history-card .hc-photos {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.history-card .hc-photos img {
    width: 30px;
    height: 30px;
    border-radius: 4px;
    object-fit: cover;
    border: 1px solid var(--border);
}

.history-card .hc-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.history-card .hc-actions .btn {
    font-size: 12px;
    padding: 5px 10px;
    gap: 4px;
}

.history-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding-top: 16px;
    margin-top: 4px;
}

.hp-btn {
    padding: 5px 14px;
    font-size: 13px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    transition: var(--transition);
}

.hp-btn:hover:not(:disabled) {
    border-color: var(--primary-light);
    color: var(--primary);
}

.hp-btn:disabled {
    color: #cbd5e1;
    cursor: not-allowed;
}

.hp-info {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ========== 按钮 ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    font-family: inherit;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-outline:hover {
    background: var(--bg);
    border-color: #94a3b8;
}

.btn-danger {
    background: transparent;
    border: 1px solid #fecaca;
    color: var(--danger);
}

.btn-danger:hover {
    background: #fef2f2;
}

.btn-success {
    background: var(--primary);
    border: 1px solid var(--primary);
    color: white;
}

.btn-success:hover {
    background: #1d4ed8;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

.btn-block {
    width: 100%;
    padding: 12px;
    font-size: 15px;
}

.btn:active {
    transform: scale(0.97);
}

/* ========== 分页组件 ========== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 16px 0;
    flex-wrap: wrap;
}

.pagination-info {
    font-size: 13px;
    color: var(--text-secondary);
    margin-right: 8px;
}

.pagination-btn {
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.pagination-btn:hover:not(:disabled):not(.active) {
    border-color: var(--primary);
    color: var(--primary);
    background: #eff6ff;
}

.pagination-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    font-weight: 600;
}

.pagination-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination-ellipsis {
    min-width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 14px;
}

@media (max-width: 768px) {
    .pagination-btn {
        min-width: 32px;
        height: 32px;
        font-size: 13px;
        padding: 0 8px;
    }
    .pagination-info {
        font-size: 12px;
    }
}

/* ========== 弹窗 ========== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background: var(--surface);
    border-radius: var(--radius);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    transform: translateY(10px);
    transition: transform 0.2s;
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-lg {
    max-width: 650px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: transparent;
    font-size: 22px;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--bg);
    color: var(--text);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}

/* 图片查看器 */
.modal-image-viewer {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
}

.modal-image-viewer img {
    max-width: 90vw;
    max-height: 85vh;
    border-radius: var(--radius-sm);
    object-fit: contain;
}

.img-close {
    position: absolute;
    top: -40px;
    right: 0;
    color: white;
    font-size: 28px;
}

/* 巡检详情 */
.inspection-detail-content {
    max-width: 100%;
    overflow: hidden;
    word-break: break-word;
}

.inspection-detail-content .detail-section {
    margin-bottom: 20px;
}

.inspection-detail-content .detail-section h4 {
    font-size: 14px;
    color: var(--text);
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.inspection-detail-content .detail-section p {
    font-size: 14px;
    line-height: 1.6;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

.inspection-detail-content .detail-photos {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.inspection-detail-content .detail-photos img {
    width: 120px;
    height: 120px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    cursor: pointer;
    border: 2px solid var(--border);
    transition: var(--transition);
}

.inspection-detail-content .detail-photos img:hover {
    border-color: var(--primary);
    transform: scale(1.02);
}

/* ========== Toast 提示 ========== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--surface);
    border-radius: var(--radius-sm);
    padding: 12px 20px;
    box-shadow: var(--shadow-lg);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2.5s forwards;
    max-width: 360px;
    border-left: 4px solid var(--primary);
}

.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--success); }
.toast.warning { border-left-color: var(--warning); }

.toast .toast-icon { font-size: 18px; flex-shrink: 0; }

@keyframes toastIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes toastOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* ========== 登录/注册页 ========== */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #5ba4cf 0%, #87CEEB 50%, #a0d8ef 100%);
    padding: 24px;
    animation: fadeIn 0.3s ease;
}

.auth-card {
    background: var(--surface);
    border-radius: 16px;
    padding: 40px 32px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    text-align: center;
}

.auth-logo {
    width: 120px;
    height: auto;
    margin: 0 auto 8px;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-logo img {
    width: 100%;
    height: auto;
    object-fit: contain;
}

.auth-card h2 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text);
}

.auth-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.auth-form {
    text-align: left;
}

.auth-form .form-group {
    margin-bottom: 16px;
}

.auth-form .form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}

.auth-form .form-group input,
.auth-form .form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: var(--transition);
    background: var(--surface);
}

.auth-form .form-group input:focus,
.auth-form .form-group select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.auth-form .form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.remember-row {
    margin-bottom: 4px;
}

.remember-label {
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 400 !important;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}

.remember-label input[type="checkbox"] {
    width: 16px !important;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
    margin: 0;
    padding: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    flex-shrink: 0;
}

.auth-form .btn-block {
    margin-top: 8px;
}

.auth-switch {
    margin-top: 20px;
    font-size: 13px;
    color: var(--text-secondary);
}

.auth-hint {
    font-size: 13px;
    color: var(--text-secondary);
    background: var(--bg-muted, #f0f4ff);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    line-height: 1.6;
    margin: 0;
}

.auth-hint b {
    color: var(--primary);
}

.auth-switch a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
}

.auth-switch a:hover {
    text-decoration: underline;
}

/* ========== 会员管理页 ========== */
.user-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.user-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    transition: var(--transition);
    border: 1px solid transparent;
}

.user-card:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-md);
}

.user-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.user-avatar.admin {
    background: linear-gradient(135deg, #1e3a5f, #2563eb);
}

.user-avatar.employee {
    background: linear-gradient(135deg, #059669, #10b981);
}

.user-avatar.member {
    background: linear-gradient(135deg, #64748b, #94a3b8);
}

.user-avatar.company_admin {
    background: linear-gradient(135deg, #7c3aed, #a78bfa);
}

.user-avatar.vip {
    background: linear-gradient(135deg, #d97706, #fbbf24);
}

.user-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.user-name {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 12px;
}
.user-name-text {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-meta {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    min-width: 0;
}

.user-meta > span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.user-role-badge.admin { background: #eff6ff; color: #2563eb; }
.user-role-badge.employee { background: #ecfdf5; color: #059669; }
.user-role-badge.member { background: #f1f5f9; color: #64748b; }
.user-role-badge.company_admin { background: #f5f3ff; color: #7c3aed; }
.user-role-badge.vip { background: #fffbeb; color: #d97706; }

.user-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
    align-items: center;
}

.user-actions .btn {
    padding: 6px 12px;
    font-size: 12px;
    white-space: nowrap;
}

/* 移动端：缩小按钮和间距 */
@media (max-width: 600px) {
    .user-card {
        padding: 16px 12px;
        gap: 10px;
    }
    .user-avatar {
        width: 42px;
        height: 42px;
        font-size: 18px;
    }
    .user-name {
        gap: 6px;
    }
    .user-name-text {
        font-size: 14px;
    }
    .user-actions {
        gap: 4px;
    }
    .user-actions .btn {
        padding: 4px 8px;
        font-size: 11px;
    }
}

.user-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

/* ========== 个人中心页 ========== */
.profile-section {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

/* 功能管理 - 功能项 */
.feature-item {
    transition: border-color 0.2s;
}
.feature-item:hover {
    border-color: var(--primary) !important;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 16px;
}

.profile-info-col {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;
}

.profile-info-col h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
}

.profile-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #5ba4cf, #87CEEB);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    font-weight: 700;
    flex-shrink: 0;
}

.profile-meta-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.profile-stats-col {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    flex-shrink: 0;
    width: fit-content;
    margin-left: 24px;
}

.profile-stats-col .stat-badge {
    display: block !important;
    width: fit-content;
    white-space: nowrap;
}

.profile-role-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    background: var(--primary-light);
    color: white;
}

.profile-role-badge.admin {
    background: #dc2626;
}

.profile-role-badge.employee {
    background: var(--primary);
}

.profile-role-badge.member {
    background: var(--text-secondary);
}

.profile-role-badge.company_admin {
    background: #7c3aed;
}

.profile-role-badge.vip {
    background: #d97706;
}

.profile-username {
    font-size: 13px;
    color: var(--text-secondary);
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text);
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.profile-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.info-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.info-value {
    font-size: 15px;
    color: var(--text);
    font-weight: 500;
}

.profile-form .form-group {
    margin-bottom: 16px;
}

.profile-form .form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}

.profile-form .form-group input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: var(--transition);
    background: var(--surface);
}

.profile-form .form-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

@media (max-width: 768px) {
    .profile-info-grid {
        grid-template-columns: 1fr;
    }
    .profile-header {
        flex-direction: row;
        text-align: left;
    }
    .profile-meta-row {
        justify-content: flex-start;
    }
}

/* ========== 导出弹窗 ========== */
.export-preview-info {
    font-size: 13px;
    color: var(--text-secondary);
    background: var(--bg);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    line-height: 1.6;
    min-height: 20px;
}

/* ========== 导出记录勾选列表 ========== */
.export-format-selector {
    display: flex;
    gap: 16px;
    margin-top: 6px;
}

.format-radio {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 8px 14px;
    border: 2px solid var(--border);
    border-radius: 8px;
    transition: var(--transition);
    user-select: none;
}

.format-radio:hover {
    border-color: var(--primary-light);
}

.format-radio input[type="radio"] {
    accent-color: var(--primary);
    width: 16px;
    height: 16px;
}

.format-radio:has(input:checked) {
    border-color: var(--primary);
    background: #EFF6FF;
}

.format-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
}

.export-record-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.export-record-list {
    max-height: 280px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
}

.export-record-list .empty-hint {
    padding: 24px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
}

.export-record-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
}

.export-record-item:last-child {
    border-bottom: none;
}

.export-record-item:hover {
    background: #f8fafc;
}

.export-record-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    flex-shrink: 0;
    cursor: pointer;
}

.export-record-item .record-time {
    font-size: 13px;
    color: var(--text);
    font-weight: 500;
    flex-shrink: 0;
}

.export-record-item .record-inspector {
    font-size: 12px;
    color: var(--text-secondary);
}

.export-record-item .record-status {
    margin-left: auto;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    flex-shrink: 0;
}

.export-record-item .record-status.normal {
    background: #ecfdf5;
    color: #059669;
}

.export-record-item .record-status.warning {
    background: #fffbeb;
    color: #d97706;
}

.export-record-item .record-status.error {
    background: #fef2f2;
    color: #dc2626;
}

.export-record-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-top: 1px solid var(--border);
}

.erp-btn {
    padding: 4px 12px;
    font-size: 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    transition: var(--transition);
}

.erp-btn:hover:not(:disabled) {
    border-color: var(--primary-light);
    color: var(--primary);
}

.erp-btn:disabled {
    color: #cbd5e1;
    cursor: not-allowed;
}

.erp-info {
    font-size: 12px;
    color: var(--text-secondary);
}

/* ========== 导出预览面板 ========== */
.export-preview-panel {
    margin-top: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    overflow: hidden;
}

.export-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
}

.export-preview-header h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.export-preview-content {
    max-height: 420px;
    overflow-y: auto;
    padding: 20px;
    background: #e8ecf1;
}

.export-preview-content .preview-page {
    background: white;
    padding: 18px 28px;
    margin-bottom: 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
    border-radius: 2px;
    font-family: 'PingFang SC','Microsoft YaHei',Arial,sans-serif;
    font-size: 12px;
    color: #1e293b;
    line-height: 1.4;
    position: relative;
    width: 210mm;
    min-height: 297mm;
    margin-left: auto;
    margin-right: auto;
}

.export-preview-content .preview-page:last-child {
    margin-bottom: 0;
}

.export-preview-content .preview-page-header {
    border-bottom: 1.5px solid #2563eb;
    padding-bottom: 6px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.export-preview-content .preview-page-header .preview-logo {
    font-size: 14px;
    font-weight: 700;
    color: #2563eb;
    display: flex;
    align-items: center;
    gap: 6px;
}

.export-preview-content .preview-page-header .preview-logo .preview-logo-img {
    height: 20px;
    width: auto;
    object-fit: contain;
}

.export-preview-content .preview-page-header .preview-label {
    font-size: 10px;
    color: #64748b;
}

.export-preview-content .preview-device-name {
    font-size: 16px;
    font-weight: normal;
    color: #1e3a5f;
    margin: 6px 0 4px;
}

.export-preview-content .preview-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 6px;
}

.export-preview-content .preview-table td {
    padding: 3px 10px;
    border: 1px solid #e2e8f0;
    font-size: 10px;
}

.export-preview-content .preview-table .preview-label-cell {
    background: #f8fafc;
    font-weight: normal;
    color: #475569;
    width: 20%;
}

.export-preview-content .preview-item {
    display: inline-block;
    margin-right: 12px;
    font-size: 10px;
}
.export-preview-content .preview-item-label {
    color: #64748b;
}
.export-preview-content .preview-item-value {
}

.export-preview-content .preview-section-title {
    font-size: 11px;
    font-weight: normal;
    color: #1e3a5f;
    margin: 6px 0 4px;
}

.export-preview-content .preview-desc {
    font-size: 10px;
    margin-bottom: 6px;
    white-space: pre-wrap;
}

.export-preview-content .preview-page-footer {
    margin-top: 10px;
    padding-top: 4px;
    border-top: 1px solid #e2e8f0;
    font-size: 9px;
    color: #94a3b8;
    display: flex;
    justify-content: space-between;
}

.export-preview-content .preview-status-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 1px 8px;
    border-radius: 10px;
}

.export-preview-content .preview-status-badge.normal {
    background: #ecfdf5;
    color: #059669;
}

.export-preview-content .preview-status-badge.warning {
    background: #fffbeb;
    color: #d97706;
}

.export-preview-content .preview-status-badge.error {
    background: #fef2f2;
    color: #dc2626;
}


/* ========== PC端侧边栏与表格布局 ========== */
.sidebar {
    display: none;
}

/* filter-bar中的搜索框默认隐藏（移动端标题行已有搜索） */
#filterBar .filter-item:first-child,
#inspectionFilterBar .filter-item:first-child {
    display: none;
}

.device-table-wrapper {
    display: none;
}

@media (min-width: 769px) {
    #mainApp {
        display: flex;
    }

    .sidebar {
        display: flex;
        flex-direction: column;
        width: 260px;
        height: 100vh;
        position: fixed;
        left: 0;
        top: 0;
        background: white;
        border-right: 1px solid var(--border);
        z-index: 100;
    }

    .sidebar-logo {
        padding: 0 20px;
        display: flex;
        align-items: center;
        gap: 10px;
        height: 60px;
    }

    .sidebar-logo img {
        width: 36px;
        height: 36px;
        object-fit: contain;
    }

    .sidebar-logo span {
        font-size: 18px;
        font-weight: 600;
        color: var(--primary-dark);
    }

    .sidebar-nav {
        display: flex;
        flex-direction: column;
        padding: 0;
        gap: 4px;
    }

    .sidebar-icp {
        margin-top: auto;
        padding: 16px;
        text-align: center;
    }
    .sidebar-icp a {
        font-size: 12px;
        color: #94a3b8;
        text-decoration: none;
    }
    .sidebar-icp a:hover {
        color: #64748b;
    }

    .sidebar-btn {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 16px;
        border: none;
        background: transparent;
        border-radius: var(--radius-sm);
        color: var(--text-secondary);
        font-size: 15px;
        font-weight: 500;
        cursor: pointer;
        transition: var(--transition);
        font-family: inherit;
    }

    .sidebar-btn:hover {
        background: rgba(37, 99, 235, 0.04);
        color: var(--primary);
    }

    .sidebar-btn.active {
        background: rgba(135, 206, 235, 0.15);
        color: var(--primary-dark);
        font-weight: 600;
    }

    .content-wrapper {
        margin-left: 270px;
        flex: 1;
        min-height: 100vh;
    }

    .header,
    .tab-nav {
        display: none;
    }

    .main-container {
        padding: 24px;
        max-width: none;
    }

    /* 设备详情页和个人中心：去掉内边距 */
    #deviceDetailPage,
    #inspectionDeviceDetailPage,
    #profilePage {
        padding: 0;
    }

    /* 个人中心卡片间距对齐设备详情 */
    #profilePage .profile-section {
        margin-bottom: 24px;
    }

    /* 会员管理页：PC端对齐个人中心布局 */
    #userManagePage {
        padding: 0;
    }

    #userManagePage .profile-section {
        margin-bottom: 24px;
    }

    #userManagePage .user-list {
        gap: 24px;
    }

    /* PC/移动端显隐控制 */
    .pc-only {
        display: flex !important;
    }
    .mobile-only {
        display: none !important;
    }

    /* 页面标题行白色背景 */
    .page-header {
        background: #fff;
        padding: 0 24px 0 16px;
        margin: -24px -24px 0 -24px;
        border-radius: 0;
        height: 60px;
    }

    /* 标题图标 */
    .page-title-icon {
        vertical-align: middle;
        margin-right: 8px;
        color: var(--text-secondary);
    }

    /* 顶部筛选器 */
    .header-filters {
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .header-filters select {
        padding: 6px 28px 6px 10px;
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        font-size: 13px;
        font-family: inherit;
        color: var(--text);
        background: var(--bg);
        cursor: pointer;
        outline: none;
        appearance: none;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 8px center;
        min-width: 110px;
    }

    .header-filters select:focus {
        border-color: var(--primary);
    }

    .header-filters .btn {
        padding: 6px 14px;
        font-size: 13px;
    }

    /* 顶部搜索框 */
    .header-search-box {
        position: relative;
    }

    .header-search-box svg {
        position: absolute;
        left: 10px;
        top: 50%;
        transform: translateY(-50%);
        color: var(--text-secondary);
        pointer-events: none;
    }

    .header-search-box input {
        padding: 6px 12px 6px 34px;
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        font-size: 13px;
        font-family: inherit;
        color: var(--text);
        background: var(--bg);
        outline: none;
        width: 180px;
    }

    .header-search-box input:focus {
        border-color: var(--primary);
    }

    /* PC端filter-bar精简 */
    /* PC端隐藏整个filter-bar（筛选项已在header-filters中） */
    #filterBar,
    #inspectionFilterBar {
        display: none;
    }

    .device-grid {
        display: none;
    }

    .device-table-wrapper {
        display: block;
        background: var(--surface);
        border-radius: 0;
        box-shadow: var(--shadow);
        overflow: hidden;
        margin: 0 -24px 0 -24px;
    }

    .device-table {
        width: 100%;
        border-collapse: collapse;
        font-size: 14px;
    }

    .device-table thead {
        background: var(--bg);
    }

    .device-table th {
        padding: 14px 16px;
        text-align: left;
        font-weight: 600;
        color: var(--text-secondary);
        font-size: 13px;
        border-bottom: 1px solid var(--border);
    }

    .device-table td {
        padding: 0 16px;
        height: 50px;
        border-bottom: 1px solid var(--border);
        color: var(--text);
        vertical-align: middle;
    }

    .device-table tbody tr {
        cursor: pointer;
        transition: var(--transition);
    }

    .device-table tbody tr:hover {
        background: #f8fafc;
    }

    .device-table tbody tr:last-child td {
        border-bottom: none;
    }

    .device-table .status-badge {
        display: inline-block;
        padding: 2px 10px;
        border-radius: 12px;
        font-size: 12px;
        font-weight: 600;
    }

    .device-table .status-badge.normal {
        background: #ecfdf5;
        color: #059669;
    }

    .device-table .status-badge.warning {
        background: #fffbeb;
        color: #d97706;
    }

    .device-table .status-badge.error {
        background: #fef2f2;
        color: #dc2626;
    }

    .device-table .table-actions {
        display: flex;
        gap: 8px;
    }

    .device-table .table-actions .btn {
        padding: 4px 10px;
        font-size: 12px;
    }

    /* 操作列图标 */
    .table-action-icon {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 32px;
        height: 32px;
        border-radius: 6px;
        border: 1px solid var(--border);
        background: var(--surface);
        color: var(--text-secondary);
        cursor: pointer;
        transition: var(--transition);
    }

    .table-action-icon:hover {
        background: var(--bg);
        color: var(--primary);
        border-color: var(--primary-light);
    }

    .table-action-icon svg {
        width: 16px;
        height: 16px;
    }
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    body {
        /* padding-bottom: 0px; */
    }

    .main-container {
        padding: 8px;
    }

    .page-header h2 {
        font-size: 18px;
    }

    .page-header-actions {
        gap: 8px;
    }

    .search-box input {
        width: 120px;
        font-size: 12px;
        padding: 8px 12px 8px 30px;
    }

    .filter-bar {
        gap: 10px;
        padding: 12px 14px;
    }

    /* 设备管理/巡检记录页：移动端标题+操作合并到筛选卡片 */
    #deviceListPage .page-header,
    #inspectionListPage .page-header {
        margin-bottom: 0;
    }
    #deviceListPage .page-header h2,
    #inspectionListPage .page-header h2 {
        display: none;
    }
    .filter-bar-header {
        display: flex;
        align-items: center;
        gap: 10px;
        width: 100%;
        margin-bottom: 0px;
        padding-bottom: 10px;
        border-bottom: 1px solid var(--border);
    }
    .filter-bar-header h2 {
        font-size: 18px;
        font-weight: 700;
        margin: 0;
    }
    .filter-bar-header-actions {
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .filter-item label {
        font-size: 11px;
    }

    .filter-item select {
        font-size: 13px;
        padding: 7px 28px 7px 10px;
        min-width: 110px;
    }

    #btnClearFilter,
    #btnClearInspectionFilter {
        padding: 7px 14px !important;
        font-size: 13px !important;
        line-height: normal !important;
    }

    .btn {
        font-size: 13px;
        padding: 8px 14px;
    }

    .btn-sm {
        font-size: 12px;
        padding: 6px 10px;
    }

    .device-grid {
        grid-template-columns: 1fr;
        gap: 5px;
    }

    .filter-bar {
        margin-bottom: 5px;
    }

    .detail-info-grid {
        grid-template-columns: 1fr;
    }

    .detail-card-header {
        flex-direction: column;
        gap: 12px;
    }

    .header {
        height: 50px;
        padding: 0;
        position: relative;
    }

    .header-content {
        flex-direction: row;
        justify-content: center;
        align-items: center;
        position: relative;
        min-height: 36px;
    }

    .logo {
        justify-content: center;
        flex: 1;
    }

    .logo h1 {
        font-size: 22px;
    }

    .header-stats {
        position: absolute;
        right: 0;
        top: 50%;
        transform: translateY(-50%);
    }

    .photo-add-btn {
        width: calc((100% - 30px) / 4);
        aspect-ratio: 1;
        font-size: 12px;
        gap: 4px;
        padding: 0;
    }

    /* 巡检表单照片：手机上每行3个 */
    #photoUploadArea .photo-add-btn,
    #editPhotoUploadArea .photo-add-btn,
    #photoUploadArea .photo-item,
    #editPhotoUploadArea .photo-item {
        width: calc((100% - 20px) / 3);
        aspect-ratio: 1;
    }

    .photo-item {
        width: calc((100% - 30px) / 4);
    }

    .tab-nav {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        height: 50px;
        border-bottom: none;
        border-top: 1px solid var(--border);
        box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
        padding: 0;
        padding-bottom: env(safe-area-inset-bottom, 0);
    }

    .tab-btn {
        padding: 0 6px;
        font-size: 13px;
        gap: 4px;
        flex: 1;
        font-weight: 600;
    }

    .tab-btn svg {
        width: 18px;
        height: 18px;
    }

    /* 会员管理页 - 移动端优化 */
    .user-card {
        flex-wrap: wrap;
        padding: 14px 16px;
        gap: 10px;
    }

    .user-info {
        flex: 1 1 calc(100% - 54px);
        min-width: 0;
    }

    .user-actions {
        flex: 1 1 100%;
        justify-content: flex-end;
        gap: 8px;
    }

    .user-actions .btn {
        padding: 6px 10px;
        font-size: 12px;
    }

    .user-meta {
        font-size: 11px;
        gap: 8px;
    }

    .user-name {
        font-size: 14px;
    }

    /* 移动端登录/注册页 - 填满屏幕 */
    .auth-page {
        min-height: 100dvh;
        padding: 16px;
    }

    /* 移动端显隐控制 */
    .pc-only {
        display: none !important;
    }
    .mobile-only {
        display: flex !important;
    }

    /* 移动端filter-bar恢复完整样式 */
    #filterBar,
    #inspectionFilterBar {
        background: var(--surface);
        box-shadow: var(--shadow-md);
        padding: 16px 20px;
        border: 1px solid var(--border);
        border-radius: var(--radius);
    }

}

/* ========== ICP备案号 ========== */
.icp-footer {
    text-align: center;
    padding: 16px 0;
    font-size: 12px;
    color: #94a3b8;
}
.icp-footer a {
    color: #94a3b8;
    text-decoration: none;
}
.icp-footer a:hover {
    color: #64748b;
}
