.device-directory #dev-modal {
  z-index: 120;
  justify-content: flex-end;
  align-items: stretch;
  padding: 0;
}

.device-directory #modal-backdrop {
  background: rgb(15 35 49 / 20%);
  backdrop-filter: none;
}

.device-directory #device-dialog {
  --drawer-bg: #f4f7f8;
  --drawer-edge: #dce5e8;
  --drawer-ink: #172e3b;
  --drawer-muted: #4f6471;
  --drawer-accent: #215d56;
  --drawer-accent-hover: #184a45;
  --drawer-tint: #e7f2ef;
  --drawer-red: #a32935;
  --drawer-red-tint: #fff5f4;
  --drawer-gap: 12px;
  width: min(100%, 458px);
  max-width: none;
  max-height: none;
  border: 0;
  border-left: 1px solid var(--drawer-edge);
  border-radius: 0;
  background: #fff;
  color: var(--drawer-ink);
  box-shadow: -14px 0 42px rgb(21 42 52 / 13%);
  animation: slideInRight 180ms ease both;
}

.device-directory #dev-modal.settings-expanded #device-dialog {
  width: min(100%, 864px);
}

.device-directory #device-dialog .modal-hdr {
  min-height: 74px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--drawer-edge);
  gap: 9px;
}

.device-directory #modal-device-name {
  font-size: 19px;
  font-weight: 750;
  letter-spacing: -.025em;
  color: var(--drawer-ink);
}

.device-directory .hdr-name-row { gap: 7px; }

.device-directory .hdr-name-row > span {
  min-width: 0;
  white-space: nowrap;
}

.device-directory #modal-device-sub {
  gap: 5px 8px;
  margin-top: 4px;
  color: var(--drawer-muted);
  font-size: 12px;
}

.device-directory #modal-device-sub .status-pill {
  align-self: center;
  font-size: 11px;
  padding: 2px 7px;
}

.device-directory #device-dialog :is(.btn-sec, #btn-close-modal) { flex-shrink: 0; }

.device-directory #device-settings-expand {
  min-height: 34px;
  padding: 5px 10px;
  border: 1px solid #bed8d1;
  border-radius: 7px;
  background: var(--drawer-tint);
  color: var(--drawer-accent);
  font-size: 12px;
  font-weight: 650;
}

.device-directory #device-settings-expand:hover { background: #d7eae4; }

.device-directory #btn-close-modal {
  width: 34px;
  height: 34px;
  border: 1px solid var(--drawer-edge);
  border-radius: 7px;
  background: #fff;
  color: var(--drawer-muted);
}

.device-directory #btn-close-modal:hover { background: var(--drawer-bg); }

.device-directory #device-dialog .btn-rename {
  padding: 4px 6px;
  border: 0;
  border-radius: 5px;
  background: none;
  color: var(--drawer-accent);
  font-size: 11px;
}

.device-directory #device-dialog .btn-rename:hover { background: var(--drawer-tint); }

.device-directory #device-settings-toolbar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-bottom: 1px solid var(--drawer-edge);
}

.device-directory #settings-search {
  width: 100%;
  height: 36px;
  padding: 7px 11px;
  border: 1px solid var(--drawer-edge);
  border-radius: 7px;
  background: var(--drawer-bg);
  font-size: 13px;
}

.device-directory #settings-search::placeholder { color: var(--drawer-muted); }

.device-directory #device-settings-picker {
  display: none;
  height: 36px;
  padding: 5px 8px;
  border: 1px solid var(--drawer-edge);
  border-radius: 7px;
  background: #fff;
  color: var(--drawer-ink);
  font-size: 12px;
}

.device-directory .group-sidebar {
  flex: 0 0 172px;
  width: auto;
  min-width: 0;
  padding: 13px 8px;
  border-color: var(--drawer-edge);
  background: #fff;
}

.device-directory .group-sidebar .sidebar-item {
  min-height: 36px;
  justify-content: flex-start;
  margin-bottom: 3px;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--drawer-muted);
  font-size: 12px;
  font-weight: 560;
  line-height: 1.3;
  text-align: left;
}

.device-directory .group-sidebar .sidebar-item:hover {
  color: var(--drawer-ink);
  background: var(--drawer-bg);
}

.device-directory .group-sidebar .sidebar-item.active {
  border-color: #cfe3dc;
  background: var(--drawer-tint);
  color: var(--drawer-accent);
  font-weight: 680;
}

.device-directory .group-sidebar .sidebar-item.danger-item { color: var(--drawer-red); }
.device-directory .group-sidebar .sidebar-item.danger-item.active {
  border-color: #f0d8d7;
  background: var(--drawer-red-tint);
}

.device-directory #group-content {
  min-width: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 15px 18px 24px;
  scroll-padding-block-start: 12px;
  background: var(--drawer-bg);
}

.drawer-section,
.drawer-card-wrap,
.drawer-card-grid {
  display: grid;
  gap: var(--drawer-gap);
  min-width: 0;
  align-content: start;
}

.drawer-card-grid { grid-template-columns: minmax(0, 1fr); }
.drawer-card-grid > * { min-width: 0; }

@media (min-width: 800px) {
  .settings-expanded .drawer-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-expanded .drawer-card-grid > .drawer-card-wrap { align-content: stretch; }
  .settings-expanded .drawer-card-grid > .drawer-card-wide { grid-column: 1 / -1; }
  .drawer-policy-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 16px; }
  .device-directory .drawer-policy-grid .policy-row { border-bottom: 1px solid #eaf0f1; }
  .device-directory .drawer-policy-grid .policy-row:last-child { padding-bottom: 7px !important; }
}

.drawer-section-heading {
  margin: 0;
  color: var(--drawer-ink);
  font-size: 20px;
  font-weight: 730;
  letter-spacing: -.03em;
  line-height: 1.25;
}

.drawer-section-links {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: -3px 0 1px;
}

.drawer-section-links button {
  min-height: 28px;
  padding: 3px 8px;
  border: 1px solid var(--drawer-edge);
  border-radius: 6px;
  background: #fff;
  color: var(--drawer-accent);
  font-size: 11.5px;
  font-weight: 620;
}

.drawer-section-links button:hover { background: var(--drawer-tint); }

.device-directory .drawer-section :is(.net-section, .pending-cmds, .danger-card) {
  min-width: 0;
  margin: 0 !important;
  padding: 13px;
  border: 1px solid var(--drawer-edge);
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 1px 2px rgb(25 52 66 / 4%);
}

.device-directory .drawer-section :is(.net-section > h3, .pending-cmds > h3, .danger-title) {
  margin: 0 0 8px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--drawer-ink);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.35;
  text-transform: none;
}

.device-directory .drawer-section :is(.policy-row, .comp-row, .usage-row, .app-row) {
  gap: 8px;
  padding: 7px 0 !important;
  border-color: #eaf0f1;
}

.device-directory .drawer-section .policy-row { min-height: 40px; }

.device-directory .drawer-section .policy-row:last-child { padding-bottom: 1px !important; }
.device-directory .drawer-section .policy-info { min-width: 0; }
.device-directory .drawer-section .policy-label { font-size: 13px; font-weight: 625; line-height: 1.35; }
.device-directory .drawer-section :is(.policy-sub, .apps-meta, .comp-val, .pending-sub, .app-pkg, .drawer-card-note) {
  color: var(--drawer-muted);
  font-size: 12px;
  line-height: 1.43;
}

.device-directory .drawer-section .policy-warn { font-size: 11.5px; line-height: 1.4; }
.device-directory .drawer-section .net-section > .apps-meta { margin: 0 0 8px !important; padding: 0; }
.device-directory .drawer-section .net-section > .apps-meta:last-child { margin-bottom: 0 !important; }
.device-directory .drawer-section :is(.sect-app, .kiosk-section-hdr) {
  margin: 4px 0 2px;
  color: var(--drawer-accent);
  font-size: 12px;
  letter-spacing: 0;
}

.device-directory .drawer-section .toggle {
  flex: 0 0 34px;
  width: 34px;
  height: 20px;
}

.device-directory .drawer-section .toggle-track {
  width: 34px;
  height: 20px;
  border-radius: 12px;
  background: #bdcbd2;
}

.device-directory .drawer-section .toggle-track::after { content: none; }

.device-directory .drawer-section .toggle-thumb {
  width: 14px;
  height: 14px;
  top: 3px;
  left: 3px;
}

.device-directory .drawer-section .toggle input:checked + .toggle-track { background: var(--drawer-accent); }
.device-directory .drawer-section .toggle input:checked ~ .toggle-thumb { transform: translateX(14px); }

.drawer-device-info {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin: 0;
}

.drawer-device-info > div {
  min-height: 53px;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid #e4ebee;
  border-radius: 6px;
  background: #f8fafb;
}

.drawer-device-info dt { color: var(--drawer-muted); font-size: 11.5px; }
.drawer-device-info dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
}

.drawer-device-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin: 8px 0 0;
  color: var(--drawer-muted);
  font-size: 11.5px;
}

.drawer-device-meta > div { display: flex; gap: 5px; min-width: 0; }
.drawer-device-meta dd { margin: 0; color: var(--drawer-ink); overflow-wrap: anywhere; }

.drawer-action-grid,
.drawer-category-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.device-directory .drawer-section .drawer-action-grid .cmd-btn {
  min-height: 53px;
  min-width: 0;
  justify-content: center;
  border: 1px solid var(--drawer-edge);
  background: #f7faf9;
  color: var(--drawer-accent);
  text-align: center;
}

.device-directory .drawer-section .drawer-action-grid .cmd-btn:hover { background: var(--drawer-tint); }
.device-directory .drawer-section .drawer-action-grid .cmd-btn.cmd-pending { color: #8a4f0d; background: #fff7e9; border-color: #ead6b6; }
.device-directory .drawer-section .drawer-action-grid .cmd-btn small { font-size: 10px; }
.drawer-card-note { margin-top: 7px; }

.drawer-category-grid button {
  display: flex;
  min-width: 0;
  min-height: 36px;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  padding: 6px 8px;
  border: 1px solid var(--drawer-edge);
  border-radius: 6px;
  background: #fff;
  color: var(--drawer-ink);
  font-size: 12px;
  font-weight: 600;
  text-align: left;
}

.drawer-category-grid button:hover { background: var(--drawer-tint); }
.drawer-category-grid button:last-child { grid-column: 1 / -1; }

.drawer-chevron {
  flex: 0 0 6px;
  width: 6px;
  height: 6px;
  margin-inline-end: 2px;
  border-top: 1.5px solid var(--drawer-muted);
  border-right: 1.5px solid var(--drawer-muted);
  transform: rotate(45deg);
}

.device-directory .drawer-section :is(.cmd-btn, .btn-small, .btn-sec, .btn-pri, .btn-wipe, .btn-cancel, .btn-send-msg, .btn-add-pkg, .btn-hide, .btn-disable, .pending-cancel, .domain-import-trigger) {
  min-height: 32px;
  max-width: 100%;
  padding: 5px 9px;
  border: 1px solid var(--drawer-edge);
  border-radius: 6px;
  background: #fff;
  color: var(--drawer-ink);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.3;
  white-space: normal;
  box-shadow: none;
}

.device-directory .drawer-section :is(.btn-pri, .btn-lock-dns, .btn-send-msg, .btn-add-pkg) {
  background: var(--drawer-accent);
  border-color: var(--drawer-accent);
  color: #fff;
}

.device-directory .drawer-section :is(.btn-pri, .btn-lock-dns, .btn-send-msg, .btn-add-pkg):hover {
  background: var(--drawer-accent-hover);
}

.device-directory .drawer-section :is(.btn-sec, .btn-cancel, .pending-cancel, .domain-import-trigger):hover { background: var(--drawer-bg); }
.device-directory .drawer-section .btn-wipe { border-color: #ebc9c9; background: var(--drawer-red-tint); color: var(--drawer-red); }
.device-directory .drawer-section .btn-wipe:hover { background: #fbe9e8; }
.device-directory .drawer-section button:disabled { opacity: .55; cursor: default; }

.device-directory .drawer-section :is(.btn-hide, .btn-disable).on {
  border-color: #b9d4cc;
  background: var(--drawer-tint);
  color: var(--drawer-accent);
}

.device-directory .drawer-section :is(.dns-row, .app-row, .time-range, .kiosk-add-row, .row-btns, .form-row) { flex-wrap: wrap; }
.device-directory .drawer-section :is(.dns-input, .input-field, .app-info) { min-width: 0; }
.device-directory .drawer-section :is(.app-label, .app-pkg, .policy-label, .policy-sub) { overflow-wrap: anywhere; }

.device-directory .drawer-section :is(input:not([type=checkbox], [type=radio], [type=file]), textarea, select) {
  max-width: 100%;
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid var(--drawer-edge);
  border-radius: 6px;
  background: #fff;
  color: var(--drawer-ink);
  font-size: 13px;
}

.device-directory .drawer-section :is(.net-section > .dns-row, .net-section .kiosk-status-bar, .net-section .kiosk-add-row, .net-section #inst-list) { padding: 0; }
.device-directory .drawer-section .net-section .app-search { margin: 5px 0 3px; width: 100%; }
.device-directory .drawer-section .net-section .cmd-grid { gap: 6px; margin: 7px 0 !important; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.device-directory .drawer-section .time-range { gap: 7px; padding: 5px 0 0; }
.device-directory .drawer-section .net-section:has(> .time-range) { display: flex; flex-direction: column; }
.device-directory .drawer-section .net-section > .time-range { margin-top: auto; }
.device-directory .drawer-section .time-range label { flex: 1 1 90px; min-width: 0; }
.device-directory .drawer-section .time-range input { width: 100%; }
.device-directory .drawer-section .domain-list { gap: 4px; }
.device-directory .drawer-section .msg-form { padding: 0; }
.device-directory .drawer-section .msg-form > .btn-send-msg { align-self: flex-end; }
.device-directory .drawer-section :is(.policy-section + .policy-section, .kiosk-section-hdr, .domain-import-trigger) { margin-top: 7px; }

.device-directory .drawer-section :is(.kiosk-status-sub, .kiosk-bar-desc, .kiosk-app-pkg, .kiosk-oneapp-sub, .kiosk-no-apps) {
  color: var(--drawer-muted);
  font-size: 12px;
}

.device-directory .drawer-section :is(#app-list, #inst-list, #limit-list, #wv-list) {
  max-block-size: min(44vh, 340px);
  overflow: auto;
}

.drawer-danger-heading {
  margin: 0;
  color: var(--drawer-red);
  font-size: 14px;
  font-weight: 720;
}

.device-directory .drawer-section .danger-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  border-color: #eddbdc;
}

.device-directory .drawer-section .danger-card .danger-title { color: var(--drawer-red); margin-bottom: 5px; }
.device-directory .drawer-section .danger-desc { color: var(--drawer-muted); font-size: 12px; line-height: 1.45; margin-bottom: 9px; }
.device-directory .drawer-section .danger-card > p { margin: 0 0 8px; color: var(--drawer-muted); font-size: 12px; }
.device-directory .drawer-section .danger-card > :is(.btn-wipe, .btn-cancel) { flex: 0 0 auto; margin-top: auto; }
.device-directory .drawer-section .danger-card .pending-cmds { margin-top: 8px !important; width: 100%; }

.device-directory .drawer-section .cmd-lockdown {
  min-height: 0;
  height: 100%;
  margin: 0;
  padding: 11px;
  border-color: #eddbdc;
  border-radius: 8px;
  background: var(--drawer-red-tint);
  color: var(--drawer-red);
}

.device-directory .drawer-section .cmd-lockdown .ld-sub { color: var(--drawer-muted); }
.device-directory .drawer-section :is(.managed-banner, .guard-warn) { margin: 0; font-size: 12px; }

#device-dialog #search-results {
  overflow: hidden;
  border: 1px solid var(--drawer-edge);
  border-radius: 8px;
  background: #fff;
}

.drawer-search-result {
  display: flex;
  width: 100%;
  min-height: 40px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 11px;
  border-bottom: 1px solid var(--drawer-edge);
  color: var(--drawer-ink);
  font-size: 13px;
  text-align: left;
}

.drawer-search-result:last-child { border-bottom: 0; }
.drawer-search-result span { color: var(--drawer-muted); font-size: 11.5px; text-align: right; }
.drawer-search-result:hover { background: var(--drawer-tint); }
#device-dialog #search-results > p { padding: 11px; margin: 0; }
.device-directory #device-dialog :focus-visible { outline: 2px solid #388377; outline-offset: 2px; }

@media (max-width: 719px) {
  .device-directory #device-dialog,
  .device-directory #dev-modal.settings-expanded #device-dialog { width: 100%; }
  .device-directory #device-dialog .modal-hdr { min-height: 66px; padding: 10px 12px; }
  .device-directory #device-settings-toolbar { flex-wrap: wrap; padding: 8px 12px; }
  .device-directory #settings-search,
  .device-directory #device-settings-picker { flex: 1 1 140px; width: auto; min-width: 0; }
  .device-directory #device-settings-picker { display: block; }
  .device-directory .group-sidebar { display: none; }
  .device-directory #group-content { padding: 12px 12px 22px; }
}

@media (prefers-reduced-motion: reduce) {
  .device-directory #device-dialog { animation: none; }
}
