/* ─── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #4F46E5;
  --primary-light: #6366F1;
  --primary-dark: #3730A3;
  --success: #10B981;
  --success-light: #D1FAE5;
  --danger: #EF4444;
  --danger-light: #FEE2E2;
  --warning: #F59E0B;
  --warning-light: #FEF3C7;
  --bg: #F1F5F9;
  --card: #FFFFFF;
  --text: #1E293B;
  --text-muted: #64748B;
  --border: #E2E8F0;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --font: 'Segoe UI', Arial, sans-serif;
}

html { font-size: 16px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  direction: rtl;
  min-height: 100vh;
  line-height: 1.5;
}

/* ─── Typography ────────────────────────────────────────────────────────────── */
h1 { font-size: 1.75rem; font-weight: 700; }
h2 { font-size: 1.375rem; font-weight: 700; }
h3 { font-size: 1.125rem; font-weight: 600; }
h4 { font-size: 1rem; font-weight: 600; }
p { font-size: .9375rem; color: var(--text-muted); }

/* ─── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: .5rem 1rem; border-radius: var(--radius-sm);
  font-size: .9375rem; font-weight: 600;
  border: none; cursor: pointer; transition: all .15s ease;
  text-decoration: none; white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(.9); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.9); }
.btn-ghost { background: transparent; color: var(--primary); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg); }
.btn-approve { background: #8B5CF6; color: #fff; font-weight: 600; }
.btn-approve:hover { filter: brightness(.9); }
.btn-reject { background: #EF4444; color: #fff; font-weight: 600; }
.btn-reject:hover { filter: brightness(.9); }
.btn-sm { padding: .3rem .7rem; font-size: .875rem; }
.btn-lg { padding: .75rem 1.5rem; font-size: 1.0625rem; }
.btn-full { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ─── Cards ─────────────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem;
}

/* ─── Forms ─────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: .875rem; font-weight: 600; margin-bottom: .35rem; color: var(--text); }
.form-control {
  width: 100%; padding: .6rem .9rem;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: .9375rem; background: var(--card); color: var(--text);
  transition: border-color .15s; outline: none; direction: rtl;
  font-family: var(--font);
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.15); }
.form-hint { font-size: .8125rem; color: var(--text-muted); margin-top: .25rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 480px) { .form-row { grid-template-columns: 1fr; } }

/* ─── Badges ────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: .2rem .6rem; border-radius: 999px;
  font-size: .78125rem; font-weight: 600;
}
.badge-pending { background: var(--warning-light); color: #92400E; }
.badge-completed { background: var(--success-light); color: #065F46; }
.badge-overdue { background: var(--danger-light); color: #991B1B; }
.badge-locked { background: #1F2937; color: #F9FAFB; }
.task-item.status-locked { border-right-color: #1F2937; opacity: .75; }
.task-value-badge.locked-penalty { background: #7F1D1D; color: #FFF; }
.badge-pending_approval { background: #EDE9FE; color: #5B21B6; }

/* ─── Avatar ────────────────────────────────────────────────────────────────── */
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .875rem; font-weight: 700; color: #fff; flex-shrink: 0;
}
.avatar-lg { width: 48px; height: 48px; font-size: 1.125rem; }

/* ─── Modal ─────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,.45); backdrop-filter: blur(4px);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--card); border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 1.5rem; width: 100%; max-width: 540px;
  max-height: 90vh; overflow-y: auto;
  transform: translateY(20px); transition: transform .25s ease;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.25rem; padding-bottom: .75rem; border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 1.125rem; font-weight: 700; }
.modal-close {
  background: var(--bg); border: none; cursor: pointer;
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; color: var(--text-muted); transition: background .15s;
}
.modal-close:hover { background: var(--border); }

@media (min-width: 600px) {
  .modal-overlay { align-items: center; }
  .modal { border-radius: var(--radius-lg); max-height: 80vh; }
}

/* ─── Tabs ──────────────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 4px; background: var(--bg); border-radius: var(--radius-sm); padding: 4px; }
.tab-btn {
  flex: 1; padding: .45rem .75rem; border-radius: 6px;
  border: none; cursor: pointer; font-size: .875rem; font-weight: 500;
  background: transparent; color: var(--text-muted); transition: all .15s;
}
.tab-btn.active { background: var(--card); color: var(--primary); font-weight: 600; box-shadow: var(--shadow); }

/* ─── Toast ─────────────────────────────────────────────────────────────────── */
#toast-container {
  position: fixed; top: 1rem; left: 50%; transform: translateX(-50%);
  z-index: 9999; display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  background: #1E293B; color: #fff;
  padding: .65rem 1.25rem; border-radius: var(--radius-sm);
  font-size: .9375rem; font-weight: 500;
  animation: toastIn .25s ease forwards;
  pointer-events: all; max-width: 360px; text-align: center;
  display: flex; align-items: center; gap: 8px;
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-warning { background: var(--warning); color: #1E293B; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─── Login Page ────────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 50%, #EC4899 100%);
}
.login-card {
  background: var(--card); border-radius: var(--radius-lg);
  padding: 2.5rem 2rem; width: 100%; max-width: 380px;
  box-shadow: var(--shadow-lg);
}
.login-logo {
  text-align: center; margin-bottom: 1.75rem;
  font-size: 3rem; line-height: 1;
}
.login-title { font-size: 1.625rem; font-weight: 700; text-align: center; margin-bottom: .35rem; }
.login-subtitle { text-align: center; margin-bottom: 1.75rem; }

/* ─── App Shell ─────────────────────────────────────────────────────────────── */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }

/* ─── Header ────────────────────────────────────────────────────────────────── */
.app-header {
  background: linear-gradient(135deg, var(--primary) 0%, #7C3AED 100%);
  color: #fff; padding: .875rem 1.25rem;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 8px rgba(79,70,229,.3);
}
.header-brand { display: flex; align-items: center; gap: .5rem; }
.header-brand h1 { font-size: 1.125rem; font-weight: 700; }
.header-brand span { font-size: 1.5rem; }
.header-actions { display: flex; align-items: center; gap: .75rem; }
.header-btn {
  background: rgba(255,255,255,.15); border: none; color: #fff;
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 1rem; transition: background .15s;
  position: relative;
}
.header-btn:hover { background: rgba(255,255,255,.25); }
.notif-badge {
  position: absolute; top: -3px; right: -3px;
  background: var(--danger); color: #fff;
  width: 18px; height: 18px; border-radius: 50%;
  font-size: .65rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--primary);
}

/* ─── Nav Tabs ───────────────────────────────────────────────────────────────── */
.nav-tabs {
  display: flex; background: var(--card); border-bottom: 1px solid var(--border);
  position: sticky; top: 60px; z-index: 99; overflow-x: auto;
  scrollbar-width: none;
}
.nav-tabs::-webkit-scrollbar { display: none; }
.nav-tab {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: .6rem 1.1rem; border: none; background: none; cursor: pointer;
  font-size: .8125rem; font-weight: 500; color: var(--text-muted);
  white-space: nowrap; border-bottom: 2.5px solid transparent;
  transition: all .15s; flex-shrink: 0;
}
.nav-tab .nav-icon { font-size: 1.1rem; }
.nav-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ─── Main Content ────────────────────────────────────────────────────────────── */
.main-content { flex: 1; padding: 1rem; max-width: 900px; margin: 0 auto; width: 100%; }

/* ─── Sections ───────────────────────────────────────────────────────────────── */
.section { display: none; }
.section.active { display: block; }

/* ─── Summary Cards ──────────────────────────────────────────────────────────── */
.summary-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem;
  margin-bottom: 1.25rem;
}
@media (min-width: 600px) { .summary-grid { grid-template-columns: repeat(4, 1fr); } }
.summary-card {
  background: var(--card); border-radius: var(--radius);
  padding: 1rem; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 4px;
}
.card-link { cursor: pointer; transition: transform .12s, box-shadow .12s; }
.card-link:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,.12); }
.card-link:active { transform: translateY(0); }
.summary-card .s-num { font-size: 1.875rem; font-weight: 800; line-height: 1; }
.summary-card .s-label { font-size: .8125rem; color: var(--text-muted); font-weight: 500; }
.s-primary { border-top: 3px solid var(--primary); }
.s-primary .s-num { color: var(--primary); }
.s-success { border-top: 3px solid var(--success); }
.s-success .s-num { color: var(--success); }
.s-danger { border-top: 3px solid var(--danger); }
.s-danger .s-num { color: var(--danger); }
.s-warning { border-top: 3px solid var(--warning); }
.s-warning .s-num { color: var(--warning); }
.s-approval { border-top: 3px solid #8B5CF6; }
.s-approval .s-num { color: #8B5CF6; }

/* ─── Task List ──────────────────────────────────────────────────────────────── */
.task-list { display: flex; flex-direction: column; gap: .5rem; }
.task-item {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: .85rem 1rem;
  display: flex; align-items: center; gap: .75rem;
  transition: box-shadow .15s, transform .15s;
  position: relative; overflow: hidden;
  border-right: 4px solid transparent;
}
.task-item:hover { box-shadow: var(--shadow-md); }
.task-item.status-completed { border-right-color: var(--success); opacity: .75; }
.task-item.status-overdue { border-right-color: var(--danger); }
.task-item.status-pending { border-right-color: var(--warning); }
.task-item.status-pending_approval { border-right-color: #8B5CF6; background: #FAFAFF; }
.task-icon { font-size: 1.375rem; flex-shrink: 0; }
.task-info { flex: 1; min-width: 0; }
.task-title { font-weight: 600; font-size: .9375rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-meta { font-size: .8125rem; color: var(--text-muted); display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.task-actions { display: flex; gap: .4rem; flex-shrink: 0; }
.task-check-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 2.5px solid var(--border);
  background: transparent; cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 1.125rem; transition: all .2s;
}
.task-check-btn:hover { border-color: var(--success); background: var(--success-light); }
.task-check-btn.checked { background: var(--success); border-color: var(--success); color: #fff; }
.task-done-line { position: absolute; inset: 0; pointer-events: none; }
.task-item.status-completed .task-title { text-decoration: line-through; color: var(--text-muted); }

/* ─── Child Groups (All Tasks view) ──────────────────────────────────────────── */
.child-group { display: flex; flex-direction: column; gap: .375rem; }
.child-group-header {
  display: flex; align-items: center; gap: .6rem;
  padding: .5rem .75rem;
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  position: sticky; top: 0; z-index: 1;
}
.child-group-name { font-weight: 700; font-size: 1rem; flex: 1; }
.child-group-count {
  font-size: .8rem; color: var(--text-muted);
  background: var(--border); border-radius: 999px;
  padding: .1rem .55rem;
}
.child-group-tasks { display: flex; flex-direction: column; gap: .375rem; padding-bottom: .5rem; }

/* ─── User Cards ─────────────────────────────────────────────────────────────── */
.user-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .75rem; }
.user-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.1rem; cursor: pointer; transition: box-shadow .15s, transform .15s;
  display: flex; flex-direction: column; align-items: center; gap: .6rem; text-align: center;
}
.user-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.user-card .user-name { font-weight: 700; font-size: .9375rem; }
.user-card .user-role { font-size: .8125rem; color: var(--text-muted); }
.user-stats { display: flex; gap: .75rem; justify-content: center; width: 100%; }
.user-stat { display: flex; flex-direction: column; align-items: center; }
.user-stat .stat-n { font-size: 1.25rem; font-weight: 700; }
.user-stat .stat-l { font-size: .75rem; color: var(--text-muted); }

/* ─── Notification Panel ─────────────────────────────────────────────────────── */
.notif-list { display: flex; flex-direction: column; gap: .5rem; }
.notif-item {
  display: flex; align-items: flex-start; gap: .75rem;
  padding: .85rem 1rem; background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); cursor: pointer;
  transition: background .15s;
}
.notif-item.unread { background: #EEF2FF; border-right: 3px solid var(--primary); }
.notif-item:hover { background: var(--bg); }
.notif-item.notif-clickable:hover { background: #F0F4FF; }
.notif-icon { font-size: 1.375rem; flex-shrink: 0; margin-top: 2px; }
.notif-title { font-weight: 600; font-size: .875rem; }
.notif-body { font-size: .8125rem; color: var(--text-muted); }
.notif-time { font-size: .75rem; color: var(--text-muted); margin-top: 2px; }
.notif-arrow { font-size: 1rem; color: var(--primary); opacity: .6; align-self: center; margin-right: auto; }
.notif-item.notif-clickable .notif-arrow { opacity: 1; }

/* highlight flash when navigating to a task */
@keyframes flash-highlight {
  0%   { box-shadow: 0 0 0 3px #6366F1; background: #EEF2FF; }
  60%  { box-shadow: 0 0 0 3px #6366F1; background: #EEF2FF; }
  100% { box-shadow: none; background: ''; }
}
.highlight-flash { animation: flash-highlight 2s ease forwards; }

/* ─── View Toggle ────────────────────────────────────────────────────────────── */
.view-toggle {
  display: flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden;
}
.view-btn {
  background: var(--card); border: none; padding: .3rem .7rem; font-size: .8rem;
  font-weight: 600; color: var(--text-muted); cursor: pointer; transition: background .15s, color .15s;
  font-family: inherit;
}
.view-btn.active { background: var(--primary); color: #fff; }
.view-btn:not(.active):hover { background: var(--bg); }

/* ─── Avatar Emoji Picker ────────────────────────────────────────────────────── */
.avatar-picker { display:flex; flex-direction:column; gap:.55rem; }
.avatar-picker-group { display:flex; align-items:center; gap:.65rem; }
.picker-group-label { font-size:.78rem; color:var(--text-muted); width:54px; flex-shrink:0; }
.picker-options { display:flex; gap:.4rem; }
.avatar-opt {
  width:46px; height:46px; font-size:1.65rem;
  border-radius:10px; border:2px solid var(--border);
  background:var(--bg); cursor:pointer;
  display:flex; align-items:center; justify-content:center;
  transition:border-color .15s, transform .12s, box-shadow .12s;
  line-height:1;
}
.avatar-opt:hover { border-color:var(--primary); transform:scale(1.1); }
.avatar-opt.selected {
  border-color:var(--primary);
  background:#EEF2FF;
  box-shadow:0 0 0 2px var(--primary);
  transform:scale(1.08);
}
.age-badge {
  display:inline-flex; align-items:center; justify-content:center;
  background:#EEF2FF; color:#4F46E5;
  border-radius:20px; font-size:.68rem; font-weight:700;
  padding:.1rem .5rem; line-height:1.5;
}
.emoji-avatar {
  background: transparent !important;
  font-size: 1.5rem !important;
  line-height: 1;
}

/* ─── Recurring Tasks Grouped by Child ──────────────────────────────────────── */
.rec-child-group {
  margin-bottom: 1.25rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.rec-child-header {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .65rem 1rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.rec-child-name {
  font-weight: 700;
  font-size: .95rem;
  flex: 1;
}
.rec-child-count {
  font-size: .75rem;
  color: var(--text-muted);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: .1rem .55rem;
}
.rec-child-tasks .task-item {
  border-radius: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}
.rec-child-tasks .task-item:last-child {
  border-bottom: none;
}

/* ─── Weekly Board ───────────────────────────────────────────────────────────── */
.wb-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.wb-table {
  border-collapse: collapse; width: 100%; min-width: 640px;
  table-layout: fixed;
}
.wb-th-child {
  width: 90px; padding: .4rem .5rem; text-align: right;
  background: var(--card); position: sticky; right: 0; z-index: 2;
  border-bottom: 2px solid var(--border);
}
.wb-th-day {
  padding: .4rem .3rem; text-align: center;
  background: var(--card); border-bottom: 2px solid var(--border);
  border-right: 1px solid var(--border);
}
.wb-day-name { font-size: .85rem; font-weight: 800; color: var(--text); }
.wb-day-date { font-size: .72rem; color: var(--text-muted); }
.wb-today-col { background: #EEF2FF !important; }
.wb-th-day.wb-today-col .wb-day-name { color: var(--primary); }

.wb-td-child {
  padding: .6rem .5rem; background: var(--card);
  position: sticky; right: 0; z-index: 1;
  display: flex; align-items: center; gap: .5rem;
  vertical-align: middle;
  border-left: 1px solid var(--border);
}
.wb-child-name { font-size: .82rem; font-weight: 700; white-space: nowrap; }

/* Row separator — thick top border between children */
.wb-table tbody tr { border-top: 3px solid var(--border); }
.wb-table tbody tr:first-child { border-top: none; }

/* Alternating row backgrounds */
.wb-table tbody tr:nth-child(odd)  td.wb-td-cell { background: #FAFAFA; }
.wb-table tbody tr:nth-child(even) td.wb-td-cell { background: #FFFFFF; }
.wb-table tbody tr:nth-child(odd)  td.wb-td-child { background: #FAFAFA; }
.wb-table tbody tr:nth-child(even) td.wb-td-child { background: #FFFFFF; }

/* Today column stays highlighted regardless of row stripe */
.wb-td-cell.wb-today-col {
  background: rgba(99,102,241,.07) !important;
}

.wb-td-cell {
  vertical-align: top; padding: .45rem .35rem;
  border-right: 1px solid var(--border);
  min-height: 64px;
}

/* Mini task card inside the board */
.wb-card {
  background: var(--card); border-radius: 6px;
  border-right: 3px solid #6366F1;
  padding: .3rem .4rem; margin-bottom: .3rem;
  cursor: pointer; font-size: .75rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.07);
  transition: box-shadow .12s;
}
.wb-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.13); }
.wb-card-top { display: flex; align-items: center; gap: .3rem; }
.wb-card-icon { font-size: .95rem; flex-shrink: 0; }
.wb-card-title { font-weight: 700; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wb-card-meta { display: flex; align-items: center; gap: .25rem; flex-wrap: wrap; margin-top: .2rem; }
.wb-card-time { font-size: .68rem; color: var(--text-muted); }
.wb-val  { font-size: .68rem; font-weight: 700; color: #059669; }
.wb-hw   { font-size: .72rem; }
.wb-appeal { font-size: .72rem; }

/* Drag & Drop */
.wb-card[draggable="true"] { cursor: grab; }
.wb-card[draggable="true"]:active { cursor: grabbing; }
.wb-card.wb-dragging { opacity: .35; transform: scale(.96); transition: opacity .1s; }
.wb-td-cell.wb-drag-over {
  background: rgba(99,102,241,.15) !important;
  outline: 2px dashed #6366F1;
  outline-offset: -3px;
}

/* Planned recurring card */
.wb-card.wb-planned {
  border-right-color: #94A3B8;
  background: #F8FAFC;
  border-style: dashed;
  opacity: .85;
}
.wb-card.wb-planned .wb-card-title { color: #475569; }
.wb-planned-badge {
  font-size: .65rem; font-weight: 600;
  background: #E2E8F0; color: #475569;
  border-radius: 4px; padding: .05rem .3rem;
}

/* ─── Empty State ─────────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 3rem 1rem;
  display: flex; flex-direction: column; align-items: center; gap: .75rem;
}
.empty-state .empty-icon { font-size: 3.5rem; }
.empty-state h3 { font-size: 1.125rem; font-weight: 700; }
.empty-state p { max-width: 260px; }

/* ─── Progress Bar ────────────────────────────────────────────────────────────── */
.progress { height: 8px; background: var(--border); border-radius: 999px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--success); border-radius: 999px; transition: width .4s ease; }

/* ─── Child Page Specific ─────────────────────────────────────────────────────── */
.child-header {
  background: linear-gradient(135deg, var(--primary) 0%, #7C3AED 100%);
  padding: 1.5rem 1.25rem;
  color: #fff;
}
.child-greeting { font-size: 1.5rem; font-weight: 700; margin-bottom: .25rem; }
.child-date { font-size: .9375rem; opacity: .85; margin-bottom: 1rem; }
.child-progress-wrap { background: rgba(255,255,255,.15); border-radius: var(--radius); padding: .85rem 1rem; }
.child-progress-label { font-size: .875rem; margin-bottom: .5rem; display: flex; justify-content: space-between; }
.child-progress .progress { background: rgba(255,255,255,.3); }
.child-progress .progress-bar { background: #fff; }

.big-check {
  width: 52px; height: 52px; border-radius: 50%;
  border: 2.5px solid var(--border);
  background: transparent; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.375rem; transition: all .2s; flex-shrink: 0;
}
.big-check:hover { border-color: var(--success); background: var(--success-light); }
.big-check.done { background: var(--success); border-color: var(--success); color: #fff; }
.big-check.done:hover { background: var(--success); }
.big-check.pending-approval { background: #EDE9FE; border-color: #8B5CF6; color: #8B5CF6; font-size: 1.5rem; cursor: default; }

.task-deadline {
  font-size: .8125rem;
  padding: .15rem .5rem; border-radius: 999px;
}
.task-deadline.soon { background: var(--warning-light); color: #92400E; }
.task-deadline.overdue { background: var(--danger-light); color: #991B1B; }
.task-deadline.normal { background: var(--bg); color: var(--text-muted); }

/* ─── Section Headers ─────────────────────────────────────────────────────────── */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: .875rem;
}
.section-title { font-size: 1rem; font-weight: 700; display: flex; align-items: center; gap: .4rem; }

/* ─── Search & Filters ────────────────────────────────────────────────────────── */
.filter-bar { display: flex; gap: .5rem; margin-bottom: .75rem; flex-wrap: wrap; }
.filter-chip {
  padding: .3rem .75rem; border-radius: 999px; border: 1.5px solid var(--border);
  font-size: .8125rem; font-weight: 500; cursor: pointer;
  background: var(--card); color: var(--text-muted); transition: all .15s;
}
.filter-chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ─── Spinner ─────────────────────────────────────────────────────────────────── */
.spinner {
  width: 24px; height: 24px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--primary);
  animation: spin .7s linear infinite; margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-wrap { display: flex; justify-content: center; padding: 2rem; }

/* ─── History Table ───────────────────────────────────────────────────────────── */
.history-list { display: flex; flex-direction: column; gap: .4rem; }
.history-item {
  display: flex; align-items: center; gap: .6rem;
  padding: .6rem .85rem; background: var(--card);
  border-radius: var(--radius-sm); font-size: .875rem;
}

/* ─── Recurrence Selector ─────────────────────────────────────────────────────── */
.day-picker { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .35rem; }
.day-btn {
  width: 36px; height: 36px; border-radius: 50%; border: 1.5px solid var(--border);
  background: var(--card); cursor: pointer; font-size: .8125rem; font-weight: 600;
  color: var(--text-muted); transition: all .15s;
}
.day-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ─── Recurring Assignment Rows ───────────────────────────────────────────────── */
.modal-lg { max-width: 680px; }
.rec-assignment-row {
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  padding: .85rem; margin-bottom: .75rem; background: var(--bg); position: relative;
}
.rec-assignment-row .asgn-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: .6rem;
}
.rec-assignment-row .asgn-title { font-size: .875rem; font-weight: 700; color: var(--text); }
.rec-assignment-row .asgn-remove {
  background: none; border: none; cursor: pointer; color: var(--danger, #dc2626);
  font-size: 1.1rem; line-height: 1; padding: .1rem .3rem; border-radius: 4px;
}
.rec-assignment-row .asgn-remove:hover { background: #fee2e2; }
.asgn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
@media (max-width: 480px) { .asgn-grid { grid-template-columns: 1fr; } }

/* ─── Icon Picker ─────────────────────────────────────────────────────────────── */
.icon-grid { display: flex; flex-wrap: wrap; gap: .5rem; padding: .5rem 0; }
.icon-opt {
  width: 40px; height: 40px; border-radius: var(--radius-sm); border: 1.5px solid var(--border);
  background: var(--bg); cursor: pointer; font-size: 1.375rem;
  display: flex; align-items: center; justify-content: center; transition: all .15s;
}
.icon-opt:hover, .icon-opt.active { border-color: var(--primary); background: #EEF2FF; }

/* ─── Mobile Bottom FAB ───────────────────────────────────────────────────────── */
.fab {
  position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%);
  z-index: 200;
}
.fab-btn {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--primary); color: #fff; border: none; cursor: pointer;
  font-size: 1.5rem; box-shadow: var(--shadow-lg);
  display: flex; align-items: center; justify-content: center;
  transition: transform .15s, background .15s;
}
.fab-btn:hover { background: var(--primary-dark); transform: scale(1.05); }
.fab-btn:active { transform: scale(.95); }

/* ─── Color Picker ────────────────────────────────────────────────────────────── */
.color-grid { display: flex; gap: .5rem; flex-wrap: wrap; padding: .35rem 0; }
.color-opt {
  width: 32px; height: 32px; border-radius: 50%; cursor: pointer;
  border: 3px solid transparent; transition: border .15s;
}
.color-opt.active, .color-opt:hover { border-color: var(--text); }

/* ─── Scrollbar Customization ─────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ─── Responsive ──────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .card { padding: 1rem; }
  .main-content { padding: .75rem; }
  .hide-mobile { display: none !important; }

  /* ── Task cards: stack actions below info ── */
  .task-item {
    flex-wrap: wrap;
    align-items: flex-start;
    padding: .6rem .75rem;
    gap: .3rem .6rem;
  }
  .task-icon { margin-top: .1rem; flex-shrink: 0; }
  .task-info { flex: 1; min-width: 0; }
  .task-title { white-space: normal; font-size: .875rem; }
  .task-meta { font-size: .75rem; gap: .3rem; }
  .task-meta .task-created-at { display: none; }
  .task-meta .badge { font-size: .68rem; padding: .12rem .4rem; }
  .task-actions {
    width: 100%;
    display: flex;
    gap: .35rem;
    flex-wrap: nowrap;
    padding-top: .25rem;
  }
  .task-actions .btn-approve {
    flex: 1;
    font-size: .75rem;
    padding: .38rem .5rem;
    min-width: 0;
  }
  .task-actions .btn-reject {
    flex-shrink: 0;
    font-size: .75rem;
    padding: .38rem .55rem;
    width: auto;
    height: auto;
  }
  .task-actions .btn-ghost,
  .task-actions .btn-danger,
  .task-actions .btn-success {
    font-size: .75rem;
    padding: .38rem .55rem;
  }
}
@media (min-width: 601px) {
  .hide-desktop { display: none !important; }
}

/* ─── Animations ──────────────────────────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn .25s ease; }

@keyframes checkBounce {
  0% { transform: scale(.8); }
  60% { transform: scale(1.2); }
  100% { transform: scale(1); }
}
.check-bounce { animation: checkBounce .3s ease; }

/* ─── Finances / Balance ──────────────────────────────────────────────────────── */
.balance-grid { display: flex; flex-direction: column; gap: .75rem; }
.balance-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: .6rem;
}
.balance-card-header { display: flex; align-items: center; gap: .65rem; }
.balance-card-name { flex: 1; font-weight: 700; font-size: 1rem; }
.balance-amount { font-size: 1.375rem; font-weight: 800; }
.balance-bar-wrap { height: 8px; background: var(--border); border-radius: 999px; overflow: hidden; }
.balance-bar-fill { height: 100%; border-radius: 999px; transition: width .4s ease; }
.balance-card-footer { display: flex; align-items: center; justify-content: space-between; }
.balance-earned-row {
  display: flex; align-items: center; justify-content: space-between;
  font-size: .8rem; color: var(--text-muted);
  padding: .35rem .1rem;
  border-top: 1px solid var(--border);
  margin-top: .2rem;
}
.balance-earned-val { font-weight: 700; color: #059669; }
/* Selective reset modal */
.reset-opt { display:flex; align-items:flex-start; gap:.65rem; background:var(--bg); border:1.5px solid var(--border); border-radius:var(--radius); padding:.65rem .75rem; cursor:pointer; transition:border-color .15s; }
.reset-opt:has(input:checked) { border-color: var(--primary); background: #EEF2FF; }
.reset-opt input[type=checkbox] { margin-top:.2rem; accent-color: var(--primary); width:16px; height:16px; flex-shrink:0; cursor:pointer; }
.reset-opt-icon { font-size:1.25rem; flex-shrink:0; }
.reset-opt-sub { font-size:.78rem; color:var(--text-muted); margin-top:.1rem; }
.tx-list { border-top: 1px solid var(--border); padding-top: .5rem; display: flex; flex-direction: column; gap: .3rem; }
.tx-item { display: flex; align-items: center; gap: .5rem; font-size: .8125rem; padding: .25rem 0; }
.tx-amount { font-weight: 700; min-width: 40px; text-align: left; }
.tx-desc { flex: 1; color: var(--text-muted); }
.tx-date { color: var(--text-muted); white-space: nowrap; font-size: .75rem; }

.payout-alert {
  background: #F5F3FF; border: 1px solid #DDD6FE; border-radius: var(--radius);
  padding: .85rem 1rem; display: flex; align-items: center; justify-content: space-between; gap: .75rem;
}
.payout-alert-info { display: flex; align-items: center; gap: .65rem; flex: 1; }

/* ─── Settings Section ─────────────────────────────────────────────────────── */
.settings-tab-btn {
  padding: .42rem .9rem; border-radius: 20px;
  border: 1.5px solid var(--border); background: var(--card);
  font-size: .83rem; font-weight: 600; cursor: pointer;
  color: var(--text-muted); transition: all .15s; font-family: inherit;
}
.settings-tab-btn:hover { border-color: var(--primary); color: var(--primary); }
.settings-tab-btn.active {
  background: var(--primary); color: #fff; border-color: var(--primary);
}
.plan-feat-tag {
  display: inline-flex; align-items: center; gap: .25rem;
  font-size: .72rem; font-weight: 600;
  padding: .15rem .48rem; border-radius: 20px;
  background: #EFF6FF; color: #1D4ED8;
}
.plan-feat-tag.all { background: #EDE9FE; color: #5B21B6; }

/* ── Premium badges & upgrade UI ─────────────────────────────────────────── */
.premium-tag {
  display: inline-block;
  background: linear-gradient(90deg, #F59E0B, #EF4444);
  color: #fff;
  font-size: .62rem;
  font-weight: 700;
  padding: .1rem .4rem;
  border-radius: 8px;
  vertical-align: middle;
  letter-spacing: .02em;
  margin-inline-start: .3rem;
}

.plan-chip {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .2rem .65rem;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 700;
}
.plan-chip.free    { background: #F3F4F6; color: #374151; }
.plan-chip.premium { background: linear-gradient(90deg,#F59E0B,#EF4444); color: #fff; }

/* ── Toggle Switch ────────────────────────────────────────────────────────── */
.toggle-switch {
  position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; cursor: pointer; inset: 0;
  background: #D1D5DB; border-radius: 24px; transition: .2s;
}
.toggle-slider::before {
  content: ''; position: absolute;
  width: 18px; height: 18px; left: 3px; bottom: 3px;
  background: #fff; border-radius: 50%; transition: .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle-switch input:checked + .toggle-slider { background: #4F46E5; }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ─── Avatar more-btn + popup ────────────────────────────────────────────────── */
.avatar-more-btn {
  height: 46px; padding: 0 .75rem;
  border-radius: 10px; border: 2px dashed var(--border);
  background: var(--bg); cursor: pointer; font-size: .8rem;
  font-weight: 700; color: var(--primary); font-family: 'Rubik', sans-serif;
  white-space: nowrap; line-height: 1;
}
.avatar-more-btn:hover { border-color: var(--primary); background: #EEF2FF; }
.avatar-popup-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,.55);
  align-items: center; justify-content: center;
}
.avatar-popup-box {
  background: #fff; border-radius: 20px;
  padding: 1.1rem; width: min(340px, 90vw);
  max-height: 80vh; overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
}
.avatar-popup-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: .85rem;
}
.avatar-popup-title { font-size: .95rem; font-weight: 700; color: #111827; }
.avatar-popup-close {
  width: 28px; height: 28px; border-radius: 50%;
  border: none; background: #F3F4F6; cursor: pointer;
  font-size: .85rem; display: flex; align-items: center; justify-content: center;
  font-family: 'Rubik', sans-serif;
}
.avatar-popup-grid { display: flex; flex-wrap: wrap; gap: .45rem; }


/* ─── FAB ripple + bee animations ───────────────────────────────────────────── */
@keyframes ripple {
  0%   { transform: scale(1); opacity: .55; }
  100% { transform: scale(2.1); opacity: 0; }
}
@keyframes beeBob {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-3px); }
}
.fab::before,
.fab::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(124, 58, 237, .38);
  animation: ripple 2s ease-out infinite;
  pointer-events: none;
}
.fab::after {
  animation-delay: 1s;
}
.fab-bee {
  position: absolute;
  top: -7px;
  left: -3px;
  font-size: .7rem;
  line-height: 1;
  animation: beeBob 1.5s ease-in-out infinite;
  pointer-events: none;
  user-select: none;
}

/* ─── Request-task button pulse glow ────────────────────────────────────────── */
@keyframes beelyPulse {
  0%      { transform: scale(1);    box-shadow: 0 0 0 0    rgba(139,92,246,.5); }
  6.67%   { transform: scale(1.06); box-shadow: 0 0 0 12px rgba(139,92,246,0);  }
  10%     { transform: scale(1);    box-shadow: 0 0 0 0    rgba(139,92,246,.5); }
  16.67%  { transform: scale(1.06); box-shadow: 0 0 0 12px rgba(139,92,246,0);  }
  18.33%  { transform: scale(1);    box-shadow: 0 0 0 0    rgba(139,92,246,0);  }
  100%    { transform: scale(1);    box-shadow: 0 0 0 0    rgba(139,92,246,0);  }
}
