.actions-anim-enter .tile-btn{
  opacity: 0;
  animation: fadeInUpSoft .35s ease forwards;
}
.actions-anim-enter .col-12:nth-child(1) .tile-btn{ animation-delay: .02s; }
.actions-anim-enter .col-12:nth-child(2) .tile-btn{ animation-delay: .06s; }
.actions-anim-enter .col-12:nth-child(3) .tile-btn{ animation-delay: .10s; }
/* Pastel app theme inspired UI */
:root{
  --bt-bg:#ffe7bf; /* used for safe-area top fill */
  --bt-surface:#fff9ef;
  --bt-primary:#7a4b2e; /* cocoa brown */
  --bt-primary-soft:#f4e8df;
  --bt-accent:#7b61ff; /* soft purple */
  --bt-accent-soft:#eee9ff;
  --bt-violet:#452473; /* titolo header */
  --bt-tab-active:#bf916a; /* colore richiesto per tab attivi */
  --bt-blue:#0d6efd;
  --bt-blue-soft:#e6f0ff;
  --bt-text:#1f2330;
  --bt-muted:#6b7280;
  --bt-shadow: 0 10px 25px rgba(31,35,48,0.08), 0 4px 12px rgba(31,35,48,0.06);
  --bt-radius-lg: 20px;
  --bt-radius-xl: 28px;
}

html,body{ height:100%; overflow-x: hidden; }
/* App-wide background: single continuous gradient (lighter top -> darker bottom) */
html{
  background: linear-gradient(180deg, #fff2dc 0%, #ffe7bf 100%);
  background-attachment: fixed;
  background-repeat: no-repeat;
}
body{ min-height:100vh; background: transparent; color:var(--bt-text); }

.card{ border:0; border-radius:var(--bt-radius-lg); background:var(--bt-surface); box-shadow: var(--bt-shadow); }
.auth-card{ backdrop-filter: blur(2px); }

/* Hero header */
.hero{
  /* Integrate with page background: remove card look */
  background: transparent;
  border-radius: 0;
  padding: 20px 16px;
  box-shadow: none;
  gap: 6px;
  flex-wrap: wrap;
}
.hero > div{ min-width: 0; }
.hero .hero-title{ word-break: break-word; }
.hero-title{ font-weight:700; letter-spacing:.2px; font-size: clamp(20px, 4.6vw, 28px); line-height: 1.15; }
.hero-monitor{ color:#452473; font-weight:800; }
#hero-child-name{ color:#452473; }
.hero-badge{ background:#fff; color:#452473; border-radius:999px; padding:.15rem .5rem; font-size:.8rem; margin-left:.35rem; box-shadow: var(--bt-shadow); vertical-align: middle; }
.hero-badge.owner{ background:#e6ffe6; color:#167b16; }
.hero-sub{ color:var(--bt-muted); max-width: 60ch; }

/* Auth chip email ellipsis */
.auth-chip .user-email{ max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; }

/* Mobile refinements */
@media (max-width: 360px){
  .hero-title{ font-size: 1.1rem; }
}
@media (max-width: 420px){
  .hero{ padding-top: 10px; padding-bottom: 6px; }
  .auth-chip{ width: 100%; justify-content: flex-start; }
  .auth-chip .user-email{ max-width: 60vw; }
  /* Compact stats cards on very small screens */
  .stat-card{ padding: 12px !important; }
}

/* Mobile hero spacing (no divider) */
@media (max-width: 576px){
  .hero{ padding-bottom: 10px; border-bottom: 0; }
  .hero::after{ content: none; }
}

/* Emphasize title on desktop */
@media (min-width: 992px){
  .hero-title{ font-size: 1.5rem; }
}

/* Fade-in animation for stats */
@keyframes fadeInUpSoft {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.stats-anim-enter .stat-card{
  opacity: 0;
  animation: fadeInUpSoft .35s ease forwards;
}
.stats-anim-enter .stat-card:nth-child(1){ animation-delay: .02s; }
.stats-anim-enter .stat-card:nth-child(2){ animation-delay: .06s; }
.stats-anim-enter .stat-card:nth-child(3){ animation-delay: .10s; }
.stats-anim-enter .stat-card:nth-child(4){ animation-delay: .14s; }

/* Tabs -> pill style */
.nav-tabs .nav-link{ border:0; border-radius:999px; padding:.5rem 1rem; color:var(--bt-muted); }
.nav-tabs{ border:0; gap:.5rem; }
.nav-tabs .nav-link.active{
  color: var(--bt-tab-active) !important;
  border-color: var(--bt-tab-active) var(--bt-tab-active) #fff !important;
}

/* Auth tabs (Accedi/Registrati): forza colore specifico */
#authTabs.nav-tabs .nav-link{
  color: #bf916a;
}
#authTabs.nav-tabs .nav-link:hover,
#authTabs.nav-tabs .nav-link:focus{
  color: #bf916a;
}
#authTabs.nav-tabs .nav-link.active{
  color: #bf916a !important;
  border-color: #bf916a #bf916a #fff !important;
}

/* Ring di focus coerente */
#authTabs .nav-link:focus,
#authTabs .nav-link:focus-visible{
  outline: none;
  box-shadow: 0 0 0 .15rem rgba(191,145,106, .35);
}

/* Action tiles */
.tile-btn{ display:flex; align-items:center; justify-content:center; gap:.6rem; border:0; border-radius:24px; padding:20px; font-weight:600; box-shadow: var(--bt-shadow); transition: transform .05s ease, filter .2s ease; }
.tile-btn:active{ transform: translateY(1px); }
.tile-poo{ background:var(--bt-primary-soft); color:var(--bt-primary); }
.tile-pee{ background:var(--bt-blue-soft); color:var(--bt-blue); }
.tile-both{ background:var(--bt-accent-soft); color:var(--bt-accent); }

/* Small badges/pills */
.pill{ background:#fff; color:var(--bt-muted); border-radius:999px; padding:.25rem .6rem; box-shadow: var(--bt-shadow); }

/* Skeleton shimmer */
.skeleton{ position: relative; overflow: hidden; background: #eee; border-radius: 8px; min-height: 16px; }
.skeleton::after{
  content: "";
  position: absolute; inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.5), transparent);
  animation: shimmer 1.1s infinite;
}
@keyframes shimmer{
  100% { transform: translateX(100%); }
}
.skeleton-line{ height: 14px; margin: 6px 0; }
.skeleton-avatar{ width:40px; height:40px; border-radius: 8px; }

/* History list tweaks */
#history-list .list-group-item{ border:0; border-radius:14px; margin-bottom:10px; box-shadow: var(--bt-shadow); }
#history-list .event-item{ cursor: pointer; transition: transform .05s ease, box-shadow .15s ease, background-color .2s ease; }
#history-list .event-item:hover{ transform: translateY(-1px); box-shadow: 0 12px 26px rgba(0,0,0,0.08), 0 4px 10px rgba(0,0,0,0.06); background-color: #fff; }
#history-list .event-item:active{ transform: translateY(0); }

/* Thumbnails inside events */
#history-list .event-item img{ width:40px; height:40px; object-fit:cover; border-radius:8px; box-shadow: var(--bt-shadow); }

/* Lightbox */
.lightbox{ position: fixed; inset:0; display:flex; align-items:center; justify-content:center; z-index: 1080; }
.lightbox .lightbox-backdrop{ position:absolute; inset:0; background: rgba(0,0,0,0.65); backdrop-filter: blur(2px); }
.lightbox .lightbox-img{ position:relative; max-width: 92vw; max-height: 90vh; border-radius: 10px; box-shadow: 0 20px 40px rgba(0,0,0,0.35); }
#detail-photo{ cursor: zoom-in; }

/* Stat cards */
.stat-card{ border-radius:26px; box-shadow: var(--bt-shadow); transition: transform .08s ease; }
.stat-card:hover{ transform: translateY(-1px); }
.stat-icon{ font-size:1.1rem; }
.stat-total{ background: var(--bt-accent-soft); color: var(--bt-accent); }
.stat-poo{ background: var(--bt-primary-soft); color: var(--bt-primary); }
.stat-pee{ background: var(--bt-blue-soft); color: var(--bt-blue); }
.stats-bg{ border-radius: 28px; background: linear-gradient(180deg, #ffe7bf 0%, #fff2dc 100%); box-shadow: var(--bt-shadow); }
.stat-transparent{ background: transparent !important; box-shadow: none !important; }

/* Accordion as rounded card */
.accordion-card .accordion-item{ border:0; border-radius: var(--bt-radius-lg); overflow:hidden; box-shadow: var(--bt-shadow); background: var(--bt-surface); }
.accordion-card .accordion-button{ background: var(--bt-surface); box-shadow:none; }
.accordion-card .accordion-button:not(.collapsed){ background: var(--bt-surface); box-shadow:none; }
.accordion-card .accordion-collapse{ background: var(--bt-surface); }
.accordion-card .accordion-body{ background: var(--bt-surface); }

/* Buttons fallback */
.btn-brown { background:var(--bt-primary); color:#fff; }
.btn-brown:hover { filter: brightness(1.05); }
.btn-primary-subtle { background:var(--bt-blue-soft); color:var(--bt-blue); }
.btn-primary-subtle:hover { filter: brightness(0.98); }

/* Brand buttons: override Bootstrap v5 CSS variables */
.btn-primary{
  --bs-btn-bg: var(--bt-violet);
  --bs-btn-border-color: var(--bt-violet);
  --bs-btn-hover-bg: var(--bt-violet);
  --bs-btn-hover-border-color: var(--bt-violet);
  --bs-btn-active-bg: var(--bt-violet);
  --bs-btn-active-border-color: var(--bt-violet);
  --bs-btn-disabled-bg: var(--bt-violet);
  --bs-btn-disabled-border-color: var(--bt-violet);
}
.btn-outline-primary{
  --bs-btn-color: var(--bt-violet);
  --bs-btn-border-color: var(--bt-violet);
  --bs-btn-hover-bg: var(--bt-violet);
  --bs-btn-hover-border-color: var(--bt-violet);
  --bs-btn-active-bg: var(--bt-violet);
  --bs-btn-active-border-color: var(--bt-violet);
}

/* Splash overlay */
.splash-overlay{ position:fixed; inset:0; background: linear-gradient(180deg, #fff2dc 0%, #ffe7bf 100%); z-index: 2000; transition: opacity .25s ease; }
.splash-overlay.hidden{ opacity: 0; pointer-events: none; }

/* Safe area (iOS notch) */
.safe-area-top{ height: env(safe-area-inset-top); height: constant(safe-area-inset-top); background: var(--bt-bg); }

/* Brand logo sizes */
.brand-logo{ width: 48px; height: 48px; }
.brand-logo-sm{ width: 24px; height: 24px; }
.brand-logo-lg{ width: 48px; height: 48px; }
.brand-logo-xl{ width: 72px; height: 72px; opacity: 0.95; }
@media (min-width: 992px){
  .brand-logo{ width: 56px; height: 56px; }
  .brand-logo-lg{ width: 56px; height: 56px; }
}

/* Members list: prevenire overflow su mobile */
#members-list .list-group-item{
  display:flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
}
#members-list .list-group-item > span{
  flex: 1 1 auto;
  min-width: 200px;
}
#members-list select.form-select{ max-width: 180px; }
#members-list .btn{ white-space: nowrap; }
@media (max-width: 420px){
  #members-list select.form-select{ max-width: 140px; }
}

/* Header mobile layout: badge a sinistra del titolo, sottotitolo a tutta larghezza su una riga */
@media (max-width: 576px){
  /* forza le due colonne (blocco titolo e chip utente) ad andare a capo a larghezza piena */
  .hero{ align-items: flex-start; padding: 12px 12px; }
  .hero > .d-flex.align-items-center.gap-2{ flex: 0 0 100%; }
  #auth-user{ flex: 0 0 100%; }

  /* titolo in riga con badge a sinistra senza comprimere troppo il testo */
  .hero .hero-title{ display:flex; align-items:center; column-gap:.35rem; flex-wrap: wrap; white-space: normal; word-break: normal; flex: 1 1 auto; width: 100%; }
  /* badge a destra del titolo */
  .hero .hero-title > .hero-badge{ order:2; margin-left:.35rem; }
  .hero .hero-title > :not(.hero-badge){ order:1; }
  .hero .hero-sub{ flex:0 0 100%; width:100%; white-space: nowrap; overflow:hidden; text-overflow: ellipsis; margin-top: 4px; }
  /* badge più compatto su mobile per restare su una riga */
  .hero-badge{ font-size: .72rem; padding: .12rem .45rem; }
}
