/* ==========================================================================
   设备列表 —— 对齐 sh1008.shapk.one/user 实测 DOM 的单元格渲染
   所有尺寸/颜色取自原版元素的 tailwind 原子类换算值
   ========================================================================== */

/* ---------- 第 0 列：实时状态（在线圆点 + 无障碍 + 锁 + 国旗） ---------- */
.rt-cell {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
    padding: 0 8px;
}

/* 在线圆点：外层 20px 容器，内圈 40% 透明光晕 12px，芯 10px 带发光 */
.rt-online {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    cursor: default;
}

.rt-online__ring {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    transform: scale(1.75);
}

.rt-online__dot {
    position: relative;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.rt-online.on .rt-online__ring { background: rgba(34, 197, 94, 0.45); }
.rt-online.on .rt-online__dot {
    background: #22c55e;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.85);
}
.rt-online.off .rt-online__ring { background: rgba(161, 161, 170, 0.35); }
.rt-online.off .rt-online__dot { background: #a1a1aa; }

/* 无障碍 / 锁：18px 图标，开启绿、未开启灰 */
.rt-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
    line-height: 1;
    cursor: default;
}

.rt-badge svg { width: 18px; height: 18px; }
.rt-badge.on { color: #16a34a; }
.rt-badge.off { color: #d4d4d8; }

/* 国旗：40×30 圆角带边框 */
.rt-flag {
    width: 40px;
    height: 30px;
    flex-shrink: 0;
    border-radius: 6px;
    border: 1px solid #e4e4e7;
    object-fit: contain;
    background: #fafafa;
    cursor: default;
}

.dark .rt-flag { border-color: #3f3f46; background: #27272a; }

/* ---------- 电量：纯 CSS 电池条（原版 h14×w30、5 格） ---------- */
.batt-row {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.batt-shell {
    display: flex;
    align-items: center;
    gap: 2px;
    width: 30px;
    height: 14px;
    padding: 0 2px;
    border: 1px solid;
    border-radius: 3px;
    box-sizing: border-box;
}

.batt-cell {
    height: 8px;
    flex: 1;
    border-radius: 1px;
    background: rgba(14, 203, 129, 0.12);
}

.batt-nub {
    width: 2px;
    height: 6px;
    margin-left: 1px;
    border-radius: 0 1px 1px 0;
}

.batt-num {
    min-width: 2.25rem;
    text-align: right;
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

/* 分档着色：>=60 绿 / >=20 黄 / <20 红（原版只有绿色系，其余沿用同一语义） */
.batt-shell.ok { border-color: rgba(14, 203, 129, 0.5); }
.batt-shell.warn { border-color: rgba(245, 158, 11, 0.5); }
.batt-shell.danger { border-color: rgba(239, 68, 68, 0.5); }

.batt-nub.ok { background: rgba(14, 203, 129, 0.5); }
.batt-nub.warn { background: rgba(245, 158, 11, 0.5); }
.batt-nub.danger { background: rgba(239, 68, 68, 0.5); }

.batt-cell.on.ok { background: #0ECB81; }
.batt-cell.on.warn { background: #f59e0b; }
.batt-cell.on.danger { background: #ef4444; }

.batt-num.ok { color: #0A9B63; }
.batt-num.warn { color: #b45309; }
.batt-num.danger { color: #dc2626; }

.dark .batt-cell.on.ok { background: #3DDC97; }
.dark .batt-num.ok { color: #3DDC97; }

/* ---------- 网络质量：112px 两行小卡片 ---------- */
.net-card {
    display: inline-flex;
    flex-direction: column;
    gap: 4px;
    width: 112px;
    max-width: 100%;
    padding: 6px 8px;
    border-radius: 8px;
    box-sizing: border-box;
    text-align: left;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.04);
    cursor: default;
}

.net-top,
.net-bot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    white-space: nowrap;
    line-height: 1;
}

.net-q {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 500;
}

.net-dot {
    width: 6px;
    height: 6px;
    flex-shrink: 0;
    border-radius: 50%;
}

.net-ping {
    display: inline-flex;
    align-items: baseline;
    gap: 2px;
    font-variant-numeric: tabular-nums;
}

.net-ping-v { font-size: 12px; font-weight: 600; letter-spacing: -0.01em; }
.net-ping-u { font-size: 10px; font-weight: 400; opacity: 0.7; }

.net-bot {
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    padding-top: 4px;
    font-size: 10px;
    line-height: 1;
}

.net-bot > span:first-child { color: #71717a; }
.net-loss { font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* 三档配色（良好 / 一般 / 较差） */
.net-card.ok { background: #E6FFF1; }
.net-card.ok .net-q,
.net-card.ok .net-ping,
.net-card.ok .net-loss { color: #0A9B63; }
.net-card.ok .net-dot { background: #36B37E; }

.net-card.warn { background: #FFF7E6; }
.net-card.warn .net-q,
.net-card.warn .net-ping,
.net-card.warn .net-loss { color: #b45309; }
.net-card.warn .net-dot { background: #f59e0b; }

.net-card.danger { background: #FEF2F2; }
.net-card.danger .net-q,
.net-card.danger .net-ping,
.net-card.danger .net-loss { color: #b91c1c; }
.net-card.danger .net-dot { background: #ef4444; }

.net-card.default { background: #f4f4f5; }
.net-card.default .net-q,
.net-card.default .net-ping,
.net-card.default .net-loss { color: #71717a; }
.net-card.default .net-dot { background: #a1a1aa; }

.dark .net-card.ok { background: #0F2E22; }
.dark .net-card.ok .net-q,
.dark .net-card.ok .net-ping,
.dark .net-card.ok .net-loss { color: #57D9A3; }
.dark .net-card.ok .net-dot { background: #57D9A3; }
.dark .net-bot { border-top-color: rgba(255, 255, 255, 0.1); }

/* ---------- 屏幕状态：68px 定宽 chip，亮屏带太阳图标 ---------- */
.screen-chip {
    position: relative;
    display: inline-flex;
    align-items: center;
    box-sizing: border-box;
    justify-content: center;
    gap: 4px;
    width: 68px;
    height: 24px;
    padding: 0 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
    cursor: default;
}

.screen-chip__icon { display: inline-flex; flex-shrink: 0; }
.screen-chip__icon svg { width: 14px; height: 14px; }
.screen-chip__text { flex: 1; text-align: inherit; }

.screen-chip.on { background: #dcfce7; color: #166534; }
.screen-chip.off { background: #f4f4f5; color: #52525b; }

.dark .screen-chip.on { background: rgba(220, 252, 231, 0.2); color: #4ade80; }
.dark .screen-chip.off { background: #27272a; color: #a1a1aa; }

/* ---------- 锁屏/支付密码：20px svg 勾叉 ---------- */
.keyguard-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: default;
}

.keyguard-mark svg { width: 20px; height: 20px; }
.keyguard-mark.ok { color: #16a34a; }
.keyguard-mark.off { color: #dc2626; }

/* ---------- 表头排序按钮 ---------- */
.th-sortable {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.th-sort-col {
    display: inline-flex;
    flex-direction: column;
    flex-shrink: 0;
}

.th-sort {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 12px;
    padding: 0;
    border: 0;
    border-radius: 2px;
    background: transparent;
    color: #d4d4d8;
    cursor: pointer;
    outline: none;
}

.th-sort:hover { background: #f4f4f5; }
.th-sort.is-active { color: #18181b; }
.th-sort svg { width: 12px; height: 12px; }

.dark .th-sort { color: #52525b; }
.dark .th-sort:hover { background: #27272a; }
.dark .th-sort.is-active { color: #fafafa; }

/* ---------- 备注旁铅笔 ---------- */
.remark-edit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    font-size: 22px;
    color: #2563eb;
    cursor: pointer;
}

.remark-edit svg { width: 20px; height: 20px; }

/* ---------- 设备ID 旁「变更管理员」箭头 ---------- */
.admin-change {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    color: #2563eb;
    cursor: pointer;
    font-size: 12px;
}

.admin-change svg { width: 14px; height: 14px; flex-shrink: 0; }

/* ---------- 标签按钮 ---------- */
.tag-edit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: 0;
    background: transparent;
    color: #2563eb;
    cursor: pointer;
    border-radius: 6px;
}

.tag-edit-btn:hover { background: rgba(37, 99, 235, 0.08); }
.tag-edit-btn svg { width: 18px; height: 18px; }

/* ==========================================================================
   在线状态 tablist（原版：按在线状态筛选）
   ========================================================================== */
.dev-tabs {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 3px;
    margin: 0 0 10px;
    border-radius: 10px;
    background: #f4f4f5;
}

.dev-tab {
    padding: 6px 14px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    font-size: 13px;
    line-height: 1;
    white-space: nowrap;
    color: #52525b;
    cursor: pointer;
    transition: background-color .15s, color .15s;
}

.dev-tab:hover { color: #18181b; }

.dev-tab.is-active {
    background: #fff;
    color: #18181b;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.dark .dev-tabs { background: #27272a; }
.dark .dev-tab { color: #a1a1aa; }
.dark .dev-tab:hover { color: #fafafa; }
.dark .dev-tab.is-active { background: #3f3f46; color: #fafafa; }

/* ==========================================================================
   按标签筛选 —— 按钮组（原版不是下拉）
   ========================================================================== */
.dev-tagbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 0 0 12px;
}

.dev-tagbar__label {
    font-size: 12px;
    color: #71717a;
    margin-right: 2px;
    white-space: nowrap;
}

.dev-tagbtn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 11px;
    border: 1px solid #e4e4e7;
    border-radius: 999px;
    background: #fff;
    font-size: 12px;
    line-height: 1;
    white-space: nowrap;
    color: #52525b;
    cursor: pointer;
    transition: border-color .15s, background-color .15s, color .15s;
}

.dev-tagbtn:hover { border-color: #a1a1aa; color: #18181b; }

.dev-tagbtn.is-active {
    border-color: #2563eb;
    background: rgba(37, 99, 235, 0.08);
    color: #1d4ed8;
    font-weight: 600;
}

/* 带复选框的自定义标签 chip：隐藏原生框，只用文字 + 高亮 */
.dev-tagbtn--check input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.dev-tagbtn--check { position: relative; }

/* 自定义标签带颜色时，用左侧色点提示 */
.dev-tagbtn--check.is-active::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--tag-color, #2563eb);
}

.dark .dev-tagbtn { background: #27272a; border-color: #3f3f46; color: #a1a1aa; }
.dark .dev-tagbtn:hover { border-color: #52525b; color: #fafafa; }
.dark .dev-tagbtn.is-active {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.16);
    color: #93c5fd;
}

/* ==========================================================================
   管理设备标签 —— 内联展开面板
   ========================================================================== */
.tag-panel {
    overflow: hidden;
    margin: 0 0 12px;
    border: 1px solid #e4e4e7;
    border-radius: 12px;
    background: #fafafa;
    transition: max-height .22s ease, opacity .18s ease, padding .22s ease;
    max-height: 640px;
    opacity: 1;
    padding: 12px 14px;
}

.tag-panel.is-collapsed {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-width: 0;
    margin-bottom: 0;
}

.tag-panel__title {
    font-size: 13px;
    font-weight: 600;
    color: #18181b;
    margin-bottom: 8px;
}

.tag-panel__empty { font-size: 13px; color: #a1a1aa; padding: 6px 0; }

.tag-panel__list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tag-panel__row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 6px;
    border-radius: 8px;
}

.tag-panel__row:hover { background: rgba(0, 0, 0, 0.03); }
.tag-panel__row.is-selected { background: rgba(37, 99, 235, 0.07); }

.tag-panel__pick {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
    padding: 2px 0;
    border: 0;
    background: transparent;
    font-size: 13px;
    text-align: left;
    color: inherit;
    cursor: pointer;
}

.tag-panel__row .spacer { flex: 1; }
.tag-panel__row .tag-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.tag-panel__row .tag-name { font-weight: 500; }
.tag-panel__row .muted { color: #a1a1aa; font-size: 12px; }

.dark .tag-panel { background: #1f1f23; border-color: #3f3f46; }
.dark .tag-panel__title { color: #fafafa; }
.dark .tag-panel__row:hover { background: rgba(255, 255, 255, 0.04); }
.dark .tag-panel__row.is-selected { background: rgba(59, 130, 246, 0.14); }
