/* ============================================================
   TaskPlanner — Design System
   Автор: Дадамирзаев Бахтиёр Файзулло угли
   ============================================================ */

/* ── 1. DESIGN TOKENS ────────────────────────────────────── */
:root {
  /* Palette */
  --blue-50:  #e8f0fe;
  --blue-100: #c5d6fc;
  --blue-500: #4285f4;
  --blue-600: #1a73e8;
  --blue-700: #1967d2;

  --green-50:  #e6f4ea;
  --green-500: #34a853;
  --green-600: #188038;

  --yellow-50:  #fef7e0;
  --yellow-400: #fbbc04;

  --red-50:  #fce8e6;
  --red-500: #ea4335;
  --red-600: #c5221f;

  --purple-50:  #f3e8fd;
  --purple-500: #9c27b0;

  --gray-50:  #f8f9fa;
  --gray-100: #f1f3f4;
  --gray-200: #e8eaed;
  --gray-300: #dadce0;
  --gray-400: #bdc1c6;
  --gray-500: #9aa0a6;
  --gray-600: #80868b;
  --gray-700: #5f6368;
  --gray-800: #3c4043;
  --gray-900: #202124;

  /* Semantic */
  --primary:        var(--blue-500);
  --primary-hover:  var(--blue-600);
  --primary-active: var(--blue-700);
  --primary-subtle: var(--blue-50);

  --success:        var(--green-500);
  --success-subtle: var(--green-50);
  --warning:        var(--yellow-400);
  --warning-subtle: var(--yellow-50);
  --danger:         var(--red-500);
  --danger-hover:   var(--red-600);
  --danger-subtle:  var(--red-50);

  /* Surface */
  --surface-0:     #ffffff;
  --surface-1:     var(--gray-50);
  --surface-2:     var(--gray-100);
  --surface-raised: #ffffff;

  /* Text */
  --text-primary:   var(--gray-900);
  --text-secondary: var(--gray-700);
  --text-tertiary:  var(--gray-500);
  --text-disabled:  var(--gray-400);
  --text-on-primary: #ffffff;

  /* Border */
  --border:         var(--gray-300);
  --border-focus:   var(--blue-500);

  /* Shadow */
  --shadow-xs: 0 1px 2px rgba(0,0,0,.06);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,.08), 0 4px 6px rgba(0,0,0,.05);
  --shadow-xl: 0 20px 25px rgba(0,0,0,.1), 0 10px 10px rgba(0,0,0,.04);

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

  /* Spacing (8px base) */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 20px;
  --s6: 24px;
  --s8: 32px;
  --s10: 40px;
  --s12: 48px;
  --s16: 64px;

  /* Typography */
  --font-sans: 'Inter', 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --text-xs:   11px;
  --text-sm:   13px;
  --text-base: 14px;
  --text-md:   15px;
  --text-lg:   16px;
  --text-xl:   18px;
  --text-2xl:  20px;
  --text-3xl:  24px;
  --text-4xl:  32px;

  --fw-normal:  400;
  --fw-medium:  500;
  --fw-semibold: 600;
  --fw-bold:    700;

  /* Transitions */
  --ease: cubic-bezier(.4,0,.2,1);
  --t-fast:   120ms;
  --t-normal: 200ms;
  --t-slow:   300ms;

  /* Layout */
  --sidebar-w: 260px;
  --header-h:  64px;
  --max-w:     1440px;
}

/* Dark theme */
[data-theme="dark"] {
  --surface-0:      #1a1b1e;
  --surface-1:      #25262b;
  --surface-2:      #2c2d32;
  --surface-raised: #2c2d32;

  --text-primary:   #e3e4e8;
  --text-secondary: #a0a4b0;
  --text-tertiary:  #6b7280;
  --text-disabled:  #4b5563;

  --border:         #3a3b42;

  --primary:        #7baff8;
  --primary-hover:  #8ab4f8;
  --primary-subtle: #1e2e45;

  --success:        #81c995;
  --success-subtle: #1a3028;
  --danger:         #f28b82;
  --danger-subtle:  #3b1916;
  --warning:        #fdd663;
  --warning-subtle: #342600;

  --shadow-xs: 0 1px 2px rgba(0,0,0,.3);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.4), 0 1px 2px rgba(0,0,0,.3);
  --shadow-md: 0 4px 6px rgba(0,0,0,.4), 0 2px 4px rgba(0,0,0,.3);
  --shadow-lg: 0 10px 15px rgba(0,0,0,.5), 0 4px 6px rgba(0,0,0,.3);
  --shadow-xl: 0 20px 25px rgba(0,0,0,.6), 0 10px 10px rgba(0,0,0,.3);
}

/* ── 2. RESET & BASE ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--fw-normal);
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--surface-1);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--primary); text-decoration: none; transition: color var(--t-fast) var(--ease); }
a:hover { color: var(--primary-hover); }

img, svg { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }

/* ── 3. LAYOUT ───────────────────────────────────────────── */
.app-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-main {
  flex: 1;
  display: flex;
  max-width: var(--max-w);
  margin: 0 auto;
  width: 100%;
  padding: var(--s6);
  gap: var(--s6);
}

.content-area { flex: 1; min-width: 0; }

/* ── 4. HEADER ───────────────────────────────────────────── */
.app-header {
  height: var(--header-h);
  background: linear-gradient(135deg, #1a73e8 0%, #5b5bd6 100%);
  border-bottom: none;
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: 0 2px 12px rgba(26,115,232,.35);
}
[data-theme="dark"] .app-header {
  background: linear-gradient(135deg, #1a3a6b 0%, #2d1f6b 100%);
  box-shadow: 0 2px 12px rgba(0,0,0,.5);
}

.header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  padding: 0 var(--s6);
  gap: var(--s6);
}

.app-logo {
  display: flex;
  align-items: center;
  gap: var(--s2);
  text-decoration: none;
  flex-shrink: 0;
}
.app-logo .logo-icon {
  width: 32px; height: 32px;
  background: rgba(255,255,255,.2);
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 18px;
  border: 1px solid rgba(255,255,255,.25);
}
.app-logo .logo-name {
  font-size: var(--text-lg);
  font-weight: var(--fw-bold);
  color: white;
  letter-spacing: -.3px;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: var(--s1);
  flex: 1;
}

.nav-item {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s2) var(--s3);
  border-radius: var(--r-md);
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  color: rgba(255,255,255,.85);
  text-decoration: none;
  transition: all var(--t-fast) var(--ease);
  white-space: nowrap;
}
.nav-item .material-icons { font-size: 18px; }
.nav-item:hover {
  background: rgba(255,255,255,.15);
  color: white;
}
.nav-item.active {
  background: rgba(255,255,255,.25);
  color: white;
}
[data-theme="dark"] .nav-item:hover { background: rgba(255,255,255,.1); }
[data-theme="dark"] .nav-item.active { background: rgba(255,255,255,.15); }

.header-right {
  display: flex;
  align-items: center;
  gap: var(--s2);
  margin-left: auto;
  flex-shrink: 0;
}

.header-avatar {
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s2) var(--s3);
  border-radius: var(--r-full);
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.25);
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  color: white;
  text-decoration: none;
  transition: all var(--t-fast) var(--ease);
}
.header-avatar:hover { background: rgba(255,255,255,.25); color: white; border-color: rgba(255,255,255,.4); }
.header-avatar .material-icons { font-size: 20px; color: white; }

/* ── 5. BUTTONS ──────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  padding: var(--s2) var(--s4);
  border-radius: var(--r-md);
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  line-height: 1;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
  white-space: nowrap;
  text-decoration: none;
  user-select: none;
}
.btn .material-icons { font-size: 16px; }
.btn:disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }

.btn-primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: white;
  box-shadow: 0 4px 12px rgba(66,133,244,.35);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); box-shadow: none; }

.btn-secondary {
  background: var(--surface-0);
  color: var(--text-primary);
  border-color: var(--border);
}
.btn-secondary:hover {
  background: var(--surface-1);
  border-color: var(--gray-400);
  color: var(--text-primary);
}
/* Secondary button inside header (on gradient bg) */
.app-header .btn-secondary {
  background: rgba(255,255,255,.15);
  color: white;
  border-color: rgba(255,255,255,.3);
}
.app-header .btn-secondary:hover {
  background: rgba(255,255,255,.25);
  border-color: rgba(255,255,255,.5);
  color: white;
}
.app-header .btn-primary {
  background: white;
  color: var(--blue-600);
  border-color: white;
}
.app-header .btn-primary:hover {
  background: rgba(255,255,255,.9);
  border-color: rgba(255,255,255,.9);
  color: var(--blue-700);
  box-shadow: 0 4px 12px rgba(0,0,0,.2);
}

.btn-danger {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}
.btn-danger:hover {
  background: var(--danger-hover);
  border-color: var(--danger-hover);
  color: white;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text-primary); }

.btn-sm { padding: 6px var(--s3); font-size: var(--text-xs); }
.btn-sm .material-icons { font-size: 14px; }
.btn-lg { padding: 12px var(--s6); font-size: var(--text-md); }
.btn-lg .material-icons { font-size: 20px; }
.btn-full { width: 100%; }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: var(--r-md);
  border: none;
  background: transparent;
  color: rgba(255,255,255,.8);
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
  flex-shrink: 0;
}
.btn-icon .material-icons { font-size: 18px; }
.btn-icon:hover { background: rgba(255,255,255,.15); color: white; }
.btn-icon.danger:hover { background: var(--danger-subtle); color: var(--danger); }
.btn-icon.success:hover { background: var(--success-subtle); color: var(--success); }
/* btn-icon outside of header (e.g. in forms, task cards) */
.card .btn-icon, .task-card .btn-icon, .sidebar .btn-icon, .modal .btn-icon {
  color: var(--text-tertiary);
}
.card .btn-icon:hover, .task-card .btn-icon:hover, .modal .btn-icon:hover {
  background: var(--surface-2); color: var(--text-primary);
}

/* ── 6. SIDEBAR ──────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s4);
}

.sidebar-card {
  background: var(--surface-0);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s5);
  box-shadow: var(--shadow-xs);
}

.sidebar-card-title {
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: .8px;
  margin-bottom: var(--s3);
}

.filter-list { display: flex; flex-direction: column; gap: 2px; }

.filter-item {
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s2) var(--s3);
  border-radius: var(--r-md);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  text-decoration: none;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: all var(--t-fast) var(--ease);
}
.filter-item .material-icons { font-size: 16px; }
.filter-item:hover { background: var(--surface-2); color: var(--text-primary); }
.filter-item.active { background: var(--primary-subtle); color: var(--primary); font-weight: var(--fw-medium); }

.filter-badge {
  margin-left: auto;
  background: var(--surface-2);
  color: var(--text-tertiary);
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  padding: 1px 6px;
  border-radius: var(--r-full);
  min-width: 20px;
  text-align: center;
}
.filter-item.active .filter-badge {
  background: var(--primary-subtle);
  color: var(--primary);
}

.color-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── 7. CARDS ────────────────────────────────────────────── */
.card {
  background: var(--surface-0);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
}

/* ── 8. TASK CARDS ───────────────────────────────────────── */
.task-list { display: flex; flex-direction: column; gap: var(--s3); }

.task-card {
  background: var(--surface-0);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s4) var(--s5);
  box-shadow: var(--shadow-xs);
  transition: all var(--t-normal) var(--ease);
  border-left: 3px solid transparent;
  position: relative;
  overflow: hidden;
}
.task-card:hover {
  border-color: var(--border);
  border-left-color: inherit;
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

/* Priority left border colors */
.task-card[data-priority="low"]    { border-left-color: var(--gray-400); }
.task-card[data-priority="medium"] { border-left-color: var(--primary); }
.task-card[data-priority="high"]   { border-left-color: var(--danger); }
.task-card[data-priority="urgent"] { border-left-color: var(--purple-500); }

.task-card.is-done {
  opacity: .6;
  background: var(--surface-1);
}
.task-card.is-done .task-card-title {
  text-decoration: line-through;
  color: var(--text-tertiary);
}

.task-card-header {
  display: flex;
  align-items: flex-start;
  gap: var(--s3);
  margin-bottom: var(--s2);
}

.task-card-check {
  flex-shrink: 0;
  margin-top: 2px;
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t-fast) var(--ease);
  background: transparent;
}
.task-card-check:hover {
  border-color: var(--success);
  background: var(--success-subtle);
}
.task-card-check .material-icons {
  font-size: 12px;
  color: transparent;
  transition: color var(--t-fast) var(--ease);
}
.task-card-check:hover .material-icons { color: var(--success); }
.task-card.is-done .task-card-check {
  border-color: var(--success);
  background: var(--success);
}
.task-card.is-done .task-card-check .material-icons { color: white; }

.task-card-content { flex: 1; min-width: 0; }

.task-card-title {
  font-size: var(--text-md);
  font-weight: var(--fw-medium);
  color: var(--text-primary);
  line-height: 1.4;
  margin-bottom: var(--s1);
}
.task-card-title a { color: inherit; text-decoration: none; }
.task-card-title a:hover { color: var(--primary); }

.task-card-desc {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.task-card-footer {
  display: flex;
  align-items: center;
  gap: var(--s2);
  margin-top: var(--s3);
  flex-wrap: wrap;
}

.task-card-actions {
  display: flex;
  gap: 2px;
  align-items: center;
  opacity: 0;
  transition: opacity var(--t-fast) var(--ease);
  flex-shrink: 0;
}
.task-card:hover .task-card-actions { opacity: 1; }

/* ── 9. BADGES & CHIPS ───────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  padding: 2px var(--s2);
  border-radius: var(--r-full);
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  white-space: nowrap;
  line-height: 1.5;
}

/* Status badges */
.badge-new        { background: var(--surface-2); color: var(--text-secondary); }
.badge-in_progress { background: var(--blue-50); color: var(--blue-700); }
.badge-done       { background: var(--green-50); color: var(--green-600); }
.badge-cancelled  { background: var(--red-50); color: var(--red-600); }

/* Priority badges */
.badge-low    { background: var(--gray-100); color: var(--gray-700); border: 1px solid var(--gray-300); }
.badge-medium { background: var(--blue-50);  color: var(--blue-700); border: 1px solid var(--blue-100); }
.badge-high   { background: #fff0ee; color: #d93025; border: 1px solid #fca7a1; font-weight: var(--fw-bold); }
.badge-urgent { background: #f5eeff; color: #7b1fa2; border: 1px solid #ce93d8; font-weight: var(--fw-bold); }

/* Date badge */
.badge-date {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  font-weight: var(--fw-normal);
}
.badge-date .material-icons { font-size: 13px; }
.badge-date.overdue { color: var(--danger); font-weight: var(--fw-medium); }
.badge-date.today   { color: var(--warning); font-weight: var(--fw-medium); }

/* Category chip */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  padding: 2px 8px;
  border-radius: var(--r-full);
  font-size: var(--text-xs);
  font-weight: var(--fw-medium);
}

/* Tag chip */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: var(--r-full);
  font-size: var(--text-xs);
  background: var(--surface-2);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  font-weight: var(--fw-medium);
}
.tag .tag-remove {
  margin-left: 2px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text-tertiary);
}
.tag .tag-remove:hover { color: var(--danger); }

/* ── 10. EMPTY STATE ─────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: var(--s16) var(--s6);
  color: var(--text-tertiary);
}
.empty-state-icon {
  font-size: 64px;
  color: var(--gray-300);
  margin-bottom: var(--s4);
  display: block;
}
.empty-state-title {
  font-size: var(--text-xl);
  font-weight: var(--fw-semibold);
  color: var(--text-secondary);
  margin-bottom: var(--s2);
}
.empty-state-text {
  font-size: var(--text-sm);
  margin-bottom: var(--s6);
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.6;
}

/* ── 11. FORMS ───────────────────────────────────────────── */
.form-group { margin-bottom: var(--s5); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); }

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  color: var(--text-secondary);
  margin-bottom: var(--s2);
}
.form-label .required { color: var(--danger); margin-left: 2px; }

.form-control {
  width: 100%;
  padding: 10px var(--s3);
  background: var(--surface-0);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: var(--text-base);
  font-family: inherit;
  color: var(--text-primary);
  transition: all var(--t-fast) var(--ease);
  appearance: none;
  -webkit-appearance: none;
  line-height: 1.5;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(66,133,244,.15);
}
.form-control::placeholder { color: var(--text-disabled); }
.form-control.is-invalid { border-color: var(--danger); }
.form-control.is-invalid:focus { box-shadow: 0 0 0 3px rgba(234,67,53,.15); }

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

select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%235f6368' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

[data-theme="dark"] select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23a0a4b0' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
}

[data-theme="dark"] .form-control {
  background: var(--surface-1);
  color: var(--text-primary);
  border-color: var(--border);
}

.form-hint { font-size: var(--text-xs); color: var(--text-tertiary); margin-top: var(--s1); }
.form-error { font-size: var(--text-xs); color: var(--danger); margin-top: var(--s1); display: flex; align-items: center; gap: var(--s1); }
.form-error .material-icons { font-size: 14px; }

.search-input-wrap {
  position: relative;
}
.search-input-wrap .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  font-size: 18px;
  pointer-events: none;
}
.search-input-wrap .form-control {
  padding-left: 36px;
}

/* ── 12. STATS CARDS ─────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--s4);
  margin-bottom: var(--s6);
}

.stat-card {
  background: var(--surface-0);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s5);
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--t-normal) var(--ease);
}
.stat-card:hover { box-shadow: var(--shadow-md); }

.stat-card-label {
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-bottom: var(--s2);
  display: flex;
  align-items: center;
  gap: var(--s1);
}
.stat-card-label .material-icons { font-size: 14px; }

.stat-card-value {
  font-size: var(--text-4xl);
  font-weight: var(--fw-bold);
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: var(--s1);
}

.stat-card-sub {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

/* Colorful stat card variants */
.stat-card--blue  { border-top: 3px solid var(--blue-500); }
.stat-card--blue  .stat-card-value { color: var(--blue-600); }
.stat-card--blue  .stat-card-label .material-icons { color: var(--blue-500); }
.stat-card--green { border-top: 3px solid var(--green-500); }
.stat-card--green .stat-card-value { color: var(--green-600); }
.stat-card--green .stat-card-label .material-icons { color: var(--green-500); }
.stat-card--orange { border-top: 3px solid #f97316; }
.stat-card--orange .stat-card-value { color: #ea6500; }
.stat-card--orange .stat-card-label .material-icons { color: #f97316; }
.stat-card--red   { border-top: 3px solid var(--red-500); }
.stat-card--red   .stat-card-value { color: var(--red-600); }
.stat-card--red   .stat-card-label .material-icons { color: var(--red-500); }
.stat-card--purple { border-top: 3px solid var(--purple-500); }
.stat-card--purple .stat-card-value { color: var(--purple-500); }
.stat-card--purple .stat-card-label .material-icons { color: var(--purple-500); }

/* ── 13. PROGRESS BAR ────────────────────────────────────── */
.progress {
  height: 6px;
  background: var(--surface-2);
  border-radius: var(--r-full);
  overflow: hidden;
  margin-top: var(--s2);
}
.progress-bar {
  height: 100%;
  border-radius: var(--r-full);
  background: var(--primary);
  transition: width var(--t-slow) var(--ease);
}
.progress-bar.success { background: var(--success); }
.progress-bar.warning { background: var(--warning); }

/* ── 14. RING PROGRESS ───────────────────────────────────── */
.ring-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: var(--s2);
}
.ring {
  width: 80px; height: 80px;
  transform: rotate(-90deg);
}
.ring-track { fill: none; stroke: var(--surface-2); stroke-width: 8; }
.ring-fill {
  fill: none;
  stroke: var(--primary);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 220;
  stroke-dashoffset: 220;
  transition: stroke-dashoffset 1s var(--ease);
}
.ring-fill.success { stroke: var(--success); }
.ring-label {
  font-size: var(--text-3xl);
  font-weight: var(--fw-bold);
  color: var(--text-primary);
  text-align: center;
  transform: rotate(90deg);
}

/* ── 15. CALENDAR ────────────────────────────────────────── */
.calendar-nav {
  display: flex;
  align-items: center;
  gap: var(--s3);
  margin-bottom: var(--s5);
}
.calendar-nav h2 {
  font-size: var(--text-2xl);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
  flex: 1;
}

.calendar-grid {
  background: var(--surface-0);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.cal-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.cal-head {
  background: var(--surface-1);
  border-bottom: 1px solid var(--border);
}

.cal-head-cell {
  padding: var(--s2) var(--s3);
  text-align: center;
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.cal-cell {
  min-height: 100px;
  padding: var(--s2);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  transition: background var(--t-fast) var(--ease);
  cursor: pointer;
  vertical-align: top;
}
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell:hover { background: var(--surface-1); }
.cal-cell.other-month { opacity: .35; }
.cal-cell.today { background: var(--primary-subtle); }
.cal-cell.today .cal-day-num {
  background: var(--primary);
  color: white;
  border-radius: 50%;
  width: 26px; height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cal-day-num {
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  color: var(--text-secondary);
  margin-bottom: var(--s1);
  width: 26px; height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cal-cell.today .cal-day-num { color: white; }

.cal-task-pill {
  display: block;
  font-size: 11px;
  padding: 2px 5px;
  border-radius: 3px;
  margin-bottom: 2px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  text-decoration: none;
  color: var(--text-primary);
  transition: filter var(--t-fast) var(--ease);
}
.cal-task-pill:hover { filter: brightness(.95); color: var(--text-primary); }
.cal-task-pill.done { opacity: .5; text-decoration: line-through; }
.cal-more { font-size: 10px; color: var(--text-tertiary); padding: 1px 4px; }

/* Week calendar */
.week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: var(--s2);
}

.week-col {
  background: var(--surface-0);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  min-height: 360px;
  display: flex;
  flex-direction: column;
}
.week-col.today { border-color: var(--primary); }

.week-col-head {
  padding: var(--s3);
  text-align: center;
  background: var(--surface-1);
  border-bottom: 1px solid var(--border);
}
.week-col.today .week-col-head { background: var(--primary-subtle); }
.week-col-dayname {
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 2px;
}
.week-col-daynum {
  font-size: var(--text-2xl);
  font-weight: var(--fw-bold);
  color: var(--text-primary);
  line-height: 1;
}
.week-col.today .week-col-daynum {
  background: var(--primary);
  color: white;
  width: 36px; height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xl);
}

.week-col-body { flex: 1; padding: var(--s2); display: flex; flex-direction: column; gap: var(--s1); }

.week-task-item {
  display: flex;
  align-items: flex-start;
  gap: var(--s1);
  padding: 4px 6px;
  border-radius: var(--r-sm);
  font-size: 11px;
  text-decoration: none;
  color: var(--text-secondary);
  background: var(--surface-1);
  border-left: 2px solid transparent;
  transition: all var(--t-fast) var(--ease);
  line-height: 1.3;
}
.week-task-item:hover { background: var(--primary-subtle); color: var(--primary); }
.week-task-item.done { opacity: .45; text-decoration: line-through; }
.week-task-item[data-priority="low"]    { border-left-color: var(--gray-400); }
.week-task-item[data-priority="medium"] { border-left-color: var(--primary); }
.week-task-item[data-priority="high"]   { border-left-color: var(--danger); }
.week-task-item[data-priority="urgent"] { border-left-color: var(--purple-500); }

.week-empty {
  text-align: center;
  padding: var(--s6) var(--s2);
  color: var(--text-disabled);
  font-size: var(--text-xs);
}

/* ── 16. MODAL ───────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 400;
  align-items: center;
  justify-content: center;
  padding: var(--s6);
  backdrop-filter: blur(2px);
}
.modal-overlay.open { display: flex; animation: fadeIn var(--t-normal) var(--ease); }

.modal-box {
  background: var(--surface-0);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  animation: scaleIn var(--t-normal) var(--ease);
}

.modal-header {
  padding: var(--s5) var(--s6);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  position: sticky;
  top: 0;
  background: var(--surface-0);
  z-index: 1;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
}
.modal-header h2 { font-size: var(--text-xl); font-weight: var(--fw-semibold); }

.modal-body { padding: var(--s6); }
.modal-footer {
  padding: var(--s4) var(--s6) var(--s5);
  display: flex;
  justify-content: flex-end;
  gap: var(--s3);
  border-top: 1px solid var(--border);
}

/* Confirm modal */
.confirm-modal { max-width: 400px; }
.confirm-modal .modal-body { text-align: center; padding-top: var(--s8); }
.confirm-icon { font-size: 48px; color: var(--warning); margin-bottom: var(--s3); display: block; }
.confirm-icon.danger { color: var(--danger); }
.confirm-title { font-size: var(--text-xl); font-weight: var(--fw-semibold); margin-bottom: var(--s2); }
.confirm-text { font-size: var(--text-sm); color: var(--text-secondary); }

/* ── 17. TOAST NOTIFICATIONS ─────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: var(--s6);
  right: var(--s6);
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  pointer-events: none;
}

.toast {
  background: var(--gray-900);
  color: white;
  padding: var(--s3) var(--s4);
  border-radius: var(--r-lg);
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  display: flex;
  align-items: center;
  gap: var(--s2);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: slideUpIn var(--t-normal) var(--ease);
  max-width: 360px;
}
.toast .material-icons { font-size: 18px; flex-shrink: 0; }
.toast.success { background: var(--green-600); }
.toast.error   { background: var(--danger-hover); }
.toast.info    { background: var(--blue-600); }
.toast.warning { background: #d97706; }
.toast.hiding  { animation: slideDownOut var(--t-normal) var(--ease) forwards; }

/* ── 18. FLASH MESSAGES ──────────────────────────────────── */
.flash-bar {
  max-width: var(--max-w);
  margin: var(--s3) auto 0;
  padding: 0 var(--s6);
  display: flex;
  flex-direction: column;
  gap: var(--s2);
}

.flash-msg {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s3) var(--s4);
  border-radius: var(--r-lg);
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  animation: slideIn var(--t-normal) var(--ease);
}
.flash-msg .material-icons { font-size: 18px; flex-shrink: 0; }
.flash-msg .flash-close {
  margin-left: auto;
  cursor: pointer;
  opacity: .7;
  background: none;
  border: none;
  color: inherit;
  display: flex;
}
.flash-msg .flash-close:hover { opacity: 1; }

.flash-msg.success { background: var(--success-subtle); color: var(--green-600); border: 1px solid #a8d5b5; }
.flash-msg.danger, .flash-msg.error { background: var(--danger-subtle); color: var(--danger-hover); border: 1px solid #f5b8b4; }
.flash-msg.info    { background: var(--primary-subtle); color: var(--blue-700); border: 1px solid var(--blue-100); }
.flash-msg.warning { background: var(--warning-subtle); color: #9a7300; border: 1px solid #fce8a3; }

[data-theme="dark"] .flash-msg.success { border-color: #2a5c3a; }
[data-theme="dark"] .flash-msg.danger  { border-color: #6b2020; }
[data-theme="dark"] .flash-msg.info    { border-color: #1e3a5f; }

/* ── 19. PAGE HEADER ─────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  margin-bottom: var(--s6);
  flex-wrap: wrap;
}
.page-header-left {}
.page-title {
  font-size: var(--text-3xl);
  font-weight: var(--fw-bold);
  color: var(--text-primary);
  line-height: 1.2;
}
.page-subtitle { font-size: var(--text-sm); color: var(--text-tertiary); margin-top: var(--s1); }

/* ── 20. PAGINATION ──────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  margin-top: var(--s6);
}
.pagination-info { font-size: var(--text-sm); color: var(--text-tertiary); }

/* ── 21. DETAIL PAGE ─────────────────────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--s4);
  margin: var(--s5) 0;
}

.detail-field {}
.detail-field-label {
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-bottom: var(--s2);
  display: flex;
  align-items: center;
  gap: var(--s1);
}
.detail-field-label .material-icons { font-size: 14px; }

/* ── 22. AUTH PAGES ──────────────────────────────────────── */
.auth-root {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--surface-1);
}

.auth-brand {
  background: linear-gradient(145deg, var(--blue-600) 0%, #5b5bd6 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--s12);
  color: white;
}
.auth-brand-logo { font-size: 80px; margin-bottom: var(--s6); }
.auth-brand-title { font-size: 36px; font-weight: var(--fw-bold); margin-bottom: var(--s3); text-align: center; }
.auth-brand-sub { font-size: var(--text-md); opacity: .85; text-align: center; line-height: 1.7; max-width: 360px; }
.auth-brand-features { margin-top: var(--s8); display: flex; flex-direction: column; gap: var(--s3); width: 100%; max-width: 340px; }
.auth-feature { display: flex; align-items: center; gap: var(--s3); font-size: var(--text-sm); opacity: .9; }
.auth-feature .material-icons { font-size: 20px; }

.auth-form-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--s12) var(--s8);
  overflow-y: auto;
}

.auth-card {
  width: 100%;
  max-width: 420px;
}

.auth-card-title { font-size: var(--text-3xl); font-weight: var(--fw-bold); margin-bottom: var(--s2); }
.auth-card-sub { font-size: var(--text-sm); color: var(--text-secondary); margin-bottom: var(--s8); }

.auth-link { color: var(--primary); font-weight: var(--fw-medium); }

.test-accounts {
  margin-top: var(--s5);
  padding-top: var(--s5);
  border-top: 1px solid var(--border);
}
.test-accounts-title {
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-bottom: var(--s3);
}
.test-account-btn {
  display: flex;
  align-items: center;
  gap: var(--s3);
  width: 100%;
  padding: var(--s3);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
  margin-bottom: var(--s2);
  color: var(--text-secondary);
  text-align: left;
  font-family: inherit;
}
.test-account-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-subtle); }
.test-account-btn strong { color: var(--text-primary); font-weight: var(--fw-semibold); }

/* ── 23. LANDING ─────────────────────────────────────────── */
.landing-hero-wrapper {
  background: linear-gradient(160deg, #e8f0fe 0%, #f3e8fd 50%, #e6f4ea 100%);
  padding-bottom: var(--s8);
  border-bottom: 1px solid var(--border);
}
[data-theme="dark"] .landing-hero-wrapper {
  background: linear-gradient(160deg, #1e2e45 0%, #2a1845 50%, #1a3028 100%);
}
.landing-hero {
  padding: var(--s16) var(--s6) var(--s12);
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
}
.landing-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  background: var(--primary-subtle);
  color: var(--primary);
  padding: var(--s1) var(--s3);
  border-radius: var(--r-full);
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: .5px;
  text-transform: uppercase;
  margin-bottom: var(--s4);
}
.landing-title {
  font-size: 52px;
  font-weight: var(--fw-bold);
  color: var(--text-primary);
  line-height: 1.1;
  letter-spacing: -1.5px;
  margin-bottom: var(--s5);
}
.landing-title em { color: var(--primary); font-style: normal; }
.landing-desc {
  font-size: var(--text-xl);
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: var(--s8);
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}
.landing-cta { display: flex; gap: var(--s3); justify-content: center; flex-wrap: wrap; }
.landing-btn-primary {
  padding: 14px var(--s8);
  font-size: var(--text-md);
  background: var(--primary);
  color: white;
  border-radius: var(--r-xl);
  border: none;
  font-weight: var(--fw-semibold);
  cursor: pointer;
  transition: all var(--t-normal) var(--ease);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  box-shadow: 0 4px 16px rgba(66,133,244,.35);
}
.landing-btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(66,133,244,.4); color: white; }
.landing-btn-secondary {
  padding: 14px var(--s8);
  font-size: var(--text-md);
  background: var(--surface-0);
  color: var(--text-primary);
  border-radius: var(--r-xl);
  border: 1px solid var(--border);
  font-weight: var(--fw-semibold);
  cursor: pointer;
  transition: all var(--t-normal) var(--ease);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
}
.landing-btn-secondary:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-2px); }

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--s5);
  max-width: 1100px;
  margin: 0 auto var(--s16);
  padding: 0 var(--s6);
}

.feature-card {
  background: var(--surface-0);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: var(--s6);
  box-shadow: var(--shadow-sm);
  transition: all var(--t-normal) var(--ease);
}
.feature-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-4px); }
.feature-card-icon {
  width: 48px; height: 48px;
  border-radius: var(--r-lg);
  background: var(--primary-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--s4);
}
.feature-card-icon .material-icons { color: var(--primary); font-size: 24px; }
.feature-card h3 { font-size: var(--text-lg); font-weight: var(--fw-semibold); margin-bottom: var(--s2); }
.feature-card p { font-size: var(--text-sm); color: var(--text-secondary); line-height: 1.7; }

/* Feature card icon color variants */
.feature-card--blue   .feature-card-icon { background: #e8f0fe; }
.feature-card--blue   .feature-card-icon .material-icons { color: #1a73e8; }
.feature-card--green  .feature-card-icon { background: #e6f4ea; }
.feature-card--green  .feature-card-icon .material-icons { color: #188038; }
.feature-card--purple .feature-card-icon { background: #f3e8fd; }
.feature-card--purple .feature-card-icon .material-icons { color: #7b1fa2; }
.feature-card--orange .feature-card-icon { background: #fff3e0; }
.feature-card--orange .feature-card-icon .material-icons { color: #e65100; }
.feature-card--teal   .feature-card-icon { background: #e0f7fa; }
.feature-card--teal   .feature-card-icon .material-icons { color: #00838f; }
.feature-card--indigo .feature-card-icon { background: #ede7f6; }
.feature-card--indigo .feature-card-icon .material-icons { color: #4527a0; }

/* ── 24. FOOTER ──────────────────────────────────────────── */
.app-footer {
  background: var(--surface-0);
  border-top: 1px solid var(--border);
  padding: var(--s4) var(--s6);
  text-align: center;
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}
.app-footer strong { color: var(--text-secondary); }

/* ── 25. SECTION HEADING ─────────────────────────────────── */
.section-heading {
  display: flex;
  align-items: center;
  gap: var(--s2);
  margin-bottom: var(--s4);
}
.section-heading h3 {
  font-size: var(--text-md);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
}
.section-heading .material-icons { font-size: 20px; color: var(--primary); }
.section-heading.danger .material-icons { color: var(--danger); }
.section-heading.danger h3 { color: var(--danger); }

/* ── 26. CATEGORIES ──────────────────────────────────────── */
.category-card {
  background: var(--surface-0);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s4) var(--s5);
  display: flex;
  align-items: center;
  gap: var(--s4);
  box-shadow: var(--shadow-xs);
  transition: all var(--t-normal) var(--ease);
  border-left: 3px solid transparent;
}
.category-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.category-swatch {
  width: 36px; height: 36px;
  border-radius: var(--r-md);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.category-swatch .material-icons { font-size: 20px; color: white; }
.category-name { font-size: var(--text-md); font-weight: var(--fw-semibold); flex: 1; }
.category-meta { font-size: var(--text-xs); color: var(--text-tertiary); margin-top: 2px; }

/* ── 27. REMINDERS ───────────────────────────────────────── */
.reminder-card {
  background: var(--surface-0);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s4) var(--s5);
  display: flex;
  align-items: center;
  gap: var(--s4);
  box-shadow: var(--shadow-xs);
  transition: all var(--t-normal) var(--ease);
}
.reminder-card:hover { box-shadow: var(--shadow-md); }
.reminder-icon {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--primary-subtle);
}
.reminder-icon .material-icons { color: var(--primary); font-size: 20px; }
.reminder-card.sent .reminder-icon { background: var(--surface-2); }
.reminder-card.sent .reminder-icon .material-icons { color: var(--text-tertiary); }
.reminder-info { flex: 1; min-width: 0; }
.reminder-task { font-size: var(--text-sm); font-weight: var(--fw-medium); }
.reminder-time { font-size: var(--text-xs); color: var(--text-tertiary); margin-top: 2px; }

/* ── 28. PROFILE ─────────────────────────────────────────── */
.profile-avatar-area {
  display: flex;
  align-items: center;
  gap: var(--s5);
  margin-bottom: var(--s8);
  padding-bottom: var(--s6);
  border-bottom: 1px solid var(--border);
}
.profile-avatar-icon { font-size: 64px; color: var(--primary); }
.profile-name { font-size: var(--text-2xl); font-weight: var(--fw-bold); }
.profile-meta { font-size: var(--text-sm); color: var(--text-tertiary); margin-top: var(--s1); }

/* ── 29. ANIMATIONS ──────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(.95) translateY(8px); }
  to   { opacity: 1; transform: scale(1)  translateY(0); }
}
@keyframes slideIn {
  from { opacity: 0; transform: translateX(-12px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes slideUpIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideDownOut {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(16px); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.animate-fade { animation: fadeIn var(--t-normal) var(--ease); }
.animate-scale { animation: scaleIn var(--t-normal) var(--ease); }
.animate-slide { animation: slideIn var(--t-normal) var(--ease); }

/* Stagger children */
.stagger-children > * { animation: slideIn var(--t-normal) var(--ease) both; }
.stagger-children > *:nth-child(1) { animation-delay: 0ms; }
.stagger-children > *:nth-child(2) { animation-delay: 40ms; }
.stagger-children > *:nth-child(3) { animation-delay: 80ms; }
.stagger-children > *:nth-child(4) { animation-delay: 120ms; }
.stagger-children > *:nth-child(5) { animation-delay: 160ms; }
.stagger-children > *:nth-child(n+6) { animation-delay: 200ms; }

/* Loading skeleton */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-1) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: skeleton-wave 1.4s infinite;
  border-radius: var(--r-md);
}
@keyframes skeleton-wave {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── 30. UTILITIES ───────────────────────────────────────── */
.flex        { display: flex; }
.flex-col    { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--s2); }
.gap-3 { gap: var(--s3); }
.gap-4 { gap: var(--s4); }
.mt-2 { margin-top: var(--s2); }
.mt-4 { margin-top: var(--s4); }
.mt-6 { margin-top: var(--s6); }
.mb-4 { margin-bottom: var(--s4); }
.mb-6 { margin-bottom: var(--s6); }
.text-sm { font-size: var(--text-sm); }
.text-xs { font-size: var(--text-xs); }
.text-secondary { color: var(--text-secondary); }
.text-tertiary  { color: var(--text-tertiary); }
.font-semibold  { font-weight: var(--fw-semibold); }
.truncate { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ── 31. RESPONSIVE ──────────────────────────────────────── */
@media (max-width: 1024px) {
  .sidebar { width: 220px; }
}

@media (max-width: 900px) {
  .header-nav { display: none; }
  .sidebar { display: none; }
  .app-main { flex-direction: column; }
  .auth-root { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .auth-form-panel { padding: var(--s8) var(--s6); min-height: 100vh; }
  .week-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 600px) {
  .app-main { padding: var(--s4); }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .landing-title { font-size: 36px; }
  .features-grid { grid-template-columns: 1fr; }
  .week-grid { grid-template-columns: repeat(2, 1fr); }
  .cal-cell { min-height: 60px; }
}

/* ============================================================
   DRIVE-STYLE LAYOUT — overrides
   ============================================================ */

:root {
  --rail-w: 256px;
  --topbar-h: 64px;
}

body { font-family: 'Google Sans', 'Inter', sans-serif; }

/* Hide the old top header completely on authed pages */
.drive-shell .app-header { display: none; }

.drive-shell {
  display: grid;
  grid-template-columns: var(--rail-w) 1fr;
  min-height: 100vh;
  background: var(--surface-1);
}

/* ── LEFT RAIL ─────────────────────────────────────────── */
.rail {
  background: var(--surface-0);
  border-right: 1px solid var(--border);
  padding: var(--s4) var(--s3);
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.rail-logo {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s2) var(--s3);
  text-decoration: none;
  margin-bottom: var(--s2);
}
.rail-logo-mark {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4285f4, #34a853 60%, #fbbc04);
  display: flex; align-items: center; justify-content: center;
  color: white;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
.rail-logo-mark .material-icons { font-size: 22px; }
.rail-logo-text {
  font-family: 'Google Sans', sans-serif;
  font-size: 20px;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: -.2px;
}

/* Create button (Drive-style big pill) */
.rail-create {
  display: inline-flex;
  align-items: center;
  gap: var(--s3);
  padding: 14px var(--s5);
  background: var(--surface-0);
  border: none;
  border-radius: var(--r-2xl);
  font-family: 'Google Sans', sans-serif;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  text-decoration: none;
  box-shadow:
    0 1px 3px rgba(0,0,0,.08),
    0 4px 8px rgba(0,0,0,.06);
  transition: box-shadow var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
  width: fit-content;
  margin: 0 var(--s2) var(--s4);
}
.rail-create:hover {
  background: #f6f9fe;
  box-shadow: 0 2px 6px rgba(0,0,0,.12), 0 6px 12px rgba(0,0,0,.08);
  color: var(--text-primary);
}
.rail-create .material-icons {
  font-size: 22px;
  background: linear-gradient(135deg, #4285f4, #ea4335 50%, #fbbc04);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
[data-theme="dark"] .rail-create { background: var(--surface-2); }
[data-theme="dark"] .rail-create:hover { background: var(--surface-1); }

/* Nav items */
.rail-nav { display: flex; flex-direction: column; gap: 2px; padding: 0; }
.rail-item {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: 10px var(--s4);
  border-radius: 0 var(--r-full) var(--r-full) 0;
  margin-right: var(--s2);
  font-family: 'Google Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
  white-space: nowrap;
}
.rail-item:hover { background: var(--surface-2); color: var(--text-primary); }
.rail-item.active {
  background: #c2e7ff;
  color: #001d35;
  font-weight: 600;
}
[data-theme="dark"] .rail-item.active {
  background: #004a77;
  color: #c2e7ff;
}

/* Colored icons (Google-style) */
.rail-item-icon {
  width: 28px; height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  flex-shrink: 0;
  color: white;
}
.rail-item-icon .material-icons { font-size: 18px; }
.rail-item-icon.i-home  { background: #1a73e8; }
.rail-item-icon.i-tasks { background: #34a853; }
.rail-item-icon.i-month { background: #ea4335; }
.rail-item-icon.i-week  { background: #fbbc04; }
.rail-item-icon.i-cat   { background: #9c27b0; }
.rail-item-icon.i-bell  { background: #ff6d00; }
.rail-item-icon.i-user  { background: #00838f; }

.rail-divider {
  height: 1px;
  background: var(--border);
  margin: var(--s3) var(--s2);
}
.rail-footer { margin-top: auto; }

/* ── DRIVE MAIN AREA ───────────────────────────────────── */
.drive-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

.topbar {
  height: var(--topbar-h);
  background: var(--surface-1);
  display: flex;
  align-items: center;
  gap: var(--s4);
  padding: 0 var(--s6);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid transparent;
}

/* Search pill in the center */
.topbar-search {
  flex: 1;
  max-width: 720px;
  height: 48px;
  background: #eef2f7;
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  padding: 0 var(--s4);
  gap: var(--s3);
  transition: background var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.topbar-search:focus-within {
  background: var(--surface-0);
  box-shadow: 0 1px 3px rgba(0,0,0,.1), 0 4px 12px rgba(0,0,0,.08);
}
[data-theme="dark"] .topbar-search { background: var(--surface-2); }
[data-theme="dark"] .topbar-search:focus-within { background: var(--surface-1); }

.topbar-search-icon {
  color: var(--text-tertiary);
  font-size: 22px;
  flex-shrink: 0;
}
.topbar-search input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 15px;
  font-family: inherit;
  color: var(--text-primary);
}
.topbar-search input::placeholder { color: var(--text-tertiary); }

.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--s2);
  margin-left: auto;
  flex-shrink: 0;
}

.topbar-iconbtn {
  width: 40px; height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  text-decoration: none;
  transition: background var(--t-fast) var(--ease);
}
.topbar-iconbtn:hover { background: var(--surface-2); color: var(--text-primary); }
.topbar-iconbtn .material-icons { font-size: 22px; }

.topbar-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4285f4, #9c27b0);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-family: 'Google Sans', sans-serif;
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 2px solid var(--surface-0);
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
  transition: transform var(--t-fast) var(--ease);
}
.topbar-avatar:hover { transform: scale(1.05); color: white; }

/* Content area */
.drive-content {
  flex: 1;
  padding: var(--s5) var(--s6) var(--s8);
  background: var(--surface-1);
  border-radius: var(--r-xl) 0 0 0;
  margin-top: 0;
}

/* Override .app-main inside drive-content to be more compact */
.drive-content .app-main {
  padding: 0;
  gap: var(--s5);
  max-width: none;
  margin: 0;
}

/* Make in-page sidebars feel like Drive filter panels */
.drive-content .sidebar-card {
  background: var(--surface-0);
  border: none;
  border-radius: var(--r-xl);
  box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 1px 3px rgba(0,0,0,.06);
}

/* Cards inside content area — Drive paper look */
.drive-content .card,
.drive-content .task-card,
.drive-content .stat-card,
.drive-content .feature-card,
.drive-content .category-card,
.drive-content .reminder-card,
.drive-content .calendar-grid,
.drive-content .week-col {
  background: var(--surface-0);
  border: 1px solid transparent;
  border-radius: var(--r-xl);
  box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 1px 3px rgba(0,0,0,.06);
}
.drive-content .task-card:hover,
.drive-content .stat-card:hover,
.drive-content .category-card:hover,
.drive-content .reminder-card:hover,
.drive-content .feature-card:hover {
  box-shadow: 0 2px 6px rgba(0,0,0,.08), 0 6px 12px rgba(0,0,0,.06);
  transform: translateY(-2px);
}

/* Page header inside Drive content */
.drive-content .page-title {
  font-family: 'Google Sans', sans-serif;
  font-weight: 400;
  font-size: 28px;
  letter-spacing: -.3px;
}

/* Drive footer */
.drive-footer {
  padding: var(--s5) var(--s6);
  text-align: center;
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  background: var(--surface-1);
}
.drive-footer strong { color: var(--text-secondary); }

/* Filter chips (Google Drive style) */
.chip-row {
  display: flex;
  gap: var(--s2);
  flex-wrap: wrap;
  margin-bottom: var(--s5);
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  padding: 6px var(--s3);
  background: var(--surface-0);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  text-decoration: none;
  transition: all var(--t-fast) var(--ease);
}
.filter-chip:hover { background: var(--surface-2); color: var(--text-primary); }
.filter-chip.active {
  background: #c2e7ff;
  border-color: #c2e7ff;
  color: #001d35;
}
.filter-chip .material-icons { font-size: 16px; }

/* ── PUBLIC HEADER (unauthed) ──────────────────────────── */
.public-header {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--s6);
  background: var(--surface-0);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.public-logo {
  display: flex;
  align-items: center;
  gap: var(--s2);
  text-decoration: none;
  font-family: 'Google Sans', sans-serif;
  font-size: 20px;
  font-weight: 500;
  color: var(--text-primary);
}
.public-logo .material-icons {
  font-size: 28px;
  background: linear-gradient(135deg, #4285f4, #34a853 60%, #fbbc04);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.public-header-right { display: flex; align-items: center; gap: var(--s2); }

/* Override old .app-header rules when nested in unauthed shell */
.app-wrapper .app-header { display: none; }

/* Responsive */
@media (max-width: 900px) {
  .drive-shell { grid-template-columns: 72px 1fr; }
  .rail-logo-text, .rail-create span:last-child, .rail-item span:not(.material-icons):not(.rail-item-icon) { display: none; }
  .rail-create { padding: 14px; }
  .rail-item { justify-content: center; padding: 10px; margin-right: 0; border-radius: 50%; }
  .rail-item-icon { margin: 0; }
}
@media (max-width: 600px) {
  .drive-shell { grid-template-columns: 1fr; }
  .rail { display: none; }
  .drive-content { padding: var(--s4); border-radius: 0; }
  .topbar { padding: 0 var(--s3); }
}

