/* ── Magnifico Wellness Coach Dashboard ── */
/* Brand colors: Deep Teal #003B4A, Emerald #009877, Amber #F5A800, Coral #FF4713, Peach #FFBE9F, Cream #F2F0EC */

:root {
  --teal:    #003B4A;
  --emerald: #009877;
  --amber:   #F5A800;
  --coral:   #FF4713;
  --peach:   #FFBE9F;
  --cream:   #F2F0EC;

  --bg:        #F5F4F0;
  --surface:   #FFFFFF;
  --surface-2: #F9F8F5;
  --border:    #E2DFD8;
  --divider:   #EDEBE5;

  --text:       #1A2E35;
  --text-muted: #5A6E75;
  --text-faint: #9AADB5;

  --font-display: 'Zodiak', Georgia, serif;
  --font-body:    'Work Sans', 'Helvetica Neue', sans-serif;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 3px rgba(0,59,74,0.07);
  --shadow-md: 0 4px 14px rgba(0,59,74,0.09);
  --shadow-lg: 0 12px 32px rgba(0,59,74,0.12);

  --sidebar-w: 220px;
  --transition: 160ms cubic-bezier(0.16,1,0.3,1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; font-size: 16px; }
body {
  font-family: var(--font-body);
  font-size: 0.9375rem;
  color: var(--text);
  background: var(--bg);
  min-height: 100dvh;
}
button { cursor: pointer; font: inherit; border: none; background: none; }
input { font: inherit; }

/* ── Login ─────────────────────────────────────────────── */
.login-screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--teal) 0%, #005566 50%, #007a60 100%);
  padding: 1.5rem;
}

.login-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2.5rem 2rem;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.login-logo { display: flex; justify-content: center; margin-bottom: 1rem; }

.login-title {
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--teal);
  letter-spacing: -0.01em;
}
.login-subtitle {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-top: 0.25rem;
  margin-bottom: 1.75rem;
}

.login-form { text-align: left; }
.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.375rem;
  letter-spacing: 0.01em;
}
.form-input {
  display: block;
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  color: var(--text);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  margin-bottom: 1rem;
}
.form-input:focus {
  border-color: var(--emerald);
  box-shadow: 0 0 0 3px rgba(0,152,119,0.12);
}
.form-error {
  color: #C0392B;
  font-size: 0.8125rem;
  margin-bottom: 0.75rem;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.375rem;
  background: var(--teal);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-weight: 600;
  transition: background var(--transition), box-shadow var(--transition);
  text-decoration: none;
}
.btn-primary:hover { background: #004d62; box-shadow: var(--shadow-sm); }
.btn-primary:disabled { opacity: 0.6; pointer-events: none; }
.btn-primary.full-width { width: 100%; }

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.375rem 0;
  transition: color var(--transition);
}
.btn-back:hover { color: var(--teal); }

.btn-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  background: var(--surface);
  transition: background var(--transition), color var(--transition);
}
.btn-icon:hover { background: var(--bg); color: var(--teal); }

.btn-danger-sm {
  padding: 0.375rem 0.875rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #C0392B;
  border: 1.5px solid #F5C6C2;
  border-radius: var(--radius-sm);
  background: #FEF5F4;
  transition: background var(--transition), border-color var(--transition);
}
.btn-danger-sm:hover { background: #FDDBD8; border-color: #E8A9A5; }

/* ── App layout ───────────────────────────────────────────── */
.app {
  display: flex;
  min-height: 100dvh;
}

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--teal);
  color: #fff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow-y: auto;
}

.sidebar-header {
  padding: 1.5rem 1.25rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #fff;
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.3;
}
.sidebar-logo strong { font-weight: 700; }

.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5625rem 0.75rem;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.7);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
  width: 100%;
  text-align: left;
}
.nav-item:hover, .nav-item.active {
  background: rgba(255,255,255,0.12);
  color: #fff;
}
.nav-item.active { font-weight: 600; }

.sidebar-footer {
  padding: 0.75rem;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.logout-btn { color: rgba(255,255,255,0.55); font-size: 0.875rem; }
.logout-btn:hover { color: rgba(255,255,255,0.9); }

/* ── Main content ─────────────────────────────────────────── */
.main-content {
  flex: 1;
  min-width: 0;
  padding: 2rem 2.5rem;
  overflow-y: auto;
}

.view { max-width: 960px; margin: 0 auto; }

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  gap: 1rem;
}

.view-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--teal);
  letter-spacing: -0.01em;
}
.view-subtitle { color: var(--text-muted); font-size: 0.875rem; margin-top: 0.125rem; }

/* ── Skeleton / loading ───────────────────────────────────── */
.loading-state {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.skeleton-row {
  height: 80px;
  background: linear-gradient(90deg, var(--divider) 25%, var(--bg) 50%, var(--divider) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: var(--radius-md);
}
@keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

/* ── Empty state ──────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem 2rem;
  gap: 1rem;
  color: var(--text-muted);
}
.empty-state p { max-width: 380px; font-size: 0.9375rem; line-height: 1.6; }
.empty-state.inline { padding: 2rem; }

/* ── Clients grid ─────────────────────────────────────────── */
.clients-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.client-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  cursor: pointer;
  transition: box-shadow var(--transition), border-color var(--transition), transform var(--transition);
  position: relative;
  overflow: hidden;
}
.client-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--type-color, var(--emerald));
}
.client-card:hover {
  box-shadow: var(--shadow-md);
  border-color: rgba(0,152,119,0.25);
  transform: translateY(-2px);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.875rem;
}
.type-badge {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.type-badge.large { width: 52px; height: 52px; font-size: 1.375rem; }

.card-meta { flex: 1; min-width: 0; }
.card-type-name {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--type-color, var(--emerald));
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-last-active { display: block; font-size: 0.75rem; color: var(--text-faint); }

.card-name {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  margin-bottom: 0.125rem;
}
.card-email { font-size: 0.8125rem; color: var(--text-muted); margin-bottom: 1rem; }

/* Progress */
.card-progress { margin-bottom: 1rem; }
.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.375rem;
}
.progress-bar {
  height: 5px;
  background: var(--divider);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}
.progress-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.6s ease;
  background: var(--emerald);
}
.milestone-dots {
  display: flex;
  gap: 0.375rem;
}
.milestone-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
  transition: background var(--transition), border-color var(--transition);
}
.milestone-dot.done { border-color: transparent; }

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.75rem;
  border-top: 1px solid var(--divider);
}
.field-count { font-size: 0.8125rem; color: var(--text-muted); }
.card-chevron { font-size: 1.25rem; color: var(--text-faint); line-height: 1; }

/* ── Client detail ────────────────────────────────────────── */
.detail-hero {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 1.5rem 1.75rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.detail-hero-left { display: flex; align-items: center; gap: 1rem; }
.detail-name {
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--teal);
  margin-bottom: 0.125rem;
}
.detail-email { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 0.25rem; }
.detail-type-name { font-size: 0.8125rem; font-weight: 600; color: var(--type-color, var(--emerald)); letter-spacing: 0.02em; text-transform: uppercase; }

.detail-stats {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.stat { text-align: center; }
.stat-value { display: block; font-weight: 700; font-size: 1.0625rem; color: var(--text); line-height: 1.2; }
.stat-label { display: block; font-size: 0.75rem; color: var(--text-muted); margin-top: 0.125rem; }

/* Milestone progress row */
.detail-milestones {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.ms-item {
  flex: 1;
  min-width: 150px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
}
.ms-item.done { border-color: var(--ms-color, var(--emerald)); color: var(--text); }
.ms-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
}
.ms-badge {
  margin-left: auto;
  padding: 0.125rem 0.5rem;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--divider);
  color: var(--text-muted);
}
.ms-badge.pending { opacity: 0.6; }

/* Response sections */
.response-section {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  overflow: hidden;
}
.response-section-title {
  padding: 0.875rem 1.25rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--divider);
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--teal);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.response-list { padding: 0.25rem 0; }
.response-item {
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid var(--divider);
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 0.25rem 1rem;
}
.response-item:last-child { border-bottom: none; }
.response-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  grid-column: 1;
  grid-row: 1;
}
.response-value {
  font-size: 0.9375rem;
  color: var(--text);
  line-height: 1.55;
  grid-column: 1;
  grid-row: 2;
}
.response-time {
  font-size: 0.75rem;
  color: var(--text-faint);
  white-space: nowrap;
  grid-column: 2;
  grid-row: 1 / 3;
  align-self: center;
}

/* ── Export card ──────────────────────────────────────────── */
.export-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 2.5rem;
  max-width: 480px;
  text-align: center;
}
.export-icon {
  width: 64px; height: 64px;
  border-radius: var(--radius-md);
  background: rgba(0,152,119,0.08);
  color: var(--emerald);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1.25rem;
}
.export-card h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--teal);
  margin-bottom: 0.5rem;
}
.export-card p {
  font-size: 0.9375rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 1.5rem;
  max-width: 100%;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 680px) {
  .sidebar { display: none; }
  .main-content { padding: 1.25rem 1rem; }
  .detail-hero { flex-direction: column; }
  .detail-stats { gap: 1rem; }
  .clients-grid { grid-template-columns: 1fr; }
}
