/* =============================================
   FamilyTasks — Premium Design System
   ============================================= */

/* ---- Google Font & Reset ---- */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;500;600;700;800;900&display=swap');

*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

/* =============================================
   CSS VARIABLES — CHILD THEME (DEFAULT)
   ============================================= */
:root {
  --primary: #88C02B;
  --primary-dark: #6fa022;
  --primary-light: #a4d65e;
  --secondary: #F5A623;
  --secondary-light: #ffc453;
  --bg: #F0F2F5;
  --card: #FFFFFF;
  --text: #1A1A1A;
  --text-secondary: #8E8E93;
  --danger: #FF3B30;
  --success: #34C759;
  --radius-card: 20px;
  --radius-pill: 9999px;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.12);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.16);
  --transition: 0.25s cubic-bezier(0.4,0,0.2,1);
}

/* =============================================
   PARENT THEME — TRUE AMOLED BLACK
   ============================================= */
.theme-parent {
  --bg: #000000;
  --card: #1C1C1E;
  --text: #FFFFFF;
  --text-secondary: #8E8E93;
}
.theme-parent body,
.theme-parent #app {
  background: #000000;
}
.theme-parent .app-header {
  background: #1C1C1E;
  border-bottom-color: #2C2C2E;
}
.theme-parent .bottom-nav {
  background: #1C1C1E;
  border-top-color: #2C2C2E;
}
.theme-parent .task-card {
  background: #1C1C1E;
  color: #fff;
}
.theme-parent .task-card.completed {
  background: rgba(52, 199, 89, 0.1);
  border-color: rgba(52, 199, 89, 0.5);
}
.theme-parent .task-points-badge {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}
.theme-parent .bottom-sheet {
  background: #1C1C1E;
  color: #fff;
}
.theme-parent .pin-key {
  background: #2C2C2E;
  color: white;
}
.theme-parent .input-field {
  background: #2C2C2E;
  border-color: #3A3A3C;
  color: #fff;
}
.theme-parent .input-field::placeholder {
  color: #636366;
}
.theme-parent .input-field:focus {
  border-color: var(--primary);
}
.theme-parent .settings-section {
  background: #1C1C1E;
}
.theme-parent .settings-item {
  border-bottom-color: #2C2C2E;
}
.theme-parent .settings-item:active {
  background: #2C2C2E;
}
.theme-parent .calendar-strip {
  background: #1C1C1E;
}
.theme-parent .reward-card {
  background: #1C1C1E;
  color: #fff;
}
.theme-parent .view-content {
  background: #000000;
}
.theme-parent .btn-secondary {
  background: #2C2C2E;
  color: #fff;
}
.theme-parent .sheet-handle {
  background: #3A3A3C;
}

/* =============================================
   BASE STYLES
   ============================================= */
body {
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  min-height: 100vh;
  overflow: hidden;
  position: fixed;
  width: 100%;
  height: 100%;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

input, textarea {
  -webkit-user-select: auto;
  user-select: auto;
}

#app {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

/* =============================================
   SPLASH SCREEN
   ============================================= */
#loading-screen {
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, var(--primary) 0%, var(--primary-dark) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
  z-index: 9999;
  transition: opacity 0.4s ease;
}
#loading-screen.hidden {
  opacity: 0;
  pointer-events: none;
}
.splash-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.splash-star {
  font-size: 72px;
  animation: bounce 1.5s ease-in-out infinite;
}
.splash-title {
  font-size: 36px;
  font-weight: 900;
  color: white;
  letter-spacing: -0.5px;
}
.splash-subtitle {
  font-size: 16px;
  color: rgba(255,255,255,0.8);
  font-weight: 600;
}

/* =============================================
   VIEW SYSTEM + TRANSITIONS
   Slide-based (translateX only, no opacity change)
   so the AMOLED black background never shows through
   ============================================= */
.view {
  position: absolute;
  inset: 0;
  background: transparent;
  display: none;
  flex-direction: column;
  pointer-events: none;
}
.view.active {
  display: flex;
  pointer-events: all;
}
.view.slide-forward .view-content,
.view.slide-forward .calendar-wrapper,
.view.slide-forward .auth-view {
  animation: slideInFromRight 0.28s cubic-bezier(0.4,0,0.2,1) forwards;
  will-change: transform;
}
.view.slide-back {
  display: flex;
}
.view.slide-back .view-content,
.view.slide-back .calendar-wrapper,
.view.slide-back .auth-view {
  animation: slideInFromLeft 0.28s cubic-bezier(0.4,0,0.2,1) forwards;
  will-change: transform;
}
.view.slide-out-left {
  display: flex;
}
.view.slide-out-left .view-content,
.view.slide-out-left .calendar-wrapper,
.view.slide-out-left .auth-view {
  animation: slideOutToLeft 0.28s cubic-bezier(0.4,0,0.2,1) forwards;
  will-change: transform;
}
.view.slide-out-right {
  display: flex;
}
.view.slide-out-right .view-content,
.view.slide-out-right .calendar-wrapper,
.view.slide-out-right .auth-view {
  animation: slideOutToRight 0.28s cubic-bezier(0.4,0,0.2,1) forwards;
  will-change: transform;
}

@keyframes slideInFromRight {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}
@keyframes slideInFromLeft {
  from { transform: translateX(-100%); }
  to   { transform: translateX(0); }
}
@keyframes slideOutToLeft {
  from { transform: translateX(0); }
  to   { transform: translateX(-100%); }
}
@keyframes slideOutToRight {
  from { transform: translateX(0); }
  to   { transform: translateX(100%); }
}

.date-slide-in-right {
  animation: slideInFromRight 0.3s cubic-bezier(0.4,0,0.2,1) forwards;
  will-change: transform;
}
.date-slide-in-left {
  animation: slideInFromLeft 0.3s cubic-bezier(0.4,0,0.2,1) forwards;
  will-change: transform;
}
.date-slide-out-left {
  animation: slideOutToLeft 0.3s cubic-bezier(0.4,0,0.2,1) forwards;
  will-change: transform;
}
.date-slide-out-right {
  animation: slideOutToRight 0.3s cubic-bezier(0.4,0,0.2,1) forwards;
  will-change: transform;
}

/* =============================================
   SCROLLABLE CONTENT AREA
   ============================================= */
.view-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(80px + env(safe-area-inset-bottom));
  background: var(--bg);
}

/* =============================================
   HEADER
   ============================================= */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  padding-top: max(12px, env(safe-area-inset-top));
  background: var(--bg);
  box-shadow: 0 -20px 40px rgba(0,0,0,0.4);
}

/* ========================================= */
/* CUSTOM DATE PICKER */
/* ========================================= */
.dp-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.6);
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(2px);
}
.dp-overlay.visible {
  opacity: 1;
}
.dp-modal {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  width: 90%;
  max-width: 340px;
  background: var(--card);
  border-radius: 20px;
  z-index: 10001;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0,0,0,0.6);
  display: flex;
  flex-direction: column;
}
.dp-modal.visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
.dp-header {
  background: var(--primary);
  padding: 24px 24px 20px;
  color: white;
}
.dp-year {
  font-size: 15px;
  font-weight: 700;
  opacity: 0.85;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}
.dp-date-large {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
}
.dp-body {
  padding: 16px 16px 12px;
}
.dp-month-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.dp-month-title {
  font-weight: 800;
  font-size: 16px;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.dp-nav-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  cursor: pointer;
  border-radius: 50%;
  transition: all 0.2s;
}
.dp-nav-btn:active {
  background: rgba(255,255,255,0.05);
  transform: scale(0.9);
}
.dp-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  color: var(--text-secondary);
  margin-bottom: 12px;
}
.dp-days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px 0;
}
.dp-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  border-radius: 50%;
  cursor: pointer;
  margin: 0 auto;
  width: 36px;
  height: 36px;
  transition: all 0.2s;
}
.dp-day:not(.empty):active {
  background: rgba(255,255,255,0.08);
  transform: scale(0.9);
}
.dp-day.today {
  border: 2px solid var(--primary);
  color: var(--primary);
  font-weight: 800;
}
.dp-day.selected {
  background: var(--primary);
  color: white;
  border: none;
  box-shadow: 0 4px 12px rgba(136, 192, 43, 0.4);
}
.dp-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}
.dp-action-btn {
  background: none;
  border: none;
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 10px 16px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s;
}
.dp-action-btn:active {
  background: rgba(255,255,255,0.05);
}
.dp-cancel {
  color: var(--text-secondary);
}
.dp-set {
  color: var(--primary);
  background: rgba(136, 192, 43, 0.1);
}
.dp-set:active {
  background: rgba(136, 192, 43, 0.2);
}
.custom-date-btn {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.05);
  color: var(--text);
  font-weight: 600;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.custom-date-btn:active {
  background: rgba(255,255,255,0.03);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-pill);
  transition: background var(--transition);
}
.user-chip:active { background: var(--bg); }
.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(136,192,43,0.3);
}
.user-name {
  font-weight: 800;
  font-size: 16px;
  color: var(--text);
}
.user-chevron {
  color: var(--text-secondary);
  font-size: 12px;
  margin-left: -4px;
}
.points-chip {
  background: white;
  border: 2px solid var(--bg);
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  font-weight: 800;
  font-size: 16px;
  color: var(--secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: var(--shadow-sm);
}
.theme-parent .points-chip {
  background: #2C2C2E;
  border-color: #3A3A3C;
}

/* =============================================
   CALENDAR COMPONENT
   ============================================= */
.calendar-wrapper {
  background: var(--card);
  margin: 16px;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  position: relative;
  z-index: 5;
  flex-shrink: 0;
}
.calendar-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px 4px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.calendar-nav .nav-btn {
  padding: 4px;
  cursor: pointer;
  transition: opacity 0.2s;
}
.calendar-nav .nav-btn:active {
  opacity: 0.6;
}
.calendar-nav .today-btn {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 10px;
  border-radius: 12px;
  background: rgba(136, 192, 43, 0.1);
  transition: all 0.3s ease;
}
.calendar-strip-dates {
  display: flex;
  justify-content: space-between;
  padding: 4px 12px 16px;
}
.calendar-header-days {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px 0;
}
.calendar-header-days .day-name {
  flex: 1;
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.calendar-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  cursor: pointer;
}
.calendar-day .day-num {
  font-size: 17px;
  font-weight: 700;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text);
  transition: all 0.15s;
}
.calendar-day.today .day-num {
  background: var(--secondary);
  color: white;
  box-shadow: 0 3px 10px rgba(245,166,35,0.4);
}

.calendar-day:not(.today):active .day-num {
  background: var(--bg);
}

/* =============================================
   SECTION HEADERS
   ============================================= */
.section-header {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 16px 20px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* =============================================
   TASK CARDS
   ============================================= */
.task-card {
  background: white;
  border-radius: var(--radius-card);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 16px 10px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
  cursor: pointer;
  position: relative;
  border: 2px solid transparent;
}
.task-card:active {
  transform: scale(0.98);
  box-shadow: none;
}
.task-card.completed {
  background: rgba(52, 199, 89, 0.05);
  border-color: var(--success);
  opacity: 1;
  filter: none;
}

.task-card.needs-review {
  border-color: #FFD700;
  background: #FFFBEB;
  animation: pulseYellow 2s ease-in-out infinite;
}
.task-card.rejected {
  border-color: var(--danger);
  background: #FFF5F5;
}
.task-icon {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  flex-shrink: 0;
}
.task-info {
  flex: 1;
  min-width: 0;
}
.task-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.task-meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
  font-weight: 600;
}
.task-card.completed .task-title {
  color: var(--text-secondary);
}
.task-right {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.task-points-badge {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text);
  font-weight: 800;
  font-size: 13px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}
.task-status-btn {
  height: 38px;
  min-width: 38px;
  padding: 0 14px;
  border-radius: 20px;
  border: 2px dashed #D4AF37;
  background: #FFFBEB;
  color: #D4AF37;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  flex-shrink: 0;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}
.task-status-btn:active { transform: scale(0.9); }
.task-status-btn.done,
.task-status-btn.waiting,
.task-status-btn.rejected-btn {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
}

.task-status-btn.done {
  background: var(--success);
  border: 2px solid var(--success);
  color: white;
  box-shadow: 0 4px 12px rgba(52, 199, 89, 0.4);
  transform: scale(1.1);
}
.task-status-btn.waiting {
  border-color: var(--secondary);
}
.task-status-btn.rejected-btn {
  border-color: var(--danger);
}

/* =============================================
   BOTTOM TAB BAR
   ============================================= */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-top: 1px solid #E8E8E8;
  display: flex;
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 100;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.06);
}
.nav-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 0 8px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-secondary);
  font-family: 'Nunito', sans-serif;
  font-size: 11px;
  font-weight: 700;
  transition: color var(--transition);
  position: relative;
}
.nav-tab.active {
  color: var(--primary);
}
.nav-tab svg {
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text);
  transition: all 0.15s;
}
.calendar-day.today .day-num {
  background: var(--secondary);
  color: white;
  box-shadow: 0 3px 10px rgba(245,166,35,0.4);
}

.calendar-day:not(.today):active .day-num {
  background: var(--bg);
}

/* =============================================
   SECTION HEADERS
   ============================================= */
.section-header {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 16px 20px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* =============================================
   TASK CARDS
   ============================================= */
.task-card {
  background: white;
  border-radius: var(--radius-card);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 16px 10px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
  cursor: pointer;
  position: relative;
  border: 2px solid transparent;
}
.task-card:active {
  transform: scale(0.98);
  box-shadow: none;
}
.task-card.completed {
  background: rgba(52, 199, 89, 0.05);
  border-color: var(--success);
  opacity: 1;
  filter: none;
}

.task-card.needs-review {
  border-color: #FFD700;
  background: #FFFBEB;
  animation: pulseYellow 2s ease-in-out infinite;
}
.task-card.rejected {
  border-color: var(--danger);
  background: #FFF5F5;
}
.task-icon {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  flex-shrink: 0;
}
.task-info {
  flex: 1;
  min-width: 0;
}
.task-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.task-meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
  font-weight: 600;
}
.task-card.completed .task-title {
  color: var(--text-secondary);
}
.task-right {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.task-points-badge {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text);
  font-weight: 800;
  font-size: 13px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}
.task-status-btn {
  height: 38px;
  min-width: 38px;
  padding: 0 14px;
  border-radius: 20px;
  border: 2px dashed #D4AF37;
  background: #FFFBEB;
  color: #D4AF37;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  flex-shrink: 0;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}
.task-status-btn:active { transform: scale(0.9); }
.task-status-btn.done,
.task-status-btn.waiting,
.task-status-btn.rejected-btn {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
}

.task-status-btn.done {
  background: var(--success);
  border: 2px solid var(--success);
  color: white;
  box-shadow: 0 4px 12px rgba(52, 199, 89, 0.4);
  transform: scale(1.1);
}
.task-status-btn.waiting {
  border-color: var(--secondary);
}
.task-status-btn.rejected-btn {
  border-color: var(--danger);
}

/* =============================================
   BOTTOM TAB BAR
   ============================================= */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-top: 1px solid #E8E8E8;
  display: flex;
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 100;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.06);
}
.nav-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 0 8px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-secondary);
  font-family: 'Nunito', sans-serif;
  font-size: 11px;
  font-weight: 700;
  transition: color var(--transition);
  position: relative;
}
.nav-tab.active {
  color: var(--primary);
}
.nav-tab svg {
  width: 24px;
  height: 24px;
  margin-bottom: 3px;
  transition: transform 0.2s;
}
.nav-tab.active svg {
  transform: scale(1.05); /* Suptilni premium pop umjesto skakanja */
}
.nav-tab-label { line-height: 1; }
.badge-dot {
  position: absolute;
  top: 8px;
  right: calc(50% - 14px);
  width: 10px;
  height: 10px;
  background-color: var(--danger);
  border-radius: 50%;
  border: 2px solid #fff;
  z-index: 10;
}
.theme-parent .badge-dot { border-color: #1C1C1E; }
.nav-badge {
  position: absolute;
  top: 8px;
  right: calc(50% - 16px);
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 800;
  border-radius: var(--radius-pill);
  padding: 1px 5px;
  min-width: 16px;
  text-align: center;
  animation: pulseBadge 1.5s ease-in-out infinite;
}

/* =============================================
   FAB BUTTON
   ============================================= */
.view.slide-out-left .fab,
.view.slide-out-right .fab {
  display: none !important;
}
.fab {
  position: fixed;
  bottom: calc(72px + env(safe-area-inset-bottom));
  right: 20px;
  width: 58px;
  height: 58px;
  background: var(--primary);
  border-radius: 50%;
  border: none;
  color: white;
  font-size: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(136,192,43,0.5);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
  z-index: 99;
  line-height: 1;
}
.fab:active {
  transform: scale(0.9);
  box-shadow: 0 2px 10px rgba(136,192,43,0.3);
}

/* =============================================
   BUTTONS
   ============================================= */
.btn {
  border: none;
  cursor: pointer;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  border-radius: var(--radius-pill);
  padding: 14px 28px;
  font-size: 16px;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  letter-spacing: 0.2px;
}
.btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.btn-icon-subtle {
  background: transparent;
  border: none;
  color: #A0A0A5;
  padding: 8px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-icon-subtle:hover, .btn-icon-subtle:active {
  color: var(--danger);
  background: rgba(255,59,48,0.1);
}

.btn-primary {
  background: var(--primary);
  color: white;
  width: 100%;
  box-shadow: 0 4px 14px rgba(136,192,43,0.4);
}
.btn-primary:active {
  background: var(--primary-dark);
  transform: scale(0.98);
  box-shadow: 0 2px 8px rgba(136,192,43,0.2);
}
.btn-secondary {
  background: var(--bg);
  color: var(--text);
  width: 100%;
}
.btn-secondary:active {
  transform: scale(0.98);
}
.btn-danger {
  background: var(--danger);
  color: white;
  width: 100%;
  box-shadow: 0 4px 14px rgba(255,59,48,0.3);
}
.btn-danger:active {
  transform: scale(0.98);
}

.btn-sm {
  padding: 8px 18px;
  font-size: 13px;
}
.btn.loading {
  opacity: 0.7;
  pointer-events: none;
}
.btn.loading::after {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-left: 6px;
}

/* =============================================
   BOTTOM SHEET
   ============================================= */
.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 200;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}
.sheet-overlay.visible {
  opacity: 1;
  pointer-events: all;
}
.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-radius: 24px 24px 0 0;
  padding: 24px 20px calc(40px + env(safe-area-inset-bottom));
  z-index: 201;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1);
  max-height: 82vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.bottom-sheet.visible {
  transform: translateY(0);
}
.sheet-handle {
  width: 36px;
  height: 4px;
  background: #E0E0E0;
  border-radius: 2px;
  margin: 8px auto 16px;
}
.sheet-close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 32px;
  height: 32px;
  background: var(--bg);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  z-index: 10;
}
.bottom-sheet.sheet-full {
  max-height: 96vh;
  height: 96vh;
}
.sheet-title {
  font-size: 19px;
  font-weight: 800;
  margin-bottom: 20px;
  color: var(--text);
  padding-right: 32px; /* Prevent text overlap with X */
}

/* =============================================
   INPUT FIELDS
   ============================================= */
.input-field {
  width: 100%;
  padding: 14px 18px;
  border: 2px solid #E8E8E8;
  border-radius: 14px;
  font-size: 16px;
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  background: white;
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.input-field:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(136,192,43,0.15);
}
.input-field::placeholder {
  color: #C7C7CC;
  font-weight: 500;
}
.input-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  display: block;
}
.form-group {
  margin-bottom: 16px;
}
.code-input {
  text-align: center;
  font-size: 32px;
  font-weight: 900;
  letter-spacing: 10px;
  text-transform: uppercase;
}

/* =============================================
   PIN KEYBOARD
   ============================================= */
.pin-display {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin: 28px 0 32px;
}
.pin-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2.5px solid var(--text-secondary);
  transition: all 0.2s cubic-bezier(0.34,1.56,0.64,1);
}
.pin-dot.filled {
  background: var(--primary);
  border-color: var(--primary);
  transform: scale(1.1);
}
.pin-dot.shake {
  animation: shake 0.4s ease-in-out;
}
.pin-keyboard {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 0 20px;
  max-width: 320px;
  margin: 0 auto;
}
.pin-key {
  aspect-ratio: 1;
  max-height: 72px;
  border-radius: 50%;
  border: none;
  background: white;
  font-size: 26px;
  font-weight: 700;
  font-family: 'Nunito', sans-serif;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
}
.pin-key:active {
  transform: scale(0.88);
  background: var(--bg);
  box-shadow: none;
}
.pin-key.empty {
  background: transparent;
  box-shadow: none;
  pointer-events: none;
}
.pin-key.backspace {
  font-size: 20px;
}

/* =============================================
   AVATAR SELECTOR
   ============================================= */
.avatar-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 16px;
}
.avatar-option {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34,1.56,0.64,1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  background: var(--bg);
}
.avatar-option.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(136,192,43,0.2);
  transform: scale(1.08);
}
.avatar-option:active {
  transform: scale(0.92);
}

/* =============================================
   EMPTY STATE
   ============================================= */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 60px 32px;
  gap: 14px;
}
.empty-state-icon {
  font-size: 80px;
}
.empty-state h3 {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
}
.empty-state p {
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
  max-width: 260px;
}

/* =============================================
   REWARDS GRID
   ============================================= */
.rewards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 16px;
}
.reward-card {
  background: white;
  border-radius: var(--radius-card);
  padding: 20px 12px 16px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  border: 2px solid transparent;
  overflow: hidden;
}
.reward-card:active {
  transform: scale(0.96);
  box-shadow: none;
}
.reward-card.on-cooldown {
  opacity: 0.5;
  pointer-events: none;
}
.reward-card.cant-afford {
  opacity: 0.7;
}
.reward-icon {
  font-size: 52px;
  margin-bottom: 8px;
  line-height: 1;
}
.reward-title {
  font-weight: 800;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 4px;
}
.reward-cost {
  color: var(--secondary);
  font-weight: 800;
  font-size: 15px;
}
.reward-cooldown-label {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 600;
  margin-top: 4px;
}

/* =============================================
   SETTINGS LIST
   ============================================= */
.settings-section {
  background: white;
  border-radius: var(--radius-card);
  margin: 12px 16px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.settings-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 12px 16px 4px;
}
.settings-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 16px;
  border-bottom: 1px solid #F2F2F7;
  cursor: pointer;
  transition: background 0.15s;
}
.settings-item:last-child {
  border-bottom: none;
}
.settings-item:active {
  background: var(--bg);
}
.settings-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.settings-label {
  flex: 1;
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
}
.settings-value {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
}
.settings-chevron {
  color: var(--text-secondary);
  font-size: 14px;
}

/* =============================================
   TOAST NOTIFICATIONS
   ============================================= */
.toast {
  position: fixed;
  top: max(24px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%) translateY(-120px);
  background: var(--card); /* Pametna pozadina (bijela za dijete, tamna za roditelja) */
  color: var(--text); /* Pametni tekst (crni za dijete, bijeli za roditelja) */
  padding: 14px 24px;
  border-radius: var(--radius-pill);
  font-weight: 800; /* Podebljano za bolju čitljivost */
  font-size: 14px;
  z-index: 10000;
  transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1);
  white-space: normal;
  width: calc(100vw - 32px);
  max-width: 600px;
  text-align: center;
  box-shadow: 0 8px 30px rgba(0,0,0,0.15); /* Nešto mekša sjena jer je oblačić svijetao kod djeteta */
  pointer-events: none;
  font-family: 'Nunito', sans-serif;
  border: 1px solid rgba(128,128,128,0.2); /* Suptilni rub za defaultne poruke */
}
.toast.show {
  transform: translateX(-50%) translateY(0);
}
.toast.success { 
  border: 2px solid var(--primary); 
}
.toast.error { 
  border: 2px solid var(--danger); 
}
.toast.warning { 
  border: 2px solid var(--secondary); 
}

/* =============================================
   PENDING BADGE
   ============================================= */
.pending-badge {
  background: var(--danger);
  color: white;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 800;
  padding: 2px 7px;
  min-width: 20px;
  text-align: center;
}

/* =============================================
   CAMERA VIEW
   ============================================= */
.camera-view {
  position: fixed;
  inset: 0;
  background: black;
  z-index: 300;
  display: flex;
  flex-direction: column;
}
.camera-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(16px, env(safe-area-inset-top)) 20px 16px;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(10px);
}
.camera-task-title {
  color: white;
  font-weight: 700;
  font-size: 15px;
  flex: 1;
  text-align: center;
  margin: 0 12px;
}
.camera-close-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
#camera-preview {
  flex: 1;
  width: 100%;
  object-fit: cover;
}
.camera-controls {
  padding: max(24px, env(safe-area-inset-bottom)) 40px 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(10px);
  gap: 60px;
}
.shutter-btn {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: white;
  border: 5px solid rgba(255,255,255,0.5);
  cursor: pointer;
  transition: transform 0.15s;
  box-shadow: 0 0 0 3px rgba(255,255,255,0.3);
}
.shutter-btn:active {
  transform: scale(0.88);
}

/* =============================================
   SUPERADMIN VIEW
   ============================================= */

/* =============================================
   WELCOME VIEW
   ============================================= */
.welcome-view {
  background: linear-gradient(160deg, var(--primary) 0%, var(--primary-dark) 55%, #4a7017 100%);
  display: flex;
  flex-direction: column;
  min-height: 100%;
  position: relative;
  overflow: hidden;
}
.welcome-bg-circles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.welcome-circle {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
}
.welcome-hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 32px 20px;
  gap: 16px;
}
.welcome-emoji {
  font-size: 90px;
  animation: bounce 2s ease-in-out infinite;
}
.welcome-title {
  font-size: 44px;
  font-weight: 900;
  color: white;
  letter-spacing: -1px;
  text-align: center;
}
.welcome-subtitle {
  font-size: 18px;
  color: rgba(255,255,255,0.85);
  font-weight: 600;
  text-align: center;
}
.welcome-actions {
  padding: 24px 32px calc(40px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.btn-white {
  background: white;
  color: var(--primary);
  font-weight: 800;
  box-shadow: var(--shadow-md);
}
.btn-white:active { transform: scale(0.98); }

/* =============================================
   JOIN FAMILY / CREATE FAMILY VIEWS
   ============================================= */
.auth-view {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  background: var(--bg);
}
.auth-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: max(16px, env(safe-area-inset-top)) 20px 16px;
  background: var(--card);
  border-bottom: 1px solid rgba(0,0,0,0.06);
  flex-shrink: 0;
}
.back-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: var(--bg);
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}
.back-btn:active { transform: scale(0.9); }
.auth-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
}
.auth-body {
  flex: 1;
  overflow-y: auto;
  padding: 28px 20px;
  -webkit-overflow-scrolling: touch;
}
.auth-subtitle {
  font-size: 15px;
  color: var(--text-secondary);
  font-weight: 600;
  margin-bottom: 28px;
  line-height: 1.5;
}

/* =============================================
   POINTS STEPPER
   ============================================= */
.stepper {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--bg);
  border-radius: var(--radius-pill);
  padding: 4px;
}
.stepper-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: white;
  font-size: 22px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s;
  flex-shrink: 0;
}
.stepper-btn:active { transform: scale(0.9); }
.stepper-value {
  flex: 1;
  text-align: center;
  font-size: 20px;
  font-weight: 900;
  color: var(--text);
}

/* =============================================
   TASK TYPE SELECTOR
   ============================================= */
.type-selector {
  display: flex;
  gap: 8px;
}
.type-option {
  flex: 1;
  padding: 10px 8px;
  border: 2px solid #E8E8E8;
  border-radius: 12px;
  text-align: center;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  transition: all 0.15s;
  font-family: 'Nunito', sans-serif;
  background: white;
}
.type-option.selected {
  border-color: var(--primary);
  background: rgba(136,192,43,0.1);
  color: var(--primary);
}

/* =============================================
   TOGGLE SWITCH
   ============================================= */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
}
.toggle-label {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
.toggle {
  width: 52px;
  height: 30px;
  border-radius: 15px;
  background: #E0E0E0;
  border: none;
  cursor: pointer;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}
.toggle.on { background: var(--primary); }
.toggle::after {
  content: '';
  position: absolute;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: white;
  top: 2px;
  left: 2px;
  transition: transform 0.2s cubic-bezier(0.34,1.56,0.64,1);
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.toggle.on::after { transform: translateX(22px); }

/* =============================================
   CHILD SELECTOR (AVATARS MULTI-SELECT)
   ============================================= */
.child-selector {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.child-selector-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}
.child-selector-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  border: 3px solid transparent;
  transition: all 0.2s;
}
.child-selector-item.selected .child-selector-avatar {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(136,192,43,0.2);
}
.child-selector-name {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
}
.child-selector-item.selected .child-selector-name {
  color: var(--primary);
}

/* =============================================
   PHOTO PROOF
   ============================================= */

/* =============================================
   LEDGER / HISTORY
   ============================================= */
.ledger-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}
.ledger-item:last-child { border-bottom: none; }
.ledger-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.ledger-desc {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.ledger-date {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 600;
}
.ledger-amount {
  font-weight: 800;
  font-size: 15px;
}
.ledger-amount.positive { color: var(--success); }
.ledger-amount.negative { color: var(--danger); }

/* =============================================
   RECURRENCE / EMOJI PICKER
   ============================================= */
.recurrence-days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  padding: 4px 0 12px;
}
.rd-btn {
  aspect-ratio: 1;
  border: 1px solid rgba(255,255,255,0.1);
  background: var(--bg);
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.theme-parent .rd-btn { border-color: rgba(0,0,0,0.1); }
.rd-btn.selected {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.emoji-picker-grid {
  display: flex;
  overflow-x: auto;
  gap: 12px;
  padding: 4px 4px 12px 4px;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
}
.emoji-picker-grid::-webkit-scrollbar {
  display: none;
}
.emoji-picker-grid .emoji-pick-btn {
  flex: 0 0 auto;
  width: 50px;
  height: 50px;
  scroll-snap-align: start;
}
.emoji-pick-btn {
  aspect-ratio: 1;
  border: none;
  background: var(--bg);
  border-radius: 10px;
  font-size: 26px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid transparent;
}
.emoji-pick-btn.selected {
  border-color: var(--primary);
  background: rgba(136,192,43,0.12);
}
.emoji-pick-btn:active { transform: scale(0.88); }

/* =============================================
   JOIN CODE DISPLAY
   ============================================= */
.join-code-display {
  background: var(--bg);
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  margin: 12px 0;
}
.join-code-big {
  font-size: 40px;
  font-weight: 900;
  letter-spacing: 10px;
  color: var(--primary);
  font-family: monospace;
}
.join-code-hint {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 600;
  margin-top: 8px;
}

/* =============================================
   LOADING STATE
   ============================================= */
.global-spinner {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(136, 192, 43, 0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  margin: 60px auto;
  opacity: 0;
  animation: spin 0.8s linear infinite, skeletonReveal 0.15s ease 0.35s forwards;
}

.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  /* Start invisible; become visible only after 350ms delay.
     On fast connections the API responds before the delay fires
     so skeletons never flash into view. */
  opacity: 0;
  animation: shimmer 1.4s ease-in-out infinite, skeletonReveal 0.15s ease 0.35s forwards;
  border-radius: 10px;
}
.skeleton-card {
  height: 80px;
  margin: 0 16px 10px;
  border-radius: var(--radius-card);
}

/* =============================================
   PIN PROMPT OVERLAY
   ============================================= */
.pin-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 500;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.pin-modal {
  background: white;
  border-radius: 28px 28px 0 0;
  width: 100%;
  padding: 16px 20px calc(40px + env(safe-area-inset-bottom));
  max-width: 480px;
}
.theme-parent .pin-modal {
  background: #1C1C1E;
}
.pin-modal-title {
  text-align: center;
  font-size: 22px;
  font-weight: 900;
  color: var(--text);
  margin-bottom: 4px;
}
.pin-modal-subtitle {
  text-align: center;
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 600;
  margin-bottom: 4px;
}

/* =============================================
   CONFETTI ANIMATION
   ============================================= */
.confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9998;
  overflow: hidden;
}
.confetti-piece {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  animation: confettiFall linear forwards;
}

/* =============================================
   PARENT TASK REVIEW CARD
   ============================================= */
.review-card {
  background: white;
  border-radius: var(--radius-card);
  padding: 16px;
  margin: 0 16px 10px;
  box-shadow: var(--shadow-sm);
  border: 2px solid var(--danger);
  position: relative;
}
.theme-parent .review-card {
  background: #1C1C1E;
}
.review-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.review-child-avatar {
  font-size: 32px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.review-info { flex: 1; }
.review-child-name {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 700;
}
.review-task-name {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
}

.review-photo {
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 12px;
}
.review-photo img {
  width: 100%;
  height: 180px;
  object-fit: cover;
}
.review-actions {
  display: flex;
  gap: 10px;
}

/* =============================================
   CHILDREN LIST (PARENT)
   ============================================= */
.child-row {
  background: white;
  border-radius: var(--radius-card);
  padding: 14px 16px;
  margin: 0 16px 10px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all var(--transition);
}
.theme-parent .child-row {
  background: #1C1C1E;
}
.child-row:active { transform: scale(0.98); }
.child-row-avatar {
  font-size: 36px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.child-row-info { flex: 1; }
.child-row-name {
  font-size: 17px;
  font-weight: 800;
  color: var(--text);
}
.child-row-points {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 600;
  margin-top: 2px;
}
.child-row-points-big {
  font-size: 20px;
  font-weight: 900;
  color: var(--secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* =============================================
   KEYFRAME ANIMATIONS
   ============================================= */
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-12px); }
}
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%     { transform: translateX(-8px); }
  40%     { transform: translateX(8px); }
  60%     { transform: translateX(-6px); }
  80%     { transform: translateX(6px); }
}
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes skeletonReveal {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes pulseBadge {
  0%,100% { opacity: 1; transform: scale(1); }
  50%     { opacity: 0.7; transform: scale(0.9); }
}
@keyframes pulseYellow {
  0%,100% { box-shadow: 0 2px 8px rgba(255,215,0,0.2); }
  50%     { box-shadow: 0 4px 20px rgba(255,215,0,0.5); }
}
@keyframes confettiFall {
  0%   { transform: translateY(-20px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}
@keyframes popIn {
  0%   { transform: scale(0.5); opacity: 0; }
  80%  { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

/* =============================================
   SPINNER (GENERAL)
   ============================================= */

/* =============================================
   UTILITIES
   ============================================= */

.mt-8  { margin-top: 8px; }

.mt-20 { margin-top: 20px; }

.text-sm { font-size: 13px; }

.text-secondary { color: var(--text-secondary); }

/* =============================================
   SCROLLBAR HIDE (mobile UX)
   ============================================= */
::-webkit-scrollbar { display: none; }
* { scrollbar-width: none; }

/* =============================================
   SAFE AREA FALLBACKS
   ============================================= */
@supports not (padding: env(safe-area-inset-top)) {
  .app-header { padding-top: 16px; }
  .bottom-nav { padding-bottom: 8px; }
  .fab { bottom: 80px; }
}

/* =============================================
   SMALL SCREENS (HEIGHT) ADJUSTMENTS
   ============================================= */
@media (max-height: 850px) {
  .sheet-title { margin-bottom: 12px; font-size: 17px; }
  .form-group { margin-bottom: 12px !important; }
  .input-field { padding: 12px 14px; font-size: 15px; }
  .stepper { height: 46px !important; padding: 0 4px !important; }
  .stepper-btn { width: 32px !important; height: 32px !important; font-size: 18px; }
  .bottom-sheet { padding-top: 16px; }
  .sheet-close-btn { top: 12px; }
}
