:root {
  color-scheme: light;
  font-family: Inter, "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  color: #17202a;
  background: #f3f5f7;
  --surface: #ffffff;
  --border: #d8dde3;
  --muted: #66717d;
  --primary: #1769aa;
  --primary-hover: #105487;
  --success: #16845b;
  --danger: #b73832;
  --shadow: 0 10px 28px rgba(25, 38, 52, 0.12);
  --surface-muted: #f7f9fb;
  --line-subtle: #e8edf1;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: #f3f5f7;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
.open-kvm {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--primary);
  border-radius: 6px;
  color: #ffffff;
  background: var(--primary);
  cursor: pointer;
  font-weight: 650;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button:hover,
.open-kvm:hover {
  background: var(--primary-hover);
}

button:disabled {
  cursor: wait;
  opacity: 0.6;
}

button.secondary {
  color: #26323d;
  border-color: #b9c1ca;
  background: #ffffff;
}

button.secondary:hover {
  background: #edf1f4;
}

button.danger {
  color: var(--danger);
  border-color: #e0b6b3;
  background: #ffffff;
}

button.danger:hover {
  background: #fff0ef;
}

button.compact {
  min-width: 72px;
  padding: 0 12px;
}

.icon-button {
  width: 40px;
  min-width: 40px;
  padding: 0;
  border-color: transparent;
  color: #2f3943;
  background: transparent;
  font-size: 26px;
  line-height: 1;
}

.icon-button:hover {
  background: #edf1f4;
}

.topbar {
  height: 68px;
  padding: 0 max(20px, calc((100vw - 1560px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.brand,
.account {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: #ffffff;
  background: #202b35;
  font-weight: 800;
}

.brand div {
  display: grid;
  gap: 1px;
}

.brand span:last-child {
  color: var(--muted);
  font-size: 12px;
}

main {
  width: calc(100% - 40px);
  max-width: 1560px;
  margin: 0 auto;
  padding: 30px 0 56px;
}

.workspace-tabs {
  min-height: 45px;
  margin-bottom: 26px;
  display: flex;
  align-items: stretch;
  gap: 4px;
  border-bottom: 1px solid var(--border);
}

button.workspace-tab {
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  color: var(--muted);
  background: transparent;
  font-weight: 650;
}

button.workspace-tab:hover {
  color: #26323d;
  background: #e9edf1;
}

button.workspace-tab.active {
  border-bottom-color: var(--primary);
  color: var(--primary);
  background: transparent;
}

.workspace-view {
  min-width: 0;
}

.page-heading {
  margin-bottom: 24px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.heading-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

h1,
h2,
p {
  margin-top: 0;
}

.page-heading h1 {
  margin-bottom: 4px;
  font-size: 26px;
}

.page-heading p {
  margin-bottom: 0;
  color: var(--muted);
}

.device-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 16px;
}

.device-card {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.device-card > header,
.device-card > footer,
.device-title {
  display: flex;
  align-items: center;
}

.device-card > header {
  min-height: 49px;
  justify-content: space-between;
  gap: 16px;
}

.device-title {
  min-width: 0;
  gap: 11px;
}

.device-title > div {
  min-width: 0;
}

.device-name {
  margin-bottom: 4px;
  overflow: hidden;
  font-size: 17px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-uuid {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-dot {
  width: 11px;
  height: 11px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #aab2ba;
}

.device-card.online .status-dot {
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(22, 132, 91, 0.12);
}

.device-state {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 13px;
}

.device-card.online .device-state {
  color: var(--success);
}

.device-facts,
.provision-values {
  margin: 20px 0;
}

.device-facts div,
.provision-values div {
  min-height: 32px;
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #edf0f2;
}

dt {
  color: var(--muted);
  font-size: 13px;
}

dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  text-align: right;
}

.device-card > footer {
  flex-wrap: wrap;
  gap: 8px;
}

.data-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}

.data-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  table-layout: fixed;
}

.data-table th,
.data-table td {
  padding: 13px 14px;
  border-bottom: 1px solid #e7ebee;
  overflow-wrap: anywhere;
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  color: var(--muted);
  background: #f8f9fa;
  font-size: 12px;
  font-weight: 700;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr:hover {
  background: #f8fafb;
}

.data-table .primary-cell {
  color: #17202a;
  font-weight: 700;
}

.data-table .actions-heading {
  width: 150px;
  text-align: right;
}

.data-table .table-actions {
  width: 150px;
  text-align: right;
  white-space: nowrap;
}

button.table-action {
  min-width: 0;
  min-height: 32px;
  margin-left: 6px;
  padding: 0 10px;
  font-size: 12px;
}

.data-table .table-empty {
  height: 150px;
  color: var(--muted);
  text-align: center;
}

.empty-state {
  min-height: 240px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
  border: 1px dashed #bac2ca;
  color: var(--muted);
  background: #fafbfc;
}

.login-view {
  min-height: calc(100vh - 64px);
  padding: 28px 20px;
  display: grid;
  place-items: center;
}

.auth-card {
  width: min(390px, 100%);
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-tabs {
  margin: -8px 0 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--border);
}

button.auth-tab {
  min-height: 42px;
  padding: 0 12px;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  color: var(--muted);
  background: transparent;
}

button.auth-tab:hover {
  color: #26323d;
  background: #edf1f4;
}

button.auth-tab.active {
  border-bottom-color: var(--primary);
  color: var(--primary);
  background: transparent;
}

.auth-card form h1 {
  margin-bottom: 24px;
  font-size: 22px;
}

label {
  display: grid;
  gap: 7px;
  margin-bottom: 16px;
  color: #35414c;
  font-size: 13px;
  font-weight: 650;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #b8c1ca;
  border-radius: 5px;
  color: #18222c;
  background: #ffffff;
  outline: none;
}

input,
select {
  height: 42px;
  padding: 0 11px;
}

textarea {
  min-height: 76px;
  padding: 9px 11px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(23, 105, 170, 0.14);
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  padding: 0;
  accent-color: var(--primary);
}

.check-row {
  min-height: 32px;
  display: flex;
  align-items: center;
  gap: 9px;
}

fieldset {
  min-width: 0;
  margin: 4px 0 20px;
  padding: 0;
  border: 0;
}

legend {
  margin-bottom: 8px;
  color: #35414c;
  font-size: 13px;
  font-weight: 650;
}

.choice-list {
  max-height: 180px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 5px;
}

.choice-option {
  min-height: 42px;
  margin: 0;
  padding: 8px 11px;
  display: flex;
  align-items: center;
  gap: 9px;
  border-bottom: 1px solid #edf0f2;
  font-weight: 500;
}

.choice-option:last-child {
  border-bottom: 0;
}

.choice-option:hover {
  background: #f5f7f9;
}

.choice-empty {
  min-height: 70px;
  margin: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
}

.auth-card form > button {
  width: 100%;
}

.auth-card form > button + button,
.profile-form > button + .dialog-actions {
  margin-top: 12px;
}

.auth-card form > button + label {
  margin-top: 16px;
}

.message {
  min-height: 20px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.message.error {
  color: var(--danger);
}

.message.success {
  color: var(--success);
}

dialog {
  width: min(480px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: #17202a;
  background: var(--surface);
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(20, 28, 36, 0.48);
}

dialog form,
dialog > section {
  margin: 0;
  padding: 22px;
}

#user-dialog,
#profile-dialog,
#user-group-dialog,
#device-group-dialog {
  width: min(560px, calc(100vw - 32px));
  max-height: min(760px, calc(100vh - 32px));
  overflow-y: auto;
}

.profile-summary {
  margin-bottom: 24px;
}

.profile-form {
  margin: 0;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}

.profile-form + .profile-form {
  margin-top: 24px;
}

.profile-form h3 {
  margin: 0 0 16px;
  font-size: 16px;
}

.dialog-header {
  min-height: 40px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.dialog-header h2 {
  margin: 0;
  font-size: 19px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.dialog-intro {
  margin: -6px 0 16px;
  color: var(--muted);
}

.binding-summary {
  margin: 0 0 18px;
}

.binding-summary > div {
  min-height: 34px;
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}

.binding-summary dt {
  color: var(--muted);
  font-size: 13px;
}

.binding-summary dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  text-align: right;
}

.link-binding-actions .action-spacer {
  flex: 1 1 auto;
}

.token-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.binding-code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 22px;
  font-weight: 750;
  text-align: center;
  text-transform: uppercase;
}

.provision-values dd {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
}

[hidden] {
  display: none !important;
}

@media (max-width: 620px) {
  .topbar {
    height: auto;
    min-height: 64px;
    padding: 10px 14px;
  }

  .brand span:last-child,
  #account-name {
    display: none;
  }

  .account {
    gap: 6px;
  }

  #profile-button,
  #logout-button {
    padding: 0 10px;
  }

  main {
    padding: 24px 14px 40px;
  }

  .workspace-tabs {
    margin: 0 -14px 22px;
    padding: 0 10px;
    overflow-x: auto;
  }

  button.workspace-tab {
    flex: 0 0 auto;
    padding: 0 12px;
  }

  .page-heading {
    align-items: center;
  }

  .page-heading .heading-actions {
    flex: 0 0 auto;
  }

  .device-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .device-card {
    padding: 16px;
  }

  .device-card > footer > * {
    flex: 1 1 130px;
  }

  dialog form,
  dialog > section {
    padding: 18px;
  }
}

@media (max-width: 420px) {
  .brand > div {
    display: none;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    color: #e7ebee;
    background: #12171c;
    --surface: #1b2229;
    --border: #35404a;
    --muted: #a7b0b9;
    --primary: #3d91d5;
    --primary-hover: #56a5e2;
    --shadow: 0 12px 30px rgba(0, 0, 0, 0.36);
  }

  body {
    background: #12171c;
  }

  button.secondary,
  button.danger,
  input,
  select,
  textarea {
    color: #e7ebee;
    background: #202830;
  }

  button.secondary:hover,
  .icon-button:hover,
  button.auth-tab:hover,
  button.workspace-tab:hover {
    background: #2b353f;
  }

  button.danger:hover {
    background: #3a2526;
  }

  .empty-state {
    background: #171d23;
  }

  label {
    color: #d4d9de;
  }

  legend {
    color: #d4d9de;
  }

  .data-table th {
    background: #202830;
  }

  .data-table th,
  .data-table td,
  .device-facts div,
  .provision-values div,
  .choice-option {
    border-color: #303941;
  }

  .data-table tbody tr:hover,
  .choice-option:hover {
    background: #232c34;
  }

  .data-table .primary-cell {
    color: #e7ebee;
  }
}

/* Device workspace: compact controls, full-width table, and focused details. */
.device-toolbar {
  min-height: 64px;
  margin-bottom: 16px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 2px 8px rgba(25, 38, 52, 0.04);
}

.device-sort-controls,
.device-sort-controls label,
.device-view-switch {
  display: flex;
  align-items: center;
}

.device-sort-controls {
  min-width: 0;
  gap: 10px;
  flex-wrap: wrap;
}

.device-sort-controls label {
  gap: 7px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.device-sort-controls label > span,
.toolbar-label {
  white-space: nowrap;
}

.toolbar-label {
  color: #35414c;
  font-size: 13px;
  font-weight: 750;
}

.device-sort-controls select {
  width: auto;
  min-width: 128px;
  height: 36px;
  padding: 0 30px 0 11px;
  border-radius: 8px;
  background: var(--surface-muted);
  font-size: 13px;
}

.device-sort-controls label:last-of-type select {
  min-width: 88px;
}

.device-sort-hint {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.device-view-switch {
  flex: 0 0 auto;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-muted);
}

.device-view-switch button {
  min-height: 32px;
  padding: 0 13px;
  border-color: transparent;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 700;
}

.device-view-switch button:hover {
  color: #26323d;
  background: rgba(255, 255, 255, 0.72);
}

.device-view-switch button[aria-pressed="true"] {
  color: var(--primary);
  border-color: var(--border);
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(25, 38, 52, 0.1);
}

.device-table-wrap {
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(25, 38, 52, 0.04);
}

.device-table {
  min-width: 1080px;
  table-layout: fixed;
}

.device-table th,
.device-table td {
  padding: 13px 16px;
}

.device-table th {
  height: 44px;
  color: var(--muted);
  background: var(--surface-muted);
  letter-spacing: 0.01em;
}

.device-table th:nth-child(1) { width: 25%; }
.device-table th:nth-child(2) { width: 11%; }
.device-table th:nth-child(3) { width: 18%; }
.device-table th:nth-child(4) { width: 14%; }
.device-table th:nth-child(5) { width: 14%; }
.device-table th:nth-child(6) { width: 10%; }
.device-table th:nth-child(7) { width: 180px; }

.device-table td {
  height: 72px;
  color: #26323d;
  font-size: 13px;
}

.device-table tbody tr {
  transition: background-color 120ms ease;
}

.device-table tbody tr:hover {
  background: var(--surface-muted);
}

.device-identity-cell {
  min-width: 0;
}

.device-table .device-name {
  max-width: 100%;
  margin-bottom: 5px;
  overflow: hidden;
  color: #18232e;
  font-size: 14px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-table .device-uuid {
  max-width: 100%;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-status-cell {
  white-space: nowrap;
}

.device-status-cell .device-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-weight: 650;
}

.device-status-cell .device-state::before {
  width: 7px;
  height: 7px;
  display: inline-block;
  border-radius: 50%;
  background: #aab2ba;
  content: "";
}

.device-row.online .device-status-cell .device-state {
  color: var(--success);
}

.device-row.online .device-status-cell .device-state::before {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(22, 132, 91, 0.12);
}

.device-bound-at,
.device-last-accessed {
  overflow: hidden;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-local-ip {
  display: block;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  color: #344b5c;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  text-overflow: clip;
  white-space: nowrap;
  scrollbar-color: #9aa7b2 transparent;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  touch-action: pan-x;
}

.device-local-ip::-webkit-scrollbar {
  height: 6px;
}

.device-local-ip::-webkit-scrollbar-track {
  border-radius: 999px;
  background: var(--surface-muted);
}

.device-local-ip::-webkit-scrollbar-thumb {
  border: 1px solid var(--surface-muted);
  border-radius: 999px;
  background: #9aa7b2;
}

.device-local-ip:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.device-owner {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-viewer-count {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.device-row-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.device-row-actions > *,
.device-detail-actions > * {
  min-height: 34px;
  padding: 0 11px;
  font-size: 12px;
}

.device-row-actions .open-kvm {
  min-width: 78px;
}

.device-card {
  padding: 18px;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(25, 38, 52, 0.04);
}

.device-card > header {
  min-height: 44px;
}

.device-card .device-name {
  margin-bottom: 4px;
  font-size: 16px;
}

.device-card-facts {
  margin: 18px 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line-subtle);
  border-radius: 9px;
  background: var(--line-subtle);
}

.device-card-facts > div {
  min-width: 0;
  min-height: 58px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: var(--surface);
}

.device-card-facts span {
  color: var(--muted);
  font-size: 11px;
}

.device-card-facts strong {
  min-width: 0;
  color: #26323d;
  font-size: 12px;
  font-weight: 650;
}

.device-card-facts strong:not(.device-local-ip) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-card > footer {
  justify-content: flex-start;
  margin-top: 0;
  padding-top: 14px;
  border-top: 1px solid var(--line-subtle);
}

.device-card > footer > * {
  flex: 0 1 auto;
}

#device-detail-dialog {
  width: min(640px, calc(100vw - 32px));
  max-height: min(760px, calc(100vh - 32px));
  overflow-y: auto;
}

.device-detail-dialog {
  padding: 24px;
}

.device-detail-heading {
  min-width: 0;
}

.detail-eyebrow {
  display: block;
  margin-bottom: 5px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.04em;
}

.device-detail-heading h2 {
  max-width: 500px;
  margin: 0 0 5px;
  overflow: hidden;
  font-size: 21px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-detail-heading code {
  display: block;
  max-width: 500px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-detail-status {
  min-height: 42px;
  margin: -3px 0 18px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 9px;
  border-radius: 9px;
  background: var(--surface-muted);
}

.device-detail-status .status-dot.online {
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(22, 132, 91, 0.12);
}

.device-detail-status .status-dot:not(.online) {
  background: #aab2ba;
}

.muted-detail {
  color: var(--muted);
  font-size: 12px;
}

.device-detail-grid {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line-subtle);
  border-radius: 10px;
  background: var(--line-subtle);
}

.device-detail-grid > div {
  min-width: 0;
  min-height: 62px;
  padding: 11px 13px;
  background: var(--surface);
}

.device-detail-grid dt {
  margin-bottom: 6px;
  font-size: 11px;
}

.device-detail-grid dd {
  overflow-wrap: anywhere;
  color: #26323d;
  font-size: 13px;
  font-weight: 650;
  text-align: left;
}

.device-detail-actions {
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  flex-wrap: wrap;
}

.device-detail-actions .open-kvm {
  margin-right: auto;
}

.open-kvm[aria-disabled="true"] {
  color: var(--muted);
  border-color: var(--border);
  background: var(--surface-muted);
  cursor: not-allowed;
}

.open-kvm[aria-busy="true"] {
  cursor: wait;
  opacity: 0.65;
}

@media (max-width: 900px) {
  .device-toolbar {
    align-items: flex-start;
  }

  .device-sort-hint {
    display: none;
  }
}

@media (max-width: 620px) {
  main {
    width: calc(100% - 28px);
    padding: 24px 0 40px;
  }

  .device-toolbar {
    align-items: stretch;
    gap: 10px;
  }

  .device-sort-controls {
    align-items: flex-start;
  }

  .device-sort-controls label {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .device-sort-controls select {
    min-width: 112px;
  }

  .device-view-switch {
    align-self: flex-start;
  }

  .device-detail-grid {
    grid-template-columns: 1fr;
  }

  .device-detail-dialog {
    padding: 18px;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --surface-muted: #202830;
    --line-subtle: #303941;
  }

  .toolbar-label,
  .device-table .device-name,
  .device-detail-grid dd,
  .device-card-facts strong {
    color: #e7ebee;
  }

  .device-table td {
    color: #d4d9de;
  }

  .device-view-switch button:hover {
    color: #e7ebee;
    background: #2b353f;
  }
}
