#devicesPage {padding:0;max-width:none;margin:0;width:100%;box-sizing:border-box}
#devicesPage > .device-head {margin:18px 0;min-height:64px}
.device-head {display:flex;align-items:center;justify-content:space-between;gap:20px;margin-bottom:24px}
.device-head h1,.device-head h2 {margin:0 0 8px}
.device-head p {margin:0}
.device-filters {display:flex;gap:12px;flex-wrap:wrap;margin-bottom:16px}
.device-filters input {flex:1;min-width:240px}
.device-list {display:grid;gap:6px;overflow-x:auto;max-width:100%;min-width:0;padding-bottom:8px}
.device-row,.device-columns-header {display:grid;grid-template-columns:var(--device-columns);width:max(100%,var(--device-table-width));box-sizing:border-box;align-items:center;gap:8px;padding:10px 12px}
.device-row {background:white;color:#123647;border:1px solid #d9e3e8;border-radius:9px;text-align:left;font-size:14px;font-weight:400;min-height:44px}
.device-row:hover {border-color:#88afc2;background:#f7fbfd;transform:none}
.device-cell {min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:13px}
.device-cell > span:not(.device-badge) {white-space:nowrap}
.device-playback-controls {display:flex;align-items:center;gap:8px}
.device-playback-controls > input[type="checkbox"] {width:16px;height:16px;padding:0;margin:0;flex:0 0 16px}
.device-playback-controls > .device-power {flex:none}
.device-badge {display:inline-block;width:auto;max-width:100%;box-sizing:border-box;border-radius:20px;padding:4px 9px;background:#eef2f6;font-size:12px;text-align:center;white-space:nowrap}
.device-columns-header {font-size:12px;color:#657586;border-bottom:1px solid #d9e3e8}
.device-column-heading {position:relative;min-width:0;white-space:nowrap}
.device-column-resize {position:absolute;right:-5px;top:-7px;bottom:-7px;width:10px;cursor:col-resize;touch-action:none}
.device-column-resize::after {content:'';position:absolute;left:4px;top:4px;bottom:4px;border-left:1px solid #b8c5cf}
.device-column-resize:hover::after,.device-column-resize:focus::after {border-left:3px solid #f5003e}
html.device-columns-dragging,html.device-columns-dragging * {cursor:col-resize!important;user-select:none!important}
.device-table-tools {display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:8px;font-size:12px}
.device-table-tools button {margin:0;white-space:nowrap;font-size:12px}
#deviceSearch {width:auto;flex:1 1 340px;min-width:180px;max-width:560px}
#deviceStatusFilter {width:200px;flex:0 1 200px}
#deviceRefresh {margin:0;flex:none}
.device-active {background:#e2f5e9;color:#206438}.device-written_off {background:#f6e5e7;color:#8d3442}.device-new {background:#e6f0fd;color:#315f99}
.device-pagination,.device-actions {display:flex;align-items:center;justify-content:flex-end;gap:16px;margin-top:24px}
.device-dialog {width:min(820px,calc(100vw - 32px));max-height:calc(100vh - 40px);box-sizing:border-box;border:1px solid #d9e3e8;border-radius:20px;padding:28px;color:#123647;background:#fff}
.device-dialog::backdrop {background:#142b3a88}
.device-dialog form {display:block}
.device-section {background:#f7f9fb;border:1px solid #e3e9ee;border-radius:12px;padding:18px;margin-top:16px}
.device-section h3 {margin:0 0 16px;font-size:16px}
.device-grid {display:grid;grid-template-columns:1fr 1fr;gap:18px}
.device-field {display:flex;flex-direction:column;gap:8px;font-size:13px;min-width:0}
.device-field input,.device-field select,.device-field textarea {box-sizing:border-box;width:100%;border:1px solid #bccbd5;border-radius:8px;background:white;padding:10px;color:#123647;font:inherit;min-height:40px}
.device-field textarea {min-height:110px;resize:vertical}
.device-section:last-child .device-grid {grid-template-columns:1fr}
.device-clear {display:flex;align-items:center;gap:8px;font-size:12px;color:#6b7c88}
.device-clear input {width:15px;min-height:15px;flex:none}
#deviceFormError {color:#b52540}
.device-section .muted {font-size:12px;line-height:1.5;margin-bottom:0}

@media(max-width:560px) {.device-grid {grid-template-columns:1fr}.device-dialog {padding:16px}.device-head {align-items:flex-start}.device-actions {flex-wrap:wrap}.device-table-tools {align-items:flex-start;flex-wrap:wrap}}

#deviceAdd {background:#f5003e;color:white;border-radius:9px;padding:12px 18px;white-space:nowrap}
.device-actions button {margin-bottom:0}
.device-tabs {display:flex;gap:8px;margin:0 0 24px}
.device-tabs button {padding:10px 18px;border:1px solid #c5d4df;border-radius:8px;background:#fff;color:#123647}
.device-tabs button.active {background:#123647;color:#fff}
.device-label-settings {background:white;border:1px solid #d9e3e8;border-radius:16px;padding:24px}
.device-label-editor {display:grid;grid-template-columns:minmax(0,1fr) 320px;gap:28px}
.device-label-canvas {max-width:100%;width:100%;height:auto;display:block;border:1px solid #e1e7ed;border-radius:8px;background:white}
#labelEditorCanvas {touch-action:none;cursor:move}
.device-label-controls {display:flex;flex-direction:column;gap:16px}
.device-label-controls label {display:flex;flex-direction:column;gap:6px;font-size:13px}
.device-label-controls input,.device-label-controls select {padding:9px;width:100%;box-sizing:border-box;border:1px solid #c5d4df;border-radius:8px}
.device-label-editor .muted {font-size:13px;line-height:1.5}
#labelSettingsSave,#deviceLabelDownload {background:#f5003e;color:white;border-radius:8px;padding:10px 16px}
#deviceLabelDialog {width:min(1000px,calc(100vw - 32px))}
@media(max-width:850px){.device-label-editor {grid-template-columns:1fr}.device-label-settings {padding:16px}}

.device-secret-toggle {align-self:flex-start;font-size:12px;padding:6px 12px;margin:0;min-height:30px}
.device-secret-area[readonly] {min-height:54px;resize:none}

#credentialsInventorySearch {box-sizing:border-box;width:100%;margin:8px 0 12px}
#credentialsInventoryDevice {box-sizing:border-box;width:100%;min-height:132px;padding:6px}
#credentialsInventoryDevice option {padding:6px 8px}
#credentialsInventorySelection {display:block;margin:8px 0}

.device-row {cursor:pointer}.device-row:focus-visible {outline:2px solid #315f9c;outline-offset:-2px}
.device-online-dot {display:inline-block;width:12px;height:12px;border-radius:50%;background:#18a058;vertical-align:middle}
.device-online-dot.offline {background:#e43c48}
.device-activity-cell {display:flex;flex-direction:column;gap:3px}
.device-activity-cell small {font-size:11px;font-weight:400}
.device-activity-cell strong {font-size:12px}
.device-power {padding:6px 12px;margin:0;font-size:16px;line-height:20px;min-width:38px}

/* Opaque frozen cells follow the resized first column, including the header. */
.device-row > :nth-child(-n+2),.device-columns-header > :nth-child(-n+2) {position:sticky;left:12px;z-index:2;background:inherit;overflow:visible;align-self:stretch;display:flex;align-items:center}
.device-row > :nth-child(2),.device-columns-header > :nth-child(2) {left:calc(var(--device-first-width) + 20px);box-shadow:8px 0 0 0 white}
.device-row:hover > :nth-child(2) {box-shadow:8px 0 0 0 #f7fbfd}
.device-columns-header {background:#f6eeeb}
.device-columns-header > :nth-child(2) {box-shadow:8px 0 0 0 #f6eeeb}
.device-row > :nth-child(2) > strong {overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.device-update-selection input {width:18px;height:18px;margin:0;vertical-align:middle}
.device-history-item {margin:12px 0;padding:10px;border:1px solid #d9e3e8;border-radius:8px}
.device-history-item summary {cursor:pointer;line-height:1.5}
.device-history-item dl {display:grid;grid-template-columns:180px minmax(0,1fr);gap:6px;font-size:12px}
.device-history-item dd {margin:0;white-space:pre-wrap;overflow-wrap:anywhere}
.device-history-item textarea {box-sizing:border-box;width:100%;min-height:160px}

.device-row > :first-child {box-shadow:-12px 0 0 white,8px 0 0 white}
.device-row:hover > :first-child {box-shadow:-12px 0 0 #f7fbfd,8px 0 0 #f7fbfd}
.device-columns-header > :first-child {box-shadow:-12px 0 0 #f6eeeb,8px 0 0 #f6eeeb}

.device-position {gap:5px}.device-position input,.device-group-content input {width:16px;height:16px;padding:0;margin:0;flex:0 0 16px;cursor:pointer}
.device-group-row {width:max(100%,var(--device-table-width));box-sizing:border-box;background:#eaf1f5;border:1px solid #c5d4df;border-radius:9px;min-height:44px;padding:8px 12px;color:#123647}
.device-group-content {position:sticky;left:12px;display:flex;align-items:center;gap:10px;width:max-content;max-width:calc(100vw - 80px);box-sizing:border-box}
.device-group-content strong {overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.device-group-content .muted {font-size:12px;white-space:nowrap}
.device-group-toggle,.device-group-edit {padding:4px 8px;margin:0;flex:none}.device-group-toggle {min-width:28px}.device-group-edit {font-size:12px}
.device-group-dialog {width:min(540px,calc(100vw - 32px))}.device-group-dialog h2 {margin-top:0}.device-group-dialog [role=status] {color:#b52540}
#deviceGroupButton {white-space:nowrap}.device-head {flex-wrap:wrap}

.device-pagination[hidden] {display:none}

.device-row > [hidden],.device-columns-header > [hidden] {display:none!important}
.device-column-heading {cursor:pointer}
.device-column-preview {opacity:.55}
.device-column-menu {position:fixed;z-index:1600;display:grid;gap:4px;min-width:180px;padding:8px;background:#fff;color:#123647;border:1px solid #d9e3e8;border-radius:12px;box-shadow:0 8px 28px #12364726}
.device-column-menu button {width:100%;margin:0;padding:9px 12px;border:0;box-shadow:none;text-align:left;font-size:13px}
.device-column-menu button:hover:not(:disabled),.device-column-menu button:focus-visible {background:#eef5f8}

/* Registry stickers also cover sticky cells without changing table geometry. */
.device-row.device-sticker-colored,.device-row.device-sticker-colored:hover {background:var(--device-sticker-color)}
.device-row.device-sticker-colored > :first-child {box-shadow:-12px 0 0 var(--device-sticker-color),8px 0 0 var(--device-sticker-color)}
.device-row.device-sticker-colored > :nth-child(2) {box-shadow:8px 0 0 var(--device-sticker-color)}
.device-position {gap:3px}
.device-position .device-sticker-note {background:#ffd34d;border:1px solid #b38300;border-radius:50%;width:11px;height:11px;min-width:11px;min-height:11px;padding:0;flex-shrink:0;box-shadow:none}
.device-sticker-menu {position:fixed;z-index:1200;min-width:190px;max-width:calc(100vw - 16px);padding:8px;background:white;border:1px solid #d4e0e7;border-radius:12px;box-shadow:0 12px 32px #12364730;color:#123647}
.device-sticker-menu > button {display:block;width:100%;text-align:left;padding:10px 12px;margin:2px 0;white-space:nowrap}
.device-sticker-palette {display:grid;grid-template-columns:1fr 1fr;gap:5px}
.device-sticker-swatch {display:flex;align-items:center;gap:6px;padding:9px 7px;font-size:13px;color:#123647;background:white;border:1px solid #d4e0e7;border-radius:7px;white-space:nowrap}
.device-sticker-swatch::before {content:'';width:16px;height:16px;background:var(--swatch);border:1px solid #a8b8c4;border-radius:50%;flex-shrink:0}
.device-sticker-swatch[aria-pressed=true] {border-color:#123647}
.device-sticker-error:empty {display:none}
.device-sticker-error {max-width:260px;font-size:13px;margin:8px}
.device-sticker-dialog {width:min(480px,calc(100vw - 24px));padding:20px}
.device-sticker-dialog h2 {font-size:20px;margin:0}
.device-sticker-dialog textarea {resize:vertical;min-height:100px}

/* Dense pointer-operated table; touch controls retain their mobile sizing. */
@media (min-width: 701px) and (pointer: fine) {
 .device-list { gap: 4px; }
 .device-row { min-height: 40px; padding-block: 4px; }
 .device-group-row { min-height: 36px; padding-block: 3px; }
 .device-row .device-power, .device-group-content .device-group-toggle, .device-group-content .device-group-edit { min-height: 28px; height: 28px; box-sizing: border-box; padding: 2px 8px; line-height: 20px; }
 .device-activity-cell { gap: 1px; line-height: 1.2; }
 .device-badge { padding-block: 2px; }
}
.device-sticker-menu { box-sizing: border-box; max-height: calc(100dvh - 16px); overflow-y: auto; }
.device-sticker-palette { min-width: 0; }
.device-sticker-swatch { min-width: 0; }

.device-tree-entry { --device-tree-indent: 0px; display: grid; grid-template-columns: var(--device-tree-indent) minmax(0,1fr); position: relative; width: max(100%,var(--device-table-width)); align-items: stretch; }
.device-tree-entry > .device-row, .device-tree-entry > .device-group-row { grid-column: 2; }
.device-tree-guides { position: sticky; left: 0; display: flex; grid-column: 1; grid-row: 1; pointer-events: none; }
.device-tree-guides > i { position: relative; flex: 0 0 16px; }
.device-tree-branch::before, .device-tree-continuation::before { content: ''; position: absolute; left: 7px; top: -4px; bottom: -4px; border-left: 1px solid #9eb6c3; }
.device-tree-branch::after { content: ''; position: absolute; left: 7px; right: 0; top: 50%; border-top: 1px solid #9eb6c3; }
.device-tree-last::before { bottom: 50%; }
.device-tree-entry .device-row > :first-child { left: calc(12px + var(--device-tree-indent)); }
.device-tree-entry .device-row > :nth-child(2) { left: calc(var(--device-first-width) + 20px + var(--device-tree-indent)); }
.device-tree-entry .device-group-content { left: calc(12px + var(--device-tree-indent)); }
@media (min-width: 701px) and (pointer: fine) {
 .device-row, .device-group-row { min-height: 46px; height: 46px; }
}
@media (max-width: 700px) {
 .device-tree-entry { width: 100%; }
 .device-tree-entry .device-group-row { min-width: 0; }
}
