/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 状态图标 */
.online {
    color: #28a745;
}

.offline {
    color: #dc3545;
}

/* 加载状态 */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: #666;
    gap: 1rem;
}

.loading i {
    font-size: 2rem;
    color: #007bff;
}

/* 无数据状态 */
.no-data {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: #666;
}

.no-data i {
    font-size: 3rem;
    color: #ccc;
    margin-bottom: 1rem;
}

.no-data p {
    font-size: 1rem;
    color: #999;
}

/* 通知样式 */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 5px;
    color: white;
    font-weight: 500;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.notification.success {
    background-color: #28a745;
}

.notification.error {
    background-color: #dc3545;
}

.notification.warning {
    background-color: #ffc107;
    color: #333;
}

.notification.info {
    background-color: #17a2b8;
}

/* 头部导航 */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    font-size: 1.5rem;
    font-weight: bold;
}

.logo i {
    margin-right: 10px;
    font-size: 1.8rem;
}

.nav {
    display: flex;
    gap: 2rem;
}

.nav a {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    transition: background-color 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav a:hover,
.nav a.active {
    background-color: rgba(255, 255, 255, 0.2);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logout-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: background-color 0.3s;
}

.logout-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* 主内容区域 */
.main {
    padding: 2rem 0;
    min-height: calc(100vh - 80px);
}

/* 页面头部 */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e1e5e9;
}

.page-header h1 {
    color: #333;
    font-size: 2rem;
    font-weight: 600;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* 按钮样式 */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    transition: all 0.3s;
    background-color: #007bff;
    color: white;
}

.btn:hover {
    background-color: #0056b3;
    transform: translateY(-1px);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background-color: #007bff;
}

.btn-primary:hover {
    background-color: #0056b3;
}

.btn-secondary {
    background-color: #6c757d;
}

.btn-secondary:hover {
    background-color: #545b62;
}

.btn-success {
    background-color: #28a745;
}

.btn-success:hover {
    background-color: #1e7e34;
}

.btn-warning {
    background-color: #ffc107;
    color: #333;
}

.btn-warning:hover {
    background-color: #e0a800;
}

.btn-danger {
    background-color: #dc3545;
}

.btn-danger:hover {
    background-color: #c82333;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

    .refresh-btn {
        background-color: #17a2b8;
        color: white;
        padding: 0.5rem 1rem;
        border: none;
        border-radius: 5px;
        cursor: pointer;
        display: flex;
        align-items: center;
        gap: 0.5rem;
        transition: background-color 0.3s;
    }

    .refresh-btn:hover {
        background-color: #138496;
    }

    .refresh-btn span {
        display: none;
    }

    /* 最后更新信息样式 */
    .last-update-container {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        padding: 0.5rem 0.75rem;
        background-color: rgba(23, 162, 184, 0.1);
        border-radius: 20px;
        color: #17a2b8;
        font-size: 0.85rem;
        font-weight: 500;
        border: 1px solid rgba(23, 162, 184, 0.2);
        transition: all 0.3s ease;
    }

    .last-update-container i {
        font-size: 0.8rem;
    }

    .refresh-info {
        display: flex;
        align-items: center;
        gap: 1rem;
    }

    /* 广播按钮组 */
    .broadcast-buttons {
        display: flex;
        gap: 0.5rem;
        align-items: center;
    }

    .broadcast-buttons button {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
        white-space: nowrap;
    }

    .status-btn {
        background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
        border: none;
        color: white;
        transition: all 0.3s ease;
    }

    .status-btn:hover {
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(23, 162, 184, 0.3);
    }

    .broadcast-buttons button span {
        display: none;
    }

    /* 响应式设计 */
    @media (min-width: 768px) {
        .broadcast-buttons button span {
            display: inline;
        }

        .broadcast-buttons button {
            padding: 0.5rem 1rem;
            font-size: 0.9rem;
        }

        .refresh-btn span {
            display: inline;
        }

        .refresh-btn {
            padding: 0.5rem 1rem;
            font-size: 0.9rem;
        }
    }

    /* 搜索框 */
    .search-box {
        position: relative;
    }

    .search-box input {
        padding: 0.5rem 2.5rem 0.5rem 1rem;
        border: 1px solid #ddd;
        border-radius: 5px;
        width: 250px;
    }

    .search-box i {
        position: absolute;
        right: 10px;
        top: 50%;
        transform: translateY(-50%);
        color: #666;
    }

    /* 筛选选择框 */
    .filter-select {
        padding: 0.5rem;
        border: 1px solid #ddd;
        border-radius: 5px;
        background-color: white;
    }

    /* 卡片样式 */
    .card {
        background: white;
        border-radius: 10px;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        margin-bottom: 2rem;
        overflow: hidden;
    }

    .card-header {
        padding: 1rem 1.5rem;
        background-color: #f8f9fa;
        border-bottom: 1px solid #e1e5e9;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .card-header h3 {
        color: #333;
        font-size: 1.2rem;
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    .card-body {
        padding: 1.5rem;
    }

    /* 统计卡片网格 */
    .stats-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 1.5rem;
        margin-bottom: 2rem;
    }

    .stat-card {
        background: white;
        border-radius: 10px;
        padding: 1.5rem;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        display: flex;
        align-items: center;
        gap: 1rem;
        transition: transform 0.3s;
    }

    .stat-card:hover {
        transform: translateY(-2px);
    }

    .stat-icon {
        width: 60px;
        height: 60px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
        font-size: 1.5rem;
    }

    .stat-icon.blue {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    }

    .stat-icon.green {
        background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    }

    .stat-icon.red {
        background: linear-gradient(135deg, #dc3545 0%, #f86c6b 100%);
    }

    .stat-icon.orange {
        background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
    }

    .stat-info h3 {
        font-size: 2rem;
        font-weight: bold;
        color: #333;
        margin-bottom: 0.25rem;
    }

    .stat-info p {
        color: #666;
        font-size: 0.9rem;
    }

    /* 仪表板内容 */
    .dashboard-content {
        display: grid;
        grid-template-columns: 2fr 1fr;
        gap: 2rem;
    }

    .dashboard-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
        margin-top: 2rem;
    }

    /* 迷你设备表格 */
    .mini-devices-table {
        width: 100%;
        font-size: 0.9rem;
    }

    .mini-devices-table th,
    .mini-devices-table td {
        padding: 0.75rem 0.5rem;
        text-align: left;
        border-bottom: 1px solid #f1f3f4;
    }

    .mini-devices-table th {
        background-color: #f8f9fa;
        font-weight: 600;
        color: #333;
        font-size: 0.85rem;
    }

    .mini-devices-table .device-id {
        font-family: monospace;
        font-size: 0.85rem;
    }

    /* 配置概览 */
    .config-overview-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 1rem;
    }

    .config-overview-item {
        border: 1px solid #e1e5e9;
        border-radius: 8px;
        padding: 1rem;
        background-color: #fafbfc;
        transition: all 0.3s;
    }

    .config-overview-item:hover {
        border-color: #007bff;
        box-shadow: 0 2px 8px rgba(0, 123, 255, 0.1);
    }

    .config-device-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 0.75rem;
    }

    .config-device-header .device-id {
        font-family: monospace;
        font-weight: 600;
        color: #333;
    }

    .config-summary {
        margin-bottom: 1rem;
    }

    .config-summary-item {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        margin-bottom: 0.5rem;
        font-size: 0.9rem;
        color: #666;
    }

    .config-summary-item i {
        width: 16px;
        color: #007bff;
    }

    /* 警报设备 */
    .alert-devices-list {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }

    .alert-device-item {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.75rem;
        border-radius: 6px;
        border-left: 4px solid;
    }

    .alert-device-item.warning {
        background-color: #fff3cd;
        border-left-color: #ffc107;
    }

    .alert-device-item.danger {
        background-color: #f8d7da;
        border-left-color: #dc3545;
    }

    .alert-device-item.secondary {
        background-color: #e2e3e5;
        border-left-color: #6c757d;
    }

    .alert-device-info {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        flex: 1;
    }

    .alert-device-info i {
        font-size: 1.2rem;
        color: #666;
    }

    .alert-device-id {
        font-family: monospace;
        font-weight: 600;
        font-size: 0.9rem;
        color: #333;
    }

    .alert-message {
        font-size: 0.85rem;
        color: #666;
        margin-top: 0.25rem;
    }

    .no-alerts {
        text-align: center;
        padding: 2rem;
        color: #28a745;
    }

    .no-alerts i {
        font-size: 2rem;
        margin-bottom: 0.5rem;
    }

    .more-alerts {
        text-align: center;
        padding: 0.75rem;
        color: #666;
        font-size: 0.9rem;
        font-style: italic;
    }

    .btn-outline {
        background-color: transparent;
        border: 1px solid #007bff;
        color: #007bff;
    }

    .btn-outline:hover {
        background-color: #007bff;
        color: white;
    }

    .card-controls {
        display: flex;
        gap: 1rem;
        align-items: center;
    }

    /* 状态图表 - 列表形式 */
    .status-list {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }

    .status-list-item {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.75rem;
        border-radius: 8px;
        background-color: #f8f9fa;
        border: 1px solid #e1e5e9;
        transition: all 0.3s;
    }

    .status-list-item:hover {
        background-color: #e9ecef;
        transform: translateY(-1px);
    }

    .status-info {
        display: flex;
        align-items: center;
        gap: 0.75rem;
    }

    .status-indicator {
        width: 12px;
        height: 12px;
        border-radius: 50%;
    }

    .status-name {
        font-weight: 500;
        color: #333;
        font-size: 0.9rem;
    }

    .status-count {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        font-size: 0.9rem;
    }

    .count-number {
        font-weight: 600;
        color: #333;
    }

    .count-percentage {
        color: #666;
        font-size: 0.85rem;
    }

    .status-list-placeholder {
        text-align: center;
        padding: 2rem;
        color: #666;
    }

    .status-list-placeholder i {
        font-size: 2rem;
        margin-bottom: 0.5rem;
        color: #ccc;
    }

    /* 设备列表 */
    .devices-table {
        width: 100%;
        border-collapse: collapse;
    }

    .devices-table th,
    .devices-table td {
        padding: 1rem;
        text-align: left;
        border-bottom: 1px solid #e1e5e9;
    }

    .devices-table th {
        background-color: #f8f9fa;
        font-weight: 600;
        color: #333;
    }

    .device-id {
        font-family: monospace;
        font-size: 0.9rem;
    }

    /* 设备ID徽章 */
    .device-id-badge {
        display: inline-block;
        padding: 0.25rem 0.5rem;
        border-radius: 4px;
        font-family: 'Courier New', monospace;
        font-weight: 600;
        font-size: 0.9rem;
        background-color: #e9ecef;
        color: #333;
        border: 1px solid #dee2e6;
    }

    /* 握手ID徽章 */
    .handshake-id-badge {
        display: inline-block;
        padding: 0.25rem 0.5rem;
        border-radius: 4px;
        font-family: 'Courier New', monospace;
        font-weight: 600;
        font-size: 0.9rem;
        background-color: #e3f2fd;
        color: #1976d2;
        border: 1px solid #bbdefb;
    }

    .device-id-badge.unconfigured {
        background-color: #fff3cd;
        color: #856404;
        border-color: #ffeaa7;
    }

    .device-id-badge.unconfigured::before {
        content: '⚠ ';
        color: #856404;
        font-weight: bold;
    }

    .rssi.excellent {
        color: #28a745;
        font-weight: bold;
    }

    .rssi.good {
        color: #17a2b8;
    }

    .rssi.fair {
        color: #ffc107;
    }

    .rssi.poor {
        color: #dc3545;
        font-weight: bold;
    }

    .dtu-state {
        padding: 0.25rem 0.5rem;
        border-radius: 3px;
        font-size: 0.8rem;
        font-weight: 500;
    }

    .dtu-state.success {
        background-color: #d4edda;
        color: #155724;
    }

    .dtu-state.warning {
        background-color: #fff3cd;
        color: #856404;
    }

    .dtu-state.danger {
        background-color: #f8d7da;
        color: #721c24;
    }

    .dtu-state.info {
        background-color: #d1ecf1;
        color: #0c5460;
    }

    .dtu-state.secondary {
        background-color: #e2e3e5;
        color: #383d41;
    }

    .action-buttons {
        display: flex;
        gap: 0.5rem;
    }

    /* 配置状态 */
    .config-status {
        display: flex;
        align-items: center;
        gap: 0.25rem;
        padding: 0.25rem 0.5rem;
        border-radius: 12px;
        font-size: 0.75rem;
        font-weight: 500;
        cursor: default;
    }

    .config-status.configured {
        background-color: #d4edda;
        color: #155724;
    }

    .config-status.no-config {
        background-color: #fff3cd;
        color: #856404;
        border: 1px solid #ffeaa7;
    }

    .config-status.offline {
        background-color: #fff3cd;
        color: #856404;
    }

    .config-status-text {
        font-size: 0.7rem;
    }

    .btn-info {
        background-color: #17a2b8;
    }

    .btn-info:hover {
        background-color: #138496;
    }

    /* 状态指示器 */
    .status-indicator {
        display: inline-flex;
        align-items: center;
        gap: 0.25rem;
        font-size: 0.8rem;
        font-weight: 500;
    }

    .status-indicator.online {
        color: #28a745;
    }

    .status-indicator.offline {
        color: #dc3545;
    }

    /* 分页 */
    .pagination {
        display: flex;
        justify-content: center;
        gap: 0.5rem;
        margin-top: 1rem;
    }

    .page-btn {
        padding: 0.5rem 0.75rem;
        border: 1px solid #ddd;
        background-color: white;
        cursor: pointer;
        border-radius: 3px;
        transition: all 0.3s;
    }

    .page-btn:hover {
        background-color: #f8f9fa;
    }

    .page-btn.active {
        background-color: #007bff;
        color: white;
        border-color: #007bff;
    }

    .page-dots {
        padding: 0.5rem 0.75rem;
        color: #666;
    }

    /* 模态框 */
    .modal {
        display: none;
        position: fixed;
        z-index: 1000;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.5);
    }

    .modal-content {
        background-color: white;
        margin: 3% auto;
        padding: 0;
        border-radius: 10px;
        width: 90%;
        max-width: 600px;
        max-height: 90vh;
        overflow-y: auto;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    }

    .modal-large {
        max-width: 800px;
    }

    .modal-header {
        padding: 1rem 1.5rem;
        border-bottom: 1px solid #e1e5e9;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .modal-header h3 {
        margin: 0;
        color: #333;
    }

    .close-btn {
        background: none;
        border: none;
        font-size: 1.5rem;
        cursor: pointer;
        color: #666;
        padding: 0;
        width: 30px;
        height: 30px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .close-btn:hover {
        color: #333;
    }

    .modal-body {
        padding: 1.5rem;
    }

    /* 命令列表 */
    .command-list {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 1rem;
    }

    .command-btn {
        padding: 1rem;
        border: 1px solid #e1e5e9;
        border-radius: 5px;
        background-color: white;
        cursor: pointer;
        transition: all 0.3s;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
        text-align: center;
    }

    .command-btn:hover {
        border-color: #007bff;
        background-color: #f8f9fa;
        transform: translateY(-2px);
    }

    .command-btn i {
        font-size: 1.5rem;
        color: #007bff;
    }

    .command-btn span {
        font-size: 0.9rem;
        color: #333;
    }

    /* 表单样式 */
    .form-group {
        margin-bottom: 1rem;
    }

    .form-group label {
        display: block;
        margin-bottom: 0.5rem;
        font-weight: 500;
        color: #333;
    }

    .form-group input,
    .form-group select {
        width: 100%;
        padding: 0.5rem;
        border: 1px solid #ddd;
        border-radius: 3px;
        font-size: 0.9rem;
    }

    .form-group input:focus,
    .form-group select:focus {
        outline: none;
        border-color: #007bff;
    }

    .form-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }

    .form-actions {
        display: flex;
        gap: 1rem;
        justify-content: flex-end;
        margin-top: 1.5rem;
    }

    .form-section {
        margin-bottom: 2rem;
        padding-bottom: 1rem;
        border-bottom: 1px solid #f1f3f4;
    }

    .form-section:last-child {
        border-bottom: none;
    }

    .form-section h4 {
        color: #333;
        margin-bottom: 1rem;
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    .config-edit-panes {
        min-height: 400px;
    }

    .config-edit-pane {
        display: none;
    }

    .config-edit-pane.active {
        display: block;
    }

    #config-modal .config-tabs {
        border-bottom: 1px solid #e1e5e9;
        margin-bottom: 1.5rem;
    }

    #config-modal .config-tab-buttons {
        display: flex;
        gap: 0.5rem;
    }

    /* 设备详情页面 */
    .device-overview {
        display: grid;
        grid-template-columns: 2fr 1fr;
        gap: 2rem;
        margin-bottom: 2rem;
    }

    .device-info-card,
    .device-actions-card {
        background: white;
        border-radius: 10px;
        padding: 1.5rem;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    }

    .device-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 1rem;
    }

    .device-header h2 {
        color: #333;
        font-size: 1.5rem;
        font-family: monospace;
    }

    .status-badge {
        padding: 0.5rem 1rem;
        border-radius: 20px;
        font-weight: 500;
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    .status-badge.online {
        background-color: #d4edda;
        color: #155724;
    }

    .status-badge.offline {
        background-color: #f8d7da;
        color: #721c24;
    }

    .device-meta {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }

    .meta-item {
        display: flex;
        justify-content: space-between;
        padding: 0.5rem 0;
    }

    .meta-item label {
        font-weight: 500;
        color: #666;
    }

    .action-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }

    .action-btn {
        padding: 1rem;
        border: 1px solid #e1e5e9;
        border-radius: 5px;
        background-color: white;
        cursor: pointer;
        transition: all 0.3s;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
    }

    .action-btn:hover {
        border-color: #007bff;
        background-color: #f8f9fa;
        transform: translateY(-2px);
    }

    .action-btn.warning {
        border-color: #ffc107;
    }

    .action-btn.warning:hover {
        border-color: #e0a800;
        background-color: #fff3cd;
    }

    .action-btn i {
        font-size: 1.2rem;
        color: #007bff;
    }

    .action-btn.warning i {
        color: #ffc107;
    }

    /* 标签页 */
    .device-tabs {
        background: white;
        border-radius: 10px;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        overflow: hidden;
    }

    .tab-buttons {
        display: flex;
        background-color: #f8f9fa;
        border-bottom: 1px solid #e1e5e9;
    }

    .tab-btn {
        padding: 1rem 1.5rem;
        border: none;
        background: none;
        cursor: pointer;
        display: flex;
        align-items: center;
        gap: 0.5rem;
        transition: all 0.3s;
        border-bottom: 3px solid transparent;
    }

    .tab-btn:hover {
        background-color: rgba(0, 0, 0, 0.05);
    }

    .tab-btn.active {
        border-bottom-color: #007bff;
        color: #007bff;
        background-color: white;
    }

    .tab-content {
        padding: 1.5rem;
    }

    .tab-pane {
        display: none;
    }

    .tab-pane.active {
        display: block;
    }

    /* 状态网格 */
    .status-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 1.5rem;
        margin-bottom: 2rem;
    }

    .status-card {
        border: 1px solid #e1e5e9;
        border-radius: 8px;
        padding: 1rem;
    }

    .status-card h4 {
        color: #333;
        margin-bottom: 1rem;
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    .status-item {
        display: flex;
        justify-content: space-between;
        padding: 0.5rem 0;
        border-bottom: 1px solid #f1f3f4;
    }

    .status-item:last-child {
        border-bottom: none;
    }

    .status-item label {
        font-weight: 500;
        color: #666;
    }

    /* 图表容器 */
    .chart-container {
        border: 1px solid #e1e5e9;
        border-radius: 8px;
        padding: 1rem;
    }

    .chart-container h4 {
        color: #333;
        margin-bottom: 1rem;
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    .chart-placeholder {
        height: 200px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        color: #666;
        background-color: #f8f9fa;
        border-radius: 4px;
    }

    .chart-placeholder i {
        font-size: 2rem;
        margin-bottom: 0.5rem;
    }

    .simple-chart {
        position: relative;
        height: 200px;
        background-color: #f8f9fa;
        border-radius: 4px;
    }

    .chart-bar {
        position: absolute;
        width: 3%;
        background-color: #007bff;
        border-radius: 2px;
        transition: height 0.3s ease;
    }

    /* 配置部分 */
    .config-section {
        margin-bottom: 2rem;
    }

    .section-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 1rem;
        padding-bottom: 0.5rem;
        border-bottom: 1px solid #e1e5e9;
    }

    .section-header h4 {
        color: #333;
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    .config-list {
        display: grid;
        gap: 0.5rem;
    }

    .config-item {
        display: flex;
        justify-content: space-between;
        padding: 0.5rem 0;
        border-bottom: 1px solid #f1f3f4;
    }

    .config-item:last-child {
        border-bottom: none;
    }

    .config-item label {
        font-weight: 500;
        color: #666;
    }

    /* 配置标签页 */
    .config-tabs {
        border-bottom: 1px solid #e1e5e9;
        margin-bottom: 1.5rem;
        display: flex;
        justify-content: space-between;
        align-items: flex-end;
    }

    .config-tab-buttons {
        display: flex;
        gap: 0.5rem;
    }

    .config-tab-btn {
        padding: 0.75rem 1rem;
        border: none;
        background: none;
        cursor: pointer;
        display: flex;
        align-items: center;
        gap: 0.5rem;
        transition: all 0.3s;
        border-bottom: 3px solid transparent;
        color: #666;
    }

    .config-tab-btn:hover {
        background-color: rgba(0, 0, 0, 0.05);
        color: #333;
    }

    .config-tab-btn.active {
        border-bottom-color: #007bff;
        color: #007bff;
        background-color: rgba(0, 123, 255, 0.05);
    }

    .config-actions-toolbar {
        display: flex;
        gap: 0.5rem;
    }

    .config-panes {
        min-height: 400px;
    }

    .config-pane {
        display: none;
    }

    .config-pane.active {
        display: block;
    }

    .config-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 1rem;
    }

    .config-value {
        font-family: monospace;
        background-color: #f8f9fa;
        padding: 0.5rem;
        border-radius: 4px;
        border: 1px solid #e1e5e9;
        color: #333;
        font-weight: 500;
        word-break: break-all;
    }

    /* 日志样式 */
    .logs-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 1rem;
    }

    .logs-controls {
        display: flex;
        gap: 1rem;
        align-items: center;
    }

    .logs-content {
        max-height: 500px;
        overflow-y: auto;
        border: 1px solid #e1e5e9;
        border-radius: 4px;
    }

    .logs-list {
        max-height: 500px;
        overflow-y: auto;
    }

    .log-entry {
        border-bottom: 1px solid #f1f3f4;
        padding: 1rem;
    }

    .log-entry:last-child {
        border-bottom: none;
    }

    .log-entry.error {
        border-left: 4px solid #dc3545;
        background-color: #f8d7da;
    }

    .log-entry.info {
        border-left: 4px solid #17a2b8;
        background-color: #d1ecf1;
    }

    .log-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 0.5rem;
    }

    .log-time {
        font-size: 0.8rem;
        color: #666;
    }

    .log-type {
        padding: 0.25rem 0.5rem;
        border-radius: 3px;
        font-size: 0.7rem;
        font-weight: 500;
    }

    .log-content pre {
        background-color: #f8f9fa;
        padding: 0.5rem;
        border-radius: 3px;
        font-size: 0.8rem;
        overflow-x: auto;
        margin: 0;
    }

    /* 实时监控页面 */
    .monitor-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
        margin-bottom: 2rem;
    }

    .monitor-card {
        background: white;
        border-radius: 10px;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        overflow: hidden;
    }

    .card-controls {
        display: flex;
        gap: 1rem;
        align-items: center;
    }

    .stream-container {
        height: 400px;
        overflow-y: auto;
        padding: 1rem;
    }

    .stream-placeholder {
        height: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        color: #666;
    }

    .stream-placeholder i {
        font-size: 2rem;
        margin-bottom: 0.5rem;
    }

    .stream-entry {
        border-bottom: 1px solid #f1f3f4;
        padding: 0.75rem;
        margin-bottom: 0.5rem;
        border-radius: 4px;
        background-color: #f8f9fa;
    }

    .stream-entry:last-child {
        border-bottom: none;
    }

    .stream-entry.heartbeat {
        border-left: 4px solid #28a745;
    }

    .stream-entry.event {
        border-left: 4px solid #17a2b8;
    }

    .entry-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 0.5rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .entry-time {
        font-size: 0.8rem;
        color: #666;
        font-family: monospace;
    }

    .device-id {
        font-family: monospace;
        font-size: 0.8rem;
        background-color: #e9ecef;
        padding: 0.2rem 0.4rem;
        border-radius: 3px;
    }

    .event-title {
        font-weight: 500;
        color: #333;
    }

    .heartbeat-info {
        display: flex;
        flex-wrap: wrap;
        gap: 1rem;
        font-size: 0.9rem;
    }

    .heartbeat-info span {
        padding: 0.2rem 0.5rem;
        background-color: white;
        border-radius: 3px;
        border: 1px solid #e1e5e9;
    }

    /* 监控统计 */
    .monitor-stats {
        background: white;
        border-radius: 10px;
        padding: 1.5rem;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    }

    .stats-row {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 1rem;
        margin-bottom: 2rem;
    }

    .stat-item {
        text-align: center;
        padding: 1rem;
        border-radius: 8px;
        background-color: #f8f9fa;
    }

    .stat-header {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        margin-bottom: 0.5rem;
        font-size: 0.9rem;
        color: #666;
    }

    .stat-value {
        font-size: 2rem;
        font-weight: bold;
        color: #333;
    }

    .stat-value.online {
        color: #28a745;
    }

    .stat-value.offline {
        color: #dc3545;
    }

    .stat-value.warning {
        color: #ffc107;
    }

    /* 连接状态 */
    .connection-status {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        padding: 0.5rem 1rem;
        border-radius: 20px;
        background-color: #f8f9fa;
    }

    .connection-status i {
        font-size: 0.8rem;
    }

    .connection-status i.online {
        color: #28a745;
    }

    .connection-status i.offline {
        color: #dc3545;
    }

    /* 告警部分 */
    .alert-section h4 {
        color: #333;
        margin-bottom: 1rem;
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    .alert-container {
        max-height: 300px;
        overflow-y: auto;
    }

    .alert-placeholder {
        text-align: center;
        padding: 2rem;
        color: #666;
    }

    .alert-placeholder i {
        font-size: 2rem;
        margin-bottom: 0.5rem;
    }

    .alert-item {
        border-radius: 4px;
        padding: 1rem;
        margin-bottom: 0.5rem;
        border-left: 4px solid;
    }

    .alert-item.error {
        border-left-color: #dc3545;
        background-color: #f8d7da;
    }

    .alert-item.warning {
        border-left-color: #ffc107;
        background-color: #fff3cd;
        color: #333;
    }

    .alert-item.info {
        border-left-color: #17a2b8;
        background-color: #d1ecf1;
    }

    .alert-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 0.5rem;
    }

    .alert-time {
        font-size: 0.8rem;
        color: #666;
    }

    .alert-device {
        font-family: monospace;
        font-size: 0.8rem;
        background-color: rgba(0, 0, 0, 0.1);
        padding: 0.2rem 0.4rem;
        border-radius: 3px;
    }

    .alert-content strong {
        display: block;
        margin-bottom: 0.25rem;
    }

    .alert-content p {
        margin: 0;
        font-size: 0.9rem;
    }

    /* 加载和空状态 */
    .loading {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        padding: 2rem;
        color: #666;
    }

    .loading i {
        font-size: 1.2rem;
    }

    .no-data {
        text-align: center;
        padding: 2rem;
        color: #666;
    }

    .no-data i {
        font-size: 2rem;
        margin-bottom: 0.5rem;
    }

    /* 响应式设计 */
    @media (max-width: 768px) {
        .container {
            padding: 0 10px;
        }

        .header-content {
            flex-direction: column;
            gap: 1rem;
        }

        .nav {
            flex-wrap: wrap;
            justify-content: center;
            gap: 1rem;
        }

        .page-header {
            flex-direction: column;
            gap: 1rem;
            align-items: flex-start;
        }

        .header-actions {
            flex-wrap: wrap;
            width: 100%;
        }

        .stats-grid {
            grid-template-columns: 1fr;
        }

        .dashboard-content {
            grid-template-columns: 1fr;
        }

        .device-overview {
            grid-template-columns: 1fr;
        }

        .status-grid {
            grid-template-columns: 1fr;
        }

        .monitor-grid {
            grid-template-columns: 1fr;
        }

        .stats-row {
            grid-template-columns: repeat(2, 1fr);
        }

        .command-list {
            grid-template-columns: 1fr;
        }

        .action-grid {
            grid-template-columns: 1fr;
        }

        .form-row {
            grid-template-columns: 1fr;
        }

        .devices-table {
            font-size: 0.8rem;
        }

        .devices-table th,
        .devices-table td {
            padding: 0.5rem;
        }

        .dashboard-grid {
            grid-template-columns: 1fr;
        }

        .config-overview-grid {
            grid-template-columns: 1fr;
        }

        .config-tabs {
            flex-direction: column;
            align-items: stretch;
            gap: 1rem;
        }

        .config-tab-buttons {
            overflow-x: auto;
            justify-content: flex-start;
        }

        .action-buttons {
            flex-direction: column;
            gap: 0.25rem;
        }

        .search-box input {
            width: 200px;
        }

        .tab-buttons {
            overflow-x: auto;
        }

        .heartbeat-info {
            flex-direction: column;
            gap: 0.5rem;
        }

        .entry-header {
            flex-direction: column;
            align-items: flex-start;
        }

        .modal-content {
            margin: 10% auto;
            width: 95%;
        }
    }

    @media (max-width: 480px) {
        .stats-row {
            grid-template-columns: 1fr;
        }

        .device-meta {
            grid-template-columns: 1fr;
        }

        .form-actions {
            flex-direction: column;
        }

        .logs-controls {
            flex-direction: column;
            align-items: flex-start;
            gap: 0.5rem;
        }

        .card-controls {
            flex-direction: column;
            align-items: flex-start;
            gap: 0.5rem;
        }
    }

    /* 移动端响应式优化 */
    @media (max-width: 768px) {
        .container {
            padding: 0 10px;
        }

        /* 头部导航优化 */
        .header-content {
            flex-direction: column;
            gap: 1rem;
        }

        .nav {
            flex-wrap: wrap;
            justify-content: center;
            gap: 0.5rem;
        }

        .nav a {
            font-size: 0.9rem;
            padding: 0.4rem 0.8rem;
        }

        /* 页面头部优化 */
        .page-header {
            flex-direction: column;
            align-items: flex-start;
            gap: 1rem;
        }

        .header-actions {
            flex-direction: column;
            width: 100%;
            align-items: stretch;
            gap: 0.8rem;
        }

        .search-box input {
            width: 100%;
        }

        .broadcast-buttons {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 0.5rem;
        }

        .broadcast-buttons button {
            justify-content: center;
        }

        .broadcast-buttons button span {
            display: inline;
            /* 强制在移动端显示文字 */
        }

        /* 表格优化 */
        .table-responsive {
            overflow-x: auto;
            -webkit-overflow-scrolling: touch;
        }

        .devices-table th,
        .devices-table td {
            padding: 0.75rem 0.5rem;
            white-space: nowrap;
        }

        /* 操作按钮优化 */
        .action-buttons {
            display: flex;
            gap: 0.5rem;
            min-width: 160px;
            /* 保证按钮不换行且有足够空间 */
        }

        .action-buttons .btn {
            padding: 0.4rem 0.6rem;
            font-size: 1rem;
            /* 增大图标以便点击 */
        }

        /* 模态框优化 */
        .modal-content {
            width: 95%;
            margin: 10% auto;
        }

        .command-list {
            grid-template-columns: repeat(2, 1fr);
        }
    }