/* Match the dark Home cards to the black tablet and phone card surface. */
html[data-theme="dark"] body.is-logged-in .home-view :is(
  .home-assistant-card,
  .home-ff-browser,
  .map-person,
  .home-bg-card
) {
  border-top-color: #4a4a4a;
  border-right-color: #292929;
  border-bottom-color: #181818;
  border-left-color: #292929;
  background: #000;
}

/* Use the original pale-blue reference for light card surfaces. */
html:not([data-theme="dark"]) body.is-logged-in {
  --home-card-surface: linear-gradient(145deg, #f7faff 0%, #edf4ff 42%, #e3eeff 100%);
  --home-card-shadow: 0 16px 30px rgba(40,60,100,.12);
  --home-icon-surface: linear-gradient(150deg, #ffffff 0%, #eef3fa 58%, #dce6f3 100%);
  --home-icon-shadow: 0 2px 4px rgba(16,35,62,.14), inset 0 1px 0 #ffffff;
}

/* Keep the menu panel shape consistent across themes. */
body.is-logged-in .app-sidebar {
  border-radius: 0 32px 32px 0;
}

/* Carry the same finish through the existing sidebar panel. */
html:not([data-theme="dark"]) body.is-logged-in .app-sidebar {
  background: var(--home-card-surface);
  border-right: 2px solid #ffffff;
  box-shadow: 6px 0 24px rgba(40,60,100,.1) !important;
}

html:not([data-theme="dark"]) body.is-logged-in .app-sidebar .app-nav-button {
  position: relative;
  color: #52698f;
}
html:not([data-theme="dark"]) body.is-logged-in .app-sidebar .app-nav-button.active {
  color: #174ab5;
  background: linear-gradient(90deg, rgba(33,103,245,.085), rgba(33,103,245,0));
}
html:not([data-theme="dark"]) body.is-logged-in .app-sidebar .app-nav-button.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 18px;
  bottom: 18px;
  width: 3px;
  border-radius: 3px;
  background: #2167f5;
}
html:not([data-theme="dark"]) body.is-logged-in .app-sidebar :is(.app-nav-button, .app-sidebar-notifications) svg {
  box-sizing: content-box;
  padding: 5px;
  margin: -5px;
  border: 1px solid #c5cedd;
  border-radius: 10px;
  background: var(--home-icon-surface);
  box-shadow: var(--home-icon-shadow) !important;
}
html:not([data-theme="dark"]) body.is-logged-in .app-sidebar :is(.app-nav-button, .app-sidebar-notifications):focus-visible {
  outline: 2px solid #2167f5;
  outline-offset: 2px;
}

/* Keep the original card intact beneath a mint haze. */
html:not([data-theme="dark"]) body.is-logged-in .home-view :is(.home-assistant-card, .home-ff-browser, [data-home-family-card], .home-bg-card) {
  isolation: isolate;
  border: 2px solid #ffffff;
  background: var(--home-card-surface);
  box-shadow: var(--home-card-shadow) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
html:not([data-theme="dark"]) body.is-logged-in .home-view :is(.home-assistant-card, .home-ff-browser, [data-home-family-card], .home-bg-card)::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(ellipse at 32% 22%, rgba(137,221,194,.24), rgba(169,231,212,.16) 62%, rgba(229,249,242,.12));
  box-shadow: inset 0 1px 1px rgba(255,255,255,.55), inset 0 -1px 1px rgba(255,255,255,.35) !important;
}
html:not([data-theme="dark"]) body.is-logged-in .home-view .home-assistant-card {
  position: relative;
}
html:not([data-theme="dark"]) body.is-logged-in .home-view [data-home-family-card] {
  border-radius: 30px;
}
html:not([data-theme="dark"]) body.is-logged-in .home-view :is(.home-assistant-card, .home-bg-card) {
  border-radius: 22px;
}
html:not([data-theme="dark"]) body.is-logged-in .home-view :is([data-home-family-card] .round-action i, .home-bg-icon) {
  position: relative; overflow: hidden;
  border: 1px solid #9caec7; color: #2167f5;
  background: var(--home-icon-surface);
  box-shadow: var(--home-icon-shadow) !important;
}
html:not([data-theme="dark"]) body.is-logged-in .home-view :is([data-home-family-card] .round-action i, .home-bg-icon) svg {
  position: relative; z-index: 1; color: #2167f5;
}

/* A single edge treatment for interaction, without additional containers. */
html:not([data-theme="dark"]) body.is-logged-in .home-view :is(.round-action, .home-bg-card, .home-ff-arrow, .home-ff-open):focus-visible {
  outline: 2px solid #2167f5;
  outline-offset: 4px;
}
html:not([data-theme="dark"]) body.is-logged-in .home-view .round-action:hover i,
html:not([data-theme="dark"]) body.is-logged-in .home-view .home-bg-card:hover .home-bg-icon {
  border-color: #2167f5;
  box-shadow: 0 3px 6px rgba(23,58,115,.17), inset 0 1px 0 #ffffff !important;
}
html:not([data-theme="dark"]) body.is-logged-in .home-view .round-action:active i,
html:not([data-theme="dark"]) body.is-logged-in .home-view .home-bg-card:active .home-bg-icon {
  box-shadow: inset 0 1px 3px rgba(23,58,115,.16) !important;
}
