*{margin:0;padding:0;box-sizing:border-box}
html{height:100%;overflow-x:hidden}
body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen,Ubuntu,sans-serif;background:#f0f2f5;color:#1f2937;min-height:100vh;overflow-x:hidden}

/* ── Login ───────────────────────────────────────────── */
#login-screen{display:flex;align-items:center;justify-content:center;min-height:100vh;background:#fff}
.login-card{background:#fff;border-radius:12px;padding:40px;width:340px;box-shadow:0 20px 60px rgba(0,0,0,.25);text-align:center}
.login-card h2{margin-bottom:24px;font-size:22px;color:#1f2937}
.login-card input{width:100%;padding:12px 14px;border:1.5px solid #d1d5db;border-radius:8px;font-size:15px;outline:none;transition:border .2s}
.login-card input:focus{border-color:#4f46e5}
.login-card button{width:100%;margin-top:16px;padding:12px;border:none;border-radius:8px;background:#4f46e5;color:#fff;font-size:15px;font-weight:600;cursor:pointer;transition:background .2s}
.login-card button:hover{background:#4338ca}
.login-error{color:#ef4444;font-size:13px;margin-top:10px;min-height:20px}

/* ── Header ──────────────────────────────────────────── */
header{background:#fff;padding:14px 28px;display:flex;align-items:center;justify-content:space-between;box-shadow:0 1px 3px rgba(0,0,0,.08);position:sticky;top:0;z-index:100}
header h1{font-size:19px;font-weight:700;color:#1f2937}
.header-right{display:flex;align-items:center;gap:12px}
.btn-refresh,.btn-logout{padding:7px 16px;border:none;border-radius:6px;font-size:13px;font-weight:600;cursor:pointer;transition:background .15s}
.btn-refresh{background:#e0e7ff;color:#4f46e5}
.btn-refresh:hover{background:#c7d2fe}
.btn-logout{background:#fee2e2;color:#ef4444}
.btn-logout:hover{background:#fecaca}

/* ── Table container ─────────────────────────────────── */
.table-wrap{padding:20px 24px;overflow-x:auto;-webkit-overflow-scrolling:touch}
table{width:100%;border-collapse:collapse;background:#fff;border-radius:8px;overflow:hidden;box-shadow:0 1px 3px rgba(0,0,0,.06)}

/* ── Main device table ───────────────────────────────── */
#dev-table{min-width:1800px;table-layout:fixed}
.dev-table th{background:#f8fafc;color:#475569;font-size:12px;font-weight:700;text-transform:uppercase;letter-spacing:.5px;padding:10px 12px;border-bottom:2px solid #e2e8f0;white-space:nowrap;user-select:none}
.dev-table th.sortable{cursor:pointer}
.dev-table th.sortable:hover{background:#eef2ff}
.dev-table td{padding:9px 12px;border-bottom:1px solid #f1f5f9;font-size:13.5px;vertical-align:middle}
#dev-table th,#dev-table td{overflow:hidden}
#dev-table .dev-col-id{width:54px}
#dev-table .dev-col-type{width:88px}
#dev-table .dev-col-version{width:112px}
#dev-table .dev-col-name{width:130px}
#dev-table .dev-col-device_group{width:126px}
#dev-table .dev-col-trace_stage{width:126px}
#dev-table .dev-col-agent_name{width:126px}
#dev-table .dev-col-token{width:150px}
#dev-table .dev-col-remaining_hours{width:132px}
#dev-table .dev-col-last_heartbeat_at{width:128px}
#dev-table .dev-col-use_count{width:104px}
#dev-table .dev-col-last_used{width:128px}
#dev-table .dev-col-total_cost{width:112px}
#dev-table .dev-col-note{width:172px}
#dev-table .dev-col-_actions{width:84px}
#dev-table .dev-col-_expand{width:44px;text-align:center}
#dev-table .dev-col-type,#dev-table .dev-col-version,#dev-table .dev-col-name,#dev-table .dev-col-last_heartbeat_at,#dev-table .dev-col-use_count,#dev-table .dev-col-last_used,#dev-table .dev-col-total_cost{white-space:nowrap;text-overflow:ellipsis}
.col-token{max-width:120px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
@media(max-width:1100px){.col-token{max-width:80px}}
@media(max-width:900px){.col-token{max-width:56px}}
.dev-table tbody tr.dev-row{cursor:pointer;transition:background .12s}
.dev-table tbody tr.dev-row:hover{background:#f8fafc}
.dev-table tbody tr.dev-row.expanded{background:#eef2ff}
.sort-icon{font-size:11px;margin-left:3px;color:#94a3b8}
th.sorted .sort-icon{color:#4f46e5;font-weight:900}

/* ── Editable cell ───────────────────────────────────── */
.cell-edit{display:inline-flex;align-items:center;gap:5px;cursor:pointer;padding:2px 6px;border-radius:4px;transition:background .12s;max-width:100%;white-space:nowrap}
.cell-edit:hover{background:#e0e7ff}
.cell-edit .cell-text{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.device-note-edit{width:100%}
.edit-icon{width:14px;height:14px;opacity:.55;flex-shrink:0}
.cell-edit:hover .edit-icon{opacity:1}

/* ── Expand toggle ───────────────────────────────────── */
.expand-btn{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;border:none;background:transparent;cursor:pointer;font-size:12px;color:#64748b;transition:transform .2s}
.expand-btn.open{transform:rotate(180deg)}
.index-btn{height:26px;min-width:58px;padding:0 10px;border:none;border-radius:6px;background:#dcfce7;color:#166534;font-size:12px;font-weight:700;cursor:pointer;transition:background .15s,opacity .15s}
.index-btn:hover:not(:disabled){background:#bbf7d0}
.index-btn:disabled{opacity:.55;cursor:default}
.index-btn.busy{background:#e0e7ff;color:#4f46e5}

/* ── Detail / usage row ──────────────────────────────── */
.detail-cell{padding:0!important;background:#f8fafc}
.usage-wrap{padding:10px 18px 14px 40px}
.usage-wrap .no-data{color:#94a3b8;font-size:13px;padding:10px 0}

/* ── Usage table ─────────────────────────────────────── */
.usage-table{width:100%;border-collapse:collapse;border:1px solid #cbd5e1;border-radius:6px;overflow:hidden;background:#fff}
.usage-table th{background:#e2e8f0;color:#334155;font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.4px;padding:7px 10px;border-bottom:1px solid #cbd5e1;white-space:nowrap;user-select:none}
.usage-table th.sortable{cursor:pointer}
.usage-table th.sortable:hover{background:#cbd5e1}
.usage-table td{padding:6px 10px;border-bottom:1px solid #e2e8f0;font-size:12.5px;font-family:'Cascadia Code','Fira Code',monospace}
.timeline-time{display:inline-flex;flex-direction:column;gap:2px;white-space:nowrap;line-height:1.25}
.timeline-utc{color:#64748b;font-size:11px;font-weight:700}
.col-taskid{max-width:140px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.col-ip{max-width:280px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.usage-ip-location{color:#111827}
.usage-ip-location.china{color:#dc2626;font-weight:800}
.col-node{text-transform:uppercase;font-weight:700;color:#334155}
@media(max-width:1100px){.col-taskid{max-width:100px}}
@media(max-width:900px){.col-taskid{max-width:64px}}
.usage-table tbody tr:nth-child(even){background:#f8fafc}
.usage-table .fail-cell{background:#fef2f2;color:#dc2626;font-weight:600}
.usage-table .blocked-cell{background:#fff7ed;color:#c2410c;font-weight:700}
.usage-table tbody tr.usage-row{cursor:pointer;transition:background .12s}
.usage-table tbody tr.usage-row:hover{background:#eef2ff!important}
.usage-table tbody tr.usage-row.usage-expanded{background:#e0e7ff!important}
.acct-doc-table td{height:36px}

/* ── Usage pagination ───────────────────────────────── */
.usage-pagination{display:flex;align-items:center;justify-content:space-between;padding:10px 4px 2px;gap:12px;flex-wrap:wrap}
.pagination-left{display:flex;align-items:center;gap:14px}
.pagination-info{font-size:12px;color:#64748b;font-weight:600}
.pagination-perpage{font-size:12px;color:#64748b;display:flex;align-items:center;gap:5px}
.pagination-perpage select{padding:3px 6px;border:1px solid #cbd5e1;border-radius:4px;font-size:12px;background:#fff;cursor:pointer;outline:none}
.pagination-perpage select:focus{border-color:#4f46e5}
.pagination-right{display:flex;align-items:center;gap:3px}
.pg-btn{min-width:28px;height:28px;padding:0 6px;border:1px solid #cbd5e1;border-radius:4px;background:#fff;font-size:12px;font-weight:600;color:#475569;cursor:pointer;transition:all .12s;line-height:1}
.pg-btn:hover:not(:disabled):not(.pg-active){background:#e0e7ff;border-color:#818cf8;color:#4f46e5}
.pg-btn:disabled{opacity:.4;cursor:default}
.pg-btn.pg-active{background:#4f46e5;color:#fff;border-color:#4f46e5}
.pg-ellipsis{font-size:12px;color:#94a3b8;padding:0 2px}

/* ── History detail (expanded usage row) ─────────────── */
.history-detail-cell{padding:0!important;background:#f1f5f9;border-bottom:2px solid #cbd5e1}
.history-wrap{display:flex;gap:16px;padding:14px 18px;min-height:100px}
.history-loading{color:#94a3b8;font-size:13px;font-style:italic;padding:20px 0;text-align:center;width:100%}
.history-section{display:flex;flex-direction:column;gap:6px;overflow-y:auto;max-height:520px}
.history-section-title{font-size:11px;font-weight:700;text-transform:uppercase;color:#475569;letter-spacing:.4px;margin-bottom:2px;position:sticky;top:0;background:#f1f5f9;padding:2px 0;z-index:1}
.history-images{flex:0 0 210px}
.history-response{flex:1 1 auto;min-width:0}
.history-result{flex:0 0 380px}
.history-img{width:100%;aspect-ratio:4/3;object-fit:contain;background:#e2e8f0;border-radius:4px;border:1px solid #cbd5e1;cursor:pointer;transition:transform .15s}
.history-img.enlarged{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);width:auto;max-width:90vw;max-height:90vh;aspect-ratio:auto;z-index:300;box-shadow:0 20px 60px rgba(0,0,0,.5);border:2px solid #fff}
.img-overlay{display:none;position:fixed;inset:0;background:rgba(0,0,0,.6);z-index:299;cursor:pointer}
.img-overlay.show{display:block}
.history-img-label{font-size:10px;color:#64748b;font-weight:600;margin-top:4px}
.history-empty{color:#94a3b8;font-size:12px;font-style:italic;padding:8px 0}
.history-md{font-size:11.5px;font-family:'Cascadia Code','Fira Code',monospace;white-space:pre-wrap;word-break:break-word;background:#fff;border:1px solid #e2e8f0;border-radius:4px;padding:10px;margin:0;line-height:1.5;overflow-y:auto;max-height:480px}
.history-refs{font-size:11.5px;font-weight:700;letter-spacing:.5px;color:#4338ca;background:#eef2ff;border:1px solid #c7d2fe;border-radius:4px;padding:6px 10px;margin-bottom:6px;word-break:break-word}
.history-refs-empty{color:#94a3b8;background:#f8fafc;border-color:#e2e8f0;font-weight:600}
.history-result-img{width:100%;object-fit:contain;border-radius:4px;border:1px solid #cbd5e1;background:#fff}

/* ── Status badges ───────────────────────────────────── */
.badge{display:inline-flex;align-items:center;justify-content:center;min-height:22px;padding:0 9px;border-radius:999px;font-size:12px;font-weight:800;line-height:1;letter-spacing:0;white-space:nowrap}
.badge-active{background:#dcfce7;color:#166534}
.badge-expired,.badge-disabled{background:#fee2e2;color:#991b1b}
.badge-forever{background:#dbeafe;color:#1e40af}
.badge-pending{background:#fef3c7;color:#92400e}
.approval-inline-actions{display:inline-flex;align-items:center;gap:6px;vertical-align:middle}

/* ── Modal ───────────────────────────────────────────── */
.modal-overlay{display:none;position:fixed;inset:0;background:rgba(0,0,0,.4);z-index:200;align-items:center;justify-content:center}
.modal-overlay.show{display:flex}
.modal{background:#fff;border-radius:12px;padding:28px;width:380px;max-width:92vw;box-shadow:0 20px 60px rgba(0,0,0,.25)}
.modal h3{margin-bottom:18px;font-size:17px;color:#1f2937}
.modal-body{margin-bottom:20px}
.modal-footer{display:flex;justify-content:flex-end;gap:10px}
.btn-set,.btn-cancel{padding:8px 22px;border:none;border-radius:6px;font-size:14px;font-weight:600;cursor:pointer;transition:background .15s}
.btn-set{background:#bbf7d0;color:#166534}
.btn-set:hover{background:#86efac}
.btn-set:disabled{opacity:.5;cursor:not-allowed}
.btn-cancel{background:#fecaca;color:#991b1b}
.btn-cancel:hover{background:#fca5a5}

/* ── Radio group ─────────────────────────────────────── */
.radio-group{display:flex;flex-direction:column;gap:10px}
.radio-group label{display:flex;align-items:center;gap:8px;cursor:pointer;font-size:14px;padding:8px 10px;border-radius:6px;transition:background .1s}
.radio-group label:hover{background:#f1f5f9}
.radio-group input[type=radio]{accent-color:#4f46e5;width:16px;height:16px}
.custom-hours-input{width:80px;padding:5px 8px;border:1.5px solid #d1d5db;border-radius:6px;font-size:14px;margin-left:4px}
.custom-hours-input:focus{outline:none;border-color:#4f46e5}
.balance-preview{margin-top:12px;border:1px solid #cbd5e1;border-radius:8px;background:#f8fafc;overflow:hidden}
.balance-preview-row{display:grid;grid-template-columns:70px 1fr 1fr 1fr;gap:8px;align-items:center;padding:8px 10px;border-bottom:1px solid #e2e8f0;font-size:12.5px}
.balance-preview-row:last-child{border-bottom:none}
.balance-preview-row strong{font-size:12px;color:#334155}
.balance-preview-row span{font-family:'Cascadia Code','Fira Code',monospace;color:#1f2937}
.balance-preview .delta-pos{color:#166534;font-weight:700}
.balance-preview .delta-neg{color:#991b1b;font-weight:700}
.balance-preview-error{padding:8px 10px;background:#fef2f2;color:#991b1b;font-size:12.5px;font-weight:700;border-top:1px solid #fecaca}

/* ── Note textarea ───────────────────────────────────── */
.note-textarea{width:100%;min-height:100px;padding:10px;border:1.5px solid #d1d5db;border-radius:8px;font-size:14px;font-family:inherit;resize:vertical}
.note-textarea:focus{outline:none;border-color:#4f46e5}

/* ── Dashboard ────────────────────────────────────────── */
.dashboard{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:16px;padding:20px 24px 0;min-width:0}
@media(max-width:1350px){.dashboard{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(max-width:980px){.dashboard{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:720px){.dashboard{grid-template-columns:1fr}}
.dash-card{background:#fff;border-radius:8px;box-shadow:0 1px 3px rgba(0,0,0,.06);padding:16px;overflow:hidden;min-height:0}
.dash-card h3{font-size:12px;font-weight:700;text-transform:uppercase;letter-spacing:.5px;color:#475569;margin-bottom:10px}
.node-stat{display:flex;flex-wrap:wrap;gap:4px 14px;padding:8px 0;border-bottom:1px solid #f1f5f9}
.node-stat:last-child{border-bottom:none}
.node-stat-name{font-size:12px;font-weight:700;color:#1f2937;width:100%;margin-bottom:2px}
.node-stat-item{font-size:11px;color:#64748b}
.node-stat-item span{font-weight:600;color:#1f2937}
.node-stat-error{font-size:12px;color:#ef4444;font-weight:600}
.load-chart-wrap{position:relative;width:100%;height:200px}
.load-chart-wrap svg{width:100%;height:100%}
.logs-panel{max-height:220px;overflow-y:auto;font-family:'Cascadia Code','Fira Code',monospace;font-size:10px;line-height:1.5;background:#0f172a;color:#e2e8f0;border-radius:6px;padding:10px;white-space:pre-wrap;word-break:break-all}
.logs-node-label{font-size:10px;font-weight:700;color:#38bdf8;display:block;margin-top:6px}
.logs-node-label:first-child{margin-top:0}
.logs-tabs{display:flex;gap:0;margin-top:12px}
.log-tab{padding:5px 12px;border:none;background:#1e293b;color:#94a3b8;font-size:10px;font-weight:700;text-transform:uppercase;letter-spacing:.4px;cursor:pointer;transition:all .15s;border-radius:4px 4px 0 0}
.log-tab.active{background:#0f172a;color:#38bdf8}
.log-tab:hover:not(.active){color:#e2e8f0}
.deploy-run{margin-bottom:8px;padding-bottom:8px;border-bottom:1px solid #1e293b}
.deploy-run:last-child{border-bottom:none;margin-bottom:0;padding-bottom:0}
.deploy-run-header{display:flex;gap:8px;align-items:center;margin-bottom:2px}
.deploy-run-action{font-weight:700;text-transform:uppercase;color:#38bdf8}
.deploy-run-time{color:#64748b}
.deploy-run-status{font-weight:700}
.deploy-run-status.ok{color:#4ade80}
.deploy-run-status.failed{color:#f87171}
.deploy-run-status.running{color:#facc15}
.deploy-run-output{font-size:9px;color:#94a3b8;white-space:pre-wrap;word-break:break-all;max-height:80px;overflow-y:auto;margin-top:2px;padding-left:8px;border-left:2px solid #1e293b}
.dash-sub-title{font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.5px;color:#475569;margin:12px 0 6px}
.dash-sub-title:first-of-type{margin-top:8px}
.node-status-mini{display:flex;flex-wrap:wrap;gap:4px 12px;margin-bottom:4px;font-size:11px;color:#64748b}
.node-status-mini strong{font-weight:700;color:#1f2937}
.node-status-mini .status-error{color:#ef4444;font-weight:600}

/* ── Section labels ──────────────────────────────────── */
.section-label{font-size:13px;font-weight:800;text-transform:uppercase;letter-spacing:1.5px;color:#475569;margin-bottom:12px;padding-left:2px}

/* ── Toast notification ──────────────────────────────── */
.toast{position:fixed;bottom:24px;left:50%;transform:translateX(-50%) translateY(20px);background:#1f2937;color:#fff;padding:8px 20px;border-radius:8px;font-size:13px;font-weight:600;opacity:0;transition:opacity .25s,transform .25s;pointer-events:none;z-index:400;box-shadow:0 4px 16px rgba(0,0,0,.18)}
.toast.show{opacity:1;transform:translateX(-50%) translateY(0)}

/* ── Copyable cell ──────────────────────────────────── */
.cell-copy{display:inline-flex;align-items:center;gap:5px;cursor:pointer;padding:2px 6px;border-radius:4px;transition:background .12s;max-width:100%}
.cell-copy:hover{background:#e0e7ff}
.cell-copy .copy-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.copy-icon{width:14px;height:14px;opacity:0;flex-shrink:0;transition:opacity .12s}
.cell-copy:hover .copy-icon{opacity:.7}

/* ── Deploy / header buttons ─────────────────────────── */
.btn-restart,.btn-update{padding:7px 16px;border:none;border-radius:6px;font-size:13px;font-weight:600;cursor:pointer;transition:background .15s}
.btn-restart{background:#dcfce7;color:#166534}
.btn-restart:hover{background:#bbf7d0}
.btn-update{background:#fef3c7;color:#92400e}
.btn-update:hover{background:#fde68a}
.deploy-result{margin:6px 0;padding:8px 10px;border-radius:6px;font-size:12px;font-family:'Cascadia Code','Fira Code',monospace;line-height:1.4}
.deploy-result.success{background:#dcfce7;color:#166534}
.deploy-result.error{background:#fee2e2;color:#991b1b}
.deploy-result.pending{background:#e0e7ff;color:#4f46e5}
.deploy-output{margin-top:4px;font-size:10px;opacity:.85;white-space:pre-wrap;max-height:120px;overflow-y:auto}

/* ── Top tabs / management surfaces ─────────────────── */
.top-tabs{display:flex;align-items:center;gap:6px;margin:0 18px;flex:1 1 auto;min-width:0;overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch;scrollbar-width:none}
.top-tabs::-webkit-scrollbar{display:none}
.tab-btn{height:32px;padding:0 12px;border:1px solid transparent;border-radius:6px;background:transparent;color:#64748b;font-size:13px;font-weight:700;cursor:pointer;transition:all .15s;white-space:nowrap;flex:0 0 auto}
.tab-btn{position:relative}
.tab-btn:hover{background:#f1f5f9;color:#1f2937}
.tab-btn.active{background:#eef2ff;border-color:#c7d2fe;color:#4f46e5}
.tab-badge{display:none;position:absolute;top:-7px;right:-7px;min-width:18px;height:18px;padding:0 5px;border-radius:999px;background:#ef4444;color:#fff;font-size:10px;font-weight:800;line-height:18px;text-align:center;box-shadow:0 0 0 2px #fff}
.tab-badge.show{display:block}
.tab-badge.blue-dot{min-width:10px;width:10px;height:10px;padding:0;top:-3px;right:-3px;background:#2563eb;color:transparent;line-height:10px}
.tab-panel{display:none}
.tab-panel.active{display:block}
.table-empty{padding:24px;text-align:center;color:#94a3b8;font-size:13px;background:#fff;border-radius:8px}
.toolbar{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:20px 24px 0}
.toolbar-title{font-size:13px;font-weight:800;text-transform:uppercase;letter-spacing:1.5px;color:#475569}
.btn-primary{height:32px;padding:0 14px;border:none;border-radius:6px;background:#4f46e5;color:#fff;font-size:13px;font-weight:700;cursor:pointer}
.btn-primary:hover{background:#4338ca}
.btn-secondary{height:32px;padding:0 14px;border:1px solid #c7d2fe;border-radius:6px;background:#eef2ff;color:#3730a3;font-size:13px;font-weight:800;cursor:pointer}
.btn-secondary:hover{background:#e0e7ff;border-color:#818cf8}
.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.form-grid label{display:flex;flex-direction:column;gap:5px;font-size:12px;font-weight:700;color:#475569}
.form-grid input,.form-grid select,.form-grid textarea{width:100%;padding:8px 10px;border:1.5px solid #d1d5db;border-radius:6px;font-size:14px;font-family:inherit;outline:none;background:#fff}
.form-grid textarea{min-height:72px;resize:vertical}
.form-grid input:focus,.form-grid select:focus,.form-grid textarea:focus{border-color:#4f46e5}
.form-grid .span-2{grid-column:1/-1}
.modal-field{display:flex;flex-direction:column;gap:5px;margin-top:12px;font-size:12px;font-weight:700;color:#475569}
.modal-field textarea{width:100%;min-height:72px;padding:8px 10px;border:1.5px solid #d1d5db;border-radius:6px;font-size:14px;font-family:inherit;outline:none;resize:vertical;background:#fff}
.modal-field textarea:focus{border-color:#4f46e5}
.check-row{display:flex!important;flex-direction:row!important;align-items:center;gap:8px!important}
.check-row input{width:auto}
.select-input{width:100%;padding:9px 10px;border:1.5px solid #d1d5db;border-radius:6px;font-size:14px;background:#fff}
.agent-picker{position:relative;width:100%}
.agent-picker-select{display:none}
.agent-picker-button{width:100%;height:40px;padding:0 10px;border:1.5px solid #d1d5db;border-radius:6px;background:#fff;color:#1f2937;font-size:14px;font-family:inherit;text-align:left;display:flex;align-items:center;justify-content:space-between;gap:10px;cursor:pointer}
.agent-picker-button:focus{outline:none;border-color:#4f46e5}
.agent-picker-label{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.agent-picker-caret{width:0;height:0;border-left:5px solid transparent;border-right:5px solid transparent;border-top:6px solid #64748b;flex-shrink:0;transition:transform .12s}
.agent-picker.open .agent-picker-caret{transform:rotate(180deg)}
.agent-picker-menu{display:none;position:absolute;left:0;right:0;top:calc(100% + 6px);max-height:min(320px,42vh);overflow-y:auto;background:#fff;border:1px solid #cbd5e1;border-radius:8px;box-shadow:0 16px 36px rgba(15,23,42,.18);z-index:450;padding:4px}
.agent-picker.open .agent-picker-menu{display:block}
.agent-picker-option{width:100%;min-height:34px;padding:7px 10px;border:none;border-radius:6px;background:transparent;color:#1f2937;font-size:13px;font-family:inherit;text-align:left;cursor:pointer;display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.agent-picker-option:hover,.agent-picker-option:focus{outline:none;background:#eef2ff;color:#4338ca}
.agent-picker-option.is-selected{background:#e0e7ff;color:#3730a3;font-weight:700}

/* ── Chat ────────────────────────────────────────────── */
#panel-chat.active{height:calc(var(--app-vh,100vh) - var(--header-h,61px));height:calc(var(--app-vh,100dvh) - var(--header-h,61px));min-height:0;overflow:hidden}
.chat-shell{display:grid;grid-template-columns:320px minmax(0,1fr);height:100%;min-height:0;background:#fff}
.chat-list-pane{border-right:1px solid #e2e8f0;background:#f8fafc;display:flex;flex-direction:column;min-width:0;min-height:0}
.chat-list-head{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:16px 16px 12px;border-bottom:1px solid #e2e8f0}
.chat-list-title{font-size:13px;font-weight:800;text-transform:uppercase;letter-spacing:1.1px;color:#475569}
.chat-list-actions{display:flex;align-items:center;gap:8px;flex-shrink:0}
.chat-clear-empty-btn{height:28px;padding:0 9px;border:1px solid #fecaca;border-radius:7px;background:#fff;color:#991b1b;font-size:12px;font-weight:800;cursor:pointer;white-space:nowrap}
.chat-clear-empty-btn:hover:not(:disabled){background:#fef2f2}
.chat-clear-empty-btn:disabled{opacity:.55;cursor:default}
.chat-list-count{font-size:12px;font-weight:700;color:#94a3b8}
.chat-list{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;touch-action:pan-y;padding:8px}
.chat-list-empty{padding:24px 16px;color:#94a3b8;font-size:13px;text-align:center}
.chat-group{margin:3px 0 7px}
.chat-group-toggle{width:100%;min-height:34px;border:none;border-radius:7px;background:transparent;color:#334155;display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:8px;align-items:center;padding:7px 8px;text-align:left;cursor:pointer}
.chat-group-toggle:hover{background:#e2e8f0}
.chat-group-caret{width:0;height:0;border-top:5px solid transparent;border-bottom:5px solid transparent;border-left:6px solid #64748b;transition:transform .12s}
.chat-group.expanded .chat-group-caret{transform:rotate(90deg)}
.chat-group-name{font-size:12px;font-weight:800;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#475569}
.chat-group-count{display:flex;align-items:center;gap:6px;font-size:11px;font-weight:800;color:#94a3b8}
.chat-group-items{display:none;margin-top:2px;padding-right:2px}
.chat-group.expanded .chat-group-items{display:block}
.chat-agent-items{display:block}
.chat-item{position:relative;width:100%;min-height:56px;display:grid;grid-template-columns:10px minmax(0,1fr) auto;gap:9px;align-items:start;padding:11px 10px;border:none;border-radius:8px;background:transparent;color:#1f2937;text-align:left;cursor:pointer}
.chat-item:hover{background:#eef2ff}
.chat-item:focus-visible{outline:2px solid #a5b4fc;outline-offset:2px}
.chat-item.active{background:#e0e7ff}
.chat-status-dot{width:9px;height:9px;border-radius:50%;margin-top:5px;background:#cbd5e1}
.chat-item.online .chat-status-dot{background:#22c55e;box-shadow:0 0 0 3px rgba(34,197,94,.14)}
.chat-item.offline{color:#94a3b8}
.chat-item-main{min-width:0}
.chat-item-title{display:flex;align-items:center;gap:7px;min-width:0}
.chat-item-name{font-size:13px;font-weight:800;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:inherit}
.chat-lang{flex:0 0 auto;padding:1px 5px;border-radius:999px;background:#ecfeff;color:#155e75;font-size:10px;font-weight:800}
.chat-item-meta{margin-top:3px;font-size:11px;color:#64748b;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.chat-item.offline .chat-item-meta{color:#94a3b8}
.chat-item-alerts{display:flex;align-items:center;gap:5px;margin-top:2px}
.chat-item-delete{width:22px;height:22px;border:0;border-radius:6px;background:transparent;color:#ef4444;font-size:16px;font-weight:900;line-height:1;cursor:pointer}
.chat-item-delete:hover{background:#fee2e2;color:#991b1b}
.chat-unread{display:none;min-width:19px;height:19px;padding:0 6px;border-radius:999px;background:#ef4444;color:#fff;font-size:11px;font-weight:800;line-height:19px;text-align:center}
.chat-unread.show{display:inline-block}
.chat-ai-dot{display:none;width:9px;height:9px;border-radius:999px;background:#2563eb;box-shadow:0 0 0 3px rgba(37,99,235,.14)}
.chat-ai-dot.show{display:inline-block}
.chat-item.human-requested .chat-item-name::after{content:"人工";display:inline-block;margin-left:6px;padding:1px 5px;border-radius:999px;background:#fee2e2;color:#991b1b;font-size:10px;font-weight:800;vertical-align:1px}
.chat-main{display:grid;grid-template-rows:auto minmax(0,1fr) auto;min-width:0;min-height:0;background:#fff}
.chat-main-head{min-height:58px;padding:12px 18px;border-bottom:1px solid #e2e8f0;display:flex;align-items:center;justify-content:space-between;gap:14px}
.chat-peer-title{font-size:15px;font-weight:800;color:#1f2937}
.chat-peer-sub{margin-top:2px;font-size:12px;color:#64748b}
.chat-peer-note{display:none;margin-top:3px;max-width:min(640px,58vw);font-size:12px;color:#92400e;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.chat-peer-note.show{display:block}
.chat-head-actions{display:flex;align-items:center;gap:9px;flex-shrink:0}
.chat-mode-btn,.chat-note-btn,.chat-delete-btn{height:32px;padding:0 11px;border:1px solid #cbd5e1;border-radius:7px;background:#fff;color:#334155;font-size:12px;font-weight:800;cursor:pointer;white-space:nowrap}
.chat-mode-btn:hover:not(:disabled),.chat-note-btn:hover:not(:disabled){background:#eef2ff;border-color:#a5b4fc;color:#3730a3}
.chat-mode-btn.human{background:#fef2f2;border-color:#fecaca;color:#991b1b}
.chat-mode-btn.ai{background:#eff6ff;border-color:#bfdbfe;color:#1d4ed8}
.chat-note-btn.has-note{background:#fffbeb;border-color:#fde68a;color:#92400e}
.chat-delete-btn{border-color:#fecaca;background:#fff;color:#991b1b}
.chat-delete-btn:hover:not(:disabled){background:#fef2f2}
.chat-mode-btn:disabled,.chat-note-btn:disabled,.chat-delete-btn:disabled{opacity:.55;cursor:default}
.chat-online-label{font-size:12px;font-weight:800;color:#94a3b8}
.chat-online-label.online{color:#16a34a}
.chat-messages{min-height:0;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;touch-action:pan-y;padding:18px;background:linear-gradient(#fff,#f8fafc)}
.chat-empty-state{height:100%;display:flex;align-items:center;justify-content:center;color:#94a3b8;font-size:13px}
.chat-row{display:flex;margin:8px 0}
.chat-row.in{justify-content:flex-start}
.chat-row.out{justify-content:flex-end}
.chat-bubble{max-width:min(620px,74%);padding:9px 11px;border-radius:8px;background:#eef2ff;color:#1f2937;box-shadow:0 1px 2px rgba(15,23,42,.06);overflow:hidden}
.chat-row.in .chat-bubble{background:#fff;border:1px solid #e2e8f0}
.chat-row.out .chat-bubble{background:#4f46e5;color:#fff}
.chat-bubble-meta{font-size:10px;font-weight:800;text-transform:uppercase;letter-spacing:.3px;opacity:.65;margin-bottom:4px}
.chat-bubble-text{font-size:13px;line-height:1.45;white-space:pre-wrap;overflow-wrap:anywhere}
.chat-media{display:block;margin-top:7px;max-width:100%;border-radius:6px;background:#0f172a}
.chat-media.image{max-height:320px;object-fit:contain}
.chat-media.video{max-height:320px}
.chat-composer{border-top:1px solid #e2e8f0;padding:12px 14px;background:#fff}
.chat-composer-row{display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:9px;align-items:end}
.chat-file-btn{height:38px;min-width:38px;border:1px solid #cbd5e1;border-radius:7px;background:#fff;color:#475569;font-size:18px;font-weight:800;cursor:pointer}
.chat-file-btn:hover{background:#f1f5f9}
.chat-input{width:100%;min-height:38px;max-height:108px;padding:9px 11px;border:1.5px solid #cbd5e1;border-radius:7px;font-size:13px;font-family:inherit;resize:vertical;outline:none}
.chat-input:focus{border-color:#4f46e5}
.chat-send-btn{height:38px;padding:0 15px;border:none;border-radius:7px;background:#4f46e5;color:#fff;font-size:13px;font-weight:800;cursor:pointer}
.chat-send-btn:disabled{opacity:.55;cursor:default}
.chat-file-note{display:none;margin:7px 0 0 48px;font-size:12px;color:#64748b}
.chat-file-note.show{display:block}
@media(max-width:700px){
  .chat-shell{grid-template-columns:1fr;grid-template-rows:clamp(180px,32dvh,280px) minmax(0,1fr);height:100%;min-height:0}
  .chat-list-pane{border-right:0;border-bottom:1px solid #e2e8f0;max-height:none}
  .chat-main{min-height:0}
  .chat-bubble{max-width:88%}
}

@media(max-width:900px){
  header{flex-wrap:wrap;align-items:center;justify-content:flex-start;padding:10px 12px;gap:8px 10px}
  header h1{font-size:18px;line-height:32px;flex:1 1 auto;order:1}
  .header-right{order:2;gap:8px;margin-left:auto}
  .btn-refresh,.btn-logout,.btn-restart,.btn-update{height:32px;padding:0 12px;font-size:12px;white-space:nowrap}
  .top-tabs{order:3;flex:1 0 100%;width:100%;margin:0;padding-bottom:2px}
  .tab-btn{height:34px;padding:0 11px;font-size:13px}
}

@media(max-width:520px){
  header{padding:8px 10px;gap:7px}
  header h1{font-size:17px;line-height:30px}
  .header-right{gap:6px}
  .btn-refresh,.btn-logout,.btn-restart,.btn-update{height:30px;padding:0 10px}
  .tab-btn{height:32px;padding:0 10px}
  .chat-list-head{padding:12px 12px 9px}
  .chat-list{padding:6px}
  .chat-main-head{min-height:54px;padding:10px 12px}
  .chat-composer{padding:10px}
  .chat-composer-row{grid-template-columns:38px minmax(0,1fr) 56px;gap:8px}
  .chat-send-btn{padding:0 12px}
  .chat-messages{padding:12px}
  .chat-bubble{max-width:92%}
  .table-wrap,.toolbar,.dashboard,.agent-summary,.ai-settings,.region-settings{padding-left:12px;padding-right:12px}
  .dev-table,.usage-table,.acct-doc-table{min-width:760px}
}

/* ── AI customer service ─────────────────────────────── */
.ai-settings{padding:20px 24px;max-width:1040px}
.ai-panel{background:#fff;border:1px solid #e2e8f0;border-radius:8px;box-shadow:0 1px 3px rgba(0,0,0,.06);overflow:hidden}
.ai-panel-head{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:16px 18px;border-bottom:1px solid #e2e8f0}
.ai-panel-title{font-size:14px;font-weight:800;color:#1f2937}
.ai-panel-meta{margin-top:3px;font-size:12px;color:#64748b}
.ai-actions{display:flex;align-items:center;gap:10px}
.ai-body{padding:16px 18px 18px}
.ai-field{display:flex;flex-direction:column;gap:8px}
.ai-field label{font-size:12px;font-weight:800;color:#475569}
.ai-prompt{width:100%;min-height:340px;height:calc(100vh - 270px);max-height:680px;padding:12px;border:1.5px solid #d1d5db;border-radius:8px;font-size:13px;font-family:'Cascadia Code','Fira Code',monospace;line-height:1.55;resize:vertical;outline:none;background:#fff;color:#0f172a}
.ai-prompt:focus{border-color:#4f46e5;box-shadow:0 0 0 3px rgba(79,70,229,.12)}
.ai-toggle{display:inline-flex;align-items:center;gap:8px;font-size:13px;font-weight:800;color:#334155;cursor:pointer;white-space:nowrap;user-select:none}
.ai-toggle-input{position:absolute;opacity:0;pointer-events:none}
.ai-toggle-track{position:relative;width:46px;height:26px;border-radius:999px;background:#cbd5e1;box-shadow:inset 0 0 0 1px rgba(15,23,42,.06);transition:background .16s}
.ai-toggle-track::after{content:"";position:absolute;top:3px;left:3px;width:20px;height:20px;border-radius:50%;background:#fff;box-shadow:0 1px 4px rgba(15,23,42,.24);transition:transform .16s}
.ai-toggle-input:checked + .ai-toggle-track{background:#4f46e5}
.ai-toggle-input:checked + .ai-toggle-track::after{transform:translateX(20px)}
.ai-toggle-input:focus-visible + .ai-toggle-track{outline:3px solid rgba(79,70,229,.22);outline-offset:2px}
.ai-save-state{min-width:56px;font-size:12px;font-weight:800;color:#64748b;text-align:right}
.ai-save-state.dirty{color:#92400e}
.ai-save-state.saved{color:#166534}
.ai-save-state.error{color:#991b1b}

/* ── Regional policy ─────────────────────────────────── */
.region-settings{padding:20px 24px;max-width:1120px}
.region-panel{background:#fff;border:1px solid #e2e8f0;border-radius:8px;box-shadow:0 1px 3px rgba(0,0,0,.06);overflow:hidden}
.region-panel-head{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:16px 18px;border-bottom:1px solid #e2e8f0}
.region-panel-title{font-size:14px;font-weight:800;color:#1f2937}
.region-panel-meta{margin-top:3px;font-size:12px;color:#64748b}
.region-actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap;justify-content:flex-end}
.region-body{padding:16px 18px 18px;display:grid;gap:14px}
.region-form{display:grid;grid-template-columns:minmax(180px,260px) minmax(220px,1fr) auto;gap:12px;align-items:end}
.region-table{min-width:760px}
.region-table th,.region-table td{font-size:13px}
.region-table .region-missing td{color:#94a3b8}
.region-rule-row td{background:#eef2ff;color:#334155;font-weight:700}
.region-rule-row td:nth-child(4){font-weight:600;color:#475569}
.region-rule-row.region-rule-off td{background:#f8fafc;color:#94a3b8}
@media(max-width:760px){.region-panel-head{align-items:flex-start;flex-direction:column}.region-form{grid-template-columns:1fr}.region-actions{justify-content:flex-start}}

/* ── Home image editor ───────────────────────────────── */
.home-image-settings{padding:20px 24px;display:grid;grid-template-columns:minmax(320px,520px) minmax(280px,420px);gap:18px;align-items:start}
.home-image-panel{background:#fff;border:1px solid #e2e8f0;border-radius:8px;box-shadow:0 1px 3px rgba(0,0,0,.06);overflow:hidden}
.home-image-head{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:14px 16px;border-bottom:1px solid #e2e8f0}
.home-image-title{font-size:14px;font-weight:800;color:#1f2937}
.home-image-state{font-size:12px;font-weight:800;color:#64748b}
.home-image-body{padding:16px}
.home-image-stage{position:relative;width:min(100%,360px);margin:0 auto;container-type:inline-size;touch-action:none}
.home-image-stage img{display:block;width:100%;height:auto;border-radius:8px;border:1px solid #cbd5e1;background:#f8fafc}
.home-image-text{position:absolute;left:var(--x);top:var(--y);max-width:90%;padding:2px 4px;border:1px dashed transparent;border-radius:3px;background:transparent;color:var(--c);font-family:var(--ff);font-size:var(--fs);font-weight:700;line-height:1.05;white-space:pre-wrap;text-align:left;cursor:move;user-select:none;touch-action:none}
.home-image-text:hover,.home-image-text.active{border-color:#4f46e5;background:rgba(238,242,255,.72)}
.home-image-toolbar{display:flex;gap:8px;flex-wrap:wrap;margin-top:14px}
.home-image-form{display:grid;gap:12px}
.home-image-field{display:flex;flex-direction:column;gap:6px;font-size:12px;font-weight:800;color:#475569}
.home-image-field input,.home-image-field select,.home-image-field textarea{width:100%;padding:8px 10px;border:1.5px solid #d1d5db;border-radius:6px;font-size:14px;font-family:inherit;background:#fff;outline:none}
.home-image-field textarea{min-height:76px;resize:vertical}
.home-image-field input:focus,.home-image-field select:focus,.home-image-field textarea:focus{border-color:#4f46e5}
.home-image-color-row{display:flex;gap:8px}
.home-image-color{height:34px;min-width:82px;border:2px solid #d1d5db;border-radius:6px;background:var(--swatch);cursor:pointer;font-size:0}
.home-image-color.active{border-color:#4f46e5;box-shadow:0 0 0 3px rgba(79,70,229,.14)}
.home-image-empty{color:#94a3b8;font-size:13px;text-align:center;padding:28px 12px}
.btn-danger{height:32px;padding:0 14px;border:none;border-radius:6px;background:#fee2e2;color:#991b1b;font-size:13px;font-weight:700;cursor:pointer}
.btn-danger:hover{background:#fecaca}
@media(max-width:940px){.home-image-settings{grid-template-columns:1fr}.home-image-stage{width:min(100%,320px)}}

.agent-summary{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;padding:20px 24px 0}
@media(max-width:1100px){.agent-summary{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:700px){.agent-summary{grid-template-columns:1fr}}
.summary-card{background:#fff;border-radius:8px;box-shadow:0 1px 3px rgba(0,0,0,.06);padding:16px}
.summary-label{font-size:11px;font-weight:800;text-transform:uppercase;letter-spacing:.6px;color:#64748b;margin-bottom:6px}
.summary-value{font-size:20px;font-weight:800;color:#1f2937}
.summary-small{font-size:12px;color:#64748b;margin-top:4px}
.pricing-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px;padding:16px 24px 0}
@media(max-width:980px){.pricing-grid{grid-template-columns:1fr}}
.price-card{background:#fff;border-radius:8px;box-shadow:0 1px 3px rgba(0,0,0,.06);padding:16px}
.price-card h3{font-size:13px;color:#1f2937;margin-bottom:10px}
.price-row{display:flex;justify-content:space-between;gap:10px;padding:6px 0;border-bottom:1px solid #f1f5f9;font-size:13px}
.price-row:last-child{border-bottom:none}
.price-row span:first-child{color:#64748b}
.price-row strong{color:#1f2937}
.agent-actions{display:flex;gap:8px;justify-content:flex-end;align-items:center;white-space:nowrap}
.agent-device-note{max-width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.agent-time-btn{height:28px;min-width:74px;padding:0 9px;border:1px solid #c7d2fe;border-radius:6px;background:#eef2ff;color:#3730a3;font-size:12px;font-weight:800;cursor:pointer}
.agent-time-btn:hover{background:#e0e7ff;border-color:#818cf8;color:#312e81}
.agent-time-btn.open{background:#e0e7ff;border-color:#818cf8;color:#312e81}
#agent-table .agent-main-row{cursor:pointer;transition:background .12s}
#agent-table .agent-main-row:hover{background:#f8fafc}
#agent-table .agent-main-row.open{background:#eef2ff}
.agent-ledger-modal{width:min(1040px,94vw)}
.agent-ledger-summary{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap;margin-bottom:10px;color:#475569;font-size:13px;font-weight:700}
.agent-ledger-current{display:inline-flex;align-items:center;justify-content:center;height:28px;padding:0 10px;border-radius:6px;background:#eef2ff;color:#3730a3;font-size:12px;font-weight:800}
.agent-ledger-table-wrap{max-height:min(58vh,520px);overflow:auto;border:1px solid #e2e8f0;border-radius:8px}
.agent-ledger-table{min-width:1080px;border:0;box-shadow:none}
.agent-ledger-table th,.agent-ledger-table td{font-size:12.5px;vertical-align:top}
.agent-time-ledger-wrap{overflow-x:auto}
.agent-time-ledger-table{min-width:920px}
.agent-time-ledger-table th,.agent-time-ledger-table td{font-size:12.5px;vertical-align:top}
.agent-own-ledger-summary{grid-template-columns:repeat(3,minmax(0,1fr))}
.agent-ledger-subhead{display:flex;align-items:center;justify-content:space-between;gap:10px;margin:0 0 8px;flex-wrap:wrap}
.agent-ledger-subtable{min-width:1080px}
.agent-ledger-time,.agent-ledger-op,.agent-ledger-value{white-space:nowrap;font-family:'Cascadia Code','Fira Code',monospace}
.agent-ledger-target{max-width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.agent-ledger-note{max-width:240px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tree-name{display:flex;align-items:center;gap:6px;min-width:0}
.tree-indent{display:inline-block;width:calc(var(--depth,0) * 18px);flex:0 0 auto}
.tree-branch{color:#cbd5e1;font-weight:800;flex:0 0 auto}
.tree-main{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.tree-muted{color:#94a3b8;font-size:11px;font-weight:700}
.mini-btn{height:26px;padding:0 10px;border:none;border-radius:6px;background:#e0e7ff;color:#4f46e5;font-size:12px;font-weight:700;cursor:pointer;white-space:nowrap}
.mini-btn:hover{background:#c7d2fe}
.mini-btn.danger{background:#fee2e2;color:#991b1b}
.mini-btn.danger:hover{background:#fecaca}
.danger-text{font-size:13px;line-height:1.55;color:#475569}
.danger-warning{margin-top:10px;padding:9px 10px;border:1px solid #fecaca;border-radius:7px;background:#fef2f2;color:#991b1b;font-size:12px;font-weight:700}
.badge-agent{background:#ecfeff;color:#155e75;max-width:92px;overflow:hidden;text-overflow:ellipsis}
.badge-group-unsold{background:#f1f5f9;color:#334155}
.badge-group-test{background:#fef3c7;color:#92400e}
.badge-group-sales{background:#ede9fe;color:#5b21b6}
.badge-group-damaged{background:#fee2e2;color:#991b1b}
.device-search-bar{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin:0 0 12px}
.device-search-input{height:34px;min-width:260px;max-width:520px;flex:1;border:1px solid #d1d5db;border-radius:6px;background:#fff;color:#0f172a;font-size:13px;padding:0 11px}
.device-search-input:focus{outline:none;border-color:#818cf8;box-shadow:0 0 0 3px rgba(129,140,248,.18)}
.device-search-clear{display:none;align-items:center}
.device-search-clear.show{display:inline-flex}
.device-search-count{font-size:12px;font-weight:700;color:#64748b}
@media(max-width:640px){.device-search-bar{align-items:stretch}.device-search-input{min-width:0;max-width:none;flex-basis:100%}.device-search-count{line-height:26px}}
.device-group-bar{display:flex;flex-direction:column;gap:10px;margin:0 0 14px}
.device-group-row{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.device-group-label{font-size:11px;font-weight:800;text-transform:uppercase;letter-spacing:.6px;color:#64748b;margin-right:2px}
.group-chip{height:30px;padding:0 10px;border:1px solid #d1d5db;border-radius:6px;background:#fff;color:#475569;font-size:12px;font-weight:700;cursor:pointer;display:inline-flex;align-items:center;gap:6px;transition:all .15s}
.group-chip:hover{background:#f8fafc;border-color:#a5b4fc;color:#4338ca}
.group-chip.active{background:#eef2ff;border-color:#818cf8;color:#3730a3}
.group-chip-count{font-family:'Cascadia Code','Fira Code',monospace;font-size:11px;color:#64748b}
.group-chip.active .group-chip-count{color:#4338ca}
.traffic-range{display:flex;gap:6px;flex-wrap:wrap}
.range-btn{height:30px;padding:0 10px;border:1px solid #d1d5db;border-radius:6px;background:#fff;color:#475569;font-size:12px;font-weight:700;cursor:pointer}
.range-btn:hover{background:#f8fafc;border-color:#a5b4fc;color:#4338ca}
.range-btn.active{background:#eef2ff;border-color:#818cf8;color:#3730a3}
.admin-audit-wrap{overflow-x:auto}
.audit-toolbar{display:flex;align-items:center;justify-content:space-between;gap:14px;margin-bottom:12px;flex-wrap:wrap}
.audit-date-controls{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.audit-date-input{height:30px;border:1px solid #d1d5db;border-radius:6px;background:#fff;color:#0f172a;font-size:13px;font-weight:700;padding:0 10px;outline:none}
.audit-date-input:focus{border-color:#818cf8;box-shadow:0 0 0 3px rgba(129,140,248,.18)}
.audit-filter-controls{display:flex;gap:12px;align-items:flex-start;flex-wrap:wrap;margin:0 0 12px}
.audit-filter{display:flex;flex-direction:column;gap:5px;font-size:11px;font-weight:800;text-transform:uppercase;letter-spacing:.5px;color:#64748b}
.audit-filter-list{min-width:190px;max-width:300px;max-height:166px;overflow:auto;border:1px solid #d1d5db;border-radius:6px;background:#fff;padding:4px;display:flex;flex-direction:column;gap:3px}
.audit-filter-option{width:100%;min-height:26px;border:0;border-radius:4px;background:transparent;color:#334155;font-size:12px;font-weight:700;text-align:left;padding:4px 7px;cursor:pointer;display:flex;align-items:center;gap:7px}
.audit-filter-option::before{content:"";width:10px;height:10px;border:1px solid #94a3b8;border-radius:2px;background:#fff;flex:0 0 auto}
.audit-filter-option:hover{background:#f8fafc;color:#4338ca}
.audit-filter-option.active{background:#eef2ff;color:#3730a3}
.audit-filter-option.active::before{background:#4f46e5;border-color:#4f46e5;box-shadow:inset 0 0 0 2px #fff}
.audit-filter-empty{padding:7px;color:#94a3b8;font-size:12px;text-transform:none;letter-spacing:0}
.audit-action-filter{min-width:240px}
.admin-audit-table{min-width:1120px}
.admin-audit-table th,.admin-audit-table td{font-size:12.5px;vertical-align:top}
.admin-audit-table .audit-time{white-space:nowrap;font-family:'Cascadia Code','Fira Code',monospace}
.time-management-wrap{overflow-x:auto}
.time-management-table{min-width:1260px}
.time-management-table th,.time-management-table td{font-size:12.5px;vertical-align:top}
.time-op-id .cell-copy{height:26px;padding:0 8px;max-width:210px;background:#f8fafc;border:1px solid #e2e8f0;color:#3730a3;font-weight:800}
.time-value{white-space:nowrap;font-family:'Cascadia Code','Fira Code',monospace;color:#0f172a}
.time-delta-positive{color:#166534}
.time-delta-negative{color:#991b1b}
.time-note{max-width:260px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.approval-wrap{overflow-x:auto}
.approval-table{min-width:1180px}
.approval-table th,.approval-table td{font-size:12.5px;vertical-align:top}
.approval-id,.approval-time{white-space:nowrap;font-family:'Cascadia Code','Fira Code',monospace}
.approval-target{max-width:180px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.approval-summary{max-width:360px;white-space:normal;overflow-wrap:anywhere}
.approval-status{display:inline-flex;align-items:center;justify-content:center;min-height:22px;padding:0 9px;border-radius:999px;font-size:12px;font-weight:800;white-space:nowrap}
.approval-status-pending{background:#fef3c7;color:#92400e}
.approval-status-ok{background:#dcfce7;color:#166534}
.approval-status-no{background:#fee2e2;color:#991b1b}
.approval-status-failed{background:#ffedd5;color:#9a3412}
.approval-status-canceled{background:#e5e7eb;color:#374151}
.approval-error{margin-top:5px;color:#991b1b;font-weight:700}
.account-device-list{display:flex;gap:5px;flex-wrap:wrap}
.account-device-chip{display:inline-flex;align-items:center;gap:5px;max-width:150px;height:24px;padding:0 5px 0 8px;border-radius:999px;background:#eef2ff;color:#3730a3;font-size:12px;font-weight:800}
.account-device-chip span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.account-device-chip button{width:16px;height:16px;border:none;border-radius:50%;background:#c7d2fe;color:#3730a3;font-size:12px;font-weight:900;line-height:16px;cursor:pointer}
.account-device-chip button:hover{background:#fecaca;color:#991b1b}
.account-device-chip.pending{background:#fef3c7;color:#92400e}
.audit-path{max-width:220px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:'Cascadia Code','Fira Code',monospace;color:#475569}
.audit-target{display:inline-flex;flex-direction:column;gap:2px;max-width:160px}
.audit-target strong{font-size:11px;color:#64748b;text-transform:uppercase;letter-spacing:.4px}
.audit-target span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.audit-json summary{color:#4f46e5;font-weight:800;cursor:pointer;white-space:nowrap}
.audit-json pre{margin-top:7px;max-width:340px;max-height:220px;overflow:auto;background:#0f172a;color:#e2e8f0;border-radius:6px;padding:9px;font-size:11px;line-height:1.45;white-space:pre-wrap;word-break:break-word}
.traffic-spacer{height:22px}
.traffic-note{font-size:12px;color:#64748b;margin:0 0 8px}
.traffic-link{max-width:280px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.traffic-overview-grid{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:18px;align-items:start;margin-bottom:22px}
.traffic-column{min-width:0}
.traffic-section-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:12px}
.traffic-section-head .section-label{margin-bottom:0}
.traffic-chart-panel{background:#fff;border:1px solid #e2e8f0;border-radius:8px;box-shadow:0 1px 3px rgba(0,0,0,.06);padding:14px;min-height:250px;margin-bottom:12px}
.traffic-chart-top{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:8px}
.traffic-chart-title{font-size:14px;font-weight:800;color:#1f2937}
.traffic-chart-sub{font-size:12px;color:#64748b;margin-top:3px}
.traffic-chart-total{font-size:20px;font-weight:900;color:#1f2937;line-height:1.1;text-align:right}
.traffic-chart-wrap{height:176px;min-width:0}
.traffic-chart-svg{display:block;width:100%;height:100%}
.traffic-chart-grid{stroke:#e5e7eb;stroke-width:1}
.traffic-chart-axis{stroke:#cbd5e1;stroke-width:1}
.traffic-chart-label{fill:#94a3b8;font-size:10px}
.traffic-chart-line{fill:none;stroke-width:2.1;stroke-linecap:round;stroke-linejoin:round;vector-effect:non-scaling-stroke}
.traffic-chart-line.total{stroke:#94a3b8;stroke-width:2.4;stroke-dasharray:6 5}
.traffic-chart-legend{display:flex;gap:8px 12px;flex-wrap:wrap;max-height:58px;overflow:auto;margin-top:8px;padding-top:8px;border-top:1px solid #f1f5f9}
.traffic-legend-item{display:inline-flex;align-items:center;gap:6px;min-width:0;font-size:11px;font-weight:700;color:#475569}
.traffic-legend-dot{width:9px;height:9px;border-radius:50%;background:var(--legend-color);box-shadow:0 0 0 2px rgba(255,255,255,.9)}
.traffic-legend-label{max-width:140px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
@media(max-width:900px){.traffic-overview-grid{grid-template-columns:1fr}.traffic-section-head{align-items:stretch;flex-direction:column}.traffic-range{width:100%}.traffic-chart-total{text-align:left}.traffic-chart-wrap{height:166px}}
.openrouter-usage-panel{display:grid;grid-template-columns:minmax(0,1fr) 240px;gap:16px;align-items:stretch;background:#fff;border:1px solid #e2e8f0;border-radius:8px;box-shadow:0 1px 3px rgba(0,0,0,.06);padding:16px;min-height:240px}
.openrouter-chart-card{display:flex;flex-direction:column;gap:10px;min-width:0}
.openrouter-chart-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}
.openrouter-title{font-size:14px;font-weight:800;color:#1f2937}
.openrouter-sub{font-size:12px;color:#64748b;margin-top:3px}
.openrouter-bars{display:grid;grid-template-columns:repeat(30,minmax(7px,1fr));align-items:end;gap:4px;height:160px;border-bottom:1px solid #cbd5e1;padding:12px 0 0}
.openrouter-bar-wrap{height:100%;display:flex;flex-direction:column;align-items:stretch;justify-content:flex-end;min-width:0}
.openrouter-bar{min-height:2px;height:var(--bar-h);border-radius:4px 4px 0 0;background:#4f46e5;box-shadow:inset 0 -1px 0 rgba(0,0,0,.12)}
.openrouter-bar.zero{height:2px;background:#cbd5e1}
.openrouter-bar-labels{display:grid;grid-template-columns:repeat(30,minmax(7px,1fr));gap:4px}
.openrouter-bar-label{height:18px;font-size:10px;color:#94a3b8;text-align:center;white-space:nowrap;overflow:hidden}
.openrouter-stat-card{border-left:1px solid #e2e8f0;padding-left:16px;display:flex;flex-direction:column;justify-content:center;gap:12px}
.openrouter-stat-label{font-size:11px;font-weight:800;text-transform:uppercase;letter-spacing:.6px;color:#64748b}
.openrouter-stat-value{font-size:26px;font-weight:900;color:#1f2937;line-height:1.1}
.openrouter-stat-small{font-size:12px;color:#64748b;line-height:1.45;overflow-wrap:anywhere}
.openrouter-stat-row{display:flex;justify-content:space-between;gap:10px;font-size:12px;color:#475569;border-top:1px solid #f1f5f9;padding-top:9px}
.openrouter-stat-row strong{font-family:'Cascadia Code','Fira Code',monospace;color:#1f2937}
.openrouter-warning{font-size:12px;color:#92400e;background:#fef3c7;border:1px solid #fde68a;border-radius:6px;padding:7px 9px}
@media(max-width:900px){.openrouter-usage-panel{grid-template-columns:1fr}.openrouter-stat-card{border-left:none;border-top:1px solid #e2e8f0;padding-left:0;padding-top:14px}.openrouter-stat-value{font-size:23px}}
.agent-referral-link{margin-bottom:14px}
.agent-referral-panel{display:flex;align-items:center;justify-content:space-between;gap:12px;background:#fff;border:1px solid #e2e8f0;border-radius:8px;box-shadow:0 1px 3px rgba(0,0,0,.06);padding:12px 14px}
.agent-referral-meta{min-width:0}
.agent-referral-label{font-size:11px;font-weight:800;text-transform:uppercase;letter-spacing:.6px;color:#64748b;margin-bottom:4px}
.agent-referral-code{font-size:13px;color:#475569}
.agent-referral-copy{min-width:0;max-width:min(560px,100%)}
.agent-referral-copy .cell-copy{height:32px;padding:0 10px;background:#f8fafc;border:1px solid #e2e8f0;color:#3730a3;font-weight:700}
.agent-referral-copy .cell-copy:hover{background:#eef2ff}
.agent-referral-copy .copy-icon{opacity:.7}
@media(max-width:700px){.agent-referral-panel{align-items:flex-start;flex-direction:column}.agent-referral-copy{width:100%}}
.agent-device-bind-panel{background:#fff;border:1px solid #e2e8f0;border-radius:8px;box-shadow:0 1px 3px rgba(0,0,0,.06);padding:14px;margin-bottom:14px}
.agent-device-bind-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:10px}
.agent-device-bind-title{font-size:13px;font-weight:900;color:#1f2937}
.agent-device-bind-state{font-size:12px;color:#64748b;margin-top:3px;min-height:16px}
.agent-device-bind-state.ok{color:#166534;font-weight:800}
.agent-device-bind-state.error{color:#991b1b;font-weight:800}
.agent-device-bind-form{display:grid;grid-template-columns:minmax(160px,240px) minmax(180px,1fr) auto;gap:8px;align-items:center}
.agent-device-bind-input{height:34px;border:1.5px solid #d1d5db;border-radius:6px;background:#fff;color:#0f172a;font-size:13px;padding:0 10px;outline:none}
.agent-device-bind-input:focus{border-color:#818cf8;box-shadow:0 0 0 3px rgba(129,140,248,.18)}
@media(max-width:720px){.agent-device-bind-form{grid-template-columns:1fr}.agent-device-bind-form .btn-primary{width:100%}}

/* ── Production trace ───────────────────────────────── */
.production-layout{display:grid;grid-template-columns:minmax(360px,520px) minmax(420px,1fr);gap:18px;padding:20px 24px;align-items:start}
.production-panel{background:#fff;border:1px solid #e2e8f0;border-radius:8px;box-shadow:0 1px 3px rgba(0,0,0,.06);padding:16px;min-width:0}
.production-panel.production-admin-only{grid-column:1/-1}
.production-panel-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:14px}
.production-title{font-size:14px;font-weight:800;color:#1f2937}
.production-sub{font-size:12px;color:#64748b;margin-top:3px}
.production-scan-row{display:grid;grid-template-columns:minmax(0,1fr) auto auto;gap:8px;margin-bottom:8px}
.production-scan-input{height:36px;border:1.5px solid #d1d5db;border-radius:6px;padding:0 11px;font-size:14px;outline:none}
.production-scan-input:focus{border-color:#4f46e5;box-shadow:0 0 0 3px rgba(79,70,229,.12)}
.production-scan-button{min-width:96px;height:44px;font-size:16px;font-weight:900}
.operator-scan-mode .production-layout{grid-template-columns:minmax(320px,680px);justify-content:center}
.operator-scan-mode .production-panel{padding:20px}
.operator-scan-mode .production-scan-row{grid-template-columns:minmax(0,1fr) auto;gap:10px}
.operator-scan-mode .production-scan-row .btn-primary{display:none}
.operator-scan-mode .production-scan-input{height:48px;font-size:17px}
.operator-scan-mode .production-scan-button{height:58px;min-width:150px;font-size:21px}
.production-scan-hint,.production-scan-status{font-size:12px;font-weight:700;color:#64748b;margin:0 0 10px}
.production-camera-panel{border:1px solid #cbd5e1;border-radius:8px;background:#0f172a;padding:10px;margin-bottom:12px}
.production-camera-view{position:relative;background:#020617;border-radius:6px;overflow:hidden}
.production-camera-panel video{display:block;width:100%;max-height:280px;background:#020617;object-fit:contain}
.production-barcode-overlay{position:absolute;inset:0;pointer-events:none}
.production-barcode-box{position:absolute;border:3px solid #ef4444;border-radius:4px;box-shadow:0 0 0 1px rgba(255,255,255,.75),0 0 18px rgba(239,68,68,.45);min-width:12px;min-height:12px}
.production-camera-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:10px}
.production-capture-button{min-width:132px;height:46px;font-size:16px;font-weight:900}
.production-confirm-button{min-width:116px;height:46px;font-size:16px;font-weight:900}
.operator-scan-mode .production-capture-button{height:58px;min-width:170px;font-size:20px}
.operator-scan-mode .production-confirm-button{height:58px;min-width:150px;font-size:20px}
.production-camera-panel .production-scan-status{color:#cbd5e1;margin:8px 0 0}
.production-scan-results{border:1px solid #e2e8f0;border-radius:8px;background:#fff;padding:10px;margin-bottom:12px}
.production-scan-results-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:8px}
.production-scan-results-title{font-size:13px;font-weight:900;color:#1f2937}
.production-scan-results-count{font-size:12px;font-weight:800;color:#64748b}
.production-scan-result-list{display:flex;flex-direction:column;gap:7px;max-height:300px;overflow-y:auto}
.production-scan-result-item{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;align-items:center;border:1px solid #e2e8f0;border-radius:6px;background:#f8fafc;padding:8px 10px}
.production-scan-result-main{min-width:0}
.production-scan-result-name{font-size:15px;font-weight:900;color:#0f172a;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.production-scan-result-meta{font-size:12px;font-weight:700;color:#64748b;margin-top:2px;overflow-wrap:anywhere}
.production-scan-result-meta.duplicate{color:#92400e}
.production-scan-result-meta.failed{color:#991b1b}
.production-device-card{border:1px solid #e2e8f0;border-radius:8px;background:#f8fafc;padding:12px;margin-bottom:12px}
.production-device-main{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:8px}
.production-device-name{font-size:20px;font-weight:800;color:#0f172a;letter-spacing:.3px}
.production-device-meta{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px 12px;font-size:12px;color:#64748b}
.production-device-meta strong{color:#334155}
.production-empty{color:#94a3b8;font-size:13px;text-align:center;padding:18px 8px}
.trace-list{display:flex;flex-direction:column;gap:9px;max-height:560px;overflow-y:auto;padding-right:2px}
.trace-item{display:grid;grid-template-columns:92px minmax(0,1fr);gap:12px;border:1px solid #e2e8f0;border-radius:8px;padding:10px;background:#fff}
.trace-time{font-size:11px;font-weight:800;color:#64748b;line-height:1.35}
.trace-main{min-width:0}
.trace-head{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-bottom:3px}
.trace-event{font-size:13px;font-weight:800;color:#1f2937}
.trace-meta{font-size:12px;color:#64748b;line-height:1.45;overflow-wrap:anywhere}
.trace-note{font-size:12px;color:#334155;margin-top:4px;white-space:pre-wrap;overflow-wrap:anywhere}
.trace-override-form{display:grid;grid-template-columns:minmax(130px,170px) minmax(180px,1fr) minmax(120px,160px) auto auto;align-items:end;gap:10px;border:1px solid #dbeafe;border-radius:8px;background:#f8fbff;padding:12px;margin-bottom:12px}
.trace-override-form label{display:flex;flex-direction:column;gap:5px;font-size:12px;font-weight:800;color:#475569}
.trace-override-form .check-row{height:34px;flex-direction:row;align-items:center;white-space:nowrap}
.trace-override-form select,.trace-override-form input[type=text],.trace-override-form input:not([type]){height:34px;border:1.5px solid #cbd5e1;border-radius:6px;background:#fff;color:#0f172a;font-size:13px;padding:0 9px;outline:none}
.trace-override-form select:focus,.trace-override-form input:focus{border-color:#4f46e5;box-shadow:0 0 0 3px rgba(79,70,229,.12)}
.compact-table{box-shadow:none;border:1px solid #e2e8f0}
.badge-stage-untracked{background:#f1f5f9;color:#475569}
.badge-stage-reserved{background:#e0f2fe;color:#075985}
.badge-stage-assembled{background:#dbeafe;color:#1e40af}
.badge-stage-flashed{background:#e0e7ff;color:#3730a3}
.badge-stage-qc_passed{background:#dcfce7;color:#166534}
.badge-stage-qc_failed{background:#fee2e2;color:#991b1b}
.badge-stage-packed{background:#fef3c7;color:#92400e}
.badge-stage-stocked{background:#dcfce7;color:#166534}
.badge-stage-shipped{background:#ccfbf1;color:#0f766e}
.badge-stage-delivered{background:#dcfce7;color:#166534}
.badge-stage-repairing{background:#ffedd5;color:#9a3412}
.badge-stage-repaired{background:#ede9fe;color:#5b21b6}
.badge-stage-scrapped{background:#e5e7eb;color:#374151}
@media(max-width:980px){.production-layout{grid-template-columns:1fr}.production-panel.production-admin-only{grid-column:auto}.production-scan-row{grid-template-columns:1fr auto auto}.trace-override-form{grid-template-columns:1fr 1fr}}
@media(max-width:560px){.production-scan-row,.operator-scan-mode .production-scan-row{grid-template-columns:1fr}.production-camera-actions{justify-content:stretch;flex-direction:column}.production-camera-actions button{width:100%}.trace-override-form{grid-template-columns:1fr}}

/* ── Camera tuning ──────────────────────────────────── */
.camera-tuning-layout{display:grid;grid-template-columns:minmax(340px,460px) minmax(520px,1fr);gap:18px;padding:20px 24px;align-items:start;width:100%;max-width:1180px;margin:0 auto;box-sizing:border-box}
.camera-panel{background:#fff;border:1px solid #e2e8f0;border-radius:8px;box-shadow:0 1px 3px rgba(0,0,0,.06);padding:16px;min-width:0}
.camera-panel-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:14px}
.camera-title{font-size:14px;font-weight:800;color:#1f2937}
.camera-meta{font-size:12px;color:#64748b;margin-top:3px}
.camera-actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap;justify-content:flex-end}
.camera-form{display:grid;gap:16px}
.camera-device-picker{display:grid;gap:12px}
.camera-field{display:flex;flex-direction:column;gap:8px;font-size:12px;font-weight:800;color:#475569}
.camera-field textarea,.camera-field input{width:100%;padding:9px 10px;border:1.5px solid #d1d5db;border-radius:6px;font-size:14px;font-family:'Cascadia Code','Fira Code',monospace;line-height:1.45;resize:vertical;outline:none}
.camera-field textarea:focus,.camera-field input:focus{border-color:#4f46e5;box-shadow:0 0 0 3px rgba(79,70,229,.12)}
.camera-device-results,.camera-override-list{display:grid;gap:6px;max-height:260px;overflow:auto}
.camera-device-row{width:100%;display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;align-items:center;border:1px solid #e2e8f0;background:#fff;border-radius:6px;padding:9px 10px;text-align:left;cursor:pointer}
.camera-device-row:hover{background:#f8fafc;border-color:#a5b4fc}
.camera-device-row.active{background:#eef2ff;border-color:#818cf8}
.camera-device-main{min-width:0;display:grid;gap:2px}
.camera-device-main strong{font-family:'Cascadia Code','Fira Code',monospace;font-size:13px;color:#1f2937;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.camera-device-main span{font-size:11px;color:#64748b;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.camera-device-chip{font-size:11px;font-weight:800;color:#4338ca;background:#eef2ff;border-radius:999px;padding:3px 7px;white-space:nowrap}
.camera-list-head,.camera-delivery-head{display:flex;align-items:center;justify-content:space-between;gap:10px;font-size:12px;font-weight:800;color:#475569}
.camera-delivery-head{margin:16px 0 8px}
.camera-report{border:1px solid #e2e8f0;border-radius:6px;background:#f8fafc;padding:10px;font-size:12px;line-height:1.5;color:#475569}
.camera-segmented{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px}
.camera-segmented button{height:34px;border:1px solid #d1d5db;border-radius:6px;background:#fff;color:#475569;font-size:12px;font-weight:800;cursor:pointer;white-space:nowrap}
.camera-segmented button:hover{background:#f8fafc;border-color:#a5b4fc;color:#4338ca}
.camera-segmented button.active{background:#eef2ff;border-color:#818cf8;color:#3730a3}
#camera-ae-target{width:100%;accent-color:#4f46e5}
.camera-slider-hint{display:flex;justify-content:space-between;gap:10px;font-size:11px;font-weight:800;color:#64748b}
.camera-delivery-table{width:100%;min-width:0;table-layout:fixed}
.camera-delivery-table th,.camera-delivery-table td{font-size:13px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.camera-delivery-table th:nth-child(1),.camera-delivery-table td:nth-child(1){width:18%}
.camera-delivery-table th:nth-child(2),.camera-delivery-table td:nth-child(2){width:14%}
.camera-delivery-table th:nth-child(3),.camera-delivery-table td:nth-child(3){width:14%}
.camera-delivery-table th:nth-child(4),.camera-delivery-table td:nth-child(4){width:14%}
.camera-delivery-table th:nth-child(5),.camera-delivery-table td:nth-child(5){width:20%}
.camera-delivery-table th:nth-child(6),.camera-delivery-table td:nth-child(6){width:20%}
.camera-device-name{font-family:'Cascadia Code','Fira Code',monospace;font-weight:800;color:#1f2937}
.camera-fw{max-width:150px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
@media(max-width:980px){.camera-tuning-layout{grid-template-columns:1fr}.camera-panel-head{flex-direction:column}.camera-actions{justify-content:flex-start}.camera-segmented{grid-template-columns:1fr}}
