* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: "Microsoft Yahei", sans-serif;
}
body {
    display: flex;
    background: #f5f7fa;
    color: #333;
}

/* 侧边栏导航 */
.sidebar {
    width: 220px;
    background: #fff;
    border-right: 1px solid #e5e7eb;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    padding-top: 20px;
}
.sidebar-logo {
    font-size: 20px;
    font-weight: bold;
    padding: 0 20px 24px;
    border-bottom: 1px solid #eee;
    margin-bottom: 16px;
}
.sidebar-menu li {
    list-style: none;
}
.sidebar-menu li a {
    display: block;
    padding: 12px 20px;
    text-decoration: none;
    color: #555;
    font-size: 14px;
}
.sidebar-menu li a.active {
    background: #eff6ff;
    color: #1d4ed8;
    border-left: 4px solid #1d4ed8;
}

/* 主内容容器 */
.main-wrap {
    margin-left: 220px;
    width: calc(100% - 220px);
    padding: 20px;
}
.page-title {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 20px;
}
.page {
    display: none;
}
.page.active {
    display: block;
}

/* 搜索栏通用 */
.search-bar {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}
.search-bar input, .search-bar select {
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

/* ========== 核心修复：全局统一按钮样式 唯一一套无冲突 ========== */
/* 所有按钮禁止文字换行挤压变形 */
button, span.op-btn {
    white-space: nowrap;
}

/* 页面大按钮：搜索、新建、弹窗确定取消 */
.btn-blue {
    background-color: #1677ff;
    color: #ffffff !important;
    border: none;
    border-radius: 6px;
    padding: 6px 16px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.5;
    transition: background 0.2s ease;
}
.btn-blue:hover {
    background-color: #4096ff;
}
.btn-white {
    background-color: #ffffff;
    color: #333333;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    padding: 6px 16px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.5;
    transition: all 0.2s ease;
}
.btn-white:hover {
    border-color: #1677ff;
    color: #1677ff;
}
.btn-gray {
    background: #f5f7fa;
    color: #333;
    border: 1px solid #e5e6eb;
    border-radius: 6px;
    padding: 6px 16px;
    cursor: pointer;
    font-size:14px;
}
.btn-red {
    background-color: #f53f3f;
    color: #fff !important;
    border: none;
    border-radius:6px;
    padding:6px 16px;
    cursor:pointer;
    font-size:14px;
    line-height: 1.5;
}
.btn-red:hover {
    background: #ff7875;
}
.btn-orange {
    background: #f97316;
    color: #fff;
    border: none;
    border-radius:6px;
    padding:6px 16px;
    cursor:pointer;
    font-size:14px;
}

/* 表格内小型操作按钮（编辑/删除/完成）解决文字看不清 */
.op-btn {
    margin: 0 4px;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    border: none;
    line-height: 1.4;
    color: #fff !important;
    display: inline-block;
    text-align: center;
}
.op-blue {
    background: #1677ff;
}
.op-red {
    background: #f53f3f;
}
.op-gray {
    background: #999;
}
.op-orange {
    background: #ff9d2e;
}
.op-green {
    background: #36c36c;
}

/* 状态标签：已完成/待维修 文字纯白清晰 */
.tag-green {
    background:#36c36c;
    color:#fff !important;
    padding: 5px 10px;
    border-radius: 6px;
    font-size:13px;
    display: inline-block;
    line-height: 1.4;
}
.tag-gray {
    background:#999;
    color:#fff !important;
    padding: 5px 10px;
    border-radius: 6px;
    font-size:13px;
    display: inline-block;
    line-height: 1.4;
}
.tag-red {
    background:#f53f3f;
    color:#fff !important;
    padding: 5px 10px;
    border-radius: 6px;
    font-size:13px;
    display: inline-block;
    line-height: 1.4;
}

/* 通用表格 */
.table-wrap {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
}
table {
    width: 100%;
    border-collapse: collapse;
}
th, td {
    border: 1px solid #eee;
    padding: 10px;
    text-align: center;
    font-size: 14px;
}
th {
    background: #f9fafb;
}

/* 首页仪表盘布局 */
.home-stat-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}
.home-stat-card {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    border: 1px solid #e5e7eb;
}
.stat-card-online { background: #f0fdf4; }
.stat-card-offline { background: #fef2f2; }
.stat-card-error { background: #fffbeb; }
.home-stat-card .title {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 8px;
}
.home-stat-card .count {
    font-size: 32px;
    font-weight: bold;
    color: #1f2937;
}
.home-chart-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}
.home-chart-box {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 16px;
}
.home-chart-title {
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
}
.home-chart {
    width: 100%;
    height: 320px;
}
.home-tab-bar {
    display: flex;
    gap: 24px;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 16px;
}
.home-tab-item {
    padding: 10px 0;
    font-size: 14px;
    cursor: pointer;
    color: #666;
    position: relative;
}
.home-tab-item.active {
    color: #1d4ed8;
}
.home-tab-item.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background: #1d4ed8;
}
.home-tab-content {
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    padding: 16px;
    min-height: 300px;
}

/* 设备详情顶部栏 */
.top-switch-bar {
    display: flex;
    gap: 24px;
    align-items: center;
    margin-bottom: 20px;
}
.stat-card {
    padding: 16px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    min-width: 160px;
    background: #f9fafb;
}
.stat-card h4 {
    color: #666;
    font-size: 14px;
    margin-bottom: 6px;
}
.stat-card .num {
    font-size: 26px;
    font-weight: bold;
}
#devSelect {
    padding: 8px 12px;
    font-size: 15px;
    min-width: 240px;
    border: 1px solid #ccc;
    border-radius: 6px;
}
.base-title {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 12px;
    color: #333;
    border-left: 4px solid #3b82f6;
    padding-left: 8px;
    margin-top: 24px;
}
.base-info-wrap {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
    background: #fff;
}
.base-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}
.base-item {
    border: 1px solid #eee;
    border-radius: 6px;
    padding: 10px;
}
.base-item .key {
    font-size: 13px;
    color: #666;
    margin-bottom: 4px;
}
.base-item .val {
    font-size: 15px;
    font-weight: 500;
}

.tag-blue { background: #3b82f6; color: #fff; padding: 3px 8px; border-radius: 4px; font-size:13px; }
.tag-write { background: #dbeafe; color: #1d4ed8; padding: 2px 6px; border-radius: 3px; font-size:12px; margin-left:6px; }

/* 参数卡片网格 */
.grid-box {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 15px;
    margin: 12px 0 20px;
}
.model-card {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 14px;
    background:#fff;
    transition: all 0.2s ease;
}
.param-click-card {
    cursor: pointer;
}
.param-click-card:hover {
    border-color: #1d4ed8;
    box-shadow: 0 2px 12px rgba(29, 78, 216, 0.15);
}
.model-card .key {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 6px;
}
.model-card .val {
    font-size: 20px;
    font-weight: 500;
}
.write-row {
    display: flex;
    gap:6px;
    margin-top:8px;
}
.write-row input {
    flex:1;
    padding:4px 8px;
    border:1px solid #ccc;
    border-radius:4px;
    font-size:13px;
}
.btn-send {
    background:#1d4ed8;
    color:#fff;
    border:none;
    padding:4px 10px;
    border-radius:4px;
    cursor:pointer;
    font-size:13px;
}
.operate-btn-group {
    display: flex;
    gap: 14px;
    margin-top: 18px;
    margin-bottom: 24px;
}

/* WiFi模块 */
.wifi-config-card {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
    background: #fff;
}
.wifi-status-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}
.wifi-input-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 12px;
    align-items: end;
    margin-bottom: 16px;
}
.wifi-input-row input {
    width:100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}
.wifi-action-row {
    display: flex;
    gap: 12px;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid #eee;
}

/* 温度压力曲线 */
.chart-wrap {
    margin: 30px 0;
}
#chart-temp, #chart-press {
    width: 100%;
    height: 360px;
    border: 1px solid #eee;
    border-radius: 8px;
    background: #fff;
}
.state-0 { color: #6b7280; }
.state-1 { color: #f59e0b; }
.state-2 { color: #27ae60; }
.state-3 { color: #2563eb; }

/* 通用弹窗遮罩 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: none;
    justify-content: center;
    align-items: center;
}
.modal-overlay.active {
    display: flex;
}
.modal-box {
    background: #fff;
    border-radius: 8px;
    width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
}
.modal-close {
    font-size: 24px;
    color: #999;
    cursor: pointer;
    border: none;
    background: none;
}
.modal-body {
    padding: 20px;
}
.form-row {
    margin-bottom: 16px;
}
.form-row label {
    display: block;
    font-size: 14px;
    margin-bottom: 6px;
}
.required { color: #ef4444; }
.form-row input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}
.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}
.btn-cancel {
    background: #f3f4f6;
    color: #374151;
    border: none;
    padding: 8px 20px;
    border-radius: 4px;
    cursor: pointer;
}
.btn-save {
    background: #1d4ed8;
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: 4px;
    cursor: pointer;
}

/* 历史记录弹窗样式 */
.history-modal-box {
    width: 85%;
    max-width: 1100px;
    max-height: 90vh;
}
.history-modal-body {
    padding: 20px;
    overflow-y: auto;
}
.time-filter-bar {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    padding-bottom: 16px;
    border-bottom: 1px solid #eee;
    margin-bottom: 16px;
}
.quick-time-btns {
    display: flex;
    gap: 10px;
}
.time-btn {
    padding: 6px 14px;
    border: 1px solid #d1d5db;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: 0.2s;
}
.time-btn:hover {
    background: #eff6ff;
    border-color: #1d4ed8;
    color: #1d4ed8;
}
.custom-time-range {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}
.custom-time-range input {
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}
.history-chart-wrap {
    height: 380px;
    margin-bottom: 20px;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 10px;
}
#historyEchart {
    width: 100%;
    height: 100%;
}
.history-table-wrap h4 {
    margin-bottom: 10px;
    font-size: 15px;
    color: #333;
}
.history-data-table {
    width: 100%;
    border-collapse: collapse;
}
.history-data-table th,
.history-data-table td {
    border: 1px solid #eee;
    padding: 8px 12px;
    text-align: center;
    font-size: 14px;
}
.history-data-table th {
    background-color: #f9fafb;
}
.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #eee;
}
.page-btn {
    padding: 6px 16px;
    border: 1px solid #d1d5db;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}
.page-btn:disabled {
    background: #f3f4f6;
    color: #999;
    cursor: not-allowed;
    border-color: #eee;
}
.page-info {
    font-size: 14px;
    color: #333;
}

/* 维修工单弹窗 图片上传区域 */
.img-upload-box{
    display:flex;
    gap:10px;
    flex-wrap:wrap;
    margin-top:8px;
}
.upload-add-card{
    width:80px;
    height:80px;
    border:1px dashed #ccc;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    color:#666;
    cursor:pointer;
    font-size:14px;
    border-radius:4px;
}
.upload-img-item{
    width:80px;
    height:80px;
    object-fit:cover;
    border:1px solid #eee;
    position:relative;
    border-radius:4px;
}
.upload-img-item .del{
    position:absolute;
    top:-6px;
    right:-6px;
    width:18px;
    height:18px;
    background:#f53f3f;
    color:#fff;
    border-radius:50%;
    text-align:center;
    line-height:18px;
    cursor:pointer;
    font-size:12px;
}
.form-item{
    margin-bottom:16px;
    display:flex;
    flex-direction:column;
    gap:6px;
}
.form-item label{
    font-weight:500;
    font-size:14px;
}
.form-item input,.form-item select,.form-item textarea{
    padding:8px 12px;
    border:1px solid #ddd;
    border-radius:6px;
    font-size:14px;
}
.form-item input:focus,.form-item select:focus,.form-item textarea:focus{
    outline: none;
    border-color:#1677ff;
}
.modal-mask{
    position:fixed;
    top:0;
    left:0;
    width:100%;
    height:100%;
    background:rgba(0,0,0,0.5);
    display:none;
    align-items:center;
    justify-content:center;
    z-index:999;
}
.modal-mask.active{
    display:flex;
}
.modal-head{
    padding:14px 18px;
    border-bottom:1px solid #eee;
    display:flex;
    justify-content:space-between;
    align-items:center;
}
.close-btn{
    cursor:pointer;
    font-size:22px;
    color:#666;
    line-height:1;
}
.modal-body{
    padding:18px;
}
.modal-foot{
    padding:14px 18px;
    border-top:1px solid #eee;
    display:flex;
    justify-content:flex-end;
    gap:12px;
}

/* 底部分页区域 */
.page-pagination{
    display:flex;
    justify-content:flex-end;
    align-items:center;
    gap:12px;
    margin-top:16px;
    font-size:14px;
}
.page-pagination button{
    padding:4px 12px;
    border:1px solid #ddd;
    background:#fff;
    border-radius:4px;
    cursor:pointer;
}
.page-pagination select{
    padding:3px 6px;
    border:1px solid #ddd;
    border-radius:4px;
}