/* Fleet workspace: keep navigation, filters and device actions within reach. */
#app main { min-width: 0; padding: 16px 22px; }
.topbar { margin-bottom: 12px; }
.topbar .eyebrow { display: none; }
.topbar h1 { font-size: 26px; }
.page-description { margin: 5px 0; }
#statsGrid { gap: 10px; margin-bottom: 12px; }
#statsGrid .stat-card { min-height: 48px; padding: 7px 12px; box-shadow: none; }
#statsGrid .stat-copy { display: flex; align-items: center; gap: 14px; }
#statsGrid .stat-copy strong { font-size: 23px; }
#statsGrid .stat-icon { width: 32px; height: 32px; }
#devicesView { display: grid; grid-template-columns: 245px minmax(0, 1fr); align-items: start; gap: 18px; }
#fleetNavigationToggle { display: none; }
.nav-branch-row { display: flex; align-items: center; }
.nav-branch-row .nav-item { padding-left: 3px; }
.group-toggle { border: 0; padding: 9px 3px; background: transparent; color: #637083; }
#fleetNavigation { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; padding: 6px; border: 1px solid #d7e2ef; border-radius: 12px; background: #fff; }
.nav-heading { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: #60738c; font-weight: 700; padding: 14px 10px 7px; }
.nav-item { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; color: #253b57; background: transparent; border: 0; border-radius: 6px; box-shadow: none; text-align: left; padding: 10px; font-size: 13px; }
.nav-item > span:first-child { overflow-wrap: anywhere; }
.nav-item:hover { background: #f0f5fc; }
.nav-item.active { background: #e8f0ff; color: #195ac0; font-weight: 700; }
.nav-counts { display: flex; align-items: center; gap: 5px; flex-shrink: 0; font-size: 11px; color: #64748b; }
.offline-count { background: #edf1f5; padding: 2px 4px; border-radius: 4px; }
.warning-count { background: #fff0cf; color: #875100; padding: 2px 4px; border-radius: 4px; }
.nav-children { padding-left: 10px; margin-left: 9px; border-left: 1px solid #dbe5f0; }
#fleetNavigation summary { padding: 7px 10px; cursor: pointer; font-size: 12px; color: #53667e; overflow-wrap: anywhere; }
.nav-tools { display: flex; gap: 10px; padding: 0 10px 8px; }
.nav-tools button { padding: 0; border: 0; background: transparent; color: #416a9e; font-size: 11px; }
#devicesPanel { min-width: 0; overflow: visible; margin: 0; }
#devicesPanel .panel-head { padding: 12px 16px; }
#devicesPanel .toolbar { padding: 10px 16px; grid-template-columns: minmax(180px, 1fr) 135px 135px auto; gap: 10px; }
#devicesPanel .view-toggle { grid-template-columns: 1fr 1fr; }
.fleet-options { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 10px 16px; border-bottom: 1px solid #dce5f0; background: #f8faff; font-size: 12px; }
.fleet-options label { display: flex; flex-direction: row; align-items: center; gap: 6px; font-size: 12px; }
.fleet-options select { width: auto; max-width: 180px; min-height: 30px; padding: 5px 8px; font-size: 12px; }
input[type=checkbox] { width: 16px; height: 16px; min-height: 0; padding: 0; margin: 0; accent-color: #2563eb; flex-shrink: 0; cursor: pointer; }
#liveStatus { margin-left: auto; color: #64748b; font-size: 11px; }
#bulkBar { background: white; }
#bulkValue { flex: 1 1 190px; width: 190px; min-height: 30px; padding: 6px 8px; font-size: 12px; }
#bulkResult { color: #375a85; padding: 8px 16px; font-size: 12px; }
#bulkResult:empty { display: none; }
#selectionCount { color: #52667f; }
#deviceListView { max-height: calc(100vh - 455px); min-height: 220px; overflow: auto; border-radius: 0; }
#deviceListView table { min-width: 790px; }
#deviceListView th { position: sticky; top: 0; z-index: 2; background: #f6f8fc; padding: 10px 12px; }
#deviceListView td { padding: 6px 12px; }
#deviceListView .device-link { min-height: 20px; }
#deviceListView tr:has(input:checked) { background: #edf4ff; }
#deviceListView .selection-cell { width: 32px; padding-right: 0; }
#deviceListView .device-avatar { display: none; }
#deviceListView .device-name { min-width: 150px; }
#deviceListView .device-identity small { font-size: 11px; }
.device-tags { display: block; color: #68798d; font-size: 10px; margin-top: 4px; max-width: 150px; overflow-wrap: anywhere; }
.group-chip { max-width: 180px; white-space: normal; overflow-wrap: anywhere; }
.health-badge { white-space: normal; max-width: 200px; }
.health-reasons { display: inline-block; position: relative; margin-left: 5px; color: #76500b; font-size: 12px; }
.health-reasons summary { cursor: pointer; }
.health-reasons div { position: absolute; z-index: 5; width: 230px; right: 0; padding: 8px 12px; background: #fff9e9; border: 1px solid #e5cf94; border-radius: 8px; box-shadow: 0 4px 14px #11243d22; }
.health-reasons p { margin: 4px 0; }
.row-actions { flex-wrap: nowrap; gap: 5px; }
.favorite-button { font-size: 17px; padding: 3px 6px; min-width: 28px; }
.favorite-button[aria-pressed=true] { color: #a66800; background: #fff8e1; }
.row-menu { position: relative; }
.row-menu summary { font-size: 21px; list-style: none; cursor: pointer; padding: 0 7px; border-radius: 4px; }
.row-menu summary::-webkit-details-marker { display: none; }
.row-menu div { position: absolute; right: 0; top: 100%; z-index: 6; background: white; border: 1px solid #d7e2ef; border-radius: 8px; padding: 5px; width: 160px; box-shadow: 0 4px 14px #11243d22; }
.row-menu button { display: block; width: 100%; text-align: left; color: #224d83; background: white; border: 0; padding: 9px; font-size: 12px; }
.row-menu button:hover { background: #eef4ff; }
#devicesPanel .panel-body { padding: 12px 16px; }
body[data-density=comfortable] #deviceListView td { padding-top: 17px; padding-bottom: 17px; }
body.drawer-open { overflow: hidden; }
body.drawer-open::before { content: ""; position: fixed; inset: 0; background: #12243c55; z-index: 19; }
#deviceView { position: fixed; z-index: 20; top: 0; bottom: 0; right: 0; width: min(620px, 94vw); background: #f4f7fc; overflow-y: auto; padding: 18px; box-shadow: -8px 0 35px #11243d26; }
#deviceView > .panel { margin-bottom: 16px; }
#deviceView > .panel:first-child > .panel-head { position: sticky; top: -18px; z-index: 2; background: #fff; }
#deviceView .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
#deviceView .card { padding: 10px; min-width: 0; min-height: 70px; }
#deviceView .card strong { font-size: 14px; overflow-wrap: anywhere; }
#deviceView .form { max-width: none; }
#deviceView .actions { flex-wrap: wrap; }
#activityRows .event { display: flex; flex-wrap: wrap; gap: 14px; padding: 14px 0; border-bottom: 1px solid #e2e8f0; }
#statsGrid .stat-card:last-child { display: none; }
#statsGrid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card-select { display: flex; align-items: center; gap: 7px; font-size: 12px; color: #60738c; }
:is(button, a, input, select, summary):focus-visible { outline: 3px solid #75a7ff; outline-offset: 2px; }
.hidden { display: none !important; }
@media (max-width: 1200px) {
  #app main { padding: 18px; }
  #devicesView { grid-template-columns: 200px minmax(0, 1fr); gap: 12px; }
  #devicesPanel .toolbar { grid-template-columns: minmax(150px, 1fr) 110px; }
  #deviceListView { max-height: 60vh; }
  .nav-counts { flex-wrap: wrap; justify-content: end; }
}
@media (max-width: 800px) {
  #devicesView { grid-template-columns: minmax(0, 1fr); }
  #fleetNavigationToggle { display: block; text-align: left; }
  #fleetNavigation { display: none; position: static; max-height: 350px; }
  #fleetNavigation.mobile-expanded { display: block; }
  #statsGrid .stat-icon { display: none; }
  #statsGrid .stat-copy { flex-direction: column; gap: 2px; align-items: start; }
  #statsGrid .stat-card { padding: 8px 10px; }
  #devicesPanel .toolbar { grid-template-columns: 1fr 1fr; }
  #devicesPanel .search-field { grid-column: 1 / -1; }
  #liveStatus { margin-left: 0; flex-basis: 100%; }
  #deviceView { width: 100vw; padding: 12px; }
  #deviceView .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #deviceListView { max-height: 65vh; }
  #deviceListView table { min-width: 0; width: 100%; display: block; }
  #deviceListView thead, #deviceListView tbody { display: block; }
  #deviceListView thead { position: sticky; top: 0; z-index: 2; }
  #deviceListView thead tr { display: block; }
  #deviceListView th { display: none; position: static; }
  #deviceListView th.selection-cell { display: flex; width: 100%; gap: 10px; }
  #deviceListView th.selection-cell::after { content: "Select visible devices"; font-size: 11px; }
  #deviceListView tbody tr { display: grid; grid-template-columns: 28px 1fr 1fr; padding: 12px 10px; border-bottom: 1px solid #dce5f0; gap: 6px; }
  #deviceListView td { display: block; padding: 0 !important; border: 0; }
  #deviceListView td:nth-child(1) { grid-column: 1; padding-top: 4px !important; }
  #deviceListView td:nth-child(2) { grid-column: 2 / -1; }
  #deviceListView td:nth-child(3) { grid-column: 2; }
  #deviceListView td:nth-child(4) { grid-column: 3; }
  #deviceListView td:nth-child(5), #deviceListView td:nth-child(6), #deviceListView td:nth-child(7) { grid-column: 2 / -1; }
  #deviceListView td:nth-child(6)::before { content: "Last seen: "; }
  #deviceListView.recent-view td:nth-child(6)::before { content: "Last connected: "; }
  #deviceListView td:nth-child(6) { font-size: 11px; color: #637083; }
  #deviceListView .row-actions { justify-content: flex-start; padding-top: 3px; }
  #deviceListView .device-empty { grid-column: 1 / -1 !important; }
}
