/* ===== FAMILY TRACKER STYLES ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #6366f1;
  --primary-light: #eef2ff;
  --sidebar-width: 260px;
  --header-h: 64px;
  --radius: 16px;
  --shadow: 0 4px 24px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.14);
  --zach: #3b82f6;
  --haven: #ec4899;
  --leo: #10b981;
  --lennon: #f59e0b;
  --grandma: #8b5cf6;
  --baby: #06b6d4;
}

body {
  font-family: 'Nunito', sans-serif;
  background: #f8fafc;
  color: #1e293b;
  min-height: 100vh;
}

/* ===== LAYOUT ===== */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #1e1b4b 0%, #312e81 100%);
  position: fixed; left: 0; top: 0; bottom: 0;
  z-index: 100; overflow-y: auto;
  display: flex; flex-direction: column;
  transition: transform 0.3s ease;
}

.sidebar-logo {
  padding: 24px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-logo .logo-text {
  font-size: 20px; font-weight: 900; color: white;
}
.sidebar-logo .logo-emoji { font-size: 32px; display: block; margin-bottom: 8px; }

.sidebar-nav { flex: 1; padding: 12px 0; }

.nav-section-title {
  padding: 8px 20px; font-size: 11px; font-weight: 700;
  color: rgba(255,255,255,0.4); text-transform: uppercase; letter-spacing: 0.1em;
}

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px; cursor: pointer; transition: all 0.2s;
  color: rgba(255,255,255,0.7); text-decoration: none;
  font-size: 15px; font-weight: 600; border: none; background: none;
  width: 100%; text-align: left;
}
.nav-item:hover {
  background: rgba(255,255,255,0.1); color: white;
}
.nav-item.active {
  background: rgba(255,255,255,0.15); color: white;
  border-left: 3px solid #818cf8;
}
.nav-item .nav-icon { font-size: 20px; width: 28px; text-align: center; }
.nav-item .nav-badge {
  margin-left: auto; background: #ef4444; color: white;
  font-size: 11px; font-weight: 800; padding: 2px 7px; border-radius: 20px;
}

.sidebar-user {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex; align-items: center; gap: 12px;
}
.sidebar-user .user-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; background: rgba(255,255,255,0.2);
}
.sidebar-user .user-name { font-weight: 700; color: white; font-size: 14px; }
.sidebar-user .user-role { font-size: 11px; color: rgba(255,255,255,0.5); }
.sidebar-user .btn-logout {
  margin-left: auto; background: rgba(255,255,255,0.1); border: none;
  color: rgba(255,255,255,0.7); padding: 6px 12px; border-radius: 8px;
  cursor: pointer; font-size: 13px; font-family: 'Nunito', sans-serif; font-weight: 600;
}
.sidebar-user .btn-logout:hover { background: rgba(255,255,255,0.2); color: white; }

.main-content {
  margin-left: var(--sidebar-width);
  flex: 1; min-height: 100vh;
  display: flex; flex-direction: column;
}

.top-bar {
  height: var(--header-h); background: white;
  border-bottom: 1px solid #e2e8f0;
  display: flex; align-items: center;
  padding: 0 28px; gap: 16px;
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 1px 8px rgba(0,0,0,0.06);
}
.top-bar .page-title {
  font-size: 20px; font-weight: 900; color: #1e293b; flex: 1;
}
.top-bar .top-date {
  font-size: 14px; color: #64748b; font-weight: 600;
}
.hamburger {
  display: none; background: none; border: none; cursor: pointer;
  font-size: 24px; color: #475569;
}

.page-body { flex: 1; padding: 28px; }

/* ===== DASHBOARD ===== */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px; margin-bottom: 28px;
}
.stat-card {
  background: white; border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow); display: flex; align-items: center; gap: 16px;
}
.stat-icon {
  width: 52px; height: 52px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center; font-size: 24px;
}
.stat-info .stat-value { font-size: 28px; font-weight: 900; line-height: 1; }
.stat-info .stat-label { font-size: 13px; color: #64748b; font-weight: 600; margin-top: 2px; }

.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

.widget {
  background: white; border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.widget-header {
  padding: 18px 20px 14px;
  border-bottom: 1px solid #f1f5f9;
  display: flex; align-items: center; gap: 10px;
}
.widget-title { font-size: 16px; font-weight: 800; }
.widget-body { padding: 16px 20px; }

/* ===== SECTIONS ===== */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}
.section-title { font-size: 24px; font-weight: 900; }

/* ===== CARDS ===== */
.card-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.item-card {
  background: white; border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px;
  transition: all 0.2s; border-left: 4px solid #6366f1;
  display: flex; flex-direction: column; gap: 10px;
}
.item-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.item-card.completed { opacity: 0.65; border-left-color: #10b981; }
.item-card.high { border-left-color: #ef4444; }
.item-card.medium { border-left-color: #f59e0b; }
.item-card.low { border-left-color: #10b981; }

.card-title { font-size: 16px; font-weight: 800; color: #1e293b; }
.card-subtitle { font-size: 13px; color: #64748b; font-weight: 600; }
.card-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tag {
  padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 700;
  background: #f1f5f9; color: #475569;
}
.tag.primary { background: #eef2ff; color: #4338ca; }
.tag.success { background: #f0fdf4; color: #166534; }
.tag.warning { background: #fffbeb; color: #92400e; }
.tag.danger { background: #fef2f2; color: #991b1b; }

.card-actions { display: flex; gap: 8px; margin-top: 4px; }
.btn-sm {
  padding: 6px 14px; border-radius: 8px; border: none;
  font-size: 13px; font-weight: 700; font-family: 'Nunito', sans-serif;
  cursor: pointer; transition: all 0.15s;
}
.btn-sm.complete { background: #f0fdf4; color: #166534; }
.btn-sm.complete:hover { background: #10b981; color: white; }
.btn-sm.edit { background: #eef2ff; color: #4338ca; }
.btn-sm.edit:hover { background: #6366f1; color: white; }
.btn-sm.delete { background: #fef2f2; color: #991b1b; }
.btn-sm.delete:hover { background: #ef4444; color: white; }
.btn-sm.undo { background: #fffbeb; color: #92400e; }
.btn-sm.undo:hover { background: #f59e0b; color: white; }

/* ===== PRIMARY BUTTON ===== */
.btn-primary {
  padding: 12px 22px; border-radius: 12px; border: none;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white; font-size: 15px; font-weight: 800;
  font-family: 'Nunito', sans-serif; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  transition: all 0.2s;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(99,102,241,0.4); }

/* ===== FILTERS ===== */
.filter-bar {
  display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap;
}
.filter-chip {
  padding: 8px 16px; border-radius: 20px; border: 2px solid #e2e8f0;
  background: white; font-size: 14px; font-weight: 700;
  font-family: 'Nunito', sans-serif; cursor: pointer; transition: all 0.15s;
  color: #475569;
}
.filter-chip:hover { border-color: #6366f1; color: #6366f1; }
.filter-chip.active { background: #6366f1; border-color: #6366f1; color: white; }
select.filter-select {
  padding: 8px 16px; border-radius: 20px; border: 2px solid #e2e8f0;
  background: white; font-size: 14px; font-weight: 700;
  font-family: 'Nunito', sans-serif; cursor: pointer; color: #475569;
  outline: none; appearance: none; padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,0.5);
  z-index: 999; display: none; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: white; border-radius: 24px; width: 100%; max-width: 540px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 25px 60px rgba(0,0,0,0.3);
  animation: modalIn 0.25s ease;
}
@keyframes modalIn {
  from { transform: scale(0.9) translateY(20px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}
.modal-header {
  padding: 24px 28px 16px;
  border-bottom: 1px solid #f1f5f9;
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 20px; font-weight: 900; }
.modal-close {
  background: #f1f5f9; border: none; width: 36px; height: 36px;
  border-radius: 50%; cursor: pointer; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: #e2e8f0; }
.modal-body { padding: 20px 28px; }
.modal-footer { padding: 16px 28px 24px; display: flex; gap: 12px; justify-content: flex-end; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block; font-weight: 700; color: #374151;
  margin-bottom: 6px; font-size: 14px;
}
.form-control {
  width: 100%; padding: 11px 16px; border: 2px solid #e5e7eb;
  border-radius: 10px; font-size: 15px; font-family: 'Nunito', sans-serif;
  transition: border-color 0.2s; outline: none; color: #1e293b;
  background: white;
}
.form-control:focus { border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,0.12); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

textarea.form-control { resize: vertical; min-height: 80px; }

.btn-cancel {
  padding: 12px 22px; border-radius: 12px; border: 2px solid #e2e8f0;
  background: white; color: #475569; font-size: 15px; font-weight: 700;
  font-family: 'Nunito', sans-serif; cursor: pointer; transition: all 0.15s;
}
.btn-cancel:hover { background: #f1f5f9; }

/* ===== CALENDAR BASE — defined in full below the toolbar styles ===== */

/* ===== AUDIT LOG ===== */
.audit-item {
  display: flex; gap: 14px; padding: 12px 0;
  border-bottom: 1px solid #f1f5f9; align-items: flex-start;
}
.audit-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
  flex-shrink: 0;
}
.audit-text { flex: 1; }
.audit-text .audit-action { font-weight: 700; font-size: 14px; }
.audit-text .audit-detail { font-size: 12px; color: #94a3b8; margin-top: 2px; }

/* ===== MEMBER AVATARS ===== */
.member-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.member-chip {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 20px;
  font-size: 13px; font-weight: 700;
}

/* ===== PROGRESS ===== */
.progress-bar {
  height: 8px; background: #e2e8f0; border-radius: 4px; overflow: hidden;
}
.progress-fill {
  height: 100%; border-radius: 4px; transition: width 0.5s ease;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
}

/* ===== CHECKBOX ===== */
.custom-check {
  display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 8px 0;
}
.custom-check input[type=checkbox] { display: none; }
.check-box {
  width: 22px; height: 22px; border: 2px solid #d1d5db; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s; flex-shrink: 0; font-size: 14px;
}
.custom-check input:checked + .check-box {
  background: #10b981; border-color: #10b981; color: white;
}
.check-label { font-weight: 600; font-size: 14px; flex: 1; }
.check-label.done { text-decoration: line-through; color: #94a3b8; }

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center; padding: 60px 20px; color: #94a3b8;
}
.empty-state .empty-icon { font-size: 64px; margin-bottom: 16px; }
.empty-state .empty-title { font-size: 18px; font-weight: 800; color: #475569; margin-bottom: 8px; }
.empty-state .empty-text { font-size: 14px; }

/* ===== TOAST ===== */
.toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
.toast {
  padding: 14px 20px; border-radius: 14px; font-weight: 700; font-size: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
  pointer-events: auto; max-width: 320px;
}
.toast.success { background: #059669; color: white; }
.toast.error { background: #dc2626; color: white; }
.toast.info { background: #2563eb; color: white; }
@keyframes toastIn { from { transform: translateX(100px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; pointer-events: none; } }

/* ===== REMINDER PULSE ===== */
.reminder-pulse {
  width: 12px; height: 12px; border-radius: 50%;
  background: #ef4444; animation: pulse 2s infinite;
  display: inline-block; margin-left: 6px;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.4); }
  50% { box-shadow: 0 0 0 8px rgba(239,68,68,0); }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .hamburger { display: block; }
  .page-body { padding: 12px; }
  .card-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .modal { border-radius: 16px; max-height: 92vh; }

  /* Calendar mobile */
  .calendar-grid { padding: 8px; gap: 1px; font-size: 11px; }
  .cal-day { min-height: 56px; padding: 3px; }
  .cal-day-num { font-size: 12px; }
  .cal-day.today .cal-day-num span { width: 20px; height: 20px; font-size: 11px; }
  .cal-event-dot { font-size: 9px; padding: 1px 3px; }
  #calMonthTitle { font-size: 15px; min-width: 100px; }
  .cal-view-btn { padding: 5px 8px; font-size: 12px; }
  .cal-type-btn { padding: 4px 8px; font-size: 11px; }
  .cal-acct-btn { padding: 4px 8px; font-size: 11px; }

  /* Section header stacks on mobile */
  .section-header { flex-direction: column; align-items: flex-start; }
  .section-header .btn-primary { align-self: flex-start; }

  /* Stats wrap to 2 columns on mobile */
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
  .stat-card { padding: 14px; gap: 10px; }
  .stat-icon { width: 42px; height: 42px; font-size: 20px; }
  .stat-info .stat-value { font-size: 22px; }

  /* Dashboard grid single column */
  .dashboard-grid { grid-template-columns: 1fr; }

  /* Cal conn row stacks on mobile */
  .cal-conn-row { flex-wrap: wrap; gap: 10px; }
  .cal-conn-actions { width: 100%; justify-content: flex-end; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat-card { padding: 10px 12px; }
  .stat-info .stat-value { font-size: 20px; }
  .stat-info .stat-label { font-size: 11px; }
  .cal-view-btn { padding: 4px 7px; font-size: 11px; }
  #calMonthTitle { font-size: 13px; }
}

.sidebar-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 99;
}
.sidebar-overlay.active { display: block; }

/* ===== SUBJECT COLORS ===== */
.subj-math { background: #fef3c7; color: #92400e; }
.subj-reading { background: #dbeafe; color: #1e40af; }
.subj-science { background: #d1fae5; color: #065f46; }
.subj-history { background: #fce7f3; color: #9d174d; }
.subj-art { background: #ede9fe; color: #5b21b6; }
.subj-pe { background: #dcfce7; color: #14532d; }
.subj-life_skills { background: #e0f2fe; color: #0c4a6e; }
.subj-other { background: #f3f4f6; color: #374151; }

/* ===== CATEGORY ICONS ===== */
.pet-dog { border-left-color: #a78bfa !important; }
.pet-cat { border-left-color: #f97316 !important; }

/* ===== LOADING ===== */
.loading-spinner {
  display: inline-block; width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: white; border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== UPCOMING EVENT LIST ===== */
.event-list-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 0;
  border-bottom: 1px solid #f1f5f9;
}
.event-list-item:last-child { border-bottom: none; }
.event-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.event-info .event-name { font-weight: 700; font-size: 14px; }
.event-info .event-when { font-size: 12px; color: #94a3b8; }

/* ===== SETTINGS — MEMBER EDIT ===== */
.settings-member-row {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 0; border-bottom: 1px solid #f1f5f9;
}
.settings-member-row:last-child { border-bottom: none; }
.settings-member-avatar {
  width: 46px; height: 46px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; flex-shrink: 0;
}
.settings-member-info { flex: 1; min-width: 0; }
.settings-member-name { font-weight: 800; font-size: 15px; color: #1e293b; }
.settings-member-type { font-size: 12px; color: #94a3b8; margin-top: 2px; }
.btn-edit-member {
  background: #f1f5f9; border: none; border-radius: 8px;
  padding: 7px 14px; font-size: 13px; font-weight: 700;
  color: #6366f1; cursor: pointer; display: flex; align-items: center; gap: 5px;
  transition: background 0.15s;
}
.btn-edit-member:hover { background: #e0e7ff; }

/* Emoji picker swatches */
.emoji-pick {
  font-size: 24px; cursor: pointer; padding: 4px;
  border-radius: 8px; transition: background 0.1s; line-height: 1;
  display: inline-block;
}
.emoji-pick:hover { background: #e2e8f0; }

/* Color swatches */
.color-swatch {
  display: inline-block; width: 28px; height: 28px;
  border-radius: 50%; cursor: pointer; border: 2px solid transparent;
  transition: transform 0.15s, border-color 0.15s;
}
.color-swatch:hover { transform: scale(1.2); border-color: #6366f1; }

/* Password cards responsive */
@media (max-width: 640px) {
  #passwordCards { grid-template-columns: 1fr !important; }
}

/* ===== LOCATION AUTOCOMPLETE ===== */
.location-suggestions {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: white; border: 2px solid #e2e8f0; border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12); z-index: 9999;
  max-height: 260px; overflow-y: auto;
}
.location-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 14px; cursor: pointer; transition: background 0.12s;
  border-bottom: 1px solid #f1f5f9;
}
.location-item:last-child { border-bottom: none; }
.location-item:hover { background: #f0f9ff; }
.location-pin { font-size: 18px; flex-shrink: 0; margin-top: 2px; }
.location-name { font-weight: 700; font-size: 14px; color: #1e293b; }
.location-addr { font-size: 12px; color: #94a3b8; margin-top: 2px; }

/* ===== CONNECTED CALENDARS LIST ===== */
.cal-conn-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 0; border-bottom: 1px solid #f1f5f9;
}
.cal-conn-row:last-child { border-bottom: none; }
.cal-provider-badge {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.cal-conn-info { flex: 1; min-width: 0; }
.cal-conn-name { font-weight: 800; font-size: 14px; color: #1e293b; }
.cal-conn-meta { font-size: 12px; color: #94a3b8; margin-top: 2px; }
.cal-conn-actions { display: flex; gap: 6px; flex-shrink: 0; }
.btn-cal-manage {
  background: #f1f5f9; border: none; border-radius: 8px;
  padding: 6px 12px; font-size: 12px; font-weight: 700;
  color: #6366f1; cursor: pointer;
}
.btn-cal-manage:hover { background: #e0e7ff; }
.btn-cal-remove {
  background: #fff5f5; border: none; border-radius: 8px;
  padding: 6px 12px; font-size: 12px; font-weight: 700;
  color: #dc2626; cursor: pointer;
}
.btn-cal-remove:hover { background: #fee2e2; }

/* Calendar sub-calendar toggles */
.sub-cal-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid #f8fafc;
}
.sub-cal-dot {
  width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0;
}

/* External event labels on calendar */
.cal-event-dot.external {
  border-left: 3px solid rgba(0,0,0,0.15);
  opacity: 0.92;
}
.cal-event-source-tag {
  font-size: 9px; opacity: 0.75; font-weight: 800; letter-spacing: 0.5px;
  text-transform: uppercase; margin-left: 3px;
}

/* Calendar legend chips */
.cal-legend-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 700; color: #374151;
  background: #f8fafc; border-radius: 20px; padding: 3px 10px;
  border: 1px solid #e2e8f0;
}

/* ── Admin User Management ─────────────────────────────────── */
.admin-user-row {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 0; border-bottom: 1px solid #f1f5f9;
}
.admin-user-row:last-child { border-bottom: none; }

.admin-user-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}

.admin-user-info { flex: 1; min-width: 0; }
.admin-user-name { font-size: 14px; font-weight: 800; color: #1e293b; }
.admin-user-meta { font-size: 12px; color: #64748b; margin-top: 2px; }

/* Toggle switch for is_active */
.admin-toggle { position: relative; display: inline-block; width: 42px; height: 24px; }
.admin-toggle input { opacity: 0; width: 0; height: 0; }
.admin-toggle-slider {
  position: absolute; cursor: pointer; inset: 0;
  background: #cbd5e1; border-radius: 24px; transition: 0.2s;
}
.admin-toggle-slider::before {
  content: ''; position: absolute;
  width: 18px; height: 18px; left: 3px; bottom: 3px;
  background: white; border-radius: 50%; transition: 0.2s;
}
.admin-toggle input:checked + .admin-toggle-slider { background: #3b82f6; }
.admin-toggle input:checked + .admin-toggle-slider::before { transform: translateX(18px); }

/* Permissions grid inside modal */
.perms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}
.perm-chip {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 12px; border-radius: 8px;
  background: #f1f5f9; border: 1.5px solid #e2e8f0;
  font-size: 12px; font-weight: 600; color: #64748b;
  cursor: pointer; transition: all 0.15s; user-select: none;
}
.perm-chip input[type="checkbox"] { accent-color: #3b82f6; width: 13px; height: 13px; }
.perm-chip.checked {
  background: #eff6ff; border-color: #93c5fd; color: #1d4ed8;
}
.perm-chip:hover { border-color: #93c5fd; }

/* ── Shopping Lists ─────────────────────────────────────────── */
.shop-category-group { padding: 4px 0; }
.shop-category-label {
  font-size: 11px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.07em; color: #64748b;
  padding: 10px 20px 4px; background: #f8fafc;
  border-top: 1px solid #f1f5f9;
}
.shop-item-row {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 20px; border-bottom: 1px solid #f8fafc;
  transition: background 0.1s;
}
.shop-item-row:hover { background: #fafafa; }
.shop-item-done .shop-item-name {
  text-decoration: line-through; color: #94a3b8;
}

/* Custom checkbox */
.shop-check-label { display: flex; align-items: center; cursor: pointer; flex-shrink: 0; }
.shop-check-label input[type="checkbox"] { display: none; }
.shop-check-box {
  width: 22px; height: 22px; border-radius: 6px;
  border: 2px solid #cbd5e1; background: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; transition: all 0.15s; flex-shrink: 0;
}
.shop-check-label input:checked + .shop-check-box {
  background: #10b981; border-color: #10b981; color: white;
}
.shop-check-label input:checked + .shop-check-box::after { content: '✓'; }

.shop-item-name { flex: 1; font-size: 15px; font-weight: 600; color: #1e293b; }
.shop-qty-badge {
  font-size: 12px; font-weight: 800; color: #7c3aed;
  background: #f3e8ff; border-radius: 20px; padding: 2px 8px;
  flex-shrink: 0;
}
.shop-delete-btn {
  opacity: 0; background: none; border: none; cursor: pointer;
  color: #94a3b8; font-size: 14px; padding: 4px 6px;
  border-radius: 6px; transition: all 0.15s; flex-shrink: 0;
}
.shop-item-row:hover .shop-delete-btn { opacity: 1; }
.shop-delete-btn:hover { background: #fee2e2; color: #ef4444; }

/* ── Attachment Viewer Modal ── */
#attachmentViewerModal .modal {
  padding: 0;
}
#attachmentViewerBody img {
  display: block;
}

/* ── Work Portfolio ── */
.portfolio-thumb {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: transform 0.15s;
}
.portfolio-thumb:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

/* ── Calendar toolbar wrapper ── */
.cal-toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.cal-toolbar-nav {
  display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0;
}
#calMonthTitle {
  font-weight: 900; font-size: 18px; flex: 1;
  text-align: center; min-width: 120px; white-space: nowrap;
}

/* ── Calendar view + type buttons ── */
.cal-view-btn {
  padding: 6px 12px; border-radius: 8px; border: none; background: transparent;
  font-family: 'Nunito', sans-serif; font-size: 13px; font-weight: 700;
  color: #64748b; cursor: pointer; transition: all 0.15s; white-space: nowrap;
}
.cal-view-btn.active {
  background: white; color: #6366f1; box-shadow: 0 1px 4px rgba(0,0,0,.12);
}
.cal-view-btn:hover:not(.active) { background: #e2e8f0; }

.cal-type-btn {
  padding: 5px 11px; border-radius: 20px; border: 2px solid #e2e8f0;
  background: white; font-family: 'Nunito', sans-serif; font-size: 12px;
  font-weight: 700; color: #64748b; cursor: pointer; transition: all 0.15s;
  white-space: nowrap;
}
.cal-type-btn.active { border-color: currentColor; }
.cal-type-btn[data-type="events"].active    { color: #6366f1; background: #ede9fe; border-color: #a5b4fc; }
.cal-type-btn[data-type="lessons"].active   { color: #0284c7; background: #e0f2fe; border-color: #7dd3fc; }
.cal-type-btn[data-type="activities"].active{ color: #059669; background: #d1fae5; border-color: #6ee7b7; }
.cal-type-btn[data-type="chores"].active    { color: #d97706; background: #fef3c7; border-color: #fcd34d; }
.cal-type-btn[data-type="reminders"].active { color: #dc2626; background: #fee2e2; border-color: #fca5a5; }

/* ── Account filter buttons ── */
.cal-acct-btn {
  padding: 5px 12px; border-radius: 20px; border: 2px solid #e2e8f0;
  background: white; font-family: 'Nunito', sans-serif; font-size: 12px;
  font-weight: 700; color: #64748b; cursor: pointer; transition: all 0.15s;
  white-space: nowrap; max-width: 160px;
  overflow: hidden; text-overflow: ellipsis;
}
.cal-acct-btn.active {
  color: #0369a1; background: #e0f2fe; border-color: #7dd3fc;
}
.cal-acct-btn:hover:not(.active) { background: #f1f5f9; }

/* ── Week view grid — scrollable wrapper on small screens ── */
.cal-week-scroll {
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.cal-week-grid {
  display: grid; grid-template-columns: 48px repeat(7, minmax(80px, 1fr));
  background: white; min-width: 600px;
}
.cal-week-header {
  background: #f8fafc; padding: 10px 4px; text-align: center;
  font-size: 12px; font-weight: 800; color: #64748b;
  border-bottom: 2px solid #e2e8f0; position: sticky; top: 0; z-index: 2;
}
.cal-week-header.today-col { background: #ede9fe; color: #6366f1; }
.cal-week-time-label {
  font-size: 10px; color: #94a3b8; font-weight: 700; text-align: right;
  padding: 0 6px; border-right: 1px solid #f1f5f9; line-height: 48px;
  white-space: nowrap;
}
.cal-week-cell {
  border-left: 1px solid #f1f5f9; border-bottom: 1px solid #f8fafc;
  min-height: 48px; padding: 2px 3px; position: relative; cursor: pointer;
  overflow: hidden;
}
.cal-week-cell:hover { background: #f8fafc; }
.cal-week-cell.today-col { background: #faf5ff; }

/* ── Day view ── */
.cal-day-view {
  background: white; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.cal-day-view-header {
  padding: 14px 20px; border-bottom: 2px solid #f1f5f9;
  font-size: 17px; font-weight: 900; color: #1e293b;
}
.cal-day-hour-row {
  display: grid; grid-template-columns: 48px 1fr;
  border-bottom: 1px solid #f8fafc; min-height: 48px;
}
.cal-day-hour-label {
  font-size: 10px; color: #94a3b8; font-weight: 700;
  padding: 4px 6px; text-align: right; border-right: 1px solid #f1f5f9;
  line-height: 48px; white-space: nowrap;
}
.cal-day-hour-events { padding: 2px 10px; }

/* ── Unified event pill for week/day ── */
.cal-pill {
  border-radius: 6px; padding: 3px 7px; font-size: 11px; font-weight: 700;
  margin-bottom: 2px; cursor: pointer; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; display: block; transition: opacity 0.15s; max-width: 100%;
}
.cal-pill:hover { opacity: .8; }

/* ── Month grid ── */
.calendar-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px;
  background: white; border-radius: var(--radius); padding: 16px;
  box-shadow: var(--shadow);
}
.cal-day-header {
  text-align: center; font-size: 12px; font-weight: 800;
  color: #94a3b8; padding: 8px 2px;
}
.cal-day {
  min-height: 88px; border-radius: 8px; padding: 5px;
  cursor: pointer; transition: background 0.15s; position: relative; overflow: hidden;
}
.cal-day:hover { background: #f8fafc; }
.cal-day.today { background: #eef2ff; }
.cal-day.other-month { opacity: 0.35; }
.cal-day-num {
  font-size: 13px; font-weight: 700; color: #475569; margin-bottom: 3px;
}
.cal-day.today .cal-day-num {
  background: #6366f1; color: white;
  width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.cal-event-dot {
  font-size: 10px; padding: 1px 5px; border-radius: 4px; margin-bottom: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-weight: 700; line-height: 1.4;
}
