/* Device tools use the customer portal's shared navigation and form controls. */
main { max-width: 600px; }
form#query {
  grid-template-columns: minmax(0,1fr);
  margin-top: 16px;
  padding: clamp(16px,4vw,28px);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow);
}
.credential p { margin-top: 7px; color: var(--muted); line-height: 1.5; font-size: 14px; }
.contact { padding: 3px; min-height: 32px; background: none; color: var(--accent); text-decoration: underline; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.toolbar button, .row-action, .dialog-head button {
  min-height: 38px; padding: 7px 10px; border: 1px solid var(--line); background: #fff; color: var(--accent);
}
.toolbar button:hover, .row-action:hover, .dialog-head button:hover { background: var(--soft); }
#devices { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; }
#devices li {
  display: grid; grid-template-columns: auto minmax(0,1fr);
  align-items: center; gap: 10px; padding: 12px;
  background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow-wrap: anywhere;
}
#devices li:not(.head):has(input:checked) { border-color: var(--accent); background: var(--soft); }
#devices .head { display: none; }
#devices input[type=checkbox], #body input[type=checkbox] {
  width: 18px; height: 18px; min-height: 0; margin: 0; accent-color: var(--accent);
}
.grade,.expiry { grid-column: 2; }
.grade small,.expiry small { display: block; color: var(--muted); font-size: 12px; }
.row-action { grid-column: 2; justify-self: start; }
#status { margin-top: 12px; color: var(--accent); overflow-wrap: anywhere; white-space: pre-line; }
#status.error { color: #a51d27; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
#body form { gap: 10px; margin-top: 12px; }
#body label { display: flex; gap: 10px; align-items: center; justify-content: space-between; }
#body label input:not([type=checkbox]),#body select { width: 65%; }
#body ul { max-height: 34svh; overflow: auto; }
#body li { overflow-wrap: anywhere; }
.dialog-status:empty { display: none; }
@media (max-width: 640px) {
  .toolbar { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); }
  .toolbar button { min-height: 44px; padding-inline: 3px; font-size: 14px; }
  .row-action, .dialog-head button { min-height: 44px; }
}
@media (min-width: 641px) {
  #devices li { grid-template-columns: 18px minmax(0,1fr) 64px 140px 76px; }
  #devices .head { display: grid; background: transparent; color: var(--muted); font-size: 14px; border-color: transparent; }
  .grade,.expiry,.row-action { grid-column: auto; }
  .grade small,.expiry small { display: none; }
  .row-action { font-size: 13px; white-space: nowrap; }
}
