/* Web Home reference finish. Geometry, photo framing and navigation are unchanged. */
body.is-logged-in .home-view {
  --home-reference-glass: rgba(249, 247, 255, .72);
  --home-reference-edge: rgba(255, 255, 255, .72);
  --home-reference-ink: #102451;
  --home-reference-accent: #7836ef;
  --home-reference-shadow: 0 2px 4px rgba(29, 25, 62, .08), 0 8px 18px rgba(29, 25, 62, .12), inset 0 1px 0 rgba(255,255,255,.7);
}
html[data-theme="dark"] body.is-logged-in .home-view {
  --home-reference-glass: rgba(28, 27, 48, .72);
  --home-reference-edge: rgba(220, 208, 255, .32);
  --home-reference-ink: #f4f0ff;
  --home-reference-accent: #b17aff;
  --home-reference-shadow: 0 2px 4px rgba(0,0,0,.18), 0 8px 18px rgba(0,0,0,.22), inset 0 1px 0 rgba(235,225,255,.18);
}
html:root body.is-logged-in .home-view :is([data-home-family-card], .home-assistant-card, .home-ff-browser, .home-bg-card) {
  background: var(--home-reference-glass) !important;
  border-color: var(--home-reference-edge) !important;
  color: var(--home-reference-ink) !important;
  box-shadow: var(--home-reference-shadow) !important;
  backdrop-filter: blur(18px) saturate(115%) !important;
  -webkit-backdrop-filter: blur(18px) saturate(115%) !important;
}
html:root body.is-logged-in .home-view :is([data-home-family-card], .home-assistant-card, .home-ff-browser, .home-bg-card)::before {
  background: none !important;
  box-shadow: none !important;
}
html:root body.is-logged-in .home-view [data-home-family-card] .round-action i {
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
}
html:root body.is-logged-in .home-view [data-home-family-card] .round-action :is(i, svg) {
  color: var(--home-reference-accent) !important;
}
html:root body.is-logged-in .home-view [data-home-family-card] .round-action {
  color: var(--home-reference-ink) !important;
  transform: none !important;
}
html:root body.is-logged-in .home-view [data-home-family-card] .person-actions {
  /* An inset rule leaves the existing spacing and measured height intact. */
  box-shadow: 0 -1px 0 rgba(122,106,157,.18);
}
html:root body.is-logged-in .home-view [data-home-family-card] .relationship-pill {
  color: var(--home-reference-accent) !important;
  background: transparent !important;
}
html:root body.is-logged-in .home-view .home-ff-switch {
  background: rgba(130,112,170,.07) !important;
  border-color: rgba(146,126,179,.12) !important;
  box-shadow: inset 0 1px 2px rgba(41,30,76,.06) !important;
}
html:root body.is-logged-in .home-view :is(.home-ff-open, .home-ff-arrow) {
  background: transparent !important;
  border-color: transparent !important;
  color: var(--home-reference-ink) !important;
  box-shadow: none !important;
  transform: none !important;
}
html:root body.is-logged-in .home-view .home-ff-arrow { color: var(--home-reference-accent) !important; }
html:root body.is-logged-in .home-view .home-ff-open.active {
  color: #fff !important;
  background: #7836ef !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 2px 5px rgba(93,35,191,.2) !important;
}
html:root body.is-logged-in .home-view :is(.home-ff-open, .home-ff-arrow, [data-home-family-card] .round-action):hover {
  background-color: rgba(136,73,239,.09) !important;
}
html:root body.is-logged-in .home-view .home-ff-open.active:hover { background: #6928dc !important; }
html:root body.is-logged-in .home-view :is(.home-ff-open, .home-ff-arrow, [data-home-family-card] .round-action):focus-visible {
  outline: 2px solid var(--home-reference-accent) !important;
  outline-offset: 3px;
}
html:root body.is-logged-in .home-view :is(.home-ff-open, .home-ff-arrow, [data-home-family-card] .round-action):active {
  filter: brightness(.94);
}
@media (prefers-reduced-transparency: reduce) {
  body.is-logged-in .home-view { --home-reference-glass: #f7f5fc; }
  html[data-theme="dark"] body.is-logged-in .home-view { --home-reference-glass: #242236; }
}

/* Scan joins the same finish without changing its size, position or camera action. */
html:root body.is-logged-in .home-view .home-bg-card .home-bg-icon {
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
}
html:root body.is-logged-in .home-view .home-bg-card :is(.home-bg-icon, .home-bg-icon svg, span:last-child) {
  color: var(--home-reference-accent) !important;
}
html:root body.is-logged-in .home-view .home-bg-card {
  transform: none !important;
}
html:root body.is-logged-in .home-view .home-bg-card:hover {
  border-color: var(--home-reference-accent) !important;
}
html:root body.is-logged-in .home-view .home-bg-card:focus-visible {
  outline: 2px solid var(--home-reference-accent) !important;
  outline-offset: 3px;
}

html:root body.is-logged-in .home-view .home-relationship-mark {
  color: var(--home-reference-accent);
  width: 1em;
  height: 1em;
  vertical-align: -0.12em;
}

/* Reference hierarchy inside the existing card bounds. */
html:root body.is-logged-in .home-view [data-home-family-card] .person-line { align-items: flex-start; }
html:root body.is-logged-in .home-view [data-home-family-card] .person-line > div:last-child { min-width: 0; }
html:root body.is-logged-in .home-view [data-home-family-card] .relationship-pill {
  display: block;
  min-height: 0;
  padding: 2px 0 0;
  color: var(--home-reference-ink) !important;
  font-weight: 500;
}
html:root body.is-logged-in .home-view [data-home-family-card] .home-relationship-mark {
  /* Same as native (shared/family-relationships.js markStyle): 23px, 8px after the name. */
  width: 23px;
  height: 23px;
  margin-left: 1px; /* the name row already has a 7px gap */
  flex: 0 0 auto;
}
html:root body.is-logged-in .home-view [data-home-family-card] .person-actions {
  box-shadow: 0 -1px 0 rgba(122,106,157,.22) !important;
}
html:root body.is-logged-in .home-view [data-home-family-card] .round-action + .round-action {
  box-shadow: -1px 0 0 rgba(122,106,157,.18) !important;
}
html:root body.is-logged-in .home-view .home-bg-card > span:last-child { margin-left: auto; }
html:root body.is-logged-in .home-view .home-bg-card .home-bg-icon::before,
html:root body.is-logged-in .home-view .home-bg-card .home-bg-icon::after { box-shadow: none !important; background: none !important; }

html:root body.is-logged-in .home-view .home-location-row {
  display: grid; grid-template-columns: 18px minmax(0, 1fr) auto 8px;
  align-items: baseline; gap: 4px;
}
html:root body.is-logged-in .home-view .home-location-pin { color: var(--home-reference-accent); }
html:root body.is-logged-in .home-view .home-location-pin :is(svg, img) { display: block; width: 20px; height: 25px; margin: 0; }
html:root body.is-logged-in .home-view .home-location-place { display: block; margin-top: 2px; overflow-wrap: anywhere; }

/* The voice assistant uses the reference's single, right-aligned card. */
html:root body.is-logged-in .home-view .home-assistant-card {
  display: flex;
  align-items: center;
  gap: 10px;
  width: auto;
  min-width: 0;
}
@media (max-width: 1100px) {
  html:root body.is-logged-in .home-view .home-assistant-card { gap: 5px; }
}

/* Final material hierarchy: quiet navigation, information, primary action.
   Transparent outer borders preserve each card's measured layout bounds. */
html:root body.is-logged-in .home-view {
  --home-reference-low: 0 1px 2px rgba(29,25,62,.06), 0 4px 10px rgba(29,25,62,.07);
  --home-reference-info: 0 2px 3px rgba(29,25,62,.07), 0 6px 14px rgba(29,25,62,.10);
  --home-reference-primary: 0 2px 4px rgba(29,25,62,.09), 0 8px 16px rgba(29,25,62,.13);
}
html:root body.is-logged-in .home-view :is([data-home-family-card], .home-assistant-card, .home-ff-browser, .home-bg-card) {
  border-color: transparent !important;
  background-clip: padding-box !important;
  box-shadow: var(--home-reference-info), inset 0 0 0 1px var(--home-reference-edge), inset 0 1px 0 rgba(255,255,255,.28) !important;
}
html:root body.is-logged-in .home-view :is(.home-assistant-card, .home-ff-browser) {
  box-shadow: var(--home-reference-low), inset 0 0 0 1px var(--home-reference-edge) !important;
}
html:root body.is-logged-in .home-view .home-ff-switch {
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
}
html:root body.is-logged-in .home-view .home-ff-open.active {
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 1px 3px rgba(93,35,191,.16) !important;
}
html:root body.is-logged-in .home-view .home-bg-card {
  width: 210px;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 18px;
  box-shadow: var(--home-reference-primary), inset 0 0 0 1px var(--home-reference-edge) !important;
}
html:root body.is-logged-in .home-view .home-bg-card .home-bg-icon,
html:root body.is-logged-in .home-view .home-bg-card:hover .home-bg-icon,
html:root body.is-logged-in .home-view .home-bg-card:active .home-bg-icon {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-color: transparent !important;
  border-radius: 0;
  background: none !important;
  box-shadow: none !important;
}
html:root body.is-logged-in .home-view [data-home-family-card] .home-location-row {
  grid-template-columns: 18px minmax(0, 1fr) auto 8px;
}
html:root body.is-logged-in .home-view [data-home-family-card] .home-location-place {
  /* Let city/country use the row's full text width, below the time. */
  grid-column: 2 / -1;
  margin-top: 1px;
}
@media (max-width: 1100px) {
  html:root body.is-logged-in .home-view .home-bg-card { width: 155px; padding: 10px; gap: 6px; }
  html:root body.is-logged-in .home-view .home-bg-card .home-bg-icon { width: 24px; height: 24px; flex-basis: 24px; }
}

/* The location pin stays next to the location, not the sharing action. */
html:root body.is-logged-in .home-view [data-home-family-card] .shared-location-trigger { grid-column: 1 / 3; grid-row: 1; justify-self: start; text-align: left; padding: 0; margin: 0; min-width: 0; width: auto; }
html:root body.is-logged-in .home-view [data-home-family-card] .home-location-pin { display: inline-flex; flex: 0 0 20px; align-self: baseline; margin: 0; }
html:root body.is-logged-in .home-view [data-home-family-card] .home-location-place { grid-column: 1 / -1; grid-row: 2; display: flex; align-items: baseline; gap: 4px; text-align: left; }

/* Keep the full city, state and country beside the pin on one line. */
html:root body.is-logged-in .home-view [data-home-family-card] { width: 320px; max-width: calc(100% - 20px); }
html:root body.is-logged-in .home-view [data-home-family-card] .home-location-place > span:last-child { white-space: nowrap; min-width: 0; }

/* Weather: location first, then conditions / local date and time. */
html:root body.is-logged-in .home-view .home-assistant-card {
  display: grid;
  grid-template-columns: auto auto auto auto;
  flex-shrink: 0;
  min-width: max-content;
  column-gap: 7px;
  row-gap: 3px;
  align-items: center;
  padding: 10px 14px;
}
html:root body.is-logged-in .home-view .home-assistant-card-location {
  grid-column: 1 / -1;
  justify-self: stretch;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}
html:root body.is-logged-in .home-view .home-assistant-card .home-assistant-card-divider {
  width: 1px;
  height: 28px;
  background: var(--home-reference-accent);
  opacity: .65;
}
@media (max-width: 1100px) {
  html:root body.is-logged-in .home-view .home-assistant-card { padding: 7px 9px; column-gap: 4px; row-gap: 2px; }
  html:root body.is-logged-in .home-view .home-assistant-card .home-assistant-card-divider { height: 23px; }
}

/* Compact Home companion, retaining the approved glass material. */
html:root body.is-logged-in .home-view .home-assistant-card{display:flex;flex-direction:column;width:174px;min-width:0;min-height:76px;box-sizing:border-box;padding:6px 8px;gap:0;flex-shrink:0}
html:root body.is-logged-in .home-view .home-assistant-card[hidden]{display:none}
html:root body.is-logged-in .home-view .home-assistant-card>small{font-size:12px;line-height:18px}

/* Dark mode: the icon gloss belongs to filled round icons; Home's action icons are transparent, so no gloss bar. */
html:root body.is-logged-in .home-view [data-home-family-card] .round-action i::after { display: none !important; }

/* Nobody in Family / Friends yet: the same card, its message, Invite family / Find friends, and SOS. */
body.is-logged-in .home-view [data-home-family-card].is-empty :is(.person-line, .person-actions) { display: none !important; }
body.is-logged-in .home-view .home-person-empty { display: grid; gap: 6px; padding-right: 64px; }
body.is-logged-in .home-view .home-person-empty[hidden] { display: none; }
body.is-logged-in .home-view .home-person-empty strong { color: var(--home-reference-ink); font-size: 17px; font-weight: 800; }
body.is-logged-in .home-view .home-person-empty p { margin: 0; color: #52698f; font-size: 13px; line-height: 1.45; }
html[data-theme="dark"] body.is-logged-in .home-view .home-person-empty p { color: #9fb4d2; }
body.is-logged-in .home-view .home-person-empty-action {
  justify-self: start; min-height: 44px; margin-top: 6px; padding: 0 18px; border: 0; border-radius: 999px;
  color: #fff; background: var(--home-reference-accent); font: inherit; font-weight: 800; cursor: pointer;
  transition: transform .18s var(--sp-ease-snappy);
}
body.is-logged-in .home-view .home-person-empty-action:active { transform: scale(.97); }
body.is-logged-in .home-view .home-person-empty-action:focus-visible { outline: 3px solid #397cff; outline-offset: 2px; }

/* No 3D avatar yet: their photo, or initials, in the avatar's place on the card. */
body.is-logged-in .home-view [data-home-family-photo] { cursor: pointer; }
body.is-logged-in .home-view [data-home-family-photo]:focus-visible { outline: 3px solid #397cff; outline-offset: 2px; border-radius: 14px; }
.home-card-picture { position: absolute; inset: 0; display: grid; place-items: center; }
.home-card-picture .sp-profile-shell { width: 86%; aspect-ratio: 4 / 5; height: auto; }
/* Picture first (web/live-avatar.js): their avatar's picture while the 3D avatar loads, faded out once it is ready. */
.avatar-picture-first { pointer-events: none; transition: opacity .42s ease-out; }
.avatar-picture-first > .sp-avatar-only { width: 72%; aspect-ratio: 4 / 5; height: auto; }
@media (prefers-reduced-motion: reduce) { .avatar-picture-first { transition: none; } }

/* Tap a person's avatar on Home: a bigger view you turn by dragging sideways. */
dialog.home-avatar-preview {
  width: min(420px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 14px 16px 12px; border: 1px solid rgba(155, 108, 255, .28);
  border-radius: 28px; color: #0b285b; background: rgba(255, 255, 255, .92); backdrop-filter: blur(22px) saturate(1.3);
  box-shadow: 0 30px 80px rgba(11, 40, 91, .28);
}
dialog.home-avatar-preview::backdrop { background: rgba(11, 40, 91, .34); }
html[data-theme="dark"] dialog.home-avatar-preview { color: #f5f8ff; background: rgba(8, 23, 43, .9); }
html[data-theme="dark"] dialog.home-avatar-preview::backdrop { background: rgba(8, 23, 43, .74); }
dialog.home-avatar-preview header { display: flex; align-items: center; gap: 8px; }
dialog.home-avatar-preview header > div { flex: 1; min-width: 0; }
dialog.home-avatar-preview h4 { margin: 0; font-size: 19px; font-weight: 800; }
dialog.home-avatar-preview small { color: #52698f; font-size: 13px; }
html[data-theme="dark"] dialog.home-avatar-preview small, html[data-theme="dark"] dialog.home-avatar-preview p { color: #9fb4d2; }
dialog.home-avatar-preview header button { width: 44px; height: 44px; border: 0; border-radius: 999px; color: inherit; background: transparent; font-size: 28px; line-height: 1; cursor: pointer; }
dialog.home-avatar-preview header button:focus-visible { outline: 3px solid #397cff; }
.home-avatar-preview-stage { position: relative; width: 100%; height: min(60vh, 560px); }
.home-avatar-preview-stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: transparent; opacity: 0; transition: opacity .42s ease-out; color-scheme: light; }
.home-avatar-preview-stage .home-card-picture .sp-profile-shell { width: 52%; }
dialog.home-avatar-preview p { margin: 4px 0 0; text-align: center; color: #52698f; font-size: 13px; }
/* Swipe beside the avatar for the next person; the middle of the stage still turns the avatar. */
.home-avatar-preview-frame { position: relative; }
.home-avatar-preview-swipe { position: absolute; top: 0; bottom: 0; width: 22%; z-index: 1; touch-action: pan-y; cursor: grab; }
.home-avatar-preview-swipe[data-side="left"] { left: 0; }
.home-avatar-preview-swipe[data-side="right"] { right: 0; }
dialog.home-avatar-preview header, dialog.home-avatar-preview footer { touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.home-avatar-preview-dots { display: flex; justify-content: center; gap: 6px; padding: 8px 0 2px; }
.home-avatar-preview-dots i { width: 6px; height: 6px; border-radius: 3px; background: rgba(11, 40, 91, .22); transition: width .2s ease, background-color .2s ease; }
.home-avatar-preview-dots i.is-current { width: 16px; background: #8b55ff; }
.home-avatar-preview-dots:focus-visible { outline: 3px solid #397cff; outline-offset: 2px; border-radius: 8px; }
html[data-theme="dark"] .home-avatar-preview-dots i:not(.is-current) { background: rgba(245, 248, 255, .35); }
@media (prefers-reduced-motion: reduce) { body.is-logged-in .home-view .home-person-empty-action, .home-avatar-preview-stage iframe { transition: none; } }
