/* =====================================================================
   HOMECARE — Home dashboard (M02 PART 02 + PART 03)
   Presentation only. Dashboard values come from the M02 mock service —
   no business rules are encoded here. Layout honors the M00/M01 mobile
   constraints: no horizontal overflow, 44px touch targets, small-screen
   rules, app max-width supplied by the shell.
   PART 03 adds the quick-action grid, the Emergency demo dialog content
   and the dev placeholder module pages.
   ===================================================================== */

.hc-home-page {
  gap: var(--hc-space-4);
}

.hc-home-dashboard {
  display: flex;
  flex-direction: column;
  gap: var(--hc-space-4);
}
.hc-home-dashboard > .hc-home-attention { order: 1; }
.hc-home-dashboard > .hc-home-coming { order: 2; }
.hc-home-dashboard > section[aria-labelledby="hc-home-summary-title"] { order: 3; }
.hc-home-dashboard > .hc-home-due { order: 4; }
.hc-home-attention__list { display: grid; gap: var(--hc-space-2); }
.hc-home-attention__item,
.hc-home-coming__item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--hc-space-2);
  min-width: 0;
  padding: var(--hc-space-3);
  color: var(--hc-text-base);
  background: var(--hc-bg-surface);
  border: 1px solid var(--hc-border);
  border-radius: var(--hc-radius-md);
  text-decoration: none;
}
.hc-home-attention__item > span:not(.hc-badge),
.hc-home-coming__item { font-size: var(--hc-font-size-sm); }
.hc-home-attention__item a { font-size: var(--hc-font-size-xs); font-weight: var(--hc-font-weight-semibold); }
.hc-home-coming__item { display: block; }
.hc-home-coming__item:hover { border-color: var(--hc-border-strong); }
@media (max-width: 359px) {
  .hc-home-attention__item { grid-template-columns: auto minmax(0, 1fr); }
  .hc-home-attention__item a { grid-column: 2; }
}

.hc-home-page p,
.hc-home-page h2,
.hc-home-page h3 {
  margin: 0;
}

.hc-home-page section .hc-section-header {
  margin-bottom: var(--hc-space-2);
}

/* ---- Context-aware header ------------------------------------------ */

.hc-home-hero__greeting {
  color: var(--hc-text-muted);
  font-size: var(--hc-font-size-sm);
}

.hc-home-hero__identity {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--hc-space-2);
  margin-top: var(--hc-space-1);
}

.hc-home-hero__name {
  font-size: var(--hc-font-size-xl);
  line-height: var(--hc-leading-tight);
}

.hc-home-hero__name:focus {
  outline: none;
}

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

/* Active-unit card: the residence context must be unmistakable.
   M03 PART 02: the card also links to the My Unit screen. */
.hc-home-unit {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--hc-space-3);
  margin-top: 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-home-unit[href] {
  text-decoration: none;
  color: inherit;
}

.hc-home-unit[href]:hover {
  border-color: var(--hc-color-primary);
}

.hc-home-unit[href]:focus-visible {
  outline: 2px solid var(--hc-color-primary);
  outline-offset: 2px;
}

.hc-home-unit__main {
  min-width: 0;
}

.hc-home-unit__badges {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: var(--hc-space-2);
}

.hc-home-unit__open {
  display: inline-flex;
  align-items: center;
  align-self: center;
  flex: none;
  color: var(--hc-text-faint);
}

.hc-home-unit__open .hc-icon {
  width: 20px;
  height: 20px;
}

.hc-home-unit__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-home-unit__code {
  margin-top: var(--hc-space-1);
  color: var(--hc-color-primary);
  font-size: var(--hc-font-size-xl);
  font-weight: var(--hc-font-weight-bold);
  letter-spacing: var(--hc-letter-tight);
}

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

/* ---- Total due card ------------------------------------------------- */

.hc-home-due {
  display: flex;
  flex-direction: column;
  gap: var(--hc-space-4);
  padding: var(--hc-space-5);
  background: var(--hc-navy-800);
  color: var(--hc-text-inverse);
  border-radius: var(--hc-radius-lg);
  box-shadow: var(--hc-shadow-md);
}

.hc-home-due__eyebrow {
  display: flex;
  align-items: center;
  gap: var(--hc-space-2);
  color: var(--hc-blue-100);
  font-size: var(--hc-font-size-xs);
  font-weight: var(--hc-font-weight-semibold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.hc-home-due__eyebrow-icon {
  width: 1rem;
  height: 1rem;
}

.hc-home-due__amount {
  margin-top: var(--hc-space-2);
  font-size: var(--hc-font-size-2xl, 2rem);
  font-weight: var(--hc-font-weight-bold);
  letter-spacing: var(--hc-letter-tight);
  line-height: var(--hc-leading-tight);
  overflow-wrap: anywhere;
}

.hc-home-due__date {
  margin-top: var(--hc-space-1);
  color: var(--hc-blue-100);
  font-size: var(--hc-font-size-sm);
}

/* Statement status chip inside the navy card (M05 PART 03). */
.hc-home-due__meta .hc-badge {
  margin-top: var(--hc-space-2);
  align-self: flex-start;
}

/* Inverse "View statement" link to #/my-unit/billing (M05 PART 03,
   44px target, secondary to the Pay now placeholder button). */
.hc-home-due__statement {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--hc-space-1);
  min-height: var(--hc-touch-target, 44px);
  padding: var(--hc-space-2) var(--hc-space-4);
  border: 1px solid var(--hc-blue-400);
  border-radius: var(--hc-radius-md);
  color: var(--hc-text-inverse);
  font-weight: var(--hc-font-weight-semibold);
  text-decoration: none;
}

.hc-home-due__statement:hover {
  border-color: var(--hc-blue-100);
  color: var(--hc-blue-100);
}

/* Inverse "Pay now" placeholder button (44px target via .hc-btn). */
.hc-home-due__pay {
  color: var(--hc-navy-800);
  background: var(--hc-bg-surface);
  border-color: var(--hc-bg-surface);
}

.hc-home-due__pay:hover {
  color: var(--hc-navy-900);
  background: var(--hc-blue-50);
  border-color: var(--hc-blue-50);
}

/* ---- Summary grid --------------------------------------------------- */

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

.hc-home-stat {
  display: flex;
  align-items: flex-start;
  gap: var(--hc-space-3);
  min-width: 0;
  min-height: var(--hc-touch-target);
  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-home-stat__icon {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  color: var(--hc-color-primary);
  background: var(--hc-color-accent-weak);
  border-radius: var(--hc-radius-md);
}

.hc-home-stat__body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--hc-space-1);
  min-width: 0;
}

.hc-home-stat__label {
  color: var(--hc-text-muted);
  font-size: var(--hc-font-size-xs);
  font-weight: var(--hc-font-weight-semibold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hc-home-stat__value {
  color: var(--hc-text-strong);
  font-size: var(--hc-font-size-lg);
  font-weight: var(--hc-font-weight-bold);
  letter-spacing: var(--hc-letter-tight);
  overflow-wrap: anywhere;
}

.hc-home-stat__caption {
  color: var(--hc-text-faint);
  font-size: var(--hc-font-size-xs);
}

.hc-home-stat__context {
  max-width: 100%;
  overflow-wrap: anywhere;
}

/* ---- Information strip ---------------------------------------------- */

.hc-home-updates {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--hc-space-3);
  margin: 0;
  padding: var(--hc-space-4);
  list-style: none;
  background: var(--hc-bg-surface);
  border: 1px solid var(--hc-border);
  border-radius: var(--hc-radius-lg);
  box-shadow: var(--hc-shadow-sm);
}

.hc-home-update {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: var(--hc-space-1);
  min-height: var(--hc-touch-target);
  text-align: center;
}

.hc-home-update__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  color: var(--hc-color-primary);
  background: var(--hc-color-accent-weak);
  border-radius: var(--hc-radius-md);
}

.hc-home-update__value {
  color: var(--hc-text-strong);
  font-size: var(--hc-font-size-lg);
  font-weight: var(--hc-font-weight-bold);
}

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

/* ---- Quick actions (8 tiles) ---------------------------------------- */

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

.hc-quick-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--hc-space-2);
  min-width: 0;
  min-height: 76px;
  padding: var(--hc-space-2) var(--hc-space-1);
  color: var(--hc-text-base);
  background: var(--hc-bg-surface);
  border: 1px solid var(--hc-border);
  border-radius: var(--hc-radius-lg);
  box-shadow: var(--hc-shadow-sm);
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: border-color var(--hc-duration-fast) var(--hc-ease-standard),
    background var(--hc-duration-fast) var(--hc-ease-standard);
}

.hc-quick-tile:hover {
  background: var(--hc-color-accent-weak);
  border-color: var(--hc-border-strong);
}

.hc-quick-tile:focus-visible {
  outline: none;
  box-shadow: var(--hc-focus-ring);
}

.hc-quick-tile__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  color: var(--hc-color-primary);
  background: var(--hc-color-accent-weak);
  border-radius: var(--hc-radius-md);
}

.hc-quick-tile__label {
  max-width: 100%;
  color: var(--hc-text-muted);
  font-size: var(--hc-font-size-xs);
  font-weight: var(--hc-font-weight-medium);
  line-height: var(--hc-leading-tight);
  overflow-wrap: anywhere;
}

/* Emergency stands out in danger styling and behaves as a button. */
.hc-quick-tile--danger {
  font: inherit;
  border-color: var(--hc-danger-500);
}

.hc-quick-tile--danger .hc-quick-tile__icon {
  color: var(--hc-text-inverse);
  background: var(--hc-danger-500);
}

.hc-quick-tile--danger .hc-quick-tile__label {
  color: var(--hc-danger-600);
  font-weight: var(--hc-font-weight-semibold);
}

.hc-quick-tile--danger:hover {
  background: var(--hc-danger-50);
  border-color: var(--hc-danger-600);
}

/* ---- Emergency demo dialog content ----------------------------------- */

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

.hc-quick-emergency__notice {
  margin: 0;
  padding: var(--hc-space-3);
  color: var(--hc-danger-600);
  background: var(--hc-danger-50);
  border: 1px solid var(--hc-danger-500);
  border-radius: var(--hc-radius-md);
  font-size: var(--hc-font-size-sm);
  font-weight: var(--hc-font-weight-medium);
}

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

.hc-quick-emergency__contact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--hc-space-3);
  min-height: var(--hc-touch-target);
  padding: var(--hc-space-2) var(--hc-space-3);
  border: 1px solid var(--hc-border);
  border-radius: var(--hc-radius-md);
}

.hc-quick-emergency__contact-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.hc-quick-emergency__contact-name {
  font-weight: var(--hc-font-weight-semibold);
  font-size: var(--hc-font-size-sm);
}

.hc-quick-emergency__contact-detail {
  color: var(--hc-text-faint);
  font-size: var(--hc-font-size-xs);
}

.hc-quick-emergency__hint {
  margin: 0;
}

/* ---- Recent activity (PART 04) --------------------------------------- */

.hc-home-activity__item {
  min-height: var(--hc-touch-target);
}

.hc-home-activity__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  color: var(--hc-color-primary);
  background: var(--hc-color-accent-weak);
  border-radius: var(--hc-radius-md);
}

.hc-home-activity__time {
  color: var(--hc-text-faint);
  font-size: var(--hc-font-size-xs);
  white-space: nowrap;
}

.hc-home-activity__empty {
  padding: var(--hc-space-6) var(--hc-space-4);
}

/* ---- Dev placeholder module pages ------------------------------------ */

.hc-dev-module__nav {
  align-self: flex-start;
  margin-bottom: var(--hc-space-4);
}

.hc-dev-module__back {
  display: inline-flex;
  align-items: center;
  gap: var(--hc-space-2);
  min-height: var(--hc-touch-target);
  color: var(--hc-color-primary);
  font-size: var(--hc-font-size-sm);
  font-weight: var(--hc-font-weight-semibold);
  text-decoration: none;
}

.hc-dev-module__back:focus-visible {
  outline: none;
  box-shadow: var(--hc-focus-ring);
  border-radius: var(--hc-radius-sm);
}

.hc-dev-module .hc-badge {
  margin-bottom: var(--hc-space-2);
}

.hc-dev-module .hc-btn {
  margin-top: var(--hc-space-3);
}

/* ---- Loading skeletons ---------------------------------------------- */

.hc-home-skeleton-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--hc-radius-md);
}

.hc-home-skeleton-lines {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: var(--hc-space-2);
  min-width: 0;
}

.hc-home-due__pay-skeleton {
  height: var(--hc-touch-target);
  border-radius: var(--hc-radius-md);
}

/* ---- Small screens --------------------------------------------------- */

@media (max-width: 359px) {
  .hc-home-unit {
    flex-wrap: wrap;
  }

  .hc-home-unit__badges {
    justify-content: flex-start;
    order: 3;
    width: 100%;
  }

  .hc-home-due {
    padding: var(--hc-space-4);
  }

  .hc-home-stat {
    flex-direction: column;
    gap: var(--hc-space-2);
    padding: var(--hc-space-3);
  }

  .hc-home-updates {
    gap: var(--hc-space-2);
    padding: var(--hc-space-3);
  }

  .hc-quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--hc-space-2);
  }

  .hc-quick-tile {
    min-height: 68px;
    padding: var(--hc-space-2) 2px;
  }

  .hc-quick-tile__icon {
    width: 32px;
    height: 32px;
  }

  .hc-home-activity__icon {
    width: 32px;
    height: 32px;
  }

  .hc-home-activity__item {
    gap: var(--hc-space-2);
  }
}

/* ---- Home Health tile link (M04 PART 03) ----------------------------- */

.hc-home-stat__link {
  align-self: flex-start;
  margin-top: var(--hc-space-1);
  color: var(--hc-primary-600, var(--hc-text-strong));
  font-size: var(--hc-font-size-xs);
  font-weight: var(--hc-font-weight-semibold);
  text-decoration: underline;
  min-height: var(--hc-touch-target, 44px);
  display: inline-flex;
  align-items: center;
}

.hc-home-stat__link:focus-visible {
  outline: 2px solid var(--hc-border-focus);
  outline-offset: 2px;
  border-radius: var(--hc-radius-sm);
}

/* ---- BM Monitoring link (PART 05) ----------------------------------- */

.hc-home-bm-link {
  margin-top: var(--hc-space-2);
}

.hc-home-bm-link .hc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--hc-space-2);
  min-height: var(--hc-touch-target, 44px);
}
