/* =====================================================================
 * HOMECARE — Unit Asset Passport (M04 PART 02)
 * ---------------------------------------------------------------------
 * Mobile-first presentation for #/my-unit/assets: asset summary stat
 * card, category/location grouping toggle, asset rows with condition /
 * operational / coverage labels and the in-page asset detail passport.
 * Also styles the Asset Passport entry card rendered inside My Unit
 * (kept here so styles/my-unit.css remains untouched by M04).
 * Token-only styling, 44px touch targets where interactive, long
 * values wrap (overflow-wrap), no horizontal overflow, small-screen
 * compaction.
 * =================================================================== */

.hc-assets-page {
  display: flex;
  flex-direction: column;
  gap: var(--hc-space-4);
  padding-bottom: var(--hc-space-6);
}

/* ---- Page heading --------------------------------------------------- */

.hc-assets-heading h2 {
  color: var(--hc-text-strong);
  font-size: var(--hc-font-size-2xl);
  font-weight: var(--hc-font-weight-bold);
  letter-spacing: var(--hc-letter-tight);
}

.hc-assets-heading p {
  margin-top: var(--hc-space-1);
  color: var(--hc-text-muted);
  font-size: var(--hc-font-size-sm);
}

/* ---- Context hero (matches the My Unit hero pattern) ---------------- */

.hc-assets-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--hc-space-3);
  padding: var(--hc-space-4);
  background: var(--hc-bg-surface);
  border: 1px solid var(--hc-border);
  border-radius: var(--hc-radius-lg);
  box-shadow: var(--hc-shadow-sm);
}

.hc-assets-hero__main {
  min-width: 0;
}

.hc-assets-hero__eyebrow {
  color: var(--hc-text-faint);
  font-size: var(--hc-font-size-xs);
  font-weight: var(--hc-font-weight-semibold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hc-assets-hero__property {
  margin-top: var(--hc-space-1);
  color: var(--hc-text-strong);
  font-size: var(--hc-font-size-lg);
  font-weight: var(--hc-font-weight-semibold);
  overflow-wrap: anywhere;
}

.hc-assets-hero__location {
  margin-top: var(--hc-space-1);
  color: var(--hc-text-muted);
  font-size: var(--hc-font-size-sm);
  overflow-wrap: anywhere;
}

.hc-assets-hero__side {
  flex-shrink: 0;
}

.hc-assets-hero__note {
  display: flex;
  align-items: flex-start;
  gap: var(--hc-space-2);
  color: var(--hc-text-muted);
  font-size: var(--hc-font-size-sm);
}

.hc-assets-hero__note-icon {
  flex-shrink: 0;
  margin-top: 2px;
}

/* ---- My Unit -> Asset Passport entry card --------------------------- */

.hc-assets-entry {
  display: flex;
  align-items: center;
  gap: var(--hc-space-3);
  min-height: var(--hc-touch-target, 44px);
  padding: var(--hc-space-3) var(--hc-space-4);
  background: var(--hc-bg-surface);
  border: 1px solid var(--hc-border);
  border-radius: var(--hc-radius-lg);
  box-shadow: var(--hc-shadow-sm);
  text-decoration: none;
  color: inherit;
}

.hc-assets-entry__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: var(--hc-radius-md);
  background: var(--hc-primary-50, var(--hc-bg-muted));
  color: var(--hc-primary-600, var(--hc-text-muted));
}

.hc-assets-entry__icon .hc-icon {
  width: 20px;
  height: 20px;
}

.hc-assets-entry__main {
  display: grid;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.hc-assets-entry__title {
  color: var(--hc-text-strong);
  font-weight: var(--hc-font-weight-semibold);
}

.hc-assets-entry__text {
  color: var(--hc-text-muted);
  font-size: var(--hc-font-size-sm);
  overflow-wrap: anywhere;
}

.hc-assets-entry__chevron {
  display: inline-flex;
  flex-shrink: 0;
  color: var(--hc-text-faint);
}

/* ---- Sections -------------------------------------------------------- */

.hc-assets-section {
  display: flex;
  flex-direction: column;
  gap: var(--hc-space-2);
}

.hc-assets-section__note {
  margin: 0;
}

.hc-assets-region {
  min-width: 0;
}

/* ---- Asset summary --------------------------------------------------- */

.hc-assets-summary {
  display: flex;
  flex-direction: column;
  gap: var(--hc-space-3);
}

.hc-assets-summary__total {
  display: flex;
  align-items: baseline;
  gap: var(--hc-space-2);
  margin: 0;
}

.hc-assets-summary__total-value {
  color: var(--hc-text-strong);
  font-size: var(--hc-font-size-2xl);
  font-weight: var(--hc-font-weight-bold);
}

.hc-assets-summary__total-label {
  color: var(--hc-text-muted);
  font-size: var(--hc-font-size-sm);
}

.hc-assets-summary__stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--hc-space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.hc-assets-stat {
  display: grid;
  gap: 2px;
  padding: var(--hc-space-2) var(--hc-space-3);
  border-radius: var(--hc-radius-md);
  border: 1px solid var(--hc-border);
}

.hc-assets-stat__value {
  font-size: var(--hc-font-size-xl);
  font-weight: var(--hc-font-weight-bold);
}

.hc-assets-stat__label {
  color: var(--hc-text-muted);
  font-size: var(--hc-font-size-xs);
}

.hc-assets-stat--success .hc-assets-stat__value {
  color: var(--hc-success-600);
}

.hc-assets-stat--warning .hc-assets-stat__value {
  color: var(--hc-warning-600);
}

.hc-assets-stat--danger .hc-assets-stat__value {
  color: var(--hc-danger-600);
}

.hc-assets-summary__ops {
  display: flex;
  flex-wrap: wrap;
  gap: var(--hc-space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

/* ---- Grouping toggle -------------------------------------------------- */

.hc-assets-list-header {
  align-items: center;
  gap: var(--hc-space-2);
}

.hc-assets-toggle {
  display: inline-flex;
  border: 1px solid var(--hc-border);
  border-radius: var(--hc-radius-pill);
  overflow: hidden;
  flex-shrink: 0;
}

.hc-assets-toggle__btn {
  min-height: var(--hc-touch-target, 44px);
  padding: 0 var(--hc-space-3);
  background: transparent;
  border: 0;
  color: var(--hc-text-muted);
  font-size: var(--hc-font-size-xs);
  font-weight: var(--hc-font-weight-semibold);
  cursor: pointer;
}

.hc-assets-toggle__btn[aria-pressed="true"] {
  background: var(--hc-primary-600, var(--hc-text-strong));
  color: var(--hc-bg-inverted, #fff);
}

/* ---- Asset groups and rows -------------------------------------------- */

.hc-assets-groups {
  display: flex;
  flex-direction: column;
  gap: var(--hc-space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.hc-assets-group {
  display: flex;
  flex-direction: column;
  gap: var(--hc-space-2);
  padding: var(--hc-space-3);
}

.hc-assets-group__title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--hc-space-2);
  margin: 0;
  color: var(--hc-text-strong);
  font-size: var(--hc-font-size-sm);
  font-weight: var(--hc-font-weight-semibold);
  overflow-wrap: anywhere;
}

.hc-assets-list {
  display: flex;
  flex-direction: column;
  gap: var(--hc-space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.hc-assets-item {
  display: flex;
  align-items: center;
  gap: var(--hc-space-3);
  width: 100%;
  min-height: var(--hc-touch-target, 44px);
  padding: var(--hc-space-3);
  text-align: left;
  background: var(--hc-bg);
  border: 1px solid var(--hc-border);
  border-radius: var(--hc-radius-md);
  cursor: pointer;
  color: inherit;
  font: inherit;
}

.hc-assets-item__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: var(--hc-radius-md);
  background: var(--hc-bg-muted);
  color: var(--hc-text-muted);
}

.hc-assets-item__icon .hc-icon {
  width: 18px;
  height: 18px;
}

.hc-assets-item__skeleton-icon {
  width: 36px;
  height: 36px;
}

.hc-assets-item__main {
  display: grid;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.hc-assets-item__name {
  color: var(--hc-text-strong);
  font-weight: var(--hc-font-weight-semibold);
  overflow-wrap: anywhere;
}

.hc-assets-item__sub,
.hc-assets-item__meta {
  color: var(--hc-text-muted);
  font-size: var(--hc-font-size-xs);
  overflow-wrap: anywhere;
}

.hc-assets-item__badges {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
  max-width: 45%;
}

.hc-assets-item__coverage {
  color: var(--hc-text-faint);
  font-size: var(--hc-font-size-xs);
  overflow-wrap: anywhere;
  text-align: right;
}

.hc-assets-item__coverage--warning {
  color: var(--hc-warning-600);
  font-weight: var(--hc-font-weight-semibold);
}

.hc-assets-item__chevron {
  display: inline-flex;
  flex-shrink: 0;
  color: var(--hc-text-faint);
}

/* ---- Asset detail ------------------------------------------------------ */

.hc-assets-back {
  align-self: flex-start;
}

.hc-assets-detail {
  gap: var(--hc-space-3);
}

.hc-assets-detail__head {
  display: flex;
  align-items: flex-start;
  gap: var(--hc-space-3);
  padding: var(--hc-space-4);
}

.hc-assets-detail__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: var(--hc-radius-md);
  background: var(--hc-bg-muted);
  color: var(--hc-text-muted);
}

.hc-assets-detail__skeleton-icon {
  width: 44px;
  height: 44px;
}

.hc-assets-detail__headmain {
  display: grid;
  gap: var(--hc-space-1);
  min-width: 0;
}

.hc-assets-detail__title {
  margin: 0;
  color: var(--hc-text-strong);
  font-size: var(--hc-font-size-lg);
  font-weight: var(--hc-font-weight-bold);
  overflow-wrap: anywhere;
}

.hc-assets-detail__title:focus {
  outline: none;
}

.hc-assets-detail__sub {
  margin: 0;
  color: var(--hc-text-muted);
  font-size: var(--hc-font-size-sm);
  overflow-wrap: anywhere;
}

.hc-assets-detail__badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--hc-space-2);
}

.hc-assets-detail__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--hc-space-3);
  margin: 0;
  padding: var(--hc-space-4);
}

.hc-assets-detail__cell {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.hc-assets-detail__cell dt {
  color: var(--hc-text-faint);
  font-size: var(--hc-font-size-xs);
}

.hc-assets-detail__cell dd {
  margin: 0;
  color: var(--hc-text-strong);
  font-size: var(--hc-font-size-sm);
  overflow-wrap: anywhere;
}

.hc-assets-detail__serial {
  font-family: var(--hc-font-mono, monospace);
  letter-spacing: 0.02em;
}

.hc-assets-detail__coverage-date {
  color: var(--hc-text-muted);
  font-size: var(--hc-font-size-xs);
}

.hc-assets-detail__notes {
  padding: var(--hc-space-4);
}

.hc-assets-detail__notes-title {
  margin: 0 0 var(--hc-space-1);
  color: var(--hc-text-strong);
  font-size: var(--hc-font-size-sm);
  font-weight: var(--hc-font-weight-semibold);
}

.hc-assets-detail__notes p {
  margin: 0;
  color: var(--hc-text-muted);
  font-size: var(--hc-font-size-sm);
  overflow-wrap: anywhere;
}

/* ---- Small-screen compaction (no horizontal overflow) ------------------ */

@media (max-width: 359px) {
  .hc-assets-summary__stats {
    grid-template-columns: minmax(0, 1fr);
  }

  .hc-assets-detail__grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .hc-assets-item {
    flex-wrap: wrap;
  }

  .hc-assets-item__badges {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    max-width: 100%;
    justify-content: flex-start;
  }

  .hc-assets-item__coverage {
    text-align: left;
  }

  .hc-assets-item__chevron {
    display: none;
  }

  .hc-assets-entry {
    flex-wrap: wrap;
  }
}
