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

:root {
  --teal: #2A9D8F;
  --teal-dark: #1f7a6e;
  --teal-light: #e8f5f3;
  --coral: #E76F51;
  --coral-dark: #c75a3e;
  --coral-light: #fdf0eb;
  --charcoal: #264653;
  --text-primary: #1a2e35;
  --text-secondary: #4a6572;
  --text-muted: #7a9099;
  --bg-light: #f8faf9;
  --bg-warm: #fdf6f0;
  --border: #e2ebe9;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.04);
  --radius: 14px;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-light);
  color: var(--text-primary);
  min-height: 100vh;
}

.w-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

/* NAV */
.w-nav {
  background: white;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.w-nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.w-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--charcoal);
}
.w-back-link {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.2s;
}
.w-back-link:hover { color: var(--teal); }

.w-auth-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 4px;
  background: var(--bg-light);
  border: 1.5px solid var(--border);
  border-radius: 100px;
}
.w-chip-photo {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}
.w-chip-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--charcoal);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.w-signout-btn {
  background: none;
  border: none;
  color: var(--coral);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color 0.15s;
}
.w-signout-btn:hover { color: var(--coral-dark); text-decoration: underline; }

/* HERO */
.w-hero {
  background: linear-gradient(135deg, var(--teal-light) 0%, var(--bg-warm) 100%);
  padding: 48px 0 40px;
  border-bottom: 1px solid var(--border);
}
.w-hero .w-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  flex-wrap: wrap;
}
.w-welcome-badge {
  display: inline-block;
  background: var(--teal);
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 12px;
}
.w-welcome-badge.senior { background: var(--coral); }
.w-heading {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  color: var(--charcoal);
  margin-bottom: 8px;
}
.w-heading span { color: var(--teal); }
.w-subheading {
  color: var(--text-secondary);
  font-size: 0.975rem;
  max-width: 420px;
  line-height: 1.6;
}
.w-hero-stats {
  display: flex;
  gap: 16px;
  flex-shrink: 0;
}
.w-stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 20px 24px;
  text-align: center;
  box-shadow: var(--shadow-md);
  min-width: 90px;
}
.w-stat-num {
  display: block;
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--teal);
  line-height: 1;
  margin-bottom: 4px;
}
.w-stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* DASHBOARD LAYOUT */
.w-dashboard {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  padding: 32px 24px;
  max-width: 1100px;
  margin: 0 auto;
}
@media (max-width: 860px) {
  .w-dashboard { grid-template-columns: 1fr; }
  .w-hero .w-container { flex-direction: column; align-items: flex-start; }
  .w-hero-stats { width: 100%; justify-content: flex-start; }
}

/* CARDS */
.w-card {
  background: white;
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  margin-bottom: 20px;
}
.w-card:last-child { margin-bottom: 0; }
.w-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.w-card-header h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}
.w-card-header h2 svg { color: var(--teal); flex-shrink: 0; }

/* BUTTONS */
.w-btn-sm {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
.w-btn-sm:active { transform: scale(0.97); }
.w-btn-teal { background: var(--teal); color: white; }
.w-btn-teal:hover { background: var(--teal-dark); }
.w-btn-coral { background: var(--coral); color: white; }
.w-btn-coral:hover { background: var(--coral-dark); }
.w-btn-full {
  width: 100%;
  padding: 11px 16px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.2s, transform 0.1s;
  margin-top: 16px;
}
.w-btn-full:active { transform: scale(0.98); }
.w-btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-secondary);
  border-radius: 10px;
  padding: 10px 20px;
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.w-btn-outline:hover { border-color: var(--teal); color: var(--teal); }

/* CALENDAR */
.calendar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.cal-month-label {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
}
.cal-nav-btn {
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: background 0.2s, color 0.2s;
}
.cal-nav-btn:hover { background: var(--teal-light); color: var(--teal); }
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-dow {
  text-align: center;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 0 8px;
}
.cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  position: relative;
  color: var(--text-primary);
  transition: background 0.15s, color 0.15s;
  border: none;
  background: transparent;
  font-family: 'Inter', sans-serif;
}
.cal-day:hover:not(.cal-empty):not(.cal-other) { background: var(--teal-light); color: var(--teal); }
.cal-day.cal-today { background: var(--teal); color: white; font-weight: 700; }
.cal-day.cal-today:hover { background: var(--teal-dark); }
.cal-day.cal-has-appt::after {
  content: '';
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--coral);
}
.cal-day.cal-today.cal-has-appt::after { background: white; }
.cal-day.cal-other { color: var(--text-muted); cursor: default; }
.cal-day.cal-empty { cursor: default; }
.cal-day.cal-selected { background: var(--teal-light); color: var(--teal); font-weight: 700; outline: 2px solid var(--teal); }

/* APPOINTMENTS */
.appt-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.appt-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: var(--bg-light);
  border-radius: 10px;
  border: 1px solid var(--border);
}
.appt-date-badge {
  flex-shrink: 0;
  width: 44px;
  text-align: center;
  background: var(--teal-light);
  border-radius: 8px;
  padding: 6px 4px;
}
.appt-date-badge .appt-month {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--teal);
  letter-spacing: 0.04em;
}
.appt-date-badge .appt-day {
  display: block;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--teal);
  line-height: 1.1;
}
.appt-info { flex: 1; min-width: 0; }
.appt-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.appt-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
}
.appt-actions { display: flex; gap: 6px; }
.appt-del-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  transition: color 0.15s, background 0.15s;
}
.appt-del-btn:hover { color: var(--coral); background: var(--coral-light); }
.appt-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
  padding: 20px 0;
}

/* HOURS */
.hours-goal { margin-bottom: 16px; }
.hours-goal-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  margin-bottom: 6px;
}
#hours-done { font-weight: 700; color: var(--teal); }
#hours-total { color: var(--text-muted); }
.hours-bar {
  height: 8px;
  background: var(--bg-light);
  border-radius: 99px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.hours-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--teal), #4ecdc4);
  border-radius: 99px;
  width: 0%;
  transition: width 1s cubic-bezier(0.19,1,0.22,1);
}
.hours-log { list-style: none; display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }
.hours-log-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  padding: 8px 10px;
  background: var(--bg-light);
  border-radius: 8px;
}
.hours-log-item .log-activity { color: var(--text-primary); font-weight: 500; }
.hours-log-item .log-hrs { color: var(--teal); font-weight: 700; }
.hours-log-item .log-date { color: var(--text-muted); font-size: 0.73rem; }

/* SCHOOL CARD */
.school-name-display {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.school-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--teal);
  font-weight: 600;
  margin-bottom: 10px;
}
.school-note {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* MATCH CARD */
.match-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--coral-light);
  border-radius: 10px;
  margin-bottom: 4px;
}
.match-avatar { flex-shrink: 0; }
.match-name { font-weight: 700; font-size: 0.9rem; color: var(--text-primary); margin-bottom: 2px; }
.match-detail { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 3px; }
.match-activity { font-size: 0.75rem; color: var(--coral); font-weight: 600; }

/* MODAL */
.w-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26,46,53,0.5);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(2px);
}
.w-modal-overlay[hidden] { display: none; }
.w-modal {
  background: white;
  border-radius: var(--radius);
  padding: 28px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.18);
  animation: modalIn 0.25s cubic-bezier(0.19,1,0.22,1);
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.w-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.w-modal-header h3 { font-size: 1.05rem; font-weight: 700; color: var(--text-primary); }
.w-modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  transition: color 0.15s;
}
.w-modal-close:hover { color: var(--text-primary); }
.w-modal-form { display: flex; flex-direction: column; gap: 14px; }
.w-form-group { display: flex; flex-direction: column; gap: 5px; }
.w-form-group label { font-size: 0.82rem; font-weight: 600; color: var(--text-secondary); }
.w-form-group input,
.w-form-group select,
.w-form-group textarea {
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  color: var(--text-primary);
  background: white;
  transition: border-color 0.2s;
  outline: none;
}
.w-form-group input:focus,
.w-form-group select:focus,
.w-form-group textarea:focus { border-color: var(--teal); }
.w-form-group textarea { resize: vertical; min-height: 60px; }
.w-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 4px;
}
.w-modal-actions .w-btn-teal {
  padding: 10px 22px;
  border-radius: 10px;
  border: none;
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

/* SKILLS CARD */
.skills-list { list-style: none; display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.skill-item { display: flex; align-items: center; gap: 10px; font-size: 0.875rem; color: var(--text-primary); }
.skill-dot { flex-shrink: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--coral); }
.skill-note { font-size: 0.78rem; color: var(--text-muted); font-style: italic; line-height: 1.5; }

/* RESOURCES CARD */
.resource-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.resource-item { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; background: var(--bg-light); border-radius: 8px; gap: 8px; }
.resource-name { font-size: 0.82rem; font-weight: 600; color: var(--text-primary); }
.resource-phone { font-size: 0.78rem; color: var(--teal); font-weight: 500; white-space: nowrap; }

/* FOOTER */
.w-footer {
  margin-top: 8px;
  padding: 24px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

.match-explainer {
  margin-top: 14px;
  padding: 12px;
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.match-explainer-label {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--coral);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}
.w-chat-modal {
  max-width: 680px;
  width: min(92vw, 680px);
  padding: 0;
  overflow: hidden;
  border-radius: 20px;
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-header-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--teal-light), var(--coral-light));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.chat-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.chat-subtitle {
  margin: 2px 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.chat-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
}

.chat-close-btn:hover {
  background: var(--bg-light);
  color: var(--text-primary);
}

.chat-thread {
  height: 420px;
  overflow-y: auto;
  padding: 18px 18px 12px;
  background: linear-gradient(180deg, #fbfdfc 0%, #f6faf9 100%);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-row {
  display: flex;
}

.chat-row.me {
  justify-content: flex-end;
}

.chat-row.them {
  justify-content: flex-start;
}

.chat-bubble {
  max-width: 72%;
  padding: 10px 13px;
  border-radius: 16px;
  font-size: 0.9rem;
  line-height: 1.45;
  box-shadow: var(--shadow-sm);
  word-wrap: break-word;
}

.chat-row.me .chat-bubble {
  background: var(--teal);
  color: white;
  border-bottom-right-radius: 6px;
}

.chat-row.them .chat-bubble {
  background: white;
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-bottom-left-radius: 6px;
}

.chat-meta {
  font-size: 0.72rem;
  margin-top: 4px;
  opacity: 0.75;
}

.chat-row.me .chat-meta {
  text-align: right;
}

.chat-form {
  display: flex;
  gap: 10px;
  padding: 16px;
  background: white;
}

.chat-input {
  flex: 1;
  min-height: 54px;
  max-height: 120px;
  resize: vertical;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  outline: none;
}

.chat-input:focus {
  border-color: var(--teal);
}

.chat-send-btn {
  align-self: flex-end;
  background: var(--teal);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 12px 18px;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
}

.chat-send-btn:hover {
  background: var(--teal-dark);
}

@media (max-width: 640px) {
  .w-chat-modal {
    width: 95vw;
  }

  .chat-thread {
    height: 360px;
  }

  .chat-bubble {
    max-width: 84%;
  }

  .chat-form {
    flex-direction: column;
  }

  .chat-send-btn {
    width: 100%;
  }
}
.match-diagnosis,
.match-reason {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 8px;
}

.match-confidence-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 8px;
  margin-bottom: 6px;
}

.match-confidence-bar {
  width: 100%;
  height: 8px;
  background: #f1f4f3;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.match-confidence-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--coral), #f4a261);
  border-radius: 999px;
  transition: width 0.8s ease;
}

