/* Nightwatch console styles. One hand-written system: tokens first, then layout, then components.
   Written mobile-first; the navigation is a drawer on phones and a collapsible sidebar from 768px. */

/* Inter is served from this server so the console never calls an external font service. */
@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --dg-bg: #f6f7f9;
  --dg-surface: #ffffff;
  --dg-subtle: #f9fafb;
  --dg-line: #eaecf0;
  --dg-line-strong: #d0d5dd;
  --dg-ink: #101828;
  --dg-ink-2: #344054;
  --dg-muted: #667085;
  --dg-primary: #7f56d9;
  --dg-primary-strong: #6941c6;
  --dg-primary-soft: #f4ebff;
  --dg-primary-softer: #f9f5ff;
  --dg-primary-line: #d6bbfb;
  --dg-blue: #1570ef;
  --dg-green: #17b26a;
  --dg-orange: #ef6820;
  --dg-red: #d92d20;
  --dg-warn-ink: #b54708;
  --dg-radius: 12px;
  --dg-radius-control: 8px;
  --dg-shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
  --dg-shadow-lg: 0 12px 16px -4px rgba(16, 24, 40, 0.08), 0 4px 6px -2px rgba(16, 24, 40, 0.03);
  --dg-ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --dg-topbar-height: 60px;
  --dg-rail-width: 64px;
  --dg-nav-width: 232px;
}

/* ---------- Base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* No rubber-band bounce when the page is scrolled past its top or bottom (a Mac's trackpad): it shook
   the sticky top bar and table headers (owner). Also turns off pull-to-refresh on phones; the console
   refreshes itself. */
html,
body {
  overscroll-behavior: none;
}

html {
  -webkit-text-size-adjust: 100%;
  caret-color: var(--dg-primary);
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--dg-bg);
  color: var(--dg-ink);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 0.875rem;
  line-height: 1.45;
  font-feature-settings: "cv03", "cv04", "cv11";
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--dg-primary-soft);
}

:focus-visible {
  outline: 2px solid var(--dg-primary);
  outline-offset: 2px;
}

a {
  color: var(--dg-primary-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

h1,
h2,
p {
  margin: 0;
}

.dg-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Keyboard users can jump past the navigation; the link shows only when focused. */
.dg-skip {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 40;
  padding: 0.5rem 0.75rem;
  border-radius: var(--dg-radius-control);
  background: var(--dg-ink);
  color: #fff;
  transform: translateY(-200%);
}

.dg-skip:focus {
  transform: none;
}

.dg-icon {
  flex: none;
  width: 20px;
  height: 20px;
  stroke-width: 1.75;
}

/* ---------- Shell: top bar and navigation ---------- */

.dg-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 0.875rem;
  height: var(--dg-topbar-height);
  padding: 0 1rem;
  background: var(--dg-surface);
  border-bottom: 1px solid var(--dg-line);
}

.dg-logo {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  /* Night sky behind the wolf, so its violet eye stands out. */
  background: linear-gradient(160deg, #2e1f5e, #0f0b1f);
  color: #fff;
}

.dg-logo img {
  display: block;
  width: 32px;
  height: 32px;
}

/* The menu button needs the script, so it only appears once the page knows scripts run. */
.dg-nav-toggle {
  display: none;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--dg-ink-2);
  cursor: pointer;
  transition: background-color 150ms ease;
}

.dg-js .dg-nav-toggle {
  display: grid;
}

.dg-home {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex: none;
  color: var(--dg-ink);
  text-decoration: none;
}

.dg-wordmark {
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

@media (hover: hover) and (pointer: fine) {
  .dg-nav-toggle:hover {
    background: #eef0f3;
  }
}

.dg-topbar-divider {
  flex: none;
  width: 1px;
  height: 24px;
  background: var(--dg-line);
}

.dg-topbar-title {
  min-width: 0;
  overflow: hidden;
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dg-topbar-title a {
  color: var(--dg-muted);
  font-weight: 500;
  text-decoration: none;
}

.dg-topbar-title .dg-icon {
  width: 16px;
  height: 16px;
  margin: 0 0.125rem;
  color: var(--dg-muted);
  vertical-align: -2px;
}

/* The parent page in the title: its name on a wide screen, a back arrow on a phone (below). */
.dg-crumb-back {
  display: none;
}

@media (max-width: 599px) {
  .dg-crumb {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    margin: 0 0.125rem 0 -0.375rem;
    border-radius: 999px;
    vertical-align: middle;
  }

  .dg-crumb-back {
    display: contents;
  }

  .dg-crumb .dg-icon {
    width: 22px;
    height: 22px;
    margin: 0;
  }

  .dg-crumb-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .dg-crumb-sep {
    display: none;
  }

  /* Room for the page's own name: no divider, and the avatar alone opens the account menu. */
  .dg-topbar {
    gap: 0.625rem;
  }

  .dg-topbar-divider,
  .dg-user > .dg-icon {
    display: none;
  }
}

.dg-user {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-left: auto;
  font-weight: 500;
}

.dg-avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--dg-primary-soft);
  color: var(--dg-primary-strong);
  font-size: 0.8125rem;
  font-weight: 600;
}

.dg-user-name {
  display: none;
}

.dg-user-role {
  display: none;
  font-size: 0.6875rem;
  font-weight: 400;
  color: var(--dg-muted);
  line-height: 1.2;
}

/* Account menu in the top bar: a native disclosure, so it needs no script. */
.dg-user-menu {
  position: relative;
  margin-left: auto;
}

.dg-user-menu > summary {
  list-style: none;
  cursor: pointer;
  margin-left: 0;
}

.dg-user-menu > summary::-webkit-details-marker {
  display: none;
}

.dg-user-menu > summary > .dg-icon {
  width: 16px;
  height: 16px;
  color: var(--dg-muted);
}

.dg-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 200px;
  padding: 6px;
  background: var(--dg-surface);
  border: 1px solid var(--dg-line);
  border-radius: 10px;
  box-shadow: var(--dg-shadow-lg);
  z-index: 30;
  transform-origin: top right;
  animation: dg-menu-in 140ms var(--dg-ease-out);
}

@keyframes dg-menu-in {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.97);
  }
}

.dg-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.dg-menu-item:hover {
  background: var(--dg-subtle);
}

/* Rename control in the top bar, right of the page title (device page): a small round pencil that
   opens a one-field box underneath. A details element, so it needs no script. */
.dg-rename {
  position: relative;
  flex: none;
  margin-left: 0.25rem;
}

.dg-rename > summary {
  list-style: none;
}

.dg-rename > summary::-webkit-details-marker {
  display: none;
}

.dg-rename-button {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--dg-line-strong);
  border-radius: 999px;
  background: var(--dg-surface);
  color: var(--dg-muted);
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
}

.dg-rename-button:hover,
.dg-rename[open] > .dg-rename-button {
  border-color: var(--dg-primary-line);
  background: var(--dg-primary-softer);
  color: var(--dg-primary-strong);
}

.dg-rename-button .dg-icon {
  width: 15px;
  height: 15px;
}

.dg-rename-box {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 30;
  display: grid;
  gap: 0.5rem;
  width: min(320px, calc(100vw - 32px));
  padding: 0.875rem;
  border: 1px solid var(--dg-line);
  border-radius: var(--dg-radius);
  background: var(--dg-surface);
  box-shadow: var(--dg-shadow-lg);
}

/* On a phone the pencil sits too far right for a box that opens rightwards: the box spans the top bar
   instead (the sticky top bar is what it is placed against once .dg-rename is no longer). */
@media (max-width: 599px) {
  .dg-rename {
    position: static;
  }

  .dg-rename-box {
    top: calc(100% + 4px);
    right: 0.75rem;
    left: 0.75rem;
    width: auto;
  }
}

.dg-rename-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--dg-ink-2);
}

.dg-rename-hint {
  font-size: 0.75rem;
  color: var(--dg-muted);
}

.dg-rename-actions {
  display: flex;
  justify-content: flex-end;
}

/* Sign out is the one red entry in the account menu and the navigation, so it is never clicked by
   mistake for a page link. The word stays; the colour only adds to it. */
.dg-menu-item-danger,
.dg-nav-link-danger {
  color: var(--dg-red);
}

.dg-menu-item-danger:hover {
  background: color-mix(in srgb, var(--dg-red) 8%, var(--dg-surface));
  color: var(--dg-red);
}

@media (hover: hover) and (pointer: fine) {
  .dg-nav-link-danger:hover,
  .dg-nav-link-danger:hover .dg-nav-icon {
    background: color-mix(in srgb, var(--dg-red) 8%, var(--dg-surface));
    color: var(--dg-red);
  }
}

/* Main navigation. Without scripts it is a bottom bar on phones. With scripts it is a drawer that
   slides in from the left on phones. From 768px it is a sidebar with labels that the menu button
   collapses to an icon rail; the choice is kept in localStorage and applied before the first paint. */

.dg-nav {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 20;
  display: flex;
  justify-content: space-around;
  padding: 0.375rem 0.5rem calc(0.375rem + env(safe-area-inset-bottom));
  background: var(--dg-surface);
  border-top: 1px solid var(--dg-line);
}

.dg-nav form {
  display: contents;
}

.dg-nav-head,
.dg-nav-heading,
.dg-nav-sep,
.dg-nav-backdrop {
  display: none;
}

.dg-nav-link {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 64px;
  padding: 0.25rem 0.5rem;
  border: 0;
  background: none;
  color: var(--dg-muted);
  font: inherit;
  font-size: 0.6875rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}

.dg-nav-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 32px;
  border-radius: 8px;
  transition: background-color 150ms ease, color 150ms ease;
}

.dg-nav-link.is-active {
  color: var(--dg-primary-strong);
}

.dg-nav-link.is-active .dg-nav-icon {
  background: var(--dg-primary-soft);
}

.dg-nav-heading {
  padding: 0.875rem 0.625rem 0.375rem;
  color: var(--dg-muted);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: opacity 150ms ease;
}

.dg-nav-sep {
  height: 1px;
  margin: 0.75rem 0.5rem;
  background: var(--dg-line);
}

.dg-nav-close {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--dg-muted);
  cursor: pointer;
}

.dg-main {
  padding: 1rem 1rem calc(5.5rem + env(safe-area-inset-bottom));
  /* A short fade on every page load so moving between pages feels continuous. Fill mode
     "backwards" leaves no transform behind, which would break position: fixed inside the page. */
  animation: dg-page-in 220ms var(--dg-ease-out) backwards;
  /* Pages size their tables and columns by the room left beside the sidebar, open or collapsed,
     not by the window. Nothing inside the page may use position: fixed (containment would break it). */
  container: dg-main / inline-size;
}

@keyframes dg-page-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

/* Phones with scripts: the links live in a drawer that slides in over a dimmed page. */
@media (max-width: 767.98px) {
  .dg-js .dg-nav {
    inset: 0 auto 0 0;
    z-index: 40;
    flex-direction: column;
    justify-content: flex-start;
    gap: 2px;
    width: min(280px, 85vw);
    padding: 0.75rem 0.75rem calc(1rem + env(safe-area-inset-bottom));
    overflow-y: auto;
    border-top: 0;
    border-right: 1px solid var(--dg-line);
    box-shadow: var(--dg-shadow-lg);
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform 240ms var(--dg-ease-out), visibility 0s 240ms;
  }

  .dg-nav-open .dg-nav {
    transform: none;
    visibility: visible;
    transition: transform 240ms var(--dg-ease-out), visibility 0s;
  }

  .dg-js .dg-nav-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.25rem;
    padding: 0 0 0.75rem 0.25rem;
    border-bottom: 1px solid var(--dg-line);
  }

  .dg-js .dg-nav-heading,
  .dg-js .dg-nav-sep {
    display: block;
  }

  .dg-js .dg-nav-link {
    flex-direction: row;
    gap: 0.75rem;
    min-width: 0;
    min-height: 44px;
    padding: 0 0.5rem;
    border-radius: 8px;
    color: var(--dg-ink-2);
    font-size: 0.9375rem;
    transition: background-color 150ms ease, color 150ms ease;
  }

  .dg-js .dg-nav-icon {
    width: 24px;
    height: 24px;
  }

  .dg-js .dg-nav-link.is-active {
    background: var(--dg-primary-soft);
  }

  .dg-js .dg-nav-link.is-active .dg-nav-icon {
    background: none;
  }

  .dg-js .dg-nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(16, 24, 40, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 240ms var(--dg-ease-out);
  }

  .dg-nav-open .dg-nav-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .dg-nav-open body {
    overflow: hidden;
  }

  .dg-js .dg-main {
    padding-bottom: calc(2rem + env(safe-area-inset-bottom));
  }

  .dg-topbar .dg-wordmark {
    display: none;
  }
}

/* From 768px: a sidebar with labels, collapsible to an icon rail. */
@media (min-width: 768px) {
  .dg-topbar {
    padding: 0 1.5rem 0 0.875rem;
  }

  .dg-user-name {
    display: block;
    line-height: 1.2;
  }

  .dg-user-role {
    display: block;
  }

  .dg-nav {
    inset: var(--dg-topbar-height) auto 0 0;
    flex-direction: column;
    justify-content: flex-start;
    gap: 2px;
    width: var(--dg-nav-width);
    padding: 0.5rem 0.75rem 1rem;
    overflow-x: hidden;
    overflow-y: auto;
    border-top: 0;
    border-right: 1px solid var(--dg-line);
    transition: width 220ms var(--dg-ease-out);
  }

  .dg-nav-heading,
  .dg-nav-sep {
    display: block;
  }

  .dg-nav-link {
    flex-direction: row;
    gap: 0.75rem;
    min-width: 0;
    min-height: 40px;
    padding: 0 0.5rem;
    border-radius: 8px;
    color: var(--dg-ink-2);
    font-size: 0.875rem;
    white-space: nowrap;
    transition: background-color 150ms ease, color 150ms ease;
  }

  .dg-nav-icon {
    width: 24px;
    height: 24px;
  }

  .dg-nav-label {
    transition: opacity 150ms ease;
  }

  .dg-nav-link.is-active {
    background: var(--dg-primary-soft);
  }

  .dg-nav-link.is-active .dg-nav-icon {
    background: none;
  }

  /* The marker on the screen edge shows which section is open. */
  .dg-nav-link.is-active::before {
    content: "";
    position: absolute;
    top: 6px;
    bottom: 6px;
    left: -0.75rem;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--dg-primary);
  }

  .dg-main {
    margin-left: var(--dg-nav-width);
    padding: 1.5rem;
    transition: margin-left 220ms var(--dg-ease-out);
  }

  /* Collapsed: the same rows with only the icons; each link keeps its title as a tooltip. */
  .dg-nav-collapsed .dg-nav {
    width: var(--dg-rail-width);
  }

  .dg-nav-collapsed .dg-nav-link {
    width: 40px;
  }

  .dg-nav-collapsed .dg-nav-label,
  .dg-nav-collapsed .dg-nav-heading {
    opacity: 0;
  }

  .dg-nav-collapsed .dg-main {
    margin-left: var(--dg-rail-width);
  }
}

@media (hover: hover) and (pointer: fine) {
  .dg-nav-link:hover .dg-nav-icon {
    background: #eef0f3;
    color: var(--dg-ink-2);
  }

  .dg-nav-link.is-active:hover .dg-nav-icon {
    background: var(--dg-primary-soft);
    color: var(--dg-primary-strong);
  }

  .dg-nav-close:hover {
    background: #eef0f3;
    color: var(--dg-ink-2);
  }
}

/* Where a link is a full row (sidebar, and the phone drawer), the whole row lights up on hover. */
@media (hover: hover) and (pointer: fine) and (min-width: 768px) {
  .dg-nav-link:hover {
    background: #f2f4f7;
    color: var(--dg-ink);
  }

  .dg-nav-link.is-active:hover {
    background: var(--dg-primary-soft);
    color: var(--dg-primary-strong);
  }

  .dg-nav-link:hover .dg-nav-icon,
  .dg-nav-link.is-active:hover .dg-nav-icon {
    background: none;
    color: inherit;
  }
}

/* ---------- Page layout helpers ---------- */

/* The one column is capped at the page width, so a wide table scrolls inside its own card instead
   of widening the column and with it every other card in the stack. */
.dg-stack {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  min-width: 0;
}

/* Always-rendered wrapper of a live part that is present only sometimes; adds no box, so layouts and gaps stay as they are. */
.dg-live-slot {
  display: contents;
}

.dg-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
}

.dg-columns > * {
  min-width: 0;
}

/* The side panel holds a short form, so it comes first on narrow screens. */
.dg-side {
  order: -1;
}

@container dg-main (min-width: 990px) {
  .dg-columns {
    grid-template-columns: minmax(0, 1fr) 300px;
    align-items: start;
  }

  .dg-side {
    order: 0;
  }
}

/* ---------- Cards ---------- */

.dg-card {
  background: var(--dg-surface);
  border: 1px solid var(--dg-line);
  border-radius: var(--dg-radius);
}

.dg-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  padding: 1rem 1.125rem 0.875rem;
}

.dg-card-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

/* A card heading on a grey strip with a coloured icon square, so cards stay apart on a long
   page (the device page). Content that brings its own top line loses it below the strip. */
.dg-card-band {
  border-bottom: 1px solid var(--dg-line);
  border-radius: calc(var(--dg-radius) - 1px) calc(var(--dg-radius) - 1px) 0 0;
  background: var(--dg-subtle);
}

.dg-card-lead {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  min-width: 0;
}

.dg-card-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: var(--dg-radius-control);
  background: var(--dg-primary-soft);
  color: var(--dg-primary-strong);
}

.dg-card-icon-red {
  background: #fee4e2;
  color: #b42318;
}

.dg-card-icon-orange {
  background: #fdead7;
  color: #b93815;
}

.dg-card-icon-blue {
  background: #d1e9ff;
  color: #175cd3;
}

.dg-card-icon-green {
  background: #d1fadf;
  color: #067647;
}

.dg-card-band + :is(.dg-card-body, .dg-problems) {
  padding-top: 1rem;
}

.dg-card-band + .dg-system-tabs {
  margin-top: 1rem;
}

.dg-card-band + .dg-empty,
.dg-card-band + [data-dg-poll] > .dg-empty,
.dg-card-band + .dg-table-wrap th,
.dg-card-band + [data-dg-poll] > .dg-table-wrap th,
.dg-card-band + .dg-table-wrap tbody tr:first-child,
.dg-card-band + [data-dg-poll] > .dg-table-wrap tbody tr:first-child,
.dg-card-band + .dg-changes > li:first-child {
  border-top: 0;
}

/* A small capitalised label with a line to its right that groups the cards below it. */
.dg-group-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0;
  color: var(--dg-muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.dg-group-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--dg-line);
}

.dg-group-title:not(:first-child) {
  margin-top: 0.75rem;
}

.dg-card-sub {
  margin-top: 0.25rem;
  color: var(--dg-muted);
  font-size: 0.8125rem;
}

.dg-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.dg-card-body {
  padding: 0 1.125rem 1.125rem;
}

.dg-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.125rem;
  border-top: 1px solid var(--dg-line);
  color: var(--dg-ink-2);
  font-weight: 500;
}

.dg-count {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--dg-primary-softer);
  color: var(--dg-primary-strong);
  font-size: 0.75rem;
  font-weight: 500;
}

/* ---------- Stat cards ---------- */

.dg-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.dg-stat {
  padding: 0.875rem 1rem;
}

.dg-stat-top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.dg-stat-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--dg-tone);
  color: #fff;
}

.dg-stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.dg-stat-label {
  color: var(--dg-ink-2);
  font-size: 0.8125rem;
}

.dg-stat-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-height: 40px;
  margin-top: 0.625rem;
  color: var(--dg-ink-2);
  font-size: 0.75rem;
  font-weight: 500;
}

/* A ring that fills to --value percent. */
.dg-ring {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: conic-gradient(var(--dg-tone) calc(var(--value) * 1%), #eef0f4 0);
  font-size: 0.625rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.dg-ring::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: var(--dg-surface);
}

.dg-ring span {
  position: relative;
}

/* ---------- Buttons ---------- */

.dg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 38px;
  padding: 0 0.875rem;
  border: 1px solid var(--dg-line-strong);
  border-radius: var(--dg-radius-control);
  background: var(--dg-surface);
  box-shadow: var(--dg-shadow-xs);
  color: var(--dg-ink-2);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, transform 160ms var(--dg-ease-out);
}

.dg-btn:active {
  transform: scale(0.97);
}

.dg-btn[aria-disabled="true"] {
  color: #98a2b3;
  pointer-events: none;
}

.dg-btn-primary {
  border-color: var(--dg-primary);
  background: var(--dg-primary);
  color: #fff;
}

.dg-btn-outline {
  border-color: var(--dg-primary);
  color: var(--dg-primary-strong);
}

.dg-btn-danger {
  border-color: var(--dg-red);
  color: var(--dg-red);
  background: var(--dg-surface);
}

.dg-btn-danger:hover {
  background: color-mix(in srgb, var(--dg-red) 8%, var(--dg-surface));
}

.dg-btn-block {
  width: 100%;
}

/* An on/off switch. It is a submit button: a click posts the opposite state, so it works without script.
   The word next to the track carries the state; colour alone never does. */
.dg-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 38px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--dg-ink-2);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.dg-switch-track {
  position: relative;
  flex: none;
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: var(--dg-line-strong);
  transition: background-color 150ms ease;
}

.dg-switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--dg-surface);
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.1), 0 1px 2px rgba(16, 24, 40, 0.06);
  transition: transform 160ms var(--dg-ease-out);
}

.dg-switch[aria-checked="true"] .dg-switch-track {
  background: var(--dg-primary);
}

.dg-switch[aria-checked="true"] .dg-switch-track::after {
  transform: translateX(16px);
}

.dg-switch:hover .dg-switch-track {
  background: #98a2b3;
}

.dg-switch[aria-checked="true"]:hover .dg-switch-track {
  background: var(--dg-primary-strong);
}

/* The outline goes round the track, not the whole row. */
.dg-switch:focus-visible {
  outline: none;
}

.dg-switch:focus-visible .dg-switch-track {
  outline: 2px solid var(--dg-primary);
  outline-offset: 2px;
}

/* Protection actions (device page, branch page): the everyday ones are real buttons in a grid, each with one short
   muted line under it saying what it does, why it is not available, or what is waiting for the PC. Colour follows how
   severe the action is (blue reversible, green undo, red outline cannot be undone) and the label says so in words.
   A destructive one ends in "…" and opens its confirmation panel below the grid through the URL fragment (no script
   needed) or stays open after a refusal. */
.dg-actions-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
}

@container dg-main (min-width: 560px) {
  .dg-actions-main {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* The branch page's Lock, Unlock and Soft wipe side by side. */
  .dg-actions-main-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* A note about the PC's state (locked itself, wiped from the keyboard) sits above the buttons. */
p + .dg-actions-main {
  margin-top: 0.875rem;
}

.dg-action-cell {
  min-width: 0;
}

.dg-action-btn {
  --dg-action-ring: var(--dg-ink-2);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  min-height: 44px;
  padding: 0.5rem 1rem;
  border: 1px solid #e4e7ec;
  border-radius: var(--dg-radius-control);
  background: #f2f4f7;
  color: #98a2b3;
  font: inherit;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, transform 160ms var(--dg-ease-out);
}

.dg-action-btn .dg-icon {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

.dg-action-btn:focus-visible {
  outline: 2px solid var(--dg-action-ring);
  outline-offset: 2px;
}

.dg-action-btn:active {
  transform: scale(0.98);
}

.dg-action-btn-azure {
  --dg-action-ring: #1570ef;
  border-color: #1570ef;
  background: #1570ef;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.12);
  color: #fff;
}

.dg-action-btn-green {
  --dg-action-ring: #067647;
  border-color: #067647;
  background: #067647;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.12);
  color: #fff;
}

.dg-action-btn-red {
  --dg-action-ring: #d92d20;
  border-color: #fda29b;
  background: var(--dg-surface);
  box-shadow: var(--dg-shadow-xs);
  color: #b42318;
}

@media (hover: hover) and (pointer: fine) {
  .dg-action-btn-azure:hover {
    border-color: #175cd3;
    background: #175cd3;
  }

  .dg-action-btn-green:hover {
    border-color: #05603a;
    background: #05603a;
  }

  .dg-action-btn-red:hover {
    border-color: #f97066;
    background: #fef3f2;
  }
}

/* Not available: grey, no pointer, no press; the line under it says why. */
.dg-action-btn[aria-disabled="true"] {
  border-color: #e4e7ec;
  background: #f2f4f7;
  box-shadow: none;
  color: #98a2b3;
  cursor: not-allowed;
}

.dg-action-btn[aria-disabled="true"]:active {
  transform: none;
}

.dg-action-hint {
  margin: 0.375rem 0 0;
  color: var(--dg-muted);
  font-size: 0.8125rem;
  line-height: 1.4;
}

/* The footer row under the buttons: the "More actions" fold on the left, Remove as a quiet red button on the right.
   The fold spans the whole row, so when it opens its rows appear below the row at full width; Remove sits on top of
   the fold's first line, level with its summary. */
.dg-actions-foot {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--dg-line);
}

.dg-actions-foot > .dg-more-actions {
  grid-column: 1 / -1;
  grid-row: 1;
}

.dg-actions-foot-end {
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 0.25rem 0.5rem;
  grid-column: 2;
  grid-row: 1;
  min-height: 36px;
}

.dg-remove-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  min-height: 36px;
  padding: 0 0.5rem;
  border-radius: var(--dg-radius-control);
  color: #b42318;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 150ms ease, transform 160ms var(--dg-ease-out);
}

.dg-remove-btn .dg-icon {
  width: 16px;
  height: 16px;
  stroke-width: 2;
}

.dg-remove-btn:focus-visible {
  outline: 2px solid #d92d20;
  outline-offset: 2px;
}

.dg-remove-btn:active {
  transform: scale(0.97);
}

@media (hover: hover) and (pointer: fine) {
  .dg-remove-btn:hover {
    background: #fef3f2;
  }
}

.dg-remove-note {
  color: var(--dg-muted);
  font-size: 0.75rem;
  white-space: nowrap;
}

/* Where the row gets tight the fold's hint gives way to the "agent update needed" note; on a phone the fold and
   Remove stack. */
@container dg-main (max-width: 759.98px) {
  .dg-actions-foot:has(.dg-remove-note) .dg-more-actions-hint {
    display: none;
  }
}

@container dg-main (max-width: 479.98px) {
  .dg-actions-foot {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 0.5rem;
  }

  .dg-actions-foot-end {
    grid-column: 1;
    grid-row: 2;
    flex-wrap: wrap;
  }

  .dg-remove-btn {
    margin-left: -0.5rem;
  }
}

/* Hard lock and Full wipe: closed by default behind a grey outline button, one slim row each with its own button. */
.dg-more-actions > summary {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.125rem 0.5rem;
  min-height: 36px;
  padding: 0.25rem 0.875rem;
  border: 1px solid var(--dg-line-strong);
  border-radius: var(--dg-radius-control);
  background: var(--dg-surface);
  box-shadow: var(--dg-shadow-xs);
  color: var(--dg-ink-2);
  font-weight: 600;
  list-style: none;
  cursor: pointer;
  transition: background-color 150ms ease;
}

.dg-more-actions > summary::-webkit-details-marker {
  display: none;
}

@media (hover: hover) and (pointer: fine) {
  .dg-more-actions > summary:hover {
    background: var(--dg-subtle);
  }
}

.dg-more-actions > summary .dg-icon {
  width: 18px;
  height: 18px;
  color: var(--dg-muted);
  transform: rotate(-90deg);
  transition: transform 150ms ease;
}

.dg-more-actions[open] > summary .dg-icon {
  transform: none;
}

.dg-more-actions-hint {
  color: var(--dg-muted);
  font-size: 0.8125rem;
  font-weight: 400;
}

.dg-more-actions-body {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.dg-more-actions-body .dg-action-panel {
  margin-top: 0;
}

/* A row's icon takes the action's colour (dg-action-orange, -red-strong); its name and text stay neutral. */
.dg-action-row {
  --dg-action-icon-bg: var(--dg-ink-2);
  --dg-action-icon-ink: #fff;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--dg-line);
  border-radius: var(--dg-radius);
  background: var(--dg-surface);
}

.dg-action-row.dg-action-orange {
  --dg-action-icon-bg: #dc6803;
}

.dg-action-row.dg-action-red-strong {
  --dg-action-icon-bg: #b42318;
}

.dg-action-row .dg-action-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--dg-action-icon-bg);
  color: var(--dg-action-icon-ink);
}

.dg-action-row .dg-action-icon .dg-icon {
  width: 16px;
  height: 16px;
}

.dg-action-row-text {
  flex: 1 1 14rem;
  min-width: 0;
}

.dg-action-row-text .dg-action-name {
  display: block;
  color: var(--dg-ink);
  font-weight: 600;
}

.dg-action-row-text .dg-action-text {
  display: block;
  color: var(--dg-muted);
  font-size: 0.75rem;
  line-height: 1.4;
}

.dg-action-row[aria-disabled="true"] {
  --dg-action-icon-bg: #e4e7ec;
  --dg-action-icon-ink: #98a2b3;
  border-style: dashed;
  background: #f9fafb;
}

.dg-action-panel {
  display: none;
  margin-top: 0.875rem;
  padding: 0.875rem 1rem;
  border: 1px solid var(--dg-line);
  border-radius: var(--dg-radius);
  background: var(--dg-subtle);
}

.dg-action-panel:target,
.dg-action-panel.is-open {
  display: block;
  animation: dg-panel-in 220ms var(--dg-ease-out);
}

/* With scripts the panels open by class (site.js), so a fragment left in the address never holds one open. */
.dg-js .dg-action-panel:target:not(.is-open) {
  display: none;
}

/* Stops below the sticky top bar when scrolled into view. */
.dg-action-panel {
  scroll-margin: calc(var(--dg-topbar-height) + 1rem) 0 1rem;
}

@keyframes dg-panel-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.dg-action-panel h3 {
  margin: 0 0 0.25rem;
  font-size: 0.9375rem;
  font-weight: 600;
}

.dg-action-panel p {
  margin: 0 0 0.75rem;
  color: var(--dg-ink-2);
}

.dg-action-panel-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

/* A box that changes what the confirmation does ("Remove anyway") gets a line of its own. */
.dg-action-panel-form .dg-check-line {
  flex-basis: 100%;
}

/* The form's gap spaces its boxes; the stacked-box margin would lift one off the line. */
.dg-action-panel-form .dg-check + .dg-check {
  margin-top: 0;
}

.dg-action-panel-form .dg-input {
  flex: 1 1 200px;
  max-width: 280px;
}

/* The Run PowerShell script box takes the whole panel width, on a line of its own. */
.dg-action-panel-form .dg-textarea {
  flex-basis: 100%;
  max-width: none;
}

.dg-icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: var(--dg-radius-control);
  background: none;
  color: var(--dg-muted);
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease, transform 160ms var(--dg-ease-out);
}

.dg-icon-btn:active {
  transform: scale(0.94);
}

@media (hover: hover) and (pointer: fine) {
  .dg-btn:hover {
    background: var(--dg-subtle);
  }

  .dg-btn-primary:hover {
    border-color: var(--dg-primary-strong);
    background: var(--dg-primary-strong);
  }

  .dg-btn-outline:hover {
    background: var(--dg-primary-softer);
  }

  .dg-icon-btn:hover {
    background: #f2f4f7;
    color: var(--dg-ink-2);
  }

  .dg-icon-btn-danger:hover {
    background: #fef3f2;
    color: var(--dg-red);
  }
}

/* ---------- Form controls ---------- */

.dg-field + .dg-field {
  margin-top: 0.875rem;
}

.dg-label {
  display: block;
  margin-bottom: 0.375rem;
  color: var(--dg-ink-2);
  font-weight: 500;
}

.dg-input,
.dg-select-button,
select.dg-select-native {
  width: 100%;
  min-height: 40px;
  padding: 0 0.75rem;
  border: 1px solid var(--dg-line-strong);
  border-radius: var(--dg-radius-control);
  background: var(--dg-surface);
  box-shadow: var(--dg-shadow-xs);
  color: var(--dg-ink);
  font: inherit;
  /* 16px stops phones from zooming the page when a field is focused. */
  font-size: 1rem;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.dg-input::placeholder {
  color: var(--dg-muted);
}

.dg-input:focus,
.dg-select-button:focus-visible,
select.dg-select-native:focus {
  border-color: var(--dg-primary-line);
  box-shadow: var(--dg-shadow-xs), 0 0 0 4px var(--dg-primary-soft);
  outline: none;
}

.dg-field-error {
  display: block;
  margin-top: 0.25rem;
  color: var(--dg-red);
  font-size: 0.8125rem;
}

.dg-field-error:empty {
  display: none;
}

.dg-field-hint {
  display: block;
  margin-top: 0.25rem;
  color: var(--dg-muted);
  font-size: 0.8125rem;
}

.dg-search {
  position: relative;
}

.dg-search .dg-icon {
  position: absolute;
  top: 50%;
  left: 0.75rem;
  color: var(--dg-muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.dg-search .dg-input {
  padding-left: 2.375rem;
}

@media (min-width: 768px) {
  .dg-input,
  .dg-select-button,
  select.dg-select-native {
    font-size: 0.875rem;
  }
}

@media (pointer: coarse) {
  .dg-btn,
  .dg-input,
  .dg-select-button {
    min-height: 44px;
  }

  .dg-icon-btn {
    width: 44px;
    height: 44px;
  }
}

/* ---------- Custom select ---------- */
/* site.js builds this around a normal <select>, which stays in the form and carries the value. */

.dg-select {
  position: relative;
  min-width: 11rem;
}

.dg-select-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  text-align: left;
  cursor: pointer;
}

.dg-select-value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* An option whose <option> names an icon (data-dg-icon) shows it before its text, in the list and on the
   button: the region and branch pickers tell regions, branches and the whole company apart at a glance. */
.dg-select-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

/* On the button the text stays on one line and ends in "…"; the open list widens to show it whole instead. */
.dg-select-value .dg-select-label > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dg-select-kind {
  color: var(--dg-muted);
}

.dg-select-kind-gap {
  flex: none;
  width: 20px;
}

.dg-select-kind[data-kind="world"] {
  color: var(--dg-blue);
}

.dg-select-kind[data-kind="building"] {
  color: var(--dg-primary);
}

.dg-select-kind[data-kind="shield-lock"] {
  color: var(--dg-green);
}

.dg-select-chevron {
  color: var(--dg-muted);
  transition: transform 150ms var(--dg-ease-out);
}

.dg-select.is-open .dg-select-chevron {
  transform: rotate(180deg);
}

/* The open list is as wide as its longest name, at least the button's width and at most the screen; only a name longer
   than the screen wraps. Closed, it hangs from the button's right edge, so even hidden it can never widen the page;
   site.js fixes its width and lines it up under the button when it opens, shifted left if it would run off. */
.dg-select-list {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  left: auto;
  z-index: 30;
  width: max-content;
  min-width: 100%;
  max-width: calc(100vw - 2rem);
  max-height: 16rem;
  margin: 0;
  padding: 0.25rem;
  overflow-y: auto;
  border: 1px solid var(--dg-line);
  border-radius: var(--dg-radius-control);
  background: var(--dg-surface);
  box-shadow: var(--dg-shadow-lg);
  list-style: none;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.97);
  transform-origin: top center;
  transition: opacity 120ms var(--dg-ease-out), transform 120ms var(--dg-ease-out), visibility 0s 120ms;
}

.dg-select.is-open .dg-select-list {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition-delay: 0s;
}

/* Opens upwards when there is no room below. */
.dg-select[data-placement="top"] .dg-select-list {
  top: auto;
  bottom: calc(100% + 4px);
  transform-origin: bottom center;
}

.dg-select-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-height: 36px;
  padding: 0.375rem 0.625rem;
  border-radius: 6px;
  cursor: pointer;
}

.dg-select-option.is-active {
  background: #f2f4f7;
}

.dg-select-option[aria-selected="true"] {
  font-weight: 500;
}

.dg-select-check {
  color: var(--dg-primary);
  visibility: hidden;
}

.dg-select-option[aria-selected="true"] .dg-select-check {
  visibility: visible;
}

@media (pointer: coarse) {
  .dg-select-option {
    min-height: 44px;
  }
}

/* A searchable select (data-dg-search): the search box stays put above the list, which scrolls. Sized and placed
   like any open list, but at least 18rem wide so the search box has room. */
.dg-select-panel {
  display: flex;
  flex-direction: column;
  min-width: max(100%, 18rem);
  max-height: 20rem;
  padding: 0;
  overflow: hidden;
}

.dg-select-search {
  flex: none;
  padding: 0.375rem;
  border-bottom: 1px solid var(--dg-line);
}

.dg-select-search .dg-input {
  min-height: 36px;
}

.dg-select-search .dg-icon {
  left: 1.125rem;
}

.dg-select-options {
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
  padding: 0.25rem;
  overflow-y: auto;
  list-style: none;
}

.dg-select-option[hidden],
.dg-select-empty[hidden] {
  display: none;
}

.dg-select-empty {
  margin: 0;
  padding: 0.625rem 0.875rem 0.75rem;
  color: var(--dg-muted);
}

/* ---------- Page tabs (device page) ---------- */

/* Underlined tabs above the cards; a tab that needs a look carries a pill with the word. Scrolls
   sideways on a narrow screen rather than wrapping. */
.dg-tabs {
  display: flex;
  gap: 0.25rem;
  overflow-x: auto;
  overscroll-behavior-x: none;
  border-bottom: 1px solid var(--dg-line);
  scrollbar-width: none;
}

.dg-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: -1px;
  padding: 0.625rem 0.875rem;
  border-bottom: 2px solid transparent;
  color: var(--dg-muted);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: color 150ms ease, border-color 150ms ease;
}

.dg-tab:hover {
  color: var(--dg-ink);
}

.dg-tab.is-active {
  border-bottom-color: var(--dg-primary);
  color: var(--dg-primary-strong);
}

.dg-tab .dg-icon {
  width: 18px;
  height: 18px;
}

.dg-tab-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  min-width: 0;
}

.dg-tab-panel[hidden] {
  display: none;
}

@media (pointer: coarse) {
  .dg-tab {
    min-height: 44px;
  }
}

/* ---------- Toolbar and segmented control ---------- */

.dg-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0 1.125rem 0.875rem;
}

.dg-toolbar-filters {
  display: flex;
  flex: 1 1 100%;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.dg-toolbar-filters > * {
  flex: 1 1 12rem;
}

.dg-segmented {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid var(--dg-line-strong);
  border-radius: var(--dg-radius-control);
  background: var(--dg-surface);
  box-shadow: var(--dg-shadow-xs);
}

.dg-segmented a {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 0.875rem;
  color: var(--dg-ink-2);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 150ms ease;
}

.dg-segmented a + a {
  border-left: 1px solid var(--dg-line-strong);
}

.dg-segmented a.is-active {
  background: #f2f4f7;
  color: var(--dg-ink);
}

@container dg-main (min-width: 1080px) {
  .dg-toolbar-filters {
    flex: 0 1 40rem;
    flex-wrap: nowrap;
  }
}

/* The device list: its search sits beside the status buttons when there is room, else on a line of
   its own, and its many filters get a row of their own instead of squeezing the search. */
.dg-toolbar-search {
  flex: 1 1 100%;
}

.dg-toolbar-filters.dg-filters-row {
  display: grid;
  flex: 1 1 100%;
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
}

.dg-filters-row .dg-select {
  min-width: 0;
}

/* A date filter (the audit log's From and To): its word sits inside the box on the left, as the search box's icon does. */
.dg-date-filter {
  position: relative;
  display: block;
  min-width: 0;
}

.dg-date-filter > span {
  position: absolute;
  top: 50%;
  left: 0.75rem;
  color: var(--dg-muted);
  font-size: 0.875rem;
  transform: translateY(-50%);
  pointer-events: none;
}

.dg-date-filter .dg-input {
  padding-left: 3.25rem;
}

/* ---------- Date range (data-dg-daterange) ---------- */
/* site.js turns a From and a To date box into one Dates button whose panel holds shortcuts and a month calendar. Until
   it does (or without scripts) the wrapper draws no box of its own, so the two boxes stay two cells of the filter row;
   once enhanced it is one cell holding the button and its panel, and the boxes are hidden. */
.dg-date-range {
  display: contents;
}

.dg-date-range.is-enhanced {
  position: relative;
  display: block;
  min-width: 0;
}

.dg-date-range.is-enhanced > .dg-date-filter {
  display: none;
}

/* The button names a range ("2026-10-10 – 2026-10-16"), longer than a picker's word: two cells of the filter row, the
   whole row where the row is narrow. */
.dg-filters-row > .dg-date-range.is-enhanced {
  grid-column: 1 / -1;
}

@container dg-main (min-width: 480px) {
  .dg-filters-row > .dg-date-range.is-enhanced {
    grid-column: span 2;
  }
}

.dg-dates-button .dg-select-label > .dg-icon {
  color: var(--dg-primary);
}

.dg-date-range.is-open .dg-select-chevron {
  transform: rotate(180deg);
}

/* Closed, the panel hangs from the button's right edge so even hidden it can never widen the page; site.js fixes its
   width and lines it up under the button when it opens, shifted left if it would run off. */
.dg-dates-panel {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  left: auto;
  z-index: 30;
  display: flex;
  width: max-content;
  max-width: calc(100vw - 2rem);
  border: 1px solid var(--dg-line);
  border-radius: var(--dg-radius);
  background: var(--dg-surface);
  box-shadow: var(--dg-shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: scale(0.97);
  transform-origin: top left;
  transition: opacity 120ms var(--dg-ease-out), transform 120ms var(--dg-ease-out), visibility 0s 120ms;
}

.dg-date-range.is-open .dg-dates-panel {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition-delay: 0s;
}

.dg-date-range[data-placement="top"] .dg-dates-panel {
  top: auto;
  bottom: calc(100% + 4px);
  transform-origin: bottom left;
}

.dg-dates-shortcuts {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 10.5rem;
  padding: 0.5rem;
  border-right: 1px solid var(--dg-line);
  background: var(--dg-subtle);
  border-radius: var(--dg-radius) 0 0 var(--dg-radius);
}

.dg-dates-shortcut {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 36px;
  padding: 0.375rem 0.625rem;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--dg-ink-2);
  font: inherit;
  font-size: 0.875rem;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease;
}

.dg-dates-shortcut[aria-pressed="true"] {
  background: var(--dg-primary-soft);
  color: var(--dg-primary-strong);
  font-weight: 600;
}

.dg-dates-check {
  width: 18px;
  height: 18px;
  color: var(--dg-primary);
  visibility: hidden;
}

.dg-dates-shortcut[aria-pressed="true"] .dg-dates-check {
  visibility: visible;
}

.dg-dates-calendar {
  padding: 0.625rem 0.875rem 0.75rem;
}

.dg-dates-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.dg-dates-title {
  color: var(--dg-ink);
  font-size: 0.9375rem;
  font-weight: 600;
}

.dg-dates-nav:disabled {
  opacity: 0.35;
  cursor: default;
}

.dg-dates-grid {
  display: grid;
  gap: 2px;
}

/* No gap between the days of a week, so a range reads as one band from its first day to its last. */
.dg-dates-week {
  display: grid;
  grid-template-columns: repeat(7, 2.5rem);
}

.dg-dates-weekdays > span {
  display: grid;
  place-items: center;
  height: 2rem;
  color: var(--dg-muted);
  font-size: 0.75rem;
  font-weight: 500;
}

/* A day: the band of a range is its own background, the mark behind its number (hover, today's ring, the range's
   solid ends, the keyboard's ring) is its ::after, drawn under the number. */
.dg-dates-day {
  position: relative;
  z-index: 0;
  height: 2.375rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--dg-ink-2);
  font: inherit;
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.dg-dates-day::after {
  content: "";
  position: absolute;
  inset: 2px;
  z-index: -1;
  border-radius: var(--dg-radius-control);
}

.dg-dates-day.is-outside {
  color: #98a2b3;
}

.dg-dates-day[aria-current="date"] {
  color: var(--dg-primary-strong);
  font-weight: 600;
}

.dg-dates-day[aria-current="date"]::after {
  box-shadow: inset 0 0 0 1px var(--dg-primary-line);
}

.dg-dates-day.is-in-range {
  background: var(--dg-primary-soft);
  color: var(--dg-primary-strong);
}

/* The band starts under the middle of the first day and ends under the middle of the last, and is rounded where a
   week ends it. */
.dg-dates-day.is-in-range:first-child {
  border-radius: var(--dg-radius-control) 0 0 var(--dg-radius-control);
}

.dg-dates-day.is-in-range:last-child {
  border-radius: 0 var(--dg-radius-control) var(--dg-radius-control) 0;
}

.dg-dates-day.is-start {
  background: linear-gradient(to right, transparent 50%, var(--dg-primary-soft) 50%);
}

.dg-dates-day.is-end {
  background: linear-gradient(to left, transparent 50%, var(--dg-primary-soft) 50%);
}

.dg-dates-day.is-start.is-end {
  background: none;
}

.dg-dates-day.is-start,
.dg-dates-day.is-end {
  color: #fff;
  font-weight: 600;
}

.dg-dates-day.is-start::after,
.dg-dates-day.is-end::after {
  background: var(--dg-primary);
  box-shadow: var(--dg-shadow-xs);
}

.dg-dates-day[aria-disabled="true"] {
  color: #d0d5dd;
  cursor: default;
}

.dg-dates-day:focus-visible {
  outline: none;
}

.dg-dates-day:focus-visible::after {
  outline: 2px solid var(--dg-primary);
  outline-offset: 0;
}

.dg-dates-day.is-start:focus-visible::after,
.dg-dates-day.is-end:focus-visible::after {
  box-shadow: inset 0 0 0 2px var(--dg-surface);
}

.dg-dates-hint {
  margin: 0.5rem 0 0;
  color: var(--dg-muted);
  font-size: 0.8125rem;
  text-align: center;
}

@media (hover: hover) and (pointer: fine) {
  .dg-dates-shortcut:hover {
    background: #f2f4f7;
    color: var(--dg-ink);
  }

  .dg-dates-shortcut[aria-pressed="true"]:hover {
    background: var(--dg-primary-soft);
    color: var(--dg-primary-strong);
  }

  .dg-dates-day:not([aria-disabled="true"]):hover::after {
    background: #f2f4f7;
  }

  .dg-dates-day.is-in-range:not(.is-start, .is-end, [aria-disabled="true"]):hover::after {
    background: color-mix(in srgb, var(--dg-primary) 14%, transparent);
  }

  .dg-dates-day.is-start:hover::after,
  .dg-dates-day.is-end:hover::after {
    background: var(--dg-primary-strong);
  }
}

@media (pointer: coarse) {
  .dg-dates-shortcut {
    min-height: 44px;
  }

  .dg-dates-week {
    grid-template-columns: repeat(7, 2.75rem);
  }

  .dg-dates-day {
    height: 2.75rem;
  }
}

/* On a phone the shortcuts become a row of small buttons above the month, and the month fills the panel's width. */
@media (max-width: 560px) {
  .dg-dates-panel {
    flex-direction: column;
    width: calc(100vw - 2rem);
  }

  .dg-dates-shortcuts {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.375rem;
    min-width: 0;
    padding: 0.625rem;
    border-right: 0;
    border-bottom: 1px solid var(--dg-line);
    border-radius: var(--dg-radius) var(--dg-radius) 0 0;
  }

  .dg-dates-shortcut {
    padding: 0 0.75rem;
    border: 1px solid var(--dg-line-strong);
    border-radius: 999px;
    background: var(--dg-surface);
  }

  .dg-dates-shortcut[aria-pressed="true"] {
    border-color: var(--dg-primary-line);
  }

  .dg-dates-check {
    display: none;
  }

  .dg-dates-week {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }
}

@container dg-main (min-width: 860px) {
  .dg-toolbar-search {
    flex: 0 1 26rem;
  }
}

@media (pointer: coarse) {
  .dg-segmented a {
    min-height: 44px;
  }
}

/* Where the buttons do not fit on one line they wrap into rows that fill the width, instead of running
   off the right edge (the device list's "Encryption issues" on a phone). Lines between buttons are
   drawn per button, so a wrapped row keeps them. */
@container dg-main (max-width: 559px) {
  .dg-segmented {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
  }

  .dg-segmented a {
    flex: 1 1 auto;
    justify-content: center;
    box-shadow: 0 0 0 0.5px var(--dg-line-strong);
  }

  .dg-segmented a + a {
    border-left: 0;
  }
}

/* ---------- Tables ---------- */

/* Relative, so a visually hidden header label is placed inside the scrolling box; placed against
   the page, it sat beyond a wide table's right edge and made the whole page scroll sideways. */
.dg-table-wrap {
  position: relative;
  overflow-x: auto;
  /* No rubber-band bounce at the edge: it shook the pinned columns and the header row, and a swipe
     past the edge no longer means "back". Scrolling the page up and down is unaffected. */
  overscroll-behavior-x: none;
}

.dg-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.dg-table th {
  padding: 0.625rem 1.125rem;
  border-top: 1px solid var(--dg-line);
  border-bottom: 1px solid var(--dg-line);
  background: var(--dg-subtle);
  color: var(--dg-muted);
  font-size: 0.75rem;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
}

.dg-table td {
  padding: 0.75rem 1.125rem;
  border-bottom: 1px solid var(--dg-line);
  color: var(--dg-ink-2);
  vertical-align: middle;
}

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

.dg-nowrap {
  white-space: nowrap;
}

/* The cell that names a row (a PC, a user, a command) stays on one line; a table that no longer
   fits scrolls sideways and drops its dg-col-wide/-mid columns instead. */
@media (min-width: 768px) {
  .dg-table td.dg-cell-main {
    white-space: nowrap;
  }

  .dg-table td.dg-cell-main .dg-entity-name {
    overflow-wrap: normal;
  }
}

/* Marks a value that needs a look, such as a PC not seen for over a day. */
.dg-table td.dg-text-warn {
  color: var(--dg-warn-ink);
  font-weight: 500;
}

/* A command's progress line or the agent's report, under its status. */
.dg-command-note {
  display: block;
  color: var(--dg-muted);
  font-size: 0.8125rem;
  max-width: 48ch;
  white-space: normal;
}

/* The PC page's Commands table sits beside the About card: a long "On the PC (user)" or "Done with
   problems" wraps onto a second line instead of pushing View output past the card's edge. */
.dg-command-table .dg-pill {
  white-space: normal;
}

.dg-command-note-warn {
  color: var(--dg-warn-ink);
  font-weight: 500;
}

/* A soft wipe's report: one line per app or result, its icon saying done, not found or a problem. */
.dg-result-list {
  margin: 0.25rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.8125rem;
  max-width: 48ch;
}

.dg-result {
  display: flex;
  align-items: flex-start;
  gap: 0.375rem;
  padding: 0.0625rem 0;
  color: var(--dg-ink-2);
  white-space: normal;
}

.dg-result .dg-icon {
  flex: none;
  width: 16px;
  height: 16px;
  margin-top: 0.0625rem;
  stroke-width: 2.5;
}

.dg-result-done .dg-icon {
  color: var(--dg-green);
}

.dg-result-none {
  color: var(--dg-muted);
}

.dg-result-none .dg-icon {
  color: #98a2b3;
}

.dg-result-problem {
  color: var(--dg-red);
  font-weight: 500;
}

.dg-result-problem .dg-icon {
  color: var(--dg-red);
}

.dg-entity {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.dg-entity-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--dg-primary-soft);
  color: var(--dg-primary-strong);
}

.dg-entity-name {
  display: block;
  color: var(--dg-ink);
  font-weight: 600;
  overflow-wrap: anywhere;
}

a.dg-entity-name {
  text-decoration: none;
}

.dg-entity-sub {
  display: block;
  color: var(--dg-muted);
  font-size: 0.8125rem;
}

/* Several pills in one cell stay together and keep a gap between them when they wrap. */
.dg-pills {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

@media (max-width: 767.98px) {
  .dg-table td .dg-pills {
    justify-content: flex-end;
  }
}

/* A device list's system cell: the platform's logo, then the version over a smaller detail line. */
.dg-os {
  display: inline-flex;
  align-items: flex-start;
  gap: 0.5rem;
  white-space: nowrap;
}

.dg-os .dg-icon {
  width: 18px;
  height: 18px;
  margin-top: 1px;
}

.dg-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f2f4f7;
  color: var(--dg-ink-2);
  font-size: 0.75rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.dg-pill-dot::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.dg-pill-green {
  background: #ecfdf3;
  color: #067647;
}

.dg-pill-red {
  background: #fef3f2;
  color: #b42318;
}

.dg-pill-blue,
.dg-pill-azure {
  background: #eff8ff;
  color: #175cd3;
}

.dg-pill-purple {
  background: #f4f3ff;
  color: #5925dc;
}

.dg-pill-indigo {
  background: #eef4ff;
  color: #3538cd;
}

.dg-pill-pink {
  background: #fdf2fa;
  color: #c11574;
}

.dg-pill-orange {
  background: #fef6ee;
  color: #b93815;
}

.dg-meter {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  white-space: nowrap;
}

.dg-meter-bar {
  flex: 0 0 4.5rem;
  height: 6px;
  overflow: hidden;
  border-radius: 3px;
  background: #f2f4f7;
}

.dg-meter-bar span {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--dg-primary);
}

@media (hover: hover) and (pointer: fine) {
  .dg-table tbody tr {
    transition: background-color 120ms ease;
  }

  .dg-table tbody tr:hover {
    background: var(--dg-subtle);
  }
}

/* Below 768px every row becomes a labelled block; a wide table cannot be read on a phone. */
@media (max-width: 767.98px) {
  .dg-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .dg-table,
  .dg-table tbody,
  .dg-table tr {
    display: block;
  }

  .dg-table tr {
    padding: 0.875rem 1.125rem;
    border-top: 1px solid var(--dg-line);
  }

  .dg-table td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.25rem 0;
    border: 0;
    text-align: right;
  }

  .dg-table td::before {
    content: attr(data-label);
    flex: none;
    color: var(--dg-muted);
    font-size: 0.8125rem;
    font-weight: 400;
    text-align: left;
  }

  .dg-table td.dg-cell-main {
    display: block;
    padding-bottom: 0.5rem;
    text-align: left;
  }

  .dg-table td.dg-cell-main::before,
  .dg-table td.dg-cell-action::before {
    content: none;
  }

  .dg-table td.dg-cell-action {
    justify-content: flex-end;
  }

  .dg-table td.dg-cell-action .dg-card-actions {
    justify-content: flex-end;
  }

  /* A button beside a note (View output, Report collected): the note takes the rest of the row,
     so the button stays at the same place whatever the note says. */
  .dg-table td.dg-cell-action .dg-command-note {
    flex: 1 1 0;
    min-width: 0;
    text-align: right;
  }

  .dg-table td.dg-cell-action:empty {
    display: none;
  }
}

/* A narrower page area (a mid-size screen, or the sidebar open) drops the least-used columns
   instead of squeezing every one in. */
@media (min-width: 768px) {
  @container dg-main (max-width: 1087.98px) {
    .dg-table .dg-col-wide {
      display: none;
    }
  }

  @container dg-main (max-width: 879.98px) {
    .dg-table .dg-col-mid {
      display: none;
    }
  }
}

/* The device list keeps Device and User in place while the other columns scroll sideways. The Device
   column has a fixed width so User knows where to stick; a long name or serial ends in "…" (full text
   on hover). A line on the right of the pinned part shows where the scrolling starts. */
@media (min-width: 768px) {
  .dg-table-pinned th:first-child,
  .dg-table-pinned td:first-child,
  .dg-table-pinned th:nth-child(2),
  .dg-table-pinned td:nth-child(2) {
    position: sticky;
    z-index: 1;
  }

  .dg-table-pinned td:first-child,
  .dg-table-pinned td:nth-child(2) {
    background: var(--dg-surface);
  }

  .dg-table-pinned th:first-child,
  .dg-table-pinned td:first-child {
    left: 0;
    width: 17rem;
    min-width: 17rem;
    max-width: 17rem;
  }

  .dg-table-pinned th:nth-child(2),
  .dg-table-pinned td:nth-child(2) {
    left: 17rem;
    box-shadow: inset -1px 0 0 var(--dg-line);
  }

  /* With User dropped on a narrower page area, the line moves to Device. */
  @container dg-main (max-width: 879.98px) {
    .dg-table-pinned th:first-child,
    .dg-table-pinned td:first-child {
      box-shadow: inset -1px 0 0 var(--dg-line);
    }
  }

  .dg-table-pinned td:first-child .dg-entity > div {
    min-width: 0;
  }

  .dg-table-pinned td:first-child .dg-entity-name,
  .dg-table-pinned td:first-child .dg-entity-sub {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* ---------- Notice, alert, empty state ---------- */

.dg-notice {
  padding: 1rem 1.125rem;
  margin-bottom: 1rem;
  border: 1px solid var(--dg-primary-line);
  border-radius: var(--dg-radius);
  background: var(--dg-primary-softer);
}

.dg-notice-title {
  color: #53389e;
  font-weight: 600;
}

.dg-notice-text {
  margin-top: 0.125rem;
  color: var(--dg-ink-2);
}

.dg-command {
  margin: 0.75rem 0;
  padding: 0.75rem 0.875rem;
  border-radius: var(--dg-radius-control);
  background: var(--dg-ink);
  color: #f2f4f7;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 0.8125rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* The Output page puts a script and its output straight in the card, so they line up with the card head. */
.dg-card > .dg-command,
.dg-card > .dg-card-sub {
  margin-inline: 1.125rem;
}

.dg-card > .dg-command:last-child {
  margin-bottom: 1.125rem;
}

/* Command output and scripts keep their columns (PowerShell tables): long lines scroll inside the block, never the page. */
.dg-command-pre {
  white-space: pre;
  overflow-wrap: normal;
  overflow-x: auto;
}

/* A secret shown on request, such as a 48-digit BitLocker recovery key. Pair it with a
   data-copy-target button to copy it. */
.dg-key {
  display: inline-block;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--dg-line-strong);
  border-radius: var(--dg-radius-control);
  background: var(--dg-subtle);
  color: var(--dg-ink);
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 0.875rem;
  letter-spacing: 0.02em;
  overflow-wrap: anywhere;
  user-select: all;
}

/* A row of count pills, e.g. a branch command's progress. */
.dg-progress-line {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

/* The secret and its Copy button on one line; the button drops below it when there is no room. */
.dg-key-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

/* Label and value pairs, e.g. the facts about one PC. */
.dg-facts {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.625rem 1rem;
  margin: 0;
}

.dg-facts dt {
  color: var(--dg-muted);
}

.dg-facts dd {
  margin: 0;
  text-align: right;
  overflow-wrap: anywhere;
}

/* A row whose value is a control (the wipe plan select) gets the card's full width: the label on its
   own line, the control below it, wide enough to show the whole plan name. */
.dg-facts .dg-facts-full {
  grid-column: 1 / -1;
}

.dg-facts dd.dg-facts-full {
  margin-top: -0.25rem;
  text-align: left;
}

.dg-facts dd.dg-facts-full .dg-select {
  flex: 1 1 auto;
}

/* A plan name too long even for that wraps rather than being cut off. */
.dg-facts dd.dg-facts-full .dg-select-value {
  white-space: normal;
}

/* In a wide card (System) the value sits next to its label, not at the far edge, with a line per row. */
.dg-facts-wide {
  grid-template-columns: minmax(7rem, 13rem) minmax(0, 1fr);
  gap: 0;
}

.dg-facts-wide dt,
.dg-facts-wide dd {
  padding: 0.5rem 0;
  border-top: 1px solid var(--dg-line);
}

.dg-facts-wide dt {
  padding-right: 1.5rem;
}

.dg-facts-wide dd {
  text-align: left;
}

.dg-facts-wide dt:first-of-type,
.dg-facts-wide dd:first-of-type {
  border-top: 0;
}

/* A long status ("Rolled back from 2026.10.7.1050") wraps inside the card instead of running off it. */
.dg-facts dd .dg-pill {
  max-width: 100%;
  white-space: normal;
  text-align: left;
}

.dg-alert {
  padding: 0.625rem 0.75rem;
  margin-bottom: 1rem;
  border: 1px solid #fecdca;
  border-radius: var(--dg-radius-control);
  background: #fef3f2;
  color: #b42318;
}

.dg-empty {
  padding: 2.5rem 1.125rem;
  border-top: 1px solid var(--dg-line);
  text-align: center;
}

.dg-empty-icon {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 0.75rem;
  border: 1px solid var(--dg-line);
  border-radius: 10px;
  box-shadow: var(--dg-shadow-xs);
  color: var(--dg-ink-2);
}

.dg-empty-title {
  font-weight: 600;
}

.dg-empty-text {
  max-width: 34ch;
  margin: 0.25rem auto 0;
  color: var(--dg-muted);
}

.dg-empty-action {
  margin-top: 1rem;
}

/* ---------- Sign-in ---------- */

.dg-signin-wrap {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 1rem;
}

.dg-signin {
  width: 100%;
  max-width: 380px;
  padding: 1.75rem 1.5rem;
}

.dg-signin .dg-logo {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  margin-bottom: 1rem;
}

.dg-signin .dg-logo img {
  width: 58px;
  height: 58px;
}

.dg-signin h1 {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.dg-signin-sub {
  margin: 0.25rem 0 1.25rem;
  color: var(--dg-muted);
}

.dg-signin .dg-btn {
  margin-top: 1.25rem;
}

@media (prefers-reduced-motion: reduce) {
  .dg-btn:active,
  .dg-icon-btn:active,
  .dg-action-btn:active,
  .dg-remove-btn:active {
    transform: none;
  }

  .dg-switch-track,
  .dg-switch-track::after,
  .dg-action-btn,
  .dg-remove-btn,
  .dg-more-actions > summary,
  .dg-more-actions > summary .dg-icon {
    transition: none;
  }

  .dg-action-panel:target,
  .dg-action-panel.is-open,
  .dg-swapped > * {
    animation: none;
  }

  .dg-select-list,
  .dg-select-chevron,
  .dg-nav,
  .dg-nav-link,
  .dg-nav-label,
  .dg-nav-heading,
  .dg-nav-backdrop,
  .dg-main {
    transition: none;
  }

  .dg-main,
  .dg-menu {
    animation: none;
  }
}

/* ---------- Inventory ---------- */

/* After a tab switch (site.js) the new content fades in; the card's heading stays still. */
.dg-swapped > :not(.dg-card-head) {
  animation: dg-swap-in 150ms ease-out;
}

@keyframes dg-swap-in {
  from {
    opacity: 0;
  }
}

.dg-system-tabs {
  display: flex;
  flex-wrap: wrap;
  margin: 0 1.125rem 1rem;
}

.dg-unreadable {
  color: var(--dg-warn-ink);
}

.dg-problems {
  display: grid;
  gap: 0.75rem;
  margin: 0;
  padding: 0 1.125rem 1.125rem;
  list-style: none;
}

.dg-problems li {
  display: grid;
  gap: 0.25rem;
}

.dg-problem-time {
  color: var(--dg-muted);
  font-size: 0.8125rem;
}

.dg-changes {
  margin: 0;
  padding: 0;
  list-style: none;
}

.dg-change-group {
  padding: 0.875rem 1.125rem;
  border-top: 1px solid var(--dg-line);
}

.dg-change-group ul {
  margin: 0.375rem 0 0;
  padding-left: 1.125rem;
}

.dg-change-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-weight: 600;
}

/* A row that breaks the row above down (the Hardware & security card's PC models under "No TPM"): a grey arrow
   and grey text, so the indent reads as "of which" and not as a stray space. */
.dg-subrow td.dg-cell-main {
  padding-left: 1.5rem;
}

.dg-subrow-mark .dg-icon {
  width: 16px;
  height: 16px;
  margin-right: 0.375rem;
  color: var(--dg-muted);
  vertical-align: -0.2em;
}

.dg-subrow a {
  color: var(--dg-ink-2);
}

.dg-subrow a:hover {
  color: var(--dg-primary-strong);
}

@media (max-width: 767.98px) {
  .dg-subrow td.dg-cell-main {
    padding-left: 0.5rem;
  }
}

/* A branch's phone app link as a QR code (inline SVG from the server), with the link itself below. */
/* The branch page's Install card: a row per platform, its logo beside the name and one line of how. */
.dg-install {
  display: grid;
  gap: 1rem;
}

.dg-install-row {
  display: grid;
  gap: 0.625rem;
}

.dg-install-row + .dg-install-row,
.dg-install-replace {
  padding-top: 1rem;
  border-top: 1px solid var(--dg-line);
}

.dg-install-head {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.dg-install-logo {
  display: grid;
  flex: none;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--dg-line);
  border-radius: 10px;
  background: var(--dg-surface);
}

.dg-install-logo .dg-icon {
  width: 24px;
  height: 24px;
}

.dg-install-name {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
}

.dg-install-text {
  margin: 0.125rem 0 0;
  color: var(--dg-muted);
  font-size: 0.8125rem;
}

.dg-install-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.dg-install-row .dg-qr {
  margin-bottom: 0;
}

.dg-install-replace {
  display: grid;
  gap: 0.375rem;
}

.dg-qr {
  width: min(200px, 100%);
  margin: 0 auto 0.75rem;
  padding: 0.5rem;
  border: 1px solid var(--dg-line);
  border-radius: var(--dg-radius-control);
  background: #ffffff;
}

.dg-qr svg {
  display: block;
  width: 100%;
  height: auto;
}

/* ---------- Telegram ---------- */

/* A side card that only explains: on a narrow screen it follows the main card instead of leading. */
.dg-side.dg-side-last {
  order: 1;
}

.dg-telegram-link {
  display: grid;
  justify-items: start;
  gap: 0.75rem;
}

.dg-telegram-link .dg-qr {
  margin: 0;
}

.dg-telegram-text {
  margin: 0;
  max-width: 40rem;
  line-height: 1.5;
}

.dg-telegram-sub {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.dg-telegram-sub .dg-icon {
  width: 14px;
  height: 14px;
}

.dg-steps {
  display: grid;
  gap: 0.5rem;
  margin: 0;
  padding-left: 2.375rem;
  line-height: 1.5;
}

/* ---------- Wipe plan editor ---------- */

.dg-textarea {
  min-height: unset;
  padding: 0.5rem 0.75rem;
  line-height: 1.5;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 0.875rem;
  resize: vertical;
}

.dg-checks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.375rem 1rem;
  margin-top: 0.25rem;
}

.dg-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--dg-ink);
  font-weight: 400;
  cursor: pointer;
}

.dg-check + .dg-check {
  margin-top: 0.5rem;
}

.dg-checks .dg-check + .dg-check {
  margin-top: 0;
}

.dg-check input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  flex: none;
  accent-color: var(--dg-primary);
}

/* Wipe-plan editor: one tile per app, its logo in white on the app's own colour (--dg-app, set per tile).
   A ticked tile carries a check mark and says what happens to the app; a left-out tile goes grey and says
   "Left alone", so the state never rests on colour alone. The real checkbox stays in the tile for the form
   and the keyboard, visually hidden. */
.dg-app-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(124px, 1fr));
  gap: 0.625rem;
  margin-top: 0.5rem;
}

.dg-app-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
  padding: 0.875rem 0.5rem 0.75rem;
  border: 1px solid var(--dg-line);
  border-radius: var(--dg-radius);
  background: var(--dg-surface);
  text-align: center;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}

.dg-app-tile:hover {
  border-color: var(--dg-line-strong);
}

.dg-app-tile input[type="checkbox"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.dg-app-tile:has(input:focus-visible) {
  outline: 2px solid var(--dg-primary);
  outline-offset: 2px;
}

.dg-app-tile:has(input:checked) {
  border-color: var(--dg-primary-line);
  background: var(--dg-primary-softer);
  box-shadow: 0 0 0 1px var(--dg-primary-line);
}

.dg-app-tile-logo {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--dg-app, var(--dg-muted));
  color: #fff;
  transition: background-color 0.15s, opacity 0.15s;
}

.dg-app-tile-logo svg {
  width: 28px;
  height: 28px;
}

.dg-app-tile-name {
  color: var(--dg-ink);
  font-weight: 600;
  font-size: 0.875rem;
  line-height: 1.25;
}

.dg-app-tile-state {
  color: var(--dg-muted);
  font-size: 0.75rem;
  line-height: 1.25;
}

.dg-app-tile-tick {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid var(--dg-line-strong);
  background: var(--dg-surface);
  color: transparent;
}

.dg-app-tile-tick .dg-icon {
  width: 14px;
  height: 14px;
  stroke-width: 3;
}

.dg-app-tile:has(input:checked) .dg-app-tile-tick {
  border-color: var(--dg-primary);
  background: var(--dg-primary);
  color: #fff;
}

.dg-app-tile .dg-app-tile-off,
.dg-app-tile:has(input:checked) .dg-app-tile-on {
  display: block;
}

.dg-app-tile .dg-app-tile-on,
.dg-app-tile:has(input:checked) .dg-app-tile-off {
  display: none;
}

.dg-app-tile:has(input:checked) .dg-app-tile-state {
  color: var(--dg-primary-strong);
  font-weight: 500;
}

.dg-app-tile:not(:has(input:checked)) .dg-app-tile-logo {
  background: var(--dg-line-strong);
  opacity: 0.8;
}

.dg-app-tile:not(:has(input:checked)) .dg-app-tile-name {
  color: var(--dg-muted);
}

/* A many-coloured logo (AppLogos.Image) sits on white with a hairline edge, like the app's own icon; left alone it goes
   grey and faint instead of the square turning grey. */
.dg-app-tile-logo-colour,
.dg-app-tile:not(:has(input:checked)) .dg-app-tile-logo-colour {
  background: var(--dg-surface);
  box-shadow: inset 0 0 0 1px var(--dg-line);
  opacity: 1;
}

.dg-app-tile-logo-colour img {
  width: 34px;
  height: 34px;
  transition: filter 0.15s, opacity 0.15s;
}

.dg-app-tile:not(:has(input:checked)) .dg-app-tile-logo-colour img {
  filter: grayscale(1);
  opacity: 0.5;
}

.dg-field-hint code {
  padding: 0.05rem 0.3rem;
  border-radius: 4px;
  background: var(--dg-surface-2, rgba(16, 24, 40, 0.06));
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 0.8125rem;
}

/* A select that submits on change, sitting inside a facts list. */
.dg-inline-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.dg-inline-form .dg-select-native,
.dg-inline-form .dg-select {
  min-width: 0;
}

.dg-btn-sm {
  min-height: 32px;
  padding: 0 0.625rem;
  font-size: 0.8125rem;
}

/* The waiting line stays readable beside long command/user names, including at phone width. */
.dg-waiting { padding: 1rem 1.25rem; border-bottom: 1px solid var(--dg-border, #e5e7eb); }
.dg-waiting-title { margin: 0 0 .75rem; font-size: .875rem; }
.dg-waiting-list { margin: 0; padding-left: 1.5rem; }
.dg-waiting-list > li { padding: .5rem 0 .5rem .25rem; }
.dg-waiting-row { display: flex; align-items: start; justify-content: space-between; gap: .75rem; }
.dg-waiting-copy { display: grid; gap: .25rem; min-width: 0; overflow-wrap: anywhere; font-size: .8125rem; }
.dg-waiting-row form { flex: 0 0 auto; }

/* Branch page: Install problems. One block per report, reasons as plain lines, the technical part folded. */
.dg-install-reports {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.dg-install-report {
  display: grid;
  gap: 0.375rem;
  padding: 0.875rem 1.125rem;
  border-top: 1px solid var(--dg-line);
}

.dg-card-band + .dg-install-reports > .dg-install-report:first-child {
  border-top: 0;
}

.dg-install-report-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.625rem;
}

.dg-install-report-pc {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.dg-install-report-meta {
  margin: 0;
  color: var(--dg-muted);
  font-size: 0.8125rem;
  overflow-wrap: anywhere;
}

.dg-install-report-reasons {
  margin: 0;
  padding-left: 1.125rem;
}

.dg-install-report-details > summary {
  width: fit-content;
  color: var(--dg-ink-2);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
}

.dg-install-report-technical {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 0.8125rem;
  overflow-wrap: anywhere;
}

.dg-install-report form {
  justify-self: start;
}

/* ---------- Touch screens ---------- */

/* Safari on an iPhone or iPad zooms the page into any field smaller than 16px when it is tapped (fields
   drop to 14px on wide screens, script boxes are 14px). On touch screens every field stays at 16px.
   Last in the file, so it wins over those rules. */
@media (pointer: coarse) {
  .dg-input,
  .dg-textarea,
  .dg-select-button,
  select.dg-select-native,
  input,
  select,
  textarea {
    font-size: 1rem;
  }
}

/* No double-tap zoom (and no tap delay); pinching to zoom still works. */
html {
  touch-action: manipulation;
}
