:root {
  --pink: #ec4899;
  --pink-dark: #db2777;
  --pink-light: #fce7f3;
  --bg: #fdf2f8;
  --card-bg: #ffffff;
  --text: #1f2937;
  --text-muted: #6b7280;
  --border: #f3d6e8;
  --shadow: 0 2px 10px rgba(219, 39, 119, 0.08);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --pink: #f472b6;
  --pink-dark: #ec4899;
  --pink-light: #3b1f30;
  --bg: #191419;
  --card-bg: #241a26;
  --text: #f3e8ff;
  --text-muted: #b8a8bd;
  --border: #3a2a3a;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    --pink: #f472b6;
    --pink-dark: #ec4899;
    --pink-light: #3b1f30;
    --bg: #191419;
    --card-bg: #241a26;
    --text: #f3e8ff;
    --text-muted: #b8a8bd;
    --border: #3a2a3a;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Arial Hebrew", Arial, sans-serif;
  min-height: 100%;
}

body {
  padding-bottom: 84px;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 20px 16px 24px;
}

/* ---------- Header ---------- */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}
.greeting {
  font-size: 15px;
  color: var(--text-muted);
  margin: 0 0 4px;
}
.page-title {
  font-size: 26px;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.stats-link {
  font-size: 13px;
  color: var(--pink-dark);
  background: var(--pink-light);
  padding: 8px 14px;
  border-radius: 20px;
  font-weight: 600;
  white-space: nowrap;
}

/* ---------- Empty state ---------- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state .big-emoji {
  font-size: 56px;
  display: block;
  margin-bottom: 16px;
}
.empty-state p { margin: 6px 0; line-height: 1.6; }
.empty-state .hint { font-size: 14px; }

/* ---------- Cards ---------- */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}

.bday-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
  cursor: pointer;
}
.bday-avatar {
  width: 46px;
  height: 46px;
  min-width: 46px;
  border-radius: 50%;
  background: var(--pink-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}
.bday-info { flex: 1; min-width: 0; }
.bday-name { font-weight: 700; font-size: 15px; margin: 0 0 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bday-sub { font-size: 13px; color: var(--text-muted); margin: 0; }
.bday-days {
  font-size: 12px;
  font-weight: 700;
  color: var(--pink-dark);
  background: var(--pink-light);
  padding: 6px 10px;
  border-radius: 12px;
  white-space: nowrap;
}
.fav-star { color: var(--pink); font-size: 16px; }

/* ---------- Bottom Nav ---------- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  right: 0;
  left: 0;
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  z-index: 40;
}
.bottom-nav.hidden { display: none; }
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  color: var(--text-muted);
  padding: 4px 14px;
  border-radius: 10px;
  transition: color .15s;
}
.nav-item.active { color: var(--pink-dark); font-weight: 700; }
.nav-icon { font-size: 20px; }

/* ---------- Nav center FAB ---------- */
.nav-fab {
  width: 50px;
  height: 50px;
  min-width: 50px;
  border-radius: 50%;
  background: var(--pink);
  color: #fff;
  border: none;
  font-size: 26px;
  line-height: 1;
  box-shadow: 0 6px 16px rgba(219, 39, 119, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translateY(-16px);
}
.nav-fab:active { transform: translateY(-16px) scale(0.95); }

/* ---------- Filter chips ---------- */
.chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 10px;
  margin-bottom: 12px;
  scrollbar-width: none;
}
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  padding: 8px 16px;
  border-radius: 20px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
}
.chip.active {
  background: var(--pink);
  color: #fff;
  border-color: var(--pink);
  font-weight: 600;
}

/* ---------- Buttons ---------- */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 700;
  border: none;
  cursor: pointer;
}
.btn-primary { background: var(--pink); color: #fff; }
.btn-primary:active { background: var(--pink-dark); }
.btn-secondary {
  background: var(--card-bg);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost {
  background: transparent;
  color: var(--pink-dark);
  border: 2px solid var(--pink-light);
}
.btn-danger { background: transparent; color: #e11d48; border: 1px solid #f9c9d5; }

/* ---------- Auth screen ---------- */
.auth-wrap {
  max-width: 420px;
  margin: 0 auto;
  padding: 40px 20px 60px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.auth-emojis { text-align: center; font-size: 34px; letter-spacing: 6px; margin-bottom: 12px; }
.auth-title { text-align: center; font-size: 30px; font-weight: 800; margin: 0 0 6px; }
.auth-tagline { text-align: center; color: var(--text-muted); margin: 0 0 28px; font-size: 14px; }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
.field input {
  width: 100%;
  padding: 13px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  font-size: 15px;
}
.field input:focus { outline: 2px solid var(--pink); }

.password-wrap { position: relative; }
.password-wrap input { padding-left: 42px; }
.password-toggle {
  position: absolute;
  left: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 17px;
  line-height: 1;
  padding: 8px;
  color: var(--text-muted);
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 13px;
  margin: 18px 0;
}
.divider::before, .divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-switch { text-align: center; margin-top: 14px; font-size: 13px; color: var(--text-muted); }
.auth-switch a { color: var(--pink-dark); font-weight: 700; }

.feature-row {
  display: flex;
  justify-content: space-around;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.feature-item { text-align: center; color: var(--text-muted); font-size: 12px; }
.feature-item .emoji { font-size: 24px; display: block; margin-bottom: 6px; }

/* ---------- Calendar ---------- */
.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.cal-header button {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 36px;
  height: 36px;
  font-size: 16px;
  cursor: pointer;
  color: var(--text);
}
.cal-month-title { font-size: 18px; font-weight: 700; }
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 16px;
}
.cal-day-label {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  padding: 6px 0;
  font-weight: 600;
}
.cal-cell {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 13px;
  cursor: pointer;
  position: relative;
  color: var(--text);
}
.cal-cell.empty { cursor: default; }
.cal-cell.today { border: 2px solid var(--pink); font-weight: 700; }
.cal-cell.selected { background: var(--pink); color: #fff; }
.cal-cell .dot {
  width: 5px; height: 5px; border-radius: 50%; background: var(--pink);
  position: absolute; bottom: 5px;
}
.cal-cell.selected .dot { background: #fff; }
.section-title { font-size: 15px; font-weight: 700; margin: 0 0 10px; }

/* ---------- Settings ---------- */
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.settings-row:last-child { border-bottom: none; }
.settings-row-text { flex: 1; padding-left: 12px; }
.settings-row-title { font-weight: 600; font-size: 14px; margin: 0 0 2px; }
.settings-row-sub { font-size: 12px; color: var(--text-muted); margin: 0; }

.switch { position: relative; width: 46px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0; background: var(--border); border-radius: 26px; cursor: pointer; transition: .2s;
}
.slider::before {
  content: ""; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: .2s;
}
.switch input:checked + .slider { background: var(--pink); }
.switch input:checked + .slider::before { transform: translateX(-20px); }

.footer-badge {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 24px;
}
.app-version { text-align: center; font-size: 12px; color: var(--text-muted); margin-top: 20px; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 60;
}
.modal-sheet {
  background: var(--bg);
  width: 100%;
  max-width: 480px;
  border-radius: 20px 20px 0 0;
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
  max-height: 88vh;
  overflow-y: auto;
}
.modal-title { font-size: 18px; font-weight: 800; margin: 0 0 16px; text-align: center; }
.field select, .field textarea {
  width: 100%;
  padding: 13px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
}
.field textarea { resize: none; min-height: 70px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; font-size: 14px; }

.pin-input {
  text-align: center;
  font-size: 30px;
  letter-spacing: 14px;
  font-weight: 700;
}
.modal-actions { display: flex; gap: 10px; margin-top: 8px; }

/* ---------- Stats ---------- */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.stat-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 16px; padding: 16px; text-align: center; box-shadow: var(--shadow); }
.stat-num { font-size: 26px; font-weight: 800; color: var(--pink-dark); }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.bar-row { margin-bottom: 10px; }
.bar-row-top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.bar-track { height: 8px; background: var(--pink-light); border-radius: 8px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--pink); border-radius: 8px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1f2937;
  color: #fff;
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 100;
  max-width: 90%;
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.hidden { display: none !important; }
