html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#map {
    width: 100vw;
    height: 100vh;
    position: absolute;
    top: 0;
    left: 0;
}

/* ========= 左侧控制面板 - 收窄 ========= */
.control-panel {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 1000;
    background: rgba(18, 25, 37, 0.85);
    backdrop-filter: blur(10px);
    padding: 14px 14px 18px 14px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    width: 280px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.3s ease;
}

.control-panel:hover {
    background: rgba(22, 30, 43, 0.95);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.panel-title {
    font-size: 18px;
    font-weight: 600;
    color: #ffffff;
    display: flex;
    align-items: center;
}

.panel-title::before {
    content: "";
    display: inline-block;
    width: 22px;
    height: 22px;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%2364DE88"><path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5a2.5 2.5 0 0 1 0-5 2.5 2.5 0 0 1 0 5z"/></svg>');
    background-size: contain;
    margin-right: 8px;
}

/* 设备控制样式 - 更紧凑 */
.device-controls {
    margin: 12px 0;
    padding: 12px;
    background: rgba(30, 41, 59, 0.6);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.device-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.device-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    display: flex;
    align-items: center;
    margin: 0;
}

.device-header h3 i {
    margin-right: 6px;
    font-size: 13px;
    color: #1e8bff;
}

.device-stats {
    display: flex;
    gap: 6px;
}

.device-stat {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
}

.device-stat.active-devices {
    background: rgba(100, 222, 136, 0.2);
    color: #64de88;
}

.device-stat.total-devices {
    background: rgba(30, 139, 255, 0.2);
    color: #1e8bff;
}

.device-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    background: transparent;
    border: none;
    margin-bottom: 8px;
}

.device-toggle span {
    font-size: 13px;
    font-weight: 500;
    color: #a0aebb;
}

.device-refresh {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.device-refresh .btn {
    width: 100%;
    background: rgba(30, 139, 255, 0.15);
    color: #1e8bff;
}

.device-refresh .btn:hover {
    background: rgba(30, 139, 255, 0.25);
}

.device-refresh .btn i {
    margin-right: 6px;
}

.last-update-time {
    font-size: 11px;
    color: #8896a4;
    text-align: center;
    margin-top: 6px;
}

#lastUpdateTime {
    color: #64de88;
    font-weight: 500;
}

/* 轨迹查询区域 - 紧凑 */
.track-controls {
    margin: 14px 0;
    padding: 12px;
    background: rgba(30, 41, 59, 0.6);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.choose-imei {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.choose-imei span {
    font-size: 13px;
    color: #cbd5e1;
    white-space: nowrap;
}

.choose-imei input {
    flex: 1;
    font-size: 12px;
    font-weight: 500;
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.07);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.09);
    padding: 6px 8px;
    outline: none;
}

.choose-imei input:focus {
    border-color: #64de88;
}

.track-time-range {
    margin: 12px 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.track-time-range .time-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.track-time-range .time-row span {
    font-size: 12px;
    color: #a0aebb;
    font-weight: 500;
}

.modal-input {
    width: 65%;
    padding: 6px 8px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 8px;
    color: #ffffff;
    font-size: 12px;
    transition: all 0.2s ease;
}

.modal-input:focus {
    outline: none;
    border-color: #64de88;
}

/* 按钮通用 - 更紧凑 */
.btn {
    padding: 8px 12px;
    background: rgba(100, 222, 136, 0.15);
    color: #64de88;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn:hover {
    background: rgba(100, 222, 136, 0.25);
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn i {
    font-size: 12px;
}

#clearTrackBtn {
    background: rgba(239, 91, 91, 0.15);
    color: #ef5b5b;
    margin-top: 8px;
}

#clearTrackBtn:hover {
    background: rgba(239, 91, 91, 0.25);
}

.track-hint {
    margin-top: 12px;
    padding: 8px 10px;
    background: rgba(30, 139, 255, 0.1);
    border-radius: 8px;
    font-size: 12px;
    color: #1e8bff;
    border-left: 3px solid #1e8bff;
    display: none;
}

.track-hint i {
    margin-right: 5px;
}

/* 说明区域 - 紧凑 */
.instructions {
    margin-top: 16px;
    padding: 10px 12px;
    background: rgba(30, 139, 255, 0.1);
    border-radius: 8px;
    font-size: 12px;
    color: #1e8bff;
    border-left: 4px solid #1e8bff;
}

.instructions p {
    margin: 0;
    line-height: 1.4;
}

.instructions strong {
    font-weight: 600;
}

/* ========= 右侧设备信息面板 - 收窄 ========= */
.device-info-panel {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 1000;
    background: rgba(18, 25, 37, 0.85);
    backdrop-filter: blur(10px);
    padding: 14px 0 16px 0;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    width: 280px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.3s ease;
}

.device-info-panel:hover {
    background: rgba(22, 30, 43, 0.95);
}

.device-info-panel .panel-header {
    padding: 0 14px 10px 14px;
    margin-bottom: 8px;
}

.device-info-panel .panel-title {
    font-size: 16px;
}

.device-info-panel .panel-title::before {
    display: none;
}

.device-count {
    background: rgba(30, 139, 255, 0.2);
    color: #1e8bff;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

/* 设备列表 - 紧凑 */
.device-list {
    margin-top: 8px;
    padding: 0 12px;
}

.device-list-header {
    display: none;
}

/* 设备项样式 - 更紧凑 */
.device-list-item {
    background: rgba(30, 41, 59, 0.6);
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: all 0.2s ease;
}

.device-list-item:hover {
    background: rgba(30, 41, 59, 0.8);
    transform: translateX(-2px);
}

.device-list-item.active {
    background: rgba(30, 139, 255, 0.15);
    border-color: rgba(30, 139, 255, 0.3);
}

.device-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.device-imei {
    font-weight: 600;
    color: #ffffff;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.device-imei i {
    font-size: 12px;
    color: #1e8bff;
}

.device-status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.device-status-indicator.online {
    background-color: #64de88;
    box-shadow: 0 0 4px rgba(100, 222, 136, 0.5);
}

.device-status-indicator.offline {
    background-color: #ef5b5b;
}

.device-details {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #b9c7d9;
}

.device-detail-item {
    display: flex;
    flex-direction: column;
}

.device-detail-label {
    color: #8896a4;
    margin-bottom: 2px;
    font-size: 10px;
}

.device-detail-value {
    color: #ffffff;
    font-weight: 500;
    font-size: 12px;
}

.device-detail-value.battery-high {
    color: #64de88;
}

.device-detail-value.battery-medium {
    color: #ffa726;
}

.device-detail-value.battery-low {
    color: #ef5b5b;
}

/* 空状态 */
.device-empty-state {
    text-align: center;
    padding: 30px 12px;
    color: #5c6b7e;
}

.device-empty-state i {
    font-size: 36px;
    margin-bottom: 10px;
    color: #3a4a5f;
}

.device-empty-state p {
    margin: 0;
    font-size: 13px;
}

/* 设备详情弹窗 - 保持原有样式 */
.device-detail-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 14, 20, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2001;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.device-detail-modal.active {
    opacity: 1;
    visibility: visible;
}

.device-detail-content {
    background: rgba(22, 30, 43, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    width: 90%;
    max-width: 380px;
    max-height: 80vh;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    transform: translateY(-20px);
    transition: transform 0.3s ease;
}

.device-detail-modal.active .device-detail-content {
    transform: translateY(0);
}

.device-detail-header {
    padding: 16px 20px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.device-detail-header h3 {
    color: #ffffff;
    margin: 0;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.device-detail-close {
    background: none;
    border: none;
    color: #a0aebb;
    font-size: 20px;
    cursor: pointer;
    transition: color 0.2s ease;
}

.device-detail-close:hover {
    color: #ffffff;
}

.device-detail-body {
    padding: 16px 20px;
}

/* 设备信息窗口 (地图弹窗) */
.device-info-window {
    background: rgba(22, 30, 43, 0.95);
    border-radius: 8px;
    padding: 12px;
    min-width: 220px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.device-info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.device-info-header h4 {
    margin: 0;
    font-size: 14px;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 6px;
}

.device-status {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
}

.device-status.active {
    background: rgba(100, 222, 136, 0.2);
    color: #64de88;
}

.device-status.inactive {
    background: rgba(239, 91, 91, 0.2);
    color: #ef5b5b;
}

.device-info-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.device-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
}

.device-info-label {
    color: #a0aebb;
}

.device-info-value {
    font-weight: 500;
    color: #ffffff;
}

.device-info-value.battery {
    color: #64de88;
}

.device-info-value.quality {
    color: #ffa726;
}

/* 滚动条样式 - 更细 */
.control-panel::-webkit-scrollbar,
.device-info-panel::-webkit-scrollbar {
    width: 4px;
}

.control-panel::-webkit-scrollbar-track,
.device-info-panel::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.control-panel::-webkit-scrollbar-thumb,
.device-info-panel::-webkit-scrollbar-thumb {
    background: rgba(100, 222, 136, 0.4);
    border-radius: 4px;
}

.control-panel::-webkit-scrollbar-thumb:hover,
.device-info-panel::-webkit-scrollbar-thumb:hover {
    background: rgba(100, 222, 136, 0.6);
}

/* 响应式微调 */
@media (max-width: 1400px) {
    .control-panel,
    .device-info-panel {
        width: 270px;
    }
}

@media (max-height: 700px) {
    .control-panel,
    .device-info-panel {
        max-height: calc(100vh - 32px);
    }
}

@media (max-width: 640px) {
    .control-panel,
    .device-info-panel {
        width: 260px;
    }
}

/* 隐藏数字输入框箭头 */
input::-webkit-inner-spin-button {
    -webkit-appearance: none !important;
}

/* 开关切换保留原有尺寸但略微紧凑 */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.2);
    transition: .3s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #64de88;
}

input:checked + .slider:before {
    transform: translateX(16px);
}

/* 轨迹按钮行 - 两按钮并排一行 */
.track-buttons-row {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.track-buttons-row .btn {
    flex: 1;
    margin-top: 0;
}

/* 覆盖原来的独立按钮样式 */
#queryTrackBtn,
#clearTrackBtn {
    width: 100%;
}

#clearTrackBtn {
    margin-top: 0;
}

/* 刷新行 - 五五分，字体统一 */
.device-refresh-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}

.device-refresh-row .btn {
    flex: 1;
    width: auto;
    padding: 8px 0;
    margin: 0;
    justify-content: center;
    font-size: 13px;
    font-weight: 500;
}

.device-refresh-row .last-update-time {
    flex: 1;
    margin: 0;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    text-align: center;
    padding: 8px 4px;
    background: rgba(255, 255, 255, 0.07);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.09);
    color: #8896a4;
}

.device-refresh-row .last-update-time #lastUpdateTime {
    color: #64de88;
    font-weight: 500;
}

/* 隐藏原来的独立元素 */
.device-refresh {
    display: none;
}