/* ============================================================
   Birthday Notify — Web
   Design system (mirrors the Android "Fresh Green" theme)
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  /* Brand accents (shared) */
  --green:          #52B788;
  --green-bright:   #63BE92;
  --green-deep:     #2D6A4F;
  --coral:          #FF6E86;
  --peach:          #FFB27A;
  --amber:          #FFC978;
  --mint:           #57D9BE;
  --green-info:     #2F8C5B;

  /* Light scheme ("Fresh Green") */
  --bg-top:         #73B98B;
  --bg-bottom:      #D6EFD7;
  --surface:        #FFFFFF;
  --surface-elev:   #F1F7F4;
  --surface-variant:#EAF7EF;
  --on-surface:     #4A4A4A;
  --on-surface-var: #2F8C5B;
  --on-background:  #FFFFFF;   /* text drawn over the gradient */
  --primary:        #52B788;
  --on-primary:     #FFFFFF;
  --primary-container: #EAF7EF;
  --on-primary-container: #2D6A4F;
  --secondary:      #2D6A4F;
  --outline:        #DCE8E1;
  --error:          #B3261E;

  /* Bottom nav */
  --nav-active:     #2D8A57;
  --nav-inactive:   #7A8A82;
  --nav-indicator:  #EAF7EF;

  /* Gradients */
  --grad-ground:    linear-gradient(155deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
  --grad-brand:     linear-gradient(135deg, #40916C 0%, #2D6A4F 100%);
  --grad-badge:     linear-gradient(135deg, #63BE92 0%, #52B788 45%, #FF6E86 100%);

  /* Shape */
  --r-card:   20px;
  --r-btn:    18px;
  --r-field:  16px;
  --r-pill:   999px;
  --shadow-card: 0 4px 16px rgba(45,106,79,.10), 0 1px 3px rgba(45,106,79,.08);
  --shadow-soft: 0 2px 10px rgba(45,106,79,.08);

  /* Layout */
  --maxw: 560px;               /* mobile-first, capped on desktop */
  --pad:  16px;
  --nav-h: 64px;

  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg-top:         #13322A;
  --bg-bottom:      #0A1712;
  --surface:        #1B2A24;
  --surface-elev:   #243530;
  --surface-variant:#27382F;
  --on-surface:     #E4EBE7;
  --on-surface-var: #8FC9AC;
  --on-background:  #E4EBE7;
  --primary:        #63C892;
  --on-primary:     #07130D;
  --primary-container: #27382F;
  --on-primary-container: #AEE5C7;
  --secondary:      #57D9BE;
  --outline:        #35473F;
  --error:          #F2B8B5;

  --nav-active:     #63C892;
  --nav-inactive:   #7A8A82;
  --nav-indicator:  #27382F;

  --shadow-card: 0 4px 16px rgba(0,0,0,.35), 0 1px 3px rgba(0,0,0,.30);
  --shadow-soft: 0 2px 10px rgba(0,0,0,.28);
  color-scheme: dark;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--on-surface);
  background: var(--grad-ground);
  background-attachment: fixed;
  min-height: 100dvh;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

/* Constrain everything to a phone-width column, centered on desktop */
.app-shell, .page, .landing-wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
}

/* ---------- Typography ---------- */
.h-display { font-size: 2rem;   font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.h1        { font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; }
.h2        { font-size: 1.3rem; font-weight: 800; letter-spacing: -.01em; }
.h3        { font-size: 1.075rem; font-weight: 700; }
.title     { font-size: 1rem;   font-weight: 700; }
.body      { font-size: .95rem; font-weight: 400; }
.small     { font-size: .82rem; font-weight: 400; }
.muted     { color: var(--on-surface-var); }
.on-ground { color: var(--on-background); }
.section-label {
  font-size: .72rem; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--on-surface-var);
}

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
  padding: 16px;
}
.card + .card { margin-top: 12px; }
.card-tap { cursor: pointer; transition: transform .12s ease, box-shadow .12s ease; }
.card-tap:active { transform: scale(.985); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: var(--r-btn); cursor: pointer;
  font-weight: 700; font-size: .98rem; letter-spacing: .01em;
  padding: 14px 20px; min-height: 52px; width: 100%;
  transition: transform .1s ease, filter .1s ease, background .1s ease;
  user-select: none;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: default; }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { filter: brightness(1.03); }
.btn-brand   { background: var(--grad-brand); color: #fff; box-shadow: var(--shadow-soft); }
.btn-white   { background: var(--surface); color: var(--green-deep); box-shadow: var(--shadow-soft); }
.btn-outline { background: transparent; color: var(--on-surface); border: 1.5px solid var(--outline); }
.btn-ghost   { background: transparent; color: var(--green-deep); box-shadow: none; min-height: 44px; }
.btn-danger  { background: transparent; color: #C0392B; box-shadow: none; }
.btn-sm      { min-height: 40px; padding: 8px 14px; width: auto; font-size: .88rem; }
.btn-block   { width: 100%; }

/* ---------- Text fields ---------- */
.field { margin-bottom: 12px; }
.field > label {
  display: block; font-size: .8rem; font-weight: 600;
  color: var(--on-surface-var); margin: 0 0 6px 2px;
}
.input, .textarea, select.input {
  width: 100%; border: 1.5px solid transparent;
  background: var(--surface-variant); color: var(--on-surface);
  border-radius: var(--r-field); padding: 13px 14px; font-size: 1rem;
  transition: border-color .12s ease, background .12s ease;
}
.input::placeholder, .textarea::placeholder { color: color-mix(in srgb, var(--on-surface) 45%, transparent); }
.input:focus, .textarea:focus, select.input:focus {
  outline: none; border-color: var(--green); background: var(--surface-elev);
}
.textarea { min-height: 130px; resize: vertical; line-height: 1.45; }
.field.error .input, .field.error .textarea { border-color: var(--error); }
.field .hint { font-size: .76rem; color: var(--on-surface-var); margin: 5px 2px 0; }
.field.error .hint { color: var(--error); }

/* ---------- Chips / pills ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: var(--r-pill); padding: 8px 14px;
  background: var(--surface); color: var(--on-surface);
  font-size: .85rem; font-weight: 600; cursor: pointer;
  border: 1.5px solid var(--outline); white-space: nowrap;
  transition: background .12s, color .12s, border-color .12s;
}
.chip.selected { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.chip-soft { background: var(--surface-variant); color: var(--green-info); border-color: transparent; }
.chip-row { display: flex; gap: 8px; overflow-x: auto; padding: 2px; scrollbar-width: none; }
.chip-row::-webkit-scrollbar { display: none; }

/* Countdown pill */
.count-pill {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-pill); padding: 6px 12px; font-weight: 700; font-size: .85rem;
  background: var(--surface-variant); color: var(--green-info);
}
.count-pill.today { background: var(--primary); color: var(--on-primary); }

/* ---------- Language selector ---------- */
.lang-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.lang-card {
  display: flex; align-items: center; gap: 10px; position: relative;
  padding: 14px 16px; border-radius: 16px; cursor: pointer;
  border: 2px solid var(--outline); background: var(--surface-variant);
  color: var(--on-surface); font-weight: 600; font-size: .95rem;
  transition: border-color .12s, background .12s, transform .1s;
}
.lang-card:active { transform: scale(.97); }
.lang-card .flag { font-size: 1.7rem; line-height: 1; }
.lang-card.sel { border-color: var(--primary); background: var(--primary-container); color: var(--on-primary-container); }
.lang-card .chk { position: absolute; top: 8px; right: 10px; color: var(--primary); font-weight: 800; }

/* ---------- Avatar ---------- */
.avatar {
  border-radius: 50%; overflow: hidden; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; background: var(--green-deep);
  width: 48px; height: 48px; font-size: 1.1rem;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 64px; height: 64px; font-size: 1.4rem; }
.avatar.xl { width: 96px; height: 96px; font-size: 2rem; }
.avatar.sm { width: 36px; height: 36px; font-size: .9rem; }

/* ---------- Rows ---------- */
.row { display: flex; align-items: center; gap: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.person-row { display: flex; align-items: center; gap: 12px; }
.person-row .meta { flex: 1; min-width: 0; }
.person-row .name { font-weight: 700; color: var(--on-surface); }
.person-row .sub  { font-size: .82rem; color: var(--on-surface-var); }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Confetti (hero card) ---------- */
.confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; border-radius: var(--r-card); }
.confetti span {
  position: absolute; top: -14px; border-radius: 2px; opacity: 0;
  animation-name: confetti-fall; animation-iteration-count: infinite; animation-timing-function: linear;
}
@keyframes confetti-fall {
  0% { transform: translateY(-14px) rotate(0deg); opacity: 0; }
  12% { opacity: .85; }
  100% { transform: translateY(160px) rotate(400deg); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .confetti { display: none; } }

/* ---------- Empty state ---------- */
.empty {
  text-align: center; padding: 40px 20px; color: var(--on-surface);
}
.empty .circle {
  width: 96px; height: 96px; border-radius: 50%; margin: 0 auto 16px;
  background: var(--primary-container); display: flex; align-items: center;
  justify-content: center; font-size: 2.6rem;
}
.empty .t { font-weight: 700; margin-bottom: 4px; }
.empty .s { color: var(--on-surface-var); font-size: .9rem; }

/* ---------- Brand badge (auth / onboarding) ---------- */
.brand-badge {
  width: 84px; height: 84px; border-radius: 24px; margin: 0 auto;
  background: #fff; display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-soft); padding: 14px;
}
.brand-badge img { width: 100%; height: 100%; object-fit: contain; display: block; }

/* ---------- Bottom nav ---------- */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: var(--surface); box-shadow: 0 -2px 14px rgba(45,106,79,.10);
  padding: 8px max(env(safe-area-inset-left),8px) calc(6px + env(safe-area-inset-bottom)) max(env(safe-area-inset-right),8px);
  display: flex; justify-content: center;
}
.bottom-nav .inner { width: 100%; max-width: var(--maxw); display: flex; }
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 0; color: var(--nav-inactive); font-size: .68rem; font-weight: 600;
  background: none; border: none; cursor: pointer;
}
.nav-item .ico {
  display: flex; align-items: center; justify-content: center;
  width: 56px; height: 30px; border-radius: var(--r-pill);
  transition: background .15s ease;
}
.nav-item svg { width: 24px; height: 24px; }
.nav-item.active { color: var(--nav-active); font-weight: 700; }
.nav-item.active .ico { background: var(--nav-indicator); }

/* ---------- FAB ---------- */
.fab {
  position: fixed; z-index: 45;
  right: max(16px, calc((100vw - var(--maxw))/2 + 16px));
  bottom: calc(var(--nav-h) + 18px + env(safe-area-inset-bottom));
  width: 58px; height: 58px; border-radius: 18px; border: none; cursor: pointer;
  background: var(--grad-brand); color: #fff; box-shadow: 0 6px 18px rgba(45,106,79,.35);
  display: flex; align-items: center; justify-content: center;
}
.fab svg { width: 28px; height: 28px; }

/* ---------- Page scaffold ---------- */
.page { padding: 0 var(--pad) calc(var(--nav-h) + 28px); }
.page-scroll { min-height: 100dvh; }
.appbar {
  display: flex; align-items: center; gap: 12px;
  padding: calc(env(safe-area-inset-top) + 14px) 2px 10px;
}
.appbar .title { color: var(--on-background); font-size: 1.35rem; font-weight: 800; letter-spacing: -.01em; }
.appbar .spacer { flex: 1; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(255,255,255,.18); color: var(--on-background);
  display: flex; align-items: center; justify-content: center;
}
:root[data-theme="dark"] .icon-btn { background: rgba(255,255,255,.08); }
.icon-btn svg { width: 22px; height: 22px; }

/* ---------- Modal / bottom sheet ---------- */
.scrim {
  position: fixed; inset: 0; z-index: 60; background: rgba(20,40,32,.45);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .18s ease;
}
.scrim.open { opacity: 1; pointer-events: auto; }
.sheet {
  width: 100%; max-width: var(--maxw); background: var(--surface);
  border-radius: 24px 24px 0 0; padding: 20px var(--pad) calc(20px + env(safe-area-inset-bottom));
  box-shadow: 0 -6px 30px rgba(0,0,0,.25);
  transform: translateY(24px); transition: transform .2s ease;
  max-height: 88dvh; overflow-y: auto;
}
.scrim.open .sheet { transform: translateY(0); }
.sheet .grip { width: 40px; height: 4px; border-radius: 3px; background: var(--outline); margin: 0 auto 14px; }
.sheet h3 { margin: 0 0 4px; }
.dialog {
  width: 100%; max-width: 400px; margin: auto; background: var(--surface);
  border-radius: 24px; padding: 22px;
}
.scrim.center { align-items: center; padding: 0 20px; }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + 20px); z-index: 80; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  background: #263A31; color: #fff; padding: 12px 18px; border-radius: 14px;
  font-size: .9rem; box-shadow: 0 6px 20px rgba(0,0,0,.3); max-width: 90vw;
  animation: toast-in .22s ease;
}
.toast.err { background: #7a2620; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- Spinner ---------- */
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid rgba(255,255,255,.4); border-top-color: #fff; animation: spin .7s linear infinite; }
.spinner.dark { border-color: rgba(45,106,79,.25); border-top-color: var(--green-deep); }
@keyframes spin { to { transform: rotate(360deg); } }
.overlay {
  position: fixed; inset: 0; z-index: 90; display: none;
  align-items: center; justify-content: center; flex-direction: column; gap: 14px;
  background: rgba(45,106,79,.90); color: #fff;
}
.overlay.show { display: flex; }
.overlay .spinner { width: 40px; height: 40px; border-width: 4px; }

/* ---------- Utilities ---------- */
.stack > * + * { margin-top: 12px; }
.stack-sm > * + * { margin-top: 8px; }
.hidden { display: none !important; }
.center { text-align: center; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
.divider { height: 1px; background: var(--outline); margin: 12px 0; border: none; }
.badge-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--coral); display: inline-block; }
.switch { position: relative; width: 48px; height: 28px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track { position: absolute; inset: 0; background: var(--outline); border-radius: 999px; transition: background .15s; cursor: pointer; }
.switch .track::before { content: ""; position: absolute; width: 22px; height: 22px; border-radius: 50%; background: #fff; top: 3px; left: 3px; transition: transform .15s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::before { transform: translateX(20px); }
