.col-sidebar {
  width: 260px;
  max-width: 300px;
  overflow-y: auto;
  max-height: calc(100vh - 56px);
  position: sticky;
  top: 56px;
  background: #f8f9fa;
}

@media (max-width: 991.98px) {
  /* Reset position:sticky so .col-sidebar no longer creates a stacking context.
     Without this, the offcanvas z-index is scoped to the sidebar's stacking
     context rather than the root, causing main-column content to paint on top
     of the offcanvas panel. */
  .col-sidebar {
    position: static;
    overflow: visible;
    max-height: none;
    width: 0 !important;
    padding: 0 !important;
  }

  .unit-table thead th {
    position: static;
  }

  .unit-table thead.sticky-top {
    position: static !important;
  }
}

[data-bs-theme="dark"] .col-sidebar {
  background: #212529;
}

.unit-table th,
.unit-table td {
  white-space: nowrap;
  font-size: 0.8rem;
}

.unit-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.unit-table th:first-child,
.unit-table td:first-child {
  white-space: normal;
  min-width: 35px;
  max-width: 240px;
}

.owned-star {
  color: var(--bs-body-color);
}

[data-bs-theme="dark"] .owned-star {
  background-color: #7a6000;
  border-color: #7a6000;
  color: #e0c060;
}

.ability-badge {
  user-select: none;
}

.ability-badge[data-ability-desc] {
  cursor: pointer;
  text-decoration: underline dotted;
}

.lance-pv-bar {
  top: 0;
  z-index: 1030;
}

.pv-cap-input {
  width: 80px;
}

.unit-detail-link {
  text-decoration: none;
  color: inherit;
}
.unit-detail-link:hover {
  text-decoration: underline;
}

.unit-detail-img {
  max-height: 260px;
  object-fit: contain;
  border-radius: 4px;
}

[data-bs-theme="dark"] .unit-detail-img {
  filter: invert(1);
  mix-blend-mode: screen;
}

.unit-detail-img-placeholder {
  height: 200px;
  border-radius: 4px;
  border: 1px dashed var(--bs-border-color);
}

.damage-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: bold;
  font-family: monospace;
}

.card-header.unit-overview-header {
  padding-top: 0.8rem;
  padding-bottom: 0;
}

/* Compact filter sidebar labels */
.filter-sidebar .form-check-label {
  cursor: pointer;
}

.filter-sidebar .form-label {
  margin-bottom: 0.2rem;
}
