:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --panel-2: #eef1f4;
  --text: #121923;
  --muted: #667085;
  --border: #d9dee5;
  --available: #18794e;
  --available-bg: #e8f5ee;
  --deployed: #b42318;
  --deployed-bg: #ffebe9;
  --accent: #0b5cab;
  --shadow: 0 8px 30px rgba(16, 24, 40, 0.08);
}
:root.dark {
  color-scheme: dark;
  --bg: #0c1118;
  --panel: #151c25;
  --panel-2: #1e2733;
  --text: #f3f6f9;
  --muted: #a7b0be;
  --border: #2d3745;
  --available: #72d8a4;
  --available-bg: #123526;
  --deployed: #ff8a80;
  --deployed-bg: #421b1d;
  --accent: #5aa7ff;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.28);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 18px max(20px, calc((100vw - 1400px)/2));
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(16px);
}
h1, h2 { margin: 0; line-height: 1.1; }
h1 { font-size: clamp(1.4rem, 3vw, 2rem); }
h2 { font-size: 1.35rem; }
.eyebrow { color: var(--muted); font-size: .76rem; letter-spacing: .12em; text-transform: uppercase; margin-bottom: 5px; }
.top-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.page { width: min(1400px, calc(100% - 32px)); margin: 28px auto 60px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.stat { background: var(--panel); border: 1px solid var(--border); border-radius: 18px; padding: 20px; box-shadow: var(--shadow); }
.stat span { display: block; color: var(--muted); font-size: .88rem; }
.stat strong { font-size: clamp(2rem, 6vw, 3.5rem); }
.stat.available strong { color: var(--available); }
.stat.deployed strong { color: var(--deployed); }
.toolbar {
  display: grid; grid-template-columns: minmax(220px, 1fr) 220px auto; gap: 12px;
  align-items: end; margin: 22px 0;
}
label { display: grid; gap: 7px; color: var(--muted); font-size: .85rem; }
input, select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--panel); color: var(--text); outline: none;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.btn {
  min-height: 44px; padding: 10px 15px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--panel); color: var(--text); font-weight: 650;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: white; }
.btn.ghost { background: var(--panel); }
.btn.small { min-height: 36px; padding: 7px 11px; font-size: .84rem; }
.banner {
  padding: 12px 14px; border-radius: 12px; margin-bottom: 20px;
  background: #fff7d6; color: #5c4800; border: 1px solid #e8d36d;
}
:root.dark .banner { background: #3c3213; color: #ffe89a; border-color: #6c5a20; }
.section-heading { display: flex; justify-content: space-between; gap: 16px; align-items: end; margin: 28px 0 14px; }
.badge { display: inline-flex; align-items: center; padding: 7px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; }
.badge.neutral { background: var(--panel-2); color: var(--muted); }
.badge.editor { background: var(--available-bg); color: var(--available); }
.radio-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.radio-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 16px; box-shadow: var(--shadow);
}
.radio-card[data-status="available"] { border-left: 5px solid var(--available); }
.radio-card[data-status="deployed"] { border-left: 5px solid var(--deployed); }
.radio-card-top { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.radio-id { font-size: 1.15rem; font-weight: 800; letter-spacing: .01em; }
.radio-status { margin-top: 7px; display: inline-flex; padding: 5px 8px; border-radius: 999px; font-size: .76rem; font-weight: 800; letter-spacing: .04em; }
.radio-card[data-status="available"] .radio-status { color: var(--available); background: var(--available-bg); }
.radio-card[data-status="deployed"] .radio-status { color: var(--deployed); background: var(--deployed-bg); }
.radio-details { display: grid; grid-template-columns: 1fr 1fr; gap: 11px 14px; margin: 16px 0 0; }
.radio-details div { min-width: 0; }
.radio-details dt { color: var(--muted); font-size: .72rem; margin-bottom: 2px; }
.radio-details dd { margin: 0; font-size: .9rem; overflow-wrap: anywhere; }
.radio-comments { color: var(--muted); font-size: .83rem; margin: 12px 0 0; border-top: 1px solid var(--border); padding-top: 10px; }
.radio-comments:empty { display: none; }
.history-section { margin-top: 34px; }
.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; }
table { width: 100%; border-collapse: collapse; min-width: 780px; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--border); text-align: left; font-size: .86rem; }
th { color: var(--muted); font-size: .75rem; letter-spacing: .04em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
.empty { color: var(--muted); text-align: center; padding: 22px; }
dialog {
  width: min(620px, calc(100% - 24px)); padding: 0; border: 0; border-radius: 18px;
  background: var(--panel); color: var(--text); box-shadow: 0 24px 80px rgba(0,0,0,.3);
}
dialog::backdrop { background: rgba(0,0,0,.55); }
.dialog-card { padding: 20px; display: grid; gap: 15px; }
.dialog-head { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.icon-btn {
  border: 1px solid var(--border); background: var(--panel); color: var(--text);
  width: 42px; height: 42px; border-radius: 10px; font-size: 1.5rem;
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.form-error { min-height: 1.1em; color: var(--deployed); font-size: .85rem; margin: 0; }
@media (max-width: 720px) {
  .topbar { align-items: flex-start; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stats .stat:first-child { grid-column: 1 / -1; }
  .toolbar { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .radio-grid { grid-template-columns: 1fr; }
}

.save-message { min-height: 1.2em; margin: 0; font-size: .86rem; color: var(--muted); }
.save-message.error { color: var(--deployed); }
.save-message.success { color: var(--available); }

.batch-help { margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.45; }
.radio-picker-fieldset { margin: 0; border: 1px solid var(--border); border-radius: 12px; padding: 12px; }
.radio-picker-fieldset legend { padding: 0 6px; color: var(--muted); font-size: .84rem; }
.batch-picker-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.batch-radio-picker {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px;
  max-height: 270px; overflow-y: auto; padding: 2px;
}
.batch-radio-option {
  display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--panel);
  color: var(--text); font-size: .86rem;
}
.batch-radio-option input { width: 18px; min-height: 18px; height: 18px; margin: 0; }
@media (max-width: 720px) {
  .batch-radio-picker { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.changelog-card { max-height: min(80vh, 760px); }
.changelog-list { display: grid; gap: 12px; overflow-y: auto; padding-right: 4px; }
.change-release {
  border: 1px solid var(--border); border-radius: 12px; padding: 13px 14px;
  background: var(--panel);
}
.change-release.current { border-color: var(--accent); }
.change-release-head {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  margin-bottom: 7px;
}
.change-release-head strong {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 42px; min-height: 28px; padding: 4px 8px;
  border-radius: 999px; background: var(--panel-2); color: var(--text);
}
.change-release.current .change-release-head strong {
  background: var(--accent); color: white;
}
.change-release-head span { font-weight: 700; }
.change-release ul { margin: 0; padding-left: 20px; color: var(--muted); }
.change-release li + li { margin-top: 4px; }

.toolbar-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 720px) {
  .toolbar-actions { justify-content: stretch; }
  .toolbar-actions .btn { flex: 1 1 auto; }
}

.card-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.btn.danger { background: var(--deployed); border-color: var(--deployed); color: white; }
.delete-warning {
  margin: 0; padding: 12px 14px; border-radius: 12px;
  background: var(--deployed-bg); color: var(--deployed);
  border: 1px solid color-mix(in srgb, var(--deployed) 35%, var(--border));
}

.equipment-fieldset {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}
.equipment-fieldset legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: .84rem;
}
.equipment-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.equipment-option {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  font-size: .88rem;
}
.equipment-option input {
  width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 0;
}
.equipment-hint {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: .82rem;
}
.radio-equipment-wrap {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.radio-equipment-label {
  color: var(--muted);
  font-size: .72rem;
  margin-bottom: 6px;
}
.radio-equipment {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.equipment-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--text);
  font-size: .75rem;
  font-weight: 650;
}
@media (max-width: 520px) {
  .equipment-grid { grid-template-columns: 1fr; }
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 24px;
  min-width: 0;
}
.dashboard-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  text-decoration: none;
  font-size: .86rem;
  font-weight: 700;
  white-space: nowrap;
}
.nav-link:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 25%, transparent);
  outline-offset: 2px;
}
@media (hover: hover) and (pointer: fine) {
  .nav-link:hover {
    border-color: var(--accent);
    color: var(--accent);
  }
}
@media (max-width: 980px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }
  .brand-block {
    width: 100%;
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }
  .dashboard-nav {
    width: 100%;
  }
  .top-actions {
    width: 100%;
    justify-content: flex-start;
  }
}
@media (max-width: 560px) {
  .dashboard-nav {
    display: grid;
    grid-template-columns: 1fr;
  }
  .nav-link {
    justify-content: center;
    width: 100%;
  }
}

/* v14 — beUI-inspired navigation primitives.
   Ported to vanilla HTML/CSS so the existing Firebase dashboard remains build-free. */

.beui-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 22px;
  padding-top: 14px;
  padding-bottom: 14px;
  background: color-mix(in srgb, var(--panel) 82%, transparent);
  box-shadow: 0 1px 0 var(--border);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: max-content;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: color-mix(in srgb, var(--panel) 82%, transparent);
  color: var(--accent);
  box-shadow: 0 8px 20px rgba(16,24,40,.06), inset 0 1px 0 rgba(255,255,255,.35);
}
:root.dark .brand-mark { box-shadow: 0 10px 24px rgba(0,0,0,.22), inset 0 1px 0 rgba(255,255,255,.04); }

.beui-dock {
  position: relative;
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 17px;
  background: color-mix(in srgb, var(--panel) 78%, transparent);
  box-shadow: 0 12px 30px rgba(16,24,40,.08), inset 0 1px 0 rgba(255,255,255,.28);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
:root.dark .beui-dock {
  box-shadow: 0 14px 34px rgba(0,0,0,.25), inset 0 1px 0 rgba(255,255,255,.035);
}

.dock-glider {
  position: absolute;
  top: 5px;
  left: 5px;
  height: calc(100% - 10px);
  width: 0;
  border-radius: 12px;
  background: var(--panel-2);
  opacity: 0;
  pointer-events: none;
  transition:
    transform 380ms cubic-bezier(.16,1,.3,1),
    width 380ms cubic-bezier(.16,1,.3,1),
    opacity 180ms ease;
}

.dock-item {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 13px;
  border-radius: 12px;
  color: var(--muted);
  text-decoration: none;
  font-size: .82rem;
  font-weight: 760;
  white-space: nowrap;
  transition:
    color 180ms ease,
    transform 220ms cubic-bezier(.16,1,.3,1);
  -webkit-tap-highlight-color: transparent;
}
.dock-item svg { width: 18px; height: 18px; flex: 0 0 auto; }
.dock-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.dock-item:active { transform: scale(.94); }

.beui-actionbar {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 17px;
  background: color-mix(in srgb, var(--panel) 78%, transparent);
  box-shadow: 0 12px 30px rgba(16,24,40,.08), inset 0 1px 0 rgba(255,255,255,.28);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
:root.dark .beui-actionbar {
  box-shadow: 0 14px 34px rgba(0,0,0,.25), inset 0 1px 0 rgba(255,255,255,.035);
}

.beui-action-btn,
.beui-primary-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  padding: 0 12px;
  font: inherit;
  font-size: .82rem;
  font-weight: 760;
  cursor: pointer;
  transition:
    transform 220ms cubic-bezier(.16,1,.3,1),
    background 180ms ease,
    color 180ms ease;
  -webkit-tap-highlight-color: transparent;
}
.beui-action-btn {
  background: transparent;
  color: var(--muted);
}
.beui-action-btn svg {
  width: 18px;
  height: 18px;
}
.beui-action-btn:hover,
.beui-action-btn:focus-visible {
  background: var(--panel-2);
  color: var(--text);
}
.beui-action-btn:focus-visible,
.beui-primary-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.beui-action-btn:active,
.beui-primary-btn:active,
.beui-press:active {
  transform: scale(.94);
}

.beui-primary-btn {
  padding-inline: 14px;
  background: var(--accent);
  color: white;
}
.beui-primary-btn:hover { filter: brightness(1.04); }

.auth-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: currentColor;
  opacity: .75;
}

.action-separator {
  width: 1px;
  height: 24px;
  margin-inline: 2px;
  background: var(--border);
}

.theme-icon-wrap {
  position: relative;
  width: 18px;
  height: 18px;
}
.theme-icon-wrap svg {
  position: absolute;
  inset: 0;
  width: 18px;
  height: 18px;
  transition:
    opacity 220ms ease,
    transform 340ms cubic-bezier(.16,1,.3,1);
}
.sun-icon { opacity: 1; transform: rotate(0deg) scale(1); }
.moon-icon { opacity: 0; transform: rotate(-35deg) scale(.6); }
:root.dark .sun-icon { opacity: 0; transform: rotate(35deg) scale(.6); }
:root.dark .moon-icon { opacity: 1; transform: rotate(0deg) scale(1); }

.beui-press {
  transition:
    transform 220ms cubic-bezier(.16,1,.3,1),
    box-shadow 180ms ease,
    background 180ms ease;
}

/* View Transition pattern adapted from beUI Theme Toggle */
html[data-beui-vt="circle"]::view-transition-old(root) {
  animation: none;
  mix-blend-mode: normal;
}
html[data-beui-vt="circle"]::view-transition-new(root) {
  mix-blend-mode: normal;
  animation: beui-circle-reveal 620ms cubic-bezier(.4,0,.2,1);
}
@keyframes beui-circle-reveal {
  from { clip-path: circle(0 at var(--beui-vt-x, 90%) var(--beui-vt-y, 6%)); }
  to { clip-path: circle(150% at var(--beui-vt-x, 90%) var(--beui-vt-y, 6%)); }
}

@media (hover: hover) and (pointer: fine) {
  .dock-item:hover { color: var(--text); }
}

@media (max-width: 1120px) {
  .beui-header {
    grid-template-columns: 1fr auto;
  }
  .beui-dock {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: stretch;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }
  .dock-item { width: 100%; }
}

@media (max-width: 700px) {
  .beui-header {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .brand-lockup { align-self: flex-start; }
  .beui-actionbar { justify-content: space-between; }
  .beui-action-btn,
  .beui-primary-btn { flex: 1 1 auto; }
  .beui-dock {
    order: 3;
    overflow-x: auto;
    grid-template-columns: none;
    display: flex;
    justify-content: flex-start;
  }
  .dock-item { min-width: max-content; width: auto; }
}

@media (max-width: 470px) {
  .beui-action-btn span:not(.theme-icon-wrap),
  .theme-label { display: none; }
  .beui-action-btn { flex: 0 0 44px; padding: 0; }
  .beui-primary-btn { flex: 1 1 auto; }
}

@media (prefers-reduced-motion: reduce) {
  .dock-glider,
  .dock-item,
  .beui-action-btn,
  .beui-primary-btn,
  .beui-press,
  .theme-icon-wrap svg {
    transition-duration: 0.001ms !important;
  }
  html[data-beui-vt="circle"]::view-transition-new(root) {
    animation: none;
  }
}

/* v16 multi-asset UI */
.brand-logo {
  display:flex;
  align-items:center;
  justify-content:center;
  width:62px;
  height:62px;
  flex:0 0 62px;
  overflow:hidden;
  border-radius:50%;
}
.brand-logo img {
  width:68px;
  height:68px;
  object-fit:cover;
  border-radius:50%;
  filter:drop-shadow(0 4px 10px rgba(0,0,0,.25));
}
.asset-overview { display:grid; grid-template-columns:repeat(4,1fr); gap:12px; margin-bottom:14px; }
.overview-card { text-align:left; border:1px solid var(--border); border-radius:16px; background:var(--panel); color:var(--text); padding:14px; min-height:104px; transition:transform .18s ease,border-color .18s ease,background .18s ease; }
.overview-card span,.overview-card small { display:block; color:var(--muted); }
.overview-card strong { display:block; font-size:1.8rem; margin:3px 0; }
.overview-card.active { border-color:var(--accent); background:color-mix(in srgb,var(--accent) 7%,var(--panel)); }
.overview-card:active { transform:scale(.98); }
.status-badges { display:flex; gap:8px; align-items:center; flex-wrap:wrap; justify-content:flex-end; }
.optional { font-style:normal; font-weight:500; color:var(--muted); font-size:.75rem; }
.danger-outline { color:var(--deployed); border-color:color-mix(in srgb,var(--deployed) 45%,var(--border)); background:var(--panel); }
.batch-signin-picker { display:grid; gap:9px; max-height:340px; overflow:auto; }
.batch-signin-row { display:grid; grid-template-columns:auto minmax(0,1fr); gap:10px; align-items:start; border:1px solid var(--border); border-radius:12px; padding:10px; }
.batch-signin-row input { width:18px; height:18px; min-height:18px; margin-top:2px; }
.batch-signin-meta { display:grid; gap:4px; }
.batch-signin-meta strong { font-size:.9rem; }
.batch-signin-meta small { color:var(--muted); }
.readonly-equipment { display:flex; flex-wrap:wrap; gap:5px; margin-top:4px; }
.user-create-panel { border:1px solid var(--border); border-radius:14px; padding:14px; background:var(--panel-2); }
.user-create-panel h3,.users-dialog-card h3 { margin:0 0 12px; }
.users-list { display:grid; gap:8px; }
.user-row { display:grid; grid-template-columns:minmax(0,1fr) 140px auto; gap:10px; align-items:center; border:1px solid var(--border); border-radius:12px; padding:10px 12px; }
.user-email { min-width:0; overflow-wrap:anywhere; }
.role-help { color:var(--muted); font-size:.82rem; line-height:1.45; }
.users-dialog-card { max-height:80vh; overflow:auto; }
.equipment-option input:disabled + span { opacity:.75; }
.equipment-fieldset.readonly { background:var(--panel-2); }
@media (max-width:900px){ .asset-overview{grid-template-columns:repeat(2,1fr)} }
@media (max-width:620px){ .asset-overview{grid-template-columns:1fr 1fr}.user-row{grid-template-columns:1fr}.status-badges{justify-content:flex-start} }


/* v20 — box inventory */
.box-picker {
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:9px;
  max-height:390px;
  overflow:auto;
  padding:2px;
}
.box-option {
  display:grid;
  grid-template-columns:auto minmax(0,1fr);
  gap:10px;
  align-items:center;
  padding:11px 12px;
  border:1px solid var(--border);
  border-radius:12px;
  background:var(--panel);
  cursor:pointer;
}
.box-option:hover { border-color:var(--accent); }
.box-option input {
  width:18px;
  height:18px;
  min-height:18px;
  margin:0;
}
.box-option strong,.box-option small { display:block; }
.box-option small { color:var(--muted); margin-top:2px; }
@media (max-width:620px) {
  .box-picker { grid-template-columns:1fr; }
}


/* ============================================================
   v21 — Operational UI Refresh
   Purpose: make the viewer feel like an internal public-safety
   operations tool rather than a stylized SaaS/AI interface.
   ============================================================ */

:root {
  --bg: #f2f4f7;
  --panel: #ffffff;
  --panel-2: #f6f7f9;
  --text: #161b22;
  --muted: #667085;
  --border: #d0d5dd;
  --accent: #1261a6;
  --available: #18794e;
  --available-bg: #edf7f1;
  --deployed: #b42318;
  --deployed-bg: #fff0ee;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
}
:root.dark {
  --bg: #0e1116;
  --panel: #171b22;
  --panel-2: #1d222b;
  --text: #f2f4f7;
  --muted: #a3acb9;
  --border: #343b46;
  --accent: #5da7e5;
  --available: #62c995;
  --available-bg: #132d21;
  --deployed: #ff8177;
  --deployed-bg: #35191b;
  --shadow: none;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

/* Header: flat, restrained, no glassmorphism */
.topbar,
.beui-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(300px, 1fr) auto auto;
  align-items: center;
  gap: 24px;
  padding: 12px max(20px, calc((100vw - 1440px)/2));
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
}
.brand-logo {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  border-radius: 4px;
  overflow: visible;
}
.brand-logo img {
  width: 52px;
  height: 52px;
  object-fit: contain;
  border-radius: 0;
  filter: none;
}
.brand-lockup h1 {
  font-size: 1.34rem;
  font-weight: 720;
  letter-spacing: -.015em;
}
.eyebrow {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: .69rem;
  font-weight: 700;
  letter-spacing: .075em;
  text-transform: uppercase;
}

/* Navigation: straightforward text tabs, no glider animation */
.beui-dock {
  position: static;
  display: flex;
  align-items: stretch;
  gap: 0;
  padding: 0;
  min-height: 40px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: none;
  overflow: hidden;
}
.dock-glider { display: none !important; }
.dock-item {
  position: static !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-right: 1px solid var(--border);
  border-radius: 0 !important;
  font-size: .8rem;
  font-weight: 650;
  text-decoration: none;
  transform: none !important;
  transition: background .12s ease, color .12s ease;
}
.dock-item:last-child { border-right: 0; }
.dock-item:hover,
.dock-item:focus-visible {
  background: var(--panel-2);
  color: var(--text);
}

/* Action bar: simple utility controls */
.beui-actionbar {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.action-separator {
  width: 1px;
  height: 26px;
  background: var(--border);
  margin: 0 3px;
}
.beui-action-btn,
.beui-primary-btn {
  min-height: 38px;
  padding: 7px 11px;
  border-radius: 6px;
  box-shadow: none !important;
  transform: none !important;
  transition: background .12s ease, border-color .12s ease;
}
.beui-action-btn {
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
}
.beui-action-btn:hover {
  color: var(--text);
  background: var(--panel-2);
  border-color: var(--border);
}
.beui-primary-btn {
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  font-weight: 700;
}

/* Main page */
.page {
  width: min(1440px, calc(100% - 36px));
  margin: 20px auto 50px;
}

/* Asset family selector: flat segmented row */
.asset-overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 0;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: 7px;
  overflow: hidden;
  background: var(--panel);
}
.overview-card {
  min-height: 82px;
  padding: 13px 16px;
  text-align: left;
  background: var(--panel);
  color: var(--text);
  border: 0;
  border-right: 1px solid var(--border);
  border-radius: 0 !important;
  box-shadow: none !important;
  transform: none !important;
}
.overview-card:last-child { border-right: 0; }
.overview-card span {
  display: block;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 650;
}
.overview-card strong {
  display: block;
  margin-top: 4px;
  font-size: 1.65rem;
  line-height: 1;
}
.overview-card small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: .75rem;
}
.overview-card.active {
  background: color-mix(in srgb, var(--accent) 9%, var(--panel));
  box-shadow: inset 0 -3px 0 var(--accent) !important;
}

/* Stats: compact and utilitarian */
.stats {
  gap: 10px;
}
.stat {
  border-radius: 7px;
  padding: 15px 17px;
  box-shadow: none;
}
.stat span {
  font-size: .78rem;
  font-weight: 650;
}
.stat strong {
  margin-top: 3px;
  font-size: clamp(2rem, 4vw, 2.75rem);
  line-height: 1;
}

/* Toolbar: one operational control strip */
.toolbar {
  grid-template-columns: minmax(260px, 1fr) 190px minmax(420px, auto);
  gap: 10px;
  margin: 14px 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--panel);
}
.toolbar-actions {
  gap: 6px;
  align-items: end;
}
label {
  gap: 5px;
  font-size: .76rem;
  font-weight: 650;
}
input, select, textarea {
  min-height: 40px;
  padding: 8px 10px;
  border-radius: 5px;
}
input:focus, select:focus, textarea:focus {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent);
}

/* Buttons: rectangular, lower visual weight */
.btn {
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 5px;
  box-shadow: none !important;
  transform: none !important;
  font-size: .82rem;
  font-weight: 680;
  transition: background .12s ease, border-color .12s ease;
}
.btn.ghost {
  background: var(--panel);
}
.btn.primary {
  background: var(--accent);
}
.btn.danger,
.btn.danger-outline {
  border-radius: 5px;
}
.btn.small {
  min-height: 32px;
  padding: 5px 9px;
  border-radius: 4px;
  font-size: .76rem;
}

/* Connection/status line */
.banner {
  padding: 9px 11px;
  margin-bottom: 14px;
  border-radius: 5px;
  font-size: .8rem;
}

.section-heading {
  align-items: center;
  margin: 18px 0 10px;
}
.section-heading h2 {
  font-size: 1.15rem;
  font-weight: 720;
}
.status-badges {
  display: flex;
  align-items: center;
  gap: 5px;
}
.badge {
  min-height: 26px;
  padding: 4px 7px;
  border-radius: 4px;
  font-size: .69rem;
  font-weight: 700;
  text-transform: none;
}

/* Asset cards: flatter and denser */
.radio-grid {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 9px;
}
.radio-card {
  padding: 13px 14px;
  border-radius: 6px;
  box-shadow: none;
}
.radio-card[data-status="available"],
.radio-card[data-status="deployed"] {
  border-left-width: 4px;
}
.radio-id {
  font-size: 1rem;
  font-weight: 750;
}
.radio-status {
  margin-top: 5px;
  padding: 3px 6px;
  border-radius: 4px;
  font-size: .67rem;
  letter-spacing: .025em;
}
.card-actions {
  gap: 5px;
}
.radio-details {
  gap: 9px 12px;
  margin-top: 12px;
}
.radio-details dt,
.radio-equipment-label {
  font-size: .68rem;
  font-weight: 650;
}
.radio-details dd {
  font-size: .84rem;
}
.radio-comments {
  margin-top: 10px;
  padding-top: 8px;
  font-size: .78rem;
}
.equipment-chip {
  min-height: 23px;
  padding: 3px 6px;
  border-radius: 4px;
  font-size: .68rem;
}

/* Activity table */
.history-section { margin-top: 24px; }
.table-wrap {
  border-radius: 6px;
  box-shadow: none;
}
th, td {
  padding: 10px 12px;
  font-size: .8rem;
}
th {
  font-size: .68rem;
  letter-spacing: .045em;
}

/* Dialogs: more like standard admin forms */
dialog {
  border: 1px solid var(--border);
  border-radius: 7px;
  box-shadow: 0 18px 50px rgba(0,0,0,.38);
}
.dialog-card {
  padding: 18px;
  gap: 12px;
}
.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 4px;
  font-size: 1.25rem;
}
.radio-picker-fieldset,
.equipment-fieldset,
.change-release,
.box-option,
.batch-radio-option {
  border-radius: 5px;
}
.equipment-option {
  min-height: 40px;
  border-radius: 5px;
}
.delete-warning,
.danger-box {
  border-radius: 5px;
}
.change-release.current {
  border-color: var(--border);
  box-shadow: inset 3px 0 0 var(--accent);
}
.change-release-head strong,
.change-release.current .change-release-head strong {
  min-width: auto;
  min-height: 0;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
}

/* Remove decorative hover/lift/motion from the prior beUI layer */
.beui-press,
.overview-card,
.radio-card,
.box-option,
.batch-radio-option,
.equipment-option,
.nav-link {
  animation: none !important;
  translate: none !important;
}
.beui-press:hover,
.beui-press:active,
.overview-card:hover,
.overview-card:active {
  transform: none !important;
}

/* Responsive behavior */
@media (max-width: 1100px) {
  .topbar,
  .beui-header {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .beui-dock {
    width: 100%;
  }
  .dock-item {
    flex: 1 1 0;
  }
  .beui-actionbar {
    width: 100%;
  }
}
@media (max-width: 760px) {
  .page {
    width: min(100% - 20px, 1440px);
    margin-top: 12px;
  }
  .asset-overview {
    grid-template-columns: repeat(2, 1fr);
  }
  .overview-card:nth-child(2) {
    border-right: 0;
  }
  .overview-card:nth-child(-n+2) {
    border-bottom: 1px solid var(--border);
  }
  .toolbar {
    grid-template-columns: 1fr;
  }
  .toolbar-actions {
    justify-content: stretch;
  }
  .toolbar-actions .btn {
    flex: 1 1 calc(50% - 6px);
  }
}


/* v22 — Login Required */
body.auth-locked { overflow: hidden; }
.login-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}
.login-card {
  width: min(420px, 100%);
  padding: 30px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 18px 50px rgba(0,0,0,.28);
}
.login-logo {
  display: block;
  width: 96px;
  height: 96px;
  object-fit: contain;
  margin: 0 auto 18px;
}
.login-heading { margin-bottom: 22px; text-align: center; }
.login-heading h1 { margin: 3px 0 7px; font-size: 1.65rem; line-height: 1.15; }
.login-heading p { margin: 0; color: var(--muted); font-size: .9rem; }
.login-form { display: grid; gap: 14px; }
.login-form label span { display: block; margin-bottom: 5px; }
.login-form input { width: 100%; }
.login-submit { width: 100%; margin-top: 3px; }
.login-message {
  min-height: 20px;
  margin: 0;
  color: var(--deployed);
  font-size: .82rem;
  text-align: center;
}
#appShell[hidden], #loginGate[hidden] { display: none !important; }

/* v23 — radio box details and retained changelog */
.asset-box-row dd { font-weight: 700; }
.changelog-list {
  max-height: min(68vh, 760px);
  overflow-y: auto;
  padding-right: 4px;
}
.change-release { margin-bottom: 10px; }

/* v26.1 — Dedicated Audit Trail page */
.audit-page {
  width: min(1600px, calc(100% - 36px));
}
.audit-heading { margin-top: 4px; }
.audit-subtitle {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: .84rem;
}
.audit-toolbar {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 190px 190px;
  gap: 10px;
  margin: 14px 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--panel);
}
.audit-history { margin-top: 0; }
.audit-table { min-width: 1050px; }
.audit-table td:last-child { min-width: 220px; }
@media (max-width: 760px) {
  .audit-toolbar { grid-template-columns: 1fr; }
}


/* v26.3 — Main header two-row layout */
.topbar.beui-header {
  grid-template-columns: minmax(320px, 1fr) auto;
  grid-template-areas:
    "brand nav"
    "actions actions";
  row-gap: 9px;
}

.topbar.beui-header .brand-lockup { grid-area: brand; }

.topbar.beui-header .beui-dock {
  grid-area: nav;
  justify-self: end;
}

.topbar.beui-header .header-second-row {
  grid-area: actions;
  width: 100%;
  justify-content: flex-start;
  gap: 6px;
  padding-top: 9px;
  border-top: 1px solid var(--border);
}

.header-action-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

@media (max-width: 1100px) {
  .topbar.beui-header {
    grid-template-columns: 1fr;
    grid-template-areas:
      "brand"
      "nav"
      "actions";
  }
  .topbar.beui-header .beui-dock { justify-self: stretch; }
  .topbar.beui-header .header-second-row { flex-wrap: wrap; }
}

@media (max-width: 650px) {
  .topbar.beui-header .header-second-row > * {
    flex: 1 1 calc(50% - 6px);
  }
  .topbar.beui-header .header-second-row #authBtn {
    flex-basis: 100%;
  }
}

/* v26.4 — true transparent header logo */
.brand-logo,
.brand-logo img {
  background: transparent !important;
}


/* v26.5 — full-width Communications banner */
.topbar.beui-header {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-areas:
    "banner"
    "nav"
    "actions";
  gap: 9px;
  padding-top: 10px;
}

.topbar.beui-header .full-header-banner {
  grid-area: banner;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  overflow: hidden;
}

.topbar.beui-header .full-header-banner img {
  display: block;
  width: min(100%, 1600px);
  max-height: 170px;
  object-fit: contain;
  object-position: center;
  background: transparent;
}

.topbar.beui-header .beui-dock {
  grid-area: nav;
  width: 100%;
  justify-self: stretch;
}

.topbar.beui-header .beui-dock .dock-item {
  flex: 1 1 0;
}

.topbar.beui-header .header-second-row,
.topbar.beui-header .beui-actionbar {
  grid-area: actions;
  width: 100%;
  justify-content: flex-start;
}

@media (max-width: 760px) {
  .topbar.beui-header .full-header-banner img { max-height: 115px; }
}

@media (max-width: 520px) {
  .topbar.beui-header .full-header-banner img { max-height: 88px; }
}


/* v26.6 — optional Surge phone pairing */
.surge-phone-fieldset select {
  width: 100%;
}
.surge-phone-fieldset .equipment-hint {
  margin-bottom: 0;
}


/* v27 — Unit Deployment */
.unit-deployment-card {
  width: min(1100px, calc(100vw - 32px));
}

.unit-deployment-summary {
  display: flex;
  justify-content: flex-start;
}

.unit-deployment-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.unit-asset-group {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel-2);
  overflow: hidden;
}

.unit-asset-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 11px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}

.unit-asset-group-head > div:first-child {
  display: grid;
  gap: 2px;
}

.unit-asset-group-head strong {
  font-size: .86rem;
}

.unit-asset-group-head span {
  color: var(--muted);
  font-size: .72rem;
}

.unit-asset-picker {
  max-height: 230px;
  overflow-y: auto;
  padding: 7px;
  display: grid;
  gap: 5px;
}

.unit-asset-picker:empty::after {
  content: "No available assets";
  display: block;
  padding: 14px 8px;
  color: var(--muted);
  font-size: .8rem;
  text-align: center;
}

.unit-asset-picker .batch-radio-option {
  margin: 0;
}

.asset-unit-row dd {
  font-weight: 700;
}

@media (max-width: 760px) {
  .unit-deployment-grid {
    grid-template-columns: 1fr;
  }

  .unit-asset-group-head {
    align-items: flex-start;
    flex-direction: column;
  }
}


/* v27.1 — Unit Deployment dialog viewport fit */
#unitDeploymentDialog {
  width: min(1100px, calc(100vw - 28px));
  max-width: none;
  max-height: calc(100dvh - 28px);
  margin: auto;
  overflow: hidden;
  box-sizing: border-box;
}

#unitDeploymentDialog .unit-deployment-card {
  width: 100%;
  max-width: none;
  max-height: calc(100dvh - 28px);
  overflow-y: auto;
  overflow-x: hidden;
  box-sizing: border-box;
  padding: 16px;
  gap: 12px;
  scrollbar-gutter: stable;
}

#unitDeploymentDialog .dialog-head {
  margin-bottom: 0;
}

#unitDeploymentDialog .batch-help {
  line-height: 1.35;
}

#unitDeploymentDialog .unit-deployment-grid {
  min-width: 0;
  align-items: start;
}

#unitDeploymentDialog .unit-asset-group {
  min-width: 0;
}

#unitDeploymentDialog .unit-asset-group-head {
  min-width: 0;
}

#unitDeploymentDialog .unit-asset-group-head .batch-picker-actions {
  flex: 0 0 auto;
  margin-bottom: 0;
  flex-wrap: nowrap;
}

#unitDeploymentDialog .unit-asset-picker {
  max-height: clamp(110px, 18dvh, 180px);
  min-height: 72px;
}

#unitDeploymentDialog .dialog-actions {
  position: sticky;
  bottom: -16px;
  z-index: 3;
  margin: 0 -16px -16px;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border);
  background: var(--panel);
}

@media (max-height: 760px) {
  #unitDeploymentDialog .unit-deployment-card {
    padding: 12px;
    gap: 9px;
  }

  #unitDeploymentDialog .unit-asset-picker {
    max-height: 120px;
    min-height: 56px;
  }

  #unitDeploymentDialog .unit-asset-group-head {
    padding: 8px 9px;
  }

  #unitDeploymentDialog .dialog-actions {
    bottom: -12px;
    margin: 0 -12px -12px;
    padding: 10px 12px 12px;
  }
}

@media (max-width: 760px) {
  #unitDeploymentDialog {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
  }

  #unitDeploymentDialog .unit-deployment-card {
    max-height: calc(100dvh - 16px);
  }

  #unitDeploymentDialog .unit-deployment-grid {
    grid-template-columns: 1fr;
  }

  #unitDeploymentDialog .unit-asset-picker {
    max-height: 150px;
  }
}


/* v27.2 — Unit Deployment equipment search */
#unitDeploymentDialog .unit-asset-search-wrap {
  padding: 8px 8px 0;
  background: var(--panel-2);
}

#unitDeploymentDialog .unit-asset-search {
  width: 100%;
  min-height: 36px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--panel);
  color: var(--text);
  box-sizing: border-box;
}

#unitDeploymentDialog .unit-asset-search::placeholder {
  color: var(--muted);
}

#unitDeploymentDialog .unit-asset-search:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent);
  outline-offset: 1px;
}


/* v27.3 — Unit Deployment search visibility fix */
#unitDeploymentDialog .unit-asset-picker .batch-radio-option[hidden],
#unitDeploymentDialog .unit-asset-picker .batch-radio-option[aria-hidden="true"] {
  display: none !important;
}


/* v27.4 — individual asset edit */
.card-actions .asset-edit {
  background: transparent;
  border-color: var(--border);
}

/* v27.6 */
.login-logo { background: transparent !important; object-fit: contain; }


/* v28.1 — responsive management toolbar */
.toolbar,
.toolbar-actions {
  min-width: 0;
}

.toolbar-actions {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.toolbar-actions .btn {
  max-width: 100%;
  white-space: nowrap;
}

/* At common laptop/browser widths, give management controls their own row
   instead of letting the grid's min-content width push past the viewport. */
@media (max-width: 1250px) and (min-width: 761px) {
  .toolbar {
    grid-template-columns: minmax(260px, 1fr) 220px;
  }

  .toolbar-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }
}

/* Preserve the existing mobile arrangement while guaranteeing containment. */
@media (max-width: 760px) {
  .toolbar {
    grid-template-columns: minmax(0, 1fr);
  }

  .toolbar-actions {
    grid-column: 1;
    justify-content: stretch;
  }

  .toolbar-actions .btn {
    flex: 1 1 calc(50% - 6px);
  }
}

@media (max-width: 480px) {
  .toolbar-actions .btn {
    flex-basis: 100%;
  }
}


/* v29 — Unit Operations */
.unit-return-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--accent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 8%, var(--panel));
}
.unit-return-panel[hidden] { display: none !important; }
.unit-return-panel strong { display: block; margin-bottom: 3px; }
.unit-return-panel p {
  margin: 0;
  color: var(--muted);
  font-size: .84rem;
  line-height: 1.35;
}
.unit-return-panel .btn { flex: 0 0 auto; white-space: nowrap; }

#deployedUnitsDialog {
  width: min(1050px, calc(100vw - 28px));
  max-width: none;
  max-height: calc(100dvh - 28px);
  margin: auto;
  overflow: hidden;
  box-sizing: border-box;
}
#deployedUnitsDialog .deployed-units-card {
  width: 100%;
  max-height: calc(100dvh - 28px);
  overflow-y: auto;
  overflow-x: hidden;
  box-sizing: border-box;
  scrollbar-gutter: stable;
}
.deployed-units-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}
.deployed-units-toolbar .search { min-width: 0; }
.deployed-units-list {
  display: grid;
  gap: 12px;
}
.deployed-unit-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel-2);
  overflow: hidden;
}
.deployed-unit-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  padding: 14px;
  border-bottom: 1px solid var(--border);
}
.deployed-unit-head h3 {
  margin: 0;
  font-size: 1.08rem;
}
.deployed-unit-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: .84rem;
  line-height: 1.4;
}
.deployed-unit-head-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.deployed-unit-assets {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
}
.deployed-unit-type-group {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--panel);
  overflow: hidden;
}
.deployed-unit-type-heading {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.deployed-unit-asset-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
}
.deployed-unit-asset-row + .deployed-unit-asset-row {
  border-top: 1px solid var(--border);
}
.deployed-unit-asset-identity {
  min-width: 0;
  display: grid;
  gap: 2px;
}
.deployed-unit-asset-identity strong {
  overflow-wrap: anywhere;
}
.deployed-unit-asset-identity span {
  color: var(--muted);
  font-size: .78rem;
}
.deployed-unit-equipment {
  display: flex;
  justify-content: flex-end;
  gap: 5px;
  flex-wrap: wrap;
}
.deployed-units-empty { padding: 28px; }

@media (max-width: 760px) {
  .unit-return-panel {
    align-items: stretch;
    flex-direction: column;
  }
  .unit-return-panel .btn { width: 100%; }

  #deployedUnitsDialog {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
  }
  #deployedUnitsDialog .deployed-units-card {
    max-height: calc(100dvh - 16px);
  }
  .deployed-units-toolbar {
    grid-template-columns: minmax(0, 1fr);
  }
  .deployed-unit-head {
    flex-direction: column;
  }
  .deployed-unit-head-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .deployed-unit-assets {
    grid-template-columns: minmax(0, 1fr);
  }
  .deployed-unit-asset-row {
    align-items: flex-start;
    flex-direction: column;
  }
  .deployed-unit-equipment {
    justify-content: flex-start;
  }
}

/* v29.1 — Paired Asset Return */
.paired-return-panel { border-color: var(--accent); }


/* v29.2 — Unit Deployment editing + Sign In Multiple search */
.batch-in-search-wrap { margin-bottom: 2px; }
#batchInPicker .batch-signin-row[hidden] { display: none !important; }

/* v30.1.0 — Operations Overview + Asset History */
.operations-overview {
  margin: 22px 0;
}
.operations-overview-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.operations-overview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.operations-card {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.operations-recent-activity { grid-column: 1 / -1; }
.operations-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.operations-card-head h3 {
  margin: 0;
  font-size: .96rem;
}
.operations-card-head span,
.operations-card-head a {
  color: var(--muted);
  font-size: .76rem;
  font-weight: 700;
}
.operations-card-head a { color: var(--accent); text-decoration: none; }
.operations-card-head a:hover { text-decoration: underline; }
.operations-table-wrap { overflow-x: auto; }
.operations-table {
  min-width: 0;
  width: 100%;
}
.operations-table th,
.operations-table td {
  padding: 9px 12px;
  font-size: .8rem;
}
.operations-table tbody th {
  color: var(--text);
  font-size: .8rem;
  letter-spacing: 0;
  text-transform: none;
}
.operations-table td { text-align: right; }
.operations-available { color: var(--available); font-weight: 800; }
.operations-deployed { color: var(--deployed); font-weight: 800; }
.operations-list { min-height: 78px; }
.operations-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
}
.operations-row + .operations-row { border-top: 1px solid var(--border); }
.operations-row-text {
  min-width: 0;
  display: grid;
  gap: 2px;
}
.operations-row-text strong {
  font-size: .86rem;
  overflow-wrap: anywhere;
}
.operations-row-text span {
  color: var(--muted);
  font-size: .75rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.operations-row-badge {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: .74rem;
  font-weight: 800;
  text-align: right;
}
.operations-empty {
  margin: 0;
  padding: 18px 14px;
  color: var(--muted);
  font-size: .82rem;
}

#assetHistoryDialog {
  width: min(860px, calc(100vw - 28px));
  max-width: none;
  max-height: calc(100dvh - 28px);
  overflow: hidden;
}
#assetHistoryDialog .asset-history-card {
  max-height: calc(100dvh - 28px);
  overflow-y: auto;
  scrollbar-gutter: stable;
}
.asset-history-current {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.asset-history-current > div {
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--panel-2);
  display: grid;
  gap: 3px;
}
.asset-history-current span {
  color: var(--muted);
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.asset-history-current strong {
  font-size: .84rem;
  overflow-wrap: anywhere;
}
.asset-history-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.asset-history-list {
  display: grid;
  gap: 10px;
}
.asset-history-entry {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}
.asset-history-entry-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-2);
}
.asset-history-entry-head strong { font-size: .9rem; }
.asset-history-entry-head time {
  color: var(--muted);
  font-size: .75rem;
  text-align: right;
}
.asset-history-entry-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
}
.asset-history-entry-details > div {
  min-width: 0;
  padding: 9px 12px;
  display: grid;
  gap: 2px;
  border-bottom: 1px solid var(--border);
}
.asset-history-entry-details > div:nth-last-child(-n+2) { border-bottom: 0; }
.asset-history-entry-details span {
  color: var(--muted);
  font-size: .7rem;
}
.asset-history-entry-details strong {
  font-size: .82rem;
  font-weight: 650;
  overflow-wrap: anywhere;
}
.asset-history-no-details {
  margin: 0;
  padding: 12px;
  color: var(--muted);
  font-size: .8rem;
}

@media (max-width: 900px) {
  .operations-overview-grid { grid-template-columns: minmax(0, 1fr); }
  .operations-recent-activity { grid-column: auto; }
  .asset-history-current { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  .operations-overview-head { align-items: flex-start; flex-direction: column; }
  .operations-row { align-items: flex-start; }
  .operations-row-badge { max-width: 42%; }
  #assetHistoryDialog {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
  }
  #assetHistoryDialog .asset-history-card { max-height: calc(100dvh - 16px); }
  .asset-history-current { grid-template-columns: minmax(0, 1fr); }
  .asset-history-entry-head { align-items: flex-start; flex-direction: column; }
  .asset-history-entry-head time { text-align: left; }
  .asset-history-entry-details { grid-template-columns: minmax(0, 1fr); }
  .asset-history-entry-details > div { border-bottom: 1px solid var(--border) !important; }
  .asset-history-entry-details > div:last-child { border-bottom: 0 !important; }
}


/* v30.1.1 — Collapsible Operations Overview */
.operations-overview {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.operations-overview-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 14px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.operations-overview-summary::-webkit-details-marker { display: none; }
.operations-overview-summary::marker { content: ""; }
.operations-overview-summary:hover { background: color-mix(in srgb, var(--accent) 4%, var(--panel)); }
.operations-overview-summary-title { min-width: 0; }
.operations-overview-summary-title h2 { margin: 1px 0 0; font-size: 1rem; }
.operations-overview-summary-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex: 0 0 auto;
}
.operations-overview-toggle {
  color: var(--accent);
  font-size: .76rem;
  font-weight: 800;
  white-space: nowrap;
}
.operations-overview-toggle::after {
  content: "▾";
  display: inline-block;
  margin-left: 6px;
  transition: transform .16s ease;
}
.operations-overview[open] .operations-overview-toggle::after { transform: rotate(180deg); }
.operations-overview .hide-label { display: none; }
.operations-overview[open] .show-label { display: none; }
.operations-overview[open] .hide-label { display: inline; }
.operations-overview-body {
  padding: 0 12px 12px;
  border-top: 1px solid var(--border);
}
.operations-overview-body .operations-overview-grid { padding-top: 12px; }
.operations-overview-body .operations-card { box-shadow: none; }

@media (max-width: 620px) {
  .operations-overview-summary { align-items: flex-start; }
  .operations-overview-summary-meta { align-items: flex-end; flex-direction: column; gap: 6px; }
}


/* v30.1.2 — Header status row */
.topbar.beui-header {
  grid-template-areas:
    "banner"
    "nav"
    "actions"
    "status";
}
.header-status-row {
  grid-area: status;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  min-height: 28px;
}
.header-status-row .badge {
  padding: 5px 8px;
  font-size: .72rem;
}
@media (max-width: 650px) {
  .header-status-row { justify-content: flex-start; }
}

/* v30.2.0 — Reports / Export Center */
#reportsDialog {
  width: min(1180px, calc(100vw - 28px));
  max-width: none;
  max-height: calc(100dvh - 28px);
  overflow: hidden;
}
#reportsDialog .reports-card {
  max-height: calc(100dvh - 28px);
  overflow-y: auto;
  scrollbar-gutter: stable;
}
.reports-controls {
  display: grid;
  grid-template-columns: minmax(240px, 1.4fr) repeat(2, minmax(170px, .8fr));
  gap: 10px;
  align-items: end;
}
.reports-controls label[hidden] { display: none !important; }
.reports-controls label small { color: var(--muted); font-weight: 600; }
.reports-help {
  margin: -3px 0 0;
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.45;
}
.reports-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.report-preview {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}
.report-preview-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-2);
}
.report-preview-head h3 { margin: 0; font-size: 1rem; }
.report-preview-head p { margin: 4px 0 0; color: var(--muted); font-size: .76rem; line-height: 1.4; }
.report-table-wrap {
  max-height: min(48vh, 520px);
  overflow: auto;
}
.report-table {
  min-width: max(900px, 100%);
}
.report-table th,
.report-table td {
  padding: 8px 10px;
  font-size: .76rem;
  vertical-align: top;
  white-space: normal;
  overflow-wrap: anywhere;
}
.report-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel-2);
}

@media (max-width: 850px) {
  .reports-controls { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
@media (max-width: 620px) {
  #reportsDialog {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
  }
  #reportsDialog .reports-card { max-height: calc(100dvh - 16px); }
  .reports-controls { grid-template-columns: minmax(0, 1fr); }
  .reports-actions .btn { flex: 1 1 auto; }
  .report-preview-head { flex-direction: column; }
}


/* v30.2.1 — Admin User Removal */
.user-email { display:flex; align-items:center; gap:8px; }
.user-actions { display:flex; flex-wrap:wrap; gap:8px; justify-content:flex-end; }
.user-you-badge { font-size:.68rem; padding:3px 6px; }
.user-actions .btn.danger:disabled { opacity:.55; cursor:not-allowed; }
