/* ---- 全局基础 ---- */
:root {
    --falcon-body-bg: #edf2f9;
    --falcon-card-bg: #ffffff;
    --falcon-border-color: #edf2f9;
    --falcon-text-primary: #232e3c;
    --falcon-text-secondary: #6c757d;
    --falcon-text-heading: rgb(52, 64, 80);
    --falcon-primary: #2c7be5;
    --falcon-success: #00d97e;
    --falcon-warning: #f6c343;
    --falcon-danger: #e5533d;
    --falcon-info: #19a4b5;
    --falcon-border-radius: 4px;
    --falcon-shadow: 0 7px 14px 0 rgba(65, 69, 88, 0.1), 0 3px 6px 0 rgba(0, 0, 0, 0.07);
    --falcon-transition: all 0.2s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: var(--falcon-body-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---- 表格覆盖 ---- */
.n-data-table {
    --n-font-size: 12px !important;
    --n-th-font-size: 13px !important;
    --n-td-font-size: 12px !important;
}

.n-data-table .n-data-table-th {
    background: #fafbfd !important;
    font-weight: 600 !important;
    color: var(--falcon-text-secondary) !important;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.n-data-table__pagination {
    margin-right: 16px !important;
    margin-bottom: 16px !important;
}

/* ---- 滚动条美化 ---- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #c8ccd4;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a0a6b1;
}

/* 页面头部 */
.page_header {
    position: fixed;
    z-index: 2;
    left: 0;
    width: 100%;
    background: #fff;
    box-shadow: 0 0 16px -5px #464646 !important;
}

/* 页面头部内容 */
.page_header_body {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 auto;
    max-width: 1670px;
    height: 54px;
    padding: 0 10px;
}

/* 页面头部标题区 */
.page_header_title {
    font-size: 20px;
    font-weight: 500;
    color: #212529;
    display: flex;
    align-items: center;
}

/* 页面头部控制区 */
.page_header_controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* 页面 */
.page_content {
    padding-top: 54px;
    max-width: 1670px;
    margin: 0 auto;
    background: #edf2f9;
}

/* 页面内容内层 */
.page_content_inner {
    padding: 16px 8px 8px 8px;
}

/* grid 包装层：padding 给阴影空间 */
.grid-pad-wrap {
    padding: 0 8px;
}

/* 概览页顶部卡片 */
.overview_top_card {
    background: var(--falcon-card-bg);
    border-radius: var(--falcon-border-radius);
    box-shadow: var(--falcon-shadow);
    transition: var(--falcon-transition);
    padding: 20px 16px;
}

/* 概览页顶部卡片内容 */
.overview_top_card_body {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.overview_top_card_title {
    font-size: 22px;
    font-weight: 600;
}

.overview_top_card_subtitle {
    font-size: 14px;
    color: #6c757d;
}

/* 概览页顶部卡片标题单位 */
.overview_top_card_title_tag {
    font-size: 14px;
    color: #6c757d;
}

/* 概览页顶部卡片详情 */
.overview_top_card_detail {
    font-size: 13px;
    margin-top: 12px;
    color: #6c757d;
}

/* 通用卡片 */
.monitor_card {
    background: var(--falcon-card-bg);
    border-radius: var(--falcon-border-radius);
    box-shadow: var(--falcon-shadow);
    transition: var(--falcon-transition);
}

/* 通用卡片头部 */
.monitor_card_header {
    padding: 16px 20px;
    font-size: 16px;
    font-weight: 500;
    color: var(--falcon-text-heading);
    background: #fafbfd;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* 通用卡片头部额外信息 */
.monitor_card_header_extra {
    font-size: 14px;
    color: #6c757d;
    display: flex;
    align-items: center;
}



/* ---- 登录页 ---- */
.login_overlay {
    position: fixed;
    inset: 0;
    background: #edf2f9;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}
.login_card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.1);
    padding: 40px 32px;
    width: 360px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.login_title {
    font-size: 22px;
    font-weight: 700;
    color: var(--falcon-text-heading);
    text-align: center;
    margin-bottom: 4px;
}
.login_subtitle {
    font-size: 13px;
    color: #6c757d;
    text-align: center;
    margin-bottom: 12px;
}

/* ---- 排行可滚动区域 ---- */
.rank_scroll {
    max-height: 444px;
    overflow-y: auto;
}

/* ---- 排行项（两行布局）---- */
.vrank_item {
    padding: 7px 16px;
    border-top: 1px solid var(--falcon-border-color);
    cursor: default;
    transition: background 0.15s ease;
}
.vrank_item:hover {
    background: rgba(44, 123, 229, 0.05);
}
.vrank_top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 3px;
}
.vrank_num {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
    background: #d9e7fa;
    color: #2c7be5;
}
.vrank_num_1 { background: #f59e0b; color: #fff; }
.vrank_num_2 { background: #94a3b8; color: #fff; }
.vrank_num_3 { background: #cd7f32; color: #fff; }
.vrank_name {
    flex: 1;
    min-width: 0;
    font-size: 12px;
    color: var(--falcon-text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.vrank_id {
    font-size: 11px;
    color: var(--falcon-text-secondary);
    margin-left: 3px;
}
.vrank_val {
    font-size: 12px;
    font-weight: 600;
    color: var(--falcon-text-primary);
    flex-shrink: 0;
    width: 42px;
    text-align: right;
}
.vrank_track {
    height: 6px;
    margin-left: 30px;
    background: #e9ecef;
    border-radius: 3px;
    overflow: hidden;
}
.vrank_bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
    min-width: 2px;
}

/* 各类排行条的配色 */
.rank_timeout .vrank_bar { background: linear-gradient(90deg, #fb923c, #ef4444); }
.rank_signal .vrank_bar  { background: linear-gradient(90deg, #4ade80, #16a34a); }
.rank_response .vrank_bar{ background: linear-gradient(90deg, #facc15, #ef4444); }
.rank_sent .vrank_bar    { background: linear-gradient(90deg, #60a5fa, #2563eb); }
.rank_connect .vrank_bar { background: linear-gradient(90deg, #a78bfa, #7c3aed); }

/* ---- 协议分布纵向排行样式 ---- */
.proto_rank {
    display: flex;
    flex-direction: column;
    padding: 10px 16px;
    border-top: 1px solid var(--falcon-border-color);
    cursor: default;
    transition: background 0.15s ease;
}

.proto_rank:hover {
    background: rgba(44, 123, 229, 0.05);
}

.proto_rank_info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.proto_rank_name {
    font-size: 14px;
    color: var(--falcon-text-primary);
}

.proto_rank_count {
    font-size: 13px;
    font-weight: 600;
    color: #2c7be5;
}

.proto_rank_track {
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    overflow: hidden;
}

.proto_rank_fill {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, #2c7be5, #6ea8fe);
    transition: width 0.4s ease;
    min-width: 2px;
}

/* 表格横向滚动 */
.table_scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* 设备连接页工具栏 */
.monitor_devices_toolbor {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    padding: 10px 16px;
}

/* ---- 调试弹窗 ---- */
.debug_modal_body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

.debug_info_item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.debug_label {
    font-size: 12px;
}

.debug_send_row {
    display: flex;
    gap: 8px;
}

.debug_send_area {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.debug_section_header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
}

.debug_send_btn {
    height: 100%;
}

.debug_response_area {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.debug_modal_body textarea {
    font-family: 'Courier New', Consolas, monospace !important;
    font-weight: 600;
}

/* ---- MQTT监视 ---- */
.mqtt_filter_row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.mqtt_msg_list {
    height: 600px;
    overflow-y: auto;
    border: 1px solid var(--falcon-border-color);
    border-radius: var(--falcon-border-radius);
    background: #fafbfd;
}
.mqtt_msg_item {
    padding: 6px 10px;
    border-bottom: 1px solid var(--falcon-border-color);
    font-size: 12px;
    line-height: 1.5;
    cursor: default;
    transition: background 0.1s ease;
}
.mqtt_msg_item:hover {
    background: rgba(44, 123, 229, 0.04);
}
.mqtt_msg_item:last-child {
    border-bottom: none;
}
.mqtt_msg_time {
    color: #6c757d;
    font-size: 11px;
    margin-bottom: 2px;
}
.mqtt_msg_topic {
    color: #2c7be5;
    font-weight: 500;
    word-break: break-all;
    margin-bottom: 2px;
}
.mqtt_msg_payload {
    color: var(--falcon-text-primary);
    font-family: 'Courier New', Consolas, monospace;
    word-break: break-all;
}


.n-divider:not(.n-divider--vertical) {
    margin-top: 10px;
    margin-bottom: 10px;
}