:root {
  --sidebar-width: 280px;
  /* Joe / Awake Lab brand palette */
  --brand-gold: #b88917;      /* golden roast */
  --brand-gold-soft: rgb(184 137 23 / 12%);
  --brand-cream: #fef8ec;     /* paper cream */
  --brand-moss: #4d502c;      /* moss */
  --brand-grove: #252610;     /* grove */
  --black: #000000;           /* espresso black */
  --ink: #171717;
  --panel: #202020;
  --panel-2: #2e2e2e;          /* charcoal */
  --line: #3f3f3f;
  --muted: #b8b8b8;
  --text: #f7f7f7;             /* steam */
  --white: #ffffff;
  --topbar-bg: #111111;
  --control-bg: #111111;
  --tile-bg: #111111;
  --tool-bg: #151515;
  --table-head-bg: #181818;
  --table-row-bg: #202020;
  --table-row-alt-bg: #1b1b1b;
  --table-row-hover-bg: #262626;
  --summary-bg: linear-gradient(145deg, #242424, #151515);
  --modal-scrim: rgb(0 0 0 / 78%);
  --shadow: rgb(0 0 0 / 42%);
  --success-text: #d6f3dc;
  --deployed-text: #e1e9ff;
  --tmobile-text: #ffd7ee;
  --hologram-text: #d8f2ff;
  --verizon-text: #ffe0e0;
  --use-text: #fff1c9;
  color-scheme: dark;
}

@font-face {
  /* Self-hosted: the CSP allows font loads from 'self' only. OFL licensed. */
  font-family: "Archivo Black";
  src: url("fonts/ArchivoBlack-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --font-display: "Archivo Black", "Segoe UI", -apple-system, Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--black);
  color: var(--text);
  /* The platform UI face rather than Arial: Segoe UI on Windows, SF on macOS,
     Roboto on Android. Arial is a document face and reads dated in a dense
     operational tool. Arial stays at the end as the fallback. */
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto,
    "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Serials, BNNs, counts and timestamps sit in columns, so digits must share a
   width or the rows visibly ripple as values change. */
table,
code,
.device-cell,
.stat-value {
  font-variant-numeric: tabular-nums;
}

.topbar {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  padding: 12px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--topbar-bg);
}

.topbar h1 {
  font-size: 20px;
}

.topbar .eyebrow {
  font-size: 11px;
  margin-bottom: 2px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 200px;
}

.brand-logo-link,
.login-logo-link {
  display: inline-flex;
  flex: 0 0 auto;
  border-radius: 50%;
}

.joe-logo {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border-radius: 50%;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--brand-gold);
  text-transform: uppercase;
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 0.14em;
}

h1, h2 {
  margin: 0;
  letter-spacing: 0.01em;
  font-family: var(--font-display);
  font-weight: 400;              /* Archivo Black carries its own weight */
  color: var(--brand-cream);
}
h1 { font-size: 23px; }
h2 { font-size: 16px; }

.search {
  display: flex;
  gap: 10px;
  width: min(620px, 100%);
}

.device-filter-form {
  display: grid;
  grid-template-columns: repeat(15, minmax(0, 1fr));
  gap: 10px 12px;
  align-items: end;
  width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

body:has(.nav-actions) {
  padding-left: var(--sidebar-width);
}

.quick-links {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.menu-toggle {
  display: none;
  width: auto;
  min-width: 112px;
  margin-left: auto;
}

.global-crm-link {
  flex: 0 0 auto;
  margin-left: auto;
  white-space: nowrap;
}

.login-page .login-crm-link {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 10;
  width: auto;
  margin: 0;
}

.nav-actions {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 60;
  display: grid;
  align-content: start;
  gap: 2px;
  width: var(--sidebar-width);
  padding: 16px 8px 16px 0;
  background: var(--topbar-bg);
  border-right: 1px solid var(--line);
  box-shadow: 18px 0 44px var(--shadow);
  overflow-y: auto;
  transform: translateX(0);
  transition: transform 180ms ease, visibility 180ms ease;
  visibility: visible;
}

.nav-actions.is-open {
  transform: translateX(0);
  visibility: visible;
}

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

.nav-actions > * {
  order: 20;
}

.nav-actions a[href="/"] {
  order: 1;
}

.nav-actions a[href$="/devices/new"] {
  order: 2;
}

.nav-actions a[href$="/accessories/new"] {
  order: 3;
}

/* Flat sidebar nav items */
.nav-actions a,
.nav-actions button {
  display: block;
  width: 100%;
  border: none;
  border-left: 3px solid transparent;
  border-radius: 0 6px 6px 0;
  padding: 9px 12px;
  background: transparent;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 600;
  text-align: left;
  transition: background 0.12s ease, color 0.12s ease;
}

.nav-actions a:hover,
.nav-actions button:hover {
  background: rgb(255 255 255 / 5%);
  color: var(--text);
}

.nav-section-label {
  display: block;
  padding: 14px 18px 4px;
  color: #7c7c7c;               /* stone */
  font-family: var(--font-display);
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  user-select: none;
}

.nav-actions a[aria-current="page"] {
  background: var(--brand-gold-soft);
  color: var(--brand-cream);
  border-left-color: var(--brand-gold);
  font-weight: 700;
}

/* Submenu parent */
.nav-submenu {
  position: relative;
}

.nav-submenu summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  border: none;
  border-left: 3px solid transparent;
  border-radius: 0 6px 6px 0;
  padding: 9px 10px 9px 12px;
  background: transparent;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  transition: background 0.12s ease, color 0.12s ease;
}

.nav-submenu summary:hover {
  background: rgb(255 255 255 / 5%);
  color: var(--text);
}

.nav-submenu summary::-webkit-details-marker {
  display: none;
}

.nav-submenu-arrow {
  font-size: 0.7rem;
  opacity: 0.45;
  line-height: 1;
  transition: transform 0.15s ease, opacity 0.12s ease;
}

.nav-submenu[open] .nav-submenu-arrow {
  transform: rotate(180deg);
  opacity: 0.75;
}

.nav-submenu summary[aria-current="page"] {
  background: var(--brand-gold-soft);
  color: var(--brand-cream);
  border-left-color: var(--brand-gold);
  font-weight: 700;
}

/* Submenu child items — tree-style indented */
.nav-submenu-menu {
  display: grid;
  gap: 1px;
  margin: 3px 0 3px 14px;
  padding-left: 10px;
  border-left: 1px solid var(--line);
}

.nav-submenu-menu a {
  font-size: 0.825rem;
  padding: 7px 10px;
}

/* CRM back link and standalone button-links */
.button-link {
  display: block;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 12px;
  background: transparent;
  color: var(--muted);
  font-size: 0.825rem;
  font-weight: 600;
  text-align: center;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.button-link:hover {
  background: rgb(255 255 255 / 5%);
  color: var(--text);
  border-color: var(--muted);
}

.button-link.secondary {
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
}

.button-link.disabled {
  opacity: 0.42;
  pointer-events: none;
}

.role-preview-bar {
  flex: 0 0 auto;
  margin-left: auto;
}

.role-preview-bar + .menu-toggle {
  margin-left: 0;
}

.role-preview-bar form {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--tool-bg);
}

.role-preview-bar label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.1;
}

.role-preview-bar select {
  min-height: 34px;
  width: 142px;
  padding: 6px 30px 6px 10px;
}

.role-preview-bar button {
  width: auto;
  white-space: nowrap;
}

.role-preview-note {
  max-width: 128px;
  color: var(--use-text);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.login-page {
  min-height: 100vh;
  background: radial-gradient(circle at top, var(--panel-2), var(--black) 52%);
}

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(460px, 100%);
  padding: 34px;
  text-align: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.login-logo {
  width: 118px;
  height: 118px;
  margin-bottom: 18px;
  border-radius: 50%;
}

.login-copy {
  margin: 18px 0 22px;
  color: var(--muted);
}

.login-button {
  display: inline-flex;
  justify-content: center;
  width: 100%;
}

.login-notice {
  justify-content: center;
  margin: 18px 0 0;
}

input, select, textarea, button {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 12px;
  background: var(--control-bg);
  color: var(--text);
  font: inherit;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

button {
  width: auto;
  min-width: 120px;
  cursor: pointer;
  /* Golden roast on espresso reads at ~6.8:1; white text on gold does not,
     so the label stays dark. */
  background: var(--brand-gold);
  color: #141414;
  border-color: var(--brand-gold);
  font-weight: 700;
}

button:hover:not(:disabled) {
  background: #c9971f;
  border-color: #c9971f;
}

button.small {
  min-width: 0;
  padding: 7px 10px;
}

button.danger {
  background: transparent;
  color: var(--text);
  border-color: #777;
}

main {
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
  padding: 24px;
}

main.wide-page {
  max-width: none;
  padding: 18px clamp(10px, 1.5vw, 24px);
}

main.form-page {
  max-width: 780px;
}

main.two-panel {
  display: grid;
  grid-template-columns: minmax(320px, 420px) 1fr;
  gap: 18px;
}

.notice {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  color: var(--black);
}

.notice span {
  background: var(--white);
  padding: 8px 12px;
  border-radius: 6px;
}

.toast-stack {
  position: fixed;
  top: 84px;
  right: 14px;
  z-index: 2000;
  display: grid;
  gap: 8px;
  max-width: min(92vw, 420px);
}

.toast-message {
  background: var(--panel);
  color: var(--white);
  border: 1px solid var(--line);
  border-left: 4px solid #58d68d;
  border-radius: 8px;
  box-shadow: 0 12px 30px var(--shadow);
  padding: 10px 12px;
  animation: toast-in 0.22s ease;
}

.toast-message.is-leaving {
  opacity: 0;
  transform: translateX(12px);
  transition: all 0.2s ease;
}

.delivery-share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
}

.delivery-share-actions button {
  width: auto;
  min-width: 0;
  padding: 6px 8px;
  font-size: 12px;
  white-space: nowrap;
}

.delivery-status-table-wrap {
  container-name: delivery-status;
  container-type: inline-size;
  overflow-x: auto;
  padding: 0;
}

.delivery-status-table {
  border-collapse: collapse;
  min-width: 960px;
  width: 100%;
}

.delivery-status-table th,
.delivery-status-table td {
  border-bottom: 1px solid #444;
  padding: .75rem;
  text-align: left;
  vertical-align: middle;
}

.delivery-status-table th {
  color: #bbb;
  font-size: .75rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}

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

.delivery-status-table .delivery-share-actions {
  margin-top: 0;
}

@container delivery-status (max-width: 1250px) {
  .delivery-status-table-wrap {
    overflow-x: visible;
  }

  .delivery-status-table {
    display: block;
    min-width: 0;
    width: 100%;
  }

  .delivery-status-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .delivery-status-table tbody {
    display: grid;
    gap: 10px;
    width: 100%;
    padding: 10px;
  }

  .delivery-status-table tr {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 12px 18px;
    width: 100%;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--table-row-bg);
  }

  .delivery-status-table td {
    display: block;
    min-width: 0;
    padding: 0;
    border: 0;
    overflow-wrap: anywhere;
  }

  .delivery-status-table td::before {
    display: block;
    margin-bottom: 5px;
    color: var(--muted);
    content: attr(data-label);
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
  }

  .delivery-status-table td:nth-child(1) { grid-column: 1 / 3; grid-row: 1; }
  .delivery-status-table td:nth-child(2) { grid-column: 3 / 6; grid-row: 1; }
  .delivery-status-table td:nth-child(3) { grid-column: 6 / 9; grid-row: 1; }
  .delivery-status-table td:nth-child(4) { grid-column: 9 / 13; grid-row: 1; }
  .delivery-status-table td:nth-child(5) { grid-column: 1 / 4; grid-row: 2; }
  .delivery-status-table td:nth-child(6) { grid-column: 4 / 8; grid-row: 2; }
  .delivery-status-table td:nth-child(7) { grid-column: 8 / 13; grid-row: 2; }

  .delivery-status-table .status-pill {
    max-width: 100%;
    white-space: normal;
  }
}

@container delivery-status (max-width: 780px) {
  .delivery-status-table tr {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .delivery-status-table td:nth-child(1) { grid-column: 1; grid-row: 2; }
  .delivery-status-table td:nth-child(2) { grid-column: 1 / -1; grid-row: 1; }
  .delivery-status-table td:nth-child(3) { grid-column: 2; grid-row: 2; }
  .delivery-status-table td:nth-child(4) { grid-column: 1 / -1; grid-row: 3; }
  .delivery-status-table td:nth-child(5) { grid-column: 1; grid-row: 4; }
  .delivery-status-table td:nth-child(6) { grid-column: 2; grid-row: 4; }
  .delivery-status-table td:nth-child(7) { grid-column: 1 / -1; grid-row: 5; }
}

@container delivery-status (max-width: 480px) {
  .delivery-status-table tbody {
    gap: 12px;
    padding: 0;
  }

  .delivery-status-table tr {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    padding: 14px;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .delivery-status-table td:nth-child(n) {
    grid-column: 1;
    grid-row: auto;
  }

  .delivery-status-table .delivery-share-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .delivery-status-table .delivery-share-actions button {
    width: 100%;
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.deploy-hint {
  margin: 0 0 14px;
}

.dashboard-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 18px;
}

.summary-card-link {
  color: inherit;
  text-decoration: none;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.summary-card-link:hover,
.summary-card-link:focus-visible {
  transform: translateY(-2px);
  border-color: var(--white);
  box-shadow: 0 14px 32px var(--shadow);
}

.summary-card-link small {
  display: block;
  margin-top: 12px;
  color: var(--muted);
  font-weight: 700;
}

.inventory-summary-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.inventory-tool-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.inventory-tool-groups > article {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
}

.inventory-tool-groups h3 {
  margin: 0 0 14px;
}

.inventory-tool-groups .dashboard-actions {
  margin: 0;
}

.inventory-other-devices {
  max-width: none;
}

.joe-os-version-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.joe-os-version-card {
  display: grid;
  gap: 10px;
  padding: 18px;
  padding-bottom: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  overflow: hidden;
}

.joe-os-version-card > div:first-child {
  display: grid;
  gap: 5px;
}

.joe-os-version-card > div:first-child span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.joe-os-version-card > div:first-child strong {
  font-size: 1.25rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.joe-os-version-links {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin: 0 -18px;
  border-top: 1px solid var(--line);
}

.joe-os-version-links a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 10px 8px;
  border: none;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  text-align: center;
  text-decoration: none;
  transition: background 0.12s ease;
}

.joe-os-version-links a:last-child {
  border-right: none;
}

.joe-os-version-links a:hover,
.joe-os-version-links a:focus-visible {
  background: rgb(255 255 255 / 5%);
  outline: none;
}

.joe-os-version-links span {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.joe-os-version-links strong {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--white);
}

@media (max-width: 1050px) {
  .inventory-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .inventory-summary-grid,
  .inventory-tool-groups {
    grid-template-columns: 1fr;
  }
}

.dashboard-scan-form {
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) auto auto;
  gap: 8px;
  flex: 1 1 420px;
  min-width: min(100%, 320px);
}

.dashboard-scan-form input {
  min-width: 0;
  width: 100%;
}

.dashboard-scan-form button {
  white-space: nowrap;
}

.add-menu {
  position: relative;
}

.add-menu summary {
  min-width: 120px;
  padding: 11px 12px;
  list-style: none;
  cursor: pointer;
  background: var(--white);
  color: var(--black);
  border: 1px solid var(--white);
  border-radius: 6px;
  font-weight: 700;
  text-align: center;
}

.add-menu summary::-webkit-details-marker {
  display: none;
}

.add-menu > div {
  position: absolute;
  right: 0;
  z-index: 12;
  display: grid;
  gap: 8px;
  min-width: 180px;
  margin-top: 8px;
  padding: 10px;
  background: var(--topbar-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 40px var(--shadow);
}

.section-title-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.export-menu {
  position: relative;
}

.export-menu summary {
  min-width: 96px;
  list-style: none;
  cursor: pointer;
  text-align: center;
}

.export-menu summary::-webkit-details-marker {
  display: none;
}

.export-menu-panel {
  position: absolute;
  right: 0;
  z-index: 12;
  display: grid;
  gap: 6px;
  min-width: 140px;
  margin-top: 8px;
  padding: 8px;
  background: var(--topbar-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 40px var(--shadow);
}

.export-menu-panel a {
  display: block;
  padding: 9px 10px;
  color: var(--text);
  text-decoration: none;
  border-radius: 6px;
}

.export-menu-panel a:hover,
.export-menu-panel a:focus-visible {
  color: var(--black);
  background: var(--white);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.metrics article,
.panel,
.table-section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metrics article {
  padding: 18px;
}

.metrics span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 10px;
}

.metrics strong {
  font-size: 34px;
}

.dashboard-hero {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.workflow-view-grid,
.health-grid,
.duplicate-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  padding: 18px;
}

.workflow-view,
.health-tile,
.duplicate-group,
.reorder-item {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 16px;
  background: var(--tile-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.workflow-view span,
.health-tile span,
.reorder-item span,
.duplicate-group span {
  color: var(--muted);
  font-size: 13px;
}

.workflow-view strong,
.health-tile strong {
  color: var(--white);
  font-size: 32px;
  line-height: 1;
}

.workflow-view small,
.health-tile small {
  color: var(--muted);
}

.backup-health-tile strong {
  font-size: 14px;
}

form.is-loading button {
  cursor: progress;
}

form.is-loading button[disabled] {
  opacity: 0.65;
}

.fleet-metrics {
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.fleet-metrics article {
  min-height: 0;
  padding: 12px 14px;
}

.fleet-metrics strong {
  font-size: 28px;
}

.fleet-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.fleet-list {
  display: grid;
  gap: 5px;
  padding: 10px;
}

.fleet-list p {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  margin: 0;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--tile-bg);
}

.fleet-list b {
  min-width: 0;
  overflow-wrap: anywhere;
}

.fleet-list span {
  flex: 0 0 auto;
  color: var(--white);
  font-weight: 800;
}

.fleet-version-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
  padding: 10px;
}

.fleet-version-grid .health-tile {
  gap: 5px;
  padding: 10px 12px;
}

.fleet-version-grid .health-tile strong {
  font-size: 24px;
}

.esper-fleet-filter-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
  padding: 10px 12px 6px;
}

.esper-fleet-filter-form label {
  flex: 1 1 150px;
  min-width: 136px;
}

.esper-fleet-filter-form .fleet-filter-search {
  flex-basis: 280px;
}

.esper-fleet-filter-form input,
.esper-fleet-filter-form select {
  min-height: 40px;
  padding: 8px 10px;
}

.fleet-filter-actions {
  display: flex;
  flex: 1 1 100%;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.fleet-filter-actions button,
.fleet-filter-actions .button-link {
  width: auto;
  min-height: 40px;
}

.esper-fleet-devices-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.esper-fleet-table-wrap {
  overflow-x: clip;
}

.esper-fleet-devices-table th,
.esper-fleet-devices-table td {
  padding: 6px 8px;
  line-height: 1.15;
  vertical-align: top;
}

.esper-fleet-devices-table .col-device {
  width: 21%;
}

.esper-fleet-devices-table .col-alias {
  width: 21%;
}

.esper-fleet-devices-table .col-full-group {
  width: 24%;
}

.esper-fleet-devices-table .col-model {
  width: 11%;
}

.esper-fleet-devices-table .col-cellular {
  width: 8%;
}

.esper-fleet-devices-table .col-joe-os {
  width: 7%;
}

.esper-fleet-devices-table .col-status {
  width: 4%;
}

.esper-fleet-devices-table .col-last-seen {
  width: 4%;
}

.esper-fleet-devices-table .col-full-group,
.esper-fleet-devices-table .col-device,
.esper-fleet-devices-table .col-alias,
.esper-fleet-devices-table .col-model,
.esper-fleet-devices-table .col-last-seen {
  white-space: normal;
  overflow-wrap: anywhere;
}

.esper-fleet-devices-table .col-cellular,
.esper-fleet-devices-table .col-joe-os,
.esper-fleet-devices-table .col-status {
  white-space: nowrap;
}

.esper-fleet-devices-table td span {
  line-height: 1.1;
}

.esper-fleet-devices-table td::before {
  display: none;
}

.esper-fleet-devices-table form {
  margin: 0;
}

@media (max-width: 1360px) {
  .esper-fleet-devices-table .col-device {
    width: 19%;
  }

  .esper-fleet-devices-table .col-alias {
    width: 19%;
  }

  .esper-fleet-devices-table .col-full-group {
    width: 22%;
  }

  .esper-fleet-devices-table .col-model {
    width: 12%;
  }

  .esper-fleet-devices-table .col-cellular {
    width: 9%;
  }

  .esper-fleet-devices-table .col-joe-os,
  .esper-fleet-devices-table .col-last-seen {
    width: 8%;
  }

  .esper-fleet-devices-table .col-status {
    width: 3%;
  }
}

@media (max-width: 1180px) {
  .esper-fleet-devices-table {
    min-width: 920px;
  }

  .esper-fleet-devices-table th,
  .esper-fleet-devices-table td {
    padding: 5px 6px;
    font-size: 12px;
  }

  .esper-fleet-devices-table .col-device {
    min-width: 150px;
  }

  .esper-fleet-devices-table .col-full-group {
    min-width: 160px;
  }

  .esper-fleet-table-wrap {
    overflow-x: auto;
  }
}

@media (max-width: 760px) {
  .esper-fleet-table-wrap {
    overflow-x: visible;
  }

  .esper-fleet-devices-table {
    min-width: 0;
    table-layout: auto;
  }

  .esper-fleet-devices-table thead {
    display: none;
  }

  .esper-fleet-devices-table,
  .esper-fleet-devices-table tbody,
  .esper-fleet-devices-table tr,
  .esper-fleet-devices-table td {
    display: block;
    width: 100%;
  }

  .esper-fleet-devices-table tbody {
    display: grid;
    gap: 12px;
  }

  .esper-fleet-devices-table tr {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--tile-bg);
  }

  .esper-fleet-devices-table td {
    display: grid;
    grid-template-columns: minmax(92px, 112px) minmax(0, 1fr);
    gap: 8px;
    padding: 4px 0;
    border: 0;
    white-space: normal;
  }

  .esper-fleet-devices-table td::before {
    display: block;
    content: attr(data-label);
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .esper-fleet-devices-table .col-status .fleet-status {
    justify-self: start;
  }

  .esper-fleet-devices-table .empty {
    display: block;
    padding: 14px 12px;
  }
}

/*
 * Keep every grouped Esper Fleet field visible in a split browser. At this
 * width each device becomes a compact card instead of squeezing the values.
 */
@media (min-width: 761px) and (max-width: 1400px) {
  .esper-fleet-table-wrap {
    overflow-x: visible;
  }

  .esper-fleet-devices-table {
    min-width: 0;
    table-layout: auto;
  }

  .esper-fleet-devices-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .esper-fleet-devices-table,
  .esper-fleet-devices-table tbody {
    display: block;
    width: 100%;
  }

  .esper-fleet-devices-table tbody {
    display: grid;
    gap: 10px;
    padding: 10px;
  }

  .esper-fleet-devices-table tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 18px;
    width: 100%;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--tile-bg);
  }

  .esper-fleet-devices-table td,
  .esper-fleet-devices-table .col-device,
  .esper-fleet-devices-table .col-alias,
  .esper-fleet-devices-table .col-model,
  .esper-fleet-devices-table .col-full-group,
  .esper-fleet-devices-table .col-cellular,
  .esper-fleet-devices-table .col-joe-os,
  .esper-fleet-devices-table .col-status,
  .esper-fleet-devices-table .col-last-seen {
    display: block;
    width: auto;
    min-width: 0;
    padding: 0;
    border: 0;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .esper-fleet-devices-table td::before {
    display: block;
    content: attr(data-label);
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .esper-fleet-devices-table .col-status .fleet-status {
    justify-self: start;
  }

  .esper-fleet-devices-table .empty {
    display: block;
    grid-column: 1 / -1;
    padding: 14px 12px;
  }
}

.device-os-info-table {
  min-width: 1540px;
}

.joe-os-versions-table {
  /* Eight narrow columns; sized to fit beside the sidebar at 1440px so the
     Status and Last Seen columns are not stranded behind horizontal scroll. */
  min-width: 1040px;
  table-layout: fixed;
}

.joe-os-versions-table th:nth-child(1) { width: 13%; }
.joe-os-versions-table th:nth-child(2) { width: 19%; }
.joe-os-versions-table th:nth-child(3) { width: 13%; }
.joe-os-versions-table th:nth-child(4) { width: 12%; }
.joe-os-versions-table th:nth-child(5) { width: 11%; }
.joe-os-versions-table th:nth-child(6) { width: 13%; }
.joe-os-versions-table th:nth-child(7) { width: 8%; }
.joe-os-versions-table th:nth-child(8) { width: 11%; }

.joe-os-versions-table td {
  overflow-wrap: normal;
  word-break: normal;
}

.device-os-info-table th:nth-child(1),
.device-os-info-table td:nth-child(1) { width: 17%; }

.device-os-info-table th:nth-child(2),
.device-os-info-table td:nth-child(2) { width: 17%; }

.device-os-info-table th:nth-child(3),
.device-os-info-table td:nth-child(3) { width: 12%; }

.device-os-info-table th:nth-child(4),
.device-os-info-table td:nth-child(4) { width: 9%; }

.device-os-info-table th:nth-child(5),
.device-os-info-table td:nth-child(5) { width: 12%; }

.device-os-info-table th:nth-child(6),
.device-os-info-table td:nth-child(6) { width: 12%; }

.device-os-info-table th:nth-child(7),
.device-os-info-table td:nth-child(7) { width: 11%; }

.device-os-info-table th:nth-child(8),
.device-os-info-table td:nth-child(8) { width: 9%; }

.device-os-info-table th:nth-child(9),
.device-os-info-table td:nth-child(9) { width: 12%; }

.fleet-table {
  min-width: 1120px;
  table-layout: fixed;
}

.fleet-table th:nth-child(1),
.fleet-table td:nth-child(1) { width: 22%; }

.fleet-table th:nth-child(2),
.fleet-table td:nth-child(2) { width: 14%; }

.fleet-table th:nth-child(3),
.fleet-table td:nth-child(3) { width: 22%; }

.fleet-table th:nth-child(4),
.fleet-table td:nth-child(4) { width: 14%; }

.fleet-table th:nth-child(5),
.fleet-table td:nth-child(5) { width: 14%; }

.fleet-table th:nth-child(6),
.fleet-table td:nth-child(6) { width: 14%; }

.fleet-table th,
.fleet-table td {
  padding: 9px 10px;
  overflow-wrap: anywhere;
  vertical-align: top;
}

.fleet-table td span {
  color: var(--muted);
  font-size: 12px;
}

/*
 * The generic fleet-table column widths are declared after the Esper device
 * card rules above. Reset them here on phones so they cannot squeeze card
 * values into the original desktop percentages.
 */
@media (max-width: 760px) {
  .esper-fleet-page,
  .esper-fleet-page .table-section,
  .esper-fleet-page .esper-fleet-table-wrap {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .esper-fleet-filter-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    padding: 14px;
  }

  .esper-fleet-filter-form label,
  .esper-fleet-filter-form .fleet-filter-search,
  .esper-fleet-filter-form input,
  .esper-fleet-filter-form select,
  .esper-fleet-filter-form .fleet-filter-actions {
    width: 100%;
    min-width: 0;
  }

  .esper-fleet-devices-table,
  .esper-fleet-devices-table tbody,
  .esper-fleet-devices-table tr {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100%;
    box-sizing: border-box;
  }

  .esper-fleet-devices-table tbody {
    padding: 10px;
  }

  .esper-fleet-devices-table tr {
    overflow: hidden;
  }

  .esper-fleet-devices-table td,
  .esper-fleet-devices-table td.col-device,
  .esper-fleet-devices-table td.col-alias,
  .esper-fleet-devices-table td.col-model,
  .esper-fleet-devices-table td.col-full-group,
  .esper-fleet-devices-table td.col-cellular,
  .esper-fleet-devices-table td.col-joe-os,
  .esper-fleet-devices-table td.col-status,
  .esper-fleet-devices-table td.col-last-seen {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100%;
    padding: 8px 0;
    overflow-wrap: anywhere;
    word-break: normal;
    white-space: normal;
  }

  .esper-fleet-devices-table td + td {
    border-top: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  }

  .esper-fleet-devices-table td::before {
    margin: 0;
    line-height: 1.2;
  }

  .esper-fleet-devices-table td > *,
  .esper-fleet-devices-table td > a,
  .esper-fleet-devices-table td > span {
    min-width: 0;
    max-width: 100%;
  }

  .esper-fleet-devices-table .col-status .fleet-status {
    width: fit-content;
  }

  .esper-fleet-secondary-table,
  .esper-fleet-secondary-table tbody,
  .esper-fleet-secondary-table tr,
  .esper-fleet-secondary-table td {
    display: block;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100%;
    box-sizing: border-box;
  }

  .esper-fleet-secondary-table {
    table-layout: auto;
  }

  .esper-fleet-secondary-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .esper-fleet-secondary-table tbody {
    display: grid;
    gap: 10px;
    padding: 10px;
  }

  .esper-fleet-secondary-table tr {
    padding: 12px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--tile-bg);
  }

  .esper-fleet-secondary-table td {
    padding: 8px 0;
    border: 0;
    overflow-wrap: anywhere;
    word-break: normal;
    white-space: normal;
  }

  .esper-fleet-secondary-table td + td {
    border-top: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  }

  .esper-fleet-secondary-table td::before {
    display: block;
    content: attr(data-label);
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
    line-height: 1.2;
    text-transform: uppercase;
  }

  .esper-fleet-secondary-table .empty {
    padding: 14px 12px;
  }

  .esper-fleet-secondary-table .empty::before {
    display: none;
  }
}

.fleet-status {
  display: inline-flex;
  align-items: center;
  min-width: 74px;
  justify-content: center;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--ink);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.fleet-status.online {
  border-color: #56b878;
  background: rgb(86 184 120 / 18%);
  color: #9be0ae;
}

.fleet-status.offline {
  border-color: #dd6b6b;
  background: rgb(221 107 107 / 18%);
  color: #f0a6a6;
}

.fleet-status.deleted {
  border-color: #888;
  background: rgb(255 255 255 / 8%);
  color: var(--muted);
}

.reorder-list {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.reorder-item {
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
}

.reorder-counts {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.reorder-counts span {
  padding: 7px 10px;
  background: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.duplicate-group h3 {
  margin: 0;
  font-size: 17px;
}

.duplicate-group p {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.summary-card {
  display: flex;
  flex-direction: column;
  min-height: unset;
  padding: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 3px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.summary-card > span {
  padding: 18px 20px 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.summary-card > strong {
  display: block;
  padding: 6px 20px 16px;
  margin: 0;
  font-family: var(--font-display);
  font-size: 50px;
  line-height: 1;
  font-weight: 400;
  color: var(--white);
}

.summary-card > .split-list {
  border-top: 1px solid var(--line);
  flex: 1;
}

/* Colored top accent per card */
.dashboard-primary-groups .summary-card:nth-child(1),
.inventory-summary-grid .summary-card:nth-child(1) {
  border-top-color: var(--brand-gold);
}
.dashboard-primary-groups .summary-card:nth-child(2),
.inventory-summary-grid .summary-card:nth-child(2) {
  border-top-color: #6c7440;   /* moss, lifted to read on dark */
}
.dashboard-primary-groups .summary-card:nth-child(3),
.inventory-summary-grid .summary-card:nth-child(3) {
  border-top-color: var(--brand-cream);
}
.dashboard-primary-groups .summary-card:nth-child(4),
.inventory-summary-grid .summary-card:nth-child(4) {
  border-top-color: #7c7c7c;   /* stone */
}

.hardware-page {
  max-width: 1180px;
}

.hardware-hero {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  padding: 26px;
  background: var(--summary-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.hardware-hero h2 {
  margin-top: 8px;
  font-size: 34px;
}

.hardware-alias-guide {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(320px, 1.1fr);
  gap: 18px;
  margin-bottom: 18px;
  padding: 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.hardware-alias-guide h2 {
  margin: 6px 0 8px;
}

.hardware-alias-guide p {
  color: var(--muted);
}

.hardware-alias-guide code {
  display: block;
  margin-top: 12px;
  padding: 10px 12px;
  overflow-wrap: anywhere;
  background: var(--tile-bg);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.hardware-alias-guide dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.hardware-alias-guide dl div {
  display: grid;
  gap: 2px;
  padding: 10px;
  background: var(--tile-bg);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.hardware-alias-guide dt {
  font-weight: 800;
}

.hardware-alias-guide dd {
  margin: 0;
  color: var(--muted);
  line-height: 1.3;
}

.hardware-model-reference {
  margin-bottom: 18px;
  padding: 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.hardware-model-reference table {
  min-width: 420px;
}

.hardware-model-reference code {
  padding: 3px 6px;
  background: var(--tile-bg);
  border: 1px solid var(--line);
  border-radius: 5px;
}

.hardware-cost {
  display: grid;
  align-content: center;
  gap: 8px;
  min-width: 260px;
  padding: 18px;
  background: var(--tile-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.hardware-cost span,
.hardware-cost small,
.hardware-panel p {
  color: var(--muted);
}

.hardware-cost strong {
  font-size: 32px;
}

.hardware-actions {
  display: flex;
  align-items: center;
}

.hardware-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 16px;
}

.hardware-panel {
  padding: 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.hardware-panel.primary {
  grid-row: span 2;
}

.hardware-panel.hold {
  border-color: #8d7b39;
}

.hardware-panel h3 {
  margin: 0 0 8px;
  font-size: 20px;
}

.hardware-panel ul {
  display: grid;
  gap: 9px;
  margin: 14px 0 0;
  padding-left: 20px;
}

.hardware-panel li {
  line-height: 1.35;
}

.hardware-qr-section {
  margin-top: 18px;
}

.qr-enroll-picker {
  display: grid;
  gap: 8px;
  max-width: 420px;
  margin: 0 0 16px;
}

.qr-enroll-picker span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.qr-enroll-grid {
  display: grid;
  grid-template-columns: minmax(260px, 520px);
  gap: 16px;
  justify-content: center;
}

.qr-enroll-card {
  display: grid;
  gap: 14px;
  align-content: start;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.qr-enroll-image-link {
  display: block;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.qr-enroll-card[hidden] {
  display: none;
}

.qr-enroll-card h3 {
  margin: 0 0 6px;
  font-size: 17px;
}

.qr-enroll-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.35;
}

.qr-enroll-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  background: #fff;
}

.qr-enroll-card-note {
  border-color: #8d7b39;
  background: var(--summary-bg);
}

.qr-open-large {
  justify-content: center;
  width: 100%;
}

.hardware-edit-form {
  display: grid;
  gap: 16px;
}

.hardware-edit-cost,
.hardware-edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 16px;
}

.hardware-edit-form h2 {
  margin: 0;
  font-size: 18px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.device-detail-actions {
  justify-content: center;
}

.checkout-layout {
  display: grid;
  grid-template-columns: minmax(280px, 380px) minmax(360px, 1fr) minmax(320px, 0.9fr);
  gap: 16px;
  align-items: start;
}

.checkout-summary,
.checkout-list {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.checkout-items {
  display: grid;
  gap: 8px;
  max-height: 68vh;
  overflow: auto;
}

.checkout-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: var(--tile-bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
}

.checkout-row.is-scanned {
  border-color: #6aa77a;
  background: rgb(106 167 122 / 14%);
}

.checkout-row input[type="checkbox"] {
  width: auto;
}

.checkout-row small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.accessory-checkout-row {
  grid-template-columns: minmax(0, 1fr) 96px;
}

.accessory-checkout-row input {
  width: 96px;
}

.checkout-scan {
  display: grid;
  gap: 8px;
}

.scan-field.checkout-role-field {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  width: 100%;
  min-width: 0;
}

.scan-field.checkout-role-field select {
  width: 100%;
  min-width: 0;
}

.scan-field.checkout-role-field button {
  width: auto;
  min-width: 108px;
}

@media (max-width: 1100px) {
  .scan-field.checkout-role-field {
    grid-template-columns: 1fr;
  }

  .scan-field.checkout-role-field button {
    width: 100%;
  }
}

.add-checkout-items {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  padding: 0 0 12px;
}

.add-checkout-items .section-title h3 {
  margin: 0;
  color: var(--text);
  font-size: 16px;
}

.add-checkout-item-form {
  display: grid;
  grid-template-columns: 76px minmax(180px, 0.9fr) minmax(260px, 1fr) minmax(92px, 0.35fr) 72px;
  gap: 8px;
  align-items: center;
  padding: 0 12px;
}

.add-checkout-item-form label {
  align-self: center;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.add-checkout-item-form input,
.add-checkout-item-form select {
  min-width: 0;
  width: 100%;
  height: 38px;
  padding: 8px 10px;
}

.add-checkout-item-form .quantity-input {
  width: 100%;
}

.add-checkout-item-form button {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  white-space: nowrap;
}

.checkout-items-table {
  min-width: 960px;
}

.checkout-detail-page button,
.checkout-detail-page button.secondary,
.checkout-detail-page button.danger,
.checkout-detail-page .small-link {
  justify-content: center;
  background: var(--panel-2);
  color: var(--text);
  border-color: var(--line);
  font-weight: 600;
  text-align: center;
}

.checkout-detail-page .small-link:hover,
.checkout-detail-page .small-link:focus-visible,
.checkout-detail-page button:hover,
.checkout-detail-page button:focus-visible {
  background: rgb(255 255 255 / 7%);
  border-color: var(--muted);
  color: var(--white);
  outline: none;
}

.checkout-detail-page button.danger {
  background: transparent;
  color: #e08080;
  border-color: rgb(180 60 60 / 45%);
}

.checkout-detail-page button.danger:hover {
  background: rgb(180 40 40 / 14%);
  color: #ffa0a0;
  border-color: rgb(200 60 60 / 70%);
  outline: none;
}

.checkout-detail-page .quiet-action,
.checkout-detail-page button.quiet-action,
.checkout-detail-page .small-link.quiet-action {
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
}

.checkout-detail-page .quiet-action:hover,
.checkout-detail-page .quiet-action:focus-visible {
  background: rgb(255 255 255 / 6%);
  border-color: var(--muted);
  color: var(--text);
  outline: none;
}

.serial-bnn-stack {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.serial-bnn-stack > * {
  min-width: 0;
  overflow-wrap: anywhere;
}

.tracking-panel {
  margin: 18px 0;
  padding: 18px;
}

.tracking-form {
  display: grid;
  grid-template-columns: minmax(160px, 0.75fr) minmax(240px, 1fr) minmax(160px, 0.75fr) auto;
  gap: 12px;
  align-items: end;
}

.partner-shipping-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.partner-shipping-card {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.partner-shipping-card:last-child {
  grid-column: 1 / -1;
}

.partner-shipping-card h3,
.partner-shipping-options h3 {
  margin: 0;
}

.partner-shipping-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.partner-shipping-form label,
.partner-shipping-card .inline-status,
.partner-shipping-card small {
  min-width: 0;
}

.partner-shipping-form button {
  grid-column: 1 / -1;
  width: 100%;
  min-width: 0;
}

.partner-shipping-link {
  display: block;
  overflow-wrap: anywhere;
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: var(--tile-bg);
  color: var(--white);
}

.compact-detail-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.partner-shipping-address {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--tile-bg);
}

.partner-shipping-address div {
  display: grid;
  gap: 4px;
}

.partner-shipping-card .inline-form {
  width: 100%;
}

.partner-shipping-card .inline-form button {
  width: 100%;
  min-width: 0;
}

.delivery-pill {
  margin-top: 8px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 10px;
}

.detail-grid p {
  margin: 0;
  padding: 10px;
  background: var(--tile-bg);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.detail-grid b,
.detail-grid span {
  display: block;
}

.detail-grid b {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.line-items {
  overflow: auto;
  margin: 12px 0 0;
  padding: 12px;
  background: var(--tile-bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  white-space: pre-wrap;
}

.split-list {
  display: grid;
  gap: 0;
}

.split-list p,
.split-list a,
.accessory-tile {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin: 0;
  padding: 11px 20px;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgb(255 255 255 / 5%);
  border-radius: 0;
}

.split-list a {
  transition: background 0.12s ease;
}

.split-list a:hover,
.split-list a:focus-visible {
  background: rgb(255 255 255 / 4%);
  outline: none;
  transform: none;
}

.split-list b {
  color: var(--text);
  font-weight: 500;
  font-size: 0.875rem;
}

.split-list em {
  color: var(--white);
  font-style: normal;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
}

.accessory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  padding: 18px;
}

.dashboard-category-grid {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.dashboard-category-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--tile-bg);
}

.accessory-grid.compact {
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  padding: 14px;
}

.accessory-tile {
  align-items: center;
  flex-wrap: wrap;
}

.accessory-tile img,
.thumb {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--tile-bg);
}

.image-preview-trigger {
  display: inline-flex;
  min-width: 0;
  width: auto;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.image-preview-modal[hidden] {
  display: none;
}

.image-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
}

.image-preview-backdrop {
  position: absolute;
  inset: 0;
  background: var(--modal-scrim);
}

.image-preview-dialog {
  position: relative;
  display: grid;
  gap: 14px;
  width: min(920px, 100%);
  max-height: min(86vh, 820px);
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 80px var(--shadow);
}

.image-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.image-preview-large {
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--tile-bg);
}

.form-image-preview {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--tile-bg);
}

.form-image-preview[hidden] {
  display: none;
}

.form-image-preview img {
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--black);
}

.form-image-preview figcaption {
  color: var(--muted);
  font-size: 13px;
}

.scan-field {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.search-mode-field {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.barcode-search-field {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.search-mode-select {
  width: auto;
  min-width: 92px;
}

.scan-button {
  width: auto;
  min-width: 110px;
}

.compact-scan-button {
  min-width: 76px;
  padding-inline: 12px;
  white-space: nowrap;
}

.barcode-scanner {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: var(--modal-scrim);
}

.barcode-scanner[hidden] {
  display: none;
}

.barcode-scanner-panel {
  width: min(720px, 100%);
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.barcode-video {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #050505;
}

.accessory-tile span {
  font-size: 26px;
  font-weight: 700;
}

.accessory-tile small {
  flex: 0 0 100%;
  color: var(--muted);
}

.dashboard-qty-form {
  flex: 0 0 100%;
}

.dashboard-qty-form input {
  width: min(110px, 42%);
}

.accessory-actions {
  display: flex;
  flex: 0 0 100%;
  gap: 8px;
  flex-wrap: wrap;
}

.category-card-grid {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.category-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--tile-bg);
}

.category-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.category-card-head h3 {
  margin: 0;
  font-size: 18px;
}

.category-card-head span {
  color: var(--muted);
  font-size: 13px;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.device-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  align-items: end;
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--tool-bg);
}

.device-tools form {
  margin: 0;
}

.device-toolbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 2px;
}

.device-view-actions,
.device-export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.device-view-actions form {
  display: contents;
}

.device-view-actions form.bulk-devices-jump {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.bulk-devices-jump select {
  min-height: 42px;
  min-width: 170px;
}

.bulk-mode-switch {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  margin: 10px 0 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--tool-bg);
}

.bulk-mode-switch label {
  display: grid;
  gap: 6px;
  min-width: 260px;
  flex: 1 1 320px;
}

.bulk-mode-switch select {
  min-height: 44px;
  width: 100%;
}

.bulk-mode-switch .filter-actions {
  display: flex;
  align-items: end;
  margin: 0;
}

.bulk-mode-switch .filter-actions button {
  min-height: 44px;
  min-width: 108px;
  padding: 10px 18px;
}

.device-view-actions .button-link,
.device-view-actions button,
.device-export-actions .button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 0;
  min-height: 42px;
  padding: 10px 14px;
  white-space: nowrap;
}

.saved-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.filter-search {
  min-width: 0;
  grid-column: span 2;
}

.filter-wide {
  min-width: 0;
  grid-column: span 2;
}

.filter-sort {
  min-width: 0;
  grid-column: span 2;
}

.compact-model-filter {
  align-content: start;
}

.compact-model-filter input[type="hidden"] {
  display: none;
}

.selected-filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.selected-filter-pills span {
  max-width: 100%;
  padding: 3px 7px;
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.filter-actions {
  display: flex;
  gap: 10px;
  align-items: end;
  align-self: end;
  min-width: 0;
  grid-column: span 2;
}

.filter-actions button,
.filter-actions .small-link {
  min-height: 42px;
}

.checkbox-row {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 10px;
}

.checkbox-row input {
  width: auto;
  flex: 0 0 auto;
}

.compact-form {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.panel {
  padding: 18px;
}

.alerts-page {
  gap: 18px;
}

.alerts-settings-panel {
  max-width: 980px;
  width: 100%;
}

.alerts-settings-form {
  gap: 16px;
}

.settings-tabs {
  display: grid;
  gap: 16px;
}

.settings-tab-input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.settings-tab-list {
  display: flex;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--ink);
  overflow-x: auto;
}

.settings-tab-list label {
  min-width: 96px;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  white-space: nowrap;
}

.settings-tab-list label:hover,
#alerts-tab-setup:checked ~ .settings-tab-list label[for="alerts-tab-setup"],
#alerts-tab-slack:checked ~ .settings-tab-list label[for="alerts-tab-slack"],
#alerts-tab-printer:checked ~ .settings-tab-list label[for="alerts-tab-printer"],
#alerts-tab-status:checked ~ .settings-tab-list label[for="alerts-tab-status"] {
  border-color: var(--line);
  background: var(--panel-2);
  color: var(--text);
}

.settings-tab-panels {
  min-height: 320px;
}

.settings-tab-panel {
  display: none;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--tool-bg);
}

#alerts-tab-setup:checked ~ .settings-tab-panels .alerts-tab-setup-panel,
#alerts-tab-slack:checked ~ .settings-tab-panels .alerts-tab-slack-panel,
#alerts-tab-printer:checked ~ .settings-tab-panels .alerts-tab-printer-panel,
#alerts-tab-status:checked ~ .settings-tab-panels .alerts-tab-status-panel {
  display: grid;
}

.settings-panel-head {
  display: grid;
  gap: 4px;
}

.settings-panel-head h3,
.settings-card h4 {
  margin: 0;
}

.settings-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.settings-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.settings-card:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.settings-save-row {
  display: flex;
  justify-content: flex-end;
  padding-top: 4px;
}

.alerts-test-panel {
  max-width: 980px;
  width: 100%;
}

.status-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}

.status-filter {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  background: var(--ink);
}

.status-filter.active,
.status-filter:hover {
  color: var(--text);
  background: var(--panel-2);
}

.status-pill.sent {
  color: var(--success-text);
}

.status-pill.failed {
  color: var(--verizon-text);
}

.status-pill.skipped {
  color: var(--muted);
}

.status-pill.sending {
  color: #f4d39a;
}

.status-pill.disabled {
  color: var(--muted);
}

.esper-events-table {
  min-width: 1500px;
}

/*
 * .esper-events-table also uses the shared .fleet-table rules, whose first six
 * percentage columns already total 100%. Give every Events Log column an
 * explicit width so the remaining cells are not squeezed to a few pixels and
 * wrapped into extremely tall rows.
 */
.esper-events-table th.esper-event-select-col,
.esper-events-table td.esper-event-select-col { width: 3%; }

.esper-events-table th.esper-event-detected-col,
.esper-events-table td.esper-event-detected-col { width: 14%; }

.esper-events-table th.esper-event-device-col,
.esper-events-table td.esper-event-device-col { width: 16%; }

.esper-events-table th.esper-event-company-col,
.esper-events-table td.esper-event-company-col { width: 15%; }

.esper-events-table th.esper-event-activity-col,
.esper-events-table td.esper-event-activity-col { width: 14%; }

.esper-events-table th.esper-event-source-col,
.esper-events-table td.esper-event-source-col { width: 10%; }

.esper-events-table th.esper-event-actor-col,
.esper-events-table td.esper-event-actor-col { width: 12%; }

.esper-events-table th.esper-event-result-col,
.esper-events-table td.esper-event-result-col { width: 9%; }

.esper-events-table th.esper-event-console-col,
.esper-events-table td.esper-event-console-col { width: 7%; }

[data-esper-events-delete-form] {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0;
}

.esper-event-select-col {
  min-width: 42px;
  text-align: center;
}

.esper-event-select-col input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
}

.esper-events-table td:nth-child(2),
.esper-events-table td:nth-child(3) {
  overflow-wrap: anywhere;
}

.esper-event-device-link {
  display: inline;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: var(--text);
  line-height: inherit;
  overflow-wrap: anywhere;
  text-decoration: underline;
  text-decoration-color: #777;
  text-underline-offset: 2px;
}

.esper-event-device-link:hover,
.esper-event-device-link:focus-visible {
  color: var(--white);
  text-decoration-color: currentColor;
}

.esper-event-bnn-link {
  color: var(--muted);
}

.esper-event-device-meta {
  display: flex;
  gap: 6px;
  align-items: baseline;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.esper-event-device-meta b {
  flex: 0 0 38px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.esper-event-device-meta > span,
.esper-event-device-meta > a {
  min-width: 0;
  overflow-wrap: anywhere;
}

.esper-events-table .esper-event-source.enterprise {
  border-color: #9c86e8;
  background: rgb(156 134 232 / 14%);
  color: #d6ccff;
}

.esper-events-table .esper-event-source.google-play {
  border-color: #7ea8df;
  background: rgb(126 168 223 / 14%);
  color: #c5dcff;
}

.esper-version-change-arrow {
  display: inline-block;
  padding: 0 4px;
  color: var(--muted);
}

.alert-history-table td:nth-child(5),
.alert-history-table td:nth-child(6) {
  overflow-wrap: anywhere;
}

.compact-sync-details {
  grid-template-columns: repeat(3, minmax(90px, 1fr));
  width: min(420px, 100%);
}

.bulk-preview-table td:nth-child(3),
.bulk-preview-table td:nth-child(4),
.bulk-preview-table td:nth-child(6) {
  overflow-wrap: anywhere;
}

.stack {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.profile-panel {
  max-width: 680px;
  margin: 0 auto;
}

.profile-head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.avatar {
  width: 96px;
  height: 96px;
  flex: 0 0 96px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--tile-bg);
}

.avatar-fallback {
  display: grid;
  place-items: center;
  color: var(--black);
  background: var(--white);
  font-size: 38px;
  font-weight: 700;
}

.table-section {
  overflow: hidden;
  margin-bottom: 24px;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

.section-title h2 {
  color: var(--text);
}

.table-wrap {
  overflow-x: auto;
  width: 100%;
  -webkit-overflow-scrolling: touch;
}

.checkout-history-section {
  container: checkout-history / inline-size;
}

@container checkout-history (max-width: 1250px) {
  .checkout-history-section,
  .checkout-history-table-wrap {
    overflow: visible;
  }

  .checkout-history-table,
  .checkout-history-table thead,
  .checkout-history-table tbody,
  .checkout-history-table tr,
  .checkout-history-table td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .checkout-history-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .checkout-history-table tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 24px;
    padding: 18px;
    border-bottom: 1px solid var(--line);
    background: var(--table-row-bg);
  }

  .checkout-history-table tr:nth-child(even) {
    background: var(--table-row-alt-bg);
  }

  .checkout-history-table td {
    display: grid;
    grid-template-columns: minmax(88px, 28%) minmax(0, 1fr);
    gap: 10px;
    align-content: start;
    padding: 0;
    border-bottom: 0;
    overflow-wrap: anywhere;
  }

  .checkout-history-table td::before {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.4;
    text-transform: uppercase;
  }

  .checkout-history-table td:nth-child(1)::before { content: "Date"; }
  .checkout-history-table td:nth-child(2)::before { content: "Checkout"; }
  .checkout-history-table td:nth-child(3)::before { content: "Created By"; }
  .checkout-history-table td:nth-child(4)::before { content: "Hardware"; }
  .checkout-history-table td:nth-child(5)::before { content: "Delivery"; }
  .checkout-history-table td:nth-child(6)::before { content: "Links"; }
  .checkout-history-table td:nth-child(7)::before { content: "Notes"; }
  .checkout-history-table td:nth-child(8)::before { content: "Actions"; }

  .checkout-history-table .action-cell {
    display: grid;
    grid-template-columns: minmax(88px, 28%) minmax(0, 1fr);
    gap: 10px;
    text-align: left;
    white-space: normal;
  }

  .checkout-history-table .action-cell > * {
    grid-column: 2;
  }

  .checkout-history-table .action-cell > :not(form) {
    width: fit-content;
  }

  .checkout-history-table .empty {
    grid-column: 1 / -1;
    display: block;
    text-align: center;
  }

  .checkout-history-table .empty::before {
    content: "";
    display: none;
  }
}

@container checkout-history (max-width: 720px) {
  .checkout-history-table tr {
    grid-template-columns: 1fr;
  }
}

/* Browser-width fallback keeps Actions visible if container queries are unavailable
   or an older cached layout is used in a medium-width window. */
@media (max-width: 1350px) {
  .checkout-history-section,
  .checkout-history-table-wrap {
    overflow: visible;
  }

  .checkout-history-table,
  .checkout-history-table thead,
  .checkout-history-table tbody,
  .checkout-history-table tr,
  .checkout-history-table td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .checkout-history-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .checkout-history-table tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 24px;
    padding: 18px;
    border-bottom: 1px solid var(--line);
    background: var(--table-row-bg);
  }

  .checkout-history-table tr:nth-child(even) {
    background: var(--table-row-alt-bg);
  }

  .checkout-history-table td {
    display: grid;
    grid-template-columns: minmax(88px, 28%) minmax(0, 1fr);
    gap: 10px;
    align-content: start;
    padding: 0;
    border-bottom: 0;
    overflow-wrap: anywhere;
  }

  .checkout-history-table td::before {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.4;
    text-transform: uppercase;
  }

  .checkout-history-table td:nth-child(1)::before { content: "Date"; }
  .checkout-history-table td:nth-child(2)::before { content: "Checkout"; }
  .checkout-history-table td:nth-child(3)::before { content: "Created By"; }
  .checkout-history-table td:nth-child(4)::before { content: "Hardware"; }
  .checkout-history-table td:nth-child(5)::before { content: "Delivery"; }
  .checkout-history-table td:nth-child(6)::before { content: "Links"; }
  .checkout-history-table td:nth-child(7)::before { content: "Notes"; }
  .checkout-history-table td:nth-child(8)::before { content: "Actions"; }

  .checkout-history-table .action-cell {
    display: grid;
    grid-template-columns: minmax(88px, 28%) minmax(0, 1fr);
    gap: 10px;
    text-align: left;
    white-space: normal;
  }

  .checkout-history-table .action-cell > * {
    grid-column: 2;
  }

  .checkout-history-table .action-cell > :not(form) {
    width: fit-content;
  }

  .checkout-history-table .empty {
    grid-column: 1 / -1;
    display: block;
    text-align: center;
  }

  .checkout-history-table .empty::before {
    content: "";
    display: none;
  }
}

@media (max-width: 760px) {
  .checkout-history-table tr {
    grid-template-columns: 1fr;
  }
}

.filter-bar {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.filter-bar label {
  min-width: 220px;
}

.pagination {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

.pagination-bottom {
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.pagination .button-link {
  width: auto;
  min-width: 104px;
  text-align: center;
}

.manual-tracking-badge {
  display: block;
  margin-top: 4px;
  color: #93c5fd;
  font-size: .72rem;
  font-weight: 700;
}

.manual-return-entry-panel {
  margin-bottom: 18px;
}

.manual-return-entry-panel.edit-active {
  box-shadow: 0 0 0 2px rgba(147, 197, 253, 0.45);
  border-radius: 14px;
}

.manual-return-entry-panel summary {
  cursor: pointer;
  color: var(--text);
  font-size: .95rem;
  font-weight: 800;
}

.manual-return-entry-panel > p {
  margin: 8px 0 0;
}

.manual-return-entry-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 10px;
  align-items: end;
  margin-top: 12px;
}

.manual-return-entry-form label {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.manual-return-entry-form label span {
  color: var(--muted);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.manual-return-entry-form label span small {
  font-size: inherit;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.manual-return-entry-form select,
.manual-return-entry-form input,
.manual-return-entry-form textarea {
  min-width: 0;
  width: 100%;
}

.manual-return-entry-form .manual-return-notes {
  grid-column: 1 / -2;
}

.manual-return-entry-form button {
  width: 100%;
}

@media (max-width: 1050px) {
  .manual-return-entry-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .manual-return-entry-form .manual-return-notes {
    grid-column: 1 / -1;
  }
}

@media (max-width: 620px) {
  .pagination {
    justify-content: center;
  }

  .pagination > span:not(.button-link) {
    flex-basis: 100%;
    order: -1;
    text-align: center;
  }

  .manual-return-entry-form {
    grid-template-columns: 1fr;
  }

  .manual-return-entry-form .manual-return-notes {
    grid-column: auto;
  }
}

.receiving-grid,
.digest-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.receiving-grid > .panel {
  min-width: 0;
}

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

.receiving-device-details p,
.receiving-device-details span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.stacked-form {
  display: grid;
  gap: 12px;
}

.stacked-form label {
  display: grid;
  gap: 6px;
}

.readiness-panel {
  margin-bottom: 16px;
}

.readiness-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.packing-workflow-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.packing-step {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1rem;
  background: var(--surface);
}

.packing-step h3 {
  margin-top: 0;
}

.packing-create-group {
  margin-top: 1rem;
}

.packing-create-group summary {
  cursor: pointer;
  font-weight: 700;
}

.package-proof-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.package-proof-item {
  position: relative;
  width: 80px;
  height: 80px;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #111;
}

.package-proof-item:hover .package-proof-overlay { opacity: 1; }

.package-proof-link {
  display: block;
  width: 100%;
  height: 100%;
}

.package-proof-photo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0;
  background: #111;
  cursor: zoom-in;
}

.package-proof-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgb(0 0 0 / 58%);
  opacity: 0;
  transition: opacity 140ms;
  pointer-events: none;
}

.package-proof-overlay form { pointer-events: auto; }

.package-proof-remove-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgb(160 30 30 / 90%);
  border: 1px solid rgb(255 100 100 / 50%);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  pointer-events: auto;
}

/* Lightbox */
.photo-lightbox {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
}

.photo-lightbox::backdrop { background: rgb(0 0 0 / 88%); }

.photo-lightbox-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 24px;
  cursor: zoom-out;
}

.photo-lightbox-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 8px 48px rgb(0 0 0 / 60%);
  cursor: default;
}

.photo-lightbox-close {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgb(255 255 255 / 12%);
  border: 1px solid rgb(255 255 255 / 22%);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.package-photo-phone {
  margin-top: 1rem;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}

.package-photo-phone summary {
  cursor: pointer;
  font-weight: 700;
}

.package-photo-phone-content {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 1rem;
  align-items: center;
  margin-top: .75rem;
}

.partner-shipping-public-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 16px 48px;
}

.partner-shipping-public-panel {
  margin-top: 18px;
}

.partner-shipping-public-form {
  display: grid;
  gap: 18px;
}

.partner-shipping-paste-box {
  display: grid;
  gap: 12px;
}

.partner-shipping-paste-box textarea {
  min-height: 150px;
  resize: vertical;
}

.partner-shipping-paste-actions {
  display: grid;
  gap: 8px;
}

.partner-shipping-public-actions {
  display: grid;
  gap: 12px;
}

.partner-shipping-public-actions .button-link,
.partner-shipping-public-actions button {
  width: 100%;
  text-align: center;
  justify-content: center;
}

.partner-shipping-address-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.partner-shipping-address-grid label,
.partner-shipping-option {
  display: grid;
  gap: 6px;
}

.address-span-2 {
  grid-column: span 2;
}

.partner-shipping-options {
  display: grid;
  gap: 12px;
}

.partner-shipping-option {
  grid-template-columns: auto 1fr;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--tile-bg);
}

.partner-shipping-option-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  flex-wrap: wrap;
}

.partner-shipping-option-price {
  color: var(--white);
  font-size: 18px;
}

.partner-shipping-option span {
  display: grid;
  gap: 4px;
}

.partner-shipping-option em {
  font-style: normal;
  color: var(--muted);
}

.package-photo-phone-content img {
  width: 150px;
  height: 150px;
  border-radius: 10px;
  background: white;
}

.package-photo-mobile-page {
  width: min(100% - 24px, 620px);
  margin: 0 auto;
  padding: 24px 0;
}

.package-photo-mobile-card {
  display: grid;
  gap: 1rem;
}

.package-photo-mobile-card h1,
.package-photo-mobile-card p {
  margin: 0;
}

.mobile-native-photo-picker input[type="file"] {
  display: block;
  width: 100%;
  min-height: 56px;
  padding: 14px;
  background: var(--control-bg);
  color: var(--text);
  font-size: 16px;
}

.delivery-tracking-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  margin-bottom: 18px;
}

.delivery-tracking-head h2,
.delivery-tracking-head p {
  margin: 0 0 6px;
}

.delivery-tracking-head-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.delivery-stage-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.delivery-stage-card {
  display: grid;
  gap: 6px;
  min-height: 118px;
  padding: 16px;
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--line);
  border-left: 5px solid #777;
  border-radius: 8px;
  background: var(--panel);
}

.delivery-stage-card strong {
  font-size: 30px;
}

.delivery-stage-card small {
  color: var(--muted);
}

.delivery-stage-card.active {
  outline: 2px solid var(--white);
}

.delivery-stage-card.stage-package_ready { border-left-color: #9ca3af; }
.delivery-stage-card.stage-label_created { border-left-color: #60a5fa; }
.delivery-stage-card.stage-not_dropped_off { border-left-color: #f59e0b; }
.delivery-stage-card.stage-on_the_way { border-left-color: #a78bfa; }
.delivery-stage-card.stage-out_for_delivery { border-left-color: #f59e0b; }
.delivery-stage-card.stage-delivered { border-left-color: #34d399; }
.delivery-stage-card.stage-needs_attention { border-left-color: #ef4444; }
.delivery-stage-card.stage-return_requested { border-left-color: #9ca3af; }

.tracking-stage.stage-needs_attention,
.danger-text {
  color: #fecaca;
}

.tracking-stage.stage-package_ready,
.tracking-stage.stage-return_requested {
  border-color: #9ca3af;
  color: #d1d5db;
}

.tracking-stage.stage-label_created {
  border-color: #60a5fa;
  color: #93c5fd;
}

.tracking-stage.stage-not_dropped_off {
  background: #fef3c7;
  color: #92400e;
}

.tracking-stage.stage-on_the_way {
  border-color: #a78bfa;
  color: #c4b5fd;
}

.tracking-stage.stage-out_for_delivery {
  border-color: #f59e0b;
  color: #fcd34d;
}

.tracking-stage.stage-delivered {
  border-color: #34d399;
  color: #6ee7b7;
}

.tracking-stage.stage-needs_attention {
  border-color: #ef4444;
}

.attention-row {
  background: rgba(239, 68, 68, .08);
}

.dashboard-delivery-alerts {
  border-bottom: 1px solid var(--line);
}

.dashboard-delivery-status-group {
  margin-bottom: 24px;
  overflow: hidden;
}

.dashboard-delivery-status-title {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.dashboard-delivery-status-row {
  padding: 0 0 4px;
}

.dashboard-delivery-status-row > .section-title {
  padding: 18px 18px 0;
}

.dashboard-delivery-status-row > .section-title h3 {
  margin: 0;
  font-size: 18px;
}

.dashboard-attention-section {
  margin-bottom: 24px;
}

.warehouse-attention-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 12px;
  padding: 18px;
}

.warehouse-attention-card {
  display: grid;
  align-content: start;
  min-height: 118px;
  padding: 15px;
  border: 1px solid var(--line);
  border-top: 4px solid #9ca3af;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  background: var(--panel);
  transition: transform .15s ease, border-color .15s ease;
}

.warehouse-attention-card:hover,
.warehouse-attention-card:focus-visible {
  transform: translateY(-2px);
  border-color: var(--muted);
}

.warehouse-attention-card span {
  font-size: 13px;
  font-weight: 700;
}

.warehouse-attention-card strong {
  margin: 7px 0 5px;
  font-size: 30px;
}

.warehouse-attention-card small {
  color: var(--muted);
  line-height: 1.3;
}

.warehouse-attention-card.attention-broken,
.warehouse-attention-card.attention-delivery { border-top-color: #ef4444; }
.warehouse-attention-card.attention-returned { border-top-color: #34d399; }
.warehouse-attention-card.attention-label { border-top-color: #60a5fa; }
.warehouse-attention-card.attention-stock { border-top-color: #f59e0b; }
.warehouse-attention-card.attention-packing { border-top-color: #a78bfa; }

.dashboard-delivery-stages {
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  padding: 18px;
  margin: 0;
}

.dashboard-delivery-stages .delivery-stage-card {
  min-height: 90px;
}

.delivery-attention-alert {
  display: grid;
  gap: 8px;
  margin: 0 18px 18px;
  padding: 14px;
  border: 1px solid #ef4444;
  border-radius: 8px;
  background: rgba(239, 68, 68, .08);
}

.delivery-attention-alert a {
  color: var(--text);
}

@media (max-width: 900px) {
  .packing-workflow-grid {
    grid-template-columns: 1fr;
  }

  .partner-shipping-grid,
  .partner-shipping-form,
  .compact-detail-grid,
  .partner-shipping-address-grid {
    grid-template-columns: 1fr;
  }

  .address-span-2 {
    grid-column: auto;
  }

  .delivery-stage-grid,
  .dashboard-delivery-stages,
  .warehouse-attention-grid {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
  }

  .delivery-tracking-head {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (min-width: 1500px) {
  .partner-shipping-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .partner-shipping-card:last-child {
    grid-column: auto;
  }
}

@media (max-width: 480px) {
  .package-photo-phone-content {
    grid-template-columns: 1fr;
  }
}

.readiness-item {
  display: grid;
  gap: 5px;
  min-height: 86px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--tile-bg);
}

.readiness-item b {
  color: var(--text);
}

.readiness-item span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.readiness-item.ok {
  border-color: rgb(106 167 122 / 70%);
}

.readiness-item.warn {
  border-color: rgb(226 178 92 / 75%);
  background: rgb(226 178 92 / 10%);
}

.status-pill.success {
  border-color: rgb(106 167 122 / 80%);
  color: #b8f0c5;
}

.status-pill.warning {
  border-color: rgb(226 178 92 / 80%);
  color: #f4d39a;
}

.digest-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.digest-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.digest-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  align-items: center;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
}

.digest-list li:first-child {
  border-top: 0;
}

.digest-list li span {
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.digest-list .small-link {
  justify-self: end;
}

.reorder-actions {
  display: grid;
  gap: 8px;
  min-width: 320px;
}

.reorder-actions form {
  display: grid;
  grid-template-columns: minmax(80px, 0.5fr) minmax(140px, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.reorder-actions form:first-child {
  grid-template-columns: minmax(140px, 1fr) auto;
}

.inline-details {
  display: grid;
  gap: 5px;
}

.inline-details summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 700;
}

.inline-details small {
  color: var(--muted);
  line-height: 1.35;
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

.devices-table {
  /* Sized to fit a 1440px laptop beside the 280px sidebar, so the Actions
     column is reachable without horizontal scrolling. It was 1280px, which
     pushed Edit/Logs off-screen on exactly the screens the warehouse uses. */
  min-width: 1040px;
  table-layout: fixed;
}

/* Column widths live on the semantic .device-*-col classes in
   .compact-inventory-table, not on nth-child. The checkbox column only exists
   on the archived view (allow_bulk_edit), so positional rules silently shifted
   by one everywhere else: Device inherited the checkbox's 3% and collapsed to
   about 38px, and the widths stopped summing to 100% so Actions was clipped. */

th, td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

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

.logs-table th:nth-child(1),
.logs-table td:nth-child(1) { width: 13%; }

.logs-table th:nth-child(2),
.logs-table td:nth-child(2) { width: 9%; }

.logs-table th:nth-child(3),
.logs-table td:nth-child(3) { width: 20%; }

.logs-table th:nth-child(4),
.logs-table td:nth-child(4) { width: 15%; }

.logs-table th:nth-child(5),
.logs-table td:nth-child(5) { width: 16%; }

.logs-table th:nth-child(6),
.logs-table td:nth-child(6) { width: 27%; }

.joe-os-schedule-page {
  min-width: 0;
}

.joe-os-schedule-page .table-section {
  min-width: 0;
}

.joe-os-schedule-tabs {
  margin-top: 12px;
}

.joe-os-batch-summary-panel {
  margin-bottom: 22px;
}

.joe-os-batch-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.joe-os-batch-card {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-left: 4px solid #d5a444;
  border-radius: 12px;
  background: var(--table-row-bg);
}

.joe-os-batch-card.completed {
  border-left-color: #4db984;
}

.joe-os-batch-card.needs_attention {
  border-left-color: #ef4444;
}

.joe-os-batch-card-heading,
.joe-os-batch-counts {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.joe-os-batch-card-heading > div {
  display: grid;
  gap: 3px;
}

.joe-os-batch-card-heading > div > span,
.joe-os-batch-timeline dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.joe-os-batch-card-heading strong {
  font-size: 20px;
}

.joe-os-batch-counts {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.joe-os-batch-counts span {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  color: var(--muted);
}

.joe-os-batch-counts b {
  color: var(--text);
  font-size: 18px;
}

.joe-os-batch-timeline {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.joe-os-batch-timeline div {
  min-width: 0;
}

.joe-os-batch-timeline dt,
.joe-os-batch-timeline dd {
  margin: 0;
}

.joe-os-batch-timeline dd {
  margin-top: 3px;
  font-size: 13px;
}

.joe-os-schedule-table .status-pill.sent {
  color: var(--use-text);
}

.joe-os-schedule-table .status-pill.installed {
  color: var(--success-text);
}

.joe-os-schedule-table {
  width: 100%;
  min-width: 1260px;
  table-layout: fixed;
}

.joe-os-schedule-table th,
.joe-os-schedule-table td {
  vertical-align: top;
  overflow-wrap: anywhere;
  word-break: normal;
}

.joe-os-schedule-table th.schedule-select-col,
.joe-os-schedule-table td.schedule-select-col {
  width: 44px;
  text-align: center;
}

.joe-os-schedule-table th.schedule-status-col,
.joe-os-schedule-table td.schedule-status-col {
  width: 180px;
  overflow-wrap: normal;
}

.joe-os-schedule-table th.schedule-time-col,
.joe-os-schedule-table td.schedule-time-col {
  width: 230px;
  overflow-wrap: normal;
}

.joe-os-schedule-table th.schedule-device-col,
.joe-os-schedule-table td.schedule-device-col {
  width: 250px;
}

.joe-os-schedule-table th.schedule-version-col,
.joe-os-schedule-table td.schedule-version-col {
  width: 180px;
}

.joe-os-schedule-table th.schedule-result-col,
.joe-os-schedule-table td.schedule-result-col {
  width: auto;
}

.joe-os-schedule-table th.schedule-actions-col,
.joe-os-schedule-table td.schedule-actions-col {
  width: 132px;
  text-align: center;
}

.joe-os-schedule-table .action-cluster {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  justify-content: stretch;
  width: 100%;
}

.joe-os-schedule-table .action-cluster > *,
.joe-os-schedule-table .action-cluster button,
.joe-os-schedule-table .action-cluster .small-link {
  justify-content: center;
  width: 100%;
  min-width: 0;
  white-space: normal;
}

.joe-os-schedule-table tr.needs-attention-row td:first-child {
  border-left: 4px solid #ef4444;
}

.joe-os-schedule-table tr.joe-os-schedule-date-row th {
  padding: 12px 16px;
  border-top: 2px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--tile-bg) 86%, var(--accent) 14%);
  color: var(--text);
  font-size: 14px;
  letter-spacing: .02em;
  text-align: left;
}

.joe-os-schedule-table tr.joe-os-schedule-date-row:first-child th {
  border-top: 0;
}

.joe-os-history-date-filter {
  grid-template-columns: minmax(220px, 320px) auto;
  width: fit-content;
  max-width: 100%;
  margin: 12px 0;
}

.joe-os-history-date-filter .filter-wide,
.joe-os-history-date-filter .filter-actions {
  grid-column: auto;
}

.schedule-timeline {
  display: grid;
  gap: 8px;
}

.schedule-timeline span {
  display: grid;
  gap: 2px;
}

.schedule-timeline small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.schedule-timeline b {
  font-size: 13px;
  line-height: 1.35;
}

.broken-logs-table {
  width: 100%;
  min-width: 1320px;
  table-layout: fixed;
}

.broken-logs-table th:nth-child(1),
.broken-logs-table td:nth-child(1) { width: 3%; }

.broken-logs-table th:nth-child(2),
.broken-logs-table td:nth-child(2) { width: 13%; }

.broken-logs-table th:nth-child(3),
.broken-logs-table td:nth-child(3) { width: 14%; }

.broken-logs-table th:nth-child(4),
.broken-logs-table td:nth-child(4) { width: 13%; }

.broken-logs-table th:nth-child(5),
.broken-logs-table td:nth-child(5) { width: 18%; }

.broken-logs-table th:nth-child(6),
.broken-logs-table td:nth-child(6) { width: 24%; }

.broken-logs-table th:nth-child(7),
.broken-logs-table td:nth-child(7) { width: 9%; }

.broken-logs-table th:nth-child(8),
.broken-logs-table td:nth-child(8) { width: 10%; }

.broken-logs-table th:nth-child(8),
.broken-logs-table .action-cell {
  text-align: center;
}

.broken-logs-table th,
.broken-logs-table td {
  padding: 6px 7px;
  vertical-align: top;
  line-height: 1.15;
  font-size: 13px;
}

.broken-logs-table td {
  overflow-wrap: anywhere;
}

.broken-logs-table td strong,
.broken-logs-table td span,
.broken-logs-table td code {
  line-height: 1.15;
}

.broken-logs-table td br {
  line-height: 1;
}

.broken-logs-table .action-cluster {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  justify-content: stretch;
  width: min(100%, 112px);
  margin-inline: auto;
}

.broken-logs-table .action-cluster > *,
.broken-logs-table .action-cluster button,
.broken-logs-table .action-cluster .small-link,
.broken-logs-table .action-cluster .button-link {
  justify-content: center;
  width: 100%;
  min-width: 0;
  min-height: 0;
  padding: 5px 7px;
  font-size: 11px;
  white-space: nowrap;
  line-height: 1.1;
  overflow-wrap: normal;
}

.damage-photo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

.damage-photo-slot {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.damage-photo-slot span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.1;
  text-transform: uppercase;
}

.damage-photo-slot img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

.damage-photo-slot em {
  display: grid;
  min-height: 42px;
  place-items: center;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  border: 1px dashed var(--line);
  border-radius: 6px;
  background: var(--panel-2);
}

.damage-photo-upload-button {
  width: 100%;
  margin-top: 6px;
  min-height: 26px;
  padding: 4px 8px;
  font-size: 11px;
}

.damage-photo-dialog {
  width: min(560px, calc(100vw - 28px));
  max-width: 100%;
  padding: 0;
  overflow: hidden;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 24px 80px var(--shadow);
}

.damage-photo-dialog::backdrop {
  background: var(--modal-scrim);
}

.damage-photo-dialog .damage-photo-form {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.damage-photo-dialog-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.damage-photo-dialog-head h2,
.damage-photo-dialog-head p,
.damage-photo-dialog-device {
  margin: 0;
}

.damage-photo-dialog-head button {
  width: auto;
  flex: 0 0 auto;
}

.damage-photo-dialog-device {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.damage-photo-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.damage-photo-fields label {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.damage-photo-fields label > span {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.damage-photo-fields input[type="file"] {
  width: 100%;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}

.damage-photo-fields input[type="file"]::file-selector-button {
  min-height: 44px;
  margin: 0 8px 6px 0;
  padding: 9px 12px;
  border: 1px solid #777;
  border-radius: 6px;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  background: var(--tile-bg);
  cursor: pointer;
}

.damage-photo-fields small {
  color: var(--muted);
  font-weight: 400;
  line-height: 1.35;
  text-transform: none;
}

.damage-photo-dialog-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.damage-photo-dialog-actions button {
  width: 100%;
  min-height: 48px;
}

@media (max-width: 560px) {
  .damage-photo-dialog .damage-photo-form {
    gap: 14px;
    padding: 14px;
  }

  .damage-photo-dialog-head {
    align-items: stretch;
    flex-direction: column;
  }

  .damage-photo-dialog-head button,
  .damage-photo-fields {
    width: 100%;
  }

  .damage-photo-fields {
    grid-template-columns: 1fr;
  }
}

.change-cell {
  vertical-align: top;
}

.change-list {
  display: grid;
  gap: 4px;
}

.change-item {
  display: grid;
  gap: 3px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.change-field {
  color: var(--white);
  font-weight: 700;
}

.change-values {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.change-values div {
  min-width: 0;
  padding: 0;
  border-radius: 0;
  background: transparent;
}

.change-values span {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.change-values p,
.log-note {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.15;
}

.devices-table th,
.devices-table td {
  padding: 9px 10px;
  overflow-wrap: anywhere;
}

.devices-table td {
  vertical-align: top;
}

.devices-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--table-head-bg);
}

.devices-table tbody tr {
  background: var(--table-row-bg);
}

.devices-table tbody tr:nth-child(even) {
  background: var(--table-row-alt-bg);
}

.devices-table tbody tr:hover {
  background: var(--table-row-hover-bg);
}

.devices-table .device-group-row,
.devices-table .device-group-row:nth-child(even),
.devices-table .device-group-row:hover {
  background: color-mix(in srgb, var(--ink) 8%, var(--card-bg));
}

.devices-table .device-group-row td {
  width: 100% !important;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}

.devices-table .device-group-row span {
  display: inline-flex;
  max-width: 100%;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.device-cell {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.device-cell.compact {
  align-content: start;
  justify-items: start;
}

.device-cell strong {
  color: var(--white);
  font-size: 13px;
  line-height: 1.2;
}

.device-cell span {
  color: var(--text);
  line-height: 1.2;
}

.device-cell .meta-row span {
  overflow-wrap: normal;
  word-break: normal;
}

.device-cell .meta-row {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr);
  gap: 6px;
  align-items: start;
}

.device-cell b {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
}

.device-cell code {
  min-width: 0;
  font-size: 12px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.inline-link {
  width: max-content;
}

.checkout-edit-device {
  display: inline;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  text-decoration: underline;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

td code {
  color: var(--white);
}

.muted {
  color: var(--muted);
}

td form {
  margin: 0;
}

td select {
  min-width: 130px;
}

.empty {
  color: var(--muted);
  text-align: center;
  padding: 28px;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.export-period-panel {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 16px;
}

.export-period-panel h2 {
  margin-bottom: 4px;
}

.export-period-panel p {
  margin: 0;
}

.export-period-form {
  align-items: flex-end;
  display: flex;
  gap: 8px;
  margin: 0;
}

.export-period-form label {
  display: grid;
  gap: 4px;
}

.action-heading,
.action-cell {
  text-align: center;
}

.action-cell {
  white-space: normal;
}

.action-cluster {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: center;
  align-items: center;
}

.devices-table .action-cluster {
  display: grid;
  grid-template-columns: 1fr;
  justify-content: end;
  align-items: start;
  gap: 6px;
  width: 100%;
}

.devices-table .action-cluster .small-link,
.devices-table .action-cluster button {
  justify-content: center;
  min-width: 0;
  width: 100%;
  white-space: normal;
  min-height: 0;
  padding: 6px 8px;
  font-size: 12px;
  line-height: 1.1;
}

.action-cluster form {
  margin: 0;
}

.devices-table .action-cluster form {
  width: 100%;
  min-width: 0;
}

.devices-table .device-action-form {
  display: grid;
  align-items: stretch;
}

.devices-table .device-print-label-form {
  grid-template-columns: 70px minmax(0, 1fr);
  align-items: end;
  gap: 8px;
}

.devices-table .device-print-quantity {
  display: grid;
  gap: 3px;
  min-width: 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  text-align: left;
}

.devices-table .device-print-label-form .quantity-input {
  width: 100%;
  min-width: 0;
  min-height: 34px;
  padding: 6px 9px;
  border-color: #777;
  background: var(--panel-2);
  color: var(--white);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
}

.action-cell .small-link,
.action-cell form {
  display: inline-flex;
  vertical-align: middle;
}

.action-cell form {
  margin-left: 8px;
}

.action-cluster form {
  margin-left: 0;
}

.inline-form {
  display: flex;
  gap: 8px;
  align-items: center;
}

.inline-form input {
  width: 88px;
}

.inline-label-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.inline-form .item-name-input {
  width: min(360px, 38vw);
  min-width: 220px;
}

.inline-form.add-checkout-item-form input,
.inline-form.add-checkout-item-form select {
  width: 100%;
  min-width: 0;
}

.quantity-input {
  width: 90px;
}

.user-role-form select {
  min-width: 130px;
}

.small-link {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 12px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.825rem;
  font-weight: 600;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.small-link:hover,
.small-link:focus-visible {
  background: rgb(255 255 255 / 5%);
  border-color: var(--muted);
  color: var(--white);
  outline: none;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 8px;
  border: 1px solid #777;
  border-radius: 999px;
  color: var(--text);
  font-size: 12px;
}

.workflow-pill.warehouse {
  border-color: #6aa77a;
  background: rgb(106 167 122 / 14%);
  color: var(--success-text);
}

.workflow-pill.deployed {
  border-color: #8fa7d8;
  background: rgb(143 167 216 / 14%);
  color: var(--deployed-text);
}

.operator-pill.no-sim {
  border-color: #777;
  background: rgb(255 255 255 / 6%);
}

.operator-pill.wifi {
  border-color: #72c7a0;
  background: rgb(114 199 160 / 14%);
  color: #103c2a;
}

.operator-pill.t-mobile {
  border-color: #e06bb0;
  background: rgb(224 107 176 / 14%);
  color: var(--tmobile-text);
}

.operator-pill.hologram {
  border-color: #79b7d8;
  background: rgb(121 183 216 / 14%);
  color: var(--hologram-text);
}

.operator-pill.verizon {
  border-color: #dc7d7d;
  background: rgb(220 125 125 / 14%);
  color: var(--verizon-text);
}

.use-pill {
  border-color: var(--brand-gold);
  background: var(--brand-gold-soft);
  color: var(--use-text);
}

.usage-section {
  margin-bottom: 24px;
}

.usage-grid,
.usage-summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  padding: 14px 18px;
}

.usage-tile,
.usage-summary span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--ink);
}

.usage-tile span,
.usage-summary b {
  color: var(--muted);
  font-size: 12px;
}

.usage-tile strong,
.usage-summary em {
  color: var(--white);
  font-style: normal;
  font-weight: 700;
}

.sync-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
}

.sync-details span {
  display: grid;
  gap: 4px;
}

.inline-status {
  min-height: 18px;
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

button.secondary {
  background: transparent;
  color: var(--text);
  border-color: #777;
}

.export-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 16px;
}

.export-section-head {
  margin: 22px 0 12px;
}

.export-section-head h2 {
  margin-bottom: 6px;
}

.export-section-head .muted {
  margin: 0;
}

/*
 * Compact desktop and mobile layout
 *
 * Keep the shared sidebar visible on normal laptop and desktop screens.
 * Only switch it to an off-canvas drawer when the viewport is genuinely too
 * narrow to support both the sidebar and operational content.
 */
@media (max-width: 760px) {
  body:has(.nav-actions) {
    padding-left: 0;
  }

  .menu-toggle {
    display: block;
    flex: 0 0 auto;
    min-width: 104px;
    margin-left: auto;
  }

  .nav-actions {
    width: min(340px, calc(100vw - 28px));
    transform: translateX(-106%);
    visibility: hidden;
  }

  .nav-actions.is-open {
    transform: translateX(0);
    visibility: visible;
  }
}

@media (max-width: 980px) {
  body:has(.nav-actions) {
    padding-left: 0;
  }

  .topbar,
  .section-title,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

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

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

  .filter-search,
  .filter-wide,
  .filter-actions {
    grid-column: 1 / -1;
  }

  .metrics,
  .grid,
  .two-col,
  .dashboard-hero,
  .fleet-grid,
  .workflow-view-grid,
  .health-grid,
  .duplicate-list,
  main.two-panel,
  .export-grid {
    grid-template-columns: 1fr;
  }

  .export-period-panel,
  .export-period-form {
    align-items: stretch;
    flex-direction: column;
  }

  .settings-card-grid {
    grid-template-columns: 1fr;
  }

  .settings-card:last-child:nth-child(odd) {
    grid-column: auto;
  }

  .settings-save-row {
    justify-content: stretch;
  }

  .settings-save-row button {
    width: 100%;
  }

  .search {
    flex-direction: column;
  }

  .filter-actions {
    align-items: stretch;
  }

  button,
  .button-link {
    width: 100%;
    text-align: center;
  }

  .nav-actions a,
  .nav-actions button,
  .nav-submenu summary {
    width: 100%;
    text-align: left;
  }

  .barcode-search-field .compact-scan-button {
    width: auto;
  }

  .menu-toggle {
    display: block;
    margin-left: 0;
  }

  .global-crm-link {
    width: 100%;
    margin-left: 0;
    text-align: center;
  }

  .nav-actions {
    width: min(340px, calc(100vw - 28px));
    transform: translateX(-106%);
    visibility: hidden;
  }

  .nav-actions.is-open {
    transform: translateX(0);
    visibility: visible;
  }

  .role-preview-bar {
    margin-left: 0;
  }

  .role-preview-bar form {
    flex-wrap: wrap;
    justify-content: center;
  }

  .role-preview-bar button {
    width: auto;
  }

  .dashboard-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: stretch;
    gap: 10px;
    margin-bottom: 14px;
  }

  .dashboard-scan-form {
    grid-column: 1 / -1;
    grid-template-columns: minmax(86px, max-content) minmax(0, 1fr) auto minmax(128px, max-content);
    min-width: 0;
  }

  .dashboard-scan-form button {
    width: auto;
  }

  .dashboard-actions > *,
  .dashboard-actions .button-link,
  .add-menu summary {
    min-width: 0;
    min-height: 48px;
  }

  .dashboard-actions .button-link,
  .add-menu summary {
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: normal;
  }

  .action-cluster button,
  .action-cluster .small-link {
    width: auto;
  }
}

@media (max-width: 1700px) {
  /* Ten fields in a 6-column grid split 6 + 5 + 2: two ragged rows and
     "Sort by" stranded on a third. Twelve columns let both rows come out
     exact -- Search 4 + four fields of 2, then six fields of 2 -- so the
     form reads as two deliberate rows with Apply closing the second. */
  .device-filter-form {
    grid-template-columns: repeat(12, minmax(0, 1fr));
  }

  .device-filter-form > label {
    grid-column: span 2;
  }

  /* One class alone loses to .device-filter-form > label above, so the
     search override carries the parent too. */
  .device-filter-form > .filter-search {
    grid-column: span 4;
  }

  .filter-actions,
  .device-filter-form > button[type="submit"] {
    grid-column: span 2;
  }
}

@media (max-width: 1400px) {
  .device-tools {
    grid-template-columns: 1fr;
  }

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

  .filter-search,
  .filter-wide,
  .filter-actions {
    grid-column: 1 / -1;
  }

  .filter-actions {
    align-items: stretch;
  }

  .joe-os-history-date-filter {
    grid-template-columns: minmax(220px, 320px) auto;
  }

  .joe-os-history-date-filter .filter-wide,
  .joe-os-history-date-filter .filter-actions {
    grid-column: auto;
  }

  .device-tools > form:not(.device-filter-form) {
    justify-self: stretch;
  }

  .device-tools > .action-cluster {
    justify-self: stretch;
  }

  .device-export-actions {
    justify-self: stretch;
  }

  .devices-page .table-section {
    overflow: visible;
  }

  .devices-page .table-wrap {
    overflow-x: visible;
  }

  .devices-table,
  .devices-table thead,
  .devices-table tbody,
  .devices-table tr,
  .devices-table td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .devices-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .devices-table tr {
    display: grid;
    gap: 14px;
    padding: 16px;
    border-bottom: 1px solid var(--line);
  }

  .devices-table .device-group-row {
    display: block;
    padding: 0;
    border-bottom: 0;
  }

  .devices-table td {
    display: grid;
    grid-template-columns: minmax(96px, 26%) minmax(0, 1fr);
    gap: 12px;
    width: 100% !important;
    padding: 0;
    border-bottom: 0;
  }

  .devices-table td::before {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
  }

  .devices-table .device-group-row td {
    display: block;
    padding: 10px 12px;
  }

  .devices-table .device-group-row td::before {
    content: "";
    display: none;
  }

  .devices-table td:nth-child(1)::before { content: "Device"; }
  .devices-table td:nth-child(2)::before { content: "Status"; }
  .devices-table td:nth-child(3)::before { content: "Use"; }
  .devices-table td:nth-child(4)::before { content: "Assignment"; }
  .devices-table td:nth-child(5)::before { content: "Esper"; }
  .devices-table td:nth-child(6)::before { content: "Dates"; }
  .devices-table td:nth-child(7)::before { content: "Actions"; }

  .devices-table .action-cell {
    display: grid;
    grid-template-columns: minmax(96px, 26%) minmax(0, 1fr);
    text-align: left;
    white-space: normal;
  }

  .devices-table .action-cluster {
    grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
    justify-content: stretch;
    width: 100%;
  }

}

@media (max-width: 760px) {
  .joe-os-schedule-page .table-section {
    overflow: visible;
  }

  .joe-os-history-date-filter {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .joe-os-history-date-filter .filter-actions {
    flex-wrap: wrap;
  }

  .joe-os-schedule-page .table-wrap {
    overflow-x: visible;
  }

  .joe-os-schedule-table,
  .joe-os-schedule-table tbody,
  .joe-os-schedule-table tr,
  .joe-os-schedule-table td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .joe-os-schedule-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .joe-os-schedule-table tr {
    display: grid;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--line);
    background: var(--table-row-bg);
  }

  .joe-os-schedule-table tr:nth-child(even) {
    background: var(--table-row-alt-bg);
  }

  .joe-os-schedule-table tr.joe-os-schedule-date-row {
    display: block;
    padding: 0;
    background: transparent;
  }

  .joe-os-schedule-table tr.joe-os-schedule-date-row th {
    display: block;
    width: 100%;
    padding: 12px 14px;
  }

  .joe-os-schedule-table td,
  .joe-os-schedule-table td.schedule-select-col,
  .joe-os-schedule-table td.schedule-status-col,
  .joe-os-schedule-table td.schedule-time-col,
  .joe-os-schedule-table td.schedule-device-col,
  .joe-os-schedule-table td.schedule-version-col,
  .joe-os-schedule-table td.schedule-result-col,
  .joe-os-schedule-table td.schedule-actions-col {
    display: grid;
    grid-template-columns: minmax(116px, 24%) minmax(0, 1fr);
    gap: 10px;
    width: 100%;
    padding: 0;
    border-bottom: 0;
    text-align: left;
  }

  .joe-os-schedule-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    line-height: 1.2;
    text-transform: uppercase;
  }

  .joe-os-schedule-table td.schedule-select-col {
    display: flex;
    align-items: center;
    justify-content: flex-start;
  }

  .joe-os-schedule-table td.schedule-select-col::before {
    min-width: 116px;
  }

  .joe-os-schedule-table .action-cluster {
    grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  }
}

@media (max-width: 760px) {
  .topbar {
    gap: 14px;
    padding: 16px 14px;
  }

  .brand {
    min-width: 0;
    gap: 12px;
    align-items: center;
  }

  .joe-logo {
    width: 58px;
    height: 58px;
    flex-basis: 58px;
  }

  h1 {
    font-size: 22px;
    line-height: 1.08;
  }

  .eyebrow {
    font-size: 11px;
  }

  main {
    padding: 14px;
  }

  .role-preview-bar form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    padding: 8px;
  }

  .role-preview-bar label {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    min-width: 0;
    white-space: nowrap;
  }

  .role-preview-bar select {
    width: 100%;
  }

  .role-preview-bar button {
    min-width: 78px;
    padding-inline: 12px;
  }

  .role-preview-note {
    grid-column: 1 / -1;
    max-width: none;
  }

  .menu-toggle {
    min-width: 0;
    min-height: 48px;
  }

  .dashboard-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-scan-form {
    grid-template-columns: auto minmax(0, 1fr) auto;
    min-height: 54px;
  }

  .dashboard-scan-form button[type="submit"] {
    grid-column: 1 / -1;
  }

  .add-menu > div {
    left: 0;
    right: auto;
    min-width: min(78vw, 240px);
  }

  .dashboard-hero {
    gap: 12px;
    margin-bottom: 16px;
  }

  .summary-card > span {
    font-size: 11px;
    padding: 14px 16px 0;
  }

  .summary-card > strong {
    font-size: 48px;
    padding: 4px 16px 12px;
  }

  .split-list {
    gap: 0;
  }

  .split-list p,
  .split-list a {
    gap: 10px;
    padding: 10px 16px;
  }

  .split-list b {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .split-list em {
    flex: 0 0 auto;
    min-width: 2ch;
    text-align: right;
  }

  .table-section {
    margin-bottom: 16px;
  }

  .section-title {
    padding: 14px;
  }

  .section-title-actions {
    align-items: stretch;
    width: 100%;
  }

  .export-menu,
  .export-menu summary {
    width: 100%;
  }

  .workflow-view-grid,
  .health-grid,
  .duplicate-list,
  .reorder-list,
  .accessory-grid {
    padding: 12px;
  }

  main.wide-page {
    padding: 12px;
  }

  .device-tools {
    padding: 12px;
  }

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

  .devices-table td,
  .devices-table .action-cell {
    grid-template-columns: 1fr;
  }

  .joe-os-schedule-table td,
  .joe-os-schedule-table td.schedule-select-col,
  .joe-os-schedule-table td.schedule-status-col,
  .joe-os-schedule-table td.schedule-time-col,
  .joe-os-schedule-table td.schedule-device-col,
  .joe-os-schedule-table td.schedule-version-col,
  .joe-os-schedule-table td.schedule-result-col,
  .joe-os-schedule-table td.schedule-actions-col {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .joe-os-schedule-table td.schedule-select-col::before {
    min-width: 0;
  }

  .joe-os-schedule-table .action-cluster {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .joe-os-batch-summary-grid,
  .joe-os-batch-timeline {
    grid-template-columns: 1fr;
  }

  .joe-os-batch-card-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .broken-logs-table tr {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 14px;
    border-bottom: 1px solid var(--line);
    background: var(--table-row-bg);
  }

  .broken-logs-page .table-wrap {
    overflow-x: visible;
  }

  .broken-logs-table,
  .broken-logs-table tbody,
  .broken-logs-table td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .broken-logs-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .broken-logs-table td {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 0;
    border-bottom: 0;
  }

  .broken-logs-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    line-height: 1.2;
    text-transform: uppercase;
    margin-bottom: -4px;
  }

  .broken-logs-table .action-cluster {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .change-values {
    grid-template-columns: 1fr;
  }

  .devices-table td::before,
  .devices-table .action-cell::before {
    margin-bottom: -4px;
  }

  .device-cell .meta-row {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .sync-details {
    grid-template-columns: 1fr;
  }

  .scan-field {
    grid-template-columns: 1fr;
  }

  .usage-grid,
  .usage-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 12px;
  }

  .hardware-hero,
  .hardware-alias-guide,
  .hardware-grid,
  .qr-enroll-grid,
  .hardware-edit-cost,
  .hardware-edit-grid,
  .checkout-layout,
  .detail-grid,
  .tracking-form,
  .reorder-item {
    grid-template-columns: 1fr;
  }

  .hardware-hero {
    display: grid;
    padding: 18px;
  }

  .hardware-qr-section {
    margin-left: -10px;
    margin-right: -10px;
  }

  .qr-enroll-card {
    padding: 12px;
  }

  .qr-enroll-image-link {
    padding: 10px;
  }

  .hardware-cost {
    min-width: 0;
  }

  .add-checkout-items {
    overflow: hidden;
    gap: 8px;
    padding: 0 0 12px;
  }

  .add-checkout-item-form {
    grid-template-columns: 70px minmax(0, 1fr);
    gap: 8px;
    padding: 0 12px;
  }

  .add-checkout-item-form label {
    align-self: center;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
  }

  .add-checkout-item-form input,
  .add-checkout-item-form select,
  .add-checkout-item-form button {
    grid-column: 2;
    width: 100%;
  }

  .add-checkout-item-form .quantity-input {
    max-width: none;
  }

  .add-checkout-item-form button {
    min-height: 44px;
  }

  .checkout-items-table,
  .checkout-items-table thead,
  .checkout-items-table tbody,
  .checkout-items-table tr,
  .checkout-items-table td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .checkout-items-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .checkout-items-table tr {
    display: grid;
    position: relative;
    gap: 8px;
    padding: 14px 12px;
    border-bottom: 1px solid var(--line);
    background: var(--table-row-bg);
  }

  .checkout-items-table tr:nth-child(even) {
    background: var(--table-row-alt-bg);
  }

  .checkout-items-table td {
    display: grid;
    grid-template-columns: 70px minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    padding: 0;
    border-bottom: 0;
    overflow-wrap: anywhere;
  }

  .checkout-items-table td::before {
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    line-height: 1.2;
    text-transform: uppercase;
  }

  .checkout-items-table td:nth-child(1) {
    position: absolute;
    top: 12px;
    right: 12px;
    display: inline-flex;
    width: auto;
    padding: 4px 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
  }

  .checkout-items-table td:nth-child(1)::before {
    content: "";
    display: none;
  }

  .checkout-items-table td:nth-child(2) {
    grid-template-columns: 1fr;
    padding-right: 96px;
  }

  .checkout-items-table td:nth-child(2)::before {
    content: attr(data-mobile-label);
  }

  .checkout-items-table td:nth-child(3)::before { content: "Model / Serial / BNN"; }
  .checkout-items-table td:nth-child(4)::before { content: "Esper"; }
  .checkout-items-table td:nth-child(5)::before { content: "Qty"; }
  .checkout-items-table td:nth-child(6)::before { content: "Notes"; }
  .checkout-items-table td:nth-child(7)::before { content: ""; display: none; }

  .checkout-items-table td:nth-child(2)::before {
    margin-bottom: 2px;
  }

  .checkout-items-table td:nth-child(7) {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .checkout-items-table .inline-form {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
    width: 100%;
  }

  .checkout-items-table td:nth-child(2) .inline-form {
    grid-template-columns: minmax(0, 1fr) 72px;
    align-items: center;
  }

  .checkout-items-table .inline-form .item-name-input,
  .checkout-items-table .inline-form input,
  .checkout-items-table .inline-form button,
  .checkout-items-table .small-link {
    width: 100%;
    min-width: 0;
  }

  .checkout-items-table .inline-form .item-name-input {
    min-height: 40px;
  }

  .checkout-items-table .inline-form button {
    min-height: 40px;
    padding-inline: 10px;
  }

  .checkout-items-table td:nth-child(7) .inline-form {
    margin: 0;
  }

  .checkout-items-table td:nth-child(7) .inline-form:only-child {
    grid-column: 1 / -1;
  }

  .checkout-items-table td:nth-child(7) .quantity-input {
    max-width: none;
  }
}

@media (max-width: 560px) {
  .dashboard-scan-form {
    grid-template-columns: 1fr;
  }

  .receiving-grid,
  .digest-grid,
  .readiness-list {
    grid-template-columns: 1fr;
  }

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

  .digest-list li,
  .reorder-actions form,
  .reorder-actions form:first-child {
    grid-template-columns: 1fr;
  }

  .digest-list li span {
    text-align: left;
  }

  .add-checkout-item-form {
    grid-template-columns: 1fr;
  }

  .add-checkout-item-form label,
  .add-checkout-item-form input,
  .add-checkout-item-form select,
  .add-checkout-item-form button {
    grid-column: 1;
  }

  .add-checkout-item-form label {
    align-self: end;
  }
}
.return-tracking-heading {
  align-items: center;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.return-summary-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 1rem;
}

.return-tracking-table-wrap {
  container-name: return-tracking;
  container-type: inline-size;
  overflow-x: auto;
  padding: 0;
}

.return-tracking-table {
  border-collapse: collapse;
  min-width: 1050px;
  width: 100%;
}

.return-tracking-table th,
.return-tracking-table td {
  border-bottom: 1px solid #444;
  padding: .75rem;
  text-align: left;
  vertical-align: middle;
}

.return-tracking-table th {
  color: #bbb;
  font-size: .75rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}

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

.return-tracking-table tbody tr:target td {
  background: rgba(75, 163, 255, .12);
}

.return-tracking-table td > strong,
.return-tracking-table td > span,
.return-line-item,
.return-tracking-value {
  display: block;
}

.return-tracking-table td > strong + span {
  color: #bbb;
  margin-top: .2rem;
}

.return-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}

.return-row-actions .button-link,
.return-row-actions button {
  padding: .45rem .65rem;
  white-space: nowrap;
}

.status-pill {
  border: 1px solid #666;
  border-radius: 999px;
  display: inline-flex;
  font-size: .82rem;
  font-weight: 800;
  padding: .4rem .7rem;
  white-space: nowrap;
}

.status-requested { border-color: #d8a93c; color: #ffd878; }
.status-open { border-color: #4ba3ff; color: #8dc7ff; }
.status-delivered { border-color: #34a853; color: #78dc91; }

.return-items,
.return-tracking-numbers {
  border-top: 1px solid #444;
  margin-top: 1rem;
  padding-top: 1rem;
}

.return-items h3,
.return-tracking-numbers h3 {
  margin: 0 0 .65rem;
}

.return-items p,
.return-tracking-numbers p {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1rem;
  margin: .45rem 0;
}

.return-items p span,
.return-tracking-numbers p span {
  color: #bbb;
}

/*
 * The return board has nine data fields, so viewport breakpoints alone are not
 * enough when the persistent navigation sidebar or a split-screen window makes
 * the table's actual content area narrower. Reflow from the table into compact
 * rows based on the available panel width.
 */
@container return-tracking (max-width: 1550px) {
  .return-tracking-table-wrap {
    overflow-x: visible;
  }

  .return-tracking-table {
    min-width: 0;
    table-layout: auto;
  }

  .return-tracking-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .return-tracking-table,
  .return-tracking-table tbody {
    display: block;
    width: 100%;
  }

  .return-tracking-table tbody {
    display: grid;
    gap: 10px;
    padding: 10px;
  }

  .return-tracking-table tr {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 12px 18px;
    width: 100%;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--table-row-bg);
  }

  .return-tracking-table td {
    display: block;
    min-width: 0;
    padding: 0;
    border: 0;
    overflow-wrap: anywhere;
  }

  .return-tracking-table td::before {
    display: block;
    margin-bottom: 5px;
    color: var(--muted);
    content: attr(data-label);
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
  }

  .return-tracking-table td:nth-child(1) { grid-column: 1 / 3; grid-row: 1; }
  .return-tracking-table td:nth-child(2) { grid-column: 3 / 5; grid-row: 1; }
  .return-tracking-table td:nth-child(3) { grid-column: 5 / 7; grid-row: 1; }
  .return-tracking-table td:nth-child(4) { grid-column: 7 / 10; grid-row: 1; }
  .return-tracking-table td:nth-child(6) { grid-column: 10 / 13; grid-row: 1; }
  .return-tracking-table td:nth-child(5) { grid-column: 1 / 5; grid-row: 2; }
  .return-tracking-table td:nth-child(7) { grid-column: 5 / 7; grid-row: 2; }
  .return-tracking-table td:nth-child(8) { grid-column: 7 / 9; grid-row: 2; }
  .return-tracking-table td:nth-child(9) { grid-column: 9 / 13; grid-row: 2; }

  .return-tracking-table .status-pill {
    max-width: 100%;
    white-space: normal;
  }

  .return-row-actions {
    align-items: stretch;
  }
}

@container return-tracking (max-width: 1100px) {
  .return-tracking-table tr {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .return-tracking-table td:nth-child(1) { grid-column: 1 / -1; grid-row: 1; }
  .return-tracking-table td:nth-child(2) { grid-column: 1; grid-row: 2; }
  .return-tracking-table td:nth-child(3) { grid-column: 2; grid-row: 2; }
  .return-tracking-table td:nth-child(4) { grid-column: 1 / -1; grid-row: 3; }
  .return-tracking-table td:nth-child(5) { grid-column: 1; grid-row: 4; }
  .return-tracking-table td:nth-child(6) { grid-column: 2; grid-row: 4; }
  .return-tracking-table td:nth-child(7) { grid-column: 1; grid-row: 5; }
  .return-tracking-table td:nth-child(8) { grid-column: 2; grid-row: 5; }
  .return-tracking-table td:nth-child(9) { grid-column: 1 / -1; grid-row: 6; }
}

@container return-tracking (max-width: 650px) {
  .return-tracking-table tbody {
    gap: 12px;
    padding: 0;
  }

  .return-tracking-table tr {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    padding: 14px;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .return-tracking-table td:nth-child(n) {
    grid-column: 1;
    grid-row: auto;
  }

  .return-row-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .return-row-actions .button-link,
  .return-row-actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    width: 100%;
    white-space: normal;
    text-align: center;
  }
}

@media (max-width: 800px) {
  .return-tracking-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .return-summary-grid {
    grid-template-columns: 1fr;
  }
}

/* Compact Partner/Warehouse Devices rows: match the dense Esper event log while
 * keeping secondary software details available on demand. */
.compact-inventory-table {
  min-width: 1040px;
}

.compact-inventory-table th,
.compact-inventory-table td {
  padding: 6px 8px;
  vertical-align: top;
}

/* A serial is a value to read, not a control to press. .small-link gave it a
   34px bordered box that looked like an editable field and set the height of
   every row; as a plain link the same information costs half the space. */
.compact-inventory-table .device-cell .small-link {
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: var(--text);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: var(--line);
}

.compact-inventory-table .device-cell .small-link:hover {
  text-decoration-color: var(--text);
}

.compact-inventory-table .device-cell {
  gap: 2px;
}

.compact-inventory-table .meta-row {
  line-height: 1.25;
}

/* Widths follow how much each column actually has to say: Esper was the
   widest at 22% but carries the least text, while Dates wrapped timestamps
   onto three lines and Use broke "CUSTOMER TABLET" mid-word. */
.compact-inventory-table .device-select-col { width: 3%; text-align: center; }
.compact-inventory-table .device-info-col { width: 18%; }
.compact-inventory-table .device-status-col { width: 13%; }
.compact-inventory-table .device-use-col { width: 8%; }
.compact-inventory-table .device-assignment-col { width: 13%; }
.compact-inventory-table .device-esper-col { width: 17%; }
.compact-inventory-table .device-dates-col { width: 16%; }
.compact-inventory-table .device-actions-col { width: 15%; }

.compact-inventory-table .device-cell {
  gap: 3px;
}

.compact-inventory-table .device-primary-line,
.compact-inventory-table .device-esper-summary,
.compact-inventory-table .device-esper-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px 8px;
  min-width: 0;
}

.compact-inventory-table .device-primary-line > strong,
.compact-inventory-table .device-assignment-col strong,
.compact-inventory-table .device-esper-col > .device-cell > strong {
  font-size: 14px;
}

.compact-inventory-table .device-model-code {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.1;
}

.compact-inventory-table .meta-row {
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 4px;
  font-size: 11px;
}

.compact-inventory-table .device-dates-col .meta-row {
  grid-template-columns: 68px minmax(0, 1fr);
}

.compact-inventory-table .status-pill {
  max-width: 100%;
  min-height: 0;
  padding: 4px 7px;
  font-size: 11px;
  line-height: 1.1;
  /* Wrapping is allowed so long labels fit these narrow cells, but only at
     spaces: the table inherits overflow-wrap: anywhere, which was splitting
     "CUSTOMER TABLET" into "CUSTOME" / "R TABLET". */
  white-space: normal;
  overflow-wrap: normal;
  word-break: normal;
}

.compact-inventory-table .device-status-list {
  display: flex;
  align-items: flex-start;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 4px;
}

.compact-inventory-table .device-esper-summary > span:not(.status-pill) {
  color: var(--text);
  font-size: 11px;
}

.compact-inventory-table .device-esper-actions {
  align-items: flex-start;
  font-size: 11px;
}

.compact-inventory-table .device-technical-details {
  position: relative;
  min-width: 0;
}

.compact-inventory-table .device-technical-details summary {
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
}

.compact-inventory-table .device-technical-details[open] {
  flex: 1 0 100%;
  display: grid;
  gap: 3px;
  padding: 5px 0 1px;
}

.compact-inventory-table .action-cluster {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}

.compact-inventory-table .action-cluster .small-link,
.compact-inventory-table .action-cluster button {
  padding: 5px 6px;
  font-size: 11px;
}

.compact-inventory-table .device-print-label-form {
  grid-column: 1 / -1;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 8px;
}

@media (max-width: 1400px) {
  .devices-page .table-wrap {
    overflow-x: visible;
  }

  .compact-inventory-table,
  .compact-inventory-table tbody {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .compact-inventory-table tbody {
    display: grid;
    gap: 8px;
    padding: 8px;
  }

  .compact-inventory-table tr {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 9px 14px;
    width: 100%;
    padding: 11px;
    border: 1px solid var(--line);
    border-radius: 9px;
  }

  .compact-inventory-table td,
  .compact-inventory-table .action-cell {
    display: block;
    width: auto !important;
    min-width: 0;
    padding: 0;
    border: 0;
  }

  .compact-inventory-table td::before {
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    content: attr(data-label);
    font-size: 10px;
    font-weight: 700;
    line-height: 1.1;
    text-transform: uppercase;
  }

  .compact-inventory-table .device-select-col { grid-column: span 1; }
  .compact-inventory-table .device-info-col { grid-column: span 4; }
  .compact-inventory-table .device-status-col { grid-column: span 3; }
  .compact-inventory-table .device-use-col { grid-column: span 2; }
  .compact-inventory-table .device-assignment-col { grid-column: span 3; }
  .compact-inventory-table .device-esper-col { grid-column: span 5; }
  .compact-inventory-table .device-dates-col { grid-column: span 3; }
  .compact-inventory-table .device-actions-col { grid-column: span 4; }

  .compact-inventory-table .device-edit-action {
    grid-column: 1 / -1;
  }

  .compact-inventory-table .device-print-label-form {
    grid-template-columns: 82px minmax(0, 1fr);
  }

  .compact-inventory-table:not(.has-bulk-select) .device-info-col { grid-column: span 4; }
  .compact-inventory-table:not(.has-bulk-select) .device-status-col { grid-column: span 3; }
  .compact-inventory-table:not(.has-bulk-select) .device-use-col { grid-column: span 2; }
  .compact-inventory-table:not(.has-bulk-select) .device-assignment-col { grid-column: span 3; }
  .compact-inventory-table.has-bulk-select .device-assignment-col { grid-column: span 2; }

  .compact-inventory-table .device-group-row {
    display: block;
    padding: 0;
    border: 0;
  }

  .compact-inventory-table .device-group-row td {
    display: block;
    padding: 8px 10px;
  }

  .compact-inventory-table .device-group-row td::before,
  .compact-inventory-table .empty::before {
    display: none;
  }

  .compact-inventory-table .empty {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .compact-inventory-table tbody {
    gap: 10px;
    padding: 0;
  }

  .compact-inventory-table tr {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    padding: 12px;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .compact-inventory-table .device-select-col,
  .compact-inventory-table .device-info-col,
  .compact-inventory-table .device-status-col,
  .compact-inventory-table .device-use-col,
  .compact-inventory-table .device-assignment-col,
  .compact-inventory-table .device-esper-col,
  .compact-inventory-table .device-dates-col,
  .compact-inventory-table .device-actions-col,
  .compact-inventory-table:not(.has-bulk-select) .device-info-col,
  .compact-inventory-table:not(.has-bulk-select) .device-status-col,
  .compact-inventory-table:not(.has-bulk-select) .device-use-col,
  .compact-inventory-table:not(.has-bulk-select) .device-assignment-col {
    grid-column: 1;
  }
}

/* Compact Esper Fleet rows: related values stay together so the list can be
 * scanned without spreading one device across eight narrow columns. */
.compact-esper-fleet-table {
  min-width: 960px;
  table-layout: fixed;
}

.compact-esper-fleet-table .col-device { width: 27%; }
.compact-esper-fleet-table .col-hardware { width: 20%; }
.compact-esper-fleet-table .col-assignment { width: 29%; }
.compact-esper-fleet-table .col-health { width: 24%; }

.compact-esper-fleet-table th,
.compact-esper-fleet-table td {
  padding: 7px 8px;
  line-height: 1.2;
  vertical-align: top;
}

.fleet-compact-cell {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.fleet-device-link,
.fleet-compact-cell > strong,
.fleet-group-path,
.fleet-meta-row > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.fleet-device-link,
.fleet-compact-cell > strong {
  font-size: 13px;
  line-height: 1.2;
}

.fleet-meta-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.fleet-meta-row b,
.fleet-health-line b {
  color: var(--text);
  font-size: 10px;
  text-transform: uppercase;
}

.fleet-group-path {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.fleet-health-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px 8px;
  font-size: 11px;
}

.compact-esper-fleet-table .fleet-status {
  min-width: 0;
  padding: 3px 7px;
  font-size: 10px;
}

@media (min-width: 761px) and (max-width: 1400px) {
  .compact-esper-fleet-table {
    min-width: 0;
  }

  .compact-esper-fleet-table tbody {
    gap: 8px;
    padding: 8px;
  }

  .compact-esper-fleet-table tr {
    gap: 8px 14px;
    padding: 10px;
  }

  .compact-esper-fleet-table td,
  .compact-esper-fleet-table .col-device,
  .compact-esper-fleet-table .col-hardware,
  .compact-esper-fleet-table .col-assignment,
  .compact-esper-fleet-table .col-health {
    width: 100% !important;
    min-width: 0;
    max-width: 100%;
    padding: 0;
  }

  .compact-esper-fleet-table td::before {
    margin-bottom: 3px;
  }
}

@media (max-width: 980px) {
  .fleet-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .compact-esper-fleet-table {
    min-width: 0;
  }

  .compact-esper-fleet-table tbody {
    gap: 8px;
    padding: 0;
  }

  .compact-esper-fleet-table tr {
    padding: 10px;
  }

  .compact-esper-fleet-table td,
  .compact-esper-fleet-table td.col-device,
  .compact-esper-fleet-table td.col-hardware,
  .compact-esper-fleet-table td.col-assignment,
  .compact-esper-fleet-table td.col-health {
    display: block;
    width: 100% !important;
    padding: 7px 0;
  }
}

/* Devices Pages has only five fields, so keep each device on one compact row
 * at tablet and split-browser widths instead of inheriting Fleet's card grid. */
.esper-devices-table {
  min-width: 860px;
  table-layout: fixed;
}

.esper-devices-table th:nth-child(1),
.esper-devices-table td:nth-child(1) { width: 24%; }

.esper-devices-table th:nth-child(2),
.esper-devices-table td:nth-child(2) { width: 19%; }

.esper-devices-table th:nth-child(3),
.esper-devices-table td:nth-child(3) { width: 21%; }

.esper-devices-table th:nth-child(4),
.esper-devices-table td:nth-child(4) { width: 18%; }

.esper-devices-table th:nth-child(5),
.esper-devices-table td:nth-child(5) { width: 18%; }

.esper-devices-table th,
.esper-devices-table td {
  padding: 6px 8px;
  line-height: 1.15;
}

@media (min-width: 761px) and (max-width: 1400px) {
  .esper-devices-page .table-wrap {
    overflow-x: auto;
  }

  .esper-devices-table {
    display: table;
    width: 100%;
    min-width: 860px;
    table-layout: fixed;
  }

  .esper-devices-table thead {
    position: static;
    display: table-header-group;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    white-space: normal;
  }

  .esper-devices-table tbody {
    display: table-row-group;
    width: auto;
    padding: 0;
  }

  .esper-devices-table tr {
    display: table-row;
    width: auto;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  .esper-devices-table td {
    display: table-cell;
    min-width: 0;
    padding: 6px 8px;
    border-bottom: 1px solid var(--line);
    white-space: normal;
    overflow-wrap: break-word;
  }

  .esper-devices-table td::before {
    display: none;
  }
}

@media (max-width: 760px) {
  .esper-devices-table {
    min-width: 0;
  }

  .esper-devices-table tbody {
    gap: 8px;
    padding: 0;
  }

  .esper-devices-table tr {
    padding: 10px;
  }

  .esper-devices-table td {
    padding: 6px 0;
  }
}

/* ─── Enterprise Checkout Redesign ──────────────────────────────────────── */

/* Packing step cards: structured header + body */
.packing-step {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0;
  background: var(--panel);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 200ms;
}
.packing-step.step-done {
  border-color: rgb(106 167 122 / 55%);
}
.packing-step-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--table-head-bg);
}
.packing-step.step-done .packing-step-header {
  border-bottom-color: rgb(106 167 122 / 30%);
  background: rgb(106 167 122 / 6%);
}
.packing-step-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--panel-2);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  flex-shrink: 0;
}
.packing-step.step-done .packing-step-num {
  background: rgb(106 167 122 / 18%);
  border-color: rgb(106 167 122 / 65%);
  color: #b8f0c5;
}
.packing-step-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}
.packing-step-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 4px;
  border: 1px solid;
  white-space: nowrap;
}
.packing-step-badge.done {
  color: #b8f0c5;
  border-color: rgb(106 167 122 / 60%);
  background: rgb(106 167 122 / 12%);
}
.packing-step-badge.pending {
  color: var(--muted);
  border-color: var(--line);
  background: transparent;
}
.packing-step-body {
  padding: 16px;
  display: grid;
  gap: 12px;
  flex: 1;
}

/* Item type badge in Hardware Sent table */
.item-type-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid;
  white-space: nowrap;
}
.item-type-badge.device {
  color: var(--deployed-text);
  border-color: rgb(100 140 220 / 45%);
  background: rgb(100 140 220 / 9%);
}
.item-type-badge.accessory {
  color: var(--use-text);
  border-color: rgb(200 160 80 / 45%);
  background: rgb(200 160 80 / 9%);
}

/* Hardware Sent table: tighter, crisper */
.checkout-detail-page .checkout-items-table th {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 14px;
}
.checkout-detail-page .checkout-items-table td {
  padding: 12px 14px;
  vertical-align: middle;
}
.checkout-detail-page .checkout-items-table tbody tr:last-child td {
  border-bottom: none;
}

/* Section accent borders */
#hardware-sent > .section-title {
  border-left: 3px solid rgb(100 140 220 / 65%);
  padding-left: 15px;
}
#packing-workflow > .section-title {
  border-left: 3px solid rgb(226 178 92 / 65%);
  padding-left: 15px;
}
.checkout-detail-page .section-title h2 {
  font-size: 15px;
  letter-spacing: 0.01em;
}

/* Add Missing Items: two-column card grid */
.add-checkout-items {
  padding: 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0;
}
.add-checkout-items > .section-title {
  padding: 11px 18px;
  border-bottom: 1px solid var(--line);
}
.add-checkout-items-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.add-checkout-items-card {
  padding: 14px 18px;
  display: grid;
  gap: 8px;
  align-content: start;
}
.add-checkout-items-card + .add-checkout-items-card {
  border-left: 1px solid var(--line);
}
.add-checkout-items-card-label {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.add-checkout-items-card .add-checkout-item-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 0;
}
.add-qty-row {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 8px;
  align-items: center;
}
@media (max-width: 768px) {
  .add-checkout-items-grid { grid-template-columns: 1fr; }
  .add-checkout-items-card + .add-checkout-items-card {
    border-left: none;
    border-top: 1px solid var(--line);
  }
}

/* ─── Checkout hero: enterprise order header ──────────────────────────── */
.checkout-detail-page .hardware-hero {
  display: grid;
  grid-template-rows: auto auto auto;
  gap: 0;
  padding: 0;
}

/* Row 1: identity + status */
.hardware-hero-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 32px;
  padding: 18px 24px;
}

.hardware-hero-identity { flex: 1; min-width: 0; }

.hardware-hero-identity h2 {
  font-size: 26px;
  margin-top: 3px;
  margin-bottom: 0;
}

.hardware-hero-notes {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.hardware-hero-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  flex-shrink: 0;
  padding-top: 2px;
}

.hardware-hero-date {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
}

.hardware-hero-user {
  font-size: 12px;
  color: var(--muted);
}

/* Row 2: compact horizontal action bar */
.hardware-hero-actions {
  display: flex;
  align-items: stretch;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  background: var(--ink);
  min-height: 42px;
}

.hardware-hero-actions form {
  display: flex;
  align-items: stretch;
}

.checkout-detail-page .hardware-hero-actions a,
.checkout-detail-page .hardware-hero-actions button {
  display: flex;
  align-items: center;
  padding: 0 15px;
  height: 42px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  background: transparent;
  border: none;
  border-color: transparent;
  border-right: 1px solid var(--line);
  border-radius: 0;
  cursor: pointer;
  white-space: nowrap;
  transition: background 120ms, color 120ms;
  min-height: unset;
  text-align: left;
  outline-offset: -2px;
}

.checkout-detail-page .hardware-hero-actions a:hover,
.checkout-detail-page .hardware-hero-actions button:hover {
  background: rgb(255 255 255 / 5%);
  color: var(--white);
  outline: none;
}

.checkout-detail-page .hardware-hero-actions a:focus-visible,
.checkout-detail-page .hardware-hero-actions button:focus-visible {
  outline: 2px solid rgb(255 255 255 / 30%);
}

.checkout-detail-page .hardware-hero-actions .hero-danger {
  color: #e08080;
}

.checkout-detail-page .hardware-hero-actions .hero-danger:hover {
  background: rgb(180 40 40 / 14%);
  color: #ffa0a0;
}

.hardware-hero-action-sep {
  width: 1px;
  background: var(--line);
  margin: 9px 0;
  align-self: stretch;
}

/* Row 3: slim metadata strip */
.hardware-hero-details {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}

.hardware-hero-details:not(:has(.hardware-hero-details-item)) { display: none; }

.hardware-hero-details-item {
  padding: 6px 14px;
  border-right: 1px solid var(--line);
  white-space: nowrap;
}

.hardware-hero-details-item:last-child { border-right: none; }

@media (max-width: 700px) {
  .hardware-hero-head { flex-direction: column; gap: 10px; }
  .hardware-hero-meta { align-items: flex-start; }
}

@media (max-width: 480px) {
  .checkout-detail-page .hardware-hero-actions a,
  .checkout-detail-page .hardware-hero-actions button { padding: 0 11px; font-size: 12px; }
}


.tracking-sort-form {
  display: flex;
  align-items: center;
  margin-left: auto;
}

.tracking-sort-form label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.tracking-sort-form select {
  min-width: 200px;
}


.joe-os-announce-form {
  gap: 6px;
}

.joe-os-announce-form input {
  min-height: 0;
  padding: 6px 8px;
  font-size: 12px;
}

.joe-os-batch-failed-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px;
}

.joe-os-batch-failed-actions .joe-os-announce-form {
  flex: 1 1 200px;
  min-width: 0;
}
