/* ==========================================================================
 * static/css/admin_devices.css — 阶段 6B C3 迁出：admin_devices.html 内联样式块。
 * 规则文本逐字搬迁，保持基线先后顺序，未重排特异性、未改选择器与属性。
 ========================================================================== */
        * { margin: 0; padding: 0; box-sizing: border-box; }
        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
            background: #0f1923; color: #e0e0e0; min-height: 100vh;
        }
        .container { max-width: 1600px; margin: 0 auto; padding: 16px; }
        .nav {
            display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap;
        }
        .nav a {
            padding: 8px 18px; background: #111d2c; border: 1px solid #1a2a3e; border-radius: 8px;
            color: #7a8a9a; text-decoration: none; font-size: 13px; transition: 0.2s;
        }
        .nav a:hover { background: #1a2a3e; border-color: #4fc3f7; color: #fff; }
        .nav a.active { background: #1a2a3e; border-color: #4fc3f7; color: #4fc3f7; }
        .nav a.home-link { background: #0d2137; border-color: #1565c0; color: #64b5f6; }
        .nav a.home-link:hover { background: #1565c0; color: #fff; }
        .main-layout { display: flex; gap: 16px; align-items: flex-start; }

        .sidebar {
            width: 220px; flex-shrink: 0;
            background: #111d2c; border: 1px solid #1a2a3e; border-radius: 10px;
            padding: 12px 0; transition: width 0.3s, padding 0.3s, opacity 0.3s;
            overflow: hidden;
        }
        .sidebar.collapsed { width: 0; padding: 0; border: none; opacity: 0; }
        .sidebar-header {
            display: flex; justify-content: space-between; align-items: center;
            padding: 0 14px 10px; border-bottom: 1px solid #1a2a3e;
        }
        .sidebar-header .title { font-size: 13px; color: #5a7a9a; letter-spacing: 1px; }
        .sidebar-toggle {
            background: none; border: none; color: #5a7a9a; cursor: pointer;
            font-size: 18px; padding: 2px 6px; border-radius: 4px;
        }
        .sidebar-toggle:hover { background: #1a2a3e; color: #fff; }
        .sidebar-reveal {
            display: none; width: 36px; flex-shrink: 0;
            background: #111d2c; border: 1px solid #1a2a3e; border-radius: 10px;
            padding: 10px 0; cursor: pointer; font-size: 20px;
            color: #5a7a9a; text-align: center; transition: 0.2s;
            align-items: center; justify-content: center;
        }
        .sidebar-reveal:hover { background: #1a2a3e; color: #fff; }
        .sidebar.collapsed + .sidebar-reveal { display: flex; }
        .sidebar-item {
            padding: 10px 16px; cursor: pointer; font-size: 13px;
            color: #7a8a9a; transition: 0.15s; display: flex; align-items: center; gap: 8px;
            border-left: 3px solid transparent;
        }
        .sidebar-item:hover { background: #15202e; color: #e0e0e0; }
        .sidebar-item.active { background: #15202e; color: #4fc3f7; border-left-color: #4fc3f7; }
        .sidebar-item .icon { font-size: 16px; }
        .sidebar-item .count {
            margin-left: auto; font-size: 11px; background: #0f1923;
            padding: 1px 6px; border-radius: 8px; color: #5a7a9a;
        }
        .sidebar-item.active .count { color: #4fc3f7; }

        .content {
            flex: 1; min-width: 0;
            background: #111d2c; border: 1px solid #1a2a3e; border-radius: 10px; padding: 20px;
        }
        .content h2 { font-size: 16px; color: #4fc3f7; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
        .toolbar { display: flex; gap: 8px; margin-bottom: 12px; align-items: center; flex-wrap: wrap; }
        .toolbar button {
            padding: 6px 14px; border-radius: 6px; border: none; cursor: pointer;
            font-size: 12px; transition: 0.15s;
        }
        .btn-primary { background: #1565c0; color: #fff; }
        .btn-primary:hover { background: #1976d2; }
        .btn-import { background: #2e7d32; color: #fff; }
        .btn-import:hover { background: #388e3c; }
        .btn-export { background: #4a2a1a; color: #ffb74d; }
        .btn-export:hover { background: #5a3a2a; }
        .btn-snapshot { background: #1a3a4a; color: #4fc3f7; }
        .btn-snapshot:hover { background: #1a4a5a; }
        .btn-snapshot.hidden { display: none; }
        .btn-refresh-ipc { background: #2a3a1a; color: #aed581; margin-left:4px; }
        .btn-refresh-ipc:hover { background: #3a4a2a; }

        .device-table-wrap { overflow-x: auto; }
        table { width: 100%; border-collapse: collapse; font-size: 13px; }
        th {
            background: #0f1923; color: #4fc3f7; padding: 10px 8px;
            text-align: left; font-size: 12px; border-bottom: 1px solid #1a2a3e;
            white-space: nowrap;
        }
        td { padding: 8px; border-bottom: 1px solid #0a0e17; color: #c0c0c0; }
        /* 批量选择首列（2026-11-11）：表头全选框与行内选择框必须同起点同宽度，否则 4K 下肉眼可见错位 */
        #deviceTable th:first-child,
        #deviceTable td:first-child {
            width: 44px; min-width: 44px; max-width: 44px;
            padding: 8px 0 8px 10px; text-align: left; box-sizing: border-box;
        }
        #deviceTable th:first-child input,
        #deviceTable td:first-child input { vertical-align: middle; margin: 0; cursor: pointer; }
        tr:hover td { background: #15202e; }
        td .ip { color: #4fc3f7; font-family: monospace; font-size: 12px; }
        td .usr { color: #7a8a9a; font-size: 12px; }
        td .model { color: #5a7a9a; font-size: 11px; }
        td .ch-name { color: #ffb74d; font-size: 12px; }

        .type-badge { display: inline-block; padding: 2px 8px; border-radius: 8px; font-size: 11px; font-weight: 500; }
        .type-ipc { background: #1a3a4a; color: #4fc3f7; }
        .type-passenger { background: #1a3a2a; color: #66bb6a; }
        .type-vehicle { background: #2a2a1a; color: #ffb74d; }
        .type-nvr { background: #3a1a2a; color: #ef5350; }
        .type-decoder { background: #2a1a3a; color: #ce93d8; }
        .type-poe { background: #1a2a3a; color: #42a5f5; }
        .type-ipbs { background: #2a3a1a; color: #aed581; }
        .type-telephone { background: #3a2a1a; color: #ff8a65; }

        .action-btn { padding: 4px 10px; border: none; border-radius: 4px; cursor: pointer; font-size: 11px; }
        .btn-del { background: #4a1a1a; color: #ef5350; }
        .btn-del:hover { background: #c62828; color: #fff; }
        .btn-cancel { background: #4a4a4a; color: #aaa; }
        .btn-cancel:hover { background: #5a5a5a; }

        /* 园区多选筛选 */
        .park-filter {
            display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; align-items: center;
        }
        .park-filter label {
            display: inline-flex; align-items: center; gap: 3px; font-size: 12px;
            cursor: pointer; padding: 3px 8px; background: #0f1923;
            border: 1px solid #1a2a3e; border-radius: 4px; color: #7a8a9a; transition: 0.15s;
        }
        .park-filter label:hover { border-color: #4fc3f7; }
        .park-filter label.active { background: #0d2137; border-color: #4fc3f7; color: #4fc3f7; }
        .park-filter label input { display: none; }
        .park-filter .label-all { color: #5a6a7a; font-size: 11px; margin-right: 4px; }
        .park-filter select:hover { border-color: #4fc3f7; }
        .btn-restore { background: #2a3a1a; color: #66bb6a; }
        .btn-restore:hover { background: #388e3c; color: #fff; }

        .add-form {
            display: none; background: #0f1923; border: 1px solid #1a2a3e;
            border-radius: 8px; padding: 14px; margin-bottom: 16px;
        }
        .add-form.visible { display: block; }
        .add-form .row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; align-items: center; }
        .add-form label { font-size: 12px; color: #5a7a9a; min-width: 50px; }
        .add-form input, .add-form select {
            padding: 5px 8px; border: 1px solid #1a2a3e; border-radius: 4px;
            background: #0a0e17; color: #e0e0e0; font-size: 12px;
        }
        .add-form input:focus, .add-form select:focus { border-color: #4fc3f7; outline: none; }

        /* 截图预览 */
        .portrait-cell { position: relative; }
        .portrait-cell img {
            width: 120px; height: 90px; object-fit: cover; border-radius: 4px;
            border: 1px solid #1a2a3e; cursor: pointer; transition: 0.2s;
        }
        .portrait-cell img:hover { border-color: #4fc3f7; transform: scale(1.05); }
        .portrait-cell .no-portrait {
            display: inline-flex; align-items: center; justify-content: center;
            width: 120px; height: 90px; background: #0a0e17; border: 1px dashed #1a2a3e;
            border-radius: 4px; color: #3a4a5a; font-size: 11px;
        }
        .portrait-lg-overlay {
            display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
            background: rgba(0,0,0,0.8); z-index: 1000;
            align-items: center; justify-content: center;
        }
        .portrait-lg-overlay.visible { display: flex; }
        .portrait-lg-overlay img {
            max-width: 90vw; max-height: 90vh; border-radius: 8px;
            box-shadow: 0 0 40px rgba(0,0,0,0.5);
        }
        .portrait-lg-overlay .close-btn {
            position: fixed; top: 20px; right: 20px; background: none;
            border: none; color: #fff; font-size: 32px; cursor: pointer;
        }

        .toast {
            position: fixed; top: 20px; right: 20px; padding: 12px 20px;
            border-radius: 6px; color: #fff; font-size: 14px; z-index: 999;
            display: none; animation: fadeIn 0.3s;
        }
        .toast.success { background: #2e7d32; }
        .toast.error { background: #c62828; }
        @keyframes fadeIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
        .empty-state { text-align: center; padding: 40px 20px; color: #3a4a5a; font-size: 14px; }
        .empty-state .icon { font-size: 48px; margin-bottom: 12px; }
        /* PoE 操作按钮 */
        .poe-btn {
            display: inline-flex; align-items: center; justify-content: center;
            width: 28px; height: 28px; border-radius: 6px; border: none;
            cursor: pointer; font-size: 14px; margin: 0 2px; transition: 0.15s;
        }
        .poe-on { background: #1b5e20; color: #66bb6a; }
        .poe-on:hover { background: #2e7d32; color: #fff; }
        .poe-off { background: #b71c1c; color: #ef5350; }
        .poe-off:hover { background: #c62828; color: #fff; }
        .poe-reboot { background: #e65100; color: #ffb74d; }
        .poe-reboot:hover { background: #ef6c00; color: #fff; }
        .poe-refresh { background: #0d2137; color: #4fc3f7; }
        .poe-refresh:hover { background: #1565c0; color: #fff; }
        .poe-editable { cursor: pointer; }
        .poe-editable:hover { background: #15202e; outline: 1px dashed #4fc3f7; }
        /* ===== PoE 挂载徽标（2026-09：PoE 页端口挂载 + IPC 页 PoE 挂载列） ===== */
        .poe-cell { white-space: nowrap; }
        .poe-badge {
            display: inline-flex; align-items: center; gap: 5px;
            padding: 3px 9px; border-radius: 6px; font-size: 11.5px;
            cursor: pointer; border: 1px solid transparent; transition: 0.15s;
            max-width: 190px; overflow: hidden;
        }
        .poe-badge:hover { filter: brightness(1.2); border-color: #4fc3f7; }
        .poe-badge .dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
        .poe-badge.mounted { background: #0e2a1a; color: #81c784; }
        .poe-badge.mounted .dot { background: #66bb6a; }
        .poe-badge.unmatched { background: #1a1a2e; color: #78909c; }
        .poe-badge.unmatched .dot { background: #607d8b; }
        .poe-badge.nomac { background: #141a24; color: #4a5a6a; }
        .poe-badge.nomac .dot { background: #37474f; }
        .poe-badge .port { color: #a5d6a7; font-weight: 600; }
        .poe-badge .hint { color: #546e7a; font-size: 10px; margin-left: 2px; }
        .poe-mount-table { width: 100%; border-collapse: collapse; font-size: 12px; }
        .poe-mount-table th {
            text-align: left; padding: 6px 8px; color: #7a8a9a; font-weight: 500;
            border-bottom: 1px solid #1a2a3e; background: #0d1520; font-size: 11.5px;
        }
        .poe-mount-table td { padding: 6px 8px; border-bottom: 1px solid #15202e; }
        .inline-input {
            background: #0d2137; border: 1px solid #1a3a5e; color: #e0e8f0;
            font-size: 13px; padding: 3px 6px; border-radius: 4px; outline: none;
            width: 80px; height: 26px; box-sizing: border-box;
        }
        .inline-input:focus { border-color: #4fc3f7; box-shadow: 0 0 6px rgba(79,195,247,.3); }
        .inline-input.wide { width: 140px; }
        /* 2026-10-28：设备能力列 / 📍 标定 */
        .ability-badge { display:inline-block; padding:1px 7px; margin:1px 2px; border-radius:9px;
            background:#0e2a3a; color:#4fc3f7; border:1px solid #1a4a6a; font-size:11px; }
        .ability-none { color:#5a6a7a; }
        .ability-unknown { color:#3a4a5a; }
        .geo-btn { background:#0d2137; color:#ffb74d; border:1px solid #3a2a1a; }
        .geo-btn:hover { background:#3a2a1a; color:#ffe0b2; }
        .geo-modal { position:fixed; inset:0; background:rgba(0,0,0,.55); z-index:10000;
            display:flex; align-items:center; justify-content:center; }
        .geo-modal .box { background:#0f1923; border:1px solid #1a2a3e; border-radius:8px;
            width:680px; max-width:94vw; padding:0; overflow:hidden; }
        .geo-modal .head { display:flex; justify-content:space-between; align-items:center;
            padding:10px 14px; border-bottom:1px solid #1a2a3e; color:#4fc3f7; font-size:14px; }
        .geo-modal .map { height:420px; width:100%; }
        .geo-modal .foot { padding:10px 14px; border-top:1px solid #1a2a3e;
            display:flex; align-items:center; gap:12px; font-size:12px; color:#8fa3b8; }
        .geo-modal .foot .coord { font-family:monospace; color:#81c784; }
        .leaflet-container { background:#0a1218; }

        /* ===== 密码掩码（2026-10-31 v3.1） ===== */
        .pw-mask  { color:#5a6a7a; font-family:monospace; letter-spacing:1px; cursor:pointer; }
        .pw-mask:hover  { color:#4fc3f7; }
        .pw-empty { color:#3a4a5a; font-style:italic; cursor:pointer; }
        .pw-empty:hover { color:#4fc3f7; }
        .pw-editor { display:inline-flex; align-items:center; gap:4px; }
        .pw-eye {
            background:#0a0e17; border:1px solid #1a2a3e; border-radius:4px;
            color:#7a8a9a; cursor:pointer; font-size:12px; padding:2px 6px; line-height:1.4;
        }
        .pw-eye:hover { border-color:#4fc3f7; color:#4fc3f7; }

        /* ===== 账号/密码复合格（2026-10-31 v3.1） ===== */
        .auth-cell { display:inline-flex; align-items:center; gap:6px; white-space:nowrap; }
        .auth-user  { font-size:12px; line-height:1; }
        .usr-default { color:#2a3a4a; font-size:13px; cursor:pointer; }
        .usr-default:hover { color:#4fc3f7; }
        .usr-empty   { color:#3a4a5a; cursor:pointer; }
        .usr-empty:hover { color:#4fc3f7; }
        .usr-custom  { color:#ffb74d; font-weight:600; cursor:pointer; }
        .usr-custom:hover { color:#ffe0b2; }
    

        /* ===== IPC 批量操作条（2026-11-11 新增） ===== */
        .batch-bar {
            display: none; align-items: center; gap: 8px; flex-wrap: wrap;
            padding: 8px 12px; margin-bottom: 10px;
            background: #10202f; border: 1px solid #1a3a52; border-radius: 8px;
        }
        .batch-bar .bb-count { font-size: 13px; color: #7a8a9a; margin-right: 4px; }
        .batch-bar .bb-count b { color: #4fc3f7; font-size: 15px; }
        .bb-btn {
            padding: 5px 12px; background: #0f1923; border: 1px solid #1a2a3e; border-radius: 5px;
            color: #9fb3c8; font-size: 12px; cursor: pointer; transition: 0.2s; white-space: nowrap;
        }
        .bb-btn:hover { background: #1a2a3e; border-color: #4fc3f7; color: #fff; }
        .bb-btn.bb-del { color: #ef8a8a; border-color: #4a2530; }
        .bb-btn.bb-del:hover { background: #3a1a20; border-color: #ef5350; color: #fff; }
        .bb-btn.bb-clear { margin-left: auto; color: #6a7a8a; }
        .batch-bar .bb-hint { font-size: 11px; color: #5a7a9a; }
     