/* =========================================
   TaskSphere — Design System
   Palette: Mint, Lavender, Peach, Sky, Cream
   ========================================= */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600;700&family=DM+Serif+Display:ital@0;1&display=swap');

:root {
  /* Pastel Palette */
  --mint:       #B8F0D8;
  --mint-dark:  #7DD8B0;
  --mint-soft:  #E8FAF2;
  --lavender:   #D4C8F5;
  --lav-dark:   #A98EE8;
  --lav-soft:   #F0ECFF;
  --peach:      #FFD8C2;
  --peach-dark: #F0A882;
  --peach-soft: #FFF0E8;
  --sky:        #C2E4FF;
  --sky-dark:   #82BEED;
  --sky-soft:   #EBF6FF;
  --yellow:     #FFF0A8;
  --yellow-dark:#E8CC50;
  --yellow-soft:#FFFAE8;

  /* Neutrals */
  --white:      #FFFFFF;
  --cream:      #FAFAF8;
  --gray-50:    #F5F5F3;
  --gray-100:   #EBEBEA;
  --gray-200:   #D8D8D6;
  --gray-400:   #9A9A97;
  --gray-600:   #5C5C5A;
  --gray-900:   #1A1A18;

  /* Semantic */
  --primary:    #A98EE8;
  --primary-bg: #F0ECFF;
  --success:    #7DD8B0;
  --warning:    #E8CC50;
  --danger:     #F0A882;
  --info:       #82BEED;

  /* Shadows */
  --shadow-xs:  0 1px 3px rgba(100,80,160,0.06);
  --shadow-sm:  0 2px 8px rgba(100,80,160,0.08);
  --shadow-md:  0 4px 16px rgba(100,80,160,0.10);
  --shadow-lg:  0 8px 32px rgba(100,80,160,0.12);

  /* Typography */
  --font-display: 'DM Serif Display', Georgia, serif;
  --font-body:    'DM Sans', system-ui, sans-serif;

  /* Radii */
  --r-sm:   8px;
  --r-md:   12px;
  --r-lg:   16px;
  --r-xl:   24px;
  --r-full: 9999px;

  /* Transitions */
  --t-fast: 150ms ease;
  --t-med:  250ms ease;
  --t-slow: 400ms ease;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--cream);
  color: var(--gray-900);
  line-height: 1.6;
  font-size: 15px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Utility ── */
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 6px; }
.gap-2 { gap: 10px; }
.gap-3 { gap: 16px; }
.gap-4 { gap: 24px; }
.w-full { width: 100%; }
.text-center { text-align: center; }
.mt-1 { margin-top: 6px; }
.mt-2 { margin-top: 12px; }
.mt-3 { margin-top: 20px; }

/* ── Typography ── */
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.2; }
h1 { font-size: 2.4rem; }
h2 { font-size: 1.8rem; }
h3 { font-size: 1.3rem; }
h4 { font-size: 1.05rem; font-family: var(--font-body); font-weight: 600; }

p { color: var(--gray-600); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 20px;
  border: none; border-radius: var(--r-full);
  font-family: var(--font-body); font-size: 14px; font-weight: 500;
  cursor: pointer; transition: all var(--t-fast);
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--lav-dark);
  color: var(--white);
  box-shadow: 0 2px 8px rgba(169,142,232,0.35);
}
.btn-primary:hover { background: #9578D8; box-shadow: 0 4px 14px rgba(169,142,232,0.45); }

.btn-mint {
  background: var(--mint-dark);
  color: var(--white);
  box-shadow: 0 2px 8px rgba(125,216,176,0.35);
}
.btn-mint:hover { background: #5FC89A; }

.btn-peach {
  background: var(--peach-dark);
  color: var(--white);
}
.btn-peach:hover { background: #E8956A; }

.btn-sky {
  background: var(--sky-dark);
  color: var(--white);
}
.btn-sky:hover { background: #60A8E0; }

.btn-ghost {
  background: transparent;
  color: var(--gray-600);
  border: 1.5px solid var(--gray-200);
}
.btn-ghost:hover { background: var(--gray-50); border-color: var(--gray-400); }

.btn-danger {
  background: #FFCDD2; color: #C0392B;
}
.btn-danger:hover { background: #FFAAB0; }

.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 13px 28px; font-size: 16px; }
.btn-icon { padding: 8px; border-radius: var(--r-sm); }

/* ── Forms ── */
.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-label {
  font-size: 13px; font-weight: 500;
  color: var(--gray-600); letter-spacing: 0.02em;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--r-md);
  background: var(--white);
  font-family: var(--font-body); font-size: 14px;
  color: var(--gray-900);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--lav-dark);
  box-shadow: 0 0 0 3px rgba(169,142,232,0.15);
}
.form-input::placeholder { color: var(--gray-400); }
.form-textarea { resize: vertical; min-height: 80px; }

/* ── Cards ── */
.card {
  background: var(--white);
  border-radius: var(--r-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-100);
}

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: 12px; font-weight: 500;
}
.badge-mint    { background: var(--mint);     color: #2E7D5A; }
.badge-lav     { background: var(--lavender); color: #6040B0; }
.badge-peach   { background: var(--peach);    color: #A04010; }
.badge-sky     { background: var(--sky);      color: #1860A0; }
.badge-yellow  { background: var(--yellow);   color: #806010; }

/* ── App Shell ── */
#app { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar ── */
.sidebar {
  width: 240px; min-width: 240px;
  background: var(--white);
  border-right: 1px solid var(--gray-100);
  display: flex; flex-direction: column;
  padding: 24px 16px;
  gap: 8px;
  overflow-y: auto;
  transition: width var(--t-med);
  z-index: 100;
}

.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px 20px;
  border-bottom: 1px solid var(--gray-100);
  margin-bottom: 8px;
}
.sidebar-logo .logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--lavender), var(--mint));
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.sidebar-logo .logo-text {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--gray-900);
}

.nav-section { margin-top: 10px; }
.nav-section-label {
  font-size: 11px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--gray-400);
  padding: 0 10px 6px;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  color: var(--gray-600);
  font-size: 14px; font-weight: 500;
  cursor: pointer;
  transition: all var(--t-fast);
  user-select: none;
  position: relative;
}
.nav-item:hover { background: var(--gray-50); color: var(--gray-900); }
.nav-item.active {
  background: var(--lav-soft);
  color: var(--lav-dark);
}
.nav-item.active::before {
  content: '';
  position: absolute; left: 0; top: 20%; bottom: 20%;
  width: 3px; border-radius: 3px;
  background: var(--lav-dark);
}
.nav-item .nav-icon { font-size: 17px; width: 20px; text-align: center; }

.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--gray-100);
}

.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background var(--t-fast);
}
.user-chip:hover { background: var(--gray-50); }
.user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600; color: var(--white);
  background: linear-gradient(135deg, var(--lav-dark), var(--sky-dark));
  flex-shrink: 0;
}
.user-name { font-size: 13px; font-weight: 500; color: var(--gray-900); }
.user-role { font-size: 11px; color: var(--gray-400); }

/* ── Main Content ── */
.main-content {
  flex: 1;
  overflow-y: auto;
  background: var(--cream);
}

.page { display: none; height: 100%; }
.page.active { display: flex; flex-direction: column; }

.page-header {
  padding: 28px 32px 0;
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.page-header h2 { color: var(--gray-900); }
.page-header p { font-size: 14px; color: var(--gray-400); margin-top: 2px; }

.page-body { padding: 24px 32px 40px; flex: 1; }

/* ── Auth Pages ── */
#auth-screen {
  min-height: 100vh;
  display: flex;
  background: linear-gradient(135deg, var(--lav-soft) 0%, var(--mint-soft) 50%, var(--peach-soft) 100%);
}

.auth-left {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 40px;
  position: relative;
  overflow: hidden;
}
.auth-left::before {
  content: '';
  position: absolute; inset: -50%;
  background: radial-gradient(circle at 30% 40%, rgba(212,200,245,0.6) 0%, transparent 60%),
              radial-gradient(circle at 70% 70%, rgba(184,240,216,0.5) 0%, transparent 50%);
  animation: bgPulse 8s ease-in-out infinite alternate;
}
@keyframes bgPulse {
  from { transform: scale(1) rotate(0deg); }
  to   { transform: scale(1.05) rotate(2deg); }
}

.auth-branding {
  position: relative; text-align: center;
}
.auth-branding .brand-icon {
  width: 80px; height: 80px;
  background: linear-gradient(135deg, var(--lav-dark), var(--mint-dark));
  border-radius: 24px;
  display: flex; align-items: center; justify-content: center;
  font-size: 38px;
  margin: 0 auto 20px;
  box-shadow: 0 8px 32px rgba(169,142,232,0.3);
}
.auth-branding h1 { font-size: 3rem; color: var(--gray-900); }
.auth-branding p { font-size: 1.1rem; color: var(--gray-600); margin-top: 8px; }
.auth-features {
  margin-top: 40px;
  display: flex; flex-direction: column; gap: 12px;
  text-align: left;
}
.auth-feature {
  display: flex; align-items: center; gap: 12px;
  background: rgba(255,255,255,0.6);
  padding: 12px 18px;
  border-radius: var(--r-md);
  backdrop-filter: blur(8px);
}
.auth-feature-icon { font-size: 20px; width: 30px; text-align: center; }
.auth-feature-text { font-size: 13px; font-weight: 500; color: var(--gray-700, #444); }

.auth-right {
  width: 440px; min-height: 100vh;
  background: var(--white);
  display: flex; align-items: center; justify-content: center;
  padding: 40px;
  box-shadow: -8px 0 40px rgba(100,80,160,0.08);
}

.auth-form-wrap { width: 100%; max-width: 360px; }
.auth-tabs {
  display: flex; gap: 4px;
  background: var(--gray-50);
  padding: 4px; border-radius: var(--r-full);
  margin-bottom: 28px;
}
.auth-tab {
  flex: 1; padding: 8px;
  text-align: center;
  border-radius: var(--r-full);
  font-size: 14px; font-weight: 500;
  cursor: pointer; transition: all var(--t-fast);
  color: var(--gray-400);
}
.auth-tab.active { background: var(--white); color: var(--gray-900); box-shadow: var(--shadow-xs); }

.auth-form-title { font-family: var(--font-display); font-size: 1.7rem; margin-bottom: 6px; }
.auth-form-sub { font-size: 14px; color: var(--gray-400); margin-bottom: 28px; }

.role-picker {
  display: flex; gap: 8px; margin-bottom: 20px;
}
.role-btn {
  flex: 1; padding: 10px 8px;
  border: 2px solid var(--gray-200);
  border-radius: var(--r-md);
  text-align: center;
  cursor: pointer; transition: all var(--t-fast);
  font-size: 13px; font-weight: 500; color: var(--gray-600);
}
.role-btn.selected-admin  { border-color: var(--lav-dark); background: var(--lav-soft); color: var(--lav-dark); }
.role-btn.selected-user   { border-color: var(--mint-dark); background: var(--mint-soft); color: #2E7D5A; }
.role-btn .role-icon { font-size: 20px; display: block; margin-bottom: 4px; }

.form-actions { margin-top: 20px; }
.form-footer { margin-top: 16px; text-align: center; font-size: 13px; color: var(--gray-400); }

/* ── Stats Row ── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
}
.stat-card {
  background: var(--white);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-100);
  display: flex; align-items: center; gap: 14px;
}
.stat-icon {
  width: 44px; height: 44px;
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.stat-icon.mint  { background: var(--mint-soft); }
.stat-icon.lav   { background: var(--lav-soft); }
.stat-icon.peach { background: var(--peach-soft); }
.stat-icon.sky   { background: var(--sky-soft); }
.stat-value { font-size: 1.6rem; font-weight: 700; color: var(--gray-900); line-height: 1; }
.stat-label { font-size: 12px; color: var(--gray-400); margin-top: 3px; }

/* ── Task Filters ── */
.view-tabs {
  display: flex; gap: 6px;
  background: var(--white);
  border: 1px solid var(--gray-100);
  padding: 4px; border-radius: var(--r-full);
  box-shadow: var(--shadow-xs);
}
.view-tab {
  padding: 7px 18px;
  border-radius: var(--r-full);
  font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all var(--t-fast);
  color: var(--gray-400);
}
.view-tab.active { background: var(--lav-dark); color: var(--white); }

/* ── Task List ── */
.tasks-section { margin-top: 24px; }
.tasks-section-title {
  font-size: 13px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--gray-400);
  margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
}
.tasks-section-title::after {
  content: '';
  flex: 1; height: 1px;
  background: var(--gray-100);
}

.task-list { display: flex; flex-direction: column; gap: 8px; }

.task-item {
  background: var(--white);
  border-radius: var(--r-md);
  padding: 14px 16px;
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--gray-100);
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--t-fast), transform var(--t-fast);
  cursor: pointer;
}
.task-item:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.task-check {
  width: 20px; height: 20px;
  border: 2px solid var(--gray-200);
  border-radius: 50%;
  flex-shrink: 0;
  cursor: pointer;
  transition: all var(--t-fast);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: transparent;
}
.task-item.done .task-check {
  background: var(--mint-dark);
  border-color: var(--mint-dark);
  color: var(--white);
}
.task-check:hover { border-color: var(--mint-dark); }

.task-body { flex: 1; min-width: 0; }
.task-title { font-size: 14px; font-weight: 500; color: var(--gray-900); }
.task-item.done .task-title { text-decoration: line-through; color: var(--gray-400); }
.task-meta {
  display: flex; align-items: center; gap: 8px;
  margin-top: 4px; flex-wrap: wrap;
}
.task-deadline { font-size: 12px; color: var(--gray-400); }
.task-deadline.urgent { color: var(--peach-dark); font-weight: 500; }

.task-actions {
  display: flex; gap: 4px;
  opacity: 0; transition: opacity var(--t-fast);
}
.task-item:hover .task-actions { opacity: 1; }

.priority-dot {
  width: 8px; height: 8px;
  border-radius: 50%; flex-shrink: 0;
}
.priority-high   { background: var(--peach-dark); }
.priority-medium { background: var(--yellow-dark); }
.priority-low    { background: var(--mint-dark); }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(30,20,60,0.25);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal {
  background: var(--white);
  border-radius: var(--r-xl);
  padding: 28px;
  width: 100%; max-width: 480px;
  box-shadow: var(--shadow-lg);
  animation: modalIn var(--t-med) var(--t-fast) both;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.modal-close {
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  border: none; background: var(--gray-50);
  cursor: pointer; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--t-fast);
}
.modal-close:hover { background: var(--gray-100); }
.modal-footer { display: flex; gap: 8px; justify-content: flex-end; margin-top: 24px; }
.modal-form { display: flex; flex-direction: column; gap: 14px; }

/* ── Celebration Popup ── */
.celebration {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  z-index: 2000; pointer-events: none;
}
.celebration-card {
  background: var(--white);
  border-radius: var(--r-xl);
  padding: 36px 40px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(169,142,232,0.3);
  pointer-events: all;
  animation: celebIn 0.5s cubic-bezier(0.34,1.56,0.64,1) both;
}
@keyframes celebIn {
  from { opacity: 0; transform: scale(0.7); }
  to   { opacity: 1; transform: none; }
}
.celebration-emoji { font-size: 56px; display: block; margin-bottom: 12px; }
.celebration-title { font-family: var(--font-display); font-size: 2rem; color: var(--gray-900); }
.celebration-sub { color: var(--gray-400); font-size: 15px; margin-top: 6px; }
.confetti-piece {
  position: fixed;
  width: 10px; height: 10px;
  border-radius: 2px;
  animation: confettiFall 2s ease-in forwards;
  pointer-events: none;
  z-index: 1999;
}
@keyframes confettiFall {
  0%   { transform: translateY(-20px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

/* ── Calendar ── */
.calendar-wrap { padding: 24px 32px 40px; }
.cal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.cal-month-title { font-family: var(--font-display); font-size: 1.5rem; }
.cal-nav { display: flex; gap: 6px; }
.cal-nav-btn {
  width: 34px; height: 34px;
  border: 1px solid var(--gray-200);
  border-radius: var(--r-sm);
  background: var(--white);
  cursor: pointer; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--t-fast);
}
.cal-nav-btn:hover { background: var(--gray-50); }

.cal-grid {
  border: 1px solid var(--gray-100);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--white);
}
.cal-week-header {
  display: grid; grid-template-columns: repeat(7,1fr);
  background: var(--lav-soft);
}
.cal-wday {
  padding: 10px 0;
  text-align: center;
  font-size: 12px; font-weight: 600;
  color: var(--lav-dark);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.cal-days {
  display: grid; grid-template-columns: repeat(7,1fr);
}
.cal-day {
  min-height: 90px;
  padding: 8px;
  border-right: 1px solid var(--gray-100);
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer;
  transition: background var(--t-fast);
}
.cal-day:hover { background: var(--lav-soft); }
.cal-day:nth-child(7n) { border-right: none; }
.cal-day.other-month { background: var(--gray-50); }
.cal-day.other-month .cal-day-num { color: var(--gray-200); }
.cal-day.today .cal-day-num {
  background: var(--lav-dark);
  color: var(--white);
  width: 26px; height: 26px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.cal-day-num { font-size: 13px; font-weight: 500; color: var(--gray-600); margin-bottom: 4px; }
.cal-task-chip {
  font-size: 11px; padding: 2px 7px;
  border-radius: var(--r-full);
  margin-bottom: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 100%;
}

/* ── User Profile ── */
.profile-header-card {
  background: linear-gradient(135deg, var(--lav-soft), var(--mint-soft));
  border-radius: var(--r-xl);
  padding: 32px;
  display: flex; align-items: center; gap: 24px;
  border: 1px solid var(--lavender);
  margin-bottom: 24px;
}
.profile-avatar-lg {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--lav-dark), var(--sky-dark));
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; font-weight: 700; color: var(--white);
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(169,142,232,0.3);
}
.profile-info h3 { margin-bottom: 4px; }
.profile-info .profile-role { 
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--lavender); color: #6040B0;
  padding: 4px 12px; border-radius: var(--r-full);
  font-size: 12px; font-weight: 500;
}

.profile-fields-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ── Admin Panel ── */
.admin-table-wrap {
  background: var(--white);
  border-radius: var(--r-lg);
  border: 1px solid var(--gray-100);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.admin-table {
  width: 100%; border-collapse: collapse;
}
.admin-table th {
  background: var(--lav-soft);
  padding: 12px 16px;
  text-align: left;
  font-size: 12px; font-weight: 600;
  color: var(--lav-dark);
  text-transform: uppercase; letter-spacing: 0.06em;
  border-bottom: 1px solid var(--lavender);
}
.admin-table td {
  padding: 12px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--gray-50); }

.online-dot {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block; margin-right: 6px;
}
.online-dot.online  { background: var(--mint-dark); }
.online-dot.offline { background: var(--gray-200); }

/* ── Toast ── */
.toast-container {
  position: fixed; top: 20px; right: 20px;
  z-index: 3000; display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--white);
  border-radius: var(--r-md);
  padding: 12px 16px;
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--lav-dark);
  font-size: 14px; font-weight: 500;
  max-width: 300px;
  animation: toastIn 0.3s ease both;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: none; }
}
.toast.success { border-left-color: var(--mint-dark); }
.toast.error   { border-left-color: var(--peach-dark); }
.toast.info    { border-left-color: var(--sky-dark); }

/* ── Empty State ── */
.empty-state {
  text-align: center; padding: 60px 20px;
  color: var(--gray-400);
}
.empty-state .empty-icon { font-size: 48px; display: block; margin-bottom: 12px; }
.empty-state h4 { color: var(--gray-600); margin-bottom: 6px; }

/* ── Reminder Banner ── */
.reminder-banner {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--white);
  border-radius: var(--r-xl);
  padding: 14px 22px;
  box-shadow: var(--shadow-lg);
  border: 1.5px solid var(--yellow-dark);
  display: flex; align-items: center; gap: 12px;
  z-index: 2500;
  animation: reminderIn 0.4s cubic-bezier(0.34,1.56,0.64,1) both;
  max-width: 400px;
}
@keyframes reminderIn {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.reminder-icon { font-size: 22px; }
.reminder-text { font-size: 14px; font-weight: 500; color: var(--gray-900); }
.reminder-sub  { font-size: 12px; color: var(--gray-400); }

/* ── Responsive ── */
@media (max-width: 768px) {
  .auth-left { display: none; }
  .auth-right { width: 100%; min-width: unset; }
  .sidebar { position: fixed; left: -260px; transition: left var(--t-med); z-index: 200; }
  .sidebar.open { left: 0; }
  .page-header, .page-body { padding-left: 20px; padding-right: 20px; }
  .profile-fields-grid { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: 1fr 1fr; }
}

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

/* ── Loading ── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--gray-200);
  border-top-color: var(--lav-dark);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Activity Log ── */
.activity-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-100);
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
  width: 8px; height: 8px; border-radius: 50%;
  margin-top: 6px; flex-shrink: 0;
}

/* ── Task Description ── */
.task-desc { font-size: 12px; color: var(--gray-400); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 300px; }

/* ════════════════════════════════════════════════════════
   NOTES PAGE
   ════════════════════════════════════════════════════════ */

.notes-layout {
  display: flex;
  height: 100%;
  overflow: hidden;
}

/* ── Notes Sidebar ── */
.notes-sidebar {
  width: 280px; min-width: 280px;
  border-right: 1px solid var(--gray-100);
  background: var(--white);
  display: flex; flex-direction: column;
  overflow: hidden;
}

.notes-sidebar-header {
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--gray-100);
}

.notes-sidebar-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}

.notes-sidebar-title { font-size: 16px; font-weight: 600; color: var(--gray-900); }

.notes-search-wrap { position: relative; }
.notes-search-wrap .search-icon {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  font-size: 13px; color: var(--gray-400);
}
.notes-search {
  width: 100%;
  padding: 8px 10px 8px 30px;
  border: 1.5px solid var(--gray-100);
  border-radius: var(--r-full);
  font-family: var(--font-body); font-size: 13px;
  color: var(--gray-900); background: var(--gray-50);
  outline: none; transition: border-color var(--t-fast);
}
.notes-search:focus { border-color: var(--lav-dark); background: var(--white); }

.notes-list { flex: 1; overflow-y: auto; }

.note-list-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer;
  transition: background var(--t-fast);
}
.note-list-item:hover { background: var(--gray-50); }
.note-list-item.active { }
.note-list-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; margin-bottom: 4px; }
.note-list-title  { font-size: 13px; font-weight: 500; color: var(--gray-900); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note-list-time   { font-size: 11px; color: var(--gray-400); flex-shrink: 0; white-space: nowrap; }
.note-list-preview { font-size: 12px; color: var(--gray-400); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ── Notes Editor ── */
.notes-editor-wrap {
  flex: 1; display: flex; flex-direction: column;
  overflow: hidden; transition: background var(--t-med);
}

.notes-editor-toolbar {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 20px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  flex-wrap: wrap;
}

.color-palette {
  display: flex; gap: 5px; align-items: center;
}
.color-swatch {
  width: 18px; height: 18px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform var(--t-fast), border-color var(--t-fast);
}
.color-swatch:hover { transform: scale(1.2); }
.color-swatch.selected { border-color: var(--gray-900); transform: scale(1.15); }

.note-meta-bar {
  font-size: 11px; color: var(--gray-400);
  display: flex; gap: 12px;
  padding: 0 20px 10px;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}

.notes-editor-body {
  flex: 1; display: flex; flex-direction: column;
  padding: 20px;
  overflow-y: auto;
}

.note-title-field {
  font-family: var(--font-display);
  font-size: 1.8rem;
  border: none; outline: none; background: transparent;
  color: var(--gray-900); width: 100%;
  margin-bottom: 12px;
  resize: none; line-height: 1.3;
  caret-color: var(--lav-dark);
}
.note-title-field::placeholder { color: var(--gray-200); }

.note-body-field {
  font-family: var(--font-body);
  font-size: 15px; line-height: 1.8;
  border: none; outline: none; background: transparent;
  color: var(--gray-600); width: 100%;
  flex: 1; resize: none;
  min-height: 400px;
  caret-color: var(--lav-dark);
}
.note-body-field::placeholder { color: var(--gray-200); }

.note-empty-state {
  flex: 1; display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 12px; text-align: center;
  color: var(--gray-400);
}
.note-empty-icon { font-size: 56px; }
.note-empty-title { font-family: var(--font-display); font-size: 1.4rem; color: var(--gray-600); }

.note-pin-btn.active { background: var(--yellow-soft); border-color: var(--yellow-dark); color: #806010; }

/* ════════════════════════════════════════════════════════
   ANALYTICS PAGE
   ════════════════════════════════════════════════════════ */

.analytics-range-row {
  display: flex; gap: 6px;
  background: var(--white);
  border: 1px solid var(--gray-100);
  padding: 4px; border-radius: var(--r-full);
  box-shadow: var(--shadow-xs);
}
.analytics-range-btn {
  padding: 7px 18px;
  border-radius: var(--r-full);
  font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all var(--t-fast);
  color: var(--gray-400); background: transparent;
  border: none; font-family: var(--font-body);
}
.analytics-range-btn.active { background: var(--lav-dark); color: var(--white); }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
}

.kpi-card {
  background: var(--white);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  border: 1px solid var(--gray-100);
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 6px;
}
.kpi-icon {
  width: 38px; height: 38px;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.kpi-value { font-size: 1.8rem; font-weight: 700; color: var(--gray-900); line-height: 1; }
.kpi-label { font-size: 12px; color: var(--gray-400); }
.kpi-sublabel { font-size: 11px; color: var(--gray-300); }

.analytics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 20px;
}
.analytics-grid .card-full { grid-column: 1 / -1; }

.analytics-card-title {
  font-size: 14px; font-weight: 600; color: var(--gray-900);
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
}
.analytics-card-title .ac-icon { font-size: 16px; }

/* Donut chart container */
.donut-wrap {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
}
#priority-chart {
  width: 180px; height: 180px; flex-shrink: 0;
}
.donut-legend { display: flex; flex-direction: column; gap: 8px; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--gray-600); }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* Heatmap */
.heatmap-wrap { }
.heatmap-label {
  font-size: 11px; color: var(--gray-400);
  margin-bottom: 8px;
  display: flex; justify-content: space-between;
}
#activity-heatmap {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

/* Streak */
.streak-display {
  display: flex; align-items: center; gap: 20px;
  padding: 8px 0;
}
.streak-flame { font-size: 48px; }
.streak-number { font-family: var(--font-display); font-size: 3.5rem; color: var(--gray-900); line-height: 1; }
.streak-unit   { font-size: 16px; color: var(--gray-400); }
.streak-message { font-size: 14px; color: var(--gray-600); margin-top: 8px; }

/* Overview pill row */
.overview-pills {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-top: 8px;
}
.overview-pill {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-radius: var(--r-full);
  font-size: 12px; font-weight: 500;
}

/* Responsive analytics */
@media (max-width: 900px) {
  .analytics-grid { grid-template-columns: 1fr; }
  .analytics-grid .card-full { grid-column: 1; }
  .notes-sidebar { width: 220px; min-width: 220px; }
}
@media (max-width: 600px) {
  .notes-layout { flex-direction: column; }
  .notes-sidebar { width: 100%; min-width: unset; max-height: 200px; border-right: none; border-bottom: 1px solid var(--gray-100); }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
}

/* ════════════════════════════════════════════════════════
   ALERT BELL (user-facing notifications sent by admin)
   ════════════════════════════════════════════════════════ */
.alert-bell-wrap { position: relative; }
.alert-bell-btn {
  position: relative;
  background: var(--white);
  border: 1px solid var(--gray-100);
  border-radius: var(--r-full);
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 18px;
  transition: all var(--t-fast);
}
.alert-bell-btn:hover { background: var(--gray-50); }
.alert-bell-badge {
  position: absolute; top: -2px; right: -2px;
  background: var(--peach-dark); color: var(--white);
  font-size: 10px; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: var(--r-full);
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px; line-height: 1;
}
.alert-dropdown {
  position: absolute; top: 48px; right: 0;
  width: 340px; max-height: 420px; overflow-y: auto;
  background: var(--white);
  border: 1px solid var(--gray-100);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  z-index: 500;
  padding: 8px;
}
.alert-dropdown-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px 12px; font-size: 13px; font-weight: 600;
}
.alert-item {
  display: flex; gap: 10px;
  padding: 10px; border-radius: var(--r-sm);
  margin-bottom: 4px;
}
.alert-item.unread { background: var(--lav-soft); }
.alert-item-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.alert-item-msg { font-size: 13px; color: var(--gray-900); line-height: 1.4; }
.alert-item-meta { font-size: 11px; color: var(--gray-400); margin-top: 3px; }
.alert-empty { padding: 24px 12px; text-align: center; color: var(--gray-400); font-size: 13px; }

/* In-page alert banner (shown on dashboard for unread urgent alerts) */
.alert-banner {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: var(--r-md);
  margin-bottom: 16px; font-size: 13px;
}
.alert-banner.info    { background: var(--sky-soft);   border: 1px solid var(--sky-dark); }
.alert-banner.warning { background: var(--yellow-soft);border: 1px solid var(--yellow-dark); }
.alert-banner.urgent  { background: var(--peach-soft); border: 1px solid var(--peach-dark); }

/* ════════════════════════════════════════════════════════
   ADMIN PANEL — Analytics / Monitoring / Database / Users
   ════════════════════════════════════════════════════════ */
.admin-section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}
.admin-section-title {
  font-size: 15px; font-weight: 600; color: var(--gray-900);
  display: flex; align-items: center; gap: 8px;
  margin: 28px 0 12px;
}
.admin-section-title:first-child { margin-top: 0; }
.monitor-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid var(--gray-100);
  font-size: 13px;
}
.monitor-row:last-child { border-bottom: none; }
.monitor-label { color: var(--gray-400); }
.monitor-value { font-weight: 600; color: var(--gray-900); }
.db-status-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  margin-right: 6px;
}
.db-status-dot.up   { background: var(--mint-dark); }
.db-status-dot.down { background: var(--peach-dark); }

/* Read-only task viewer (admin viewing a user's tasks) */
.readonly-task-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 4px; border-bottom: 1px solid var(--gray-100);
  font-size: 13px;
}
.readonly-task-row:last-child { border-bottom: none; }
.readonly-task-row.done .readonly-task-title { text-decoration: line-through; color: var(--gray-400); }
.readonly-task-title { flex: 1; font-weight: 500; }
.readonly-task-deadline { color: var(--gray-400); font-size: 12px; white-space: nowrap; }

.online-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  margin-right: 6px;
}
.online-dot.online  { background: var(--mint-dark); }
.online-dot.offline { background: var(--gray-200); }

.temp-password-box {
  background: var(--yellow-soft);
  border: 1px solid var(--yellow-dark);
  border-radius: var(--r-md);
  padding: 14px 16px;
  font-size: 13px;
  margin-top: 12px;
}
.temp-password-box code {
  background: var(--white);
  padding: 2px 8px;
  border-radius: var(--r-sm);
  font-weight: 600;
  border: 1px solid var(--gray-200);
}



/* ════════════════════════════════════════════════════════
   MESSAGES PAGE (User <-> Admin chat)
   ════════════════════════════════════════════════════════ */

.nav-badge {
  margin-left: auto;
  background: var(--peach-dark); color: var(--white);
  font-size: 10px; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: var(--r-full);
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px; line-height: 1;
}

.messages-layout { display: flex; height: 100%; overflow: hidden; }

.conversation-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer;
  transition: background var(--t-fast);
}
.conversation-item:hover { background: var(--gray-50); }
.conversation-item.active { background: var(--lav-soft); }
.conversation-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--sky); color: #1860A0;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600; flex-shrink: 0;
}
.conversation-info { flex: 1; min-width: 0; }
.conversation-name-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.conversation-name { font-size: 13px; font-weight: 600; color: var(--gray-900); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conversation-time { font-size: 11px; color: var(--gray-400); flex-shrink: 0; }
.conversation-preview { font-size: 12px; color: var(--gray-400); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conversation-unread-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--peach-dark); flex-shrink: 0;
}

.chat-thread-header {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-100);
  flex-shrink: 0;
}
.chat-thread-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--lavender); color: #6040B0;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 600; flex-shrink: 0;
}
.chat-thread-name { font-size: 14px; font-weight: 600; color: var(--gray-900); }
.chat-thread-sub { font-size: 12px; color: var(--gray-400); }

.chat-thread-messages {
  flex: 1; overflow-y: auto;
  padding: 20px;
  display: flex; flex-direction: column; gap: 10px;
}

.chat-bubble-row { display: flex; }
.chat-bubble-row.mine { justify-content: flex-end; }
.chat-bubble {
  max-width: 65%;
  padding: 10px 14px;
  border-radius: var(--r-lg);
  font-size: 13.5px; line-height: 1.5;
  white-space: pre-wrap; word-break: break-word;
}
.chat-bubble-row:not(.mine) .chat-bubble {
  background: var(--gray-50); color: var(--gray-900);
  border-bottom-left-radius: 4px;
}
.chat-bubble-row.mine .chat-bubble {
  background: var(--lav-dark); color: var(--white);
  border-bottom-right-radius: 4px;
}
.chat-bubble-meta {
  font-size: 10.5px; margin-top: 4px; opacity: 0.7;
}
.chat-bubble-row:not(.mine) .chat-bubble-meta { color: var(--gray-400); }
.chat-bubble-row.mine .chat-bubble-meta { color: var(--lav-soft); text-align: right; }

.chat-input-bar {
  display: flex; align-items: flex-end; gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--gray-100);
  flex-shrink: 0;
}
.chat-input {
  flex: 1;
  max-height: 120px;
  padding: 10px 14px;
  border: 1.5px solid var(--gray-100);
  border-radius: var(--r-lg);
  font-family: var(--font-body); font-size: 13.5px;
  color: var(--gray-900); background: var(--gray-50);
  outline: none; resize: none;
  transition: border-color var(--t-fast);
}
.chat-input:focus { border-color: var(--lav-dark); background: var(--white); }

@media (max-width: 900px) {
  .messages-layout { flex-direction: column; }
  #messages-sidebar.notes-sidebar { width: 100%; min-width: unset; max-height: 220px; border-right: none; border-bottom: 1px solid var(--gray-100); }
}

.user-picker-list {
  max-height: 180px; overflow-y: auto;
  border: 1.5px solid var(--gray-100);
  border-radius: var(--r-md);
  margin-top: 8px;
}
.user-picker-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--gray-100);
  font-size: 13px;
}
.user-picker-item:last-child { border-bottom: none; }
.user-picker-item:hover { background: var(--gray-50); }
.user-picker-item.selected { background: var(--lav-soft); }
.user-picker-item .up-name { font-weight: 500; color: var(--gray-900); }
.user-picker-item .up-username { color: var(--gray-400); font-size: 12px; }
.user-picker-empty { padding: 12px; font-size: 12px; color: var(--gray-400); text-align: center; }

.chat-sender-label {
  font-size: 11px; font-weight: 600; margin-bottom: 2px;
  color: var(--lav-dark);
}
