:root {
  --bg-main: #f8fafc;
  --bg-surface: #ffffff;
  --border-color: #e2e8f0;
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  
  --color-max: #2563eb;
  --color-max-bg: #eff6ff;
  --color-max-border: #bfdbfe;
  
  --color-arthur: #059669;
  --color-arthur-bg: #ecfdf5;
  --color-arthur-border: #a7f3d0;
  
  --color-shared: #7c3aed;
  --color-shared-bg: #f5f3ff;
  
  --color-warning: #ea580c;
  --color-warning-bg: #fff7ed;
  --color-danger: #dc2626;
  --color-danger-bg: #fef2f2;
  --color-success: #16a34a;
  
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 6px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
  background-color: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 40;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text-primary);
  text-decoration: none;
  cursor: pointer;
}

.brand-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.15rem;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

.controls-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Filters */
.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.filter-pill:hover {
  background: #f1f5f9;
}

.filter-pill.active-all {
  background: var(--text-primary);
  color: white;
  border-color: var(--text-primary);
}

.filter-pill.active-max {
  background: var(--color-max-bg);
  color: var(--color-max);
  border-color: var(--color-max-border);
}

.filter-pill.active-arthur {
  background: var(--color-arthur-bg);
  color: var(--color-arthur);
  border-color: var(--color-arthur-border);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.dot-max { background: var(--color-max); }
.dot-arthur { background: var(--color-arthur); }

/* Parent Avatar Badges */
.avatar-badge {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
}

.avatar-badge:hover {
  transform: scale(1.08);
  box-shadow: var(--shadow-sm);
}

.avatar-badge.active-assignee {
  outline: 2px solid var(--text-primary);
  outline-offset: 1px;
}

/* View Switcher */
.view-switcher {
  display: flex;
  background: #f1f5f9;
  padding: 4px;
  border-radius: var(--radius-md);
  gap: 4px;
}

.view-btn {
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.view-btn.active {
  background: white;
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.btn-primary {
  background: #2563eb;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s ease, transform 0.1s ease;
}

.btn-primary:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}

/* Subheader & Date Nav */
.subheader {
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.date-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.date-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  min-width: 200px;
}

.nav-arrow-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  color: var(--text-secondary);
  transition: all 0.15s ease;
}

.nav-arrow-btn:hover {
  background: #f1f5f9;
  color: var(--text-primary);
}

.today-btn {
  border: 1px solid var(--border-color);
  background: white;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.today-btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

/* Layout Main */
.main-content {
  flex: 1;
  padding: 0 24px 24px;
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
}

@media (max-width: 1024px) {
  .main-content {
    grid-template-columns: 1fr;
  }
  .sidebar {
    order: -1;
  }
}

/* Calendar Container */
.calendar-container {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.calendar-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color);
  text-align: center;
  padding: 12px 0;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: repeat(5, minmax(110px, 1fr));
  flex: 1;
}

.calendar-cell {
  border-right: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  padding: 8px;
  min-height: 110px;
  position: relative;
  background: white;
  transition: background 0.1s ease;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.calendar-cell:nth-child(7n) {
  border-right: none;
}

.calendar-cell.inactive-month {
  background: #fbfcfe;
  color: var(--text-muted);
}

.calendar-cell.is-today {
  background: #f0f7ff;
}

.cell-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.day-num {
  font-size: 0.85rem;
  font-weight: 600;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.is-today .day-num {
  background: #2563eb;
  color: white;
}

/* Event Cards on Calendar */
.event-card {
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  gap: 2px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  border-left: 3px solid transparent;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.event-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.event-card.max {
  background: var(--color-max-bg);
  color: #1d4ed8;
  border-left-color: var(--color-max);
}

.event-card.arthur {
  background: var(--color-arthur-bg);
  color: #047857;
  border-left-color: var(--color-arthur);
}

.event-card.both {
  background: var(--color-shared-bg);
  color: var(--color-shared);
  border-left-color: var(--color-shared);
}

.event-card.urgent {
  background: var(--color-warning-bg);
  color: #c2410c;
  border-left-color: var(--color-warning);
}

.event-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.7rem;
  font-weight: 500;
  opacity: 0.85;
}

/* List / Table View */
.list-container {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  display: none;
}

.list-section {
  margin-bottom: 28px;
}

.section-header {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.task-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin-bottom: 8px;
  background: white;
  transition: all 0.15s ease;
  cursor: pointer;
}

.task-row:hover {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-sm);
}

.task-row.is-completed {
  opacity: 0.55;
  background: #f8fafc;
}

.task-row.is-completed .task-title {
  text-decoration: line-through;
  color: var(--text-muted);
}

.task-check {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  cursor: pointer;
  accent-color: #2563eb;
}

.task-info {
  flex: 1;
}

.task-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.task-sub {
  font-size: 0.75rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 3px;
  flex-wrap: wrap;
}

.pill-tag {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 9999px;
  display: inline-block;
}

/* Sidebar Widgets */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.widget-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.widget-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.badge-count {
  background: #fee2e2;
  color: #b91c1c;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 9999px;
}

.action-alert-box {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 10px;
}

.alert-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 700;
  color: #9a3412;
  margin-bottom: 4px;
}

.alert-body {
  font-size: 0.85rem;
  font-weight: 600;
  color: #431407;
  margin-bottom: 8px;
}

.btn-action-sm {
  width: 100%;
  background: #ea580c;
  color: white;
  border: none;
  padding: 7px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-action-sm:hover {
  background: #c2410c;
}

/* AI Tab View */
.ai-tab-container {
  display: none;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  padding: 24px;
}

.dropzone {
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-lg);
  padding: 36px 20px;
  text-align: center;
  background: #f8fafc;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 16px;
}

.dropzone:hover {
  border-color: #2563eb;
  background: #eff6ff;
}

.candidate-card {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
  transition: border-color 0.15s ease;
}

.candidate-card:hover {
  border-color: #94a3b8;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.modal-card {
  background: white;
  width: 100%;
  max-width: 520px;
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-lg);
  animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-secondary);
}

.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  margin-bottom: 5px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s ease;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.btn-group {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.btn-secondary {
  flex: 1;
  padding: 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: white;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-secondary:hover {
  background: #f8fafc;
}

.btn-danger {
  padding: 10px 16px;
  border-radius: var(--radius-md);
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #dc2626;
  font-weight: 600;
  cursor: pointer;
}

.btn-danger:hover {
  background: #fee2e2;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 150;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: #0f172a;
  color: white;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  animation: toastSlideUp 0.25s ease;
}

@keyframes toastSlideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* User Profile Chip in Header */
.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f1f5f9;
  border: 1px solid var(--border-color);
  padding: 4px 12px 4px 6px;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.user-chip-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #4338ca;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
}

/* Login Screen Overlay */
.login-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}

.login-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  max-width: 440px;
  width: 100%;
  padding: 32px 28px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  animation: loginFadeIn 0.3s ease-out;
}

@keyframes loginFadeIn {
  from { opacity: 0; transform: scale(0.96) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.login-header {
  text-align: center;
  margin-bottom: 24px;
}

.login-brand-icon {
  font-size: 2.8rem;
  margin-bottom: 8px;
}

.login-header h2 {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.login-header p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 6px;
  line-height: 1.4;
}

.login-error-alert {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.quick-parents-section {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 14px;
  margin-bottom: 16px;
}

.quick-parents-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 10px;
}

.quick-parents-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.quick-parent-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: white;
  border: 1px solid var(--border-color);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s ease;
}

.quick-parent-btn:hover {
  border-color: #2563eb;
  background: #eff6ff;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.quick-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.quick-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
}

.quick-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.login-divider {
  display: flex;
  align-items: center;
  margin: 18px 0;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

.login-divider span {
  padding: 0 10px;
  text-transform: uppercase;
  font-weight: 600;
}

/* Multi-Step Onboarding Wizard */
.onboarding-card {
  background: white;
  width: 100%;
  max-width: 580px;
  border-radius: var(--radius-xl);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  padding: 32px;
  animation: modalPop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.onboarding-header {
  text-align: center;
  margin-bottom: 24px;
}

.stepper-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  position: relative;
}

.stepper-bar::before {
  content: '';
  position: absolute;
  top: 15px;
  left: 30px;
  right: 30px;
  height: 2px;
  background: #e2e8f0;
  z-index: 0;
}

.step-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  position: relative;
  z-index: 1;
  background: white;
  padding: 0 8px;
}

.step-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #f1f5f9;
  border: 2px solid #cbd5e1;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  transition: all 0.2s ease;
}

.step-node.active .step-circle {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

.step-node.completed .step-circle {
  background: #10b981;
  border-color: #10b981;
  color: white;
}

.step-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
}

.step-node.active .step-label {
  color: var(--primary);
  font-weight: 700;
}

.step-node.completed .step-label {
  color: #059669;
}

.color-swatch-picker {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.color-swatch {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.color-swatch:hover {
  transform: scale(1.1);
}

.color-swatch.selected {
  border-color: #0f172a;
  transform: scale(1.15);
}

.added-item-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  margin-bottom: 8px;
}

.onboarding-btn-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 24px;
  gap: 12px;
}
